Changeset 201040 in webkit


Ignore:
Timestamp:
May 17, 2016 2:02:01 PM (8 years ago)
Author:
hyatt@apple.com
Message:

Optimize layer repaint rect computation and painting.
https://bugs.webkit.org/show_bug.cgi?id=157631

Reviewed by Zalan Bujtas.

This patch changes the computation of repaint rects to be for self-painting layers
only. In addition, hasBoxDecorations() has been changed to hasVisibleBoxDecorations(),
and it will no longer be set for transparent borders.

For scrolling layer position updating, visually empty layers have their repaint rects
cleared, and we don't compute repaint rects during the scroll. We would like to do this
all the time, but computeRepaintRects can be called at times when the visually empty
state is stale/unknown. For now we limit it to scrolling, since we know that the layer's
visually empty state is correct.

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::paintBoxDecorations):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::paintObject):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlockFlow::layoutRunsAndFloats):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::updateFromStyle):
(WebCore::RenderBox::paintBoxDecorations):

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::willBeDestroyed):
(WebCore::RenderBoxModelObject::hasVisibleBoxDecorationStyle):
(WebCore::RenderBoxModelObject::updateFromStyle):
(WebCore::RenderBoxModelObject::hasBoxDecorationStyle): Deleted.

  • rendering/RenderBoxModelObject.h:
  • rendering/RenderElement.cpp:

(WebCore::RenderElement::styleWillChange):
(WebCore::mustRepaintBackgroundOrBorder):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::imageChanged):

  • rendering/RenderInline.cpp:

(WebCore::RenderInline::styleDidChange):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::repaintRectIncludingNonCompositingDescendants):
(WebCore::RenderLayer::computeRepaintRects):
(WebCore::RenderLayer::clearRepaintRects):
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::calculateClipRects):

  • rendering/RenderLayer.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateDrawsContent):
(WebCore::RenderLayerBacking::compositingOpacity):
(WebCore::hasVisibleBoxDecorations):
(WebCore::canCreateTiledImage):
(WebCore::hasVisibleBoxDecorationsOrBackgroundImage):
(WebCore::supportsDirectBoxDecorationsComposition):
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
(WebCore::RenderLayerBacking::containsPaintedContent):
(WebCore::RenderLayerBacking::isDirectlyCompositedImage):
(WebCore::hasBoxDecorations): Deleted.
(WebCore::hasBoxDecorationsOrBackgroundImage): Deleted.

  • rendering/RenderLayerModelObject.cpp:

(WebCore::RenderLayerModelObject::styleDidChange):

  • rendering/RenderNamedFlowFragment.cpp:

(WebCore::RenderNamedFlowFragment::setObjectStyleInRegion):

  • rendering/RenderObject.h:

(WebCore::RenderObject::hasVisibleBoxDecorations):
(WebCore::RenderObject::setFloating):
(WebCore::RenderObject::setInline):
(WebCore::RenderObject::computeBackgroundIsKnownToBeObscured):
(WebCore::RenderObject::setSelectionStateIfNeeded):
(WebCore::RenderObject::setHasVisibleBoxDecorations):
(WebCore::RenderObject::invalidateBackgroundObscurationStatus):
(WebCore::RenderObject::hasBoxDecorations): Deleted.
(WebCore::RenderObject::setHasBoxDecorations): Deleted.

  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::paint):

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::paintObject):
(WebCore::RenderTable::paintBoxDecorations):

  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::styleDidChange):

  • rendering/RenderWidget.cpp:

(WebCore::RenderWidget::paint):

  • rendering/style/BorderData.h:

(WebCore::BorderData::hasBorder):
(WebCore::BorderData::hasVisibleBorder):
(WebCore::BorderData::hasFill):
(WebCore::BorderData::hasBorderRadius):

  • rendering/style/RenderStyle.h:
  • rendering/svg/RenderSVGRoot.cpp:

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

