ietestcenter/css3/valuesandunits/units-000.htm asserts
authortomz@codeaurora.org <tomz@codeaurora.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 20:23:26 +0000 (20:23 +0000)
committertomz@codeaurora.org <tomz@codeaurora.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 20:23:26 +0000 (20:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86176

Patch by Dave Tharp <dtharp@codeaurora.org> on 2012-06-26
Reviewed by Beth Dakin.

Source/WebCore:

Modified computeLengthDouble() to handle vh, vw, and vmin units. Per the spec
(http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths) viewport -percentage
lengths are "relative to the size of the initial containing block", which I read to be
the size of the parent element. Since parentStyle was not available in computeLengthDouble,
most of the changes for this patch involved "pushing down" the parentStyle pointer through
the network of computeLength methods and dependencies.

Tests: css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html
       css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html
       css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html

* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcValue::computeLengthPx):
(WebCore::CSSCalcPrimitiveValue::toCalcValue):
(WebCore::CSSCalcPrimitiveValue::computeLengthPx):
(WebCore::CSSCalcBinaryOperation::toCalcValue):
(WebCore::CSSCalcBinaryOperation::computeLengthPx):
* css/CSSCalculationValue.h:
(CSSCalcExpressionNode):
(WebCore::CSSCalcValue::toCalcValue):
(CSSCalcValue):
* css/CSSGradientValue.cpp:
(WebCore::CSSGradientValue::addStops):
(WebCore::positionFromValue):
(WebCore::CSSGradientValue::computeEndPoint):
(WebCore::CSSLinearGradientValue::createGradient):
(WebCore::CSSRadialGradientValue::resolveRadius):
(WebCore::CSSRadialGradientValue::createGradient):
* css/CSSGradientValue.h:
(CSSGradientValue):
(CSSRadialGradientValue):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLength):
(WebCore::CSSPrimitiveValue::computeLengthDouble):
* css/CSSPrimitiveValue.h:
(CSSPrimitiveValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::convertToLength):
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::parentStyle):
(WebCore):
(WebCore::CSSToStyleMap::mapFillSize):
(WebCore::CSSToStyleMap::mapFillXPosition):
(WebCore::CSSToStyleMap::mapFillYPosition):
(WebCore::CSSToStyleMap::mapNinePieceImageQuad):
* css/CSSToStyleMap.h:
(CSSToStyleMap):
* css/MediaQueryEvaluator.cpp:
(WebCore::computeLength):
(WebCore::device_heightMediaFeatureEval):
(WebCore::device_widthMediaFeatureEval):
(WebCore::heightMediaFeatureEval):
(WebCore::widthMediaFeatureEval):
* css/SVGCSSStyleSelector.cpp:
(WebCore::StyleResolver::applySVGProperty):
* css/StyleBuilder.cpp:
(WebCore::ApplyPropertyAuto::applyValue):
(WebCore::ApplyPropertyClip::convertToLength):
(WebCore::ApplyPropertyLength::applyValue):
(WebCore::ApplyPropertyBorderRadius::applyValue):
(WebCore::ApplyPropertyComputeLength::applyValue):
(WebCore::ApplyPropertyFontSize::applyValue):
(WebCore::ApplyPropertyLineHeight::applyValue):
(WebCore::ApplyPropertyPageSize::mmLength):
(WebCore::ApplyPropertyPageSize::inchLength):
(WebCore::ApplyPropertyPageSize::applyValue):
(WebCore::ApplyPropertyVerticalAlign::applyValue):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* css/StyleResolver.h:
(WebCore::StyleResolver::parentNode):
(StyleResolver):
* css/WebKitCSSMatrix.cpp:
(WebCore::WebKitCSSMatrix::setMatrixValue):

LayoutTests:

Adding explicit tests for viewport border length tests. Inspired by IE Test center
units-000 test which highlighted that vw, vh, and vmin were not being handled in computeLengthDouble().
Also, adjusting test_expectations and Skipped for units-000, which no longer Asserts with this
patch implemented.

* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border-expected.html: Added.
* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html: Added.
* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border-expected.html: Added.
* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html: Added.
* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border-expected.htm: Added.
* css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html: Added.
* ietestcenter/css3/valuesandunits/units-000.htm:
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121285 268f45cc-cd09-0410-ab3c-d52691b4dbfc

29 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border-expected.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border-expected.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border-expected.htm [new file with mode: 0644]
LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html [new file with mode: 0644]
LayoutTests/ietestcenter/css3/valuesandunits/units-000.htm
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSGradientValue.h
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSToStyleMap.cpp
Source/WebCore/css/CSSToStyleMap.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/SVGCSSStyleSelector.cpp
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/css/WebKitCSSMatrix.cpp

index e12d7b9..26ae83e 100644 (file)
@@ -1,3 +1,28 @@
+2012-06-26  Dave Tharp  <dtharp@codeaurora.org>
+
+        ietestcenter/css3/valuesandunits/units-000.htm asserts
+        https://bugs.webkit.org/show_bug.cgi?id=86176
+
+        Reviewed by Beth Dakin.
+
+        Adding explicit tests for viewport border length tests. Inspired by IE Test center
+        units-000 test which highlighted that vw, vh, and vmin were not being handled in computeLengthDouble().
+        Also, adjusting test_expectations and Skipped for units-000, which no longer Asserts with this
+        patch implemented.
+
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border-expected.html: Added.
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html: Added.
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border-expected.html: Added.
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html: Added.
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border-expected.htm: Added.
+        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html: Added.
+        * ietestcenter/css3/valuesandunits/units-000.htm:
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/qt/TestExpectations:
+
 2012-06-26  Filip Pizlo  <fpizlo@apple.com>
 
         DFG::operationNewArray is unnecessarily slow, and may use the wrong array
