Changeset 196439 in webkit


Ignore:
Timestamp:
Feb 11, 2016 2:15:45 PM (8 years ago)
Author:
Alan Bujtas
Message:

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).

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:
Location:
trunk
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196434 r196439  
     12016-02-11  Zalan Bujtas  <zalan@apple.com>
     2
     3        Subpixel rendering: Make focusring painting subpixel aware.
     4        https://bugs.webkit.org/show_bug.cgi?id=154111
     5
     6        Reviewed by David Hyatt.
     7
     8        Do not integral snap focusring rects while collecting them (use device pixel snapping instead
     9        right before passing them to GraphicsContext::drawFocusRing).
     10
     11        * platform/mac/accessibility/image-link-expected.txt:
     12        * platform/mac/accessibility/mac/aria-columnrowheaders-expected.txt: Copied from LayoutTests/platform/mac/accessibility/table-cells-expected.txt.
     13        * platform/mac/accessibility/mac/document-links-expected.txt: Added.
     14        * platform/mac/accessibility/table-attributes-expected.txt:
     15        * platform/mac/accessibility/table-cells-expected.txt:
     16        * platform/mac/accessibility/table-sections-expected.txt:
     17        * platform/mac/accessibility/table-with-rules-expected.txt:
     18
    1192016-02-11  Sukolsak Sakshuwong  <sukolsak@gmail.com>
    220
  • trunk/LayoutTests/accessibility/mac/aria-columnrowheaders-expected.txt

    r190833 r196439  
    4747AXHelp:
    4848AXParent: <AXCell>
    49 AXSize: NSSize: {56, 18}
     49AXSize: NSSize: {54, 18}
    5050AXTitle:
    5151AXDescription:
     
    116116AXHelp:
    117117AXParent: <AXCell>
    118 AXSize: NSSize: {29, 18}
     118AXSize: NSSize: {28, 18}
    119119AXTitle:
    120120AXDescription:
     
    150150AXHelp:
    151151AXParent: <AXCell>
    152 AXSize: NSSize: {29, 18}
     152AXSize: NSSize: {28, 18}
    153153AXTitle:
    154154AXDescription:
  • trunk/LayoutTests/accessibility/mac/document-links-expected.txt

    r187799 r196439  
    9696AXHelp:
    9797AXParent: <AXLink: 'link 4'>
    98 AXSize: NSSize: {38, 18}
     98AXSize: NSSize: {37, 18}
    9999AXTitle: link 4
    100100AXDescription:
  • trunk/LayoutTests/platform/mac/accessibility/image-link-expected.txt

    r171360 r196439  
    1010AXHelp:
    1111AXParent: <AXLink: 'Delicious cake'>
    12 AXSize: NSSize: {280, 214}
     12AXSize: NSSize: {280, 215}
    1313AXTitle: Delicious cake
    1414AXDescription:
  • trunk/LayoutTests/platform/mac/accessibility/table-attributes-expected.txt

    r191623 r196439  
    1515AXHelp:
    1616AXParent: <AXCell>
    17 AXSize: NSSize: {144, 66}
     17AXSize: NSSize: {145, 66}
    1818AXTitle:
    1919AXDescription:
     
    4949AXHelp:
    5050AXParent: <AXCell>
    51 AXSize: NSSize: {144, 66}
     51AXSize: NSSize: {145, 66}
    5252AXTitle:
    5353AXDescription:
     
    488488AXHelp:
    489489AXParent: <AXRow>
    490 AXSize: NSSize: {336, 30}
     490AXSize: NSSize: {335, 30}
    491491AXTitle:
    492492AXDescription:
     
    516516AXHelp:
    517517AXParent: <AXRow>
    518 AXSize: NSSize: {336, 36}
     518AXSize: NSSize: {335, 36}
    519519AXTitle:
    520520AXDescription:
     
    544544AXHelp:
    545545AXParent: <AXRow>
    546 AXSize: NSSize: {336, 30}
     546AXSize: NSSize: {335, 30}
    547547AXTitle:
    548548AXDescription:
     
    572572AXHelp:
    573573AXParent: <AXRow>
    574 AXSize: NSSize: {336, 30}
     574AXSize: NSSize: {335, 30}
    575575AXTitle:
    576576AXDescription:
     
    10841084AXHelp:
    10851085AXParent: <AXGroup>
    1086 AXSize: NSSize: {336, 66}
     1086AXSize: NSSize: {335, 66}
    10871087AXTitle:
    10881088AXDescription:
  • trunk/LayoutTests/platform/mac/accessibility/table-cells-expected.txt

    r191623 r196439  
    1717AXHelp:
    1818AXParent: <AXCell>
    19 AXSize: NSSize: {144, 66}
     19AXSize: NSSize: {145, 66}
    2020AXTitle:
    2121AXDescription:
  • trunk/LayoutTests/platform/mac/accessibility/table-sections-expected.txt

    r191623 r196439  
    5858AXHelp:
    5959AXParent: <AXCell>
    60 AXSize: NSSize: {29, 30}
     60AXSize: NSSize: {28, 30}
    6161AXTitle:
    6262AXDescription:
     
    861861AXHelp:
    862862AXParent: <AXGroup>
    863 AXSize: NSSize: {76, 30}
     863AXSize: NSSize: {77, 30}
    864864AXTitle:
    865865AXDescription:
     
    17331733AXHelp:
    17341734AXParent: <AXGroup>
    1735 AXSize: NSSize: {76, 30}
     1735AXSize: NSSize: {77, 30}
    17361736AXTitle:
    17371737AXDescription:
  • trunk/LayoutTests/platform/mac/accessibility/table-with-rules-expected.txt

    r191623 r196439  
    157157AXHelp:
    158158AXParent: <AXGroup>
    159 AXSize: NSSize: {29, 20}
     159AXSize: NSSize: {30, 20}
    160160AXTitle:
    161161AXDescription:
  • trunk/Source/WebCore/ChangeLog

    r196438 r196439  
     12016-02-11  Zalan Bujtas  <zalan@apple.com>
     2
     3        Subpixel rendering: Make focusring painting subpixel aware.
     4        https://bugs.webkit.org/show_bug.cgi?id=154111
     5
     6        Reviewed by David Hyatt.
     7
     8        Do not integral snap focusring rects while collecting them (use device pixel snapping instead
     9        right before passing them to GraphicsContext::drawFocusRing).
     10
     11        Unable to test.
     12
     13        * platform/graphics/GraphicsContext.h:
     14        * platform/graphics/displaylists/DisplayListItems.h:
     15        (WebCore::DisplayList::DrawFocusRingRects::create):
     16        (WebCore::DisplayList::DrawFocusRingRects::rects):
     17        (WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):
     18        * platform/graphics/displaylists/DisplayListRecorder.cpp:
     19        (WebCore::DisplayList::Recorder::drawFocusRing):
     20        * platform/graphics/displaylists/DisplayListRecorder.h:
     21        * platform/graphics/mac/GraphicsContextMac.mm:
     22        (WebCore::GraphicsContext::drawFocusRing):
     23        * rendering/RenderBlock.cpp:
     24        (WebCore::RenderBlock::addFocusRingRectsForInlineChildren):
     25        (WebCore::RenderBlock::addFocusRingRects):
     26        * rendering/RenderBlock.h:
     27        * rendering/RenderBlockFlow.cpp:
     28        (WebCore::RenderBlockFlow::addFocusRingRectsForInlineChildren):
     29        * rendering/RenderBlockFlow.h:
     30        * rendering/RenderBox.cpp:
     31        (WebCore::RenderBox::addFocusRingRects):
     32        * rendering/RenderBox.h:
     33        * rendering/RenderElement.cpp:
     34        (WebCore::RenderElement::paintFocusRing):
     35        (WebCore::RenderElement::issueRepaintForOutlineAuto):
     36        * rendering/RenderInline.cpp:
     37        (WebCore::RenderInline::absoluteRects):
     38        (WebCore::RenderInline::addFocusRingRects):
     39        * rendering/RenderInline.h:
     40        * rendering/RenderListBox.cpp:
     41        (WebCore::RenderListBox::addFocusRingRects):
     42        * rendering/RenderListBox.h:
     43        * rendering/RenderObject.cpp:
     44        (WebCore::RenderObject::addPDFURLRect):
     45        (WebCore::RenderObject::absoluteFocusRingQuads):
     46        * rendering/RenderObject.h:
     47        (WebCore::RenderObject::addFocusRingRects):
     48        * rendering/RenderTextControl.cpp:
     49        (WebCore::RenderTextControl::addFocusRingRects):
     50        * rendering/RenderTextControl.h:
     51        * rendering/svg/RenderSVGContainer.cpp:
     52        (WebCore::RenderSVGContainer::addFocusRingRects):
     53        * rendering/svg/RenderSVGContainer.h:
     54        * rendering/svg/RenderSVGImage.cpp:
     55        (WebCore::RenderSVGImage::addFocusRingRects):
     56        * rendering/svg/RenderSVGImage.h:
     57        * rendering/svg/RenderSVGShape.cpp:
     58        (WebCore::RenderSVGShape::addFocusRingRects):
     59        * rendering/svg/RenderSVGShape.h:
     60
    1612016-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
    262
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r195848 r196439  
    437437#endif
    438438
    439     void drawFocusRing(const Vector<IntRect>&, float width, float offset, const Color&);
     439    void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&);
    440440    void drawFocusRing(const Path&, float width, float offset, const Color&);
    441441#if PLATFORM(MAC)
    442     void drawFocusRing(const Vector<IntRect>&, float width, float offset, double timeOffset, bool& needsRedraw);
     442    void drawFocusRing(const Vector<FloatRect>&, float offset, double timeOffset, bool& needsRedraw);
    443443#endif
    444444
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r195170 r196439  
    610610}
    611611
    612 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float width, float /* offset */, const Color& color)
     612void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float /* offset */, const Color& color)
    613613{
    614614    if (paintingDisabled())
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h

    r195170 r196439  
    934934class DrawFocusRingRects : public DrawingItem {
    935935public:
    936     static Ref<DrawFocusRingRects> create(const Vector<IntRect>& rects, int width, int offset, const Color& color)
     936    static Ref<DrawFocusRingRects> create(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
    937937    {
    938938        return adoptRef(*new DrawFocusRingRects(rects, width, offset, color));
    939939    }
    940940
    941     const Vector<IntRect> rects() const { return m_rects; }
     941    const Vector<FloatRect> rects() const { return m_rects; }
    942942    int width() const { return m_width; }
    943943    int offset() const { return m_offset; }
     
    945945
    946946private:
    947     DrawFocusRingRects(const Vector<IntRect>& rects, int width, int offset, const Color& color)
     947    DrawFocusRingRects(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
    948948        : DrawingItem(ItemType::DrawFocusRingRects)
    949949        , m_rects(rects)
     
    958958    virtual Optional<FloatRect> localBounds(const GraphicsContext&) const override;
    959959
    960     Vector<IntRect> m_rects;
     960    Vector<FloatRect> m_rects;
    961961    int m_width;
    962962    int m_offset;
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp

    r195185 r196439  
    248248}
    249249
    250 void Recorder::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
     250void Recorder::drawFocusRing(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
    251251{
    252252    DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawFocusRingRects::create(rects, width, offset, color)));
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h

    r195170 r196439  
    9999
    100100    void drawFocusRing(const Path&, int width, int offset, const Color&);
    101     void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&);
     101    void drawFocusRing(const Vector<FloatRect>&, int width, int offset, const Color&);
    102102
    103103    void save();
  • trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm

    r194421 r196439  
    8686
    8787#if PLATFORM(MAC)
    88 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float, float offset, double timeOffset, bool& needsRedraw)
     88void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float offset, double timeOffset, bool& needsRedraw)
    8989{
    9090    if (paintingDisabled())
     
    9999#endif
    100100
    101 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float, float offset, const Color&)
     101void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float, float offset, const Color&)
    102102{
    103103#if !PLATFORM(IOS)
  • trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp

    r194798 r196439  
    138138// FIXME: This is nearly identical to the GraphicsContext::drawFocusRing function in GraphicsContextMac.mm.
    139139// The code could move to GraphicsContextCG.cpp and be shared.
    140 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float width, float offset, const Color& color)
     140void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
    141141{
    142142    if (paintingDisabled())
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r196222 r196439  
    34283428}
    34293429
    3430 void RenderBlock::addFocusRingRectsForInlineChildren(Vector<IntRect>&, const LayoutPoint&, const RenderLayerModelObject*)
     3430void RenderBlock::addFocusRingRectsForInlineChildren(Vector<LayoutRect>&, const LayoutPoint&, const RenderLayerModelObject*)
    34313431{
    34323432    ASSERT_NOT_REACHED();
    34333433}
    34343434
    3435 void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
     3435void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
    34363436{
    34373437    // For blocks inside inlines, we include margins so that we run right up to the inline boxes
     
    34483448        LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
    34493449        if (!rect.isEmpty())
    3450             rects.append(snappedIntRect(rect));
     3450            rects.append(rect);
    34513451    } else if (width() && height())
    3452         rects.append(snappedIntRect(additionalOffset, size()));
     3452        rects.append(LayoutRect(additionalOffset, size()));
    34533453
    34543454    if (!hasOverflowClip() && !hasControlClip()) {
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r194417 r196439  
    381381    void addVisualOverflowFromTheme();
    382382
    383     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
    384     virtual void addFocusRingRectsForInlineChildren(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer);
     383    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
     384    virtual void addFocusRingRectsForInlineChildren(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer);
    385385
    386386    void computeRegionRangeForBoxChild(const RenderBox&) const;
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r196222 r196439  
    34583458
    34593459
    3460 void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
     3460void RenderBlockFlow::addFocusRingRectsForInlineChildren(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
    34613461{
    34623462    ASSERT(childrenInline());
     
    34663466        LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y() + top, curr->width(), bottom - top);
    34673467        if (!rect.isEmpty())
    3468             rects.append(snappedIntRect(rect));
     3468            rects.append(rect);
    34693469    }
    34703470}
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r194496 r196439  
    534534    Position positionForBox(InlineBox*, bool start = true) const;
    535535    virtual VisiblePosition positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents, const RenderRegion*) override;
    536     virtual void addFocusRingRectsForInlineChildren(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) override;
     536    virtual void addFocusRingRectsForInlineChildren(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) override;
    537537
    538538// FIXME-BLOCKFLOW: These methods have implementations in
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r196222 r196439  
    730730}
    731731
    732 void RenderBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
     732void RenderBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
    733733{
    734734    if (!size().isEmpty())
    735         rects.append(snappedIntRect(additionalOffset, size()));
     735        rects.append(LayoutRect(additionalOffset, size()));
    736736}
    737737
  • trunk/Source/WebCore/rendering/RenderBox.h

    r195284 r196439  
    171171    // Bounds of the outline box in absolute coords. Respects transforms
    172172    virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*repaintContainer*/, const RenderGeometryMap*) const override final;
    173     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
     173    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
    174174   
    175175    virtual FloatRect repaintRectInLocalCoordinates() const override { return borderBoxRect(); }
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r196222 r196439  
    20862086    ASSERT(style.outlineStyleIsAuto());
    20872087
    2088     Vector<IntRect> focusRingRects;
     2088    Vector<LayoutRect> focusRingRects;
    20892089    addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
     2090    Vector<FloatRect> pixelSnappedFocusRingRects;
     2091    float deviceScaleFactor = document().deviceScaleFactor();
     2092    for (const auto& rect : focusRingRects)
     2093        pixelSnappedFocusRingRects.append(snapRectToDevicePixels(rect, deviceScaleFactor));
    20902094#if PLATFORM(MAC)
    20912095    bool needsRepaint;
    2092     paintInfo.context().drawFocusRing(focusRingRects, style.outlineWidth(), style.outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
     2096    paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, style.outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
    20932097    if (needsRepaint)
    20942098        document().page()->focusController().setFocusedElementNeedsRepaint();
    20952099#else
    2096     paintInfo.context().drawFocusRing(focusRingRects, style.outlineWidth(), style.outlineOffset(), style.visitedDependentColor(CSSPropertyOutlineColor));
     2100    paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, style.outlineWidth(), style.outlineOffset(), style.visitedDependentColor(CSSPropertyOutlineColor));
    20972101#endif
    20982102}
     
    21692173{
    21702174    LayoutRect repaintRect;
    2171     Vector<IntRect> focusRingRects;
     2175    Vector<LayoutRect> focusRingRects;
    21722176    addFocusRingRects(focusRingRects, LayoutPoint(), containerForRepaint());
    21732177    for (auto rect : focusRingRects) {
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r196334 r196439  
    744744class AbsoluteRectsGeneratorContext {
    745745public:
    746     AbsoluteRectsGeneratorContext(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset)
     746    AbsoluteRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
    747747        : m_rects(rects)
    748748        , m_accumulatedOffset(accumulatedOffset) { }
     
    750750    void addRect(const FloatRect& rect)
    751751    {
    752         IntRect intRect = enclosingIntRect(rect);
    753         intRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y());
    754         m_rects.append(intRect);
     752        LayoutRect adjustedRect = LayoutRect(rect);
     753        adjustedRect.moveBy(m_accumulatedOffset);
     754        m_rects.append(adjustedRect);
    755755    }
    756756private:
    757     Vector<IntRect>& m_rects;
     757    Vector<LayoutRect>& m_rects;
    758758    const LayoutPoint& m_accumulatedOffset;
    759759};
     
    763763void RenderInline::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
    764764{
    765     AbsoluteRectsGeneratorContext context(rects, accumulatedOffset);
     765    Vector<LayoutRect> lineboxRects;
     766    AbsoluteRectsGeneratorContext context(lineboxRects, accumulatedOffset);
    766767    generateLineBoxRects(context);
     768    for (const auto& rect : lineboxRects)
     769        rects.append(snappedIntRect(rect));
    767770
    768771    if (RenderBoxModelObject* continuation = this->continuation()) {
     
    15681571}
    15691572
    1570 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
     1573void RenderInline::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
    15711574{
    15721575    AbsoluteRectsGeneratorContext context(rects, additionalOffset);
  • trunk/Source/WebCore/rendering/RenderInline.h

    r194016 r196439  
    8888    LayoutSize offsetForInFlowPositionedInline(const RenderBox* child) const;
    8989
    90     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
     90    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
    9191    void paintOutline(PaintInfo&, const LayoutPoint&);
    9292
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r196222 r196439  
    314314}
    315315
    316 void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
     316void RenderListBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
    317317{
    318318    if (!selectElement().allowsNonContiguousSelection())
     
    333333        if (is<HTMLOptionElement>(*element) && !element->isDisabledFormControl()) {
    334334            selectElement().setActiveSelectionEndIndex(i);
    335             rects.append(snappedIntRect(itemBoundingBoxRect(additionalOffset, i)));
     335            rects.append(itemBoundingBoxRect(additionalOffset, i));
    336336            return;
    337337        }
  • trunk/Source/WebCore/rendering/RenderListBox.h

    r194515 r196439  
    9090    virtual void layout() override;
    9191
    92     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
     92    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = nullptr) override;
    9393
    9494    virtual bool canBeProgramaticallyScrolled() const override { return true; }
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r196222 r196439  
    721721void RenderObject::addPDFURLRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    722722{
    723     Vector<IntRect> focusRingRects;
     723    Vector<LayoutRect> focusRingRects;
    724724    addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
    725     IntRect urlRect = unionRect(focusRingRects);
     725    LayoutRect urlRect = unionRect(focusRingRects);
    726726
    727727    if (urlRect.isEmpty())
     
    799799void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
    800800{
    801     Vector<IntRect> rects;
     801    Vector<LayoutRect> rects;
    802802    // FIXME: addFocusRingRects() needs to be passed this transform-unaware
    803803    // localToAbsolute() offset here because RenderInline::addFocusRingRects()
     
    806806    FloatPoint absolutePoint = localToAbsolute();
    807807    addFocusRingRects(rects, flooredLayoutPoint(absolutePoint));
    808     size_t count = rects.size();
    809     for (size_t i = 0; i < count; ++i) {
    810         IntRect rect = rects[i];
    811         rect.move(-absolutePoint.x(), -absolutePoint.y());
    812         quads.append(localToAbsoluteQuad(FloatQuad(rect)));
     808    float deviceScaleFactor = document().deviceScaleFactor();
     809    for (auto rect : rects) {
     810        rect.moveBy(LayoutPoint(-absolutePoint));
     811        quads.append(localToAbsoluteQuad(FloatQuad(snapRectToDevicePixels(rect, deviceScaleFactor))));
    813812    }
    814813}
  • trunk/Source/WebCore/rendering/RenderObject.h

    r196222 r196439  
    837837    void getTransformFromContainer(const RenderObject* container, const LayoutSize& offsetInContainer, TransformationMatrix&) const;
    838838   
    839     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = nullptr) { };
     839    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = nullptr) { };
    840840
    841841    LayoutRect absoluteOutlineBounds() const
  • trunk/Source/WebCore/rendering/RenderTextControl.cpp

    r195180 r196439  
    232232}
    233233
    234 void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
     234void RenderTextControl::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*)
    235235{
    236236    if (!size().isEmpty())
    237         rects.append(snappedIntRect(additionalOffset, size()));
     237        rects.append(LayoutRect(additionalOffset, size()));
    238238}
    239239
  • trunk/Source/WebCore/rendering/RenderTextControl.h

    r194496 r196439  
    8181    virtual bool canHaveGeneratedChildren() const override { return false; }
    8282   
    83     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
     83    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
    8484
    8585    virtual bool canBeProgramaticallyScrolled() const override { return true; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp

    r194496 r196439  
    155155
    156156// addFocusRingRects is called from paintOutline and needs to be in the same coordinates as the paintOuline call
    157 void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
     157void RenderSVGContainer::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
    158158{
    159     IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
     159    LayoutRect paintRectInParent = LayoutRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
    160160    if (!paintRectInParent.isEmpty())
    161161        rects.append(paintRectInParent);
  • trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h

    r177259 r196439  
    5151    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) override final;
    5252    virtual void removeChild(RenderObject&) override final;
    53     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
     53    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
    5454
    5555    virtual FloatRect objectBoundingBox() const override final { return m_objectBoundingBox; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp

    r194496 r196439  
    223223}
    224224
    225 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
     225void RenderSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
    226226{
    227227    // this is called from paint() after the localTransform has already been applied
    228     IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates());
     228    LayoutRect contentRect = LayoutRect(repaintRectInLocalCoordinates());
    229229    if (!contentRect.isEmpty())
    230230        rects.append(contentRect);
  • trunk/Source/WebCore/rendering/svg/RenderSVGImage.h

    r177259 r196439  
    6767    virtual FloatRect repaintRectInLocalCoordinatesExcludingSVGShadow() const override { return m_repaintBoundingBoxExcludingShadow; }
    6868
    69     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
     69    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
    7070
    7171    virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
  • trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp

    r195411 r196439  
    327327// This method is called from inside paintOutline() since we call paintOutline()
    328328// while transformed to our coord system, return local coords
    329 void RenderSVGShape::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
    330 {
    331     IntRect rect = enclosingIntRect(repaintRectInLocalCoordinates());
     329void RenderSVGShape::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&, const RenderLayerModelObject*)
     330{
     331    LayoutRect rect = LayoutRect(repaintRectInLocalCoordinates());
    332332    if (!rect.isEmpty())
    333333        rects.append(rect);
  • trunk/Source/WebCore/rendering/svg/RenderSVGShape.h

    r189144 r196439  
    9999    virtual void layout() override final;
    100100    virtual void paint(PaintInfo&, const LayoutPoint&) override final;
    101     virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
     101    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override final;
    102102
    103103    virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override final;
Note: See TracChangeset for help on using the changeset viewer.