Diff
Modified: trunk/LayoutTests/ChangeLog (196074 => 196075)
--- trunk/LayoutTests/ChangeLog 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/LayoutTests/ChangeLog 2016-02-03 20:54:30 UTC (rev 196075)
@@ -1,3 +1,15 @@
+2016-02-03 Dave Hyatt <[email protected]>
+
+ Implement hanging-punctuation property parsing.
+ https://bugs.webkit.org/show_bug.cgi?id=18109.
+
+ Reviewed by Zalan Bujtas.
+
+ * fast/css/parsing-hanging-punctuation-expected.txt: Added.
+ * fast/css/parsing-hanging-punctuation.html: Added.
+ * fast/css/resources/parsing-hanging-punctuation.js: Added.
+ (test):
+
2016-02-03 Ryan Haddad <[email protected]>
Skip fast/forms/input-user-input-sanitization.html on ios-simulator
Added: trunk/LayoutTests/fast/css/parsing-hanging-punctuation-expected.txt (0 => 196075)
--- trunk/LayoutTests/fast/css/parsing-hanging-punctuation-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/parsing-hanging-punctuation-expected.txt 2016-02-03 20:54:30 UTC (rev 196075)
@@ -0,0 +1,27 @@
+This tests checks that all of the input values for hanging-punctuation parse correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test("hanging-punctuation: none;") is "none"
+PASS test("hanging-punctuation: first;") is "first"
+PASS test("hanging-punctuation: last;") is "last"
+PASS test("hanging-punctuation: allow-end;") is "allow-end"
+PASS test("hanging-punctuation: force-end;") is "force-end"
+PASS test("hanging-punctuation: first last;") is "first last"
+PASS test("hanging-punctuation: last first;") is "last first"
+PASS test("hanging-punctuation: first allow-end;") is "first allow-end"
+PASS test("hanging-punctuation: first force-end;") is "first force-end"
+PASS test("hanging-punctuation: first allow-end last;") is "first allow-end last"
+PASS test("hanging-punctuation: last allow-end;") is "last allow-end"
+PASS test("hanging-punctuation: first first;") is ""
+PASS test("hanging-punctuation: nonsense;") is ""
+PASS test("hanging-punctuation: allow-end force-end;") is ""
+PASS test("hanging-punctuation: force-end allow-end;") is ""
+PASS test("hanging-punctuation: last last;") is ""
+PASS test("hanging-punctuation: 20px;") is ""
+PASS test("hanging-punctuation: first allow-end force-end last;") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/parsing-hanging-punctuation.html (0 => 196075)
--- trunk/LayoutTests/fast/css/parsing-hanging-punctuation.html (rev 0)
+++ trunk/LayoutTests/fast/css/parsing-hanging-punctuation.html 2016-02-03 20:54:30 UTC (rev 196075)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resources/parsing-hanging-punctuation.js (0 => 196075)
--- trunk/LayoutTests/fast/css/resources/parsing-hanging-punctuation.js (rev 0)
+++ trunk/LayoutTests/fast/css/resources/parsing-hanging-punctuation.js 2016-02-03 20:54:30 UTC (rev 196075)
@@ -0,0 +1,32 @@
+description("This tests checks that all of the input values for hanging-punctuation parse correctly.");
+
+function test(value)
+{
+ var div = document.createElement("div");
+ div.setAttribute("style", value);
+ document.body.appendChild(div);
+
+ var result = div.style.getPropertyValue("hanging-punctuation");
+ document.body.removeChild(div);
+ return result;
+}
+
+shouldBe('test("hanging-punctuation: none;")', '"none"');
+shouldBe('test("hanging-punctuation: first;")', '"first"');
+shouldBe('test("hanging-punctuation: last;")', '"last"');
+shouldBe('test("hanging-punctuation: allow-end;")', '"allow-end"');
+shouldBe('test("hanging-punctuation: force-end;")', '"force-end"');
+shouldBe('test("hanging-punctuation: first last;")', '"first last"');
+shouldBe('test("hanging-punctuation: last first;")', '"last first"');
+shouldBe('test("hanging-punctuation: first allow-end;")', '"first allow-end"');
+shouldBe('test("hanging-punctuation: first force-end;")', '"first force-end"');
+shouldBe('test("hanging-punctuation: first allow-end last;")', '"first allow-end last"');
+shouldBe('test("hanging-punctuation: last allow-end;")', '"last allow-end"');
+
+shouldBeEqualToString('test("hanging-punctuation: first first;")', '');
+shouldBeEqualToString('test("hanging-punctuation: nonsense;")', '');
+shouldBeEqualToString('test("hanging-punctuation: allow-end force-end;")', '');
+shouldBeEqualToString('test("hanging-punctuation: force-end allow-end;")', '');
+shouldBeEqualToString('test("hanging-punctuation: last last;")', '');
+shouldBeEqualToString('test("hanging-punctuation: 20px;")', '');
+shouldBeEqualToString('test("hanging-punctuation: first allow-end force-end last;")', '');
Modified: trunk/Source/WebCore/ChangeLog (196074 => 196075)
--- trunk/Source/WebCore/ChangeLog 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/ChangeLog 2016-02-03 20:54:30 UTC (rev 196075)
@@ -1,3 +1,43 @@
+2016-02-03 Dave Hyatt <[email protected]>
+
+ Implement hanging-punctuation property parsing.
+ https://bugs.webkit.org/show_bug.cgi?id=18109.
+
+ Reviewed by Zalan Bujtas.
+
+ Added parsing test in fast/css.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::renderEmphasisPositionFlagsToCSSValue):
+ (WebCore::hangingPunctuationToCSSValue):
+ (WebCore::fillRepeatToCSSValue):
+ (WebCore::ComputedStyleExtractor::propertyValue):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ (WebCore::CSSParser::parseTextIndent):
+ (WebCore::CSSParser::parseHangingPunctuation):
+ (WebCore::CSSParser::parseLineBoxContain):
+ * css/CSSParser.h:
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ (WebCore::CSSPrimitiveValue::operator HangingPunctuation):
+ (WebCore::CSSPrimitiveValue::operator LineBreak):
+ * css/CSSPropertyNames.in:
+ * css/CSSValueKeywords.in:
+ * css/StyleBuilderConverter.h:
+ (WebCore::StyleBuilderConverter::convertRegionBreakInside):
+ (WebCore::StyleBuilderConverter::convertHangingPunctuation):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::changeRequiresLayout):
+ * rendering/style/RenderStyle.h:
+ * rendering/style/RenderStyleConstants.h:
+ (WebCore::operator| ):
+ (WebCore::operator|= ):
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+ (WebCore::StyleRareInheritedData::operator==):
+ * rendering/style/StyleRareInheritedData.h:
+
2016-02-03 Jessie Berlin <[email protected]>
Build fix.
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (196074 => 196075)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2016-02-03 20:54:30 UTC (rev 196075)
@@ -1695,6 +1695,23 @@
return list.releaseNonNull();
}
+static Ref<CSSValue> hangingPunctuationToCSSValue(HangingPunctuation hangingPunctuation)
+{
+ auto& cssValuePool = CSSValuePool::singleton();
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ if (hangingPunctuation & FirstHangingPunctuation)
+ list->append(cssValuePool.createIdentifierValue(CSSValueFirst));
+ if (hangingPunctuation & AllowEndHangingPunctuation)
+ list->append(cssValuePool.createIdentifierValue(CSSValueAllowEnd));
+ if (hangingPunctuation & ForceEndHangingPunctuation)
+ list->append(cssValuePool.createIdentifierValue(CSSValueForceEnd));
+ if (hangingPunctuation & LastHangingPunctuation)
+ list->append(cssValuePool.createIdentifierValue(CSSValueLast));
+ if (!list->length())
+ return cssValuePool.createIdentifierValue(CSSValueNone);
+ return list.releaseNonNull();
+}
+
static Ref<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
{
// For backwards compatibility, if both values are equal, just return one of them. And
@@ -3018,6 +3035,8 @@
return cssValuePool.createValue(style->breakBefore());
case CSSPropertyBreakInside:
return cssValuePool.createValue(style->breakInside());
+ case CSSPropertyHangingPunctuation:
+ return hangingPunctuationToCSSValue(style->hangingPunctuation());
case CSSPropertyPosition:
return cssValuePool.createValue(style->position());
case CSSPropertyRight:
Modified: trunk/Source/WebCore/css/CSSParser.cpp (196074 => 196075)
--- trunk/Source/WebCore/css/CSSParser.cpp 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2016-02-03 20:54:30 UTC (rev 196075)
@@ -3087,6 +3087,8 @@
validPrimitive = true;
break;
+ case CSSPropertyHangingPunctuation:
+ return parseHangingPunctuation(important);
case CSSPropertyWebkitLineBoxContain:
if (id == CSSValueNone)
validPrimitive = true;
@@ -10511,6 +10513,50 @@
return list.release();
}
+bool CSSParser::parseHangingPunctuation(bool important)
+{
+ CSSParserValue* value = m_valueList->current();
+ if (value && value->id == CSSValueNone) {
+ addProperty(CSSPropertyHangingPunctuation, CSSValuePool::singleton().createIdentifierValue(CSSValueNone), important);
+ m_valueList->next();
+ return true;
+ }
+
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ bool isValid = true;
+ std::bitset<numCSSValueKeywords> seenValues;
+ while (isValid && value) {
+ if (seenValues[value->id]
+ || (value->id == CSSValueAllowEnd && seenValues[CSSValueForceEnd])
+ || (value->id == CSSValueForceEnd && seenValues[CSSValueAllowEnd])) {
+ isValid = false;
+ break;
+ }
+ switch (value->id) {
+ case CSSValueAllowEnd:
+ case CSSValueFirst:
+ case CSSValueForceEnd:
+ case CSSValueLast:
+ list->append(CSSValuePool::singleton().createIdentifierValue(value->id));
+ seenValues.set(value->id);
+ break;
+ default:
+ isValid = false;
+ break;
+ }
+ if (isValid)
+ value = m_valueList->next();
+ }
+
+ // Values are either valid or in shorthand scope.
+ if (list->length() && isValid) {
+ addProperty(CSSPropertyHangingPunctuation, list.release(), important);
+ return true;
+ }
+
+ return false;
+}
+
bool CSSParser::parseLineBoxContain(bool important)
{
LineBoxContain lineBoxContain = LineBoxContainNone;
Modified: trunk/Source/WebCore/css/CSSParser.h (196074 => 196075)
--- trunk/Source/WebCore/css/CSSParser.h 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/css/CSSParser.h 2016-02-03 20:54:30 UTC (rev 196075)
@@ -337,6 +337,8 @@
RefPtr<CSSValue> parseTextIndent();
+ bool parseHangingPunctuation(bool important);
+
bool parseLineBoxContain(bool important);
RefPtr<CSSCalcValue> parseCalculation(CSSParserValue&, CalculationPermittedValueRange);
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (196074 => 196075)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2016-02-03 20:54:30 UTC (rev 196075)
@@ -1626,6 +1626,29 @@
}
}
+template<> inline CSSPrimitiveValue::operator HangingPunctuation() const
+{
+ ASSERT(isValueID());
+
+ switch (m_value.valueID) {
+ case CSSValueNone:
+ return NoHangingPunctuation;
+ case CSSValueFirst:
+ return FirstHangingPunctuation;
+ case CSSValueLast:
+ return LastHangingPunctuation;
+ case CSSValueAllowEnd:
+ return AllowEndHangingPunctuation;
+ case CSSValueForceEnd:
+ return ForceEndHangingPunctuation;
+ default:
+ break;
+ }
+
+ ASSERT_NOT_REACHED();
+ return NoHangingPunctuation;
+}
+
template<> inline CSSPrimitiveValue::operator LineBreak() const
{
ASSERT(isValueID());
Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (196074 => 196075)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2016-02-03 20:54:30 UTC (rev 196075)
@@ -236,6 +236,7 @@
font-stretch [SkipBuilder]
glyph-orientation-horizontal [Inherited, SVG, Converter=GlyphOrientation]
glyph-orientation-vertical [Inherited, SVG, Converter=GlyphOrientationOrAuto]
+hanging-punctuation [Inherited, Converter=HangingPunctuation]
height [Initial=initialSize, Converter=LengthSizing]
#if defined(ENABLE_CSS_IMAGE_ORIENTATION) && ENABLE_CSS_IMAGE_ORIENTATION
image-orientation [Inherited]
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (196074 => 196075)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2016-02-03 20:54:30 UTC (rev 196075)
@@ -1191,3 +1191,9 @@
// touch-action
manipulation
#endif
+
+// hanging-punctuation
+allow-end
+first
+force-end
+last
Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (196074 => 196075)
--- trunk/Source/WebCore/css/StyleBuilderConverter.h 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h 2016-02-03 20:54:30 UTC (rev 196075)
@@ -135,6 +135,8 @@
static BreakBetween convertRegionBreakBetween(StyleResolver&, CSSValue&);
static BreakInside convertRegionBreakInside(StyleResolver&, CSSValue&);
#endif
+
+ static HangingPunctuation convertHangingPunctuation(StyleResolver&, CSSValue&);
private:
friend class StyleBuilderCustom;
@@ -1279,6 +1281,16 @@
}
#endif
+inline HangingPunctuation StyleBuilderConverter::convertHangingPunctuation(StyleResolver&, CSSValue& value)
+{
+ HangingPunctuation result = RenderStyle::initialHangingPunctuation();
+ if (is<CSSValueList>(value)) {
+ for (auto& currentValue : downcast<CSSValueList>(value))
+ result |= downcast<CSSPrimitiveValue>(currentValue.get());
+ }
+ return result;
+}
+
} // namespace WebCore
#endif // StyleBuilderConverter_h
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (196074 => 196075)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2016-02-03 20:54:30 UTC (rev 196075)
@@ -613,6 +613,7 @@
#endif
|| rareInheritedData->m_lineSnap != other.rareInheritedData->m_lineSnap
|| rareInheritedData->m_lineAlign != other.rareInheritedData->m_lineAlign
+ || rareInheritedData->m_hangingPunctuation != other.rareInheritedData->m_hangingPunctuation
#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
|| rareInheritedData->useTouchOverflowScrolling != other.rareInheritedData->useTouchOverflowScrolling
#endif
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (196074 => 196075)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2016-02-03 20:54:30 UTC (rev 196075)
@@ -879,6 +879,8 @@
BreakInside breakInside() const { return static_cast<BreakInside>(rareNonInheritedData->m_breakInside); }
BreakBetween breakBefore() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakBefore); }
BreakBetween breakAfter() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakAfter); }
+
+ HangingPunctuation hangingPunctuation() const { return static_cast<HangingPunctuation>(rareInheritedData->m_hangingPunctuation); }
float outlineOffset() const
{
@@ -1622,6 +1624,8 @@
void setBreakBefore(BreakBetween breakBehavior) { SET_VAR(rareNonInheritedData, m_breakBefore, breakBehavior); }
void setBreakAfter(BreakBetween breakBehavior) { SET_VAR(rareNonInheritedData, m_breakAfter, breakBehavior); }
void setBreakInside(BreakInside breakBehavior) { SET_VAR(rareNonInheritedData, m_breakInside, breakBehavior); }
+
+ void setHangingPunctuation(HangingPunctuation punctuation) { SET_VAR(rareInheritedData, m_hangingPunctuation, punctuation); }
// End CSS3 Setters
@@ -1881,6 +1885,7 @@
static EFloat initialFloating() { return NoFloat; }
static BreakBetween initialBreakBetween() { return AutoBreakBetween; }
static BreakInside initialBreakInside() { return AutoBreakInside; }
+ static HangingPunctuation initialHangingPunctuation() { return NoHangingPunctuation; }
static ETableLayout initialTableLayout() { return TAUTO; }
static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
static EBorderStyle initialBorderStyle() { return BNONE; }
Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (196074 => 196075)
--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2016-02-03 20:54:30 UTC (rev 196075)
@@ -483,7 +483,17 @@
enum BreakInside {
AutoBreakInside, AvoidBreakInside, AvoidColumnBreakInside, AvoidPageBreakInside, AvoidRegionBreakInside
};
-
+
+enum HangingPunctuation {
+ NoHangingPunctuation = 0,
+ FirstHangingPunctuation = 1 << 0,
+ LastHangingPunctuation = 1 << 1,
+ AllowEndHangingPunctuation = 1 << 2,
+ ForceEndHangingPunctuation = 1 << 3
+};
+inline HangingPunctuation operator| (HangingPunctuation a, HangingPunctuation b) { return HangingPunctuation(int(a) | int(b)); }
+inline HangingPunctuation& operator|= (HangingPunctuation& a, HangingPunctuation b) { return a = a | b; }
+
enum EEmptyCell {
SHOW, HIDE
};
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (196074 => 196075)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2016-02-03 20:54:30 UTC (rev 196075)
@@ -125,6 +125,7 @@
#if ENABLE(CSS_TRAILING_WORD)
, trailingWord(static_cast<unsigned>(RenderStyle::initialTrailingWord()))
#endif
+ , m_hangingPunctuation(RenderStyle::initialHangingPunctuation())
, hyphenationLimitBefore(-1)
, hyphenationLimitAfter(-1)
, hyphenationLimitLines(-1)
@@ -207,6 +208,7 @@
#if ENABLE(CSS_TRAILING_WORD)
, trailingWord(o.trailingWord)
#endif
+ , m_hangingPunctuation(o.m_hangingPunctuation)
, hyphenationString(o.hyphenationString)
, hyphenationLimitBefore(o.hyphenationLimitBefore)
, hyphenationLimitAfter(o.hyphenationLimitAfter)
@@ -313,6 +315,7 @@
#if ENABLE(CSS_TRAILING_WORD)
&& trailingWord == o.trailingWord
#endif
+ && m_hangingPunctuation == o.m_hangingPunctuation
&& m_customProperties == o.m_customProperties
&& arePointingToEqualData(listStyleImage, o.listStyleImage);
}
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (196074 => 196075)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2016-02-03 20:15:05 UTC (rev 196074)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2016-02-03 20:54:30 UTC (rev 196075)
@@ -137,6 +137,8 @@
unsigned trailingWord : 1;
#endif
+ unsigned m_hangingPunctuation : 4;
+
AtomicString hyphenationString;
short hyphenationLimitBefore;
short hyphenationLimitAfter;