WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-145831-20150615183822.patch (text/plain), 84.12 KB, created by
Hunseop Jeong
on 2015-06-15 02:38:57 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Hunseop Jeong
Created:
2015-06-15 02:38:57 PDT
Size:
84.12 KB
patch
obsolete
>Subversion Revision: 185547 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index adecc9b13714dae82b506a7a30c1005d6f2e59a0..e6c681c4663d8556fd44f86093c0e98885566b9e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,99 @@ >+2015-06-15 Hunseop Jeong <hs85.jeong@samsung.com> >+ >+ 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-13 Chris Dumez <cdumez@apple.com> > > [WK2] API::Navigation objects are leaked on history navigation to HistoryItems in PageCache >diff --git a/Source/WebCore/rendering/AutoTableLayout.cpp b/Source/WebCore/rendering/AutoTableLayout.cpp >index 1aeaded5a933385db739b5c06f3d25727baf6fcd..cd418ebc5461afbc7147b4a8d542900fef1ce487 100644 >--- a/Source/WebCore/rendering/AutoTableLayout.cpp >+++ b/Source/WebCore/rendering/AutoTableLayout.cpp >@@ -226,17 +226,17 @@ void AutoTableLayout::computeIntrinsicLogicalWidths(LayoutUnit& minWidth, Layout > 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 AutoTableLayout::calcEffectiveLogicalWidth() > { > 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 @@ int AutoTableLayout::calcEffectiveLogicalWidth() > 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: >diff --git a/Source/WebCore/rendering/FilterEffectRenderer.cpp b/Source/WebCore/rendering/FilterEffectRenderer.cpp >index 62dac4b8b4622387b8dcce78fea2092d21440e5c..2182e6f6688c473c121585b84156332e220268af 100644 >--- a/Source/WebCore/rendering/FilterEffectRenderer.cpp >+++ b/Source/WebCore/rendering/FilterEffectRenderer.cpp >@@ -135,18 +135,17 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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 @@ bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations > 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::allocateBackingStoreIfNeeded() > 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() >diff --git a/Source/WebCore/rendering/FilterEffectRenderer.h b/Source/WebCore/rendering/FilterEffectRenderer.h >index 5ff898b4065649d0c8647567ad5df22c20af9241..d71553ae37660543ddb7c78ab4df68ef0da0efc6 100644 >--- a/Source/WebCore/rendering/FilterEffectRenderer.h >+++ b/Source/WebCore/rendering/FilterEffectRenderer.h >@@ -120,10 +120,8 @@ public: > 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 >diff --git a/Source/WebCore/rendering/FloatingObjects.cpp b/Source/WebCore/rendering/FloatingObjects.cpp >index dbc51c7ed7424e6518e916ed68cdc7a38f47eb90..0c06449b5e15fd4287e8d7d552a14b1deb2a7024 100644 >--- a/Source/WebCore/rendering/FloatingObjects.cpp >+++ b/Source/WebCore/rendering/FloatingObjects.cpp >@@ -266,9 +266,9 @@ FloatingObjects::~FloatingObjects() > 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::clear() > > 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 @@ void FloatingObjects::computePlacedFloatsTree() > 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())); > } > } > >diff --git a/Source/WebCore/rendering/FlowThreadController.cpp b/Source/WebCore/rendering/FlowThreadController.cpp >index 8cf14acfa20c844c11fe791ab8355f4ac848ad98..eb6b46cbd452716b46ec80cbe01029596591fdc7 100644 >--- a/Source/WebCore/rendering/FlowThreadController.cpp >+++ b/Source/WebCore/rendering/FlowThreadController.cpp >@@ -274,8 +274,7 @@ void FlowThreadController::collectFixedPositionedLayers(Vector<RenderLayer*>& fi > > 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 @@ void FlowThreadController::collectFixedPositionedLayers(Vector<RenderLayer*>& fi > } > > 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); >diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp >index 14449b677dd7b72c0d107e4e2a4eefb6ef957c3b..892d163c33f38958bee13f30fc673ef7ffe1b238 100644 >--- a/Source/WebCore/rendering/HitTestResult.cpp >+++ b/Source/WebCore/rendering/HitTestResult.cpp >@@ -702,8 +702,8 @@ void HitTestResult::append(const HitTestResult& other) > > 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); > } > } > >diff --git a/Source/WebCore/rendering/ImageQualityController.cpp b/Source/WebCore/rendering/ImageQualityController.cpp >index c4a6e43c6722f410f7bf90d108b8c560c320009c..10dcf11ad9e9204cbe554d6c496941d75ed0fb15 100644 >--- a/Source/WebCore/rendering/ImageQualityController.cpp >+++ b/Source/WebCore/rendering/ImageQualityController.cpp >@@ -88,8 +88,8 @@ void ImageQualityController::highQualityRepaintTimerFired() > 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; > } >diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp >index f40b750e13ad2897aba0731abfd396261604b593..beeecc66697f548d4e6a7fcba06523d78dee624b 100644 >--- a/Source/WebCore/rendering/InlineTextBox.cpp >+++ b/Source/WebCore/rendering/InlineTextBox.cpp >@@ -630,12 +630,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, > 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 >diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp >index 766d1a886a3af88ff8fe761c975c8c30816acde5..e9db7495fd61d8565f33a3338613dfa8466d4977 100644 >--- a/Source/WebCore/rendering/RenderBlock.cpp >+++ b/Source/WebCore/rendering/RenderBlock.cpp >@@ -193,10 +193,9 @@ RenderBlock::RenderBlock(Document& document, Ref<RenderStyle>&& style, unsigned > > 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 @@ void RenderBlock::addOverflowFromPositionedObjects() > 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 @@ void RenderBlock::dirtyForLayoutFromPercentageHeightDescendants() > 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 @@ void RenderBlock::simplifiedNormalFlowLayout() > > // 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 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPosit > 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 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPosit > // 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 @@ void RenderBlock::markPositionedObjectsForLayout() > 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 @@ void RenderBlock::paintContinuationOutlines(PaintInfo& info, const LayoutPoint& > > 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 @@ static void clipOutPositionedObjects(const PaintInfo* paintInfo, const LayoutPoi > 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 @@ void RenderBlock::removeFromTrackedRendererMaps(RenderBox& descendant, TrackedDe > 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 @@ void RenderBlock::removePositionedObjects(RenderBlock* o, ContainingBlockState c > > 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 @@ void RenderBlock::checkPositionedObjectsNeedLayout() > 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 >diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp >index af4ca71385ebbe686b66ee3745e7dcdc59dd809b..deac64f9584cce99479f60e5a0c0c1e69fb9e67b 100644 >--- a/Source/WebCore/rendering/RenderBlockFlow.cpp >+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp >@@ -203,10 +203,7 @@ void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats() > > 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 @@ void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats() > 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 @@ void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats() > 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 @@ void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats() > } > } > >- 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 @@ void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats() > 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 @@ void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* ol > 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 @@ void RenderBlockFlow::moveFloatsTo(RenderBlockFlow* toBlockFlow) > 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 @@ void RenderBlockFlow::addOverflowFromFloats() > 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 @@ void RenderBlockFlow::repaintOverhangingFloats(bool paintAllDescendants) > // 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 @@ void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint > 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::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint > 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 @@ LayoutUnit RenderBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT > 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 @@ LayoutUnit RenderBlockFlow::lowestInitialLetterLogicalBottom() const > 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 @@ LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow& child, bool ma > > // 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 @@ LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow& child, bool ma > > // 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 @@ void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, RenderBlockFlow* > > 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 @@ void RenderBlockFlow::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove) > 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 @@ void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU > } > > 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); > } >diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp >index 5ec0470bacc8af8d564ae6dd677f2c26355f8e6f..c252e694321d3d5c4200c46916aed7ad54c0c678 100644 >--- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp >+++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp >@@ -512,9 +512,8 @@ static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru > } 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 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, I > } > } > >- 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 @@ void RenderBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState) > 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::linkToEndLineIfNeeded(LineLayoutState& layoutState) > > 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 @@ void RenderBlockFlow::layoutLineBoxes(bool relayoutChildren, LayoutUnit& repaint > } > } > >- 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 @@ void RenderBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi > 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* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutSt > 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 @@ bool RenderBlockFlow::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutS > > 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; > } > >diff --git a/Source/WebCore/rendering/RenderCounter.cpp b/Source/WebCore/rendering/RenderCounter.cpp >index 918a4f88a23d96d8ae5e236695671780a093627e..1412258e7c9ea5be7a270aac4e19212165cc9fcc 100644 >--- a/Source/WebCore/rendering/RenderCounter.cpp >+++ b/Source/WebCore/rendering/RenderCounter.cpp >@@ -455,11 +455,8 @@ void RenderCounter::destroyCounterNodes(RenderElement& owner) > 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 @@ static void updateCounters(RenderElement& renderer) > 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 @@ static void updateCounters(RenderElement& renderer) > 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 @@ void RenderCounter::rendererStyleChanged(RenderElement& renderer, const RenderSt > 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); > } > } > } >diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp >index 0d5a036a57e8c48e815fe5b89da275185d0f5fef..55160528faec36aa55674226a51da5a058b5758d 100644 >--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp >+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp >@@ -713,8 +713,7 @@ LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi > > 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 @@ bool RenderFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren > > 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 @@ bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF > 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 @@ ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox& child) const > 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 @@ void RenderFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children, > 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 @@ void RenderFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) > 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 @@ void RenderFlexibleBox::alignChildren(const Vector<LineContext>& lineContexts) > 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 @@ void RenderFlexibleBox::flipForWrapReverse(const Vector<LineContext>& lineContex > { > 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); > } >diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp >index c2a3d7898db69eb56a4f5fbcf25d851f190a77d7..decc487c3b19309be5d33a722ff3c16cb32a9ca0 100644 >--- a/Source/WebCore/rendering/RenderFlowThread.cpp >+++ b/Source/WebCore/rendering/RenderFlowThread.cpp >@@ -299,8 +299,8 @@ bool RenderFlowThread::updateAllLayerToRegionMappings() > 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); > } > } > >diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp >index 66f2dc618eba3e3a93f48e3a7a98679dffc882c2..db0a690bdb766ac54758a45a4a5e6e6ec731f1ac 100644 >--- a/Source/WebCore/rendering/RenderInline.cpp >+++ b/Source/WebCore/rendering/RenderInline.cpp >@@ -1707,10 +1707,7 @@ void RenderInline::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) > 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(); >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index 38f3b41d4f4e03bc03c4f0260268a1b2bcec53c0..51754158ae3fa9a20e28a704fd1e37ef4d074e2c 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -729,10 +729,8 @@ void RenderLayer::updateDescendantsAreContiguousInStackingOrder() > } > > 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 @@ void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* o > 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; >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index 377a083c04403cf39ea9fb5d211e4d8b5f49efa1..abb2cbbf514d940e0b117133ff4b5e69c20515b1 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -1898,9 +1898,7 @@ static bool descendantLayerPaintsIntoAncestor(RenderLayer& parent) > #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 @@ static bool descendantLayerPaintsIntoAncestor(RenderLayer& parent) > > // 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 @@ static bool descendantLayerPaintsIntoAncestor(RenderLayer& parent) > } > > 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 @@ bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim > 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(); > >diff --git a/Source/WebCore/rendering/RenderLineBoxList.cpp b/Source/WebCore/rendering/RenderLineBoxList.cpp >index e1cfca564db9b34b591c742255d36f99d7dad125..c07992123a839624521f0da189e8679317f37ebe 100644 >--- a/Source/WebCore/rendering/RenderLineBoxList.cpp >+++ b/Source/WebCore/rendering/RenderLineBoxList.cpp >@@ -267,11 +267,8 @@ void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn > } > > 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(); > } > } >diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp >index 916c2de7eb57cf5a71cff8544488db35c1193763..4b0cfa63effb29c16759d7d133f35bae3677cfda 100644 >--- a/Source/WebCore/rendering/RenderListBox.cpp >+++ b/Source/WebCore/rendering/RenderListBox.cpp >@@ -107,12 +107,8 @@ HTMLSelectElement& RenderListBox::selectElement() const > 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)) >diff --git a/Source/WebCore/rendering/RenderMenuList.cpp b/Source/WebCore/rendering/RenderMenuList.cpp >index ff9a2c586bbd9be99c7755e222e0038646c174d6..a29989ece4fe2991d590a4f14980b4591180852d 100644 >--- a/Source/WebCore/rendering/RenderMenuList.cpp >+++ b/Source/WebCore/rendering/RenderMenuList.cpp >@@ -58,12 +58,9 @@ using namespace HTMLNames; > #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::styleDidChange(StyleDifference diff, const RenderStyle* old > 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; > >diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.cpp b/Source/WebCore/rendering/RenderMultiColumnSet.cpp >index 821e4b98fa23f2c23fceabb044e359e56733671e..91d299addc3f9b73ec6fe71329c9a089e76a05e6 100644 >--- a/Source/WebCore/rendering/RenderMultiColumnSet.cpp >+++ b/Source/WebCore/rendering/RenderMultiColumnSet.cpp >@@ -198,8 +198,8 @@ void RenderMultiColumnSet::distributeImplicitBreaks() > { > #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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 145831
:
254626
|
254627
|
254628
|
254784
| 254866