outline-offset does not work for inlines.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jan 2016 20:32:01 +0000 (20:32 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jan 2016 20:32:01 +0000 (20:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153238

Reviewed by Simon Fraser.

Adjust outline box width/height with outline-offset.

Test: fast/inline/inlines-with-outline-offset.html

Source/WebCore:

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

LayoutTests:

* fast/inline/inlines-with-outline-offset-expected.html: Added.
* fast/inline/inlines-with-outline-offset.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/inline/inline-with-outline-offset-expected.html [new file with mode: 0644]
LayoutTests/fast/inline/inline-with-outline-offset.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderInline.cpp

index 7bf5bb5..779a617 100644 (file)
@@ -1,3 +1,17 @@
+2016-01-19  Zalan Bujtas  <zalan@apple.com>
+
+        outline-offset does not work for inlines.
+        https://bugs.webkit.org/show_bug.cgi?id=153238
+
+        Reviewed by Simon Fraser.
+
+        Adjust outline box width/height with outline-offset.
+
+        Test: fast/inline/inlines-with-outline-offset.html
+
+        * fast/inline/inlines-with-outline-offset-expected.html: Added.
+        * fast/inline/inlines-with-outline-offset.html: Added.
+
 2016-01-19  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: WebInspector.Object.addEventListener is O(n), make it O(1)
diff --git a/LayoutTests/fast/inline/inline-with-outline-offset-expected.html b/LayoutTests/fast/inline/inline-with-outline-offset-expected.html
new file mode 100644 (file)
index 0000000..b808c9a
--- /dev/null
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+<head>
+<title>This tests that outline-offset is applied properly on inline elements</title>
+<style>
+  div {
+    width: 120px;
+       outline-offset: 50px;
+       outline: solid red 1px;
+       color: white;
+       font-family: ahem;
+       font-size: 20px;
+  }
+</style>
+<body>
+<div>foobar</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/inline/inline-with-outline-offset.html b/LayoutTests/fast/inline/inline-with-outline-offset.html
new file mode 100644 (file)
index 0000000..f80e1f4
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+<head>
+<title>This tests that outline-offset is applied properly on inline elements</title>
+<style>
+  span {
+       outline-offset: 50px;
+       outline: solid red 1px;
+       color: white;
+       font-family: ahem;
+       font-size: 20px;
+  }
+</style>
+<body>
+<span>foobar</span>
+</body>
+</html>
index 192d058..55e4a29 100644 (file)
@@ -1,3 +1,18 @@
+2016-01-19  Zalan Bujtas  <zalan@apple.com>
+
+        outline-offset does not work for inlines.
+        https://bugs.webkit.org/show_bug.cgi?id=153238
+
+        Reviewed by Simon Fraser.
+
+        Adjust outline box width/height with outline-offset.
+
+        Test: fast/inline/inlines-with-outline-offset.html
+
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::paintOutline):
+        (WebCore::RenderInline::paintOutlineForLine):
+
 2016-01-19  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r195141.
index 125d6d4..c7080f9 100644 (file)
@@ -1609,11 +1609,10 @@ void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOf
     if (graphicsContext.paintingDisabled())
         return;
 
-    if (styleToUse.outlineStyleIsAuto() || styleToUse.outlineStyle() == BNONE)
+    if (styleToUse.outlineStyleIsAuto() || !styleToUse.hasOutline())
         return;
 
     Vector<LayoutRect> rects;
-
     rects.append(LayoutRect());
     for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
         const RootInlineBox& rootBox = curr->root();
@@ -1643,14 +1642,14 @@ void RenderInline::paintOutlineForLine(GraphicsContext& graphicsContext, const L
 {
     const RenderStyle& styleToUse = style();
     float outlineWidth = styleToUse.outlineWidth();
+    float outlineOffset = style().outlineOffset();
     EBorderStyle outlineStyle = styleToUse.outlineStyle();
 
     bool antialias = shouldAntialiasLines(graphicsContext);
 
-    float offset = style().outlineOffset();
 
-    LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOffset.y() + thisline.y() - offset),
-        LayoutSize(thisline.width() + offset, thisline.height() + offset));
+    LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - outlineOffset, paintOffset.y() + thisline.y() - outlineOffset),
+        LayoutSize(thisline.width() + 2 * outlineOffset, thisline.height() + 2 * outlineOffset));
 
     IntRect pixelSnappedBox = snappedIntRect(box);
     if (pixelSnappedBox.isEmpty())