Location:
trunk/Source/WebCore
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r201038 r201040  
     12016-05-17  Dave Hyatt  <hyatt@apple.com>
     2
     3        Optimize layer repaint rect computation and painting.
     4        https://bugs.webkit.org/show_bug.cgi?id=157631
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        This patch changes the computation of repaint rects to be for self-painting layers
     9        only. In addition, hasBoxDecorations() has been changed to hasVisibleBoxDecorations(),
     10        and it will no longer be set for transparent borders.
     11
     12        For scrolling layer position updating, visually empty layers have their repaint rects
     13        cleared, and we don't compute repaint rects during the scroll. We would like to do this
     14        all the time, but computeRepaintRects can be called at times when the visually empty
     15        state is stale/unknown. For now we limit it to scrolling, since we know that the layer's
     16        visually empty state is correct.
     17
     18        * rendering/InlineFlowBox.cpp:
     19        (WebCore::InlineFlowBox::paintBoxDecorations):
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::RenderBlock::paintObject):
     22        * rendering/RenderBlockLineLayout.cpp:
     23        (WebCore::RenderBlockFlow::layoutRunsAndFloats):
     24        * rendering/RenderBox.cpp:
     25        (WebCore::RenderBox::updateFromStyle):
     26        (WebCore::RenderBox::paintBoxDecorations):
     27        * rendering/RenderBoxModelObject.cpp:
     28        (WebCore::RenderBoxModelObject::willBeDestroyed):
     29        (WebCore::RenderBoxModelObject::hasVisibleBoxDecorationStyle):
     30        (WebCore::RenderBoxModelObject::updateFromStyle):
     31        (WebCore::RenderBoxModelObject::hasBoxDecorationStyle): Deleted.
     32        * rendering/RenderBoxModelObject.h:
     33        * rendering/RenderElement.cpp:
     34        (WebCore::RenderElement::styleWillChange):
     35        (WebCore::mustRepaintBackgroundOrBorder):
     36        * rendering/RenderImage.cpp:
     37        (WebCore::RenderImage::imageChanged):
     38        * rendering/RenderInline.cpp:
     39        (WebCore::RenderInline::styleDidChange):
     40        * rendering/RenderLayer.cpp:
     41        (WebCore::RenderLayer::RenderLayer):
     42        (WebCore::RenderLayer::updateLayerPositions):
     43        (WebCore::RenderLayer::repaintRectIncludingNonCompositingDescendants):
     44        (WebCore::RenderLayer::computeRepaintRects):
     45        (WebCore::RenderLayer::clearRepaintRects):
     46        (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
     47        (WebCore::RenderLayer::scrollTo):
     48        (WebCore::RenderLayer::calculateClipRects):
     49        * rendering/RenderLayer.h:
     50        * rendering/RenderLayerBacking.cpp:
     51        (WebCore::RenderLayerBacking::updateDrawsContent):
     52        (WebCore::RenderLayerBacking::compositingOpacity):
     53        (WebCore::hasVisibleBoxDecorations):
     54        (WebCore::canCreateTiledImage):
     55        (WebCore::hasVisibleBoxDecorationsOrBackgroundImage):
     56        (WebCore::supportsDirectBoxDecorationsComposition):
     57        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
     58        (WebCore::RenderLayerBacking::containsPaintedContent):
     59        (WebCore::RenderLayerBacking::isDirectlyCompositedImage):
     60        (WebCore::hasBoxDecorations): Deleted.
     61        (WebCore::hasBoxDecorationsOrBackgroundImage): Deleted.
     62        * rendering/RenderLayerModelObject.cpp:
     63        (WebCore::RenderLayerModelObject::styleDidChange):
     64        * rendering/RenderNamedFlowFragment.cpp:
     65        (WebCore::RenderNamedFlowFragment::setObjectStyleInRegion):
     66        * rendering/RenderObject.h:
     67        (WebCore::RenderObject::hasVisibleBoxDecorations):
     68        (WebCore::RenderObject::setFloating):
     69        (WebCore::RenderObject::setInline):
     70        (WebCore::RenderObject::computeBackgroundIsKnownToBeObscured):
     71        (WebCore::RenderObject::setSelectionStateIfNeeded):
     72        (WebCore::RenderObject::setHasVisibleBoxDecorations):
     73        (WebCore::RenderObject::invalidateBackgroundObscurationStatus):
     74        (WebCore::RenderObject::hasBoxDecorations): Deleted.
     75        (WebCore::RenderObject::setHasBoxDecorations): Deleted.
     76        * rendering/RenderReplaced.cpp:
     77        (WebCore::RenderReplaced::paint):
     78        * rendering/RenderTable.cpp:
     79        (WebCore::RenderTable::paintObject):
     80        (WebCore::RenderTable::paintBoxDecorations):
     81        * rendering/RenderTableCell.cpp:
     82        (WebCore::RenderTableCell::styleDidChange):
     83        * rendering/RenderWidget.cpp:
     84        (WebCore::RenderWidget::paint):
     85        * rendering/style/BorderData.h:
     86        (WebCore::BorderData::hasBorder):
     87        (WebCore::BorderData::hasVisibleBorder):
     88        (WebCore::BorderData::hasFill):
     89        (WebCore::BorderData::hasBorderRadius):
     90        * rendering/style/RenderStyle.h:
     91        * rendering/svg/RenderSVGRoot.cpp:
     92        (WebCore::RenderSVGRoot::layout):
     93        (WebCore::RenderSVGRoot::styleDidChange):
     94
    1952016-05-17  Filip Pizlo  <fpizlo@apple.com>
    296
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r200098 r201040  
    13671367    // You can use p::first-line to specify a background. If so, the root line boxes for
    13681368    // a line may actually have to paint a background.
    1369     if (parent() && !renderer().hasBoxDecorations())
     1369    if (parent() && !renderer().hasVisibleBoxDecorations())
    13701370        return;
    13711371    const RenderStyle& lineStyle = this->lineStyle();
     
    13861386    // :first-line cannot be used to put borders on a line. Always paint borders with our
    13871387    // non-first-line style.
    1388     if (!parent() || !renderer().style().hasBorderDecoration())
     1388    if (!parent() || !renderer().style().hasVisibleBorderDecoration())
    13891389        return;
    13901390    const NinePieceImage& borderImage = renderer().style().borderImage();
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r200736 r201040  
    15401540    // 1. paint background, borders etc
    15411541    if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && style().visibility() == VISIBLE) {
    1542         if (hasBoxDecorations()) {
     1542        if (hasVisibleBoxDecorations()) {
    15431543            bool didClipToRegion = false;
    15441544           
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r200220 r201040  
    12601260    if (layoutState.isFullLayout() && hasInlineChild && !selfNeedsLayout()) {
    12611261        setNeedsLayout(MarkOnlyThis); // Mark as needing a full layout to force us to repaint.
    1262         if (!view().doingFullRepaint() && hasLayer()) {
     1262        if (!view().doingFullRepaint() && hasSelfPaintingLayer() && layer()->hasComputedRepaintRect()) {
    12631263            // Because we waited until we were already inside layout to discover
    12641264            // that the block really needed a full layout, we missed our chance to repaint the layer
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r200931 r201040  
    495495    // The root and the RenderView always paint their backgrounds/borders.
    496496    if (isDocElementRenderer || isViewObject)
    497         setHasBoxDecorations(true);
     497        setHasVisibleBoxDecorations(true);
    498498
    499499    setFloating(!isOutOfFlowPositioned() && styleToUse.isFloating());
     
    13701370
    13711371    // The theme will tell us whether or not we should also paint the CSS border.
    1372     if (bleedAvoidance != BackgroundBleedBackgroundOverBorder && (!style().hasAppearance() || (borderOrBackgroundPaintingIsNeeded && theme().paintBorderOnly(*this, paintInfo, paintRect))) && style().hasBorderDecoration())
     1372    if (bleedAvoidance != BackgroundBleedBackgroundOverBorder && (!style().hasAppearance() || (borderOrBackgroundPaintingIsNeeded && theme().paintBorderOnly(*this, paintInfo, paintRect))) && style().hasVisibleBorderDecoration())
    13731373        paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
    13741374
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r200671 r201040  
    194194}
    195195
    196 bool RenderBoxModelObject::hasBoxDecorationStyle() const
    197 {
    198     return hasBackground() || style().hasBorderDecoration() || style().hasAppearance() || style().boxShadow();
     196bool RenderBoxModelObject::hasVisibleBoxDecorationStyle() const
     197{
     198    return hasBackground() || style().hasVisibleBorderDecoration() || style().hasAppearance() || style().boxShadow();
    199199}
    200200
     
    206206    // we only check for bits that could possibly be set to true.
    207207    const RenderStyle& styleToUse = style();
    208     setHasBoxDecorations(hasBoxDecorationStyle());
     208    setHasVisibleBoxDecorations(hasVisibleBoxDecorationStyle());
    209209    setInline(styleToUse.isDisplayInlineType());
    210210    setPositionState(styleToUse.position());
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r200041 r201040  
    246246    LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const;
    247247
    248     bool hasBoxDecorationStyle() const;
     248    bool hasVisibleBoxDecorationStyle() const;
    249249    BackgroundImageGeometry calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer&, const LayoutPoint& paintOffset,
    250250        const LayoutRect& paintRect, RenderElement* = nullptr) const;
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r200953 r201040  
    861861        }
    862862        setHorizontalWritingMode(true);
    863         setHasBoxDecorations(false);
     863        setHasVisibleBoxDecorations(false);
    864864        setHasOverflowClip(false);
    865865        setHasTransformRelatedProperty(false);
     
    12581258
    12591259    // If we don't have a background/border/mask, then nothing to do.
    1260     if (!renderer.hasBoxDecorations())
     1260    if (!renderer.hasVisibleBoxDecorations())
    12611261        return false;
    12621262
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r200486 r201040  
    226226        return;
    227227
    228     if (hasBoxDecorations() || hasMask() || hasShapeOutside())
     228    if (hasVisibleBoxDecorations() || hasMask() || hasShapeOutside())
    229229        RenderReplaced::imageChanged(newImage, rect);
    230230
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r200953 r201040  
    205205
    206206    if (!alwaysCreateLineBoxes()) {
    207         bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || newStyle.hasPadding() || newStyle.hasMargin() || hasOutline();
     207        bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasVisibleBoxDecorations() || newStyle.hasBorder() || newStyle.hasPadding() || newStyle.hasMargin() || hasOutline();
    208208        if (oldStyle && alwaysCreateLineBoxes) {
    209209            dirtyLineBoxes(false);
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r200915 r201040  
    306306#endif
    307307    , m_hasFilterInfo(false)
     308    , m_hasComputedRepaintRect(false)
    308309#if ENABLE(CSS_COMPOSITING)
    309310    , m_blendMode(BlendModeNormal)
     
    510511        // FIXME: Should ASSERT that value calculated for m_outlineBox using the cached offset is the same
    511512        // as the value not using the cached offset, but we can't due to https://bugs.webkit.org/show_bug.cgi?id=37048
    512         if (flags & CheckForRepaint) {
     513        if ((flags & CheckForRepaint) && m_hasComputedRepaintRect) {
    513514            if (!renderer().view().printing()) {
    514515                bool didRepaint = false;
     
    595596            continue;
    596597
    597         repaintRect.unite(child->repaintRectIncludingNonCompositingDescendants());
     598        repaintRect.uniteIfNonZero(child->repaintRectIncludingNonCompositingDescendants());
    598599    }
    599600    return repaintRect;
     
    786787    ASSERT(!m_visibleContentStatusDirty);
    787788
     789    if (!isSelfPaintingLayer()) {
     790        clearRepaintRects();
     791        return;
     792    }
     793   
     794    m_hasComputedRepaintRect = true;
    788795    m_repaintRect = renderer().clippedOverflowRectForRepaint(repaintContainer);
    789796    m_outlineBox = renderer().outlineBoundsForRepaint(repaintContainer, geometryMap);
     
    804811void RenderLayer::clearRepaintRects()
    805812{
    806     ASSERT(!m_hasVisibleContent);
    807813    ASSERT(!m_visibleContentStatusDirty);
    808814
     815    m_hasComputedRepaintRect = false;
    809816    m_repaintRect = LayoutRect();
    810817    m_outlineBox = LayoutRect();
     
    846853        flags |= HasChangedAncestor;
    847854
    848     if (geometryMap)
    849         geometryMap->pushMappingsToAncestor(this, parent());
    850 
    851855    if (flags & HasChangedAncestor || flags & HasSeenViewportConstrainedAncestor || flags & IsOverflowScroll)
    852856        clearClipRects();
     
    857861    if (renderer().hasOverflowClip())
    858862        flags |= HasSeenAncestorWithOverflowClip;
    859 
    860     if (flags & HasSeenViewportConstrainedAncestor
    861         || (flags & IsOverflowScroll && flags & HasSeenAncestorWithOverflowClip)) {
    862         // FIXME: We could track the repaint container as we walk down the tree.
    863         computeRepaintRects(renderer().containerForRepaint(), geometryMap);
     863   
     864    bool shouldComputeRepaintRects = (flags & HasSeenViewportConstrainedAncestor || (flags & IsOverflowScroll && flags & HasSeenAncestorWithOverflowClip)) && isSelfPaintingLayer();
     865    bool isVisuallyEmpty = !isVisuallyNonEmpty();
     866    bool shouldPushAndPopMappings = geometryMap && ((shouldComputeRepaintRects && !isVisuallyEmpty) || firstChild());
     867    if (shouldPushAndPopMappings)
     868        geometryMap->pushMappingsToAncestor(this, parent());
     869
     870    if (shouldComputeRepaintRects) {
     871        // When scrolling, we don't compute repaint rects for visually non-empty layers.
     872        if (isVisuallyEmpty)
     873            clearRepaintRects();
     874        else // FIXME: We could track the repaint container as we walk down the tree.
     875            computeRepaintRects(renderer().containerForRepaint(), geometryMap);
    864876    } else {
    865877        // Check that our cached rects are correct.
    866         ASSERT(m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint()));
    867         ASSERT(m_outlineBox == renderer().outlineBoundsForRepaint(renderer().containerForRepaint(), geometryMap));
     878        ASSERT(!m_hasComputedRepaintRect || (m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint())));
     879        ASSERT(!m_hasComputedRepaintRect || m_outlineBox == renderer().outlineBoundsForRepaint(renderer().containerForRepaint()));
    868880    }
    869881   
     
    882894    }
    883895
    884     if (geometryMap)
     896    if (shouldPushAndPopMappings)
    885897        geometryMap->popMappingsToAncestor(parent());
    886898
     
    24122424    // The caret rect needs to be invalidated after scrolling
    24132425    frame.selection().setCaretRectNeedsUpdate();
    2414 
    2415     FloatQuad quadForFakeMouseMoveEvent = FloatQuad(m_repaintRect);
     2426   
     2427    LayoutRect rectForRepaint = m_hasComputedRepaintRect ? m_repaintRect : renderer().clippedOverflowRectForRepaint(repaintContainer);
     2428
     2429    FloatQuad quadForFakeMouseMoveEvent = FloatQuad(rectForRepaint);
    24162430    if (repaintContainer)
    24172431        quadForFakeMouseMoveEvent = repaintContainer->localToAbsoluteQuad(quadForFakeMouseMoveEvent);
     
    24242438    // Just schedule a full repaint of our object.
    24252439    if (requiresRepaint)
    2426         renderer().repaintUsingContainer(repaintContainer, m_repaintRect);
     2440        renderer().repaintUsingContainer(repaintContainer, rectForRepaint);
    24272441
    24282442    // Schedule the scroll and scroll-related DOM events.
     
    65016515}
    65026516
    6503 static bool hasBoxDecorationsOrBackground(const RenderElement& renderer)
    6504 {
    6505     return renderer.hasBoxDecorations() || renderer.style().hasOutline();
     6517static bool hasVisibleBoxDecorationsOrBackground(const RenderElement& renderer)
     6518{
     6519    return renderer.hasVisibleBoxDecorations() || renderer.style().hasOutline();
    65066520}
    65076521
     
    65346548            continue;
    65356549
    6536         if (hasBoxDecorationsOrBackground(renderElementChild))
     6550        if (hasVisibleBoxDecorationsOrBackground(renderElementChild))
    65376551            return true;
    65386552       
     
    65526566}
    65536567
    6554 bool RenderLayer::hasBoxDecorationsOrBackground() const
    6555 {
    6556     return WebCore::hasBoxDecorationsOrBackground(renderer());
     6568bool RenderLayer::hasVisibleBoxDecorationsOrBackground() const
     6569{
     6570    return WebCore::hasVisibleBoxDecorationsOrBackground(renderer());
    65576571}
    65586572
     
    65626576        return false;
    65636577
    6564     return hasBoxDecorationsOrBackground() || hasOverflowControls();
     6578    return hasVisibleBoxDecorationsOrBackground() || hasOverflowControls();
    65656579}
    65666580
     
    65756589        return true;
    65766590
    6577     if (hasBoxDecorationsOrBackground())
     6591    if (hasVisibleBoxDecorationsOrBackground())
    65786592        return true;
    65796593   
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r200915 r201040  
    387387    void dirtyVisibleContentStatus();
    388388
    389     bool hasBoxDecorationsOrBackground() const;
     389    bool hasVisibleBoxDecorationsOrBackground() const;
    390390    bool hasVisibleBoxDecorations() const;
    391391    // Returns true if this layer has visible content (ignoring any child layers).
     
    539539   
    540540    // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
    541     LayoutRect repaintRect() const { return m_repaintRect; }
     541    bool hasComputedRepaintRect() const { return m_hasComputedRepaintRect; }
     542    LayoutRect repaintRect() const { ASSERT(hasComputedRepaintRect()); return m_repaintRect; }
    542543    LayoutRect repaintRectIncludingNonCompositingDescendants() const;
    543544
     
    10691070
    10701071    bool m_hasFilterInfo : 1;
     1072   
     1073    bool m_hasComputedRepaintRect : 1;
    10711074
    10721075#if ENABLE(CSS_COMPOSITING)
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r200671 r201040  
    12301230        // m_scrollingLayer never has backing store.
    12311231        // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint.
    1232         bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() && m_owningLayer.hasBoxDecorationsOrBackground();
     1232        bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() && m_owningLayer.hasVisibleBoxDecorationsOrBackground();
    12331233        m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
    12341234
     
    16761676
    16771677// FIXME: Code is duplicated in RenderLayer. Also, we should probably not consider filters a box decoration here.
    1678 static inline bool hasBoxDecorations(const RenderStyle& style)
    1679 {
    1680     return style.hasBorder() || style.hasBorderRadius() || style.hasOutline() || style.hasAppearance() || style.boxShadow() || style.hasFilter();
     1678static inline bool hasVisibleBoxDecorations(const RenderStyle& style)
     1679{
     1680    return style.hasVisibleBorder() || style.hasBorderRadius() || style.hasOutline() || style.hasAppearance() || style.boxShadow() || style.hasFilter();
    16811681}
    16821682
     
    17131713}
    17141714
    1715 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle& style)
    1716 {
    1717     if (hasBoxDecorations(style))
     1715static bool hasVisibleBoxDecorationsOrBackgroundImage(const RenderStyle& style)
     1716{
     1717    if (hasVisibleBoxDecorations(style))
    17181718        return true;
    17191719
     
    18111811        return false;
    18121812
    1813     if (hasBoxDecorationsOrBackgroundImage(style))
     1813    if (hasVisibleBoxDecorationsOrBackgroundImage(style))
    18141814        return false;
    18151815
     
    18961896        // Reject anything that has a border, a border-radius or outline,
    18971897        // or is not a simple background (no background, or solid color).
    1898         if (hasBoxDecorationsOrBackgroundImage(rootObject->style()))
     1898        if (hasVisibleBoxDecorationsOrBackgroundImage(rootObject->style()))
    18991899            return false;
    19001900       
     
    19071907            return false;
    19081908       
    1909         if (hasBoxDecorationsOrBackgroundImage(bodyRenderer->style()))
     1909        if (hasVisibleBoxDecorationsOrBackgroundImage(bodyRenderer->style()))
    19101910            return false;
    19111911    }
     
    19801980#if ENABLE(VIDEO)
    19811981    if (is<RenderVideo>(renderer()) && downcast<RenderVideo>(renderer()).shouldDisplayVideo())
    1982         return m_owningLayer.hasBoxDecorationsOrBackground() || (!(downcast<RenderVideo>(renderer()).supportsAcceleratedRendering()) && m_requiresOwnBackingStore);
     1982        return m_owningLayer.hasVisibleBoxDecorationsOrBackground() || (!(downcast<RenderVideo>(renderer()).supportsAcceleratedRendering()) && m_requiresOwnBackingStore);
    19831983#endif
    19841984
    19851985#if ENABLE(WEBGL) || ENABLE(ACCELERATED_2D_CANVAS)
    19861986    if (is<RenderHTMLCanvas>(renderer()) && canvasCompositingStrategy(renderer()) == CanvasAsLayerContents)
    1987         return m_owningLayer.hasBoxDecorationsOrBackground();
     1987        return m_owningLayer.hasVisibleBoxDecorationsOrBackground();
    19881988#endif
    19891989
     
    19951995bool RenderLayerBacking::isDirectlyCompositedImage() const
    19961996{
    1997     if (!is<RenderImage>(renderer()) || m_owningLayer.hasBoxDecorationsOrBackground() || m_owningLayer.paintsWithFilters() || renderer().hasClip())
     1997    if (!is<RenderImage>(renderer()) || m_owningLayer.hasVisibleBoxDecorationsOrBackground() || m_owningLayer.paintsWithFilters() || renderer().hasClip())
    19981998        return false;
    19991999
  • trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp

    r200116 r201040  
    162162        setHasReflection(false);
    163163        // Repaint the about to be destroyed self-painting layer when style change also triggers repaint.
    164         if (layer()->isSelfPaintingLayer() && layer()->repaintStatus() == NeedsFullRepaint)
     164        if (layer()->isSelfPaintingLayer() && layer()->repaintStatus() == NeedsFullRepaint && layer()->hasComputedRepaintRect())
    165165            repaintUsingContainer(containerForRepaint(), layer()->repaintRect());
    166166        layer()->removeOnlyThisLayer(); // calls destroyLayer() which clears m_layer
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp

    r200098 r201040  
    393393        downcast<RenderElement>(*object).setStyleInternal(WTFMove(*styleInRegion));
    394394
    395     if (is<RenderBoxModelObject>(*object) && !object->hasBoxDecorations()) {
    396         bool hasBoxDecorations = is<RenderTableCell>(*object)
     395    if (is<RenderBoxModelObject>(*object) && !object->hasVisibleBoxDecorations()) {
     396        bool hasVisibleBoxDecorations = is<RenderTableCell>(*object)
    397397        || object->style().hasBackground()
    398         || object->style().hasBorder()
     398        || object->style().hasVisibleBorder()
    399399        || object->style().hasAppearance()
    400400        || object->style().boxShadow();
    401         object->setHasBoxDecorations(hasBoxDecorations);
     401        object->setHasVisibleBoxDecorations(hasVisibleBoxDecorations);
    402402    }
    403403
  • trunk/Source/WebCore/rendering/RenderObject.h

    r200953 r201040  
    519519        HasBoxDecorationsAndBackgroundMayBeVisible,
    520520    };
    521     bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
     521    bool hasVisibleBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
    522522    bool backgroundIsKnownToBeObscured(const LayoutPoint& paintOffset);
    523523    bool hasEntirelyFixedBackground() const;
     
    602602    void setInline(bool b = true) { m_bitfields.setIsInline(b); }
    603603
    604     void setHasBoxDecorations(bool = true);
     604    void setHasVisibleBoxDecorations(bool = true);
    605605    void invalidateBackgroundObscurationStatus();
    606606    virtual bool computeBackgroundIsKnownToBeObscured(const LayoutPoint&) { return false; }
     
    11261126}
    11271127
    1128 inline void RenderObject::setHasBoxDecorations(bool b)
     1128inline void RenderObject::setHasVisibleBoxDecorations(bool b)
    11291129{
    11301130    if (!b) {
     
    11321132        return;
    11331133    }
    1134     if (hasBoxDecorations())
     1134    if (hasVisibleBoxDecorations())
    11351135        return;
    11361136    m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid);
     
    11391139inline void RenderObject::invalidateBackgroundObscurationStatus()
    11401140{
    1141     if (!hasBoxDecorations())
     1141    if (!hasVisibleBoxDecorations())
    11421142        return;
    11431143    m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid);
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r200486 r201040  
    146146    LayoutPoint adjustedPaintOffset = paintOffset + location();
    147147   
    148     if (hasBoxDecorations() && paintInfo.phase == PaintPhaseForeground)
     148    if (hasVisibleBoxDecorations() && paintInfo.phase == PaintPhaseForeground)
    149149        paintBoxDecorations(paintInfo, adjustedPaintOffset);
    150150   
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r200098 r201040  
    690690{
    691691    PaintPhase paintPhase = paintInfo.phase;
    692     if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && hasBoxDecorations() && style().visibility() == VISIBLE)
     692    if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && hasVisibleBoxDecorations() && style().visibility() == VISIBLE)
    693693        paintBoxDecorations(paintInfo, paintOffset);
    694694
     
    769769    paintBoxShadow(paintInfo, rect, style(), Inset);
    770770
    771     if (style().hasBorderDecoration() && !collapseBorders())
     771    if (style().hasVisibleBorderDecoration() && !collapseBorders())
    772772        paintBorder(paintInfo, rect, style());
    773773}
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r200041 r201040  
    411411
    412412    RenderBlockFlow::styleDidChange(diff, oldStyle);
    413     setHasBoxDecorations(true);
     413    setHasVisibleBoxDecorations(true); // FIXME: Optimize this to only set to true if necessary.
    414414
    415415    if (parent() && section() && oldStyle && style().height() != oldStyle->height())
  • trunk/Source/WebCore/rendering/RenderWidget.cpp

    r200041 r201040  
    255255    LayoutPoint adjustedPaintOffset = paintOffset + location();
    256256
    257     if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
     257    if (hasVisibleBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
    258258        paintBoxDecorations(paintInfo, adjustedPaintOffset);
    259259
  • trunk/Source/WebCore/rendering/style/BorderData.h

    r192970 r201040  
    4747        return m_left.nonZero(!haveImage) || m_right.nonZero(!haveImage) || m_top.nonZero(!haveImage) || m_bottom.nonZero(!haveImage);
    4848    }
     49   
     50    bool hasVisibleBorder() const
     51    {
     52        bool haveImage = m_image.hasImage();
     53        return m_left.isVisible(!haveImage) || m_right.isVisible(!haveImage) || m_top.isVisible(!haveImage) || m_bottom.isVisible(!haveImage);
     54    }
    4955
    5056    bool hasFill() const
     
    5258        return m_image.hasImage() && m_image.fill();
    5359    }
    54 
     60   
    5561    bool hasBorderRadius() const
    5662    {
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r200660 r201040  
    555555    bool hasBorder() const { return surround->border.hasBorder(); }
    556556    bool hasBorderFill() const { return surround->border.hasFill(); }
    557     bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); }
     557    bool hasVisibleBorderDecoration() const { return hasVisibleBorder() || hasBorderFill(); }
     558    bool hasVisibleBorder() const { return surround->border.hasVisibleBorder(); }
    558559    bool hasPadding() const { return !surround->padding.isZero(); }
    559560    bool hasOffset() const { return !surround->offset.isZero(); }
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r200041 r201040  
    205205
    206206    updateLayerTransform();
    207     m_hasBoxDecorations = isDocumentElementRenderer() ? hasBoxDecorationStyle() : hasBoxDecorations();
     207    m_hasBoxDecorations = isDocumentElementRenderer() ? hasVisibleBoxDecorationStyle() : hasVisibleBoxDecorations();
    208208    invalidateBackgroundObscurationStatus();
    209209
     
    306306    // Box decorations may have appeared/disappeared - recompute status.
    307307    if (diff == StyleDifferenceRepaint)
    308         m_hasBoxDecorations = hasBoxDecorationStyle();
     308        m_hasBoxDecorations = hasVisibleBoxDecorationStyle();
    309309
    310310    RenderReplaced::styleDidChange(diff, oldStyle);
Note: See TracChangeset for help on using the changeset viewer.