Title: [95129] trunk
Revision
95129
Author
[email protected]
Date
2011-09-14 15:24:23 -0700 (Wed, 14 Sep 2011)

Log Message

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

Tiles were not being properly centered within border image sides for the "repeat"
keyword. This patch fixes the buggy math behind the pattern tiling to actually get
the initial phases correct.

Source/WebCore: 

Reviewed by Sam Weinig.
        
Added new tests in fast/borders and updated broken existing tests.

* platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):

LayoutTests: 

Reviewed by Sam Weinig.

* fast/borders/border-image-massive-scale.html: Added.
* fast/borders/border-image-scaled-gradient.html: Added.
* platform/mac/fast/borders/border-image-massive-scale-expected.png: Added.
* platform/mac/fast/borders/border-image-massive-scale-expected.txt: Added.
* platform/mac/fast/borders/border-image-outset-expected.png:
* platform/mac/fast/borders/border-image-outset-in-shorthand-expected.png:
* platform/mac/fast/borders/border-image-outset-split-inline-expected.png:
* platform/mac/fast/borders/border-image-outset-split-inline-vertical-lr-expected.png:
* platform/mac/fast/borders/border-image-scaled-gradient-expected.png: Added.
* platform/mac/fast/borders/border-image-scaled-gradient-expected.txt: Added.
* platform/mac/fast/borders/border-image-side-reduction-expected.png:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95128 => 95129)


--- trunk/LayoutTests/ChangeLog	2011-09-14 22:14:33 UTC (rev 95128)
+++ trunk/LayoutTests/ChangeLog	2011-09-14 22:24:23 UTC (rev 95129)
@@ -1,3 +1,25 @@
+2011-09-14  David Hyatt  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=52736
+
+        Tiles were not being properly centered within border image sides for the "repeat"
+        keyword. This patch fixes the buggy math behind the pattern tiling to actually get
+        the initial phases correct.
+
+        Reviewed by Sam Weinig.
+
+        * fast/borders/border-image-massive-scale.html: Added.
+        * fast/borders/border-image-scaled-gradient.html: Added.
+        * platform/mac/fast/borders/border-image-massive-scale-expected.png: Added.
+        * platform/mac/fast/borders/border-image-massive-scale-expected.txt: Added.
+        * platform/mac/fast/borders/border-image-outset-expected.png:
+        * platform/mac/fast/borders/border-image-outset-in-shorthand-expected.png:
+        * platform/mac/fast/borders/border-image-outset-split-inline-expected.png:
+        * platform/mac/fast/borders/border-image-outset-split-inline-vertical-lr-expected.png:
+        * platform/mac/fast/borders/border-image-scaled-gradient-expected.png: Added.
+        * platform/mac/fast/borders/border-image-scaled-gradient-expected.txt: Added.
+        * platform/mac/fast/borders/border-image-side-reduction-expected.png:
+
 2011-09-14  Jeremy Apthorp  <[email protected]>
 
         Change mousedown events to keydown events, since eventSender.mouseDown

Added: trunk/LayoutTests/fast/borders/border-image-massive-scale.html (0 => 95129)


--- trunk/LayoutTests/fast/borders/border-image-massive-scale.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/border-image-massive-scale.html	2011-09-14 22:24:23 UTC (rev 95129)
@@ -0,0 +1,36 @@
+<html>
+<head>
+    <style>
+        div {
+            border-width: 105px 150px 150px 105px;
+            width: 75px;
+            height: 75px;
+            margin: 10px;
+            display: inline-block;
+        }
+
+        div.rr {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 repeat repeat;
+        }
+
+        div.rs {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 repeat stretch;
+        }
+
+        div.sr {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 stretch repeat;
+        }
+
+        div.ss {
+            -webkit-border-image: url("resources/border-image.png") 21 30 30 21 stretch stretch;
+        }
+    </style>
+</head>
+<body>
+    <div class="rr"></div>
+    <div class="rs"></div>
+    <br>
+    <div class="sr"></div>
+    <div class="ss"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/borders/border-image-scaled-gradient.html (0 => 95129)


--- trunk/LayoutTests/fast/borders/border-image-scaled-gradient.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/border-image-scaled-gradient.html	2011-09-14 22:24:23 UTC (rev 95129)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style>
+    div {
+      width: 300px;
+      height: 300px;
+      -webkit-border-image: -webkit-linear-gradient(30deg, black, white) 1 repeat;
+      border-image: -webkit-linear-gradient(30deg, black, white) 1 fill repeat;
+      border: 2px solid red;
+    }
+      
+  </style>
+</head>
+<body>
+  <div>
+  </div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac/fast/borders/border-image-massive-scale-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/borders/border-image-massive-scale-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/borders/border-image-massive-scale-expected.txt (0 => 95129)


