Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 struct SameSizeAsLayoutObject : DisplayItemClient { | 120 struct SameSizeAsLayoutObject : DisplayItemClient { |
| 121 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. | 121 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. |
| 122 void* pointers[5]; | 122 void* pointers[5]; |
| 123 Member<void*> members[1]; | 123 Member<void*> members[1]; |
| 124 #if ENABLE(ASSERT) | 124 #if ENABLE(ASSERT) |
| 125 unsigned m_debugBitfields : 2; | 125 unsigned m_debugBitfields : 2; |
| 126 #endif | 126 #endif |
| 127 unsigned m_bitfields; | 127 unsigned m_bitfields; |
| 128 unsigned m_bitfields2; | 128 unsigned m_bitfields2; |
| 129 LayoutRect m_previousVisualRect; | 129 LayoutRect m_previousVisualRect; |
| 130 LayoutPoint m_previousPosition; | |
| 131 }; | 130 }; |
| 132 | 131 |
| 133 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), | 132 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), |
| 134 "LayoutObject should stay small"); | 133 "LayoutObject should stay small"); |
| 135 | 134 |
| 136 bool LayoutObject::s_affectsParentBlock = false; | 135 bool LayoutObject::s_affectsParentBlock = false; |
| 137 | 136 |
| 138 // The pointer to paint properties is implemented as a global hash map | 137 // The pointer to paint properties is implemented as a global hash map |
| 139 // temporarily, to avoid memory regression during the transition towards SPv2. | 138 // temporarily, to avoid memory regression during the transition towards SPv2. |
| 140 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> | 139 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1197 LayoutView* v = view(); | 1196 LayoutView* v = view(); |
| 1198 if (v->document().printing()) | 1197 if (v->document().printing()) |
| 1199 return PaintInvalidationNone; // Don't invalidate paints if we're printing. | 1198 return PaintInvalidationNone; // Don't invalidate paints if we're printing. |
| 1200 | 1199 |
| 1201 PaintInvalidatorContextAdapter context(paintInvalidationState); | 1200 PaintInvalidatorContextAdapter context(paintInvalidationState); |
| 1202 | 1201 |
| 1203 const LayoutBoxModelObject& paintInvalidationContainer = | 1202 const LayoutBoxModelObject& paintInvalidationContainer = |
| 1204 paintInvalidationState.paintInvalidationContainer(); | 1203 paintInvalidationState.paintInvalidationContainer(); |
| 1205 DCHECK(paintInvalidationContainer == containerForPaintInvalidation()); | 1204 DCHECK(paintInvalidationContainer == containerForPaintInvalidation()); |
| 1206 | 1205 |
| 1206 ObjectPaintInvalidator paintInvalidator(*this); | |
| 1207 context.oldVisualRect = previousVisualRect(); | 1207 context.oldVisualRect = previousVisualRect(); |
| 1208 context.oldLocation = previousPositionFromPaintInvalidationBacking(); | 1208 context.oldLocation = paintInvalidator.previousLocationInBacking(); |
| 1209 context.newVisualRect = paintInvalidationState.computeVisualRectInBacking(); | 1209 context.newVisualRect = paintInvalidationState.computeVisualRectInBacking(); |
| 1210 context.newLocation = | 1210 // Use visual rect location for LayoutTexts and non-container SVG objects |
| 1211 paintInvalidationState.computePositionFromPaintInvalidationBacking(); | 1211 // because visual rect change suffices to detect layout caused invalidation. |
| 1212 context.newLocation = !isBoxModelObject() && !isSVGContainer() | |
|
chrishtr
2016/11/04 18:20:06
You don't need a conditional here I think. paintIn
Xianzhu
2016/11/04 19:11:03
They are in different paths (PaintInvalidator path
| |
| 1213 ? context.newVisualRect.location() | |
| 1214 : paintInvalidationState.computeLocationInBacking(); | |
| 1212 | 1215 |
| 1213 IntSize adjustment = | 1216 IntSize adjustment = |
| 1214 scrollAdjustmentForPaintInvalidation(paintInvalidationContainer); | 1217 scrollAdjustmentForPaintInvalidation(paintInvalidationContainer); |
| 1215 context.newLocation.move(adjustment); | 1218 context.newLocation.move(adjustment); |
| 1216 context.newVisualRect.move(adjustment); | 1219 context.newVisualRect.move(adjustment); |
| 1217 | 1220 |
| 1218 adjustVisualRectForRasterEffects(context.newVisualRect); | 1221 adjustVisualRectForRasterEffects(context.newVisualRect); |
| 1219 | 1222 |
| 1220 setPreviousVisualRect(context.newVisualRect); | 1223 setPreviousVisualRect(context.newVisualRect); |
| 1221 setPreviousPositionFromPaintInvalidationBacking(context.newLocation); | 1224 paintInvalidator.setPreviousLocationInBacking(context.newLocation); |
| 1222 | 1225 |
| 1223 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && | 1226 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && |
| 1224 paintInvalidationState | 1227 paintInvalidationState |
| 1225 .forcedSubtreeInvalidationRectUpdateWithinContainerOnly()) { | 1228 .forcedSubtreeInvalidationRectUpdateWithinContainerOnly()) { |
| 1226 // We are done updating the visual rect. No other paint invalidation work | 1229 // We are done updating the visual rect. No other paint invalidation work |
| 1227 // to do for this object. | 1230 // to do for this object. |
| 1228 return PaintInvalidationNone; | 1231 return PaintInvalidationNone; |
| 1229 } | 1232 } |
| 1230 | 1233 |
| 1231 return invalidatePaintIfNeeded(context); | 1234 return invalidatePaintIfNeeded(context); |
| (...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3546 const blink::LayoutObject* root = object1; | 3549 const blink::LayoutObject* root = object1; |
| 3547 while (root->parent()) | 3550 while (root->parent()) |
| 3548 root = root->parent(); | 3551 root = root->parent(); |
| 3549 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3552 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3550 } else { | 3553 } else { |
| 3551 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3554 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
| 3552 } | 3555 } |
| 3553 } | 3556 } |
| 3554 | 3557 |
| 3555 #endif | 3558 #endif |
| OLD | NEW |