diff --git a/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border-expected.html b/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border-expected.html
new file mode 100644 (file)
index 0000000..4adedfd
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>CSS Test: vh unit - Reference</title>
+        <link rel="author" title="Codeaurora" href="http://www.codeaurora.org/" />
+        <link rel="help" href="http://www.w3.org/TR/CSS21/" />
+        <style type="text/css">
+            body div
+            {
+                font: 16px/1em ahem;
+                color: green;
+                height: 16px;
+            }
+            #parent
+            {
+                background: green;
+                position: relative;
+                overflow: hidden;
+                width: 1in;
+                height: 1in;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if there is no red visible on the page.</p>
+        <div id="parent">
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html b/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html
new file mode 100644 (file)
index 0000000..a40564c
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>CSS Test: vh unit</title>
+        <link rel="author" title="Codeaurora" href="http://www.codeaurora.org/" />
+        <link rel="help" href="http://www.w3.org/TR/CSS21/" />
+        <meta name="assert" content="Verifying vh unit values are supported." />
+        <style type="text/css">
+            body div
+            {
+                font: 16px/1em ahem;
+                color: green;
+                height: 16px;
+            }
+            #parent
+            {
+                background: red;
+                position: relative;
+                overflow: hidden;
+                width: 1in;
+                height: 1in;
+            }
+            #div-vh
+            {
+                border-right: solid green 100vh;
+                height: 16px;
+                width: 0;
+            }
+            #div-fill
+            {
+                background: green;
+                width: 1in;
+                height: 80px;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if there is no red visible on the page.</p>
+        <div id="parent">
+            <div id="div-vh"></div>
+            <div id="div-fill"></div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border-expected.html b/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border-expected.html
new file mode 100644 (file)
index 0000000..71c0b9b
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>CSS Test: vmin unit - Reference</title>
+        <link rel="author" title="Codeaurora" href="http://www.codeaurora.org/" />
+        <link rel="help" href="http://www.w3.org/TR/CSS21/" />
+        <style type="text/css">
+            body div
+            {
+                font: 16px/1em ahem;
+                color: green;
+                height: 16px;
+            }
+            #parent
+            {
+                background: green;
+                position: relative;
+                overflow: hidden;
+                width: 1in;
+                height: 112px;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if there is no red visible on the page.</p>
+        <div id="parent">
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html b/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html
new file mode 100644 (file)
index 0000000..9ace027
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>CSS Test: vmin unit</title>
+        <link rel="author" title="Codeaurora" href="http://www.codeaurora.org/" />
+        <link rel="help" href="http://www.w3.org/TR/CSS21/" />
+        <meta name="assert" content="Verifying vmin unit values are supported." />
+        <style type="text/css">
+            body div
+            {
+                font: 16px/1em ahem;
+                color: green;
+                height: 16px;
+            }
+            #parent
+            {
+                background: red;
+                position: relative;
+                overflow: hidden;
+                width: 1in;
+                height: 112px;
+            }
+            #div-vh
+            {
+                border-right: solid green 100vmin;
+                height: 16px;
+                width: 0;
+            }
+            #div-fill
+            {
+                background: green;
+                width: 1in;
+                height: 96px;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if there is no red visible on the page.</p>
+        <div id="parent">
+            <div id="div-vh"></div>
+            <div id="div-fill"></div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border-expected.htm b/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border-expected.htm
new file mode 100644 (file)
index 0000000..9d87bb8
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>CSS Test: vw unit - Reference</title>
+        <link rel="author" title="Codeaurora" href="http://www.codeaurora.org/" />
+        <link rel="help" href="http://www.w3.org/TR/CSS21/" />
+        <style type="text/css">
+            body div
+            {
+                font: 16px/1em ahem;
+                color: green;
+                height: 16px;
+            }
+            #parent
+            {
+                background: green;
+                position: relative;
+                overflow: hidden;
+                width: 1in;
+                height: 16px;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if there is no red visible on the page.</p>
+        <div id="parent">
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html b/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html
new file mode 100644 (file)
index 0000000..57f860c
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>CSS Test: vw unit</title>
+        <link rel="author" title="Codeaurora" href="http://www.codeaurora.org/" />
+        <link rel="help" href="http://www.w3.org/TR/CSS21/" />
+        <meta name="assert" content="Verifying vw unit values are supported." />
+        <style type="text/css">
+            body div
+            {
+                font: 16px/1em ahem;
+                color: green;
+                height: 16px;
+            }
+            #parent
+            {
+                background: red;
+                position: relative;
+                overflow: hidden;
+                width: 1in;
+                height: 16px;
+            }
+            #div-vh
+            {
+                border-right: solid green 100vw;
+                height: 16px;
+                width: 0;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if there is no red visible on the page.</p>
+        <div id="parent">
+            <div id="div-vh"></div>
+        </div>
+    </body>
+</html>
index 6d79e9e..e764c82 100644 (file)
             }
             #div12
             {
-                border-right: solid green 100vm;
+                border-right: solid green 100vmin;
                 height: 16px;
                 width: 0;
             }
index 9cad67a..dfde98a 100644 (file)
@@ -3461,8 +3461,7 @@ BUGWK84778 : ietestcenter/css3/multicolumn/column-width-negative-001.htm = IMAGE
 BUGWK85211 : ietestcenter/css3/flexbox/flexbox-align-stretch-001.htm = IMAGE
 BUGWK85212 : ietestcenter/css3/flexbox/flexbox-layout-002.htm = IMAGE
 // IETC CSS units
-BUGWK85308 DEBUG : ietestcenter/css3/valuesandunits/units-000.htm = CRASH
-BUGWK85308 RELEASE : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
+BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE
 // IETC namespace failures
 BUGWK86137 : ietestcenter/css3/namespaces/prefix-007.xml = IMAGE
index e7d9b4b..1ccb31e 100644 (file)
@@ -577,7 +577,7 @@ BUGWK85902 SLOW DEBUG : fast/overflow/lots-of-sibling-inline-boxes.html = PASS
 BUGWKEFL SLOW DEBUG : http/tests/incremental/slow-utf8-html.pl = PASS
 
 // Tests imported in r116658
-BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE CRASH
+BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE
 
 // New test introduced in r116694 fails
index b9ffed1..4fd3f0e 100644 (file)
@@ -356,8 +356,6 @@ BUGWK85811 DEBUG : fast/events/message-port-close.html = CRASH PASS
 BUGWK86443 : plugins/npruntime/delete-plugin-within-getProperty.html = CRASH
 BUGWK86443 : plugins/npruntime/delete-plugin-within-invoke.html = CRASH
 
-BUGWK86176 DEBUG : ietestcenter/css3/valuesandunits/units-000.htm = CRASH
-
 BUGWK89188 RELEASE : storage/websql/quota-tracking.html = CRASH PASS
 
 BUGWK89954 DEBUG : http/tests/xmlhttprequest/reentrant-cancel.html = CRASH
@@ -1171,7 +1169,8 @@ BUGWK85969 : http/tests/loading/post-in-iframe-with-back-navigation.html = TEXT
 // Started failing after it was added in r116563
 BUGWK86061 : http/tests/security/referrer-policy-redirect-link.html = TEXT
 
-BUGWK85308 RELEASE : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
+// IETC Units test failures
+BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE
 
 // IETC namespace failures
index 9dec4f9..0fc3c93 100644 (file)
@@ -243,8 +243,8 @@ BUGWK85565 : fast/css/border-solid-single-edge-antialias.html = IMAGE
 // Interferes with the tests that should pass
 BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT
 
-// Hits assert https://bugs.webkit.org/show_bug.cgi?id=86208
-BUGWK85308 SKIP : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
+// IETC units test failures
+BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE
 
 // IETC namespace failures
index 4760254..e1b6ce4 100644 (file)
@@ -59,9 +59,8 @@ BUGWK85567 : fast/images/png-suite/test.html = IMAGE
 // Interferes with the tests that should pass
 BUGWK85689 SKIP : fast/animation/request-animation-frame-disabled.html = TEXT
 
-// ietestcenter/css3/valuesandunits/units-000.htm asserts
-// https://bugs.webkit.org/show_bug.cgi?id=86176
-BUGWK85308 SKIP : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
+// IETC units test failures
+BUGWK85308 : ietestcenter/css3/valuesandunits/units-000.htm = IMAGE
 BUGWK85310 : ietestcenter/css3/valuesandunits/units-010.htm = IMAGE
 
 // IETC namespace failures
index 0cbb7ed..e1c0fb9 100755 (executable)
@@ -1,3 +1,85 @@
+2012-06-26  Dave Tharp  <dtharp@codeaurora.org>
+
+        ietestcenter/css3/valuesandunits/units-000.htm asserts
+        https://bugs.webkit.org/show_bug.cgi?id=86176
+
+        Reviewed by Beth Dakin.
+
+        Modified computeLengthDouble() to handle vh, vw, and vmin units. Per the spec
+        (http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths) viewport -percentage
+        lengths are "relative to the size of the initial containing block", which I read to be
+        the size of the parent element. Since parentStyle was not available in computeLengthDouble,
+        most of the changes for this patch involved "pushing down" the parentStyle pointer through
+        the network of computeLength methods and dependencies.
+
+        Tests: css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vh-border.html
+               css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmin-border.html
+               css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vw-border.html
+
+        * css/CSSCalculationValue.cpp:
+        (WebCore::CSSCalcValue::computeLengthPx):
+        (WebCore::CSSCalcPrimitiveValue::toCalcValue):
+        (WebCore::CSSCalcPrimitiveValue::computeLengthPx):
+        (WebCore::CSSCalcBinaryOperation::toCalcValue):
+        (WebCore::CSSCalcBinaryOperation::computeLengthPx):
+        * css/CSSCalculationValue.h:
+        (CSSCalcExpressionNode):
+        (WebCore::CSSCalcValue::toCalcValue):
+        (CSSCalcValue):
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSGradientValue::addStops):
+        (WebCore::positionFromValue):
+        (WebCore::CSSGradientValue::computeEndPoint):
+        (WebCore::CSSLinearGradientValue::createGradient):
+        (WebCore::CSSRadialGradientValue::resolveRadius):
+        (WebCore::CSSRadialGradientValue::createGradient):
+        * css/CSSGradientValue.h:
+        (CSSGradientValue):
+        (CSSRadialGradientValue):
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::computeLength):
+        (WebCore::CSSPrimitiveValue::computeLengthDouble):
+        * css/CSSPrimitiveValue.h:
+        (CSSPrimitiveValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::convertToLength):
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::parentStyle):
+        (WebCore):
+        (WebCore::CSSToStyleMap::mapFillSize):
+        (WebCore::CSSToStyleMap::mapFillXPosition):
+        (WebCore::CSSToStyleMap::mapFillYPosition):
+        (WebCore::CSSToStyleMap::mapNinePieceImageQuad):
+        * css/CSSToStyleMap.h:
+        (CSSToStyleMap):
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::computeLength):
+        (WebCore::device_heightMediaFeatureEval):
+        (WebCore::device_widthMediaFeatureEval):
+        (WebCore::heightMediaFeatureEval):
+        (WebCore::widthMediaFeatureEval):
+        * css/SVGCSSStyleSelector.cpp:
+        (WebCore::StyleResolver::applySVGProperty):
+        * css/StyleBuilder.cpp:
+        (WebCore::ApplyPropertyAuto::applyValue):
+        (WebCore::ApplyPropertyClip::convertToLength):
+        (WebCore::ApplyPropertyLength::applyValue):
+        (WebCore::ApplyPropertyBorderRadius::applyValue):
+        (WebCore::ApplyPropertyComputeLength::applyValue):
+        (WebCore::ApplyPropertyFontSize::applyValue):
+        (WebCore::ApplyPropertyLineHeight::applyValue):
+        (WebCore::ApplyPropertyPageSize::mmLength):
+        (WebCore::ApplyPropertyPageSize::inchLength):
+        (WebCore::ApplyPropertyPageSize::applyValue):
+        (WebCore::ApplyPropertyVerticalAlign::applyValue):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList):
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::parentNode):
+        (StyleResolver):
+        * css/WebKitCSSMatrix.cpp:
+        (WebCore::WebKitCSSMatrix::setMatrixValue):
+
 2012-06-25  James Robinson  <jamesr@chromium.org>
 
         [chromium] Add WebLayer API for scrolling
