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

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

Issue 1062283002: Use C++11 range-based loop for core/layout (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix it naming Created 5 years, 8 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 | « Source/core/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutTableSection.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) 2011 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2011 Adobe Systems Incorporated. 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 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void LayoutFlowThread::validateRegions() 66 void LayoutFlowThread::validateRegions()
67 { 67 {
68 if (m_regionsInvalidated) { 68 if (m_regionsInvalidated) {
69 m_regionsInvalidated = false; 69 m_regionsInvalidated = false;
70 m_regionsHaveUniformLogicalHeight = true; 70 m_regionsHaveUniformLogicalHeight = true;
71 71
72 if (hasRegions()) { 72 if (hasRegions()) {
73 LayoutUnit previousRegionLogicalHeight = 0; 73 LayoutUnit previousRegionLogicalHeight = 0;
74 bool firstRegionVisited = false; 74 bool firstRegionVisited = false;
75 75
76 for (LayoutMultiColumnSetList::iterator iter = m_multiColumnSetList. begin(); iter != m_multiColumnSetList.end(); ++iter) { 76 for (auto* columnSet : m_multiColumnSetList) {
77 LayoutMultiColumnSet* columnSet = *iter;
78 LayoutUnit regionLogicalHeight = columnSet->pageLogicalHeight(); 77 LayoutUnit regionLogicalHeight = columnSet->pageLogicalHeight();
79 78
80 if (!firstRegionVisited) { 79 if (!firstRegionVisited) {
81 firstRegionVisited = true; 80 firstRegionVisited = true;
82 } else { 81 } else {
83 if (m_regionsHaveUniformLogicalHeight && previousRegionLogic alHeight != regionLogicalHeight) 82 if (m_regionsHaveUniformLogicalHeight && previousRegionLogic alHeight != regionLogicalHeight)
84 m_regionsHaveUniformLogicalHeight = false; 83 m_regionsHaveUniformLogicalHeight = false;
85 } 84 }
86 85
87 previousRegionLogicalHeight = regionLogicalHeight; 86 previousRegionLogicalHeight = regionLogicalHeight;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 LayoutMultiColumnSet* columnSet = *iter; 187 LayoutMultiColumnSet* columnSet = *iter;
189 columnSet->collectLayerFragments(layerFragments, layerBoundingBox, dirty Rect); 188 columnSet->collectLayerFragments(layerFragments, layerBoundingBox, dirty Rect);
190 } 189 }
191 } 190 }
192 191
193 LayoutRect LayoutFlowThread::fragmentsBoundingBox(const LayoutRect& layerBoundin gBox) const 192 LayoutRect LayoutFlowThread::fragmentsBoundingBox(const LayoutRect& layerBoundin gBox) const
194 { 193 {
195 ASSERT(!m_regionsInvalidated); 194 ASSERT(!m_regionsInvalidated);
196 195
197 LayoutRect result; 196 LayoutRect result;
198 for (LayoutMultiColumnSetList::const_iterator iter = m_multiColumnSetList.be gin(); iter != m_multiColumnSetList.end(); ++iter) { 197 for (auto* columnSet : m_multiColumnSetList) {
199 LayoutMultiColumnSet* columnSet = *iter;
200 DeprecatedPaintLayerFragments fragments; 198 DeprecatedPaintLayerFragments fragments;
201 columnSet->collectLayerFragments(fragments, layerBoundingBox, LayoutRect (LayoutRect::infiniteIntRect())); 199 columnSet->collectLayerFragments(fragments, layerBoundingBox, LayoutRect (LayoutRect::infiniteIntRect()));
202 for (size_t i = 0; i < fragments.size(); ++i) { 200 for (const auto& fragment : fragments) {
203 const DeprecatedPaintLayerFragment& fragment = fragments.at(i);
204 LayoutRect fragmentRect(layerBoundingBox); 201 LayoutRect fragmentRect(layerBoundingBox);
205 fragmentRect.intersect(fragment.paginationClip); 202 fragmentRect.intersect(fragment.paginationClip);
206 fragmentRect.moveBy(fragment.paginationOffset); 203 fragmentRect.moveBy(fragment.paginationOffset);
207 result.unite(fragmentRect); 204 result.unite(fragmentRect);
208 } 205 }
209 } 206 }
210 207
211 return result; 208 return result;
212 } 209 }
213 210
214 void LayoutFlowThread::MultiColumnSetSearchAdapter::collectIfNeeded(const MultiC olumnSetInterval& interval) 211 void LayoutFlowThread::MultiColumnSetSearchAdapter::collectIfNeeded(const MultiC olumnSetInterval& interval)
215 { 212 {
216 if (m_result) 213 if (m_result)
217 return; 214 return;
218 if (interval.low() <= m_offset && interval.high() > m_offset) 215 if (interval.low() <= m_offset && interval.high() > m_offset)
219 m_result = interval.data(); 216 m_result = interval.data();
220 } 217 }
221 218
222 } // namespace blink 219 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutTableSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698