Changeset 232991 in webkit


Ignore:
Timestamp:
Jun 19, 2018 4:06:09 PM (6 years ago)
Author:
timothy_horton@apple.com
Message:

Unpainted area while scrolling in Reader is white
https://bugs.webkit.org/show_bug.cgi?id=186541
<rdar://problem/40471363>

Reviewed by Timothy Hatcher.

Source/WebCore:

New test: tiled-drawing/simple-document-with-dynamic-background-color.html

For platforms that do not use the overhang layer, we depend on
RenderView's background color to fill unpainted space.

RenderView's background color is only updated inside updateRootLayerConfiguration,
and it is possible with a simple enough page to change the document's
background color without running that code.

  • page/FrameView.cpp:

(WebCore::FrameView::setTransparent):
(WebCore::FrameView::setBaseBackgroundColor):
Make use of the newly added rootBackgroundColorOrTransparencyChanged.

(WebCore::FrameView::calculateExtendedBackgroundMode const):
Update a comment, since the function it mentioned is no longer.

(WebCore::FrameView::updateTilesForExtendedBackgroundMode):
Remove this code that clears the root extended background color
if using tiles to extend in both directions. Two reasons:
1) it seems harmless to also have a root extended background color
2) this just gets clobbered by the call in RenderView::paintBoxDecorations

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::updateCompositingLayers):
Add a bit that will do a updateConfiguration() on the root layer if no
other work needs to be done, so that we can update the root layer's
transparency or background color without doing a full layer rebuild.

(WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
Make use of the newly added rootBackgroundColorOrTransparencyChanged.

(WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
Change rootBackgroundTransparencyChanged to also cover color changes.
Fold setRootExtendedBackgroundColor in here, and make use of
setRootLayerConfigurationNeedsUpdate() instead of doing a full rebuild.
Previously, we would bail if the transparency state hadn't changed;
now, we'll also update the root layer's background color and the
exposed-to-WebKit extended background color if they change too.

(WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Deleted.
(WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor): Deleted.

  • rendering/RenderLayerCompositor.h:

Add setRootLayerConfigurationNeedsUpdate, remove setRootExtendedBackgroundColor,
and add both a bit indicating that the root layer configuration needs updating
and the cached view background color to make the early return in
rootBackgroundColorOrTransparencyChanged possible.

  • rendering/RenderView.cpp:

(WebCore::RenderView::paintBoxDecorations):
Make use of the newly added rootBackgroundColorOrTransparencyChanged.

LayoutTests:

  • tiled-drawing/background-transparency-toggle-expected.txt:

This is a progression; the extended background color now matches the color
of the page at this point (#CCCCCC is the specified body background, black
with 0.2 alpha, blended with the root's white background).

  • tiled-drawing/simple-document-with-dynamic-background-color-expected.txt: Added.
  • tiled-drawing/simple-document-with-dynamic-background-color.html: Added.

Added a test that ensures that dynamically changing the background color
actually applies to the RenderView background. Previously, the second layer
tree dump would have a black background where it should be red.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r232985 r232991  
     12018-06-19  Tim Horton  <timothy_horton@apple.com>
     2
     3        Unpainted area while scrolling in Reader is white
     4        https://bugs.webkit.org/show_bug.cgi?id=186541
     5        <rdar://problem/40471363>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * tiled-drawing/background-transparency-toggle-expected.txt:
     10        This is a progression; the extended background color now matches the color
     11        of the page at this point (#CCCCCC is the specified body background, black
     12        with 0.2 alpha, blended with the root's white background).
     13
     14        * tiled-drawing/simple-document-with-dynamic-background-color-expected.txt: Added.
     15        * tiled-drawing/simple-document-with-dynamic-background-color.html: Added.
     16        Added a test that ensures that dynamically changing the background color
     17        actually applies to the RenderView background. Previously, the second layer
     18        tree dump would have a black background where it should be red.
     19
    1202018-06-19  Michael Catanzaro  <mcatanzaro@igalia.com>
    221
  • trunk/LayoutTests/tiled-drawing/background-transparency-toggle-expected.txt

    r222285 r232991  
    5050      (bounds 785.00 1024.00)
    5151      (contentsOpaque 1)
     52      (backgroundColor #CCCCCC)
    5253      (tile cache coverage 0, 0 785 x 1024)
    5354      (tile size 785 x 512)
  • trunk/Source/WebCore/ChangeLog

    r232981 r232991  
     12018-06-19  Tim Horton  <timothy_horton@apple.com>
     2
     3        Unpainted area while scrolling in Reader is white
     4        https://bugs.webkit.org/show_bug.cgi?id=186541
     5        <rdar://problem/40471363>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        New test: tiled-drawing/simple-document-with-dynamic-background-color.html
     10
     11        For platforms that do not use the overhang layer, we depend on
     12        RenderView's background color to fill unpainted space.
     13
     14        RenderView's background color is only updated inside updateRootLayerConfiguration,
     15        and it is possible with a simple enough page to change the document's
     16        background color without running that code.
     17
     18        * page/FrameView.cpp:
     19        (WebCore::FrameView::setTransparent):
     20        (WebCore::FrameView::setBaseBackgroundColor):
     21        Make use of the newly added rootBackgroundColorOrTransparencyChanged.
     22
     23        (WebCore::FrameView::calculateExtendedBackgroundMode const):
     24        Update a comment, since the function it mentioned is no longer.
     25
     26        (WebCore::FrameView::updateTilesForExtendedBackgroundMode):
     27        Remove this code that clears the root extended background color
     28        if using tiles to extend in both directions. Two reasons:
     29        1) it seems harmless to also have a root extended background color
     30        2) this just gets clobbered by the call in RenderView::paintBoxDecorations
     31
     32        * rendering/RenderLayerCompositor.cpp:
     33        (WebCore::RenderLayerCompositor::updateCompositingLayers):
     34        Add a bit that will do a updateConfiguration() on the root layer if no
     35        other work needs to be done, so that we can update the root layer's
     36        transparency or background color without doing a full layer rebuild.
     37
     38        (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
     39        Make use of the newly added rootBackgroundColorOrTransparencyChanged.
     40
     41        (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
     42        Change rootBackgroundTransparencyChanged to also cover color changes.
     43        Fold setRootExtendedBackgroundColor in here, and make use of
     44        setRootLayerConfigurationNeedsUpdate() instead of doing a full rebuild.
     45        Previously, we would bail if the transparency state hadn't changed;
     46        now, we'll also update the root layer's background color and the
     47        exposed-to-WebKit extended background color if they change too.
     48
     49        (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Deleted.
     50        (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor): Deleted.
     51
     52        * rendering/RenderLayerCompositor.h:
     53        Add setRootLayerConfigurationNeedsUpdate, remove setRootExtendedBackgroundColor,
     54        and add both a bit indicating that the root layer configuration needs updating
     55        and the cached view background color to make the early return in
     56        rootBackgroundColorOrTransparencyChanged possible.
     57
     58        * rendering/RenderView.cpp:
     59        (WebCore::RenderView::paintBoxDecorations):
     60        Make use of the newly added rootBackgroundColorOrTransparencyChanged.
     61
    1622018-06-19  Youenn Fablet  <youenn@apple.com>
    263
  • trunk/Source/WebCore/page/FrameView.cpp

    r232859 r232991  
    28972897        return;
    28982898
    2899     renderView()->compositor().rootBackgroundTransparencyChanged();
     2899    renderView()->compositor().rootBackgroundColorOrTransparencyChanged();
    29002900    setNeedsLayout();
    29012901}
     
    29132913void FrameView::setBaseBackgroundColor(const Color& backgroundColor)
    29142914{
    2915     bool wasOpaque = m_baseBackgroundColor.isOpaque();
    2916 
    2917     if (!backgroundColor.isValid())
    2918         m_baseBackgroundColor = Color::white;
    2919     else
    2920         m_baseBackgroundColor = backgroundColor;
     2915    m_baseBackgroundColor = backgroundColor.isValid() ? backgroundColor : Color::white;
    29212916
    29222917    if (!isViewForDocumentInFrame())
     
    29262921    setNeedsLayout();
    29272922
    2928     if (m_baseBackgroundColor.isOpaque() != wasOpaque)
    2929         renderView()->compositor().rootBackgroundTransparencyChanged();
     2923    renderView()->compositor().rootBackgroundColorOrTransparencyChanged();
    29302924}
    29312925
     
    29712965    // Just because Settings::backgroundShouldExtendBeyondPage() is true does not necessarily mean
    29722966    // that the background rect needs to be extended for painting. Simple backgrounds can be extended
    2973     // just with RenderLayerCompositor::setRootExtendedBackgroundColor(). More complicated backgrounds,
     2967    // just with RenderLayerCompositor's rootExtendedBackgroundColor. More complicated backgrounds,
    29742968    // such as images, require extending the background rect to continue painting into the extended
    29752969    // region. This function finds out if it is necessary to extend the background rect for painting.
     
    30253019        return;
    30263020
    3027     renderView->compositor().setRootExtendedBackgroundColor(mode == ExtendedBackgroundModeAll ? Color() : documentBackgroundColor());
    30283021    backing->setTiledBackingHasMargins(mode & ExtendedBackgroundModeHorizontal, mode & ExtendedBackgroundModeVertical);
    30293022}
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r232218 r232991  
    670670    bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout;
    671671    bool needGeometryUpdate = false;
     672    bool needRootLayerConfigurationUpdate = m_rootLayerConfigurationNeedsUpdate;
    672673
    673674    switch (updateType) {
     
    684685    }
    685686
    686     if (!checkForHierarchyUpdate && !needGeometryUpdate)
     687    if (!checkForHierarchyUpdate && !needGeometryUpdate && !needRootLayerConfigurationUpdate)
    687688        return false;
    688689
     
    692693    // Only clear the flag if we're updating the entire hierarchy.
    693694    m_compositingLayersNeedRebuild = false;
     695    m_rootLayerConfigurationNeedsUpdate = false;
    694696    updateRoot = &rootRenderLayer();
    695697
     
    753755        updateLayerTreeGeometry(*updateRoot, 0);
    754756        ASSERT(!isFullUpdate || !m_subframeScrollLayersNeedReattach);
    755     }
     757    } else if (needRootLayerConfigurationUpdate)
     758        m_renderView.layer()->backing()->updateConfiguration();
    756759   
    757760#if !LOG_DISABLED
     
    31073110
    31083111    if (oldBackgroundColor != renderer.style().visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor))
    3109         rootBackgroundTransparencyChanged();
     3112        rootBackgroundColorOrTransparencyChanged();
    31103113
    31113114    bool hadFixedBackground = oldStyle && oldStyle->hasEntirelyFixedBackground();
     
    31163119}
    31173120
    3118 void RenderLayerCompositor::rootBackgroundTransparencyChanged()
     3121void RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged()
    31193122{
    31203123    if (!inCompositingMode())
    31213124        return;
    31223125
    3123     bool isTransparent = viewHasTransparentBackground();
    3124 
    3125     LOG(Compositing, "RenderLayerCompositor %p rootBackgroundTransparencyChanged. isTransparent=%d, changed=%d", this, isTransparent, m_viewBackgroundIsTransparent != isTransparent);
    3126     if (m_viewBackgroundIsTransparent == isTransparent)
     3126    Color backgroundColor;
     3127    bool isTransparent = viewHasTransparentBackground(&backgroundColor);
     3128   
     3129    Color extendedBackgroundColor = m_renderView.settings().backgroundShouldExtendBeyondPage() ? backgroundColor : Color();
     3130   
     3131    bool transparencyChanged = m_viewBackgroundIsTransparent != isTransparent;
     3132    bool backgroundColorChanged = m_viewBackgroundColor != backgroundColor;
     3133    bool extendedBackgroundColorChanged = m_rootExtendedBackgroundColor != extendedBackgroundColor;
     3134
     3135    LOG(Compositing, "RenderLayerCompositor %p rootBackgroundColorOrTransparencyChanged. isTransparent=%d, transparencyChanged=%d, backgroundColorChanged=%d, extendedBackgroundColorChanged=%d", this, isTransparent, transparencyChanged, backgroundColorChanged, extendedBackgroundColorChanged);
     3136    if (!transparencyChanged && !backgroundColorChanged && !extendedBackgroundColorChanged)
    31273137        return;
    31283138
    31293139    m_viewBackgroundIsTransparent = isTransparent;
    3130 
    3131     // FIXME: We should do something less expensive than a full layer rebuild.
    3132     setCompositingLayersNeedRebuild();
     3140    m_viewBackgroundColor = backgroundColor;
     3141    m_rootExtendedBackgroundColor = extendedBackgroundColor;
     3142   
     3143    if (extendedBackgroundColorChanged) {
     3144        page().chrome().client().pageExtendedBackgroundColorDidChange(m_rootExtendedBackgroundColor);
     3145       
     3146#if ENABLE(RUBBER_BANDING)
     3147        if (!m_layerForOverhangAreas)
     3148            return;
     3149       
     3150        m_layerForOverhangAreas->setBackgroundColor(m_rootExtendedBackgroundColor);
     3151       
     3152        if (!m_rootExtendedBackgroundColor.isValid())
     3153            m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
     3154#endif
     3155    }
     3156   
     3157    setRootLayerConfigurationNeedsUpdate();
    31333158    scheduleCompositingLayerUpdate();
    3134 }
    3135 
    3136 void RenderLayerCompositor::setRootExtendedBackgroundColor(const Color& color)
    3137 {
    3138     if (color == m_rootExtendedBackgroundColor)
    3139         return;
    3140 
    3141     m_rootExtendedBackgroundColor = color;
    3142 
    3143     page().chrome().client().pageExtendedBackgroundColorDidChange(color);
    3144 
    3145 #if ENABLE(RUBBER_BANDING)
    3146     if (!m_layerForOverhangAreas)
    3147         return;
    3148 
    3149     m_layerForOverhangAreas->setBackgroundColor(m_rootExtendedBackgroundColor);
    3150 
    3151     if (!m_rootExtendedBackgroundColor.isValid())
    3152         m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
    3153 #endif
    31543159}
    31553160
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r224796 r232991  
    166166
    167167    // Called after the view transparency, or the document or base background color change.
    168     void rootBackgroundTransparencyChanged();
     168    void rootBackgroundColorOrTransparencyChanged();
    169169   
    170170    // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
     
    314314    void didPaintBacking(RenderLayerBacking*);
    315315
    316     void setRootExtendedBackgroundColor(const Color&);
    317316    const Color& rootExtendedBackgroundColor() const { return m_rootExtendedBackgroundColor; }
    318317
     
    482481    bool documentUsesTiledBacking() const;
    483482    bool isMainFrameCompositor() const;
     483   
     484    void setRootLayerConfigurationNeedsUpdate() { m_rootLayerConfigurationNeedsUpdate = true; }
    484485
    485486private:
     
    502503    bool m_compositing { false };
    503504    bool m_compositingLayersNeedRebuild { false };
     505    bool m_rootLayerConfigurationNeedsUpdate { false };
    504506    bool m_flushingLayers { false };
    505507    bool m_shouldFlushOnReattach { false };
     
    562564#endif
    563565
     566    Color m_viewBackgroundColor;
    564567    Color m_rootExtendedBackgroundColor;
    565568
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r232178 r232991  
    455455    }
    456456
    457     bool backgroundShouldExtendBeyondPage = settings().backgroundShouldExtendBeyondPage();
    458     compositor().setRootExtendedBackgroundColor(backgroundShouldExtendBeyondPage ? frameView().documentBackgroundColor() : Color());
     457    compositor().rootBackgroundColorOrTransparencyChanged();
    459458
    460459    Page* page = document().page();
     
    475474    else {
    476475        const Color& documentBackgroundColor = frameView().documentBackgroundColor();
    477         const Color& backgroundColor = (backgroundShouldExtendBeyondPage && documentBackgroundColor.isValid()) ? documentBackgroundColor : frameView().baseBackgroundColor();
     476        const Color& backgroundColor = (settings().backgroundShouldExtendBeyondPage() && documentBackgroundColor.isValid()) ? documentBackgroundColor : frameView().baseBackgroundColor();
    478477        if (backgroundColor.isVisible()) {
    479478            CompositeOperator previousOperator = paintInfo.context().compositeOperation();
Note: See TracChangeset for help on using the changeset viewer.