index 54247e0..777a016 100755 (executable)
@@ -97,9 +97,9 @@ double CSSCalcValue::doubleValue() const
     return clampToPermittedRange(m_expression->doubleValue());
 }
 
-double CSSCalcValue::computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
+double CSSCalcValue::computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) const
 {
-    return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize));
+    return clampToPermittedRange(m_expression->computeLengthPx(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize));
 }
     
 CSSCalcExpressionNode::~CSSCalcExpressionNode() 
@@ -124,16 +124,16 @@ public:
         return m_value->cssText();
     }
 
-    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const
+    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom) const
     {
         switch (m_category) {
         case CalcNumber:
             return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
         case CalcLength:
-            return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, zoom)));
+            return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, parentStyle, zoom)));
         case CalcPercent:
         case CalcPercentLength:
-            return adoptPtr(new CalcExpressionLength(StyleResolver::convertToFloatLength(m_value.get(), style, rootStyle, zoom)));
+            return adoptPtr(new CalcExpressionLength(StyleResolver::convertToFloatLength(m_value.get(), style, rootStyle, parentStyle, zoom)));
         // Only types that could be part of a Length expression can be converted
         // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length.
         case CalcPercentNumber:
@@ -159,11 +159,11 @@ public:
         return 0;
     }
     
-    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
+    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) const
     {
         switch (m_category) {
         case CalcLength:
-            return m_value->computeLength<double>(currentStyle, rootStyle, multiplier, computingFontSize);
+            return m_value->computeLength<double>(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize);
         case CalcPercent:
         case CalcNumber:
             return m_value->getDoubleValue();
@@ -237,12 +237,12 @@ public:
         return !doubleValue();
     }
 
-    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom) const
+    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom) const
     {
-        OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, zoom));
+        OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, parentStyle, zoom));
         if (!left)
             return nullptr;
-        OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, zoom));
+        OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, parentStyle, zoom));
         if (!right)
             return nullptr;
         return adoptPtr(new CalcExpressionBinaryOperation(left.release(), right.release(), m_operator));
@@ -253,10 +253,10 @@ public:
         return evaluate(m_leftSide->doubleValue(), m_rightSide->doubleValue());
     }
     
-    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize) const
+    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize) const
     {
-        const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);
-        const double rightValue = m_rightSide->computeLengthPx(currentStyle, rootStyle, multiplier, computingFontSize);
+        const double leftValue = m_leftSide->computeLengthPx(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize);
+        const double rightValue = m_rightSide->computeLengthPx(currentStyle, rootStyle, parentStyle, multiplier, computingFontSize);
         return evaluate(leftValue, rightValue);
     }
 
index 57a249f..3afdec8 100755 (executable)
@@ -60,9 +60,9 @@ public:
     
     virtual ~CSSCalcExpressionNode() = 0;
     virtual bool isZero() const = 0;
-    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, double zoom = 1.0) const = 0;    
+    virtual PassOwnPtr<CalcExpressionNode> toCalcValue(RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom = 1.0) const = 0;
     virtual double doubleValue() const = 0;
-    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;
+    virtual double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;
     virtual String customCssText() const = 0;
     
     CalculationCategory category() const { return m_category; }    
@@ -84,15 +84,15 @@ public:
     static PassRefPtr<CSSCalcValue> create(CSSParserString name, CSSParserValueList*, CalculationPermittedValueRange);
     static PassRefPtr<CSSCalcValue> create(CalculationValue*);
 
