Commit 7e4b3b75 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Reland "Serialize 'oblique' computed values for 'font-style'"

Handling of 'oblique' values were missing in
ComputedStyleUtils::ValueForFontStyle - serialize as 'oblique <angle>'.
Because of this the return value needs to be widened to CSSValue.

Expectations for css/css-fonts/variations/font-shorthand.html updated.

TBR=drott@chromium.org

Bug: 809935, 809938
Change-Id: I753324776ba080820bc5c4a14e8aff6237ee5d12
Reviewed-on: https://chromium-review.googlesource.com/995793Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#548143}
parent a91041ae
...@@ -2260,9 +2260,8 @@ crbug.com/626703 [ Debug ] external/wpt/html/semantics/tabular-data/processing-m ...@@ -2260,9 +2260,8 @@ crbug.com/626703 [ Debug ] external/wpt/html/semantics/tabular-data/processing-m
crbug.com/666993 external/wpt/requestidlecallback/callback-idle-periods.html [ Timeout ] crbug.com/666993 external/wpt/requestidlecallback/callback-idle-periods.html [ Timeout ]
# Crashes with DCHECK enabled, but not on normal Release builds. # Crashes with DCHECK enabled, but not on normal Release builds.
crbug.com/828746 external/wpt/css/css-fonts/variations/font-shorthand.html [ Pass Crash Failure ] crbug.com/809935 external/wpt/css/css-fonts/variations/font-style-interpolation.html [ Timeout ]
crbug.com/828746 external/wpt/css/css-fonts/variations/font-style-interpolation.html [ Pass Crash Timeout ] crbug.com/828748 external/wpt/css/css-fonts/variations/font-weight-lighter-bolder.html [ Pass Crash Failure ]
crbug.com/828747 external/wpt/css/css-fonts/variations/font-weight-lighter-bolder.html [ Pass Crash Failure ]
crbug.com/626703 external/wpt/css/css-ui/text-overflow-011.html [ Failure Crash Pass ] crbug.com/626703 external/wpt/css/css-ui/text-overflow-011.html [ Failure Crash Pass ]
crbug.com/626703 external/wpt/workers/opaque-origin.html [ Failure Crash Timeout ] crbug.com/626703 external/wpt/workers/opaque-origin.html [ Failure Crash Timeout ]
crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-quirks-mode.html [ Pass Crash ] crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-quirks-mode.html [ Pass Crash ]
......
This is a testharness.js-based test.
PASS Font shorthand: Font size specified as calc()
PASS Font shorthand: Font weight specified as number
PASS Font shorthand: Font weight specified as number, value less than 1
PASS Font shorthand: Font weight specified as number, value greater than 1000
PASS Font shorthand: Font weight specified as calc()
FAIL Font shorthand: Font weight specified as calc(), value smaller than 1 assert_equals: Font shorthand expected weight: Font weight specified as calc(), value smaller than 1 expected "1" but got "400"
FAIL Font shorthand: Font weight specified as calc(), value greater than 1000 assert_equals: Font shorthand expected weight: Font weight specified as calc(), value greater than 1000 expected "1000" but got "400"
PASS Font shorthand: 'oblique' with positive angle
PASS Font shorthand: 'oblique' with hegative angle
FAIL Font shorthand: 'oblique' without slant angle assert_equals: Font shorthand expected style: 'oblique' without slant angle expected "oblique" but got "italic"
FAIL Font shorthand: 'oblique' with negative angle, value out of range assert_equals: Font shorthand: 'oblique' with negative angle, value out of range expected false but got true
FAIL Font shorthand: 'oblique' with positive angle, value out of range assert_equals: Font shorthand: 'oblique' with positive angle, value out of range expected false but got true
FAIL Font shorthand: 'oblique' followed by valid small weight assert_equals: Font shorthand expected style: 'oblique' followed by valid small weight expected "oblique" but got "italic"
FAIL Font shorthand: 'oblique' followed by valid large weight assert_equals: Font shorthand expected style: 'oblique' followed by valid large weight expected "oblique" but got "italic"
PASS Font shorthand: 'oblique' with positive angle followed by valid weight
PASS Font shorthand: 'oblique' with negative angle followed by valid weight
FAIL Font shorthand: 'oblique' followed by valid calc() weight assert_equals: Font shorthand expected style: 'oblique' followed by valid calc() weight expected "oblique" but got "italic"
PASS Font shorthand: 'oblique' with angle followed by valid calc() weight
FAIL Font shorthand: 'oblique' followed by a to-be-clamped calc() weight assert_equals: Font shorthand expected style: 'oblique' followed by a to-be-clamped calc() weight expected "oblique" but got "italic"
FAIL Font shorthand: calc() weight folowed by 'oblique' assert_equals: Font shorthand expected style: calc() weight folowed by 'oblique' expected "oblique" but got "italic"
PASS Font shorthand: calc() weight folowed by 'oblique' and slant angle
FAIL Font shorthand: To-be-clamped calc() weight folowed by 'oblique' and slant angle assert_equals: Font shorthand: To-be-clamped calc() weight folowed by 'oblique' and slant angle expected true but got false
Harness: the test ran to completion.
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "core/css/CSSCounterValue.h" #include "core/css/CSSCounterValue.h"
#include "core/css/CSSCustomIdentValue.h" #include "core/css/CSSCustomIdentValue.h"
#include "core/css/CSSFontFamilyValue.h" #include "core/css/CSSFontFamilyValue.h"
#include "core/css/CSSFontStyleRangeValue.h"
#include "core/css/CSSFunctionValue.h" #include "core/css/CSSFunctionValue.h"
#include "core/css/CSSGridLineNamesValue.h" #include "core/css/CSSGridLineNamesValue.h"
#include "core/css/CSSInitialValue.h" #include "core/css/CSSInitialValue.h"
...@@ -745,8 +746,7 @@ CSSPrimitiveValue* ComputedStyleUtils::ValueForFontStretch( ...@@ -745,8 +746,7 @@ CSSPrimitiveValue* ComputedStyleUtils::ValueForFontStretch(
CSSPrimitiveValue::UnitType::kPercentage); CSSPrimitiveValue::UnitType::kPercentage);
} }
CSSIdentifierValue* ComputedStyleUtils::ValueForFontStyle( CSSValue* ComputedStyleUtils::ValueForFontStyle(const ComputedStyle& style) {
const ComputedStyle& style) {
FontSelectionValue angle = style.GetFontDescription().Style(); FontSelectionValue angle = style.GetFontDescription().Style();
if (angle == NormalSlopeValue()) { if (angle == NormalSlopeValue()) {
return CSSIdentifierValue::Create(CSSValueNormal); return CSSIdentifierValue::Create(CSSValueNormal);
...@@ -756,8 +756,14 @@ CSSIdentifierValue* ComputedStyleUtils::ValueForFontStyle( ...@@ -756,8 +756,14 @@ CSSIdentifierValue* ComputedStyleUtils::ValueForFontStyle(
return CSSIdentifierValue::Create(CSSValueItalic); return CSSIdentifierValue::Create(CSSValueItalic);
} }
NOTREACHED(); // The spec says: 'The lack of a number represents an angle of
return CSSIdentifierValue::Create(CSSValueNormal); // "20deg"', but since we compute that to 'italic' (handled above),
// we don't perform any special treatment of that value here.
CSSValueList* oblique_values = CSSValueList::CreateSpaceSeparated();
oblique_values->Append(
*CSSPrimitiveValue::Create(angle, CSSPrimitiveValue::UnitType::kDegrees));
return CSSFontStyleRangeValue::Create(
*CSSIdentifierValue::Create(CSSValueOblique), *oblique_values);
} }
CSSPrimitiveValue* ComputedStyleUtils::ValueForFontWeight( CSSPrimitiveValue* ComputedStyleUtils::ValueForFontWeight(
......
...@@ -102,7 +102,7 @@ class ComputedStyleUtils { ...@@ -102,7 +102,7 @@ class ComputedStyleUtils {
static CSSValueList* ValueForFontFamily(const ComputedStyle&); static CSSValueList* ValueForFontFamily(const ComputedStyle&);
static CSSPrimitiveValue* ValueForFontSize(const ComputedStyle&); static CSSPrimitiveValue* ValueForFontSize(const ComputedStyle&);
static CSSPrimitiveValue* ValueForFontStretch(const ComputedStyle&); static CSSPrimitiveValue* ValueForFontStretch(const ComputedStyle&);
static CSSIdentifierValue* ValueForFontStyle(const ComputedStyle&); static CSSValue* ValueForFontStyle(const ComputedStyle&);
static CSSPrimitiveValue* ValueForFontWeight(const ComputedStyle&); static CSSPrimitiveValue* ValueForFontWeight(const ComputedStyle&);
static CSSIdentifierValue* ValueForFontVariantCaps(const ComputedStyle&); static CSSIdentifierValue* ValueForFontVariantCaps(const ComputedStyle&);
static CSSValue* ValueForFontVariantLigatures(const ComputedStyle&); static CSSValue* ValueForFontVariantLigatures(const ComputedStyle&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment