Subpixel rendering: Make focusring painting subpixel aware.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Feb 2016 22:15:45 +0000 (22:15 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Feb 2016 22:15:45 +0000 (22:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154111

Reviewed by David Hyatt.

Do not integral snap focusring rects while collecting them (use device pixel snapping instead
right before passing them to GraphicsContext::drawFocusRing).

Source/WebCore:

Unable to test.

* platform/graphics/GraphicsContext.h:
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawFocusRingRects::create):
(WebCore::DisplayList::DrawFocusRingRects::rects):
(WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawFocusRing):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::drawFocusRing):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addFocusRingRectsForInlineChildren):
(WebCore::RenderBlock::addFocusRingRects):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::addFocusRingRectsForInlineChildren):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::addFocusRingRects):
* rendering/RenderBox.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::paintFocusRing):
(WebCore::RenderElement::issueRepaintForOutlineAuto):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::absoluteRects):
(WebCore::RenderInline::addFocusRingRects):
* rendering/RenderInline.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::addFocusRingRects):
* rendering/RenderListBox.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::addPDFURLRect):
(WebCore::RenderObject::absoluteFocusRingQuads):
* rendering/RenderObject.h:
(WebCore::RenderObject::addFocusRingRects):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::addFocusRingRects):
* rendering/RenderTextControl.h:
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::addFocusRingRects):
* rendering/svg/RenderSVGContainer.h:
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::addFocusRingRects):
* rendering/svg/RenderSVGImage.h:
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::addFocusRingRects):
* rendering/svg/RenderSVGShape.h:

LayoutTests:

* platform/mac/accessibility/image-link-expected.txt:
* platform/mac/accessibility/mac/aria-columnrowheaders-expected.txt: Copied from LayoutTests/platform/mac/accessibility/table-cells-expected.txt.
* platform/mac/accessibility/mac/document-links-expected.txt: Added.
* platform/mac/accessibility/table-attributes-expected.txt:
* platform/mac/accessibility/table-cells-expected.txt:
* platform/mac/accessibility/table-sections-expected.txt:
* platform/mac/accessibility/table-with-rules-expected.txt:

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

37 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/mac/aria-columnrowheaders-expected.txt
LayoutTests/accessibility/mac/document-links-expected.txt
LayoutTests/platform/mac/accessibility/image-link-expected.txt
LayoutTests/platform/mac/accessibility/table-attributes-expected.txt
LayoutTests/platform/mac/accessibility/table-cells-expected.txt
LayoutTests/platform/mac/accessibility/table-sections-expected.txt
LayoutTests/platform/mac/accessibility/table-with-rules-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h
Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Source/WebCore/rendering/svg/RenderSVGContainer.h
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGImage.h
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGShape.h

index a57f4ba..0c0928a 100644 (file)
@@ -1,3 +1,21 @@
+2016-02-11  Zalan Bujtas  <zalan@apple.com>
+
+        Subpixel rendering: Make focusring painting subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=154111
+
+        Reviewed by David Hyatt.
+
+        Do not integral snap focusring rects while collecting them (use device pixel snapping instead
+        right before passing them to GraphicsContext::drawFocusRing).
+
+        * platform/mac/accessibility/image-link-expected.txt:
+        * platform/mac/accessibility/mac/aria-columnrowheaders-expected.txt: Copied from LayoutTests/platform/mac/accessibility/table-cells-expected.txt.
+        * platform/mac/accessibility/mac/document-links-expected.txt: Added.
+        * platform/mac/accessibility/table-attributes-expected.txt:
+        * platform/mac/accessibility/table-cells-expected.txt:
+        * platform/mac/accessibility/table-sections-expected.txt:
+        * platform/mac/accessibility/table-with-rules-expected.txt:
+
 2016-02-11  Sukolsak Sakshuwong  <sukolsak@gmail.com>
 
         [INTL] Implement Intl.NumberFormat.prototype.resolvedOptions ()
index ca41b65..3c98db5 100644 (file)
@@ -46,7 +46,7 @@ AXRoleDescription: cell
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXCell>
-AXSize: NSSize: {56, 18}
+AXSize: NSSize: {54, 18}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -115,7 +115,7 @@ AXRoleDescription: cell
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXCell>
-AXSize: NSSize: {29, 18}
+AXSize: NSSize: {28, 18}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -149,7 +149,7 @@ AXRoleDescription: cell
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXCell>
-AXSize: NSSize: {29, 18}
+AXSize: NSSize: {28, 18}
 AXTitle: 
 AXDescription: 
 AXValue: 
index ac4ad3d..1634d93 100644 (file)
@@ -95,7 +95,7 @@ AXRoleDescription: link
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXLink: 'link 4'>
-AXSize: NSSize: {38, 18}
+AXSize: NSSize: {37, 18}
 AXTitle: link 4
 AXDescription: 
 AXValue: 
index 1a48774..cd8bbb6 100644 (file)
@@ -9,7 +9,7 @@ AXRoleDescription: link
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXLink: 'Delicious cake'>
-AXSize: NSSize: {280, 214}
+AXSize: NSSize: {280, 215}
 AXTitle: Delicious cake
 AXDescription: 
 AXValue: 
index a6b95d5..6e6dddd 100644 (file)
@@ -14,7 +14,7 @@ AXRoleDescription: cell
 AXChildren: <array of size 3>
 AXHelp: 
 AXParent: <AXCell>
-AXSize: NSSize: {144, 66}
+AXSize: NSSize: {145, 66}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -48,7 +48,7 @@ AXRoleDescription: cell
 AXChildren: <array of size 3>
 AXHelp: 
 AXParent: <AXCell>
-AXSize: NSSize: {144, 66}
+AXSize: NSSize: {145, 66}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -487,7 +487,7 @@ AXRoleDescription: row
 AXChildren: <array of size 3>
 AXHelp: 
 AXParent: <AXRow>
-AXSize: NSSize: {336, 30}
+AXSize: NSSize: {335, 30}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -515,7 +515,7 @@ AXRoleDescription: row
 AXChildren: <array of size 2>
 AXHelp: 
 AXParent: <AXRow>
-AXSize: NSSize: {336, 36}
+AXSize: NSSize: {335, 36}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -543,7 +543,7 @@ AXRoleDescription: row
 AXChildren: <array of size 5>
 AXHelp: 
 AXParent: <AXRow>
-AXSize: NSSize: {336, 30}
+AXSize: NSSize: {335, 30}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -571,7 +571,7 @@ AXRoleDescription: row
 AXChildren: <array of size 4>
 AXHelp: 
 AXParent: <AXRow>
-AXSize: NSSize: {336, 30}
+AXSize: NSSize: {335, 30}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -1083,7 +1083,7 @@ AXRoleDescription: group
 AXChildren: <array of size 5>
 AXHelp: 
 AXParent: <AXGroup>
-AXSize: NSSize: {336, 66}
+AXSize: NSSize: {335, 66}
 AXTitle: 
 AXDescription: 
 AXValue: 
index 1b0b4bd..270550e 100644 (file)
@@ -16,7 +16,7 @@ AXRoleDescription: cell
 AXChildren: <array of size 3>
 AXHelp: 
 AXParent: <AXCell>
-AXSize: NSSize: {144, 66}
+AXSize: NSSize: {145, 66}
 AXTitle: 
 AXDescription: 
 AXValue: 
index 89e7484..1239ea7 100644 (file)
@@ -57,7 +57,7 @@ AXRoleDescription: cell
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXCell>
-AXSize: NSSize: {29, 30}
+AXSize: NSSize: {28, 30}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -860,7 +860,7 @@ AXRoleDescription: group
 AXChildren: <array of size 3>
 AXHelp: 
 AXParent: <AXGroup>
-AXSize: NSSize: {76, 30}
+AXSize: NSSize: {77, 30}
 AXTitle: 
 AXDescription: 
 AXValue: 
@@ -1732,7 +1732,7 @@ AXRoleDescription: group
 AXChildren: <array of size 3>
 AXHelp: 
 AXParent: <AXGroup>
-AXSize: NSSize: {76, 30}
+AXSize: NSSize: {77, 30}
 AXTitle: 
 AXDescription: 
 AXValue: 
index 5af1e00..b67871e 100644 (file)
@@ -156,7 +156,7 @@ AXRoleDescription: group
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXGroup>
-AXSize: NSSize: {29, 20}
+AXSize: NSSize: {30, 20}
 AXTitle: 
 AXDescription: 
 AXValue: 
index b0b2d1d..7d6acf4 100644 (file)
@@ -1,3 +1,63 @@
+2016-02-11  Zalan Bujtas  <zalan@apple.com>
+
+        Subpixel rendering: Make focusring painting subpixel aware.
+        https://bugs.webkit.org/show_bug.cgi?id=154111
+
+        Reviewed by David Hyatt.
+
+        Do not integral snap focusring rects while collecting them (use device pixel snapping instead
+        right before passing them to GraphicsContext::drawFocusRing).
+
+        Unable to test.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::DrawFocusRingRects::create):
+        (WebCore::DisplayList::DrawFocusRingRects::rects):
+        (WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::drawFocusRing):
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/mac/GraphicsContextMac.mm:
+        (WebCore::GraphicsContext::drawFocusRing):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addFocusRingRectsForInlineChildren):
+        (WebCore::RenderBlock::addFocusRingRects):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::addFocusRingRectsForInlineChildren):
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::addFocusRingRects):
+        * rendering/RenderBox.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::paintFocusRing):
+        (WebCore::RenderElement::issueRepaintForOutlineAuto):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::absoluteRects):
+        (WebCore::RenderInline::addFocusRingRects):
+        * rendering/RenderInline.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::addFocusRingRects):
+        * rendering/RenderListBox.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::addPDFURLRect):
+        (WebCore::RenderObject::absoluteFocusRingQuads):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::addFocusRingRects):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::addFocusRingRects):
+        * rendering/RenderTextControl.h:
+        * rendering/svg/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::addFocusRingRects):
+        * rendering/svg/RenderSVGContainer.h:
+        * rendering/svg/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::addFocusRingRects):
+        * rendering/svg/RenderSVGImage.h:
+        * rendering/svg/RenderSVGShape.cpp:
+        (WebCore::RenderSVGShape::addFocusRingRects):
+        * rendering/svg/RenderSVGShape.h:
+
 2016-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Addressing post-review comments after r196393
index a4608e0..07f5520 100644 (file)
@@ -436,10 +436,10 @@ public:
     bool mustUseShadowBlur() const;
 #endif
 
-    void drawFocusRing(const Vector<IntRect>&, float width, float offset, const Color&);
+    void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&);
     void drawFocusRing(const Path&, float width, float offset, const Color&);
 #if PLATFORM(MAC)
-    void drawFocusRing(const Vector<IntRect>&, float width, float offset, double timeOffset, bool& needsRedraw);
+    void drawFocusRing(const Vector<FloatRect>&, float offset, double timeOffset, bool& needsRedraw);
 #endif
 
     void setLineCap(LineCap);
index b0036fd..f07920f 100644 (file)
@@ -609,7 +609,7 @@ void GraphicsContext::drawFocusRing(const Path& path, float width, float /* offs
     cairo_restore(cr);
 }
 
-void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float width, float /* offset */, const Color& color)
+void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float /* offset */, const Color& color)
 {
     if (paintingDisabled())
         return;
index 5065f38..6c07f63 100644 (file)
@@ -933,18 +933,18 @@ private:
 
 class DrawFocusRingRects : public DrawingItem {
 public:
-    static Ref<DrawFocusRingRects> create(const Vector<IntRect>& rects, int width, int offset, const Color& color)
+    static Ref<DrawFocusRingRects> create(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
     {
         return adoptRef(*new DrawFocusRingRects(rects, width, offset, color));
     }
 
-    const Vector<IntRect> rects() const { return m_rects; }
+    const Vector<FloatRect> rects() const { return m_rects; }
     int width() const { return m_width; }
     int offset() const { return m_offset; }
     Color color() const { return m_color; }
 
 private:
-    DrawFocusRingRects(const Vector<IntRect>& rects, int width, int offset, const Color& color)
+    DrawFocusRingRects(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
         : DrawingItem(ItemType::DrawFocusRingRects)
         , m_rects(rects)
         , m_width(width)
@@ -957,7 +957,7 @@ private:
 
     virtual Optional<FloatRect> localBounds(const GraphicsContext&) const override;
 
-    Vector<IntRect> m_rects;
+    Vector<FloatRect> m_rects;
     int m_width;
     int m_offset;
     Color m_color;
index bc0f109..5e52ec9 100644 (file)
@@ -247,7 +247,7 @@ void Recorder::drawFocusRing(const Path& path, int width, int offset, const Colo
     updateItemExtent(newItem);
 }
 
-void Recorder::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
+void Recorder::drawFocusRing(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
 {
     DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawFocusRingRects::create(rects, width, offset, color)));
     updateItemExtent(newItem);
index 52e39ac..a5d2c71 100644 (file)
@@ -98,7 +98,7 @@ public:
     void drawPath(const Path&);
 
     void drawFocusRing(const Path&, int width, int offset, const Color&);
-    void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&);
+    void drawFocusRing(const Vector<FloatRect>&, int width, int offset, const Color&);
 
     void save();
     void restore();
index 02558da..2729ec3 100644 (file)
@@ -85,7 +85,7 @@ void GraphicsContext::drawFocusRing(const Path& path, float /* width */, float /
 }
 
 #if PLATFORM(MAC)
-void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float, float offset, double timeOffset, bool& needsRedraw)
+void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float offset, double timeOffset, bool& needsRedraw)
 {
     if (paintingDisabled())
         return;
@@ -98,7 +98,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float, float o
 }
 #endif
 
-void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float, float offset, const Color&)
+void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float, float offset, const Color&)
 {
 #if !PLATFORM(IOS)
     if (paintingDisabled())
index d03f104..9f80769 100644 (file)
@@ -137,7 +137,7 @@ void GraphicsContext::drawFocusRing(const Path& path, float width, float offset,
 
 // FIXME: This is nearly identical to the GraphicsContext::drawFocusRing function in GraphicsContextMac.mm.
 // The code could move to GraphicsContextCG.cpp and be shared.
-void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float width, float offset, const Color& color)
+void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
 {
     if (paintingDisabled())
         return;
index de4cf7b..d7465fd 100644 (file)
@@ -3427,12 +3427,12 @@ LayoutRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, La
     return caretRect;
 }
 
-void RenderBlock::addFocusRingRectsForInlineChildren(Vector<IntRect>&, const LayoutPoint&, const RenderLayerModelObject*)
+void RenderBlock::addFocusRingRectsForInlineChildren(Vector<LayoutRect>&, const LayoutPoint&, const RenderLayerModelObject*)
 {
     ASSERT_NOT_REACHED();
 }
 
-void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
+void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
 {
     // For blocks inside inlines, we include margins so that we run right up to the inline boxes
     // above and below us (thus getting merged with them to form a single irregular shape).
@@ -3447,9 +3447,9 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& a
         float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit();
         LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
         if (!rect.isEmpty())
-            rects.append(snappedIntRect(rect));
+            rects.append(rect);
     } else if (width() && height())
-        rects.append(snappedIntRect(additionalOffset, size()));
+        rects.append(LayoutRect(additionalOffset, size()));
 
     if (!hasOverflowClip() && !hasControlClip()) {
         if (childrenInline())
index b38a982..6c068fb 100644 (file)
@@ -380,8 +380,8 @@ protected:
     void addOverflowFromPositionedObjects();
     void addVisualOverflowFromTheme();
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
-    virtual void addFocusRingRectsForInlineChildren(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
+    virtual void addFocusRingRectsForInlineChildren(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer);
 
     void computeRegionRangeForBoxChild(const RenderBox&) const;
 
index a421ffb..4cb08d6 100644 (file)
@@ -3457,7 +3457,7 @@ VisiblePosition RenderBlockFlow::positionForPoint(const LayoutPoint& point, cons
 }
 
 
-void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
+void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
 {
     ASSERT(childrenInline());
     for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
@@ -3465,7 +3465,7 @@ void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector<IntRect>& rects,
         LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->top() + curr->height());
         LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y() + top, curr->width(), bottom - top);
         if (!rect.isEmpty())
-            rects.append(snappedIntRect(rect));
+            rects.append(rect);
     }
 }
 
index b860d78..52bf26e 100644 (file)
@@ -533,7 +533,7 @@ private:
     
     Position positionForBox(InlineBox*, bool start = true) const;
     virtual VisiblePosition positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents, const RenderRegion*) override;
-    virtual void addFocusRingRectsForInlineChildren(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) override;
+    virtual void addFocusRingRectsForInlineChildren(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) override;
 
 // FIXME-BLOCKFLOW: These methods have implementations in
 // RenderBlockLineLayout. They should be moved to the proper header once the
index e59a343..26a05a0 100644 (file)
@@ -729,10 +729,10 @@ LayoutRect RenderBox::outlineBoundsForRepaint(const RenderLayerModelObject* repa
     return LayoutRect(snapRectToDevicePixels(box, document().deviceScaleFactor()));
 }
 
-void RenderBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
+void RenderBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
 {
     if (!size().isEmpty())
-        rects.append(snappedIntRect(additionalOffset, size()));
+        rects.append(LayoutRect(additionalOffset, size()));
 }
 
 int RenderBox::reflectionOffset() const
index 3432357..a5e3399 100644 (file)
@@ -170,7 +170,7 @@ public:
 
     // Bounds of the outline box in absolute coords. Respects transforms
     virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*repaintContainer*/, const RenderGeometryMap*) const override final;
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
     
     virtual FloatRect repaintRectInLocalCoordinates() const override { return borderBoxRect(); }
     virtual FloatRect objectBoundingBox() const override { return borderBoxRect(); }
index f2077a1..69731f2 100644 (file)
@@ -2085,15 +2085,19 @@ void RenderElement::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& pain
 {
     ASSERT(style.outlineStyleIsAuto());
 
-    Vector<IntRect> focusRingRects;
+    Vector<LayoutRect> focusRingRects;
     addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
+    Vector<FloatRect> pixelSnappedFocusRingRects;
+    float deviceScaleFactor = document().deviceScaleFactor();
+    for (const auto& rect : focusRingRects)
+        pixelSnappedFocusRingRects.append(snapRectToDevicePixels(rect, deviceScaleFactor));
 #if PLATFORM(MAC)
     bool needsRepaint;
-    paintInfo.context().drawFocusRing(focusRingRects, style.outlineWidth(), style.outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
+    paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, style.outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
     if (needsRepaint)
         document().page()->focusController().setFocusedElementNeedsRepaint();
 #else
-    paintInfo.context().drawFocusRing(focusRingRects, style.outlineWidth(), style.outlineOffset(), style.visitedDependentColor(CSSPropertyOutlineColor));
+    paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, style.outlineWidth(), style.outlineOffset(), style.visitedDependentColor(CSSPropertyOutlineColor));
 #endif
 }
 
@@ -2168,7 +2172,7 @@ void RenderElement::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRe
 void RenderElement::issueRepaintForOutlineAuto(float outlineSize)
 {
     LayoutRect repaintRect;
-    Vector<IntRect> focusRingRects;
+    Vector<LayoutRect> focusRingRects;
     addFocusRingRects(focusRingRects, LayoutPoint(), containerForRepaint());
     for (auto rect : focusRingRects) {
         rect.inflate(outlineSize);
index c5e4bf7..b6c6b54 100644 (file)
@@ -743,18 +743,18 @@ namespace {
 
 class AbsoluteRectsGeneratorContext {
 public:
-    AbsoluteRectsGeneratorContext(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset)
+    AbsoluteRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
         : m_rects(rects)
         , m_accumulatedOffset(accumulatedOffset) { }
 
     void addRect(const FloatRect& rect)
     {
-        IntRect intRect = enclosingIntRect(rect);
-        intRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y());
-        m_rects.append(intRect);
+        LayoutRect adjustedRect = LayoutRect(rect);
+        adjustedRect.moveBy(m_accumulatedOffset);
+        m_rects.append(adjustedRect);
     }
 private:
-    Vector<IntRect>& m_rects;
+    Vector<LayoutRect>& m_rects;
     const LayoutPoint& m_accumulatedOffset;
 };
 
@@ -762,8 +762,11 @@ private:
 
 void RenderInline::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
 {
-    AbsoluteRectsGeneratorContext context(rects, accumulatedOffset);
+    Vector<LayoutRect> lineboxRects;
+    AbsoluteRectsGeneratorContext context(lineboxRects, accumulatedOffset);
     generateLineBoxRects(context);
+    for (const auto& rect : lineboxRects)
+        rects.append(snappedIntRect(rect));
 
     if (RenderBoxModelObject* continuation = this->continuation()) {
         if (is<RenderBox>(*continuation)) {
@@ -1567,7 +1570,7 @@ void RenderInline::imageChanged(WrappedImagePtr, const IntRect*)
     repaint();
 }
 
-void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
+void RenderInline::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
 {
     AbsoluteRectsGeneratorContext context(rects, additionalOffset);
     generateLineBoxRects(context);
index 219cfa1..76411dc 100644 (file)
@@ -87,7 +87,7 @@ public:
     
     LayoutSize offsetForInFlowPositionedInline(const RenderBox* child) const;
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
     void paintOutline(PaintInfo&, const LayoutPoint&);
 
     using RenderBoxModelObject::continuation;
index 6b915a6..21353b6 100644 (file)
@@ -313,7 +313,7 @@ void RenderListBox::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOf
     }
 }
 
-void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
+void RenderListBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
 {
     if (!selectElement().allowsNonContiguousSelection())
         return RenderBlockFlow::addFocusRingRects(rects, additionalOffset, paintContainer);
@@ -332,7 +332,7 @@ void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
         HTMLElement* element = listItems[i];
         if (is<HTMLOptionElement>(*element) && !element->isDisabledFormControl()) {
             selectElement().setActiveSelectionEndIndex(i);
-            rects.append(snappedIntRect(itemBoundingBoxRect(additionalOffset, i)));
+            rects.append(itemBoundingBoxRect(additionalOffset, i));
             return;
         }
     }
index a2b0492..cf23f67 100644 (file)
@@ -89,7 +89,7 @@ private:
 
     virtual void layout() override;
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
 
     virtual bool canBeProgramaticallyScrolled() const override { return true; }
     virtual void autoscroll(const IntPoint&) override;
index beafc8b..854b4d9 100644 (file)
@@ -720,9 +720,9 @@ RenderBlock* RenderObject::containingBlock() const
 
 void RenderObject::addPDFURLRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    Vector<IntRect> focusRingRects;
+    Vector<LayoutRect> focusRingRects;
     addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
-    IntRect urlRect = unionRect(focusRingRects);
+    LayoutRect urlRect = unionRect(focusRingRects);
 
     if (urlRect.isEmpty())
         return;
@@ -798,18 +798,17 @@ IntRect RenderObject::absoluteBoundingBoxRect(bool useTransforms, bool* wasFixed
 
 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
 {
-    Vector<IntRect> rects;
+    Vector<LayoutRect> rects;
     // FIXME: addFocusRingRects() needs to be passed this transform-unaware
     // localToAbsolute() offset here because RenderInline::addFocusRingRects()
     // implicitly assumes that. This doesn't work correctly with transformed
     // descendants.
     FloatPoint absolutePoint = localToAbsolute();
     addFocusRingRects(rects, flooredLayoutPoint(absolutePoint));
-    size_t count = rects.size();
-    for (size_t i = 0; i < count; ++i) {
-        IntRect rect = rects[i];
-        rect.move(-absolutePoint.x(), -absolutePoint.y());
-        quads.append(localToAbsoluteQuad(FloatQuad(rect)));
+    float deviceScaleFactor = document().deviceScaleFactor();
+    for (auto rect : rects) {
+        rect.moveBy(LayoutPoint(-absolutePoint));
+        quads.append(localToAbsoluteQuad(FloatQuad(snapRectToDevicePixels(rect, deviceScaleFactor))));
     }
 }
 
index 90c1016..ad25836 100644 (file)
@@ -836,7 +836,7 @@ public:
     bool shouldUseTransformFromContainer(const RenderObject* container) const;
     void getTransformFromContainer(const RenderObject* container, const LayoutSize& offsetInContainer, TransformationMatrix&) const;
     
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = nullptr) { };
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = nullptr) { };
 
     LayoutRect absoluteOutlineBounds() const
     {
index 58e3dfe..77712b1 100644 (file)
@@ -231,10 +231,10 @@ void RenderTextControl::computePreferredLogicalWidths()
     setPreferredLogicalWidthsDirty(false);
 }
 
-void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
+void RenderTextControl::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
 {
     if (!size().isEmpty())
-        rects.append(snappedIntRect(additionalOffset, size()));
+        rects.append(LayoutRect(additionalOffset, size()));
 }
 
 RenderObject* RenderTextControl::layoutSpecialExcludedChild(bool relayoutChildren)
index 5f90115..d0f7e09 100644 (file)
@@ -80,7 +80,7 @@ private:
     virtual bool avoidsFloats() const override { return true; }
     virtual bool canHaveGeneratedChildren() const override { return false; }
     
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
 
     virtual bool canBeProgramaticallyScrolled() const override { return true; }
 
index 8cd89cc..326e0b7 100644 (file)
@@ -154,9 +154,9 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, const LayoutPoint&)
 }
 
 // addFocusRingRects is called from paintOutline and needs to be in the same coordinates as the paintOuline call
-void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
+void RenderSVGContainer::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
 {
-    IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
+    LayoutRect paintRectInParent = LayoutRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
     if (!paintRectInParent.isEmpty())
         rects.append(paintRectInParent);
 }
index 113c343..dded82b 100644 (file)
@@ -50,7 +50,7 @@ protected:
 
     virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) override final;
     virtual void removeChild(RenderObject&) override final;
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
 
     virtual FloatRect objectBoundingBox() const override final { return m_objectBoundingBox; }
     virtual FloatRect strokeBoundingBox() const override final { return m_strokeBoundingBox; }
index ca1d65b..cf4f2b8 100644 (file)
@@ -222,10 +222,10 @@ void RenderSVGImage::imageChanged(WrappedImagePtr, const IntRect*)
     repaint();
 }
 
-void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
+void RenderSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
 {
     // this is called from paint() after the localTransform has already been applied
-    IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates());
+    LayoutRect contentRect = LayoutRect(repaintRectInLocalCoordinates());
     if (!contentRect.isEmpty())
         rects.append(contentRect);
 }
index b36bd21..3692e40 100644 (file)
@@ -66,7 +66,7 @@ private:
     virtual FloatRect repaintRectInLocalCoordinates() const override { return m_repaintBoundingBox; }
     virtual FloatRect repaintRectInLocalCoordinatesExcludingSVGShadow() const override { return m_repaintBoundingBoxExcludingShadow; }
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
 
     virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
 
index 9de1913..3d8f8c2 100644 (file)
@@ -326,9 +326,9 @@ void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&)
 
 // This method is called from inside paintOutline() since we call paintOutline()
 // while transformed to our coord system, return local coords
-void RenderSVGShape::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
+void RenderSVGShape::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
 {
-    IntRect rect = enclosingIntRect(repaintRectInLocalCoordinates());
+    LayoutRect rect = LayoutRect(repaintRectInLocalCoordinates());
     if (!rect.isEmpty())
         rects.append(rect);
 }
index 14c31cc..cf4e01f 100644 (file)
@@ -98,7 +98,7 @@ private:
 
     virtual void layout() override final;
     virtual void paint(PaintInfo&, const LayoutPoint&) override final;
-    virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
 
     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override final;