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

Side by Side Diff: sky/engine/core/rendering/RenderObject.cpp

Issue 791023006: Delete invalidateTreeIfNeeded. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove unneeded call Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderParagraph.cpp » ('j') | 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 struct SameSizeAsRenderObject { 92 struct SameSizeAsRenderObject {
93 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. 93 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer.
94 void* pointers[5]; 94 void* pointers[5];
95 #if ENABLE(ASSERT) 95 #if ENABLE(ASSERT)
96 unsigned m_debugBitfields : 2; 96 unsigned m_debugBitfields : 2;
97 #if ENABLE(OILPAN) 97 #if ENABLE(OILPAN)
98 unsigned m_oilpanBitfields : 1; 98 unsigned m_oilpanBitfields : 1;
99 #endif 99 #endif
100 #endif 100 #endif
101 unsigned m_bitfields; 101 unsigned m_bitfields;
102 unsigned m_bitfields2;
103 LayoutRect rect; // Stores the previous paint invalidation rect. 102 LayoutRect rect; // Stores the previous paint invalidation rect.
104 LayoutPoint position; // Stores the previous position from the paint invalid ation container. 103 LayoutPoint position; // Stores the previous position from the paint invalid ation container.
105 }; 104 };
106 105
107 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small); 106 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small);
108 107
109 bool RenderObject::s_affectsParentBlock = false; 108 bool RenderObject::s_affectsParentBlock = false;
110 109
111 #if !ENABLE(OILPAN) 110 #if !ENABLE(OILPAN)
112 void* RenderObject::operator new(size_t sz) 111 void* RenderObject::operator new(size_t sz)
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 } 1210 }
1212 1211
1213 const RenderLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA ncestors(const RenderLayerModelObject* paintInvalidationContainer) const 1212 const RenderLayerModelObject* RenderObject::adjustCompositedContainerForSpecialA ncestors(const RenderLayerModelObject* paintInvalidationContainer) const
1214 { 1213 {
1215 // FIXME(sky): We shouldn't have any special ancestors and we don't have com posited containers 1214 // FIXME(sky): We shouldn't have any special ancestors and we don't have com posited containers
1216 if (paintInvalidationContainer) 1215 if (paintInvalidationContainer)
1217 return paintInvalidationContainer; 1216 return paintInvalidationContainer;
1218 return view(); 1217 return view();
1219 } 1218 }
1220 1219
1221 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState)
1222 {
1223 // If we didn't need paint invalidation then our children don't need as well .
1224 // Skip walking down the tree as everything should be fine below us.
1225 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
1226 return;
1227
1228 clearPaintInvalidationState(paintInvalidationState);
1229
1230 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
1231 if (!child->isOutOfFlowPositioned())
1232 child->invalidateTreeIfNeeded(paintInvalidationState);
1233 }
1234 }
1235
1236 void RenderObject::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p aintInvalidationState) const 1220 void RenderObject::mapRectToPaintInvalidationBacking(const RenderLayerModelObjec t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p aintInvalidationState) const
1237 { 1221 {
1238 if (paintInvalidationContainer == this) 1222 if (paintInvalidationContainer == this)
1239 return; 1223 return;
1240 1224
1241 if (RenderObject* o = parent()) { 1225 if (RenderObject* o = parent()) {
1242 if (o->hasOverflowClip()) { 1226 if (o->hasOverflowClip()) {
1243 RenderBox* boxParent = toRenderBox(o); 1227 RenderBox* boxParent = toRenderBox(o);
1244 boxParent->applyCachedClipAndScrollOffsetForPaintInvalidation(rect); 1228 boxParent->applyCachedClipAndScrollOffsetForPaintInvalidation(rect);
1245 if (rect.isEmpty()) 1229 if (rect.isEmpty())
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 if (updatedDiff.needsFullLayout()) 1449 if (updatedDiff.needsFullLayout())
1466 setNeedsLayoutAndPrefWidthsRecalc(); 1450 setNeedsLayoutAndPrefWidthsRecalc();
1467 else if (updatedDiff.needsPositionedMovementLayout()) 1451 else if (updatedDiff.needsPositionedMovementLayout())
1468 setNeedsPositionedMovementLayout(); 1452 setNeedsPositionedMovementLayout();
1469 } 1453 }
1470 1454
1471 if (diff.transformChanged() && !needsLayout()) { 1455 if (diff.transformChanged() && !needsLayout()) {
1472 if (RenderBlock* container = containingBlock()) 1456 if (RenderBlock* container = containingBlock())
1473 container->setNeedsOverflowRecalcAfterStyleChange(); 1457 container->setNeedsOverflowRecalcAfterStyleChange();
1474 } 1458 }
1475
1476 if (updatedDiff.needsPaintInvalidationLayer())
1477 toRenderLayerModelObject(this)->layer()->setShouldDoFullPaintInvalidatio nIncludingNonCompositingDescendants();
1478 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali dationObject())
1479 setShouldDoFullPaintInvalidation(true);
1480 } 1459 }
1481 1460
1482 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) 1461 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle)
1483 { 1462 {
1484 if (m_style) { 1463 if (m_style) {
1485 if (isOutOfFlowPositioned() && (m_style->position() != newStyle.position ())) 1464 if (isOutOfFlowPositioned() && (m_style->position() != newStyle.position ()))
1486 // For changes in positioning styles, we need to conceivably remove ourselves 1465 // For changes in positioning styles, we need to conceivably remove ourselves
1487 // from the positioned objects list. 1466 // from the positioned objects list.
1488 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 1467 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
1489 1468
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 if (FrameView* frameView = renderView->frameView()) 1986 if (FrameView* frameView = renderView->frameView())
2008 frameView->scheduleRelayoutOfSubtree(this); 1987 frameView->scheduleRelayoutOfSubtree(this);
2009 } 1988 }
2010 } 1989 }
2011 } 1990 }
2012 } 1991 }
2013 1992
2014 void RenderObject::forceLayout() 1993 void RenderObject::forceLayout()
2015 { 1994 {
2016 setSelfNeedsLayout(true); 1995 setSelfNeedsLayout(true);
2017 setShouldDoFullPaintInvalidation(true);
2018 layout(); 1996 layout();
2019 } 1997 }
2020 1998
2021 // FIXME: Does this do anything different than forceLayout given that we don't w alk 1999 // FIXME: Does this do anything different than forceLayout given that we don't w alk
2022 // the containing block chain. If not, we should change all callers to use force Layout. 2000 // the containing block chain. If not, we should change all callers to use force Layout.
2023 void RenderObject::forceChildLayout() 2001 void RenderObject::forceChildLayout()
2024 { 2002 {
2025 setNormalChildNeedsLayout(true); 2003 setNormalChildNeedsLayout(true);
2026 layout(); 2004 layout();
2027 } 2005 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 if (isInline() && !isReplaced()) 2100 if (isInline() && !isReplaced())
2123 return false; 2101 return false;
2124 return true; 2102 return true;
2125 } 2103 }
2126 2104
2127 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect) 2105 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect)
2128 { 2106 {
2129 imageChanged(static_cast<WrappedImagePtr>(image), rect); 2107 imageChanged(static_cast<WrappedImagePtr>(image), rect);
2130 } 2108 }
2131 2109
2110 void RenderObject::imageChanged(WrappedImagePtr, const IntRect*)
2111 {
2112 if (parent())
2113 scheduleVisualUpdate();
2114 }
2115
2132 Element* RenderObject::offsetParent() const 2116 Element* RenderObject::offsetParent() const
2133 { 2117 {
2134 if (isDocumentElement()) 2118 if (isDocumentElement())
2135 return 0; 2119 return 0;
2136 2120
2137 Node* node = 0; 2121 Node* node = 0;
2138 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { 2122 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) {
2139 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes 2123 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes
2140 node = ancestor->node(); 2124 node = ancestor->node();
2141 if (!node) 2125 if (!node)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 { 2219 {
2236 ASSERT_NOT_REACHED(); 2220 ASSERT_NOT_REACHED();
2237 return false; 2221 return false;
2238 } 2222 }
2239 2223
2240 bool RenderObject::isRelayoutBoundaryForInspector() const 2224 bool RenderObject::isRelayoutBoundaryForInspector() const
2241 { 2225 {
2242 return objectIsRelayoutBoundary(this); 2226 return objectIsRelayoutBoundary(this);
2243 } 2227 }
2244 2228
2245 void RenderObject::setShouldDoFullPaintInvalidation(bool b, MarkingBehavior mark Behavior) 2229 void RenderObject::scheduleVisualUpdate()
2246 { 2230 {
2247 if (markBehavior == MarkContainingBlockChain && b) { 2231 frame()->page()->animator().scheduleVisualUpdate();
2248 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInval idation);
2249 // FIXME(sky): Do we still need this here?
2250 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called not during FrameView::updateLayoutAndStyleForPainting().
2251 }
2252 }
2253
2254 void RenderObject::clearPaintInvalidationState(const PaintInvalidationState& pai ntInvalidationState)
2255 {
2256 // paintInvalidationStateIsDirty should be kept in sync with the
2257 // booleans that are cleared below.
2258 ASSERT(paintInvalidationState.forceCheckForPaintInvalidation() || paintInval idationStateIsDirty());
2259 setShouldDoFullPaintInvalidation(false);
2260 setOnlyNeededPositionedMovementLayout(false);
2261 setNeededLayoutBecauseOfChildren(false);
2262 setShouldInvalidateOverflowForPaint(false);
2263 setLayoutDidGetCalled(false);
2264 } 2232 }
2265 2233
2266 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) 2234 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document)
2267 { 2235 {
2268 return document.lifecycle().stateAllowsRenderTreeMutations(); 2236 return document.lifecycle().stateAllowsRenderTreeMutations();
2269 } 2237 }
2270 2238
2271 } // namespace blink 2239 } // namespace blink
2272 2240
2273 #ifndef NDEBUG 2241 #ifndef NDEBUG
(...skipping 19 matching lines...) Expand all
2293 { 2261 {
2294 if (object1) { 2262 if (object1) {
2295 const blink::RenderObject* root = object1; 2263 const blink::RenderObject* root = object1;
2296 while (root->parent()) 2264 while (root->parent())
2297 root = root->parent(); 2265 root = root->parent();
2298 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 2266 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
2299 } 2267 }
2300 } 2268 }
2301 2269
2302 #endif 2270 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderParagraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698