Modified: trunk/LayoutTests/TestExpectations (209525 => 209526)
--- trunk/LayoutTests/TestExpectations 2016-12-08 06:19:57 UTC (rev 209525)
+++ trunk/LayoutTests/TestExpectations 2016-12-08 06:29:46 UTC (rev 209526)
@@ -1030,8 +1030,6 @@
webkit.org/b/165195 fast/css-grid-layout/grid-columns-rows-get-set.html [ Pass Failure ]
webkit.org/b/165195 fast/css-grid-layout/non-grid-columns-rows-get-set.html [ Pass Failure ]
webkit.org/b/165195 fast/masking/parsing-mask.html [ Pass Failure ]
-webkit.org/b/165195 fast/css/font-calculated-value.html [ Pass Failure ]
-webkit.org/b/165195 fast/css/font-shorthand.html [ Pass Failure ]
webkit.org/b/165195 fast/shadow-dom/slotted-pseudo-element-css-text.html [ Pass Failure ]
# The following tests match Blink/Chrome, but we're not sure yet what to do with them when the
Modified: trunk/LayoutTests/fast/css/font-shorthand-expected.txt (209525 => 209526)
--- trunk/LayoutTests/fast/css/font-shorthand-expected.txt 2016-12-08 06:19:57 UTC (rev 209525)
+++ trunk/LayoutTests/fast/css/font-shorthand-expected.txt 2016-12-08 06:29:46 UTC (rev 209526)
@@ -49,16 +49,16 @@
Font for 'italic bold 12px/24px serif':
font-style: italic (original property was font)
+font-variant-caps: normal (original property was font and property was implicitly set.)
font-weight: bold (original property was font)
-font-variant-caps: normal (original property was font and property was implicitly set.)
font-size: 12px (original property was font)
line-height: 24px (original property was font)
font-family: serif (original property was font)
Font for 'small-caps bold 14px/28px Arial, sans-serif':
+font-style: normal (original property was font and property was implicitly set.)
font-variant-caps: small-caps (original property was font)
font-weight: bold (original property was font)
-font-style: normal (original property was font and property was implicitly set.)
font-size: 14px (original property was font)
line-height: 28px (original property was font)
font-family: Arial, sans-serif (original property was font)
Modified: trunk/Source/WebCore/ChangeLog (209525 => 209526)
--- trunk/Source/WebCore/ChangeLog 2016-12-08 06:19:57 UTC (rev 209525)
+++ trunk/Source/WebCore/ChangeLog 2016-12-08 06:29:46 UTC (rev 209526)
@@ -1,3 +1,32 @@
+2016-12-07 Dave Hyatt <[email protected]>
+
+ REGRESSION: font shorthand parsing is broken
+ https://bugs.webkit.org/show_bug.cgi?id=165594
+
+ Reviewed by Zalan Bujtas.
+
+ Unskipping fast/css/font-calculated-value.html.
+
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::consumeFontWeight):
+ The new parser did not support calc() in the font-weight property.
+ In order to support a positive integer, add new functions to consume
+ and handle positive integers without making a CSSPrimitiveValue out of
+ the number. These correspond to consumeNumberRaw but are limited to positive
+ integers.
+
+ (WebCore::CSSPropertyParser::consumeFont):
+ The implicit bool was incorrectly set to true when properties were
+ defined because releaseNonNull() cleared the variables being null
+ checked. Add separate booleans to avoid this.
+
+ * css/parser/CSSPropertyParserHelpers.cpp:
+ (WebCore::CSSPropertyParserHelpers::CalcParser::consumePositiveIntegerRaw):
+ (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
+ * css/parser/CSSPropertyParserHelpers.h:
+ Add the new helpers that consume positive integers without creating
+ CSSPrimitiveValues out of them.
+
2016-12-07 Jeremy Jones <[email protected]>
Exit pointer lock when page goes into page cache.
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (209525 => 209526)
--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-12-08 06:19:57 UTC (rev 209525)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp 2016-12-08 06:29:46 UTC (rev 209526)
@@ -862,12 +862,11 @@
const CSSParserToken& token = range.peek();
if (token.id() >= CSSValueNormal && token.id() <= CSSValueLighter)
return consumeIdent(range);
- if (token.type() != NumberToken || token.numericValueType() != IntegerValueType)
+ int weight;
+ if (!consumePositiveIntegerRaw(range, weight))
return nullptr;
- int weight = static_cast<int>(token.numericValue());
if ((weight % 100) || weight < 100 || weight > 900)
return nullptr;
- range.consumeIncludingWhitespace();
return CSSValuePool::singleton().createIdentifierValue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1));
}
@@ -4333,6 +4332,7 @@
RefPtr<CSSPrimitiveValue> fontStyle;
RefPtr<CSSPrimitiveValue> fontVariantCaps;
RefPtr<CSSPrimitiveValue> fontWeight;
+
// FIXME-NEWPARSER: Implement. RefPtr<CSSPrimitiveValue> fontStretch;
while (!m_range.atEnd()) {
CSSValueID id = m_range.peek().id();
@@ -4362,8 +4362,12 @@
if (m_range.atEnd())
return false;
- addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? fontStyle.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !fontStyle);
- addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? fontVariantCaps.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !fontVariantCaps);
+ bool hasStyle = fontStyle;
+ bool hasVariant = fontVariantCaps;
+ bool hasWeight = fontWeight;
+
+ addProperty(CSSPropertyFontStyle, CSSPropertyFont, fontStyle ? fontStyle.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !hasStyle);
+ addProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, fontVariantCaps ? fontVariantCaps.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !hasVariant);
/*
// FIXME-NEWPARSER: What do we do with these? They aren't part of our fontShorthand().
addProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, true);
@@ -4370,10 +4374,7 @@
addProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, true);
*/
- addProperty(CSSPropertyFontWeight, CSSPropertyFont, fontWeight ? fontWeight.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !fontWeight);
- /* FIXME-NEWPARSER: Implement.
- addProperty(CSSPropertyFontStretch, CSSPropertyFont, fontStretch ? fontStretch.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !fontStretch);
- */
+ addProperty(CSSPropertyFontWeight, CSSPropertyFont, fontWeight ? fontWeight.releaseNonNull() : CSSValuePool::singleton().createIdentifierValue(CSSValueNormal), important, !hasWeight);
// Now a font size _must_ come.
RefPtr<CSSValue> fontSize = consumeFontSize(m_range, m_context.mode);
@@ -4398,9 +4399,6 @@
addProperty(CSSPropertyFontFamily, CSSPropertyFont, parsedFamilyValue.releaseNonNull(), important);
- // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requires that
- // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their initial values
- // but we don't seem to support them at the moment. They should also be added here once implemented.
return m_range.atEnd();
}
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (209525 => 209526)
--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp 2016-12-08 06:19:57 UTC (rev 209525)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp 2016-12-08 06:29:46 UTC (rev 209526)
@@ -111,6 +111,17 @@
result = m_calcValue->doubleValue();
return true;
}
+
+ bool consumePositiveIntegerRaw(int& result)
+ {
+ if (!m_calcValue || m_calcValue->category() != CalcNumber || !m_calcValue->isInt())
+ return false;
+ result = static_cast<int>(m_calcValue->doubleValue());
+ if (result < 1)
+ return false;
+ m_sourceRange = m_range;
+ return true;
+ }
private:
CSSParserTokenRange& m_sourceRange;
@@ -143,6 +154,19 @@
return consumeInteger(range, 1);
}
+bool consumePositiveIntegerRaw(CSSParserTokenRange& range, int& result)
+{
+ const CSSParserToken& token = range.peek();
+ if (token.type() == NumberToken) {
+ if (token.numericValueType() == NumberValueType || token.numericValue() < 1)
+ return nullptr;
+ result = range.consumeIncludingWhitespace().numericValue();
+ return true;
+ }
+ CalcParser calcParser(range);
+ return calcParser.consumePositiveIntegerRaw(result);
+}
+
bool consumeNumberRaw(CSSParserTokenRange& range, double& result)
{
if (range.peek().type() == NumberToken) {
Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h (209525 => 209526)
--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h 2016-12-08 06:19:57 UTC (rev 209525)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.h 2016-12-08 06:29:46 UTC (rev 209526)
@@ -58,6 +58,7 @@
};
RefPtr<CSSPrimitiveValue> consumeInteger(CSSParserTokenRange&, double minimumValue = -std::numeric_limits<double>::max());
+bool consumePositiveIntegerRaw(CSSParserTokenRange&, int& result);
RefPtr<CSSPrimitiveValue> consumePositiveInteger(CSSParserTokenRange&);
bool consumeNumberRaw(CSSParserTokenRange&, double& result);
RefPtr<CSSPrimitiveValue> consumeNumber(CSSParserTokenRange&, ValueRange);