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

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: Also handle layers Created 6 years, 4 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
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 setNeedsLayoutAndPrefWidthsRecalc(); 2052 setNeedsLayoutAndPrefWidthsRecalc();
2053 else if (updatedDiff.needsPositionedMovementLayout()) 2053 else if (updatedDiff.needsPositionedMovementLayout())
2054 setNeedsPositionedMovementLayout(); 2054 setNeedsPositionedMovementLayout();
2055 } 2055 }
2056 2056
2057 if (diff.transformChanged() && !needsLayout()) { 2057 if (diff.transformChanged() && !needsLayout()) {
2058 if (RenderBlock* container = containingBlock()) 2058 if (RenderBlock* container = containingBlock())
2059 container->setNeedsOverflowRecalcAfterStyleChange(); 2059 container->setNeedsOverflowRecalcAfterStyleChange();
2060 } 2060 }
2061 2061
2062 if (updatedDiff.needsRepaint()) { 2062 if (updatedDiff.needsRepaintLayer()) {
2063 // Invalidate paints with the new style, e.g., for example if we go from not having 2063 toRenderLayerModelObject(this)->layer()->setShouldDoFullPaintInvalidatio nIncludingNonCompositingDescendants();
2064 // an outline to having an outline. 2064 } else if (updatedDiff.needsRepaint()) {
2065 2065 // FIXME: For objects whose invalidateTreeIfNeeded won't invalidate them selves,
2066 // The paintInvalidationForWholeRenderer() call is needed for non-layout changes to style. See the corresponding 2066 // we still need to invalidate now. crbug.com/394133.
2067 // comment in RenderObject::styleWillChange for why. 2067 if (needsLayout() || canSelfInvalidateDuringTreeInvalidation())
2068 if (needsLayout())
2069 setShouldDoFullPaintInvalidation(true); 2068 setShouldDoFullPaintInvalidation(true);
2070 else if (!selfNeedsLayout()) 2069 else
2071 paintInvalidationForWholeRenderer(); 2070 paintInvalidationForWholeRenderer();
2072 } 2071 }
2073 } 2072 }
2074 2073
2075 static inline bool rendererHasBackground(const RenderObject* renderer) 2074 static inline bool rendererHasBackground(const RenderObject* renderer)
2076 { 2075 {
2077 return renderer && renderer->hasBackground(); 2076 return renderer && renderer->hasBackground();
2078 } 2077 }
2079 2078
2080 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) 2079 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle)
(...skipping 15 matching lines...) Expand all
2096 // We might not have an enclosing layer yet because we might not be in the tree. 2095 // We might not have an enclosing layer yet because we might not be in the tree.
2097 if (RenderLayer* layer = enclosingLayer()) { 2096 if (RenderLayer* layer = enclosingLayer()) {
2098 if (newStyle.visibility() == VISIBLE) { 2097 if (newStyle.visibility() == VISIBLE) {
2099 layer->setHasVisibleContent(); 2098 layer->setHasVisibleContent();
2100 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { 2099 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) {
2101 layer->dirtyVisibleContentStatus(); 2100 layer->dirtyVisibleContentStatus();
2102 } 2101 }
2103 } 2102 }
2104 } 2103 }
2105 2104
2106 // For style-only changes that need paint invalidation, we currently nee d to issue a paint invalidation before and after the style
2107 // change. The paint invalidation before style change is accomplished he re. The paint invalidation after style change is accomplished
2108 // in RenderObject::setStyle.
2109 if (m_parent && diff.needsRepaintObject()) { 2105 if (m_parent && diff.needsRepaintObject()) {
2110 if (!diff.needsLayout() && !needsLayout()) 2106 if (!diff.needsLayout() && !needsLayout()) {
2111 paintInvalidationForWholeRenderer(); 2107 // Invalidate before style change.
2108 // FIXME: See FIXMEs in setStyle() before calling paintInvalidat ionForWholeRenderer
2109 // for the reason of this paintInvalidationForWholeRenderer.
2110 if (!canSelfInvalidateDuringTreeInvalidation())
2111 paintInvalidationForWholeRenderer();
2112 }
2112 } 2113 }
2113 2114
2114 if (isFloating() && (m_style->floating() != newStyle.floating())) 2115 if (isFloating() && (m_style->floating() != newStyle.floating()))
2115 // For changes in float styles, we need to conceivably remove oursel ves 2116 // For changes in float styles, we need to conceivably remove oursel ves
2116 // from the floating objects list. 2117 // from the floating objects list.
2117 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 2118 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
2118 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) 2119 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition()))
2119 // For changes in positioning styles, we need to conceivably remove ourselves 2120 // For changes in positioning styles, we need to conceivably remove ourselves
2120 // from the positioned objects list. 2121 // from the positioned objects list.
2121 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 2122 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 { 3454 {
3454 if (object1) { 3455 if (object1) {
3455 const blink::RenderObject* root = object1; 3456 const blink::RenderObject* root = object1;
3456 while (root->parent()) 3457 while (root->parent())
3457 root = root->parent(); 3458 root = root->parent();
3458 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3459 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3459 } 3460 }
3460 } 3461 }
3461 3462
3462 #endif 3463 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698