Changeset 183765 in webkit
- Timestamp:
- May 4, 2015 1:27:50 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183761 r183765 1 2015-05-04 Chris Dumez <cdumez@apple.com> 2 3 REGRESSION (r178156): CSS Parser incorrectly rejects valid calc() in padding-right property 4 https://bugs.webkit.org/show_bug.cgi?id=144584 5 <rdar://problem/20796829> 6 7 Reviewed by Darin Adler. 8 9 * fast/css/negative-calc-values-expected.txt: Added. 10 * fast/css/negative-calc-values.html: Added. 11 Add a layout test that assigns negative calc() values to properties 12 whose values cannot be negative to verify that values are clamped as 13 per the specification: 14 http://dev.w3.org/csswg/css-values-3/#calc-range 15 16 * fast/css/padding-calc-value-expected.txt: Added. 17 * fast/css/padding-calc-value.html: Added. 18 Add a layout test to test that using calc(.5em - 2px) for padding-right 19 CSS property works as intended. It used to be resolved as 0px instead 20 of "2*font-size - 2px". 21 22 * fast/css/text-shadow-calc-value-expected.txt: 23 * fast/css/text-shadow-calc-value.html: 24 Update test to match what the specification says: 25 http://dev.w3.org/csswg/css-values-3/#calc-range 26 "width: calc(5px - 10px);" is equivalent to "width: 0px;" since widths 27 smaller than 0px are not allowed. 28 1 29 2015-05-04 Joseph Pecoraro <pecoraro@apple.com> 2 30 -
trunk/LayoutTests/fast/css/text-shadow-calc-value-expected.txt
r178156 r183765 12 12 PASS window.getComputedStyle(testDiv).getPropertyValue('text-shadow') is "rgb(255, 255, 255) -3px -6px 9px" 13 13 testDiv.style['text-shadow'] = 'calc(1 * 3px) calc(2 * 3px) calc(-3 * 3px) rgb(255, 255, 255)' 14 PASS testDiv.style['text-shadow'] is previousStyle15 PASS window.getComputedStyle(testDiv).getPropertyValue('text-shadow') is previousComputedStyle14 PASS testDiv.style['text-shadow'] is "rgb(255, 255, 255) calc(3px) calc(6px) calc(-9px)" 15 PASS window.getComputedStyle(testDiv).getPropertyValue('text-shadow') is "rgb(255, 255, 255) 3px 6px 0px" 16 16 PASS successfullyParsed is true 17 17 -
trunk/LayoutTests/fast/css/text-shadow-calc-value.html
r178156 r183765 18 18 shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('text-shadow')", "rgb(255, 255, 255) -3px -6px 9px") 19 19 20 var previousStyle = testDiv.style['text-shadow']; 21 var previousComputedStyle = window.getComputedStyle(testDiv).getPropertyValue('text-shadow'); 22 23 // Negative blur-radius is not allowed. 20 // Negative blur-radius is not allowed so it should become 0. 24 21 evalAndLog("testDiv.style['text-shadow'] = 'calc(1 * 3px) calc(2 * 3px) calc(-3 * 3px) rgb(255, 255, 255)'"); 25 22 // text-shadow should not be updated. 26 shouldBe ("testDiv.style['text-shadow']", "previousStyle");27 shouldBe ("window.getComputedStyle(testDiv).getPropertyValue('text-shadow')", "previousComputedStyle")23 shouldBeEqualToString("testDiv.style['text-shadow']", "rgb(255, 255, 255) calc(3px) calc(6px) calc(-9px)"); 24 shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('text-shadow')", "rgb(255, 255, 255) 3px 6px 0px") 28 25 29 26 </script> -
trunk/Source/WebCore/ChangeLog
r183751 r183765 1 2015-05-04 Chris Dumez <cdumez@apple.com> 2 3 REGRESSION (r178156): CSS Parser incorrectly rejects valid calc() in padding-right property 4 https://bugs.webkit.org/show_bug.cgi?id=144584 5 <rdar://problem/20796829> 6 7 Reviewed by Darin Adler. 8 9 The CSS parser was rejecting calculated values at parsing time if it 10 considered the value was negative and the CSS property did not allow 11 negative values. However, doing so at this point will not always work 12 because we don't necessarily know the font-size yet (for e.g. for 13 calc(0.5em - 2px). Also, rejecting negative calculated values is not 14 the right behavior as the the specification. The specification says 15 we should clamp: 16 http://dev.w3.org/csswg/css-values-3/#calc-range 17 18 This patch updates validateCalculationUnit() to stop marking the value 19 as invalid if it is negative. Instead, let the CSSCalcValue's permitted 20 range clamp the value as needed. 21 22 This bug was causing the bottom graphic on aldentrio.com to not be 23 rendered properly. 24 25 Test: fast/css/negative-calc-values.html 26 fast/css/padding-calc-value.html 27 28 * css/CSSParser.cpp: 29 (WebCore::CSSParser::validateCalculationUnit): 30 1 31 2015-05-04 Eric Carlson <eric.carlson@apple.com> 2 32 -
trunk/Source/WebCore/css/CSSCalculationValue.h
r178627 r183765 93 93 bool isInt() const { return m_expression->isInteger(); } 94 94 double doubleValue() const; 95 bool isNegative() const { return m_expression->doubleValue() < 0; }96 95 bool isPositive() const { return m_expression->doubleValue() > 0; } 97 96 double computeLengthPx(const CSSToLengthConversionData&) const; -
trunk/Source/WebCore/css/CSSParser.cpp
r183748 r183765 1671 1671 if (!isValid && (unitFlags & FPositiveInteger) && calculation->isInt() && calculation->isPositive()) 1672 1672 isValid = true; 1673 if (isValid && mustBeNonNegative && calculation->isNegative())1674 isValid = false;1675 1673 break; 1676 1674 case CalcLength: 1677 1675 isValid = (unitFlags & FLength); 1678 if (isValid && mustBeNonNegative && calculation->isNegative())1679 isValid = false;1680 1676 break; 1681 1677 case CalcPercent: 1682 1678 isValid = (unitFlags & FPercent); 1683 if (isValid && mustBeNonNegative && calculation->isNegative())1684 isValid = false;1685 1679 break; 1686 1680 case CalcPercentLength:
Note: See TracChangeset
for help on using the changeset viewer.