Changeset 190816 in webkit


Ignore:
Timestamp:
Oct 9, 2015 12:59:12 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Dynamic background color changes do not update until a layout is forced
https://bugs.webkit.org/show_bug.cgi?id=131623

Source/WebCore:

Compute correct repaint rect for decorated RenderSVGRoots.

The current implementation of clippedOverflowRectForRepaint() uses the
generic repaint-rect calculations in SVGRenderSupport. Those in turn make
use of repaintRectInLocalCoordinates(), which for RenderSVGRoot is the
union of the painted children (w/ some expansion). If there're no children,
or they do not fill the entire content box, then a repaint would not
repaint the correct parts.
Fix by calculating the union of the border-box and the SVG content
when the SVG root is decorated (has background/border/etc.)

Adapted from a Chromium patch by fs@opera.com
https://src.chromium.org/viewvc/blink?revision=170890&view=revision

Patch by Antoine Quint <Antoine Quint> on 2015-10-09
Reviewed by Darin Adler.

Tests: svg/repaint/add-background-property-on-root.html

svg/repaint/add-border-property-on-root.html
svg/repaint/add-outline-property-on-root.html
svg/repaint/change-background-color.html
svg/repaint/remove-background-property-on-root.html
svg/repaint/remove-border-property-on-root.html
svg/repaint/remove-outline-property-on-root.html

  • rendering/svg/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::layout):
(WebCore::RenderSVGRoot::styleDidChange):
(WebCore::RenderSVGRoot::clippedOverflowRectForRepaint):

LayoutTests:

Add some new tests checking that dynamically updating the "background",
"border" and "outline" CSS properties repaint correctly and rebase a few
existing tests that yield the same rendered results but slightly different
DRT output.

Patch by Antoine Quint <Antoine Quint> on 2015-10-09
Reviewed by Darin Adler.

  • platform/mac/fast/repaint/moving-shadow-on-container-expected.txt:
  • platform/mac/svg/custom/simple-text-double-shadow-expected.txt:
  • svg/css/composite-shadow-example-expected.txt:
  • svg/css/composite-shadow-with-opacity-expected.txt:
  • svg/repaint/add-background-property-on-root-expected.html: Added.
  • svg/repaint/add-background-property-on-root.html: Added.
  • svg/repaint/add-border-property-on-root-expected.html: Added.
  • svg/repaint/add-border-property-on-root.html: Added.
  • svg/repaint/add-outline-property-on-root-expected.html: Added.
  • svg/repaint/add-outline-property-on-root.html: Added.
  • svg/repaint/change-background-color-expected.html: Added.
  • svg/repaint/change-background-color.html: Added.
  • svg/repaint/remove-background-property-on-root-expected.html: Added.
  • svg/repaint/remove-background-property-on-root.html: Added.
  • svg/repaint/remove-border-property-on-root-expected.html: Added.
  • svg/repaint/remove-border-property-on-root.html: Added.
  • svg/repaint/remove-outline-property-on-root-expected.html: Added.
  • svg/repaint/remove-outline-property-on-root.html: Added.
  • svg/repaint/repaint-webkit-svg-shadow-expected.txt:
