Changeset 182270 in webkit
- Timestamp:
- Apr 2, 2015 1:51:23 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r182266 r182270 1 2015-04-02 Joonghun Park <jh718.park@samsung.com> 2 3 [CSS MultiColumn] Parse "columns: auto <length>" shorthand property value properly 4 https://bugs.webkit.org/show_bug.cgi?id=143248 5 6 Reviewed by Darin Adler. 7 8 * fast/css/getPropertyValue-columns-expected.txt: 9 * fast/css/getPropertyValue-columns.html: 10 * fast/multicol/columns-shorthand-parsing-2-expected.txt: Added. 11 * fast/multicol/columns-shorthand-parsing-2.html: Added. 12 1 13 2015-04-01 Commit Queue <commit-queue@webkit.org> 2 14 -
trunk/LayoutTests/fast/css/getPropertyValue-columns-expected.txt
r144730 r182270 1 Bug 111011: getPropertyValue for -webkit-columns returns null, should compute the shorthand value1 Bug 111011: getPropertyValue for columns returns null, should compute the shorthand value 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 PASS webkitColumnsValue("columns1") is "10px"7 PASS webkitColumnsValue("columns2") is "10"8 PASS webkitColumnsValue("columns3") is "10px auto"9 PASS webkitColumnsValue("columns4") is "auto"10 PASS webkitColumnsValue("columns5") is "auto 2"11 PASS webkitColumnsValue("columns6") is "10px 2"12 PASS webkitColumnsValue("columns7") is "auto auto"13 NOTE: 'foo' is an illegal CSS value for ' -webkit-columns'.14 PASS webkitColumnsValue("columns8") is null6 PASS columnsValue("columns1") is "10px" 7 PASS columnsValue("columns2") is "10" 8 PASS columnsValue("columns3") is "10px auto" 9 PASS columnsValue("columns4") is "auto" 10 PASS columnsValue("columns5") is "auto 2" 11 PASS columnsValue("columns6") is "10px 2" 12 PASS columnsValue("columns7") is "auto auto" 13 NOTE: 'foo' is an illegal CSS value for 'columns'. 14 PASS columnsValue("columns8") is null 15 15 NOTE: If only few longhand properties are specified, getPropertyValue for shorthand property returns null. 16 PASS webkitColumnsValue("columns9") is null16 PASS columnsValue("columns9") is null 17 17 PASS successfullyParsed is true 18 18 -
trunk/LayoutTests/fast/css/getPropertyValue-columns.html
r155263 r182270 2 2 </html> 3 3 <head> 4 <title> -webkit-columns shorthand getPropertyValue test</title>4 <title>columns shorthand getPropertyValue test</title> 5 5 <style> 6 6 .test { … … 16 16 </head> 17 17 <body> 18 <div id="columns1" class="test" style=" -webkit-columns: 10px;"></div>19 <div id="columns2" class="test" style=" -webkit-columns: 10;"></div>20 <div id="columns3" class="test" style=" -webkit-columns: 10px auto;"></div>21 <div id="columns4" class="test" style=" -webkit-columns: auto;"></div>22 <div id="columns5" class="test" style=" -webkit-columns: auto 2;"></div>23 <div id="columns6" class="test" style=" -webkit-column-width: 10px; -webkit-column-count: 2;"></div>24 <div id="columns7" class="test" style=" -webkit-column-width: auto; -webkit-column-count: auto;"></div>25 <div id="columns8" class="test" style=" -webkit-columns: foo;"></div>26 <div id="columns9" class="test" style=" -webkit-column-width: 10px;"></div>18 <div id="columns1" class="test" style="columns: 10px;"></div> 19 <div id="columns2" class="test" style="columns: 10;"></div> 20 <div id="columns3" class="test" style="columns: 10px auto;"></div> 21 <div id="columns4" class="test" style="columns: auto;"></div> 22 <div id="columns5" class="test" style="columns: auto 2;"></div> 23 <div id="columns6" class="test" style="column-width: 10px; column-count: 2;"></div> 24 <div id="columns7" class="test" style="column-width: auto; column-count: auto;"></div> 25 <div id="columns8" class="test" style="columns: foo;"></div> 26 <div id="columns9" class="test" style="column-width: 10px;"></div> 27 27 <script> 28 description("<a href=\"https://bugs.webkit.org/show_bug.cgi?id=111011\">Bug 111011: getPropertyValue for -webkit-columns returns null, should compute the shorthand value</a>");28 description("<a href=\"https://bugs.webkit.org/show_bug.cgi?id=111011\">Bug 111011: getPropertyValue for columns returns null, should compute the shorthand value</a>"); 29 29 30 function webkitColumnsValue(id) {30 function columnsValue(id) { 31 31 var element = document.getElementById(id); 32 return element.style.getPropertyValue(" -webkit-columns");32 return element.style.getPropertyValue("columns"); 33 33 } 34 34 35 shouldBeEqualToString(' webkitColumnsValue("columns1")', '10px');36 shouldBeEqualToString(' webkitColumnsValue("columns2")', '10');37 shouldBeEqualToString(' webkitColumnsValue("columns3")', '10px auto');38 shouldBeEqualToString(' webkitColumnsValue("columns4")', 'auto');39 shouldBeEqualToString(' webkitColumnsValue("columns5")', 'auto 2');40 shouldBeEqualToString(' webkitColumnsValue("columns6")', '10px 2');41 shouldBeEqualToString(' webkitColumnsValue("columns7")', 'auto auto');42 debug("NOTE: 'foo' is an illegal CSS value for ' -webkit-columns'.");43 shouldBe(' webkitColumnsValue("columns8")', "null");35 shouldBeEqualToString('columnsValue("columns1")', '10px'); 36 shouldBeEqualToString('columnsValue("columns2")', '10'); 37 shouldBeEqualToString('columnsValue("columns3")', '10px auto'); 38 shouldBeEqualToString('columnsValue("columns4")', 'auto'); 39 shouldBeEqualToString('columnsValue("columns5")', 'auto 2'); 40 shouldBeEqualToString('columnsValue("columns6")', '10px 2'); 41 shouldBeEqualToString('columnsValue("columns7")', 'auto auto'); 42 debug("NOTE: 'foo' is an illegal CSS value for 'columns'."); 43 shouldBe('columnsValue("columns8")', "null"); 44 44 debug("NOTE: If only few longhand properties are specified, getPropertyValue for shorthand property returns null.") 45 shouldBe(' webkitColumnsValue("columns9")', "null");45 shouldBe('columnsValue("columns9")', "null"); 46 46 </script> 47 47 <script src="../../resources/js-test-post.js"></script> -
trunk/Source/WebCore/ChangeLog
r182266 r182270 1 2015-04-02 Joonghun Park <jh718.park@samsung.com> 2 3 [CSS MultiColumn] Parse "columns: auto <length>" shorthand property value properly 4 https://bugs.webkit.org/show_bug.cgi?id=143248 5 6 Reviewed by Darin Adler. 7 8 Test: fast/multicol/columns-shorthand-parsing-2.html 9 10 The two longhands for the 'columns' property ('column-count' and 11 'column-width') may both take 'auto' as a value. When we encounter 12 'auto' during parsing the value list of a declaration, we cannot just 13 make a guess at which property/properties that's meant for. Instead, 14 don't assign anything to 'auto' right away, but wait until all values 15 have been processed and at that point set the still unassigned 16 properties to 'auto'. If 'auto' isn't in the value list at all, set 17 unassigned properties to 'initial' for the 'columns' property, just 18 like we do for any other property. 19 20 * css/CSSParser.cpp: 21 (WebCore::CSSParser::parseValue): 22 (WebCore::CSSParser::parseColumnWidth): 23 (WebCore::CSSParser::parseColumnCount): 24 (WebCore::CSSParser::parseColumnsShorthand): 25 * css/CSSParser.h: 26 1 27 2015-04-01 Commit Queue <commit-queue@webkit.org> 2 28 -
trunk/Source/WebCore/css/CSSParser.cpp
r182147 r182270 2764 2764 break; 2765 2765 case CSSPropertyColumnCount: 2766 if (id == CSSValueAuto) 2767 validPrimitive = true; 2768 else 2769 validPrimitive = !id && validateUnit(valueWithCalculation, FPositiveInteger, CSSQuirksMode); 2766 parsedValue = parseColumnCount(); 2770 2767 break; 2771 2768 case CSSPropertyColumnGap: // normal | <length> … … 2792 2789 break; 2793 2790 case CSSPropertyColumnWidth: // auto | <length> 2794 if (id == CSSValueAuto) 2795 validPrimitive = true; 2796 else { 2797 // Always parse this property in strict mode, since it would be ambiguous otherwise when used in the 'columns' shorthand property. 2798 validPrimitive = validateUnit(valueWithCalculation, FLength | FNonNeg, CSSStrictMode) && parsedDouble(valueWithCalculation); 2799 } 2791 parsedValue = parseColumnWidth(); 2800 2792 break; 2801 2793 // End of CSS3 properties … … 2958 2950 return parseShorthand(propId, listStyleShorthand(), important); 2959 2951 case CSSPropertyColumns: 2960 return parse Shorthand(propId, columnsShorthand(),important);2952 return parseColumnsShorthand(important); 2961 2953 case CSSPropertyColumnRule: 2962 2954 return parseShorthand(propId, columnRuleShorthand(), important); … … 3608 3600 addProperty(shorthand.properties()[i], values[i].release(), important); 3609 3601 } 3602 3603 return true; 3604 } 3605 3606 RefPtr<CSSValue> CSSParser::parseColumnWidth() 3607 { 3608 ValueWithCalculation valueWithCalculation(*m_valueList->current()); 3609 CSSValueID id = valueWithCalculation.value().id; 3610 // Always parse this property in strict mode, since it would be ambiguous otherwise when used in the 'columns' shorthand property. 3611 if (id != CSSValueAuto && !(validateUnit(valueWithCalculation, FLength | FNonNeg, CSSStrictMode) && parsedDouble(valueWithCalculation))) 3612 return nullptr; 3613 3614 RefPtr<CSSValue> parsedValue = parseValidPrimitive(id, valueWithCalculation); 3615 m_valueList->next(); 3616 return parsedValue; 3617 } 3618 3619 RefPtr<CSSValue> CSSParser::parseColumnCount() 3620 { 3621 ValueWithCalculation valueWithCalculation(*m_valueList->current()); 3622 CSSValueID id = valueWithCalculation.value().id; 3623 3624 if (id != CSSValueAuto && !validateUnit(valueWithCalculation, FPositiveInteger, CSSQuirksMode)) 3625 return nullptr; 3626 3627 RefPtr<CSSValue> parsedValue = parseValidPrimitive(id, valueWithCalculation); 3628 m_valueList->next(); 3629 return parsedValue; 3630 } 3631 3632 bool CSSParser::parseColumnsShorthand(bool important) 3633 { 3634 RefPtr<CSSValue> columnWidth; 3635 RefPtr<CSSValue> columnCount; 3636 bool hasPendingExplicitAuto = false; 3637 3638 for (unsigned propertiesParsed = 0; CSSParserValue* value = m_valueList->current(); propertiesParsed++) { 3639 if (propertiesParsed >= 2) 3640 return false; // Too many values for this shorthand. Invalid declaration. 3641 if (!propertiesParsed && value->id == CSSValueAuto) { 3642 // 'auto' is a valid value for any of the two longhands, and at this point 3643 // we don't know which one(s) it is meant for. We need to see if there are other values first. 3644 m_valueList->next(); 3645 hasPendingExplicitAuto = true; 3646 } else { 3647 if (!columnWidth) { 3648 if ((columnWidth = parseColumnWidth())) 3649 continue; 3650 } 3651 if (!columnCount) { 3652 if ((columnCount = parseColumnCount())) 3653 continue; 3654 } 3655 // If we didn't find at least one match, this is an invalid shorthand and we have to ignore it. 3656 return false; 3657 } 3658 } 3659 3660 // Any unassigned property at this point will become implicit 'auto'. 3661 if (columnWidth) 3662 addProperty(CSSPropertyColumnWidth, columnWidth, important); 3663 else { 3664 addProperty(CSSPropertyColumnWidth, cssValuePool().createIdentifierValue(CSSValueAuto), important, !hasPendingExplicitAuto /* implicit */); 3665 hasPendingExplicitAuto = false; 3666 } 3667 3668 if (columnCount) 3669 addProperty(CSSPropertyColumnCount, columnCount, important); 3670 else 3671 addProperty(CSSPropertyColumnCount, cssValuePool().createIdentifierValue(CSSValueAuto), important, !hasPendingExplicitAuto /* implicit */); 3610 3672 3611 3673 return true; -
trunk/Source/WebCore/css/CSSParser.h
r182147 r182270 193 193 bool parseAnimationShorthand(CSSPropertyID, bool important); 194 194 195 RefPtr<CSSValue> parseColumnWidth(); 196 RefPtr<CSSValue> parseColumnCount(); 197 bool parseColumnsShorthand(bool important); 198 195 199 #if ENABLE(CSS_GRID_LAYOUT) 196 200 PassRefPtr<CSSValue> parseGridPosition();
Note: See TracChangeset
for help on using the changeset viewer.