2009-03-24 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2009 19:52:03 +0000 (19:52 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2009 19:52:03 +0000 (19:52 +0000)
        Reviewed by Dave Hyatt

        https://bugs.webkit.org/show_bug.cgi?id=24784

        Length values in transform operations need to take zoom into account.

        Test: fast/transforms/transforms-with-zoom.html

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::createTransformOperations):

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

LayoutTests/ChangeLog
LayoutTests/fast/transforms/transforms-with-zoom.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSStyleSelector.cpp

index 70cc5f1..4eb0bff 100644 (file)
@@ -1,3 +1,16 @@
+2009-03-24  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt
+        
+        https://bugs.webkit.org/show_bug.cgi?id=24784
+        
+        Test for transforms with zoom.
+
+        * fast/transforms/transforms-with-zoom.html: Added.
+        * platform/mac/fast/transforms/transforms-with-zoom-expected.checksum: Added.
+        * platform/mac/fast/transforms/transforms-with-zoom-expected.png: Added.
+        * platform/mac/fast/transforms/transforms-with-zoom-expected.txt: Added.
+
 2009-03-25  David Hyatt  <hyatt@apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/LayoutTests/fast/transforms/transforms-with-zoom.html b/LayoutTests/fast/transforms/transforms-with-zoom.html
new file mode 100644 (file)
index 0000000..c3bb474
--- /dev/null
@@ -0,0 +1,52 @@
+<html>
+<head>
+<style>
+body {
+  margin: 0;
+  zoom: 120%;
+}
+.box {
+  position: absolute;
+  top: 20px;
+  width:100px;
+  height:100px;
+}
+
+.tester1 {
+  left: 100px;
+  top: 70px;
+  background-color: red;
+}
+
+.tester2 {
+  left: 250px;
+  top: 70px;
+  background-color: red;
+}
+
+.translated1 {
+  -webkit-transform: translate(100px, 50px);
+  background-color: green;
+}
+
+.translated2 {
+  -webkit-transform-origin: 50px, 50px;
+  -webkit-transform: translate(250px, 50px) rotate(90deg);
+  background-color: green;
+}
+
+</style>
+</head>
+<body>
+
+<p><a href="https://bugs.webkit.org/show_bug.cgi?id=24784">https://bugs.webkit.org/show_bug.cgi?id=24784</a></p>
+<p>Test transform lengths with zoom. You should see two green squares below, no red.</p>
+
+<div class="tester1 box"></div>
+<div class="tester2 box"></div>
+
+<div class="translated1 box"></div>
+<div class="translated2 box"></div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.checksum b/LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.checksum
new file mode 100644 (file)
index 0000000..67905dc
--- /dev/null
@@ -0,0 +1 @@
+83154238659dc2486e115edf01aed25f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.png b/LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.png
new file mode 100644 (file)
index 0000000..044d108
Binary files /dev/null and b/LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.txt b/LayoutTests/platform/mac/fast/transforms/transforms-with-zoom-expected.txt
new file mode 100644 (file)
index 0000000..4ddac9d
--- /dev/null
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (0,0) size 800x581
+      RenderBlock {P} at (0,0) size 800x22
+        RenderInline {A} at (0,0) size 375x22 [color=#0000EE]
+          RenderText {#text} at (0,0) size 375x22
+            text run at (0,0) width 375: "https://bugs.webkit.org/show_bug.cgi?id=24784"
+      RenderBlock {P} at (0,41) size 800x22
+        RenderText {#text} at (0,0) size 644x22
+          text run at (0,0) width 644: "Test transform lengths with zoom. You should see two green squares below, no red."
+layer at (120,84) size 120x120
+  RenderBlock (positioned) {DIV} at (120,84) size 120x120 [bgcolor=#FF0000]
+layer at (300,84) size 120x120
+  RenderBlock (positioned) {DIV} at (300,84) size 120x120 [bgcolor=#FF0000]
+layer at (0,24) size 120x120
+  RenderBlock (positioned) {DIV} at (0,24) size 120x120 [bgcolor=#008000]
+layer at (0,24) size 120x120
+  RenderBlock (positioned) {DIV} at (0,24) size 120x120 [bgcolor=#008000]
index 815e6c6..9b4f051 100644 (file)
@@ -1,3 +1,16 @@
+2009-03-24  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt
+        
+        https://bugs.webkit.org/show_bug.cgi?id=24784
+        
+        Length values in transform operations need to take zoom into account.
+
+        Test: fast/transforms/transforms-with-zoom.html
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::createTransformOperations):
+
 2009-03-25  David Hyatt  <hyatt@apple.com>
 
         Reviewed by Simon Fraser.
index 54c62a0..fd27892 100644 (file)
@@ -5894,6 +5894,8 @@ static TransformOperation::OperationType getTransformOperationType(WebKitCSSTran
 
 bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle* style, TransformOperations& outOperations)
 {
+    float zoomFactor = style ? style->effectiveZoom() : 1;
+
     TransformOperations operations;
     if (inValue && !inValue->isPrimitiveValue()) {
         CSSValueList* list = static_cast<CSSValueList*>(inValue);
@@ -5957,13 +5959,13 @@ bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle*
                     Length tx = Length(0, Fixed);
                     Length ty = Length(0, Fixed);
                     if (val->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
-                        ty = convertToLength(firstValue, style, 1, &ok);
+                        ty = convertToLength(firstValue, style, zoomFactor, &ok);
                     else { 
-                        tx = convertToLength(firstValue, style, 1, &ok);
+                        tx = convertToLength(firstValue, style, zoomFactor, &ok);
                         if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
                             if (val->length() > 1) {
                                 CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
-                                ty = convertToLength(secondValue, style, 1, &ok);
+                                ty = convertToLength(secondValue, style, zoomFactor, &ok);
                             }
                         }
                     }
@@ -5981,19 +5983,19 @@ bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle*
                     Length ty = Length(0, Fixed);
                     Length tz = Length(0, Fixed);
                     if (val->operationType() == WebKitCSSTransformValue::TranslateZTransformOperation)
-                        tz = convertToLength(firstValue, style, 1, &ok);
+                        tz = convertToLength(firstValue, style, zoomFactor, &ok);
                     else if (val->operationType() == WebKitCSSTransformValue::TranslateYTransformOperation)
-                        ty = convertToLength(firstValue, style, 1, &ok);
+                        ty = convertToLength(firstValue, style, zoomFactor, &ok);
                     else { 
-                        tx = convertToLength(firstValue, style, 1, &ok);
+                        tx = convertToLength(firstValue, style, zoomFactor, &ok);
                         if (val->operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) {
                             if (val->length() > 2) {
                                 CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(2));
-                                tz = convertToLength(thirdValue, style, 1, &ok);
+                                tz = convertToLength(thirdValue, style, zoomFactor, &ok);
                             }
                             if (val->length() > 1) {
                                 CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(val->itemWithoutBoundsCheck(1));
-                                ty = convertToLength(secondValue, style, 1, &ok);
+                                ty = convertToLength(secondValue, style, zoomFactor, &ok);
                             }
                         }
                     }