CSS3 calc: enable mixed percent/absolute for font
authormikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Mar 2012 19:20:56 +0000 (19:20 +0000)
committermikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Mar 2012 19:20:56 +0000 (19:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80813

Reviewed by Ojan Vafai.

Source/WebCore:

Add support for mixed percent/absolute expressions to the font handling class.

* css/CSSStyleApplyProperty.cpp:
(WebCore::ApplyPropertyFontSize::applyValue):

LayoutTests:

* css3/calc/font-expected.txt:
* css3/calc/font-size-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/css3/calc/font-expected.txt
LayoutTests/css3/calc/font-size-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSStyleApplyProperty.cpp

index 09283ee946c4f52248e7e2acd1d7848ad2cecc6b..c155652e2c2ca17988c3e9acd3ddbc66f15e6d97 100644 (file)
@@ -1,3 +1,13 @@
+2012-03-12  Mike Lawther  <mikelawther@chromium.org>
+
+        CSS3 calc: enable mixed percent/absolute for font
+        https://bugs.webkit.org/show_bug.cgi?id=80813
+
+        Reviewed by Ojan Vafai.
+
+        * css3/calc/font-expected.txt:
+        * css3/calc/font-size-expected.txt:
+
 2012-03-12  Mike Reed  <reed@google.com>
 
         update expectations in preparation for bitmap-sampling fix in skia
index c456ce3c102c3b6687cfb94bc9fa3856c3907fc0..29497d82de21a0f71c02ef7251eead6a614891eb 100644 (file)
@@ -10,7 +10,7 @@ PASS getComputedStyle(document.getElementById("calc-height"), null).fontSize is
 PASS getComputedStyle(document.getElementById("calc-both"), null).lineHeight is "63px"
 PASS getComputedStyle(document.getElementById("calc-both"), null).fontSize is "24px"
 PASS getComputedStyle(document.getElementById("calc-percent-size"), null).lineHeight is "63px"
-FAIL getComputedStyle(document.getElementById("calc-percent-size"), null).fontSize should be 24px. Was 16px.
+PASS getComputedStyle(document.getElementById("calc-percent-size"), null).fontSize is "24px"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index d43da48a0e6cec8097376adb765220c09c448c42..e63ec4699b663944dec6e20aa3765b5e94750376 100644 (file)
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS getComputedStyle(document.getElementById("calc-percent"), null).fontSize is "40px"
-FAIL getComputedStyle(document.getElementById("calc-percent-pixels"), null).fontSize should be 40px. Was 20px.
+PASS getComputedStyle(document.getElementById("calc-percent-pixels"), null).fontSize is "40px"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 902011010abfaa7618d1bddb9ee5741e661d10c3..5839abd1d186d7a353008abfd8fc579a632f6016 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-12  Mike Lawther  <mikelawther@chromium.org>
+
+        CSS3 calc: enable mixed percent/absolute for font
+        https://bugs.webkit.org/show_bug.cgi?id=80813
+
+        Reviewed by Ojan Vafai.
+
+        Add support for mixed percent/absolute expressions to the font handling class.
+
+        * css/CSSStyleApplyProperty.cpp:
+        (WebCore::ApplyPropertyFontSize::applyValue):
+
 2012-03-12  Andreas Kling  <awesomekling@apple.com>
 
         Restore Attr::style() functionality.
index cfd6931d10069149b38f847d65eac8782997101b..37bc485d9d1f1c3f731fc9aade920262780b97a2 100644 (file)
@@ -739,6 +739,8 @@ public:
                 size = primitiveValue->computeLength<float>(selector->parentStyle(), selector->rootElementStyle(), 1.0, true);
             else if (primitiveValue->isPercentage())
                 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
+            else if (primitiveValue->isCalculatedPercentageWithLength())
+                size = primitiveValue->cssCalcValue()->toCalcValue(selector->parentStyle(), selector->rootElementStyle())->evaluate(parentSize);                
             else
                 return;
         }