WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Mar 2008 03:07:21 +0000 (03:07 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Mar 2008 03:07:21 +0000 (03:07 +0000)
        Reviewed by Dave Hyatt.

        - fix a percentage background position regression from r31389

        Test: fast/backgrounds/background-position-1.html

        * rendering/Length.h:
        (WebCore::Length::calcValue): Divide by 100.
        (WebCore::Length::calcMinValue): Ditto.

LayoutTests:

        Reviewed by Dave Hyatt.

        - pixel test for a percentage background position regression from r31389

        * fast/backgrounds/background-position-1.html: Added.
        * platform/mac/fast/backgrounds/background-position-1-expected.checksum: Added.
        * platform/mac/fast/backgrounds/background-position-1-expected.png: Added.
        * platform/mac/fast/backgrounds/background-position-1-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/backgrounds/background-position-1.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/Length.h

index c92ae35..d6faa8b 100644 (file)
@@ -1,3 +1,14 @@
+2008-03-28  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - pixel test for a percentage background position regression from r31389
+
+        * fast/backgrounds/background-position-1.html: Added.
+        * platform/mac/fast/backgrounds/background-position-1-expected.checksum: Added.
+        * platform/mac/fast/backgrounds/background-position-1-expected.png: Added.
+        * platform/mac/fast/backgrounds/background-position-1-expected.txt: Added.
+
 2008-03-28  Stephanie Lewis  <slewis@apple.com>
 
         Update Windows Skipped list.  Bugs filed.
diff --git a/LayoutTests/fast/backgrounds/background-position-1.html b/LayoutTests/fast/backgrounds/background-position-1.html
new file mode 100644 (file)
index 0000000..ed4d775
--- /dev/null
@@ -0,0 +1,7 @@
+<style>
+ div { height: 100px; width: 101px; background: url(../../http/tests/multipart/resources/green-100x100.png) no-repeat top 100%; }
+</style>
+<p>
+    This should be a green square:
+</p>
+<div></div>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.checksum b/LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.checksum
new file mode 100644 (file)
index 0000000..e009c9a
--- /dev/null
@@ -0,0 +1 @@
+2c038121b8fd9a265510ec136888ca78
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.png b/LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.png
new file mode 100644 (file)
index 0000000..76747d4
Binary files /dev/null and b/LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.txt b/LayoutTests/platform/mac/fast/backgrounds/background-position-1-expected.txt
new file mode 100644 (file)
index 0000000..9c23ade
--- /dev/null
@@ -0,0 +1,9 @@
+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 (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 192x18
+          text run at (0,0) width 192: "This should be a green square:"
+      RenderBlock {DIV} at (0,34) size 101x100
index 113c7f5..31fe47d 100644 (file)
@@ -1,3 +1,15 @@
+2008-03-28  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - fix a percentage background position regression from r31389
+
+        Test: fast/backgrounds/background-position-1.html
+
+        * rendering/Length.h:
+        (WebCore::Length::calcValue): Divide by 100.
+        (WebCore::Length::calcMinValue): Ditto.
+
 2008-03-28  David Hyatt  <hyatt@apple.com>
 
         Back out the Ahem font antialiasing hack, since it is now no longer required for LCD antialiased text
index d5188b1..44214f3 100644 (file)
@@ -111,7 +111,7 @@ namespace WebCore {
                     return value();
                 case Percent:
                     if (roundPercentages)
-                        return static_cast<int>(round(maxValue * percent()));
+                        return static_cast<int>(round(maxValue * percent() / 100.0));
                     return maxValue * rawValue() / (100 * percentScaleFactor);
                 case Auto:
                     return maxValue;
@@ -127,7 +127,7 @@ namespace WebCore {
                     return value();
                 case Percent:
                     if (roundPercentages)
-                        return static_cast<int>(round(maxValue * percent()));
+                        return static_cast<int>(round(maxValue * percent() / 100.0));
                     return maxValue * rawValue() / (100 * percentScaleFactor);
                 case Auto:
                 default: