Diff
Modified: trunk/Source/WebCore/ChangeLog (185511 => 185512)
--- trunk/Source/WebCore/ChangeLog 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/ChangeLog 2015-06-12 17:10:07 UTC (rev 185512)
@@ -1,3 +1,99 @@
+2015-06-12 Hunseop Jeong <[email protected]>
+
+ Use modern for-loops in WebCore/rendering - 1
+ https://bugs.webkit.org/show_bug.cgi?id=145831
+
+ Reviewed by Darin Adler.
+
+ No new tests because there is no behavior change.
+
+ * rendering/AutoTableLayout.cpp:
+ (WebCore::AutoTableLayout::computeIntrinsicLogicalWidths):
+ (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
+ * rendering/FilterEffectRenderer.cpp:
+ (WebCore::FilterEffectRenderer::build):
+ (WebCore::FilterEffectRenderer::clearIntermediateResults):
+ * rendering/FilterEffectRenderer.h:
+ * rendering/FloatingObjects.cpp:
+ (WebCore::FloatingObjects::clearLineBoxTreePointers):
+ (WebCore::FloatingObjects::moveAllToFloatInfoMap):
+ (WebCore::FloatingObjects::computePlacedFloatsTree):
+ * rendering/FlowThreadController.cpp:
+ (WebCore::FlowThreadController::collectFixedPositionedLayers):
+ * rendering/HitTestResult.cpp:
+ (WebCore::HitTestResult::append):
+ * rendering/ImageQualityController.cpp:
+ (WebCore::ImageQualityController::highQualityRepaintTimerFired):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paint):
+ * rendering/RenderBlock.cpp:
+ (WebCore::removeBlockFromDescendantAndContainerMaps):
+ (WebCore::RenderBlock::addOverflowFromPositionedObjects):
+ (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
+ (WebCore::RenderBlock::simplifiedNormalFlowLayout):
+ (WebCore::RenderBlock::layoutPositionedObjects):
+ (WebCore::RenderBlock::markPositionedObjectsForLayout):
+ (WebCore::RenderBlock::paintContinuationOutlines):
+ (WebCore::clipOutPositionedObjects):
+ (WebCore::RenderBlock::removeFromTrackedRendererMaps):
+ (WebCore::RenderBlock::removePositionedObjects):
+ (WebCore::RenderBlock::checkPositionedObjectsNeedLayout):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
+ (WebCore::RenderBlockFlow::styleDidChange):
+ (WebCore::RenderBlockFlow::moveFloatsTo):
+ (WebCore::RenderBlockFlow::addOverflowFromFloats):
+ (WebCore::RenderBlockFlow::repaintOverhangingFloats):
+ (WebCore::RenderBlockFlow::paintFloats):
+ (WebCore::RenderBlockFlow::clipOutFloatingObjects):
+ (WebCore::RenderBlockFlow::lowestFloatLogicalBottom):
+ (WebCore::RenderBlockFlow::lowestInitialLetterLogicalBottom):
+ (WebCore::RenderBlockFlow::addOverhangingFloats):
+ (WebCore::RenderBlockFlow::addIntrudingFloats):
+ (WebCore::RenderBlockFlow::markSiblingsWithFloatsForLayout):
+ (WebCore::RenderBlockFlow::adjustForBorderFit):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::setLogicalWidthForTextRun):
+ (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
+ (WebCore::RenderBlockFlow::linkToEndLineIfNeeded):
+ (WebCore::RenderBlockFlow::repaintDirtyFloats):
+ (WebCore::RenderBlockFlow::layoutLineBoxes):
+ (WebCore::RenderBlockFlow::checkFloatsInCleanLine):
+ (WebCore::RenderBlockFlow::determineStartPosition):
+ (WebCore::RenderBlockFlow::checkPaginationAndFloatsAtEndLine):
+ * rendering/RenderCounter.cpp:
+ (WebCore::RenderCounter::destroyCounterNodes):
+ (WebCore::updateCounters):
+ (WebCore::RenderCounter::rendererStyleChanged):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::autoMarginOffsetInMainAxis):
+ (WebCore::RenderFlexibleBox::freezeViolations):
+ (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
+ (WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren):
+ (WebCore::RenderFlexibleBox::layoutColumnReverse):
+ (WebCore::RenderFlexibleBox::alignFlexLines):
+ (WebCore::RenderFlexibleBox::alignChildren):
+ (WebCore::RenderFlexibleBox::flipForWrapReverse):
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::updateAllLayerToRegionMappings):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::addAnnotatedRegions):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrder):
+ (WebCore::RenderLayer::updateDescendantDependentFlags):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::descendantLayerPaintsIntoAncestor):
+ (WebCore::RenderLayerBacking::startAnimation):
+ * rendering/RenderLineBoxList.cpp:
+ (WebCore::RenderLineBoxList::paint):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::updateFromElement):
+ * rendering/RenderMenuList.cpp:
+ (WebCore::selectedOptionCount):
+ (RenderMenuList::updateOptionsWidth):
+ * rendering/RenderMultiColumnSet.cpp:
+ (WebCore::RenderMultiColumnSet::distributeImplicitBreaks):
+
2015-06-12 Csaba Osztrogonác <[email protected]>
Fix unused private field warning in ResourceHandleSoup.cpp
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -226,17 +226,17 @@
const float epsilon = 1 / 128.0f;
float remainingPercent = 100;
- for (size_t i = 0; i < m_layoutStruct.size(); ++i) {
- minWidth += m_layoutStruct[i].effectiveMinLogicalWidth;
- maxWidth += m_layoutStruct[i].effectiveMaxLogicalWidth;
+ for (auto& layout : m_layoutStruct) {
+ minWidth += layout.effectiveMinLogicalWidth;
+ maxWidth += layout.effectiveMaxLogicalWidth;
if (scaleColumns) {
- if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
- float percent = std::min(m_layoutStruct[i].effectiveLogicalWidth.percent(), remainingPercent);
- float logicalWidth = static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) * 100 / std::max(percent, epsilon);
+ if (layout.effectiveLogicalWidth.isPercent()) {
+ float percent = std::min(layout.effectiveLogicalWidth.percent(), remainingPercent);
+ float logicalWidth = static_cast<float>(layout.effectiveMaxLogicalWidth) * 100 / std::max(percent, epsilon);
maxPercent = std::max(logicalWidth, maxPercent);
remainingPercent -= percent;
} else
- maxNonPercent += m_layoutStruct[i].effectiveMaxLogicalWidth;
+ maxNonPercent += layout.effectiveMaxLogicalWidth;
}
}
@@ -264,17 +264,15 @@
{
int maxLogicalWidth = 0;
- size_t nEffCols = m_layoutStruct.size();
int spacingInRowDirection = m_table->hBorderSpacing();
- for (size_t i = 0; i < nEffCols; ++i) {
- m_layoutStruct[i].effectiveLogicalWidth = m_layoutStruct[i].logicalWidth;
- m_layoutStruct[i].effectiveMinLogicalWidth = m_layoutStruct[i].minLogicalWidth;
- m_layoutStruct[i].effectiveMaxLogicalWidth = m_layoutStruct[i].maxLogicalWidth;
+ for (auto& layout : m_layoutStruct) {
+ layout.effectiveLogicalWidth = layout.logicalWidth;
+ layout.effectiveMinLogicalWidth = layout.minLogicalWidth;
+ layout.effectiveMaxLogicalWidth = layout.maxLogicalWidth;
}
- for (size_t i = 0; i < m_spanCells.size(); ++i) {
- RenderTableCell* cell = m_spanCells[i];
+ for (auto& cell : m_spanCells) {
if (!cell)
break;
@@ -296,7 +294,7 @@
bool haveAuto = false;
bool spanHasEmptyCellsOnly = true;
int fixedWidth = 0;
- while (lastCol < nEffCols && span > 0) {
+ while (lastCol < m_layoutStruct.size() && span > 0) {
Layout& columnLayout = m_layoutStruct[lastCol];
switch (columnLayout.logicalWidth.type()) {
case Percent:
Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -135,18 +135,17 @@
m_effects.clear();
RefPtr<FilterEffect> previousEffect = m_sourceGraphic;
- for (size_t i = 0; i < operations.operations().size(); ++i) {
+ for (auto& filterOperation : operations.operations()) {
RefPtr<FilterEffect> effect;
- FilterOperation& filterOperation = *operations.operations().at(i);
- switch (filterOperation.type()) {
+ switch (filterOperation->type()) {
case FilterOperation::REFERENCE: {
- ReferenceFilterOperation& referenceOperation = downcast<ReferenceFilterOperation>(filterOperation);
+ ReferenceFilterOperation& referenceOperation = downcast<ReferenceFilterOperation>(*filterOperation);
effect = buildReferenceFilter(renderer, previousEffect, &referenceOperation);
referenceOperation.setFilterEffect(effect);
break;
}
case FilterOperation::GRAYSCALE: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(*filterOperation);
Vector<float> inputParameters;
double _oneMinusAmount_ = clampTo(1 - colorMatrixOperation.amount(), 0.0, 1.0);
@@ -174,7 +173,7 @@
break;
}
case FilterOperation::SEPIA: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(*filterOperation);
Vector<float> inputParameters;
double _oneMinusAmount_ = clampTo(1 - colorMatrixOperation.amount(), 0.0, 1.0);
@@ -202,21 +201,21 @@
break;
}
case FilterOperation::SATURATE: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(*filterOperation);
Vector<float> inputParameters;
inputParameters.append(narrowPrecisionToFloat(colorMatrixOperation.amount()));
effect = FEColorMatrix::create(*this, FECOLORMATRIX_TYPE_SATURATE, inputParameters);
break;
}
case FilterOperation::HUE_ROTATE: {
- BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
+ BasicColorMatrixFilterOperation& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(*filterOperation);
Vector<float> inputParameters;
inputParameters.append(narrowPrecisionToFloat(colorMatrixOperation.amount()));
effect = FEColorMatrix::create(*this, FECOLORMATRIX_TYPE_HUEROTATE, inputParameters);
break;
}
case FilterOperation::INVERT: {
- BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(*filterOperation);
ComponentTransferFunction transferFunction;
transferFunction.type = FECOMPONENTTRANSFER_TYPE_TABLE;
Vector<float> transferParameters;
@@ -229,7 +228,7 @@
break;
}
case FilterOperation::OPACITY: {
- BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(*filterOperation);
ComponentTransferFunction transferFunction;
transferFunction.type = FECOMPONENTTRANSFER_TYPE_TABLE;
Vector<float> transferParameters;
@@ -242,7 +241,7 @@
break;
}
case FilterOperation::BRIGHTNESS: {
- BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(*filterOperation);
ComponentTransferFunction transferFunction;
transferFunction.type = FECOMPONENTTRANSFER_TYPE_LINEAR;
transferFunction.slope = narrowPrecisionToFloat(componentTransferOperation.amount());
@@ -253,7 +252,7 @@
break;
}
case FilterOperation::CONTRAST: {
- BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
+ BasicComponentTransferFilterOperation& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(*filterOperation);
ComponentTransferFunction transferFunction;
transferFunction.type = FECOMPONENTTRANSFER_TYPE_LINEAR;
float amount = narrowPrecisionToFloat(componentTransferOperation.amount());
@@ -265,13 +264,13 @@
break;
}
case FilterOperation::BLUR: {
- BlurFilterOperation& blurOperation = downcast<BlurFilterOperation>(filterOperation);
+ BlurFilterOperation& blurOperation = downcast<BlurFilterOperation>(*filterOperation);
float stdDeviation = floatValueForLength(blurOperation.stdDeviation(), 0);
effect = FEGaussianBlur::create(*this, stdDeviation, stdDeviation, consumer == FilterProperty ? EDGEMODE_NONE : EDGEMODE_DUPLICATE);
break;
}
case FilterOperation::DROP_SHADOW: {
- DropShadowFilterOperation& dropShadowOperation = downcast<DropShadowFilterOperation>(filterOperation);
+ DropShadowFilterOperation& dropShadowOperation = downcast<DropShadowFilterOperation>(*filterOperation);
effect = FEDropShadow::create(*this, dropShadowOperation.stdDeviation(), dropShadowOperation.stdDeviation(),
dropShadowOperation.x(), dropShadowOperation.y(), dropShadowOperation.color(), 1);
break;
@@ -286,7 +285,7 @@
effect->setClipsToBounds(consumer == FilterFunction);
effect->setOperatingColorSpace(ColorSpaceDeviceRGB);
- if (filterOperation.type() != FilterOperation::REFERENCE) {
+ if (filterOperation->type() != FilterOperation::REFERENCE) {
effect->inputEffects().append(previousEffect);
m_effects.append(effect);
}
@@ -331,8 +330,8 @@
void FilterEffectRenderer::clearIntermediateResults()
{
m_sourceGraphic->clearResult();
- for (size_t i = 0; i < m_effects.size(); ++i)
- m_effects[i]->clearResult();
+ for (auto& effect : m_effects)
+ effect->clearResult();
}
void FilterEffectRenderer::apply()
Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.h (185511 => 185512)
--- trunk/Source/WebCore/rendering/FilterEffectRenderer.h 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.h 2015-06-12 17:10:07 UTC (rev 185512)
@@ -120,10 +120,8 @@
private:
void setMaxEffectRects(const FloatRect& effectRect)
{
- for (size_t i = 0; i < m_effects.size(); ++i) {
- RefPtr<FilterEffect> effect = m_effects.at(i);
+ for (auto& effect : m_effects)
effect->setMaxEffectRect(effectRect);
- }
}
FilterEffect* lastEffect() const
Modified: trunk/Source/WebCore/rendering/FloatingObjects.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/FloatingObjects.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/FloatingObjects.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -266,9 +266,9 @@
void FloatingObjects::clearLineBoxTreePointers()
{
// Clear references to originating lines, since the lines are being deleted
- for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
- ASSERT(!((*it)->originatingLine()) || &((*it)->originatingLine()->renderer()) == &m_renderer);
- (*it)->setOriginatingLine(0);
+ for (auto& floatingObject : m_set) {
+ ASSERT(!floatingObject->originatingLine() || &floatingObject->originatingLine()->renderer() == &m_renderer);
+ floatingObject->setOriginatingLine(nullptr);
}
}
@@ -282,12 +282,12 @@
void FloatingObjects::moveAllToFloatInfoMap(RendererToFloatInfoMap& map)
{
- for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
- auto& renderer = it->get()->renderer();
+ for (auto& floatingObject : m_set) {
+ auto& renderer = floatingObject->renderer();
// FIXME: The only reason it is safe to move these out of the set is that
// we are about to clear it. Otherwise it would break the hash table invariant.
// A clean way to do this would be to add a takeAll function to HashSet.
- map.add(&renderer, WTF::move(*it));
+ map.add(&renderer, WTF::move(floatingObject));
}
clear();
}
@@ -374,10 +374,9 @@
return;
m_placedFloatsTree = std::make_unique<FloatingObjectTree>();
- for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
+ for (auto& floatingObject : m_set) {
if (floatingObject->isPlaced())
- m_placedFloatsTree->add(intervalForFloatingObject(floatingObject));
+ m_placedFloatsTree->add(intervalForFloatingObject(floatingObject.get()));
}
}
Modified: trunk/Source/WebCore/rendering/FlowThreadController.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/FlowThreadController.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/FlowThreadController.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -274,8 +274,7 @@
RenderLayer* flowThreadLayer = flowRenderer->layer();
if (Vector<RenderLayer*>* negZOrderList = flowThreadLayer->negZOrderList()) {
- for (size_t i = 0, size = negZOrderList->size(); i < size; ++i) {
- RenderLayer* currLayer = negZOrderList->at(i);
+ for (auto& currLayer : *negZOrderList) {
if (currLayer->renderer().style().position() != FixedPosition)
continue;
fixedPosLayers.append(currLayer);
@@ -283,8 +282,7 @@
}
if (Vector<RenderLayer*>* posZOrderList = flowThreadLayer->posZOrderList()) {
- for (size_t i = 0, size = posZOrderList->size(); i < size; ++i) {
- RenderLayer* currLayer = posZOrderList->at(i);
+ for (auto& currLayer : *posZOrderList) {
if (currLayer->renderer().style().position() != FixedPosition)
continue;
fixedPosLayers.append(currLayer);
Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/HitTestResult.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -702,8 +702,8 @@
if (other.m_rectBasedTestResult) {
NodeSet& set = mutableRectBasedTestResult();
- for (NodeSet::const_iterator it = other.m_rectBasedTestResult->begin(), last = other.m_rectBasedTestResult->end(); it != last; ++it)
- set.add(it->get());
+ for (auto& result : *other.m_rectBasedTestResult)
+ set.add(result);
}
}
Modified: trunk/Source/WebCore/rendering/ImageQualityController.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/ImageQualityController.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/ImageQualityController.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -88,8 +88,8 @@
return;
}
- for (auto it = m_objectLayerSizeMap.begin(), end = m_objectLayerSizeMap.end(); it != end; ++it)
- it->key->repaint();
+ for (auto& object : m_objectLayerSizeMap.keys())
+ object->repaint();
m_liveResizeOptimizationIsActive = false;
}
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -630,12 +630,7 @@
paintDocumentMarkers(context, boxOrigin, lineStyle, font, false);
if (useCustomUnderlines) {
- const Vector<CompositionUnderline>& underlines = renderer().frame().editor().customCompositionUnderlines();
- size_t numUnderlines = underlines.size();
-
- for (size_t index = 0; index < numUnderlines; ++index) {
- const CompositionUnderline& underline = underlines[index];
-
+ for (auto& underline : renderer().frame().editor().customCompositionUnderlines()) {
if (underline.endOffset <= start())
// underline is completely before this run. This might be an underline that sits
// before the first run we draw, or underlines that were within runs we skipped
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -193,10 +193,9 @@
static void removeBlockFromDescendantAndContainerMaps(RenderBlock* block, TrackedDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap)
{
- if (std::unique_ptr<TrackedRendererListHashSet> descendantSet = descendantMap->take(block)) {
- TrackedRendererListHashSet::iterator end = descendantSet->end();
- for (TrackedRendererListHashSet::iterator descendant = descendantSet->begin(); descendant != end; ++descendant) {
- TrackedContainerMap::iterator it = containerMap->find(*descendant);
+ if (auto descendantSet = descendantMap->take(block)) {
+ for (auto& box : *descendantSet) {
+ auto it = containerMap->find(box);
ASSERT(it != containerMap->end());
if (it == containerMap->end())
continue;
@@ -1051,9 +1050,7 @@
if (!positionedDescendants)
return;
- for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
- RenderBox* positionedObject = *it;
-
+ for (auto& positionedObject : *positionedDescendants) {
// Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
if (positionedObject->style().position() != FixedPosition) {
LayoutUnit x = positionedObject->x();
@@ -1148,8 +1145,7 @@
if (!descendants)
return;
- for (auto it = descendants->begin(), end = descendants->end(); it != end; ++it) {
- RenderBox* box = *it;
+ for (auto& box : *descendants) {
while (box != this) {
if (box->normalChildNeedsLayout())
break;
@@ -1186,11 +1182,9 @@
// FIXME: Glyph overflow will get lost in this case, but not really a big deal.
// FIXME: Find a way to invalidate the knownToHaveNoOverflow flag on the InlineBoxes.
- GlyphOverflowAndFallbackFontsMap textBoxDataMap;
- for (auto it = lineBoxes.begin(), end = lineBoxes.end(); it != end; ++it) {
- RootInlineBox* box = *it;
+ GlyphOverflowAndFallbackFontsMap textBoxDataMap;
+ for (auto& box : lineBoxes)
box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataMap);
- }
} else {
for (auto box = firstChildBox(); box; box = box->nextSiblingBox()) {
if (!box->isOutOfFlowPositioned())
@@ -1299,17 +1293,15 @@
if (!positionedDescendants)
return;
- for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
- RenderBox& r = **it;
-
- estimateRegionRangeForBoxChild(r);
+ for (auto& box : *positionedDescendants) {
+ estimateRegionRangeForBoxChild(*box);
// A fixed position element with an absolute positioned ancestor has no way of knowing if the latter has changed position. So
// if this is a fixed position element, mark it for layout if it has an abspos ancestor and needs to move with that ancestor, i.e.
// it has static position.
- markFixedPositionObjectForLayoutIfNeeded(r);
+ markFixedPositionObjectForLayoutIfNeeded(*box);
if (fixedPositionObjectsOnly) {
- r.layoutIfNeeded();
+ box->layoutIfNeeded();
continue;
}
@@ -1317,43 +1309,43 @@
// non-positioned block. Rather than trying to detect all of these movement cases, we just always lay out positioned
// objects that are positioned implicitly like this. Such objects are rare, and so in typical DHTML menu usage (where everything is
// positioned explicitly) this should not incur a performance penalty.
- if (relayoutChildren || (r.style().hasStaticBlockPosition(isHorizontalWritingMode()) && r.parent() != this))
- r.setChildNeedsLayout(MarkOnlyThis);
+ if (relayoutChildren || (box->style().hasStaticBlockPosition(isHorizontalWritingMode()) && box->parent() != this))
+ box->setChildNeedsLayout(MarkOnlyThis);
// If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths.
- if (relayoutChildren && r.needsPreferredWidthsRecalculation())
- r.setPreferredLogicalWidthsDirty(true, MarkOnlyThis);
+ if (relayoutChildren && box->needsPreferredWidthsRecalculation())
+ box->setPreferredLogicalWidthsDirty(true, MarkOnlyThis);
- r.markForPaginationRelayoutIfNeeded();
+ box->markForPaginationRelayoutIfNeeded();
// We don't have to do a full layout. We just have to update our position. Try that first. If we have shrink-to-fit width
// and we hit the available width constraint, the layoutIfNeeded() will catch it and do a full layout.
- if (r.needsPositionedMovementLayoutOnly() && r.tryLayoutDoingPositionedMovementOnly())
- r.clearNeedsLayout();
+ if (box->needsPositionedMovementLayoutOnly() && box->tryLayoutDoingPositionedMovementOnly())
+ box->clearNeedsLayout();
// If we are paginated or in a line grid, compute a vertical position for our object now.
// If it's wrong we'll lay out again.
LayoutUnit oldLogicalTop = 0;
- bool needsBlockDirectionLocationSetBeforeLayout = r.needsLayout() && view().layoutState()->needsBlockDirectionLocationSetBeforeLayout();
+ bool needsBlockDirectionLocationSetBeforeLayout = box->needsLayout() && view().layoutState()->needsBlockDirectionLocationSetBeforeLayout();
if (needsBlockDirectionLocationSetBeforeLayout) {
- if (isHorizontalWritingMode() == r.isHorizontalWritingMode())
- r.updateLogicalHeight();
+ if (isHorizontalWritingMode() == box->isHorizontalWritingMode())
+ box->updateLogicalHeight();
else
- r.updateLogicalWidth();
- oldLogicalTop = logicalTopForChild(r);
+ box->updateLogicalWidth();
+ oldLogicalTop = logicalTopForChild(*box);
}
- r.layoutIfNeeded();
+ box->layoutIfNeeded();
// Lay out again if our estimate was wrong.
- if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r) != oldLogicalTop) {
- r.setChildNeedsLayout(MarkOnlyThis);
- r.layoutIfNeeded();
+ if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(*box) != oldLogicalTop) {
+ box->setChildNeedsLayout(MarkOnlyThis);
+ box->layoutIfNeeded();
}
- if (updateRegionRangeForBoxChild(r)) {
- r.setNeedsLayout(MarkOnlyThis);
- r.layoutIfNeeded();
+ if (updateRegionRangeForBoxChild(*box)) {
+ box->setNeedsLayout(MarkOnlyThis);
+ box->layoutIfNeeded();
}
}
}
@@ -1364,10 +1356,8 @@
if (!positionedDescendants)
return;
- for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
- RenderBox* r = *it;
- r->setChildNeedsLayout();
- }
+ for (auto& box : *positionedDescendants)
+ box->setChildNeedsLayout();
}
void RenderBlock::markForPaginationRelayoutIfNeeded()
@@ -1691,10 +1681,8 @@
LayoutPoint accumulatedPaintOffset = paintOffset;
// Paint each continuation outline.
- ListHashSet<RenderInline*>::iterator end = continuations->end();
- for (ListHashSet<RenderInline*>::iterator it = continuations->begin(); it != end; ++it) {
+ for (auto& flow : *continuations) {
// Need to add in the coordinates of the intervening blocks.
- RenderInline* flow = *it;
RenderBlock* block = flow->containingBlock();
for ( ; block && block != this; block = block->containingBlock())
accumulatedPaintOffset.moveBy(block->location());
@@ -1788,11 +1776,8 @@
if (!positionedObjects)
return;
- TrackedRendererListHashSet::const_iterator end = positionedObjects->end();
- for (TrackedRendererListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
- RenderBox* r = *it;
- paintInfo->context->clipOut(IntRect(offset.x() + r->x(), offset.y() + r->y(), r->width(), r->height()));
- }
+ for (auto& object : *positionedObjects)
+ paintInfo->context->clipOut(IntRect(offset.x() + object->x(), offset.y() + object->y(), object->width(), object->height()));
}
LayoutUnit blockDirectionOffset(RenderBlock& rootBlock, const LayoutSize& offsetFromRootBlock)
@@ -2123,9 +2108,7 @@
if (!containerSet)
return;
- for (auto it = containerSet->begin(), end = containerSet->end(); it != end; ++it) {
- RenderBlock* container = *it;
-
+ for (auto& container : *containerSet) {
// FIXME: Disabling this assert temporarily until we fix the layout
// bugs associated with positioned objects not properly cleared from
// their ancestor chain before being moved. See webkit bug 93766.
@@ -2173,26 +2156,25 @@
Vector<RenderBox*, 16> deadObjects;
- for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
- RenderBox* r = *it;
- if (!o || r->isDescendantOf(o)) {
+ for (auto& box : *positionedDescendants) {
+ if (!o || box->isDescendantOf(o)) {
if (containingBlockState == NewContainingBlock)
- r->setChildNeedsLayout(MarkOnlyThis);
+ box->setChildNeedsLayout(MarkOnlyThis);
// It is parent blocks job to add positioned child to positioned objects list of its containing block
// Parent layout needs to be invalidated to ensure this happens.
- RenderElement* p = r->parent();
+ RenderElement* p = box->parent();
while (p && !p->isRenderBlock())
p = p->parent();
if (p)
p->setChildNeedsLayout();
- deadObjects.append(r);
+ deadObjects.append(box);
}
}
- for (unsigned i = 0; i < deadObjects.size(); i++)
- removePositionedObject(*deadObjects.at(i));
+ for (auto& object : deadObjects)
+ removePositionedObject(*object);
}
void RenderBlock::addPercentHeightDescendant(RenderBox& descendant)
@@ -3743,10 +3725,8 @@
if (!positionedDescendantSet)
return;
- for (auto it = positionedDescendantSet->begin(), end = positionedDescendantSet->end(); it != end; ++it) {
- RenderBox* currBox = *it;
- ASSERT(!currBox->needsLayout());
- }
+ for (auto& box : *positionedDescendantSet)
+ ASSERT(!box->needsLayout());
}
#endif
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -203,10 +203,7 @@
HashSet<RenderBox*> oldIntrudingFloatSet;
if (!childrenInline() && m_floatingObjects) {
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
+ for (auto& floatingObject : m_floatingObjects->set()) {
if (!floatingObject->isDescendant())
oldIntrudingFloatSet.add(&floatingObject->renderer());
}
@@ -264,15 +261,12 @@
LayoutUnit changeLogicalTop = LayoutUnit::max();
LayoutUnit changeLogicalBottom = LayoutUnit::min();
if (m_floatingObjects) {
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
+ for (auto& floatingObject : m_floatingObjects->set()) {
std::unique_ptr<FloatingObject> oldFloatingObject = floatMap.take(&floatingObject->renderer());
- LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject);
+ LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject.get());
if (oldFloatingObject) {
LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloatingObject.get());
- if (logicalWidthForFloat(floatingObject) != logicalWidthForFloat(oldFloatingObject.get()) || logicalLeftForFloat(floatingObject) != logicalLeftForFloat(oldFloatingObject.get())) {
+ if (logicalWidthForFloat(floatingObject.get()) != logicalWidthForFloat(oldFloatingObject.get()) || logicalLeftForFloat(floatingObject.get()) != logicalLeftForFloat(oldFloatingObject.get())) {
changeLogicalTop = 0;
changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalBottom, oldLogicalBottom));
} else {
@@ -280,7 +274,7 @@
changeLogicalTop = std::min(changeLogicalTop, std::min(logicalBottom, oldLogicalBottom));
changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalBottom, oldLogicalBottom));
}
- LayoutUnit logicalTop = logicalTopForFloat(floatingObject);
+ LayoutUnit logicalTop = logicalTopForFloat(floatingObject.get());
LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatingObject.get());
if (logicalTop != oldLogicalTop) {
changeLogicalTop = std::min(changeLogicalTop, std::min(logicalTop, oldLogicalTop));
@@ -299,12 +293,10 @@
}
}
- auto end = floatMap.end();
- for (auto it = floatMap.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->value.get();
+ for (auto& floatingObject : floatMap.values()) {
if (!floatingObject->isDescendant()) {
changeLogicalTop = 0;
- changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(floatingObject));
+ changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(floatingObject.get()));
}
}
@@ -315,10 +307,8 @@
if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size())
markAllDescendantsWithFloatsForLayout();
else {
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it)
- oldIntrudingFloatSet.remove(&(*it)->renderer());
+ for (auto& floatingObject : m_floatingObjects->set())
+ oldIntrudingFloatSet.remove(&floatingObject->renderer());
if (!oldIntrudingFloatSet.isEmpty())
markAllDescendantsWithFloatsForLayout();
}
@@ -1982,8 +1972,8 @@
if (ancestor.isRenderView())
break;
if (ancestor.hasOverhangingFloats()) {
- for (auto it = floatingObjectSet.begin(), end = floatingObjectSet.end(); it != end; ++it) {
- RenderBox& renderer = (*it)->renderer();
+ for (auto& floatingObject : floatingObjectSet) {
+ RenderBox& renderer = floatingObject->renderer();
if (ancestor.hasOverhangingFloat(renderer)) {
parentBlock = &ancestor;
break;
@@ -2070,12 +2060,7 @@
if (!toBlockFlow->m_floatingObjects)
toBlockFlow->createFloatingObjects();
- const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set();
- auto end = fromFloatingObjectSet.end();
-
- for (auto it = fromFloatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
-
+ for (auto& floatingObject : m_floatingObjects->set()) {
// Don't insert the object again if it's already in the list
if (toBlockFlow->containsFloat(floatingObject->renderer()))
continue;
@@ -2097,12 +2082,9 @@
if (!m_floatingObjects)
return;
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* r = it->get();
- if (r->isDescendant())
- addOverflowFromChild(&r->renderer(), IntSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r)));
+ for (auto& floatingObject : m_floatingObjects->set()) {
+ if (floatingObject->isDescendant())
+ addOverflowFromChild(&floatingObject->renderer(), IntSize(xPositionForFloatIncludingMargin(floatingObject.get()), yPositionForFloatIncludingMargin(floatingObject.get())));
}
}
@@ -2124,14 +2106,11 @@
// FIXME: Avoid disabling LayoutState. At the very least, don't disable it for floats originating
// in this block. Better yet would be to push extra state for the containers of other floats.
LayoutStateDisabler layoutStateDisabler(&view());
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
+ for (auto& floatingObject : m_floatingObjects->set()) {
// Only repaint the object if it is overhanging, is not in its own layer, and
// is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter
// condition is replaced with being a descendant of us.
- if (logicalBottomForFloat(floatingObject) > logicalHeight()
+ if (logicalBottomForFloat(floatingObject.get()) > logicalHeight()
&& !floatingObject->renderer().hasSelfPaintingLayer()
&& (floatingObject->shouldPaint() || (paintAllDescendants && floatingObject->renderer().isDescendantOf(this)))) {
floatingObject->renderer().repaint();
@@ -2159,26 +2138,23 @@
if (!m_floatingObjects)
return;
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* r = it->get();
+ for (auto& floatingObject : m_floatingObjects->set()) {
// Only paint the object if our m_shouldPaint flag is set.
- if (r->shouldPaint() && !r->renderer().hasSelfPaintingLayer()) {
+ if (floatingObject->shouldPaint() && !floatingObject->renderer().hasSelfPaintingLayer()) {
PaintInfo currentPaintInfo(paintInfo);
currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
// FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner.
- LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->renderer().x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->renderer().y()));
- r->renderer().paint(currentPaintInfo, childPoint);
+ LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject.get(), LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(floatingObject.get()) - floatingObject->renderer().x(), paintOffset.y() + yPositionForFloatIncludingMargin(floatingObject.get()) - floatingObject->renderer().y()));
+ floatingObject->renderer().paint(currentPaintInfo, childPoint);
if (!preservePhase) {
currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
- r->renderer().paint(currentPaintInfo, childPoint);
+ floatingObject->renderer().paint(currentPaintInfo, childPoint);
currentPaintInfo.phase = PaintPhaseFloat;
- r->renderer().paint(currentPaintInfo, childPoint);
+ floatingObject->renderer().paint(currentPaintInfo, childPoint);
currentPaintInfo.phase = PaintPhaseForeground;
- r->renderer().paint(currentPaintInfo, childPoint);
+ floatingObject->renderer().paint(currentPaintInfo, childPoint);
currentPaintInfo.phase = PaintPhaseOutline;
- r->renderer().paint(currentPaintInfo, childPoint);
+ floatingObject->renderer().paint(currentPaintInfo, childPoint);
}
}
}
@@ -2187,12 +2163,9 @@
void RenderBlockFlow::clipOutFloatingObjects(RenderBlock& rootBlock, const PaintInfo* paintInfo, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock)
{
if (m_floatingObjects) {
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
- LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(floatingObject),
- offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(floatingObject),
+ for (auto& floatingObject : m_floatingObjects->set()) {
+ LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(floatingObject.get()),
+ offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(floatingObject.get()),
floatingObject->renderer().width(), floatingObject->renderer().height());
rootBlock.flipForWritingMode(floatBox);
floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y());
@@ -2590,12 +2563,9 @@
if (!m_floatingObjects)
return 0;
LayoutUnit lowestFloatBottom = 0;
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
+ for (auto& floatingObject : m_floatingObjects->set()) {
if (floatingObject->isPlaced() && floatingObject->type() & floatType)
- lowestFloatBottom = std::max(lowestFloatBottom, logicalBottomForFloat(floatingObject));
+ lowestFloatBottom = std::max(lowestFloatBottom, logicalBottomForFloat(floatingObject.get()));
}
return lowestFloatBottom;
}
@@ -2605,12 +2575,9 @@
if (!m_floatingObjects)
return 0;
LayoutUnit lowestFloatBottom = 0;
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
+ for (auto& floatingObject : m_floatingObjects->set()) {
if (floatingObject->isPlaced() && floatingObject->renderer().style().styleType() == FIRST_LETTER && floatingObject->renderer().style().initialLetterDrop() > 0)
- lowestFloatBottom = std::max(lowestFloatBottom, logicalBottomForFloat(floatingObject));
+ lowestFloatBottom = std::max(lowestFloatBottom, logicalBottomForFloat(floatingObject.get()));
}
return lowestFloatBottom;
}
@@ -2627,10 +2594,8 @@
// Floats that will remain the child's responsibility to paint should factor into its
// overflow.
- auto childEnd = child.m_floatingObjects->set().end();
- for (auto childIt = child.m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) {
- FloatingObject* floatingObject = childIt->get();
- LayoutUnit floatLogicalBottom = std::min(logicalBottomForFloat(floatingObject), LayoutUnit::max() - childLogicalTop);
+ for (auto& floatingObject : child.m_floatingObjects->set()) {
+ LayoutUnit floatLogicalBottom = std::min(logicalBottomForFloat(floatingObject.get()), LayoutUnit::max() - childLogicalTop);
LayoutUnit logicalBottom = childLogicalTop + floatLogicalBottom;
lowestFloatLogicalBottom = std::max(lowestFloatLogicalBottom, logicalBottom);
@@ -2667,7 +2632,7 @@
// Since the float doesn't overhang, it didn't get put into our list. We need to add its overflow in to the child now.
if (floatingObject->isDescendant())
- child.addOverflowFromChild(&floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floatingObject)));
+ child.addOverflowFromChild(&floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(floatingObject.get()), yPositionForFloatIncludingMargin(floatingObject.get())));
}
}
return lowestFloatLogicalBottom;
@@ -2700,11 +2665,8 @@
logicalLeftOffset += marginLogicalLeft();
- const FloatingObjectSet& prevSet = prev->m_floatingObjects->set();
- auto prevEnd = prevSet.end();
- for (auto prevIt = prevSet.begin(); prevIt != prevEnd; ++prevIt) {
- FloatingObject* floatingObject = prevIt->get();
- if (logicalBottomForFloat(floatingObject) > logicalTopOffset) {
+ for (auto& floatingObject : prev->m_floatingObjects->set()) {
+ if (logicalBottomForFloat(floatingObject.get()) > logicalTopOffset) {
if (!m_floatingObjects || !m_floatingObjects->set().contains<FloatingObject&, FloatingObjectHashTranslator>(*floatingObject)) {
// We create the floating object list lazily.
if (!m_floatingObjects)
@@ -2756,16 +2718,13 @@
if (!m_floatingObjects)
return;
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
-
for (RenderObject* next = nextSibling(); next; next = next->nextSibling()) {
if (!is<RenderBlockFlow>(*next) || next->isFloatingOrOutOfFlowPositioned())
continue;
RenderBlockFlow& nextBlock = downcast<RenderBlockFlow>(*next);
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- RenderBox& floatingBox = (*it)->renderer();
+ for (auto& floatingObject : m_floatingObjects->set()) {
+ RenderBox& floatingBox = floatingObject->renderer();
if (floatToRemove && &floatingBox != floatToRemove)
continue;
if (nextBlock.containsFloat(floatingBox))
@@ -2928,14 +2887,11 @@
}
if (m_floatingObjects) {
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* r = it->get();
+ for (auto& floatingObject : m_floatingObjects->set()) {
// Only examine the object if our m_shouldPaint flag is set.
- if (r->shouldPaint()) {
- LayoutUnit floatLeft = xPositionForFloatIncludingMargin(r) - r->renderer().x();
- LayoutUnit floatRight = floatLeft + r->renderer().width();
+ if (floatingObject->shouldPaint()) {
+ LayoutUnit floatLeft = xPositionForFloatIncludingMargin(floatingObject.get()) - floatingObject->renderer().x();
+ LayoutUnit floatRight = floatLeft + floatingObject->renderer().width();
left = std::min(left, floatLeft);
right = std::max(right, floatRight);
}
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -512,9 +512,8 @@
} else
measuredWidth += wordMeasurement.width;
if (!wordMeasurement.fallbackFonts.isEmpty()) {
- HashSet<const Font*>::const_iterator end = wordMeasurement.fallbackFonts.end();
- for (HashSet<const Font*>::const_iterator it = wordMeasurement.fallbackFonts.begin(); it != end; ++it)
- fallbackFonts.add(*it);
+ for (auto& font : wordMeasurement.fallbackFonts)
+ fallbackFonts.add(font);
}
}
if (measuredWidth && lastEndOffset != run->m_stop) {
@@ -1336,8 +1335,8 @@
}
}
- for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i)
- setStaticPositions(*this, *lineBreaker.positionedObjects()[i]);
+ for (auto& positionedObject : lineBreaker.positionedObjects())
+ setStaticPositions(*this, *positionedObject);
if (!layoutState.lineInfo().isEmpty()) {
layoutState.lineInfo().setFirstLine(false);
@@ -1454,8 +1453,7 @@
if (layoutState.flowThread())
updateRegionForLine(line);
if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) {
- for (auto it = cleanLineFloats->begin(), end = cleanLineFloats->end(); it != end; ++it) {
- RenderBox* floatingBox = *it;
+ for (auto& floatingBox : *cleanLineFloats) {
FloatingObject* floatingObject = insertFloatingObject(*floatingBox);
ASSERT(!floatingObject->originatingLine());
floatingObject->setOriginatingLine(line);
@@ -1512,13 +1510,12 @@
void RenderBlockFlow::repaintDirtyFloats(Vector<FloatWithRect>& floats)
{
- size_t floatCount = floats.size();
// Floats that did not have layout did not repaint when we laid them out. They would have
// painted by now if they had moved, but if they stayed at (0, 0), they still need to be
// painted.
- for (size_t i = 0; i < floatCount; ++i) {
- if (!floats[i].everHadLayout) {
- RenderBox& box = floats[i].object;
+ for (auto& floatWithRect : floats) {
+ if (!floatWithRect.everHadLayout) {
+ RenderBox& box = floatWithRect.object;
if (!box.x() && !box.y() && box.checkForRepaintDuringLayout())
box.repaint();
}
@@ -1606,8 +1603,8 @@
}
}
- for (size_t i = 0; i < replacedChildren.size(); i++)
- replacedChildren[i]->layoutIfNeeded();
+ for (auto& child : replacedChildren)
+ child->layoutIfNeeded();
layoutRunsAndFloats(layoutState, hasInlineChild);
}
@@ -1645,8 +1642,7 @@
return;
}
- for (auto it = cleanLineFloats->begin(), end = cleanLineFloats->end(); it != end; ++it) {
- RenderBox* floatingBox = *it;
+ for (auto& floatingBox : *cleanLineFloats) {
floatingBox->layoutIfNeeded();
LayoutSize newSize(floatingBox->width() + floatingBox->horizontalMarginExtent(), floatingBox->height() + floatingBox->verticalMarginExtent());
ASSERT_WITH_SECURITY_IMPLICATION(floatIndex < floats.size());
@@ -1747,8 +1743,7 @@
RootInlineBox* line = firstRootBox();
while (line != curr) {
if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) {
- for (auto it = cleanLineFloats->begin(), end = cleanLineFloats->end(); it != end; ++it) {
- RenderBox* floatingBox = *it;
+ for (auto& floatingBox : *cleanLineFloats) {
FloatingObject* floatingObject = insertFloatingObject(*floatingBox);
ASSERT(!floatingObject->originatingLine());
floatingObject->setOriginatingLine(line);
@@ -1855,11 +1850,8 @@
LayoutUnit logicalBottom = lastLine->lineBottomWithLeading() + absoluteValue(lineDelta);
- const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
- auto end = floatingObjectSet.end();
- for (auto it = floatingObjectSet.begin(); it != end; ++it) {
- FloatingObject* floatingObject = it->get();
- if (logicalBottomForFloat(floatingObject) >= logicalTop && logicalBottomForFloat(floatingObject) < logicalBottom)
+ for (auto& floatingObject : m_floatingObjects->set()) {
+ if (logicalBottomForFloat(floatingObject.get()) >= logicalTop && logicalBottomForFloat(floatingObject.get()) < logicalBottom)
return false;
}
Modified: trunk/Source/WebCore/rendering/RenderCounter.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderCounter.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderCounter.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -455,11 +455,8 @@
CounterMaps::iterator mapsIterator = maps.find(&owner);
if (mapsIterator == maps.end())
return;
- CounterMap* map = mapsIterator->value.get();
- CounterMap::const_iterator end = map->end();
- for (CounterMap::const_iterator it = map->begin(); it != end; ++it) {
- destroyCounterNodeWithoutMapRemoval(it->key, it->value.get());
- }
+ for (auto& counter : *mapsIterator->value.get())
+ destroyCounterNodeWithoutMapRemoval(counter.key, counter.value.get());
maps.remove(mapsIterator);
owner.setHasCounterNodeMap(false);
}
@@ -508,25 +505,24 @@
const CounterDirectiveMap* directiveMap = renderer.style().counterDirectives();
if (!directiveMap)
return;
- CounterDirectiveMap::const_iterator end = directiveMap->end();
if (!renderer.hasCounterNodeMap()) {
- for (CounterDirectiveMap::const_iterator it = directiveMap->begin(); it != end; ++it)
- makeCounterNode(renderer, it->key, false);
+ for (auto& key : directiveMap->keys())
+ makeCounterNode(renderer, key, false);
return;
}
CounterMap* counterMap = counterMaps().get(&renderer);
ASSERT(counterMap);
- for (CounterDirectiveMap::const_iterator it = directiveMap->begin(); it != end; ++it) {
- RefPtr<CounterNode> node = counterMap->get(it->key);
+ for (auto& key : directiveMap->keys()) {
+ RefPtr<CounterNode> node = counterMap->get(key);
if (!node) {
- makeCounterNode(renderer, it->key, false);
+ makeCounterNode(renderer, key, false);
continue;
}
RefPtr<CounterNode> newParent = 0;
RefPtr<CounterNode> newPreviousSibling = 0;
- findPlaceForCounter(renderer, it->key, node->hasResetType(), newParent, newPreviousSibling);
- if (node != counterMap->get(it->key))
+ findPlaceForCounter(renderer, key, node->hasResetType(), newParent, newPreviousSibling);
+ if (node != counterMap->get(key))
continue;
CounterNode* parent = node->parent();
if (newParent == parent && newPreviousSibling == node->previousSibling())
@@ -534,7 +530,7 @@
if (parent)
parent->removeChild(node.get());
if (newParent)
- newParent->insertAfter(node.get(), newPreviousSibling.get(), it->key);
+ newParent->insertAfter(node.get(), newPreviousSibling.get(), key);
}
}
@@ -564,36 +560,33 @@
const CounterDirectiveMap* oldCounterDirectives;
if (oldStyle && (oldCounterDirectives = oldStyle->counterDirectives())) {
if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) {
- CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end();
- CounterDirectiveMap::const_iterator oldMapEnd = oldCounterDirectives->end();
- for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) {
- CounterDirectiveMap::const_iterator oldMapIt = oldCounterDirectives->find(it->key);
- if (oldMapIt != oldMapEnd) {
- if (oldMapIt->value == it->value)
+ for (auto& directive : *newCounterDirectives) {
+ auto oldMapIt = oldCounterDirectives->find(directive.key);
+ if (oldMapIt != oldCounterDirectives->end()) {
+ if (oldMapIt->value == directive.value)
continue;
- RenderCounter::destroyCounterNode(renderer, it->key);
+ RenderCounter::destroyCounterNode(renderer, directive.key);
}
// We must create this node here, because the changed node may be a node with no display such as
// as those created by the increment or reset directives and the re-layout that will happen will
// not catch the change if the node had no children.
- makeCounterNode(renderer, it->key, false);
+ makeCounterNode(renderer, directive.key, false);
}
// Destroying old counters that do not exist in the new counterDirective map.
- for (CounterDirectiveMap::const_iterator it = oldCounterDirectives->begin(); it !=oldMapEnd; ++it) {
- if (!newCounterDirectives->contains(it->key))
- RenderCounter::destroyCounterNode(renderer, it->key);
+ for (auto& key : oldCounterDirectives->keys()) {
+ if (!newCounterDirectives->contains(key))
+ RenderCounter::destroyCounterNode(renderer, key);
}
} else {
if (renderer.hasCounterNodeMap())
RenderCounter::destroyCounterNodes(renderer);
}
} else if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) {
- CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end();
- for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) {
+ for (auto& key : newCounterDirectives->keys()) {
// We must create this node here, because the added node may be a node with no display such as
// as those created by the increment or reset directives and the re-layout that will happen will
// not catch the change if the node had no children.
- makeCounterNode(renderer, it->key, false);
+ makeCounterNode(renderer, key, false);
}
}
}
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -713,8 +713,7 @@
int numberOfAutoMargins = 0;
bool isHorizontal = isHorizontalFlow();
- for (size_t i = 0; i < children.size(); ++i) {
- RenderBox* child = children[i];
+ for (auto& child : children) {
if (child->isOutOfFlowPositioned())
continue;
if (isHorizontal) {
@@ -898,9 +897,9 @@
void RenderFlexibleBox::freezeViolations(const Vector<Violation>& violations, LayoutUnit& availableFreeSpace, double& totalFlexGrow, double& totalWeightedFlexShrink, InflexibleFlexItemSize& inflexibleItems, bool hasInfiniteLineLength)
{
- for (size_t i = 0; i < violations.size(); ++i) {
- RenderBox& child = violations[i].child;
- LayoutUnit childSize = violations[i].childSize;
+ for (auto& violation : violations) {
+ RenderBox& child = violation.child;
+ LayoutUnit childSize = violation.childSize;
LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(child, hasInfiniteLineLength);
availableFreeSpace -= childSize - preferredChildSize;
totalFlexGrow -= child.style().flexGrow();
@@ -917,35 +916,34 @@
LayoutUnit usedFreeSpace = 0;
Vector<Violation> minViolations;
Vector<Violation> maxViolations;
- for (size_t i = 0; i < children.size(); ++i) {
- RenderBox& child = *children[i];
- if (child.isOutOfFlowPositioned()) {
+ for (auto& child : children) {
+ if (child->isOutOfFlowPositioned()) {
childSizes.append(0);
continue;
}
- if (inflexibleItems.contains(&child))
- childSizes.append(inflexibleItems.get(&child));
+ if (inflexibleItems.contains(child))
+ childSizes.append(inflexibleItems.get(child));
else {
- LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(child, hasInfiniteLineLength);
+ LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(*child, hasInfiniteLineLength);
LayoutUnit childSize = preferredChildSize;
double extraSpace = 0;
if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && std::isfinite(totalFlexGrow))
- extraSpace = availableFreeSpace * child.style().flexGrow() / totalFlexGrow;
+ extraSpace = availableFreeSpace * child->style().flexGrow() / totalFlexGrow;
else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink))
- extraSpace = availableFreeSpace * child.style().flexShrink() * preferredChildSize / totalWeightedFlexShrink;
+ extraSpace = availableFreeSpace * child->style().flexShrink() * preferredChildSize / totalWeightedFlexShrink;
if (std::isfinite(extraSpace))
childSize += LayoutUnit::fromFloatRound(extraSpace);
- LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize);
+ LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(*child, childSize);
childSizes.append(adjustedChildSize);
usedFreeSpace += adjustedChildSize - preferredChildSize;
LayoutUnit violation = adjustedChildSize - childSize;
if (violation > 0)
- minViolations.append(Violation(child, adjustedChildSize));
+ minViolations.append(Violation(*child, adjustedChildSize));
else if (violation < 0)
- maxViolations.append(Violation(child, adjustedChildSize));
+ maxViolations.append(Violation(*child, adjustedChildSize));
totalViolation += violation;
}
}
@@ -1030,8 +1028,7 @@
size_t RenderFlexibleBox::numberOfInFlowPositionedChildren(const OrderedFlexItemList& children) const
{
size_t count = 0;
- for (size_t i = 0; i < children.size(); ++i) {
- RenderBox* child = children[i];
+ for (auto& child : children) {
if (!child->isOutOfFlowPositioned())
++count;
}
@@ -1155,17 +1152,16 @@
mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
size_t seenInFlowPositionedChildren = 0;
- for (size_t i = 0; i < children.size(); ++i) {
- RenderBox& child = *children[i];
- if (child.isOutOfFlowPositioned()) {
- child.layer()->setStaticBlockPosition(mainAxisOffset);
+ for (auto& child : children) {
+ if (child->isOutOfFlowPositioned()) {
+ child->layer()->setStaticBlockPosition(mainAxisOffset);
continue;
}
- mainAxisOffset -= mainAxisExtentForChild(child) + flowAwareMarginEndForChild(child);
+ mainAxisOffset -= mainAxisExtentForChild(*child) + flowAwareMarginEndForChild(*child);
- setFlowAwareLocationForChild(child, LayoutPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child)));
+ setFlowAwareLocationForChild(*child, LayoutPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(*child)));
- mainAxisOffset -= flowAwareMarginStartForChild(child);
+ mainAxisOffset -= flowAwareMarginStartForChild(*child);
++seenInFlowPositionedChildren;
if (seenInFlowPositionedChildren < numberOfChildrenForJustifyContent)
@@ -1209,18 +1205,18 @@
return;
LayoutUnit availableCrossAxisSpace = crossAxisContentExtent();
- for (size_t i = 0; i < lineContexts.size(); ++i)
- availableCrossAxisSpace -= lineContexts[i].crossAxisExtent;
+ for (auto& lineContext : lineContexts)
+ availableCrossAxisSpace -= lineContext.crossAxisExtent;
RenderBox* child = m_orderIterator.first();
LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, position, distribution, lineContexts.size());
- for (unsigned lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
- lineContexts[lineNumber].crossAxisOffset += lineOffset;
- for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next())
+ for (auto& lineContext : lineContexts) {
+ lineContext.crossAxisOffset += lineOffset;
+ for (size_t childNumber = 0; childNumber < lineContext.numberOfChildren; ++childNumber, child = m_orderIterator.next())
adjustAlignmentForChild(*child, lineOffset);
if (distribution == ContentDistributionStretch && availableCrossAxisSpace > 0)
- lineContexts[lineNumber].crossAxisExtent += availableCrossAxisSpace / static_cast<unsigned>(lineContexts.size());
+ lineContext.crossAxisExtent += availableCrossAxisSpace / static_cast<unsigned>(lineContexts.size());
lineOffset += alignContentSpaceBetweenChildren(availableCrossAxisSpace, distribution, lineContexts.size());
}
@@ -1247,12 +1243,12 @@
Vector<LayoutUnit> minMarginAfterBaselines;
RenderBox* child = m_orderIterator.first();
- for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
+ for (auto& lineContext : lineContexts) {
LayoutUnit minMarginAfterBaseline = LayoutUnit::max();
- LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisExtent;
- LayoutUnit maxAscent = lineContexts[lineNumber].maxAscent;
+ LayoutUnit lineCrossAxisExtent = lineContext.crossAxisExtent;
+ LayoutUnit maxAscent = lineContext.maxAscent;
- for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next()) {
+ for (size_t childNumber = 0; childNumber < lineContext.numberOfChildren; ++childNumber, child = m_orderIterator.next()) {
ASSERT(child);
if (child->isOutOfFlowPositioned()) {
if (style().flexWrap() == FlexWrapReverse)
@@ -1380,11 +1376,11 @@
{
LayoutUnit contentExtent = crossAxisContentExtent();
RenderBox* child = m_orderIterator.first();
- for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
- for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next()) {
+ for (auto& lineContext : lineContexts) {
+ for (size_t childNumber = 0; childNumber < lineContext.numberOfChildren; ++childNumber, child = m_orderIterator.next()) {
ASSERT(child);
- LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisExtent;
- LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
+ LayoutUnit lineCrossAxisExtent = lineContext.crossAxisExtent;
+ LayoutUnit originalOffset = lineContext.crossAxisOffset - crossAxisStartEdge;
LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxisExtent;
adjustAlignmentForChild(*child, newOffset - originalOffset);
}
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -299,8 +299,8 @@
RenderLayerList* lists[] = { layer()->negZOrderList(), layer()->normalFlowList(), layer()->posZOrderList() };
for (size_t listIndex = 0; listIndex < sizeof(lists) / sizeof(lists[0]); ++listIndex) {
if (RenderLayerList* list = lists[listIndex]) {
- for (size_t i = 0, listSize = list->size(); i < listSize; ++i)
- updateLayerToRegionMappings(*list->at(i), layerToRegionMap, regionToLayerListMap, needsLayerUpdate);
+ for (auto& layer : *list)
+ updateLayerToRegionMappings(*layer, layerToRegionMap, regionToLayerListMap, needsLayerUpdate);
}
}
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -1707,10 +1707,7 @@
return;
const Vector<StyleDashboardRegion>& styleRegions = style().dashboardRegions();
- unsigned i, count = styleRegions.size();
- for (i = 0; i < count; i++) {
- StyleDashboardRegion styleRegion = styleRegions[i];
-
+ for (auto& styleRegion : styleRegions) {
LayoutRect linesBoundingBox = this->linesBoundingBox();
LayoutUnit w = linesBoundingBox.width();
LayoutUnit h = linesBoundingBox.height();
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -729,10 +729,8 @@
}
if (posZOrderList) {
- size_t listSize = posZOrderList->size();
int stackingOrderIndex = 1;
- for (size_t i = 0; i < listSize; ++i) {
- RenderLayer* currentLayer = posZOrderList->at(i);
+ for (auto& currentLayer : *posZOrderList) {
if (!currentLayer->isStackingContext())
continue;
lookup.set(currentLayer, stackingOrderIndex++);
@@ -1186,9 +1184,8 @@
childOutOfFlowDescendantContainingBlocks.add(child->renderer().containingBlock());
if (outOfFlowDescendantContainingBlocks) {
- HashSet<const RenderObject*>::const_iterator it = childOutOfFlowDescendantContainingBlocks.begin();
- for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++it)
- outOfFlowDescendantContainingBlocks->add(*it);
+ for (auto& block : childOutOfFlowDescendantContainingBlocks)
+ outOfFlowDescendantContainingBlocks->add(block);
}
hasVisibleDescendant |= child->m_hasVisibleContent || child->m_hasVisibleDescendant;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -1898,9 +1898,7 @@
#endif
if (Vector<RenderLayer*>* normalFlowList = parent.normalFlowList()) {
- size_t listSize = normalFlowList->size();
- for (size_t i = 0; i < listSize; ++i) {
- RenderLayer* curLayer = normalFlowList->at(i);
+ for (auto& curLayer : *normalFlowList) {
if (!compositedWithOwnBackingStore(curLayer)
&& (curLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*curLayer)))
return true;
@@ -1913,9 +1911,7 @@
// Use the m_hasCompositingDescendant bit to optimize?
if (Vector<RenderLayer*>* negZOrderList = parent.negZOrderList()) {
- size_t listSize = negZOrderList->size();
- for (size_t i = 0; i < listSize; ++i) {
- RenderLayer* curLayer = negZOrderList->at(i);
+ for (auto& curLayer : *negZOrderList) {
if (!compositedWithOwnBackingStore(curLayer)
&& (curLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*curLayer)))
return true;
@@ -1923,9 +1919,7 @@
}
if (Vector<RenderLayer*>* posZOrderList = parent.posZOrderList()) {
- size_t listSize = posZOrderList->size();
- for (size_t i = 0; i < listSize; ++i) {
- RenderLayer* curLayer = posZOrderList->at(i);
+ for (auto& curLayer : *posZOrderList) {
if (!compositedWithOwnBackingStore(curLayer)
&& (curLayer->isVisuallyNonEmpty() || descendantLayerPaintsIntoAncestor(*curLayer)))
return true;
@@ -2502,9 +2496,7 @@
KeyframeValueList backdropFilterVector(AnimatedPropertyWebkitBackdropFilter);
#endif
- size_t numKeyframes = keyframes.size();
- for (size_t i = 0; i < numKeyframes; ++i) {
- const KeyframeValue& currentKeyframe = keyframes[i];
+ for (auto& currentKeyframe : keyframes.keyframes()) {
const RenderStyle* keyframeStyle = currentKeyframe.style();
double key = currentKeyframe.key();
Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderLineBoxList.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -267,11 +267,8 @@
}
if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline || info.phase == PaintPhaseChildOutlines) {
- ListHashSet<RenderInline*>::iterator end = info.outlineObjects->end();
- for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begin(); it != end; ++it) {
- RenderInline* flow = *it;
+ for (auto& flow : *info.outlineObjects)
flow->paintOutline(info, paintOffset);
- }
info.outlineObjects->clear();
}
}
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -107,12 +107,8 @@
void RenderListBox::updateFromElement()
{
if (m_optionsChanged) {
- const Vector<HTMLElement*>& listItems = selectElement().listItems();
- int size = numItems();
-
float width = 0;
- for (int i = 0; i < size; ++i) {
- HTMLElement* element = listItems[i];
+ for (auto& element : selectElement().listItems()) {
String text;
FontCascade itemFont = style().fontCascade();
if (is<HTMLOptionElement>(*element))
Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderMenuList.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -58,12 +58,9 @@
#if PLATFORM(IOS)
static size_t selectedOptionCount(const RenderMenuList& renderMenuList)
{
- const Vector<HTMLElement*>& listItems = renderMenuList.selectElement().listItems();
- size_t numberOfItems = listItems.size();
-
size_t count = 0;
- for (size_t i = 0; i < numberOfItems; ++i) {
- if (is<HTMLOptionElement>(*listItems[i]) && downcast<HTMLOptionElement>(*listItems[i]).selected())
+ for (auto& element : renderMenuList.selectElement().listItems()) {
+ if (is<HTMLOptionElement>(*element) && downcast<HTMLOptionElement>(*element).selected())
++count;
}
return count;
@@ -206,11 +203,7 @@
void RenderMenuList::updateOptionsWidth()
{
float maxOptionWidth = 0;
- const Vector<HTMLElement*>& listItems = selectElement().listItems();
- int size = listItems.size();
-
- for (int i = 0; i < size; ++i) {
- HTMLElement* element = listItems[i];
+ for (auto& element : selectElement().listItems()) {
if (!is<HTMLOptionElement>(*element))
continue;
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (185511 => 185512)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2015-06-12 17:04:48 UTC (rev 185511)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2015-06-12 17:10:07 UTC (rev 185512)
@@ -198,8 +198,8 @@
{
#ifndef NDEBUG
// There should be no implicit breaks assumed at this point.
- for (unsigned i = 0; i < forcedBreaksCount(); i++)
- ASSERT(!m_contentRuns[i].assumedImplicitBreaks());
+ for (auto& forcedBreak : m_contentRuns)
+ ASSERT(!forcedBreak.assumedImplicitBreaks());
#endif // NDEBUG
// Insert a final content run to encompass all content. This will include overflow if this is