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

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

Issue 2502413004: WTF/std normalization: replace WTF::Vector::last with ::back (Closed)
Patch Set: rebase Created 4 years, 1 month 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 m_mapCoordinatesFlags(flags) {} 48 m_mapCoordinatesFlags(flags) {}
49 49
50 LayoutGeometryMap::~LayoutGeometryMap() {} 50 LayoutGeometryMap::~LayoutGeometryMap() {}
51 51
52 void LayoutGeometryMap::mapToAncestor( 52 void LayoutGeometryMap::mapToAncestor(
53 TransformState& transformState, 53 TransformState& transformState,
54 const LayoutBoxModelObject* ancestor) const { 54 const LayoutBoxModelObject* ancestor) const {
55 // If the mapping includes something like columns, we have to go via 55 // If the mapping includes something like columns, we have to go via
56 // layoutObjects. 56 // layoutObjects.
57 if (hasNonUniformStep()) { 57 if (hasNonUniformStep()) {
58 m_mapping.last().m_layoutObject->mapLocalToAncestor( 58 m_mapping.back().m_layoutObject->mapLocalToAncestor(
59 ancestor, transformState, ApplyContainerFlip | m_mapCoordinatesFlags); 59 ancestor, transformState, ApplyContainerFlip | m_mapCoordinatesFlags);
60 transformState.flatten(); 60 transformState.flatten();
61 return; 61 return;
62 } 62 }
63 63
64 bool inFixed = false; 64 bool inFixed = false;
65 #if ENABLE(ASSERT) 65 #if ENABLE(ASSERT)
66 bool foundAncestor = !ancestor || (m_mapping.size() && 66 bool foundAncestor = !ancestor || (m_mapping.size() &&
67 m_mapping[0].m_layoutObject == ancestor); 67 m_mapping[0].m_layoutObject == ancestor);
68 #endif 68 #endif
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 result.move(m_accumulatedOffset); 148 result.move(m_accumulatedOffset);
149 } else { 149 } else {
150 TransformState transformState(TransformState::ApplyTransformDirection, 150 TransformState transformState(TransformState::ApplyTransformDirection,
151 rect.center(), rect); 151 rect.center(), rect);
152 mapToAncestor(transformState, ancestor); 152 mapToAncestor(transformState, ancestor);
153 result = transformState.lastPlanarQuad(); 153 result = transformState.lastPlanarQuad();
154 } 154 }
155 155
156 #if ENABLE(ASSERT) 156 #if ENABLE(ASSERT)
157 if (m_mapping.size() > 0) { 157 if (m_mapping.size() > 0) {
158 const LayoutObject* lastLayoutObject = m_mapping.last().m_layoutObject; 158 const LayoutObject* lastLayoutObject = m_mapping.back().m_layoutObject;
159 159
160 FloatRect layoutObjectMappedResult = 160 FloatRect layoutObjectMappedResult =
161 lastLayoutObject 161 lastLayoutObject
162 ->localToAncestorQuad(rect, ancestor, m_mapCoordinatesFlags) 162 ->localToAncestorQuad(rect, ancestor, m_mapCoordinatesFlags)
163 .boundingBox(); 163 .boundingBox();
164 164
165 // Inspector creates layoutObjects with negative width 165 // Inspector creates layoutObjects with negative width
166 // <https://bugs.webkit.org/show_bug.cgi?id=87194>. 166 // <https://bugs.webkit.org/show_bug.cgi?id=87194>.
167 // Taking FloatQuad bounds avoids spurious assertions because of that. 167 // Taking FloatQuad bounds avoids spurious assertions because of that.
168 ASSERT(enclosingIntRect(layoutObjectMappedResult) == 168 ASSERT(enclosingIntRect(layoutObjectMappedResult) ==
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 stepInserted(step); 301 stepInserted(step);
302 } 302 }
303 303
304 void LayoutGeometryMap::popMappingsToAncestor( 304 void LayoutGeometryMap::popMappingsToAncestor(
305 const LayoutBoxModelObject* ancestorLayoutObject) { 305 const LayoutBoxModelObject* ancestorLayoutObject) {
306 ASSERT(m_mapping.size()); 306 ASSERT(m_mapping.size());
307 307
308 bool mightBeSaturated = false; 308 bool mightBeSaturated = false;
309 while (m_mapping.size() && 309 while (m_mapping.size() &&
310 m_mapping.last().m_layoutObject != ancestorLayoutObject) { 310 m_mapping.back().m_layoutObject != ancestorLayoutObject) {
311 mightBeSaturated = 311 mightBeSaturated =
312 mightBeSaturated || m_accumulatedOffset.width().mightBeSaturated(); 312 mightBeSaturated || m_accumulatedOffset.width().mightBeSaturated();
313 mightBeSaturated = 313 mightBeSaturated =
314 mightBeSaturated || m_accumulatedOffset.height().mightBeSaturated(); 314 mightBeSaturated || m_accumulatedOffset.height().mightBeSaturated();
315 stepRemoved(m_mapping.last()); 315 stepRemoved(m_mapping.back());
316 m_mapping.pop_back(); 316 m_mapping.pop_back();
317 } 317 }
318 if (UNLIKELY(mightBeSaturated)) { 318 if (UNLIKELY(mightBeSaturated)) {
319 m_accumulatedOffset = LayoutSize(); 319 m_accumulatedOffset = LayoutSize();
320 for (const auto& step : m_mapping) 320 for (const auto& step : m_mapping)
321 m_accumulatedOffset += step.m_offset; 321 m_accumulatedOffset += step.m_offset;
322 } 322 }
323 } 323 }
324 324
325 void LayoutGeometryMap::popMappingsToAncestor(const PaintLayer* ancestorLayer) { 325 void LayoutGeometryMap::popMappingsToAncestor(const PaintLayer* ancestorLayer) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // If we're not working with multiple LayoutViews, then any view is considered 369 // If we're not working with multiple LayoutViews, then any view is considered
370 // "topmost" (to preserve original behavior). 370 // "topmost" (to preserve original behavior).
371 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) 371 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries))
372 return true; 372 return true;
373 373
374 return layoutObject->frame()->isMainFrame(); 374 return layoutObject->frame()->isMainFrame();
375 } 375 }
376 #endif 376 #endif
377 377
378 } // namespace blink 378 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698