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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1315993004: Implement a paint offset cache for slimming paint v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 struct SameSizeAsLayoutObject { 131 struct SameSizeAsLayoutObject {
132 virtual ~SameSizeAsLayoutObject() { } // Allocate vtable pointer. 132 virtual ~SameSizeAsLayoutObject() { } // Allocate vtable pointer.
133 void* pointers[5]; 133 void* pointers[5];
134 #if ENABLE(ASSERT) 134 #if ENABLE(ASSERT)
135 unsigned m_debugBitfields : 2; 135 unsigned m_debugBitfields : 2;
136 #endif 136 #endif
137 unsigned m_bitfields; 137 unsigned m_bitfields;
138 unsigned m_bitfields2; 138 unsigned m_bitfields2;
139 LayoutRect rect; // Stores the previous paint invalidation rect. 139 LayoutRect rect; // Stores the previous paint invalidation rect.
140 LayoutPoint position; // Stores the previous position from the paint invalid ation container. 140 LayoutPoint position; // Stores the previous position from the paint invalid ation container.
141 LayoutPoint paintOffset; // DO NOT COMMIT until https://codereview.chromium. org/1315213002 lands and we can remove this.
141 }; 142 };
142 143
143 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), "LayoutObj ect should stay small"); 144 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), "LayoutObj ect should stay small");
144 145
145 bool LayoutObject::s_affectsParentBlock = false; 146 bool LayoutObject::s_affectsParentBlock = false;
146 147
147 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap; 148 typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap;
148 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr; 149 static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr;
149 150
150 void* LayoutObject::operator new(size_t sz) 151 void* LayoutObject::operator new(size_t sz)
(...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 // booleans that are cleared below. 3182 // booleans that are cleared below.
3182 ASSERT(paintInvalidationState.ancestorHadPaintInvalidationForLocationChange( ) || paintInvalidationStateIsDirty()); 3183 ASSERT(paintInvalidationState.ancestorHadPaintInvalidationForLocationChange( ) || paintInvalidationStateIsDirty());
3183 clearShouldDoFullPaintInvalidation(); 3184 clearShouldDoFullPaintInvalidation();
3184 m_bitfields.setChildShouldCheckForPaintInvalidation(false); 3185 m_bitfields.setChildShouldCheckForPaintInvalidation(false);
3185 m_bitfields.setNeededLayoutBecauseOfChildren(false); 3186 m_bitfields.setNeededLayoutBecauseOfChildren(false);
3186 m_bitfields.setShouldInvalidateOverflowForPaint(false); 3187 m_bitfields.setShouldInvalidateOverflowForPaint(false);
3187 m_bitfields.setMayNeedPaintInvalidation(false); 3188 m_bitfields.setMayNeedPaintInvalidation(false);
3188 m_bitfields.setShouldInvalidateSelection(false); 3189 m_bitfields.setShouldInvalidateSelection(false);
3189 } 3190 }
3190 3191
3192 const LayoutPoint& LayoutObject::cachedPaintOffset() const
3193 {
3194 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
3195 return m_cachedPaintOffset;
3196 }
3197
3198 void LayoutObject::updateCachedPaintOffset(const LayoutPoint& paintOffset) const
3199 {
3200 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
3201 m_cachedPaintOffset = paintOffset;
3202 }
3203
3191 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) 3204 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document)
3192 { 3205 {
3193 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre eStateInAnyState() 3206 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre eStateInAnyState()
3194 || document.lifecycle().stateAllowsLayoutTreeMutations(); 3207 || document.lifecycle().stateAllowsLayoutTreeMutations();
3195 } 3208 }
3196 3209
3197 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout TreeStructureAsserts() 3210 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout TreeStructureAsserts()
3198 : m_disabler(gModifyLayoutTreeStructureAnyState, true) 3211 : m_disabler(gModifyLayoutTreeStructureAnyState, true)
3199 { 3212 {
3200 } 3213 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 const blink::LayoutObject* root = object1; 3397 const blink::LayoutObject* root = object1;
3385 while (root->parent()) 3398 while (root->parent())
3386 root = root->parent(); 3399 root = root->parent();
3387 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3400 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3388 } else { 3401 } else {
3389 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3402 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3390 } 3403 }
3391 } 3404 }
3392 3405
3393 #endif 3406 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698