-    PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, double zoom = 1.0) const
+    PassRefPtr<CalculationValue> toCalcValue(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double zoom = 1.0) const
     {
-        return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, zoom), m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll);
+        return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, parentStyle, zoom), m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll);
     }
     CalculationCategory category() const { return m_expression->category(); }
     bool isInt() const { return m_expression->isInteger(); }    
     double doubleValue() const;
     bool isNegative() const { return m_expression->doubleValue() < 0; }
-    double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const;
+    double computeLengthPx(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1.0, bool computingFontSize = false) const;
         
     String customCssText() const;
     
index a314a86..daeeabf 100644 (file)
@@ -105,7 +105,7 @@ struct GradientStop {
     { }
 };
 
-void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, RenderStyle* rootStyle, float maxLengthForRepeat)
+void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, RenderStyle* rootStyle, RenderStyle* parentStyle, float maxLengthForRepeat)
 {
     RenderStyle* style = renderer->style();
 
@@ -160,9 +160,9 @@ void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, Rend
                 }
                 float length;
                 if (stop.m_position->isLength())
-                    length = stop.m_position->computeLength<float>(style, rootStyle, style->effectiveZoom());
+                    length = stop.m_position->computeLength<float>(style, rootStyle, parentStyle, style->effectiveZoom());
                 else 
-                    length = stop.m_position->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(gradientLength);
+                    length = stop.m_position->cssCalcValue()->toCalcValue(style, rootStyle, parentStyle, style->effectiveZoom())->evaluate(gradientLength);
                 stops[i].offset = (gradientLength > 0) ? length / gradientLength : 0;
             } else {
                 ASSERT_NOT_REACHED();
@@ -363,7 +363,7 @@ void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, Rend
     gradient->setStopsSorted(true);
 }
 
-static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size, bool isHorizontal)
+static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, const IntSize& size, bool isHorizontal)
 {
     float zoomFactor = style->effectiveZoom();
 
@@ -375,7 +375,7 @@ static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, Ren
         return value->getFloatValue() / 100.f * edgeDistance;
 
     if (value->isCalculatedPercentageWithLength())
-        return value->cssCalcValue()->toCalcValue(style, rootStyle, style->effectiveZoom())->evaluate(edgeDistance);
+        return value->cssCalcValue()->toCalcValue(style, rootStyle, parentStyle, style->effectiveZoom())->evaluate(edgeDistance);
 
     switch (value->getIdent()) {
     case CSSValueTop:
@@ -392,18 +392,18 @@ static float positionFromValue(CSSPrimitiveValue* value, RenderStyle* style, Ren
         return size.width();
     }
 
-    return value->computeLength<float>(style, rootStyle, zoomFactor);
+    return value->computeLength<float>(style, rootStyle, parentStyle, zoomFactor);
 }
 
-FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* first, CSSPrimitiveValue* second, RenderStyle* style, RenderStyle* rootStyle, const IntSize& size)
+FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* first, CSSPrimitiveValue* second, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, const IntSize& size)
 {
     FloatPoint result;
 
     if (first)
-        result.setX(positionFromValue(first, style, rootStyle, size, true));
+        result.setX(positionFromValue(first, style, rootStyle, parentStyle, size, true));
 
     if (second)
-        result.setY(positionFromValue(second, style, rootStyle, size, false));
+        result.setY(positionFromValue(second, style, rootStyle, parentStyle, size, false));
 
     return result;
 }
@@ -542,6 +542,8 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render
     ASSERT(!size.isEmpty());
 
     RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle();
+    RenderObject* parent = renderer->parent();
+    RenderStyle* parentStyle = parent ? parent->style() : 0;
 
     FloatPoint firstPoint;
     FloatPoint secondPoint;
@@ -549,10 +551,10 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render
         float angle = m_angle->getFloatValue(CSSPrimitiveValue::CSS_DEG);
         endPointsFromAngle(angle, size, firstPoint, secondPoint);
     } else {
-        firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
+        firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, parentStyle, size);
 
         if (m_secondX || m_secondY)
-            secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size);
+            secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, parentStyle, size);
         else {
             if (m_firstX)
                 secondPoint.setX(size.width() - firstPoint.x());
@@ -564,7 +566,7 @@ PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderObject* render
     RefPtr<Gradient> gradient = Gradient::create(firstPoint, secondPoint);
 
     // Now add the stops.
-    addStops(gradient.get(), renderer, rootStyle, 1);
+    addStops(gradient.get(), renderer, rootStyle, parentStyle, 1);
 
     return gradient.release();
 }
@@ -638,7 +640,7 @@ String CSSRadialGradientValue::customCssText() const
     return result;
 }
 
-float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderStyle* style, RenderStyle* rootStyle, float* widthOrHeight)
+float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float* widthOrHeight)
 {
     float zoomFactor = style->effectiveZoom();
 
@@ -648,7 +650,7 @@ float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, RenderSty
     else if (widthOrHeight && radius->isPercentage())
         result = *widthOrHeight * radius->getFloatValue() / 100;
     else
-        result = radius->computeLength<float>(style, rootStyle, zoomFactor);
+        result = radius->computeLength<float>(style, rootStyle, parentStyle, zoomFactor);
 
     return result;
 }
@@ -735,14 +737,16 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render
     ASSERT(!size.isEmpty());
 
     RenderStyle* rootStyle = renderer->document()->documentElement()->renderStyle();
+    RenderObject* parent = renderer->parent();
+    RenderStyle* parentStyle = parent ? parent->style() : 0;
 
-    FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size);
+    FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, parentStyle, size);
     if (!m_firstX)
         firstPoint.setX(size.width() / 2);
     if (!m_firstY)
         firstPoint.setY(size.height() / 2);
 
-    FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size);
+    FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, parentStyle, size);
     if (!m_secondX)
         secondPoint.setX(size.width() / 2);
     if (!m_secondY)
@@ -750,17 +754,17 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render
 
     float firstRadius = 0;
     if (m_firstRadius)
-        firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle);
+        firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle, parentStyle);
 
     float secondRadius = 0;
     float aspectRatio = 1; // width / height.
     if (m_secondRadius)
-        secondRadius = resolveRadius(m_secondRadius.get(), renderer->style(), rootStyle);
+        secondRadius = resolveRadius(m_secondRadius.get(), renderer->style(), rootStyle, parentStyle);
     else if (m_endHorizontalSize || m_endVerticalSize) {
         float width = size.width();
         float height = size.height();
-        secondRadius = resolveRadius(m_endHorizontalSize.get(), renderer->style(), rootStyle, &width);
-        aspectRatio = secondRadius / resolveRadius(m_endVerticalSize.get(), renderer->style(), rootStyle, &height);
+        secondRadius = resolveRadius(m_endHorizontalSize.get(), renderer->style(), rootStyle, parentStyle, &width);
+        aspectRatio = secondRadius / resolveRadius(m_endVerticalSize.get(), renderer->style(), rootStyle, parentStyle, &height);
     } else {
         enum GradientShape { Circle, Ellipse };
         GradientShape shape = Ellipse;
@@ -861,7 +865,7 @@ PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderObject* render
     }
 
     // Now add the stops.
