Patch by Jason Liu <jason.liu@torchmobile.com.cn> on 2011-09-20
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2011 16:14:30 +0000 (16:14 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2011 16:14:30 +0000 (16:14 +0000)
Reviewed by Simon Fraser.

CSS outline property on a narrow element has rabbit ear artifacts
https://bugs.webkit.org/show_bug.cgi?id=36793

Patch by Jason Liu  <jason.liu@torchmobile.com.cn>
Patch updated by Robert Hogan <robert@webkit.org>

Source/WebCore:

Test: fast/css/outline-narrowLine.html

* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutlineForLine):

LayoutTests:

* fast/css/outline-narrowLine.html: Added.
* platform/qt/fast/css/outline-narrowLine-expected.txt: Added.
* platform/qt/fast/css/outline-narrowLine-expected.png: Added.
* platform/chromium-linux/fast/css/outline-narrowLine-expected.txt: Added.
* platform/chromium-linux/fast/css/outline-narrowLine-expected.png: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/outline-narrowLine.html [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/css/outline-narrowLine-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/css/outline-narrowLine-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/css/outline-narrowLine-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/fast/css/outline-narrowLine-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderInline.cpp

index a0f33d0..770eebe 100644 (file)
@@ -1,3 +1,19 @@
+2011-09-20  Jason Liu  <jason.liu@torchmobile.com.cn>
+
+        Reviewed by Simon Fraser.
+
+        CSS outline property on a narrow element has rabbit ear artifacts
+        https://bugs.webkit.org/show_bug.cgi?id=36793
+
+        Patch by Jason Liu  <jason.liu@torchmobile.com.cn>
+        Patch updated by Robert Hogan <robert@webkit.org>
+
+        * fast/css/outline-narrowLine.html: Added.
+        * platform/qt/fast/css/outline-narrowLine-expected.txt: Added.
+        * platform/qt/fast/css/outline-narrowLine-expected.png: Added.
+        * platform/chromium-linux/fast/css/outline-narrowLine-expected.txt: Added.
+        * platform/chromium-linux/fast/css/outline-narrowLine-expected.png: Added.
+
 2011-09-22  Marcus Bulach  <bulach@chromium.org>
 
         [chromium] Rebaseline following r95715
diff --git a/LayoutTests/fast/css/outline-narrowLine.html b/LayoutTests/fast/css/outline-narrowLine.html
new file mode 100644 (file)
index 0000000..10479ef
--- /dev/null
@@ -0,0 +1,32 @@
+<html>
+<body>
+<!--Outline around an empty span: WebKit does nothing here, as empty inlines are ignored.-->
+<p>
+<span style="outline: solid red 50px"></span>
+
+<!--Outline around a span with a line break:-->
+<p>
+<span style="outline: solid green 50px"><br></span>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+
+<!--Outline around a span with a line break and an 'x':-->
+<p>
+<span style="outline: solid blue 50px"><br>x</span>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+
+<!--Outline around a span with an 'x' and two line breaks:-->
+<p>
+<span style="outline: solid purple 50px">x<br><br></span>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-linux/fast/css/outline-narrowLine-expected.png b/LayoutTests/platform/chromium-linux/fast/css/outline-narrowLine-expected.png
new file mode 100644 (file)
index 0000000..83b38e1
Binary files /dev/null and b/LayoutTests/platform/chromium-linux/fast/css/outline-narrowLine-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux/fast/css/outline-narrowLine-expected.txt b/LayoutTests/platform/chromium-linux/fast/css/outline-narrowLine-expected.txt
new file mode 100644 (file)
index 0000000..17f3d1d
--- /dev/null
@@ -0,0 +1,40 @@
+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 784x576
+      RenderBlock {P} at (0,0) size 784x0
+        RenderInline {SPAN} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {P} at (0,0) size 784x140
+        RenderInline {SPAN} at (0,0) size 0x19
+          RenderBR {BR} at (0,0) size 0x19
+        RenderText {#text} at (0,0) size 0x0
+        RenderBR {BR} at (0,20) size 0x19
+        RenderBR {BR} at (0,40) size 0x19
+        RenderBR {BR} at (0,60) size 0x19
+        RenderBR {BR} at (0,80) size 0x19
+        RenderBR {BR} at (0,100) size 0x19
+        RenderBR {BR} at (0,120) size 0x19
+      RenderBlock {P} at (0,156) size 784x160
+        RenderInline {SPAN} at (0,0) size 7x39
+          RenderBR {BR} at (0,0) size 0x19
+          RenderText {#text} at (0,20) size 7x19
+            text run at (0,20) width 7: "x"
+        RenderText {#text} at (7,20) size 4x19
+          text run at (7,20) width 4: " "
+        RenderBR {BR} at (11,35) size 0x0
+        RenderBR {BR} at (0,40) size 0x19
+        RenderBR {BR} at (0,60) size 0x19
+        RenderBR {BR} at (0,80) size 0x19
+        RenderBR {BR} at (0,100) size 0x19
+        RenderBR {BR} at (0,120) size 0x19
+        RenderBR {BR} at (0,140) size 0x19
+      RenderBlock {P} at (0,332) size 784x40
+        RenderInline {SPAN} at (0,0) size 7x39
+          RenderText {#text} at (0,0) size 7x19
+            text run at (0,0) width 7: "x"
+          RenderBR {BR} at (7,15) size 0x0
+          RenderBR {BR} at (0,20) size 0x19
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/qt/fast/css/outline-narrowLine-expected.png b/LayoutTests/platform/qt/fast/css/outline-narrowLine-expected.png
new file mode 100644 (file)
index 0000000..14277bb
Binary files /dev/null and b/LayoutTests/platform/qt/fast/css/outline-narrowLine-expected.png differ
diff --git a/LayoutTests/platform/qt/fast/css/outline-narrowLine-expected.txt b/LayoutTests/platform/qt/fast/css/outline-narrowLine-expected.txt
new file mode 100644 (file)
index 0000000..54ec4ae
--- /dev/null
@@ -0,0 +1,40 @@
+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 784x576
+      RenderBlock {P} at (0,0) size 784x0
+        RenderInline {SPAN} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {P} at (0,0) size 784x154
+        RenderInline {SPAN} at (0,0) size 0x22
+          RenderBR {BR} at (0,0) size 0x22
+        RenderText {#text} at (0,0) size 0x0
+        RenderBR {BR} at (0,22) size 0x22
+        RenderBR {BR} at (0,44) size 0x22
+        RenderBR {BR} at (0,66) size 0x22
+        RenderBR {BR} at (0,88) size 0x22
+        RenderBR {BR} at (0,110) size 0x22
+        RenderBR {BR} at (0,132) size 0x22
+      RenderBlock {P} at (0,170) size 784x176
+        RenderInline {SPAN} at (0,0) size 8x44
+          RenderBR {BR} at (0,0) size 0x22
+          RenderText {#text} at (0,22) size 8x22
+            text run at (0,22) width 8: "x"
+        RenderText {#text} at (8,22) size 4x22
+          text run at (8,22) width 4: " "
+        RenderBR {BR} at (12,38) size 0x0
+        RenderBR {BR} at (0,44) size 0x22
+        RenderBR {BR} at (0,66) size 0x22
+        RenderBR {BR} at (0,88) size 0x22
+        RenderBR {BR} at (0,110) size 0x22
+        RenderBR {BR} at (0,132) size 0x22
+        RenderBR {BR} at (0,154) size 0x22
+      RenderBlock {P} at (0,362) size 784x44
+        RenderInline {SPAN} at (0,0) size 8x44
+          RenderText {#text} at (0,0) size 8x22
+            text run at (0,0) width 8: "x"
+          RenderBR {BR} at (8,16) size 0x0
+          RenderBR {BR} at (0,22) size 0x22
+        RenderText {#text} at (0,0) size 0x0
index 7b364a8..0822062 100644 (file)
@@ -1,3 +1,18 @@
+2011-09-20  Jason Liu  <jason.liu@torchmobile.com.cn>
+
+        Reviewed by Simon Fraser.
+
+        CSS outline property on a narrow element has rabbit ear artifacts
+        https://bugs.webkit.org/show_bug.cgi?id=36793
+
+        Patch by Jason Liu  <jason.liu@torchmobile.com.cn>
+        Patch updated by Robert Hogan <robert@webkit.org>
+
+        Test: fast/css/outline-narrowLine.html
+
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::paintOutlineForLine):
+
 2011-09-22  Wajahat Siddiqui  <mdwajahatali.siddiqui@motorola.com>
 
         [GTK]Popup drop-down menu contains extra empty spaces at beginning and 
index ff0662b..8c78fc2 100644 (file)
@@ -1475,7 +1475,18 @@ void RenderInline::paintOutlineForLine(GraphicsContext* graphicsContext, const L
             BSTop, outlineColor, outlineStyle,
             (!lastline.isEmpty() && left - outlineWidth < paintOffset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth,
             outlineWidth, antialias);
-    
+
+    if (thisline.x() == thisline.maxX())
+          drawLineForBoxSide(graphicsContext,
+            left - outlineWidth,
+            top - outlineWidth,
+            right + outlineWidth,
+            top,
+            BSTop, outlineColor, outlineStyle,
+            outlineWidth,
+            outlineWidth,
+            antialias);
+
     // lower edge
     if (thisline.x() < nextline.x())
         drawLineForBoxSide(graphicsContext,
@@ -1497,6 +1508,17 @@ void RenderInline::paintOutlineForLine(GraphicsContext* graphicsContext, const L
             BSBottom, outlineColor, outlineStyle,
             (!nextline.isEmpty() && left - outlineWidth < paintOffset.x() + nextline.maxX()) ? -outlineWidth : outlineWidth,
             outlineWidth, antialias);
+
+    if (thisline.x() == thisline.maxX())
+          drawLineForBoxSide(graphicsContext,
+            left - outlineWidth,
+            bottom,
+            right + outlineWidth,
+            bottom + outlineWidth,
+            BSBottom, outlineColor, outlineStyle,
+            outlineWidth,
+            outlineWidth,
+            antialias);
 }
 
 #if ENABLE(DASHBOARD_SUPPORT)