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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp

Issue 2151933003: Change WTF::TemporaryChange to be an alias for AutoReset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TemporaryChange -> AutoReset Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/layout/LayoutGeometryMap.h" 26 #include "core/layout/LayoutGeometryMap.h"
27 27
28 #include "core/frame/LocalFrame.h" 28 #include "core/frame/LocalFrame.h"
29 #include "core/paint/PaintLayer.h" 29 #include "core/paint/PaintLayer.h"
30 #include "platform/geometry/TransformState.h" 30 #include "platform/geometry/TransformState.h"
31 #include "wtf/TemporaryChange.h" 31 #include "wtf/AutoReset.h"
32 32
33 #define LAYOUT_GEOMETRY_MAP_LOGGING 0 33 #define LAYOUT_GEOMETRY_MAP_LOGGING 0
34 34
35 #if LAYOUT_GEOMETRY_MAP_LOGGING 35 #if LAYOUT_GEOMETRY_MAP_LOGGING
36 #define LAYOUT_GEOMETRY_MAP_LOG(...) WTFLogAlways(__VA_ARGS__) 36 #define LAYOUT_GEOMETRY_MAP_LOG(...) WTFLogAlways(__VA_ARGS__)
37 #else 37 #else
38 #define LAYOUT_GEOMETRY_MAP_LOG(...) ((void)0) 38 #define LAYOUT_GEOMETRY_MAP_LOG(...) ((void)0)
39 #endif 39 #endif
40 40
41 namespace blink { 41 namespace blink {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 || result.boundingBox().mayNotHaveExactIntRectRepresentation()); 153 || result.boundingBox().mayNotHaveExactIntRectRepresentation());
154 } 154 }
155 #endif 155 #endif
156 156
157 return result; 157 return result;
158 } 158 }
159 159
160 void LayoutGeometryMap::pushMappingsToAncestor(const LayoutObject* layoutObject, const LayoutBoxModelObject* ancestorLayoutObject) 160 void LayoutGeometryMap::pushMappingsToAncestor(const LayoutObject* layoutObject, const LayoutBoxModelObject* ancestorLayoutObject)
161 { 161 {
162 // We need to push mappings in reverse order here, so do insertions rather t han appends. 162 // We need to push mappings in reverse order here, so do insertions rather t han appends.
163 TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size() ); 163 AutoReset<size_t> positionChange(&m_insertionPosition, m_mapping.size());
164 do { 164 do {
165 layoutObject = layoutObject->pushMappingToContainer(ancestorLayoutObject , *this); 165 layoutObject = layoutObject->pushMappingToContainer(ancestorLayoutObject , *this);
166 } while (layoutObject && layoutObject != ancestorLayoutObject); 166 } while (layoutObject && layoutObject != ancestorLayoutObject);
167 167
168 ASSERT(m_mapping.isEmpty() || isTopmostLayoutView(m_mapping[0].m_layoutObjec t)); 168 ASSERT(m_mapping.isEmpty() || isTopmostLayoutView(m_mapping[0].m_layoutObjec t));
169 } 169 }
170 170
171 static bool canMapBetweenLayoutObjects(const LayoutObject* layoutObject, const L ayoutObject* ancestor) 171 static bool canMapBetweenLayoutObjects(const LayoutObject* layoutObject, const L ayoutObject* ancestor)
172 { 172 {
173 for (const LayoutObject* current = layoutObject; ; current = current->parent ()) { 173 for (const LayoutObject* current = layoutObject; ; current = current->parent ()) {
(...skipping 27 matching lines...) Expand all
201 if (canConvertInLayerTree) { 201 if (canConvertInLayerTree) {
202 LayoutPoint layerOffset; 202 LayoutPoint layerOffset;
203 layer->convertToLayerCoords(ancestorLayer, layerOffset); 203 layer->convertToLayerCoords(ancestorLayer, layerOffset);
204 204
205 // The LayoutView must be pushed first. 205 // The LayoutView must be pushed first.
206 if (!m_mapping.size()) { 206 if (!m_mapping.size()) {
207 ASSERT(ancestorLayer->layoutObject()->isLayoutView()); 207 ASSERT(ancestorLayer->layoutObject()->isLayoutView());
208 pushMappingsToAncestor(ancestorLayer->layoutObject(), 0); 208 pushMappingsToAncestor(ancestorLayer->layoutObject(), 0);
209 } 209 }
210 210
211 TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.si ze()); 211 AutoReset<size_t> positionChange(&m_insertionPosition, m_mapping.size()) ;
212 bool accumulatingTransform = layer->layoutObject()->style()->preserves3D () || ancestorLayer->layoutObject()->style()->preserves3D(); 212 bool accumulatingTransform = layer->layoutObject()->style()->preserves3D () || ancestorLayer->layoutObject()->style()->preserves3D();
213 push(layoutObject, toLayoutSize(layerOffset), accumulatingTransform ? Ac cumulatingTransform : 0); 213 push(layoutObject, toLayoutSize(layerOffset), accumulatingTransform ? Ac cumulatingTransform : 0);
214 return; 214 return;
215 } 215 }
216 const LayoutBoxModelObject* ancestorLayoutObject = ancestorLayer ? ancestorL ayer->layoutObject() : 0; 216 const LayoutBoxModelObject* ancestorLayoutObject = ancestorLayer ? ancestorL ayer->layoutObject() : 0;
217 pushMappingsToAncestor(layoutObject, ancestorLayoutObject); 217 pushMappingsToAncestor(layoutObject, ancestorLayoutObject);
218 } 218 }
219 219
220 void LayoutGeometryMap::push(const LayoutObject* layoutObject, const LayoutSize& offsetFromContainer, GeometryInfoFlags flags, LayoutSize offsetForFixedPosition ) 220 void LayoutGeometryMap::push(const LayoutObject* layoutObject, const LayoutSize& offsetFromContainer, GeometryInfoFlags flags, LayoutSize offsetForFixedPosition )
221 { 221 {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // If we're not working with multiple LayoutViews, then any view is consider ed 320 // If we're not working with multiple LayoutViews, then any view is consider ed
321 // "topmost" (to preserve original behavior). 321 // "topmost" (to preserve original behavior).
322 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) 322 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries))
323 return true; 323 return true;
324 324
325 return layoutObject->frame()->isMainFrame(); 325 return layoutObject->frame()->isMainFrame();
326 } 326 }
327 #endif 327 #endif
328 328
329 } // namespace blink 329 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698