Location:
trunk
Files:
14 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r190808 r190816  
     12015-10-09  Antoine Quint  <graouts@apple.com>
     2
     3        Dynamic background color changes do not update until a layout is forced
     4        https://bugs.webkit.org/show_bug.cgi?id=131623
     5
     6        Add some new tests checking that dynamically updating the "background",
     7        "border" and "outline" CSS properties repaint correctly and rebase a few
     8        existing tests that yield the same rendered results but slightly different
     9        DRT output.
     10
     11        Reviewed by Darin Adler.
     12
     13        * platform/mac/fast/repaint/moving-shadow-on-container-expected.txt:
     14        * platform/mac/svg/custom/simple-text-double-shadow-expected.txt:
     15        * svg/css/composite-shadow-example-expected.txt:
     16        * svg/css/composite-shadow-with-opacity-expected.txt:
     17        * svg/repaint/add-background-property-on-root-expected.html: Added.
     18        * svg/repaint/add-background-property-on-root.html: Added.
     19        * svg/repaint/add-border-property-on-root-expected.html: Added.
     20        * svg/repaint/add-border-property-on-root.html: Added.
     21        * svg/repaint/add-outline-property-on-root-expected.html: Added.
     22        * svg/repaint/add-outline-property-on-root.html: Added.
     23        * svg/repaint/change-background-color-expected.html: Added.
     24        * svg/repaint/change-background-color.html: Added.
     25        * svg/repaint/remove-background-property-on-root-expected.html: Added.
     26        * svg/repaint/remove-background-property-on-root.html: Added.
     27        * svg/repaint/remove-border-property-on-root-expected.html: Added.
     28        * svg/repaint/remove-border-property-on-root.html: Added.
     29        * svg/repaint/remove-outline-property-on-root-expected.html: Added.
     30        * svg/repaint/remove-outline-property-on-root.html: Added.
     31        * svg/repaint/repaint-webkit-svg-shadow-expected.txt:
     32
    1332015-10-06  Simon Fraser  <simon.fraser@apple.com>
    234
  • trunk/LayoutTests/platform/mac/fast/repaint/moving-shadow-on-container-expected.txt

    r148049 r190816  
    44  RenderBlock {HTML} at (0,0) size 785x616
    55    RenderBody {BODY} at (8,8) size 769x600
    6       RenderSVGRoot {svg} at (8,8) size 496x201
     6      RenderSVGRoot {svg} at (8,8) size 472x177
    77        RenderSVGPath {path} at (8,8) size 80x70 [stroke={[type=SOLID] [color=#000000] [stroke width=10.00]}] [fill={[type=SOLID] [color=#999999]}] [data="M 1.83697e-15 30 L -35.2671 48.541 L -28.5317 9.27051 L -57.0634 -18.541 L -17.6336 -24.2705 L -1.10218e-14 -60 L 17.6336 -24.2705 L 57.0634 -18.541 L 28.5317 9.27051 L 35.2671 48.541 Z"]
    88        RenderSVGPath {path} at (198,44) size 132x129 [transform={m=((1.00,0.00)(0.00,1.00)) t=(250.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00] [dash array={20.00}]}] [fill={[type=SOLID] [color=#999999]}] [data="M 1.83697e-15 30 L -35.2671 48.541 L -28.5317 9.27051 L -57.0634 -18.541 L -17.6336 -24.2705 L -1.10218e-14 -60 L 17.6336 -24.2705 L 57.0634 -18.541 L 28.5317 9.27051 L 35.2671 48.541 Z"]
  • trunk/LayoutTests/platform/mac/svg/custom/simple-text-double-shadow-expected.txt

    r177774 r190816  
    22  RenderView at (0,0) size 800x600
    33layer at (0,0) size 800x600
    4   RenderSVGRoot {svg} at (20,26) size 480x294
     4  RenderSVGRoot {svg} at (20,26) size 380x194
    55    RenderSVGText {text} at (20,26) size 221x18 contains 1 chunk(s)
    66      RenderSVGInlineText {#text} at (0,0) size 221x18
  • trunk/LayoutTests/svg/css/composite-shadow-example-expected.txt

    r159013 r190816  
    44  RenderBlock {HTML} at (0,0) size 785x616
    55    RenderBody {BODY} at (8,8) size 769x600
    6       RenderSVGRoot {svg} at (32,28) size 472x186
     6      RenderSVGRoot {svg} at (36,32) size 444x158
    77        RenderSVGContainer {g} at (36,32) size 164x158
    88          RenderSVGPath {path} at (38,34) size 150x144 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00]}] [fill={[type=SOLID] [color=#999999]}] [data="M 1.83697e-15 30 L -35.2671 48.541 L -28.5317 9.27051 L -57.0634 -18.541 L -17.6336 -24.2705 L -1.10218e-14 -60 L 17.6336 -24.2705 L 57.0634 -18.541 L 28.5317 9.27051 L 35.2671 48.541 Z"]
  • trunk/LayoutTests/svg/css/composite-shadow-with-opacity-expected.txt

    r159013 r190816  
    55    RenderBody {BODY} at (8,8) size 769x600
    66layer at (8,8) size 769x600
    7   RenderSVGRoot {svg} at (32,28) size 472x186 [opacity=0.50]
     7  RenderSVGRoot {svg} at (36,32) size 444x158 [opacity=0.50]
    88    RenderSVGContainer {g} at (36,32) size 164x158
    99      RenderSVGPath {path} at (38,34) size 150x144 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,100.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=10.00]}] [fill={[type=SOLID] [color=#999999]}] [data="M 1.83697e-15 30 L -35.2671 48.541 L -28.5317 9.27051 L -57.0634 -18.541 L -17.6336 -24.2705 L -1.10218e-14 -60 L 17.6336 -24.2705 L 57.0634 -18.541 L 28.5317 9.27051 L 35.2671 48.541 Z"]
  • trunk/LayoutTests/svg/repaint/repaint-webkit-svg-shadow-expected.txt

    r133834 r190816  
    22  RenderView at (0,0) size 800x600
    33layer at (0,0) size 800x600
    4   RenderSVGRoot {svg} at (120,0) size 450x520
     4  RenderSVGRoot {svg} at (120,0) size 250x320
    55    RenderSVGRect {rect} at (150,100) size 120x120 [transform={m=((1.00,0.00)(0.00,1.00)) t=(150.00,50.00)}] [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=50.00] [width=20.00] [height=20.00]
    66    RenderSVGRect {rect} at (120,0) size 120x120 [fill={[type=SOLID] [color=#000000]}] [x=120.00] [y=0.00] [width=20.00] [height=20.00]
  • trunk/Source/WebCore/ChangeLog

    r190810 r190816  
     12015-10-09  Antoine Quint  <graouts@apple.com>
     2
     3        Dynamic background color changes do not update until a layout is forced
     4        https://bugs.webkit.org/show_bug.cgi?id=131623
     5
     6        Compute correct repaint rect for decorated RenderSVGRoots.
     7
     8        The current implementation of clippedOverflowRectForRepaint() uses the
     9        generic repaint-rect calculations in SVGRenderSupport. Those in turn make
     10        use of repaintRectInLocalCoordinates(), which for RenderSVGRoot is the
     11        union of the painted children (w/ some expansion). If there're no children,
     12        or they do not fill the entire content box, then a repaint would not
     13        repaint the correct parts.
     14        Fix by calculating the union of the border-box and the SVG content
     15        when the SVG root is decorated (has background/border/etc.)
     16
     17        Adapted from a Chromium patch by fs@opera.com
     18        https://src.chromium.org/viewvc/blink?revision=170890&view=revision
     19
     20        Reviewed by Darin Adler.
     21
     22        Tests: svg/repaint/add-background-property-on-root.html
     23               svg/repaint/add-border-property-on-root.html
     24               svg/repaint/add-outline-property-on-root.html
     25               svg/repaint/change-background-color.html
     26               svg/repaint/remove-background-property-on-root.html
     27               svg/repaint/remove-border-property-on-root.html
     28               svg/repaint/remove-outline-property-on-root.html
     29
     30        * rendering/svg/RenderSVGRoot.cpp:
     31        (WebCore::RenderSVGRoot::layout):
     32        (WebCore::RenderSVGRoot::styleDidChange):
     33        (WebCore::RenderSVGRoot::clippedOverflowRectForRepaint):
     34
    1352015-10-09  Simon Fraser  <simon.fraser@apple.com>
    236
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r190685 r190816  
    301301    if (diff == StyleDifferenceLayout)
    302302        setNeedsBoundariesUpdate();
     303
     304    // Box decorations may have appeared/disappeared - recompute status.
     305    if (diff == StyleDifferenceRepaint)
     306        m_hasBoxDecorations = hasBoxDecorationStyle();
     307
    303308    RenderReplaced::styleDidChange(diff, oldStyle);
    304309    SVGResourcesCache::clientStyleChanged(*this, diff, style());
     
    343348LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
    344349{
    345     return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
     350    if (style().visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent())
     351        return LayoutRect();
     352
     353    FloatRect contentRepaintRect = m_localToBorderBoxTransform.mapRect(repaintRectInLocalCoordinates());
     354    contentRepaintRect.intersect(snappedIntRect(borderBoxRect()));
     355
     356    LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect);
     357    if (m_hasBoxDecorations || hasRenderOverflow())
     358        repaintRect.unite(unionRect(localSelectionRect(false), visualOverflowRect()));
     359
     360    return RenderReplaced::computeRectForRepaint(enclosingIntRect(repaintRect), repaintContainer);
    346361}
    347362
Note: See TracChangeset for help on using the changeset viewer.