Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 398343003: Use unified invalidation path for repaint-only style changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 setNeedsLayoutAndPrefWidthsRecalc(); 2048 setNeedsLayoutAndPrefWidthsRecalc();
2049 else if (updatedDiff.needsPositionedMovementLayout()) 2049 else if (updatedDiff.needsPositionedMovementLayout())
2050 setNeedsPositionedMovementLayout(); 2050 setNeedsPositionedMovementLayout();
2051 } 2051 }
2052 2052
2053 if (diff.transformChanged() && !needsLayout()) { 2053 if (diff.transformChanged() && !needsLayout()) {
2054 if (RenderBlock* container = containingBlock()) 2054 if (RenderBlock* container = containingBlock())
2055 container->setNeedsOverflowRecalcAfterStyleChange(); 2055 container->setNeedsOverflowRecalcAfterStyleChange();
2056 } 2056 }
2057 2057
2058 if (updatedDiff.needsRepaint()) { 2058 // FIXME: Should invalidate whole layer if updatedDiff.needsRepaintLayer(). crbug.com/394050.
2059 // Invalidate paints with the new style, e.g., for example if we go from not having 2059 if (diff.needsRepaintObject() || updatedDiff.needsRepaint()) {
2060 // an outline to having an outline. 2060 // FIXME: For objects that don't save previousPaintInvalidationRect, we still need
2061 2061 // to invalidate now because their invalidateTreeIfNeeded won't invalida te themselves.
2062 // The paintInvalidationForWholeRenderer() call is needed for non-layout changes to style. See the corresponding 2062 // crbug.com/394133.
2063 // comment in RenderObject::styleWillChange for why. 2063 // FIXME: Test of parentTransformDidChange in RenderSVGModelObject::inva lidateTreeIfNeeded()
2064 if (needsLayout()) 2064 // prevents SVG objects from using unified invalidation for repaint-only style change.
2065 // crbug.com/394619.
2066 if (needsLayout() || (invalidatesSelfDuringTreeInvalidation() && !isSVG( )))
2065 setShouldDoFullPaintInvalidation(true); 2067 setShouldDoFullPaintInvalidation(true);
2066 else if (!selfNeedsLayout()) 2068 else
2067 paintInvalidationForWholeRenderer(); 2069 paintInvalidationForWholeRenderer();
2068 } 2070 }
2069 } 2071 }
2070 2072
2071 static inline bool rendererHasBackground(const RenderObject* renderer) 2073 static inline bool rendererHasBackground(const RenderObject* renderer)
2072 { 2074 {
2073 return renderer && renderer->hasBackground(); 2075 return renderer && renderer->hasBackground();
2074 } 2076 }
2075 2077
2076 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) 2078 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle)
(...skipping 15 matching lines...) Expand all
2092 // We might not have an enclosing layer yet because we might not be in the tree. 2094 // We might not have an enclosing layer yet because we might not be in the tree.
2093 if (RenderLayer* layer = enclosingLayer()) { 2095 if (RenderLayer* layer = enclosingLayer()) {
2094 if (newStyle.visibility() == VISIBLE) { 2096 if (newStyle.visibility() == VISIBLE) {
2095 layer->setHasVisibleContent(); 2097 layer->setHasVisibleContent();
2096 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { 2098 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) {
2097 layer->dirtyVisibleContentStatus(); 2099 layer->dirtyVisibleContentStatus();
2098 } 2100 }
2099 } 2101 }
2100 } 2102 }
2101 2103
2102 // For style-only changes that need paint invalidation, we currently nee d to issue a paint invalidation before and after the style
2103 // change. The paint invalidation before style change is accomplished he re. The paint invalidation after style change is accomplished
2104 // in RenderObject::setStyle.
2105 if (m_parent && diff.needsRepaintObject()) {
2106 if (!diff.needsLayout() && !needsLayout())
2107 paintInvalidationForWholeRenderer();
2108 }
2109
2110 if (isFloating() && (m_style->floating() != newStyle.floating())) 2104 if (isFloating() && (m_style->floating() != newStyle.floating()))
2111 // For changes in float styles, we need to conceivably remove oursel ves 2105 // For changes in float styles, we need to conceivably remove oursel ves
2112 // from the floating objects list. 2106 // from the floating objects list.
2113 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 2107 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
2114 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) 2108 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition()))
2115 // For changes in positioning styles, we need to conceivably remove ourselves 2109 // For changes in positioning styles, we need to conceivably remove ourselves
2116 // from the positioned objects list. 2110 // from the positioned objects list.
2117 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 2111 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
2118 2112
2119 s_affectsParentBlock = isFloatingOrOutOfFlowPositioned() 2113 s_affectsParentBlock = isFloatingOrOutOfFlowPositioned()
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 { 3381 {
3388 ASSERT_NOT_REACHED(); 3382 ASSERT_NOT_REACHED();
3389 return false; 3383 return false;
3390 } 3384 }
3391 3385
3392 bool RenderObject::isRelayoutBoundaryForInspector() const 3386 bool RenderObject::isRelayoutBoundaryForInspector() const
3393 { 3387 {
3394 return objectIsRelayoutBoundary(this); 3388 return objectIsRelayoutBoundary(this);
3395 } 3389 }
3396 3390
3391 void RenderObject::setShouldDoFullPaintInvalidation(bool b)
3392 {
3393 m_bitfields.setShouldDoFullPaintInvalidation(b);
3394 if (!b)
3395 return;
3396
3397 // Make sure our parent is marked as child needing invalidation.
dsinclair 2014/07/17 18:36:01 as child needing full paint invalidation
Xianzhu 2014/07/17 21:57:34 Updated.
3398 for (RenderObject* p = parent(); p && !p->shouldCheckForPaintInvalidation(); p = p->parent())
3399 p->setChildNeedsPaintInvalidation(true);
3400 }
3401
3397 void RenderObject::clearPaintInvalidationState() 3402 void RenderObject::clearPaintInvalidationState()
3398 { 3403 {
3399 setShouldDoFullPaintInvalidation(false); 3404 setShouldDoFullPaintInvalidation(false);
3400 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false); 3405 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false);
3401 setOnlyNeededPositionedMovementLayout(false); 3406 setOnlyNeededPositionedMovementLayout(false);
3402 setNeededLayoutBecauseOfChildren(false); 3407 setNeededLayoutBecauseOfChildren(false);
3403 setShouldInvalidateOverflowForPaint(false); 3408 setShouldInvalidateOverflowForPaint(false);
3404 setLayoutDidGetCalled(false); 3409 setLayoutDidGetCalled(false);
3405 setMayNeedPaintInvalidation(false); 3410 setMayNeedPaintInvalidation(false);
3411 setChildNeedsPaintInvalidation(false);
3406 } 3412 }
3407 3413
3408 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) 3414 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document)
3409 { 3415 {
3410 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState() 3416 return DeprecatedDisableModifyRenderTreeStructureAsserts::canModifyRenderTre eStateInAnyState()
3411 || document.lifecycle().stateAllowsRenderTreeMutations(); 3417 || document.lifecycle().stateAllowsRenderTreeMutations();
3412 } 3418 }
3413 3419
3414 DeprecatedDisableModifyRenderTreeStructureAsserts::DeprecatedDisableModifyRender TreeStructureAsserts() 3420 DeprecatedDisableModifyRenderTreeStructureAsserts::DeprecatedDisableModifyRender TreeStructureAsserts()
3415 : m_disabler(gModifyRenderTreeStructureAnyState, true) 3421 : m_disabler(gModifyRenderTreeStructureAnyState, true)
(...skipping 30 matching lines...) Expand all
3446 { 3452 {
3447 if (object1) { 3453 if (object1) {
3448 const WebCore::RenderObject* root = object1; 3454 const WebCore::RenderObject* root = object1;
3449 while (root->parent()) 3455 while (root->parent())
3450 root = root->parent(); 3456 root = root->parent();
3451 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3457 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3452 } 3458 }
3453 } 3459 }
3454 3460
3455 #endif 3461 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698