-    addStops(gradient.get(), renderer, rootStyle, maxExtent);
+    addStops(gradient.get(), renderer, rootStyle, parentStyle, maxExtent);
 
     return gradient.release();
 }
index ea10eb8..0292c14 100644 (file)
@@ -81,10 +81,10 @@ protected:
     {
     }
 
-    void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLengthForRepeat = 0);
+    void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, RenderStyle* parentStyle, float maxLengthForRepeat = 0);
 
     // Resolve points/radii to front end values.
-    FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize&);
+    FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, const IntSize&);
 
     bool isCacheable() const;
 
@@ -154,7 +154,7 @@ private:
     }
 
     // Resolve points/radii to front end values.
-    float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, float* widthOrHeight = 0);
+    float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, float* widthOrHeight = 0);
 
     // These may be null for non-deprecated gradients.
     RefPtr<CSSPrimitiveValue> m_firstRadius;
index 16e43dc..c53f28c 100644 (file)
@@ -455,46 +455,46 @@ double CSSPrimitiveValue::computeDegrees()
     }
 }
 
-template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
-    return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+    return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize));
 }
 
-template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
-    return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+    return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize));
 }
 
-template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
 #if ENABLE(SUBPIXEL_LAYOUT)
-    return Length(static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
+    return Length(static_cast<float>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)), Fixed);
 #else
-    return Length(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
+    return Length(roundForImpreciseConversion<float>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize)), Fixed);
 #endif
 }
 
-template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
-    return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+    return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize));
 }
 
-template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
-    return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+    return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize));
 }
 
-template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
-    return static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+    return static_cast<float>(computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize));
 }
 
-template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
-    return computeLengthDouble(style, rootStyle, multiplier, computingFontSize);
+    return computeLengthDouble(style, rootStyle, parentStyle, multiplier, computingFontSize);
 }
 
-double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
+double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize)
 {
     double factor;
 
@@ -537,6 +537,17 @@ double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r
         case CSS_CALC_PERCENTAGE_WITH_NUMBER:
             ASSERT_NOT_REACHED();
             return -1.0;
+        case CSS_VW:
+            factor = parentStyle ? 0.01 * parentStyle->width().getFloatValue() : 0;
+            break;
+        case CSS_VH:
+            factor = parentStyle ? 0.01 * parentStyle->height().getFloatValue() : 0;
+            break;
+        case CSS_VMIN:
+            factor = 0;
+            if (parentStyle)
+                factor = .01 * (float) min(parentStyle->width().getFloatValue(), parentStyle->height().getFloatValue());
+            break;
         default:
             ASSERT_NOT_REACHED();
             return -1.0;
@@ -545,7 +556,7 @@ double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r
     double computedValue;
     if (m_primitiveUnitType == CSS_CALC)
         // The multiplier is passed in as 1.0 here to ensure it is only applied once
-        computedValue = m_value.calc->computeLengthPx(style, rootStyle, 1.0, computingFontSize);
+        computedValue = m_value.calc->computeLengthPx(style, rootStyle, parentStyle, 1.0, computingFontSize);
     else
         computedValue = getDoubleValue();
     
index 87069c0..4084045 100644 (file)
@@ -238,10 +238,10 @@ public:
      * this is screen/printer dependent, so we probably need a config option for this,
      * and some tool to calibrate.
      */
-    template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, float multiplier = 1.0f, bool computingFontSize = false);
+    template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier = 1.0f, bool computingFontSize = false);
 
     // Converts to a Length, mapping various unit types appropriately.
-    template<int> Length convertToLength(RenderStyle* currStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false);
+    template<int> Length convertToLength(RenderStyle* currStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1.0, bool computingFontSize = false);
 
     // use with care!!!
     void setPrimitiveType(unsigned short type) { m_primitiveUnitType = type; }
@@ -342,7 +342,7 @@ private:
     void init(PassRefPtr<CSSCalcValue>);
     bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const;
 
-    double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, float multiplier, bool computingFontSize);
+    double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, float multiplier, bool computingFontSize);
 
     union {
         int ident;
index 4855ec3..2f19c7d 100644 (file)
@@ -3799,14 +3799,14 @@ enum LengthConversion {
     ViewportPercentageConversion = 1 << 6
 };
 
-template<int supported> Length CSSPrimitiveValue::convertToLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+template<int supported> Length CSSPrimitiveValue::convertToLength(RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier, bool computingFontSize)
 {
     if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && isFontRelativeLength() && (!style || !rootStyle))
         return Length(Undefined);
     if ((supported & FixedIntegerConversion) && isLength())
-        return computeLength<Length>(style, rootStyle, multiplier, computingFontSize);
+        return computeLength<Length>(style, rootStyle, parentStyle, multiplier, computingFontSize);
     if ((supported & FixedFloatConversion) && isLength())
-        return Length(computeLength<double>(style, rootStyle, multiplier), Fixed);
+        return Length(computeLength<double>(style, rootStyle, parentStyle, multiplier), Fixed);
     if ((supported & PercentConversion) && isPercentage())
         return Length(getDoubleValue(), Percent);
     if ((supported & FractionConversion) && isNumber())
@@ -3814,7 +3814,7 @@ template<int supported> Length CSSPrimitiveValue::convertToLength(RenderStyle* s
     if ((supported & AutoConversion) && getIdent() == CSSValueAuto)
         return Length(Auto);
     if ((supported & CalculatedConversion) && isCalculated())
-        return Length(cssCalcValue()->toCalcValue(style, rootStyle, multiplier));
+        return Length(cssCalcValue()->toCalcValue(style, rootStyle, parentStyle, multiplier));
     if ((supported & ViewportPercentageConversion) && isViewportPercentageLength())
         return viewportPercentageLength();
     return Length(Undefined);
index e154cec..0e9e2d7 100644 (file)
@@ -51,6 +51,11 @@ RenderStyle* CSSToStyleMap::rootElementStyle() const
     return m_resolver->rootElementStyle();
 }
 
+RenderStyle* CSSToStyleMap::parentStyle() const
+{
+    return m_resolver->parentStyle();
+}
+
 bool CSSToStyleMap::useSVGZoomRules() const
 {
     return m_resolver->useSVGZoomRules();
@@ -198,10 +203,10 @@ void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value
     if (Pair* pair = primitiveValue->getPairValue()) {
         CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first());
         CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second());
-        firstLength = first->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
-        secondLength = second->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
+        firstLength = first->convertToLength<AnyConversion>(style(), rootElementStyle(), parentStyle(), zoomFactor);
+        secondLength = second->convertToLength<AnyConversion>(style(), rootElementStyle(), parentStyle(),  zoomFactor);
     } else {
-        firstLength = primitiveValue->convertToLength<AnyConversion>(style(), rootElementStyle(), zoomFactor);
+        firstLength = primitiveValue->convertToLength<AnyConversion>(style(), rootElementStyle(), parentStyle(), zoomFactor);
         secondLength = Length();
     }
 
@@ -228,11 +233,11 @@ void CSSToStyleMap::mapFillXPosition(CSSPropertyID, FillLayer* layer, CSSValue*
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     Length length;
     if (primitiveValue->isLength())
-        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor);
+        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoomFactor);
     else if (primitiveValue->isPercentage())
         length = Length(primitiveValue->getDoubleValue(), Percent);
     else if (primitiveValue->isCalculatedPercentageWithLength())
-        length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), zoomFactor));
+        length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), parentStyle(), zoomFactor));
     else if (primitiveValue->isViewportPercentageLength())
         length = primitiveValue->viewportPercentageLength();
     else
@@ -255,11 +260,11 @@ void CSSToStyleMap::mapFillYPosition(CSSPropertyID, FillLayer* layer, CSSValue*
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     Length length;
     if (primitiveValue->isLength())
-        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), zoomFactor);
+        length = primitiveValue->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoomFactor);
     else if (primitiveValue->isPercentage())
         length = Length(primitiveValue->getDoubleValue(), Percent);
     else if (primitiveValue->isCalculatedPercentageWithLength())
-        length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), zoomFactor));
+        length = Length(primitiveValue->cssCalcValue()->toCalcValue(style(), rootElementStyle(), parentStyle(), zoomFactor));
     else if (primitiveValue->isViewportPercentageLength())
         length = primitiveValue->viewportPercentageLength();
     else
@@ -582,28 +587,28 @@ LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value)
     else if (slices->top()->isPercentage())
         box.m_top = Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
     else if (slices->top()->getIdent() != CSSValueAuto)
-        box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom);
+        box.m_top = slices->top()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom);
 
     if (slices->right()->isNumber())
         box.m_right = Length(slices->right()->getIntValue(), Relative);
     else if (slices->right()->isPercentage())
         box.m_right = Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
     else if (slices->right()->getIdent() != CSSValueAuto)
-        box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom);
+        box.m_right = slices->right()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom);
 
     if (slices->bottom()->isNumber())
         box.m_bottom = Length(slices->bottom()->getIntValue(), Relative);
     else if (slices->bottom()->isPercentage())
         box.m_bottom = Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
     else if (slices->bottom()->getIdent() != CSSValueAuto)
-        box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom);
+        box.m_bottom = slices->bottom()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom);
 
     if (slices->left()->isNumber())
         box.m_left = Length(slices->left()->getIntValue(), Relative);
     else if (slices->left()->isPercentage())
         box.m_left = Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
     else if (slices->left()->getIdent() != CSSValueAuto)
-        box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom);
+        box.m_left = slices->left()->computeLength<Length>(style(), rootElementStyle(), parentStyle(), zoom);
 
     return box;
 }
index 8e0fc95..5e449f5 100644 (file)
@@ -73,6 +73,7 @@ private:
     // the current paint/layout.
     RenderStyle* style() const;
     RenderStyle* rootElementStyle() const;
+    RenderStyle* parentStyle() const;
     bool useSVGZoomRules() const;
 
     // FIXME: This should be part of some sort of StyleImageCache object which
index 90c9df2..fc13649 100644 (file)
@@ -307,7 +307,7 @@ static bool gridMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFea
     return false;
 }
 
-static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, int& result)
+static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, int& result)
 {
     if (!value->isPrimitiveValue())
         return false;
@@ -320,7 +320,7 @@ static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, Rend
     }
 
     if (primitiveValue->isLength()) {
-        result = primitiveValue->computeLength<int>(style, rootStyle);
+        result = primitiveValue->computeLength<int>(style, rootStyle, parentStyle);
         return true;
     }
 
@@ -332,10 +332,12 @@ static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, F
     if (value) {
         FloatRect sg = screenRect(frame->page()->mainFrame()->view());
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+        ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle();
+        RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0;
         int length;
         long height = sg.height();
         InspectorInstrumentation::applyScreenHeightOverride(frame, &height);
-        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(height), length, op);
+        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(static_cast<int>(height), length, op);
     }
     // ({,min-,max-}device-height)
     // assume if we have a device, assume non-zero
@@ -347,10 +349,12 @@ static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
     if (value) {
         FloatRect sg = screenRect(frame->page()->mainFrame()->view());
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+        ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle();
+        RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0;
         int length;
         long width = sg.width();
         InspectorInstrumentation::applyScreenWidthOverride(frame, &width);
-        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(width), length, op);
+        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(static_cast<int>(width), length, op);
     }
     // ({,min-,max-}device-width)
     // assume if we have a device, assume non-zero
@@ -363,8 +367,10 @@ static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f
 
     if (value) {
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+        ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle();
+        RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0;
         int length;
-        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(view->layoutHeight(), length, op);
+        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(view->layoutHeight(), length, op);
     }
 
     return view->layoutHeight() != 0;
@@ -376,8 +382,10 @@ static bool widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* fr
 
     if (value) {
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+        ContainerNode* parentNode = frame->document()->documentElement()->parentNodeForRenderingAndStyle();
+        RenderStyle* parentStyle = parentNode ? parentNode->renderStyle() : 0;
         int length;
-        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(view->layoutWidth(), length, op);
+        return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, parentStyle, length) && compareValue(view->layoutWidth(), length, op);
     }
 
     return view->layoutWidth() != 0;
index 5b3547f..620ba0d 100644 (file)
@@ -559,9 +559,9 @@ void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
             if (!firstValue->isShadowValue())
                 return;
             ShadowValue* item = static_cast<ShadowValue*>(firstValue);
-            IntPoint location(item->x->computeLength<int>(style(), m_rootElementStyle),
-                              item->y->computeLength<int>(style(), m_rootElementStyle));
-            int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle) : 0;
+            IntPoint location(item->x->computeLength<int>(style(), m_rootElementStyle, m_parentStyle),
+                              item->y->computeLength<int>(style(), m_rootElementStyle, m_parentStyle));
+            int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle, m_parentStyle) : 0;
             Color color;
             if (item->color)
                 color = colorFromPrimitiveValue(item->color.get());
index 20d02cc..ac51f30 100644 (file)
@@ -34,6 +34,7 @@
 #include "CursorList.h"
 #include "Document.h"
 #include "Element.h"
+#include "NodeRenderStyle.h"
 #include "Pair.h"
 #include "Rect.h"
 #include "RenderObject.h"
@@ -212,7 +213,7 @@ public:
         else if (valueType == Number)
             setValue(styleResolver->style(), *primitiveValue);
         else if (valueType == ComputeLength)
-            setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
+            setValue(styleResolver->style(), primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom()));
     }
 
     static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
@@ -222,7 +223,7 @@ class ApplyPropertyClip {
 private:
     static Length convertToLength(StyleResolver* styleResolver, CSSPrimitiveValue* value)
     {
-        return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+        return value->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | AutoConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom());
     }
 public:
     static void applyInheritValue(StyleResolver* styleResolver)
@@ -379,13 +380,13 @@ public:
         if (autoEnabled && primitiveValue->getIdent() == CSSValueAuto)
             setValue(styleResolver->style(), Length());
         else if (primitiveValue->isLength()) {
-            Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+            Length length = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom());
             length.setQuirk(primitiveValue->isQuirkValue());
             setValue(styleResolver->style(), length);
         } else if (primitiveValue->isPercentage())
             setValue(styleResolver->style(), Length(primitiveValue->getDoubleValue(), Percent));
         else if (primitiveValue->isCalculatedPercentageWithLength())
-            setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
+            setValue(styleResolver->style(), Length(primitiveValue->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom())));
         else if (primitiveValue->isViewportPercentageLength())
             setValue(styleResolver->style(), primitiveValue->viewportPercentageLength());
     }
