Changeset 196075 in webkit
- Timestamp:
- Feb 3, 2016 12:54:30 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r196069 r196075 1 2016-02-03 Dave Hyatt <hyatt@apple.com> 2 3 Implement hanging-punctuation property parsing. 4 https://bugs.webkit.org/show_bug.cgi?id=18109. 5 6 Reviewed by Zalan Bujtas. 7 8 * fast/css/parsing-hanging-punctuation-expected.txt: Added. 9 * fast/css/parsing-hanging-punctuation.html: Added. 10 * fast/css/resources/parsing-hanging-punctuation.js: Added. 11 (test): 12 1 13 2016-02-03 Ryan Haddad <ryanhaddad@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r196070 r196075 1 2016-02-03 Dave Hyatt <hyatt@apple.com> 2 3 Implement hanging-punctuation property parsing. 4 https://bugs.webkit.org/show_bug.cgi?id=18109. 5 6 Reviewed by Zalan Bujtas. 7 8 Added parsing test in fast/css. 9 10 * css/CSSComputedStyleDeclaration.cpp: 11 (WebCore::renderEmphasisPositionFlagsToCSSValue): 12 (WebCore::hangingPunctuationToCSSValue): 13 (WebCore::fillRepeatToCSSValue): 14 (WebCore::ComputedStyleExtractor::propertyValue): 15 * css/CSSParser.cpp: 16 (WebCore::CSSParser::parseValue): 17 (WebCore::CSSParser::parseTextIndent): 18 (WebCore::CSSParser::parseHangingPunctuation): 19 (WebCore::CSSParser::parseLineBoxContain): 20 * css/CSSParser.h: 21 * css/CSSPrimitiveValueMappings.h: 22 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 23 (WebCore::CSSPrimitiveValue::operator HangingPunctuation): 24 (WebCore::CSSPrimitiveValue::operator LineBreak): 25 * css/CSSPropertyNames.in: 26 * css/CSSValueKeywords.in: 27 * css/StyleBuilderConverter.h: 28 (WebCore::StyleBuilderConverter::convertRegionBreakInside): 29 (WebCore::StyleBuilderConverter::convertHangingPunctuation): 30 * rendering/style/RenderStyle.cpp: 31 (WebCore::RenderStyle::changeRequiresLayout): 32 * rendering/style/RenderStyle.h: 33 * rendering/style/RenderStyleConstants.h: 34 (WebCore::operator| ): 35 (WebCore::operator|= ): 36 * rendering/style/StyleRareInheritedData.cpp: 37 (WebCore::StyleRareInheritedData::StyleRareInheritedData): 38 (WebCore::StyleRareInheritedData::operator==): 39 * rendering/style/StyleRareInheritedData.h: 40 1 41 2016-02-03 Jessie Berlin <jberlin@webkit.org> 2 42 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r195892 r196075 1696 1696 } 1697 1697 1698 static Ref<CSSValue> hangingPunctuationToCSSValue(HangingPunctuation hangingPunctuation) 1699 { 1700 auto& cssValuePool = CSSValuePool::singleton(); 1701 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 1702 if (hangingPunctuation & FirstHangingPunctuation) 1703 list->append(cssValuePool.createIdentifierValue(CSSValueFirst)); 1704 if (hangingPunctuation & AllowEndHangingPunctuation) 1705 list->append(cssValuePool.createIdentifierValue(CSSValueAllowEnd)); 1706 if (hangingPunctuation & ForceEndHangingPunctuation) 1707 list->append(cssValuePool.createIdentifierValue(CSSValueForceEnd)); 1708 if (hangingPunctuation & LastHangingPunctuation) 1709 list->append(cssValuePool.createIdentifierValue(CSSValueLast)); 1710 if (!list->length()) 1711 return cssValuePool.createIdentifierValue(CSSValueNone); 1712 return list.releaseNonNull(); 1713 } 1714 1698 1715 static Ref<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat) 1699 1716 { … … 3019 3036 case CSSPropertyBreakInside: 3020 3037 return cssValuePool.createValue(style->breakInside()); 3038 case CSSPropertyHangingPunctuation: 3039 return hangingPunctuationToCSSValue(style->hangingPunctuation()); 3021 3040 case CSSPropertyPosition: 3022 3041 return cssValuePool.createValue(style->position()); -
trunk/Source/WebCore/css/CSSParser.cpp
r195951 r196075 3088 3088 break; 3089 3089 3090 case CSSPropertyHangingPunctuation: 3091 return parseHangingPunctuation(important); 3090 3092 case CSSPropertyWebkitLineBoxContain: 3091 3093 if (id == CSSValueNone) … … 10512 10514 } 10513 10515 10516 bool CSSParser::parseHangingPunctuation(bool important) 10517 { 10518 CSSParserValue* value = m_valueList->current(); 10519 if (value && value->id == CSSValueNone) { 10520 addProperty(CSSPropertyHangingPunctuation, CSSValuePool::singleton().createIdentifierValue(CSSValueNone), important); 10521 m_valueList->next(); 10522 return true; 10523 } 10524 10525 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 10526 bool isValid = true; 10527 std::bitset<numCSSValueKeywords> seenValues; 10528 while (isValid && value) { 10529 if (seenValues[value->id] 10530 || (value->id == CSSValueAllowEnd && seenValues[CSSValueForceEnd]) 10531 || (value->id == CSSValueForceEnd && seenValues[CSSValueAllowEnd])) { 10532 isValid = false; 10533 break; 10534 } 10535 switch (value->id) { 10536 case CSSValueAllowEnd: 10537 case CSSValueFirst: 10538 case CSSValueForceEnd: 10539 case CSSValueLast: 10540 list->append(CSSValuePool::singleton().createIdentifierValue(value->id)); 10541 seenValues.set(value->id); 10542 break; 10543 default: 10544 isValid = false; 10545 break; 10546 } 10547 if (isValid) 10548 value = m_valueList->next(); 10549 } 10550 10551 // Values are either valid or in shorthand scope. 10552 if (list->length() && isValid) { 10553 addProperty(CSSPropertyHangingPunctuation, list.release(), important); 10554 return true; 10555 } 10556 10557 return false; 10558 } 10559 10514 10560 bool CSSParser::parseLineBoxContain(bool important) 10515 10561 { -
trunk/Source/WebCore/css/CSSParser.h
r195304 r196075 338 338 RefPtr<CSSValue> parseTextIndent(); 339 339 340 bool parseHangingPunctuation(bool important); 341 340 342 bool parseLineBoxContain(bool important); 341 343 RefPtr<CSSCalcValue> parseCalculation(CSSParserValue&, CalculationPermittedValueRange); -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r195892 r196075 1625 1625 break; 1626 1626 } 1627 } 1628 1629 template<> inline CSSPrimitiveValue::operator HangingPunctuation() const 1630 { 1631 ASSERT(isValueID()); 1632 1633 switch (m_value.valueID) { 1634 case CSSValueNone: 1635 return NoHangingPunctuation; 1636 case CSSValueFirst: 1637 return FirstHangingPunctuation; 1638 case CSSValueLast: 1639 return LastHangingPunctuation; 1640 case CSSValueAllowEnd: 1641 return AllowEndHangingPunctuation; 1642 case CSSValueForceEnd: 1643 return ForceEndHangingPunctuation; 1644 default: 1645 break; 1646 } 1647 1648 ASSERT_NOT_REACHED(); 1649 return NoHangingPunctuation; 1627 1650 } 1628 1651 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r195892 r196075 237 237 glyph-orientation-horizontal [Inherited, SVG, Converter=GlyphOrientation] 238 238 glyph-orientation-vertical [Inherited, SVG, Converter=GlyphOrientationOrAuto] 239 hanging-punctuation [Inherited, Converter=HangingPunctuation] 239 240 height [Initial=initialSize, Converter=LengthSizing] 240 241 #if defined(ENABLE_CSS_IMAGE_ORIENTATION) && ENABLE_CSS_IMAGE_ORIENTATION -
trunk/Source/WebCore/css/CSSValueKeywords.in
r195892 r196075 1192 1192 manipulation 1193 1193 #endif 1194 1195 // hanging-punctuation 1196 allow-end 1197 first 1198 force-end 1199 last -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r195892 r196075 136 136 static BreakInside convertRegionBreakInside(StyleResolver&, CSSValue&); 137 137 #endif 138 139 static HangingPunctuation convertHangingPunctuation(StyleResolver&, CSSValue&); 138 140 139 141 private: … … 1280 1282 #endif 1281 1283 1284 inline HangingPunctuation StyleBuilderConverter::convertHangingPunctuation(StyleResolver&, CSSValue& value) 1285 { 1286 HangingPunctuation result = RenderStyle::initialHangingPunctuation(); 1287 if (is<CSSValueList>(value)) { 1288 for (auto& currentValue : downcast<CSSValueList>(value)) 1289 result |= downcast<CSSPrimitiveValue>(currentValue.get()); 1290 } 1291 return result; 1292 } 1293 1282 1294 } // namespace WebCore 1283 1295 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r196031 r196075 614 614 || rareInheritedData->m_lineSnap != other.rareInheritedData->m_lineSnap 615 615 || rareInheritedData->m_lineAlign != other.rareInheritedData->m_lineAlign 616 || rareInheritedData->m_hangingPunctuation != other.rareInheritedData->m_hangingPunctuation 616 617 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 617 618 || rareInheritedData->useTouchOverflowScrolling != other.rareInheritedData->useTouchOverflowScrolling -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r195892 r196075 880 880 BreakBetween breakBefore() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakBefore); } 881 881 BreakBetween breakAfter() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakAfter); } 882 883 HangingPunctuation hangingPunctuation() const { return static_cast<HangingPunctuation>(rareInheritedData->m_hangingPunctuation); } 882 884 883 885 float outlineOffset() const … … 1623 1625 void setBreakAfter(BreakBetween breakBehavior) { SET_VAR(rareNonInheritedData, m_breakAfter, breakBehavior); } 1624 1626 void setBreakInside(BreakInside breakBehavior) { SET_VAR(rareNonInheritedData, m_breakInside, breakBehavior); } 1627 1628 void setHangingPunctuation(HangingPunctuation punctuation) { SET_VAR(rareInheritedData, m_hangingPunctuation, punctuation); } 1625 1629 1626 1630 // End CSS3 Setters … … 1882 1886 static BreakBetween initialBreakBetween() { return AutoBreakBetween; } 1883 1887 static BreakInside initialBreakInside() { return AutoBreakInside; } 1888 static HangingPunctuation initialHangingPunctuation() { return NoHangingPunctuation; } 1884 1889 static ETableLayout initialTableLayout() { return TAUTO; } 1885 1890 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r195892 r196075 484 484 AutoBreakInside, AvoidBreakInside, AvoidColumnBreakInside, AvoidPageBreakInside, AvoidRegionBreakInside 485 485 }; 486 486 487 enum HangingPunctuation { 488 NoHangingPunctuation = 0, 489 FirstHangingPunctuation = 1 << 0, 490 LastHangingPunctuation = 1 << 1, 491 AllowEndHangingPunctuation = 1 << 2, 492 ForceEndHangingPunctuation = 1 << 3 493 }; 494 inline HangingPunctuation operator| (HangingPunctuation a, HangingPunctuation b) { return HangingPunctuation(int(a) | int(b)); } 495 inline HangingPunctuation& operator|= (HangingPunctuation& a, HangingPunctuation b) { return a = a | b; } 496 487 497 enum EEmptyCell { 488 498 SHOW, HIDE -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r192290 r196075 126 126 , trailingWord(static_cast<unsigned>(RenderStyle::initialTrailingWord())) 127 127 #endif 128 , m_hangingPunctuation(RenderStyle::initialHangingPunctuation()) 128 129 , hyphenationLimitBefore(-1) 129 130 , hyphenationLimitAfter(-1) … … 208 209 , trailingWord(o.trailingWord) 209 210 #endif 211 , m_hangingPunctuation(o.m_hangingPunctuation) 210 212 , hyphenationString(o.hyphenationString) 211 213 , hyphenationLimitBefore(o.hyphenationLimitBefore) … … 314 316 && trailingWord == o.trailingWord 315 317 #endif 318 && m_hangingPunctuation == o.m_hangingPunctuation 316 319 && m_customProperties == o.m_customProperties 317 320 && arePointingToEqualData(listStyleImage, o.listStyleImage); -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r195699 r196075 138 138 #endif 139 139 140 unsigned m_hangingPunctuation : 4; 141 140 142 AtomicString hyphenationString; 141 143 short hyphenationLimitBefore;
Note: See TracChangeset
for help on using the changeset viewer.