--- trunk/LayoutTests/platform/mac/fast/borders/border-image-massive-scale-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/borders/border-image-massive-scale-expected.txt	2011-09-14 22:24:23 UTC (rev 95129)
@@ -0,0 +1,17 @@
+layer at (0,0) size 785x724
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x724
+  RenderBlock {HTML} at (0,0) size 785x724
+    RenderBody {BODY} at (8,8) size 769x708
+      RenderBlock {DIV} at (10,10) size 330x330 [border: (105px none #000000) (150px none #000000) (105px none #000000)]
+      RenderText {#text} at (350,336) size 4x18
+        text run at (350,336) width 4: " "
+      RenderBlock {DIV} at (364,10) size 330x330 [border: (105px none #000000) (150px none #000000) (105px none #000000)]
+      RenderText {#text} at (704,336) size 4x18
+        text run at (704,336) width 4: " "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBlock {DIV} at (10,364) size 330x330 [border: (105px none #000000) (150px none #000000) (105px none #000000)]
+      RenderText {#text} at (350,690) size 4x18
+        text run at (350,690) width 4: " "
+      RenderBlock {DIV} at (364,364) size 330x330 [border: (105px none #000000) (150px none #000000) (105px none #000000)]
+      RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/mac/fast/borders/border-image-outset-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/borders/border-image-outset-in-shorthand-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/borders/border-image-outset-split-inline-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/borders/border-image-outset-split-inline-vertical-lr-expected.png


(Binary files differ)

Added: trunk/LayoutTests/platform/mac/fast/borders/border-image-scaled-gradient-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/borders/border-image-scaled-gradient-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/borders/border-image-scaled-gradient-expected.txt (0 => 95129)


--- trunk/LayoutTests/platform/mac/fast/borders/border-image-scaled-gradient-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/borders/border-image-scaled-gradient-expected.txt	2011-09-14 22:24:23 UTC (rev 95129)
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x320
+  RenderBlock {HTML} at (0,0) size 800x320
+    RenderBody {BODY} at (8,8) size 784x304
+      RenderBlock {DIV} at (0,0) size 304x304 [border: (2px solid #FF0000)]

Modified: trunk/LayoutTests/platform/mac/fast/borders/border-image-side-reduction-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (95128 => 95129)


--- trunk/Source/WebCore/ChangeLog	2011-09-14 22:14:33 UTC (rev 95128)
+++ trunk/Source/WebCore/ChangeLog	2011-09-14 22:24:23 UTC (rev 95129)
@@ -1,3 +1,18 @@
+2011-09-14  David Hyatt  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=52736
+
+        Tiles were not being properly centered within border image sides for the "repeat"
+        keyword. This patch fixes the buggy math behind the pattern tiling to actually get
+        the initial phases correct.
+
+        Reviewed by Sam Weinig.
+        
+        Added new tests in fast/borders and updated broken existing tests.
+
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::drawTiled):
+
 2011-09-14  Anders Carlsson  <[email protected]>
 
         Remove DocTypeStrings.gperf

Modified: trunk/Source/WebCore/platform/graphics/Image.cpp (95128 => 95129)


--- trunk/Source/WebCore/platform/graphics/Image.cpp	2011-09-14 22:14:33 UTC (rev 95128)
+++ trunk/Source/WebCore/platform/graphics/Image.cpp	2011-09-14 22:24:23 UTC (rev 95129)
@@ -153,10 +153,12 @@
     // set for a particular rule).
     float hPhase = tileScaleFactor.width() * srcRect.x();
     float vPhase = tileScaleFactor.height() * srcRect.y();
+    float scaledTileWidth = tileScaleFactor.width() * srcRect.width();
+    float scaledTileHeight = tileScaleFactor.height() * srcRect.height();
     if (hRule == Image::RepeatTile)
-        hPhase -= fmodf(dstRect.width(), tileScaleFactor.width() * srcRect.width()) / 2.0f;
+        hPhase -= (dstRect.width() - scaledTileWidth) / 2;
     if (vRule == Image::RepeatTile)
-        vPhase -= fmodf(dstRect.height(), tileScaleFactor.height() * srcRect.height()) / 2.0f;
+        vPhase -= (dstRect.height() - scaledTileHeight) / 2; 
     FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase);
     
     drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace, op, dstRect);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to