Changeset 188577 in webkit


Ignore:
Timestamp:
Aug 17, 2015 11:03:51 PM (9 years ago)
Author:
Alan Bujtas
Message:

Outline with auto style leaves bits behind when the the box is moved.
https://bugs.webkit.org/show_bug.cgi?id=148100

Reviewed by Simon Fraser.

Source/WebCore:

We paint the focus ring when 'outline-style: auto' is present, however
we don't take the focus ring width into account when the repaint rect
is computed.

Tests: fast/repaint/outline-with1px-auto-repaint-rect.html

fast/repaint/outline-with2px-auto-repaint-rect.html
fast/repaint/outline-with3px-auto-repaint-rect.html

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::adjustRectForOutlineAndShadow):

  • rendering/RenderThemeMac.h:
  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::platformFocusRingMaxWidth): Deleted. : 0 as focus ring width is incorrect.
The reason why r169699 fixed the failing cases was because they all had outline width < 3 (but no auto outline style).
The correct fix is to check if the style requires focus ring painting and use the RenderTheme::platformFocusRingMaxWidth
accordingly.

LayoutTests:

Due to RenderView::maximalOutlineSize() each outline width need to be tested separately.

  • fast/repaint/outline-with1px-auto-repaint-rect-expected.txt: Added.
  • fast/repaint/outline-with1px-auto-repaint-rect.html: Added.
  • fast/repaint/outline-with2px-auto-repaint-rect-expected.txt: Added.
  • fast/repaint/outline-with2px-auto-repaint-rect.html: Added.
  • fast/repaint/outline-with3px-auto-repaint-rect-expected.txt: Added.
  • fast/repaint/outline-with3px-auto-repaint-rect.html: Added.
Location:
trunk
Files:
6 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r188566 r188577  
     12015-08-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        Outline with auto style leaves bits behind when the the box is moved.
     4        https://bugs.webkit.org/show_bug.cgi?id=148100
     5
     6        Reviewed by Simon Fraser.
     7
     8        Due to RenderView::maximalOutlineSize() each outline width need to be tested separately.
     9
     10        * fast/repaint/outline-with1px-auto-repaint-rect-expected.txt: Added.
     11        * fast/repaint/outline-with1px-auto-repaint-rect.html: Added.
     12        * fast/repaint/outline-with2px-auto-repaint-rect-expected.txt: Added.
     13        * fast/repaint/outline-with2px-auto-repaint-rect.html: Added.
     14        * fast/repaint/outline-with3px-auto-repaint-rect-expected.txt: Added.
     15        * fast/repaint/outline-with3px-auto-repaint-rect.html: Added.
     16
    1172015-08-17  Myles C. Maxfield  <mmaxfield@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r188575 r188577  
     12015-08-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        Outline with auto style leaves bits behind when the the box is moved.
     4        https://bugs.webkit.org/show_bug.cgi?id=148100
     5
     6        Reviewed by Simon Fraser.
     7
     8        We paint the focus ring when 'outline-style: auto' is present, however
     9        we don't take the focus ring width into account when the repaint rect
     10        is computed.
     11
     12        Tests: fast/repaint/outline-with1px-auto-repaint-rect.html
     13               fast/repaint/outline-with2px-auto-repaint-rect.html
     14               fast/repaint/outline-with3px-auto-repaint-rect.html
     15
     16        * rendering/RenderObject.cpp:
     17        (WebCore::RenderObject::adjustRectForOutlineAndShadow):
     18        * rendering/RenderThemeMac.h:
     19        * rendering/RenderThemeMac.mm:
     20        (WebCore::RenderThemeMac::platformFocusRingMaxWidth): Deleted. : 0 as focus ring width is incorrect.
     21        The reason why r169699 fixed the failing cases was because they all had outline width < 3 (but no auto outline style).
     22        The correct fix is to check if the style requires focus ring painting and use the RenderTheme::platformFocusRingMaxWidth
     23        accordingly.
     24
    1252015-08-17  Myles C. Maxfield  <mmaxfield@apple.com>
    226
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r188530 r188577  
    365365#endif
    366366
     367void RenderElement::computeMaxOutlineSize() const
     368{
     369    // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
     370    // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
     371    if (!m_style->outlineWidth())
     372        return;
     373    int maxOutlineSize = m_style->outlineSize();
     374    if (m_style->outlineStyleIsAuto())
     375        maxOutlineSize = std::max(theme().platformFocusRingMaxWidth(), maxOutlineSize);
     376
     377    if (maxOutlineSize < maximalOutlineSize(PaintPhaseOutline))
     378        return;
     379
     380    view().setMaximalOutlineSize(maxOutlineSize);
     381}
     382
    367383void RenderElement::initializeStyle()
    368384{
     
    381397#endif
    382398
    383     // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
    384     // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
    385     if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline))
    386         view().setMaximalOutlineSize(std::max(theme().platformFocusRingMaxWidth(), static_cast<int>(m_style->outlineSize())));
    387 
     399    computeMaxOutlineSize();
     400   
    388401    styleDidChange(StyleDifferenceNewStyle, nullptr);
    389402
     
    435448#endif
    436449
    437     // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
    438     // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
    439     if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline))
    440         view().setMaximalOutlineSize(std::max(theme().platformFocusRingMaxWidth(), static_cast<int>(m_style->outlineSize())));
     450    computeMaxOutlineSize();
    441451
    442452    bool doesNotNeedLayout = !parent();
  • trunk/Source/WebCore/rendering/RenderElement.h

    r188530 r188577  
    312312    bool shouldWillChangeCreateStackingContext() const;
    313313
     314    void computeMaxOutlineSize() const;
     315
    314316    unsigned m_baseTypeFlags : 6;
    315317    unsigned m_ancestorLineBoxDirty : 1;
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r188420 r188577  
    19181918{
    19191919    int outlineSize = outlineStyleForRepaint().outlineSize();
     1920    if (outlineStyleForRepaint().outlineStyleIsAuto())
     1921        outlineSize = std::max(theme().platformFocusRingMaxWidth(), outlineSize);
    19201922    if (const ShadowData* boxShadow = style().boxShadow()) {
    19211923        boxShadow->adjustRectForShadow(rect, outlineSize);
    19221924        return;
    19231925    }
    1924 
    19251926    rect.inflate(outlineSize);
    19261927}
  • trunk/Source/WebCore/rendering/RenderThemeMac.h

    r188510 r188577  
    6262    virtual Color platformInactiveListBoxSelectionForegroundColor() const override;
    6363    virtual Color platformFocusRingColor() const override;
    64     virtual int platformFocusRingMaxWidth() const override;
    6564
    6665    virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) override { return SmallScrollbar; }
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r188510 r188577  
    307307}
    308308
    309 int RenderThemeMac::platformFocusRingMaxWidth() const
    310 {
    311     // FIXME: Shouldn't this function be named platformFocusRingMinWidth? But also, I'm not sure if this function is needed - looks like
    312     // all platforms just used 0 for this before <http://trac.webkit.org/changeset/168397>.
    313     return 0;
    314 }
    315 
    316309Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor() const
    317310{
Note: See TracChangeset for help on using the changeset viewer.