source: trunk/LayoutTests/css3/calc/negative-padding-expected.html @ 174190

Revision 108750, 379 bytes checked in by mikelawther@chromium.org, 3 years ago (diff)

CSS3 calc(): handle non-negative values
https://bugs.webkit.org/show_bug.cgi?id=79188

Reviewed by Daniel Bates.

Source/WebCore:

Some CSS properties (e.g. padding) are required to be non-negative. These
are now restricted to the correct range.

Tests: css3/calc/negative-padding-expected.html

css3/calc/negative-padding.html

  • css/CSSCalculationValue.cpp:

(WebCore):
(WebCore::CSSCalcValue::clampToPermittedRange): Added
(WebCore::CSSCalcValue::doubleValue):
(WebCore::CSSCalcValue::isNegative): Added
(WebCore::CSSCalcValue::computeLengthPx):
(WebCore::CSSCalcValue::create):

  • css/CSSCalculationValue.h:

(CSSCalcValue):
(WebCore::CSSCalcValue::CSSCalcValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::validCalculationUnit):
(WebCore::CSSParser::parseCalculation):

  • css/CSSParser.h:
  • platform/CalculationValue.h:

LayoutTests:

  • css3/calc/negative-padding-expected.html: Added.
  • css3/calc/negative-padding.html: Added.
Line 
1<!DOCTYPE HTML>
2<style>
3    p { width:200px; height:120px; background-color: lightgreen;}
4    .control { padding: -100px; }
5</style>
6
7<div style="background-color: yellow;">
8    <p class="control">This element should have zero padding.</p>
9    <p class="control">This element should have zero padding.</p>
10    <p class="control">This element should have zero padding.</p>
11</div>
Note: See TracBrowser for help on using the repository browser.