@@ -445,7 +446,7 @@ public:
             // handle this case
             return;
         } else
-            radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+            radiusWidth = pair->first()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom());
         if (pair->second()->isPercentage())
             radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
         else if (pair->second()->isViewportPercentageLength())
@@ -455,7 +456,7 @@ public:
             // handle this case
             return;
         } else
-            radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom());
+            radiusHeight = pair->second()->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom());
         int width = radiusWidth.value();
         int height = radiusHeight.value();
         if (width < 0 || height < 0)
@@ -600,7 +601,7 @@ public:
             length = 5;
         } else if (ident == CSSValueInvalid) {
             float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
-            length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), zoom);
+            length = primitiveValue->computeLength<T>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), zoom);
         } else {
             ASSERT_NOT_REACHED();
             length = 0;
@@ -738,12 +739,20 @@ public:
         } else {
             fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
                                               || !(primitiveValue->isPercentage() || primitiveValue->isFontRelativeLength()));
+
+            RenderStyle* gpStyle = 0;
+            ContainerNode* parentNode = styleResolver->parentNode();
+            if (parentNode) {
+                ContainerNode* gpNode = parentNode->parentNodeForRenderingAndStyle();
+                gpStyle = gpNode ? gpNode->renderStyle() : 0;
+            }
+
             if (primitiveValue->isLength())
-                size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), 1.0, true);
+                size = primitiveValue->computeLength<float>(styleResolver->parentStyle(), styleResolver->rootElementStyle(), gpStyle, 1.0, true);
             else if (primitiveValue->isPercentage())
                 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
             else if (primitiveValue->isCalculatedPercentageWithLength())
-                size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize);
+                size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver->parentStyle(), styleResolver->rootElementStyle(), gpStyle)->evaluate(parentSize);
             else if (primitiveValue->isViewportPercentageLength())
                 size = valueForLength(primitiveValue->viewportPercentageLength(), 0, styleResolver->document()->renderView());
             else
@@ -1200,7 +1209,7 @@ public:
                 if (Frame* frame = styleResolver->document()->frame())
                     multiplier *= frame->textZoomFactor();
             }
-            lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
+            lineHeight = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), multiplier);
         } else if (primitiveValue->isPercentage()) {
             // FIXME: percentage should not be restricted to an integer here.
             lineHeight = Length((styleResolver->style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
@@ -1222,8 +1231,8 @@ public:
 
 class ApplyPropertyPageSize {
 private:
-    static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0); }
-    static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0); }
+    static Length mmLength(double mm) { return CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLength<Length>(0, 0, 0); }
+    static Length inchLength(double inch) { return CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLength<Length>(0, 0, 0); }
     static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
     {
         DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148)));
@@ -1318,8 +1327,8 @@ public:
                 // <length>{2}
                 if (!second->isLength())
                     return;
-                width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
-                height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
+                width = first->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle());
+                height = second->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle());
             } else {
                 // <page-size> <orientation>
                 // The value order is guaranteed. See CSSParser::parseSizeParameter.
@@ -1337,7 +1346,7 @@ public:
             if (primitiveValue->isLength()) {
                 // <length>
                 pageSizeType = PAGE_SIZE_RESOLVED;
-                width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle());
+                width = height = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle());
             } else {
                 switch (primitiveValue->getIdent()) {
                 case 0:
@@ -1571,7 +1580,7 @@ public:
         if (primitiveValue->getIdent())
             return styleResolver->style()->setVerticalAlign(*primitiveValue);
 
-        styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom()));
+        styleResolver->style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->parentStyle(), styleResolver->style()->effectiveZoom()));
     }
 
     static PropertyHandler createHandler()
index de3a0a9..e1fee7b 100644 (file)
@@ -2757,14 +2757,14 @@ void RuleSet::shrinkToFit()
 // -------------------------------------------------------------------------------------
 // this is mostly boring stuff on how to apply a certain rule to the renderstyle...
 
-Length StyleResolver::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
+Length StyleResolver::convertToIntLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier)
 {
-    return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined);
+    return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, parentStyle, multiplier) : Length(Undefined);
 }
 
-Length StyleResolver::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, double multiplier)
+Length StyleResolver::convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier)
 {
-    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, multiplier) : Length(Undefined);
+    return primitiveValue ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion | ViewportPercentageConversion>(style, rootStyle, parentStyle, multiplier) : Length(Undefined);
 }
 
 template <StyleResolver::StyleApplicationPass pass>
@@ -3243,7 +3243,7 @@ bool StyleResolver::useSVGZoomRules()
 
 static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, Length& length)
 {
-    Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
+    Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector->parentStyle(), selector->style()->effectiveZoom());
     if (workingLength.isUndefined())
         return false;
 
@@ -3706,10 +3706,10 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
             if (!currValue->isShadowValue())
                 continue;
             ShadowValue* item = static_cast<ShadowValue*>(currValue);
-            int x = item->x->computeLength<int>(style(), m_rootElementStyle, zoomFactor);
-            int y = item->y->computeLength<int>(style(), m_rootElementStyle, zoomFactor);
-            int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle, zoomFactor) : 0;
-            int spread = item->spread ? item->spread->computeLength<int>(style(), m_rootElementStyle, zoomFactor) : 0;
+            int x = item->x->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor);
+            int y = item->y->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor);
+            int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor) : 0;
+            int spread = item->spread ? item->spread->computeLength<int>(style(), m_rootElementStyle, m_parentStyle, zoomFactor) : 0;
             ShadowStyle shadowStyle = item->style && item->style->getIdent() == CSSValueInset ? Inset : Normal;
             Color color;
             if (item->color)
@@ -3739,7 +3739,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
         RefPtr<StyleReflection> reflection = StyleReflection::create();
         reflection->setDirection(reflectValue->direction());
         if (reflectValue->offset())
-            reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(style(), m_rootElementStyle, zoomFactor));
+            reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(style(), m_rootElementStyle, m_parentStyle, zoomFactor));
         NinePieceImage mask;
         mask.setMaskDefaults();
         m_styleMap.mapNinePieceImage(id, reflectValue->mask(), mask);
@@ -3821,7 +3821,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
                 break;
             }
         } else {
-            Length marqueeLength = convertToIntLength(primitiveValue, style(), m_rootElementStyle);
+            Length marqueeLength = convertToIntLength(primitiveValue, style(), m_rootElementStyle, m_parentStyle);
             if (!marqueeLength.isUndefined())
                 m_style->setMarqueeIncrement(marqueeLength);
         }
@@ -3867,10 +3867,10 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
 
         DashboardRegion* first = region;
         while (region) {
-            Length top = convertToIntLength(region->top(), style(), m_rootElementStyle);
-            Length right = convertToIntLength(region->right(), style(), m_rootElementStyle);
-            Length bottom = convertToIntLength(region->bottom(), style(), m_rootElementStyle);
-            Length left = convertToIntLength(region->left(), style(), m_rootElementStyle);
+            Length top = convertToIntLength(region->top(), style(), m_rootElementStyle, m_parentStyle);
+            Length right = convertToIntLength(region->right(), style(), m_rootElementStyle, m_parentStyle);
+            Length bottom = convertToIntLength(region->bottom(), style(), m_rootElementStyle, m_parentStyle);
+            Length left = convertToIntLength(region->left(), style(), m_rootElementStyle, m_parentStyle);
 
             if (top.isUndefined())
                 top = Length();
@@ -3905,11 +3905,11 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
                 result *= 3;
             else if (primitiveValue->getIdent() == CSSValueThick)
                 result *= 5;
-            width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(style(), m_rootElementStyle, zoomFactor);
+            width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS)->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor);
             break;
         }
         default:
