outline-style: auto leaves bits behind on strava's flyby view.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2015 23:04:52 +0000 (23:04 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2015 23:04:52 +0000 (23:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148178

Reviewed by Simon Fraser.

RenderView::m_maximalOutlineSize should include outline-offset.

Source/WebCore:

Test: fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint.html

* rendering/RenderElement.cpp:
(WebCore::RenderElement::computeMaxOutlineSize):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::adjustRectForOutlineAndShadow):

LayoutTests:

* fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint-expected.txt: Added.
* fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderObject.cpp

index 1ba71e8..fe0490c 100644 (file)
@@ -1,5 +1,17 @@
 2015-08-19  Zalan Bujtas  <zalan@apple.com>
 
+        outline-style: auto leaves bits behind on strava's flyby view.
+        https://bugs.webkit.org/show_bug.cgi?id=148178
+
+        Reviewed by Simon Fraser.
+
+        RenderView::m_maximalOutlineSize should include outline-offset.
+
+        * fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint-expected.txt: Added.
+        * fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint.html: Added.
+
+2015-08-19  Zalan Bujtas  <zalan@apple.com>
+
         Cleanup outline-style: auto painting.
         https://bugs.webkit.org/show_bug.cgi?id=148159
 
diff --git a/LayoutTests/fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint-expected.txt b/LayoutTests/fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint-expected.txt
new file mode 100644 (file)
index 0000000..1899b06
--- /dev/null
@@ -0,0 +1,6 @@
+PASS window.internals.repaintRectsAsText().indexOf('3 5') is not -1
+PASS window.internals.repaintRectsAsText().indexOf('3 45') is not -1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint.html b/LayoutTests/fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint.html
new file mode 100644 (file)
index 0000000..071d32e
--- /dev/null
@@ -0,0 +1,38 @@
+<html>
+<script>jsTestIsAsync = true;</script>
+<script src="../../resources/js-test-pre.js"></script>
+<head>
+<title>This tests that outline repaint rect for focus ring is correct.</title>
+<style>
+div {
+  position: absolute;
+  top: 10px;
+  height: 10px;
+  width: 10px;
+  outline-style: auto;
+  outline-width: 1px;
+  outline-offset: 2px;
+}
+</style>
+</head>
+<body>
+<div id=foo></div>
+</body>
+<script>
+setTimeout(
+       function() { 
+        if (window.internals)
+               internals.startTrackingRepaints();
+               document.getElementById("foo").style.top = "50px";
+               document.body.offsetWidth;
+
+        if (window.internals) {
+            shouldNotBe("window.internals.repaintRectsAsText().indexOf('3 5')", "-1");
+            shouldNotBe("window.internals.repaintRectsAsText().indexOf('3 45')", "-1");
+            internals.stopTrackingRepaints();
+        }
+        finishJSTest();
+       }, 0);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>
index 0671b63..10a4347 100644 (file)
@@ -1,3 +1,19 @@
+2015-08-19  Zalan Bujtas  <zalan@apple.com>
+
+        outline-style: auto leaves bits behind on strava's flyby view.
+        https://bugs.webkit.org/show_bug.cgi?id=148178
+
+        Reviewed by Simon Fraser.
+
+        RenderView::m_maximalOutlineSize should include outline-offset.
+
+        Test: fast/repaint/outline-auto-with-width-less-than-focus-ring-width-and-offset-repaint.html
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::computeMaxOutlineSize):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::adjustRectForOutlineAndShadow):
+
 2015-08-19  Anders Carlsson  <andersca@apple.com>
 
         Fix errors on bots.
index f2ae051..0a3df3b 100644 (file)
@@ -372,7 +372,7 @@ void RenderElement::computeMaxOutlineSize() const
         return;
     int maxOutlineSize = m_style->outlineSize();
     if (m_style->outlineStyleIsAuto())
-        maxOutlineSize = std::max(theme().platformFocusRingWidth(), maxOutlineSize);
+        maxOutlineSize = std::max(theme().platformFocusRingWidth() + m_style->outlineOffset(), maxOutlineSize);
 
     if (maxOutlineSize < maximalOutlineSize(PaintPhaseOutline))
         return;
index 4747e83..fbec338 100644 (file)
@@ -1918,7 +1918,7 @@ void RenderObject::adjustRectForOutlineAndShadow(LayoutRect& rect) const
 {
     int outlineSize = outlineStyleForRepaint().outlineSize();
     if (outlineStyleForRepaint().outlineStyleIsAuto())
-        outlineSize = std::max(theme().platformFocusRingWidth(), outlineSize);
+        outlineSize = std::max(theme().platformFocusRingWidth() + outlineStyleForRepaint().outlineOffset(), outlineSize);
     if (const ShadowData* boxShadow = style().boxShadow()) {
         boxShadow->adjustRectForShadow(rect, outlineSize);
         return;