Changeset 245276 in webkit
- Timestamp:
- May 14, 2019 7:02:50 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r245275 r245276 1 2019-05-14 Joonghun Park <jh718.park@samsung.com> 2 3 Implement page-break-* and -webkit-column-break-* as legacy-shorthands. 4 https://bugs.webkit.org/show_bug.cgi?id=197656 5 6 Reviewed by Darin Adler. 7 8 According to https://drafts.csswg.org/css-cascade-4/#legacy-shorthand, 9 implement page-break-* and -webkit-column-break-* as legacy-shorthands for break-*. 10 11 This change also serialize page-break-* properties 12 to CSSStyleDeclaration, 13 per https://drafts.csswg.org/css-break/#page-break-properties. 14 15 * web-platform-tests/css/cssom/serialize-values-expected.txt: 16 1 17 2019-05-14 Javier Fernandez <jfernandez@igalia.com> 2 18 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt
r232005 r245276 572 572 PASS padding-left: .5% 573 573 PASS padding-left: inherit 574 FAIL page-break-after: auto assert_equals: page-break-after raw inline style declaration expected "auto" but got "" 575 FAIL page-break-after: always assert_equals: page-break-after raw inline style declaration expected "always" but got "" 576 FAIL page-break-after: avoid assert_equals: page-break-after raw inline style declaration expected "avoid" but got "" 577 FAIL page-break-after: left assert_equals: page-break-after raw inline style declaration expected "left" but got "" 578 FAIL page-break-after: right assert_equals: page-break-after raw inline style declaration expected "right" but got "" 574 PASS page-break-after: auto 575 PASS page-break-after: always 576 PASS page-break-after: avoid 577 PASS page-break-after: left 578 PASS page-break-after: right 579 579 PASS page-break-after: inherit 580 FAIL page-break-before: auto assert_equals: page-break-before raw inline style declaration expected "auto" but got "" 581 FAIL page-break-before: always assert_equals: page-break-before raw inline style declaration expected "always" but got "" 582 FAIL page-break-before: avoid assert_equals: page-break-before raw inline style declaration expected "avoid" but got "" 583 FAIL page-break-before: left assert_equals: page-break-before raw inline style declaration expected "left" but got "" 584 FAIL page-break-before: right assert_equals: page-break-before raw inline style declaration expected "right" but got "" 580 PASS page-break-before: auto 581 PASS page-break-before: always 582 PASS page-break-before: avoid 583 PASS page-break-before: left 584 PASS page-break-before: right 585 585 PASS page-break-before: inherit 586 FAIL page-break-inside: avoid assert_equals: page-break-inside raw inline style declaration expected "avoid" but got "" 587 FAIL page-break-inside: auto assert_equals: page-break-inside raw inline style declaration expected "auto" but got "" 586 PASS page-break-inside: avoid 587 PASS page-break-inside: auto 588 588 PASS page-break-inside: inherit 589 589 PASS position: static -
trunk/Source/WebCore/ChangeLog
r245275 r245276 1 2019-05-14 Joonghun Park <pjh0718@gmail.com> 2 3 Implement page-break-* and -webkit-column-break-* as legacy-shorthands. 4 https://bugs.webkit.org/show_bug.cgi?id=197656 5 6 Reviewed by Darin Adler. 7 8 According to https://drafts.csswg.org/css-cascade-4/#legacy-shorthand, 9 implement page-break-* and -webkit-column-break-* as legacy-shorthands for break-*. 10 11 This change also serialize page-break-* properties 12 to CSSStyleDeclaration, 13 per https://drafts.csswg.org/css-break/#page-break-properties. 14 15 * css/CSSProperties.json: 16 * css/StyleBuilderConverter.h: 17 (WebCore::StyleBuilderConverter::convertFontSynthesis): 18 (WebCore::StyleBuilderConverter::convertPageBreakBetween): Deleted. 19 (WebCore::StyleBuilderConverter::convertPageBreakInside): Deleted. 20 (WebCore::StyleBuilderConverter::convertColumnBreakBetween): Deleted. 21 (WebCore::StyleBuilderConverter::convertColumnBreakInside): Deleted. 22 * css/StyleProperties.cpp: 23 (WebCore::StyleProperties::getPropertyValue const): 24 (WebCore::StyleProperties::pageBreakPropertyValue const): 25 * css/StyleProperties.h: 26 * css/parser/CSSPropertyParser.cpp: 27 (WebCore::CSSPropertyParser::parseValueStart): 28 (WebCore::mapFromPageBreakBetween): 29 (WebCore::CSSPropertyParser::parseShorthand): 30 (WebCore::isLegacyBreakProperty): Deleted. 31 1 32 2019-05-14 Javier Fernandez <jfernandez@igalia.com> 2 33 -
trunk/Source/WebCore/css/CSSProperties.json
r245275 r245276 3415 3415 }, 3416 3416 "page-break-after": { 3417 "values": [ 3418 "auto", 3419 "always", 3420 "avoid", 3421 "left", 3422 "right" 3423 ], 3424 "codegen-properties": { 3425 "initial": "initialBreakBetween", 3426 "name-for-methods": "BreakAfter", 3427 "converter": "PageBreakBetween" 3417 "codegen-properties": { 3418 "longhands": [ 3419 "break-after" 3420 ] 3428 3421 }, 3429 3422 "specification": { … … 3433 3426 }, 3434 3427 "page-break-before": { 3435 "values": [ 3436 "auto", 3437 "always", 3438 "avoid", 3439 "left", 3440 "right" 3441 ], 3442 "codegen-properties": { 3443 "initial": "initialBreakBetween", 3444 "name-for-methods": "BreakBefore", 3445 "converter": "PageBreakBetween" 3428 "codegen-properties": { 3429 "longhands": [ 3430 "break-before" 3431 ] 3446 3432 }, 3447 3433 "specification": { … … 3451 3437 }, 3452 3438 "page-break-inside": { 3453 "values": [ 3454 "auto", 3455 "avoid" 3456 ], 3457 "codegen-properties": { 3458 "initial": "initialBreakInside", 3459 "name-for-methods": "BreakInside", 3460 "converter": "PageBreakInside" 3439 "codegen-properties": { 3440 "longhands": [ 3441 "break-inside" 3442 ] 3461 3443 }, 3462 3444 "specification": { … … 4691 4673 }, 4692 4674 "-webkit-column-break-after": { 4693 "values": [ 4694 "auto", 4695 "always", 4696 "avoid", 4697 "left", 4698 "right" 4699 ], 4700 "codegen-properties": { 4701 "initial": "initialBreakBetween", 4702 "name-for-methods": "BreakAfter", 4703 "converter": "ColumnBreakBetween" 4675 "codegen-properties": { 4676 "longhands": [ 4677 "break-after" 4678 ] 4704 4679 }, 4705 4680 "status": { … … 4712 4687 }, 4713 4688 "-webkit-column-break-before": { 4714 "values": [ 4715 "auto", 4716 "always", 4717 "avoid", 4718 "left", 4719 "right" 4720 ], 4721 "codegen-properties": { 4722 "initial": "initialBreakBetween", 4723 "name-for-methods": "BreakBefore", 4724 "converter": "ColumnBreakBetween" 4689 "codegen-properties": { 4690 "longhands": [ 4691 "break-before" 4692 ] 4725 4693 }, 4726 4694 "status": { … … 4733 4701 }, 4734 4702 "-webkit-column-break-inside": { 4735 "values": [ 4736 "auto", 4737 "avoid" 4738 ], 4739 "codegen-properties": { 4740 "initial": "initialBreakInside", 4741 "name-for-methods": "BreakInside", 4742 "converter": "ColumnBreakInside" 4703 "codegen-properties": { 4704 "longhands": [ 4705 "break-inside" 4706 ] 4743 4707 }, 4744 4708 "status": { -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r244408 r245276 1567 1567 return result; 1568 1568 } 1569 1570 inline BreakBetween StyleBuilderConverter::convertPageBreakBetween(StyleResolver&, const CSSValue& value)1571 {1572 auto& primitiveValue = downcast<CSSPrimitiveValue>(value);1573 if (primitiveValue.valueID() == CSSValueAlways)1574 return BreakBetween::Page;1575 if (primitiveValue.valueID() == CSSValueAvoid)1576 return BreakBetween::AvoidPage;1577 return primitiveValue;1578 }1579 1580 inline BreakInside StyleBuilderConverter::convertPageBreakInside(StyleResolver&, const CSSValue& value)1581 {1582 auto& primitiveValue = downcast<CSSPrimitiveValue>(value);1583 if (primitiveValue.valueID() == CSSValueAvoid)1584 return BreakInside::AvoidPage;1585 return primitiveValue;1586 }1587 1588 inline BreakBetween StyleBuilderConverter::convertColumnBreakBetween(StyleResolver&, const CSSValue& value)1589 {1590 auto& primitiveValue = downcast<CSSPrimitiveValue>(value);1591 if (primitiveValue.valueID() == CSSValueAlways)1592 return BreakBetween::Column;1593 if (primitiveValue.valueID() == CSSValueAvoid)1594 return BreakBetween::AvoidColumn;1595 return primitiveValue;1596 }1597 1598 inline BreakInside StyleBuilderConverter::convertColumnBreakInside(StyleResolver&, const CSSValue& value)1599 {1600 auto& primitiveValue = downcast<CSSPrimitiveValue>(value);1601 if (primitiveValue.valueID() == CSSValueAvoid)1602 return BreakInside::AvoidColumn;1603 return primitiveValue;1604 }1605 1569 1606 1570 inline OptionSet<SpeakAs> StyleBuilderConverter::convertSpeakAs(StyleResolver&, const CSSValue& value) -
trunk/Source/WebCore/css/StyleProperties.cpp
r240334 r245276 134 134 if (!value || value->isPendingSubstitutionValue()) 135 135 return String(); 136 // FIXME: If all longhands are the same css-generic keyword(e.g. initial or inherit), 137 // then the shorthand should be serialized to that keyword. 138 // It seems to be needed to handle this in a single function commonly for all the shorthands, 139 // not in each of the shorthand serialization function. 140 // We could call that function here. 136 141 } 137 142 … … 210 215 case CSSPropertyGridRow: 211 216 return getShorthandValue(gridRowShorthand()); 217 case CSSPropertyPageBreakAfter: 218 return pageBreakPropertyValue(pageBreakAfterShorthand()); 219 case CSSPropertyPageBreakBefore: 220 return pageBreakPropertyValue(pageBreakBeforeShorthand()); 221 case CSSPropertyPageBreakInside: 222 return pageBreakPropertyValue(pageBreakInsideShorthand()); 212 223 case CSSPropertyPlaceContent: 213 224 return getAlignmentShorthandValue(placeContentShorthand()); … … 714 725 } 715 726 727 String StyleProperties::pageBreakPropertyValue(const StylePropertyShorthand& shorthand) const 728 { 729 RefPtr<CSSValue> value = getPropertyCSSValueInternal(shorthand.properties()[0]); 730 // FIXME: Remove this isGlobalKeyword check after we do this consistently for all shorthands in getPropertyValue. 731 if (value->isGlobalKeyword()) 732 return value->cssText(); 733 CSSValueID valueId = downcast<CSSPrimitiveValue>(*value).valueID(); 734 switch (valueId) { 735 case CSSValuePage: 736 return "always"_s; 737 case CSSValueAuto: 738 case CSSValueAvoid: 739 case CSSValueLeft: 740 case CSSValueRight: 741 return value->cssText(); 742 default: 743 return String(); 744 } 745 } 746 716 747 RefPtr<CSSValue> StyleProperties::getPropertyCSSValue(CSSPropertyID propertyID) const 717 748 { -
trunk/Source/WebCore/css/StyleProperties.h
r240251 r245276 164 164 String getAlignmentShorthandValue(const StylePropertyShorthand&) const; 165 165 String borderPropertyValue(const StylePropertyShorthand&, const StylePropertyShorthand&, const StylePropertyShorthand&) const; 166 String pageBreakPropertyValue(const StylePropertyShorthand&) const; 166 167 String getLayeredShorthandValue(const StylePropertyShorthand&) const; 167 168 String get2Values(const StylePropertyShorthand&) const; -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r244408 r245276 315 315 } 316 316 317 static bool isLegacyBreakProperty(CSSPropertyID propertyID)318 {319 switch (propertyID) {320 case CSSPropertyPageBreakAfter:321 case CSSPropertyPageBreakBefore:322 case CSSPropertyPageBreakInside:323 case CSSPropertyWebkitColumnBreakAfter:324 case CSSPropertyWebkitColumnBreakBefore:325 case CSSPropertyWebkitColumnBreakInside:326 return true;327 default:328 break;329 }330 return false;331 }332 333 317 bool CSSPropertyParser::parseValueStart(CSSPropertyID propertyID, bool important) 334 318 { … … 342 326 // Variable references will fail to parse here and will fall out to the variable ref parser below. 343 327 if (parseShorthand(propertyID, important)) 344 return true;345 } else if (isLegacyBreakProperty(propertyID)) {346 // FIXME-NEWPARSER: Can turn this into a shorthand once old parser is gone, and then347 // we don't need the special case.348 if (consumeLegacyBreakProperty(propertyID, important))349 328 return true; 350 329 } else { … … 5140 5119 if (value == CSSValueAlways) 5141 5120 return CSSValuePage; 5142 if (value == CSSValueAuto || value == CSSValue Left || value == CSSValueRight)5121 if (value == CSSValueAuto || value == CSSValueAvoid || value == CSSValueLeft || value == CSSValueRight) 5143 5122 return value; 5144 if (value == CSSValueAvoid)5145 return CSSValueAvoidPage;5146 5123 return CSSValueInvalid; 5147 5124 } … … 5888 5865 case CSSPropertyBorderImage: 5889 5866 return consumeBorderImage(property, important); 5867 case CSSPropertyPageBreakAfter: 5868 case CSSPropertyPageBreakBefore: 5869 case CSSPropertyPageBreakInside: 5870 case CSSPropertyWebkitColumnBreakAfter: 5871 case CSSPropertyWebkitColumnBreakBefore: 5872 case CSSPropertyWebkitColumnBreakInside: 5873 return consumeLegacyBreakProperty(property, important); 5890 5874 case CSSPropertyWebkitMaskPosition: 5891 5875 case CSSPropertyBackgroundPosition: {
Note: See TracChangeset
for help on using the changeset viewer.