-            width = primitiveValue->computeLength<float>(style(), m_rootElementStyle, zoomFactor);
+            width = primitiveValue->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor);
             break;
         }
         m_style->setTextStrokeWidth(width);
@@ -3918,7 +3918,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
     case CSSPropertyWebkitTransform: {
         HANDLE_INHERIT_AND_INITIAL(transform, Transform);
         TransformOperations operations;
-        createTransformOperations(value, style(), m_rootElementStyle, operations);
+        createTransformOperations(value, style(), m_rootElementStyle, m_parentStyle, operations);
         m_style->setTransform(operations);
         return;
     }
@@ -3935,10 +3935,10 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
 
         float perspectiveValue;
         if (primitiveValue->isLength())
-            perspectiveValue = primitiveValue->computeLength<float>(style(), m_rootElementStyle, zoomFactor);
+            perspectiveValue = primitiveValue->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor);
         else if (primitiveValue->isNumber()) {
             // For backward compatibility, treat valueless numbers as px.
-            perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(style(), m_rootElementStyle, zoomFactor);
+            perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(style(), m_rootElementStyle, m_parentStyle, zoomFactor);
         } else
             return;
 
@@ -4814,7 +4814,7 @@ static TransformOperation::OperationType getTransformOperationType(WebKitCSSTran
     return TransformOperation::NONE;
 }
 
-bool StyleResolver::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, TransformOperations& outOperations)
+bool StyleResolver::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, RenderStyle* parentStyle, TransformOperations& outOperations)
 {
     if (!inValue || !inValue->isValueList()) {
         outOperations.clear();
@@ -4898,13 +4898,13 @@ bool StyleResolver::createTransformOperations(CSSValue* inValue, RenderStyle* st
             Length tx = Length(0, Fixed);
             Length ty = Length(0, Fixed);
             if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
-                ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+                ty = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor);
             else {
-                tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+                tx = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor);
                 if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
                     if (transformValue->length() > 1) {
                         CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
-                        ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);
+                        ty = convertToFloatLength(secondValue, style, rootStyle, parentStyle, zoomFactor);
                     }
                 }
             }
@@ -4921,19 +4921,19 @@ bool StyleResolver::createTransformOperations(CSSValue* inValue, RenderStyle* st
             Length ty = Length(0, Fixed);
             Length tz = Length(0, Fixed);
             if (transformValue->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation)
-                tz = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+                tz = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor);
             else if (transformValue->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
-                ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+                ty = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor);
             else {
-                tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+                tx = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor);
                 if (transformValue->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
                     if (transformValue->length() > 2) {
                         CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(2));
-                        tz = convertToFloatLength(thirdValue, style, rootStyle, zoomFactor);
+                        tz = convertToFloatLength(thirdValue, style, rootStyle, parentStyle, zoomFactor);
                     }
                     if (transformValue->length() > 1) {
                         CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(transformValue->itemWithoutBoundsCheck(1));
-                        ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);
+                        ty = convertToFloatLength(secondValue, style, rootStyle, parentStyle, zoomFactor);
                     }
                 }
             }
@@ -5036,7 +5036,7 @@ bool StyleResolver::createTransformOperations(CSSValue* inValue, RenderStyle* st
         case WebKitCSSTransformValue::PerspectiveTransformOperation: {
             Length p = Length(0, Fixed);
             if (firstValue->isLength())
-                p = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+                p = convertToFloatLength(firstValue, style, rootStyle, parentStyle, zoomFactor);
             else {
                 // This is a quirk that should go away when 3d transforms are finalized.
                 double val = firstValue->getDoubleValue();
@@ -5400,7 +5400,7 @@ bool StyleResolver::createFilterOperations(CSSValue* inValue, RenderStyle* style
         case WebKitCSSFilterValue::BlurFilterOperation: {
             Length stdDeviation = Length(0, Fixed);
             if (filterValue->length() >= 1)
-                stdDeviation = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
+                stdDeviation = convertToFloatLength(firstValue, style, rootStyle, parentStyle(), zoomFactor);
             if (stdDeviation.isUndefined())
                 return false;
 
@@ -5416,9 +5416,9 @@ bool StyleResolver::createFilterOperations(CSSValue* inValue, RenderStyle* style
                 continue;
 
             ShadowValue* item = static_cast<ShadowValue*>(cssValue);
-            IntPoint location(item->x->computeLength<int>(style, rootStyle, zoomFactor),
-                              item->y->computeLength<int>(style, rootStyle, zoomFactor));
-            int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, zoomFactor) : 0;
+            IntPoint location(item->x->computeLength<int>(style, rootStyle, m_parentStyle, zoomFactor),
+                              item->y->computeLength<int>(style, rootStyle, m_parentStyle, zoomFactor));
+            int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, m_parentStyle, zoomFactor) : 0;
             Color color;
             if (item->color)
                 color = colorFromPrimitiveValue(item->color.get());
index 4843eb5..748fda6 100644 (file)
@@ -156,7 +156,8 @@ public:
     void setEffectiveZoom(float f) { m_fontDirty |= style()->setEffectiveZoom(f); }
     void setTextSizeAdjust(bool b) { m_fontDirty |= style()->setTextSizeAdjust(b); }
     bool hasParentNode() const { return m_parentNode; }
-    
+    ContainerNode* parentNode() const { return m_parentNode; }
+
     void appendAuthorStylesheets(unsigned firstNew, const Vector<RefPtr<StyleSheet> >&);
     
     // Find the ids or classes the selectors on a stylesheet are scoped to. The selectors only apply to elements in subtrees where the root element matches the scope.
@@ -244,7 +245,7 @@ public:
     bool usesBeforeAfterRules() const { return m_features.usesBeforeAfterRules; }
     bool usesLinkRules() const { return m_features.usesLinkRules; }
 
-    static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations);
+    static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, RenderStyle* parentStyle, TransformOperations& outOperations);
     
     void invalidateMatchedPropertiesCache();
     
@@ -409,8 +410,8 @@ public:
     bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
     bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
 
-    static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
-    static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, double multiplier = 1);
+    static Length convertToIntLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1);
+    static Length convertToFloatLength(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, RenderStyle* parentStyle, double multiplier = 1);
 
     CSSToStyleMap* styleMap() { return &m_styleMap; }
     
index 92bfce3..872236b 100644 (file)
@@ -66,7 +66,7 @@ void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec)
             return;
 
         TransformOperations operations;
-        if (!StyleResolver::createTransformOperations(value.get(), 0, 0, operations)) {
+        if (!StyleResolver::createTransformOperations(value.get(), 0, 0, 0, operations)) {
             ec = SYNTAX_ERR;
             return;
         }