Commit 42276a7f authored by abucur@adobe.com's avatar abucur@adobe.com

[CSS Regions] Convert regions iterator loops to range-based loops

https://bugs.webkit.org/show_bug.cgi?id=127464

Reviewed by Antti Koivisto.

Replace most of the iterator loops in the region implementation with
range based for loops. The for loops that iterate only over subsets
of collections have not been changed.

Tests: no new tests, this is a refactoring patch.

* dom/WebKitNamedFlow.cpp:
(WebCore::WebKitNamedFlow::firstEmptyRegionIndex):
(WebCore::WebKitNamedFlow::getRegionsByContent):
(WebCore::WebKitNamedFlow::getRegions):
(WebCore::WebKitNamedFlow::getContent):
* inspector/InspectorOverlay.cpp:
(WebCore::buildObjectForCSSRegionsHighlight):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::validateRegions):
(WebCore::RenderFlowThread::updateLogicalWidth):
(WebCore::RenderFlowThread::computeLogicalHeight):
(WebCore::RenderFlowThread::repaintRectangleInRegions):
(WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
(WebCore::RenderFlowThread::logicalWidthChangedInRegionsForBlock):
(WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
(WebCore::RenderFlowThread::isAutoLogicalHeightRegionsCountConsistent):
(WebCore::RenderFlowThread::markAutoLogicalHeightRegionsForLayout):
(WebCore::RenderFlowThread::markRegionsForOverflowLayoutIfNeeded):
(WebCore::RenderFlowThread::updateRegionsFlowThreadPortionRect):
(WebCore::RenderFlowThread::collectLayerFragments):
(WebCore::RenderFlowThread::fragmentsBoundingBox):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::setRegionObjectsRegionStyle):
(WebCore::RenderNamedFlowFragment::restoreRegionObjectsOriginalStyle):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::clearContentElements):
(WebCore::RenderNamedFlowThread::nextRendererForNode):
(WebCore::RenderNamedFlowThread::dependsOn):
(WebCore::RenderNamedFlowThread::computeOversetStateForRegions):
(WebCore::RenderNamedFlowThread::checkInvalidRegions):
(WebCore::RenderNamedFlowThread::pushDependencies):
(WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
(WebCore::isContainedInElements):
(WebCore::RenderNamedFlowThread::getRanges):
(WebCore::RenderNamedFlowThread::checkRegionsWithStyling):
(WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeRenderRegionList):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e6c09a97
2014-01-23 Andrei Bucur <abucur@adobe.com>
[CSS Regions] Convert regions iterator loops to range-based loops
https://bugs.webkit.org/show_bug.cgi?id=127464
Reviewed by Antti Koivisto.
Replace most of the iterator loops in the region implementation with
range based for loops. The for loops that iterate only over subsets
of collections have not been changed.
Tests: no new tests, this is a refactoring patch.
* dom/WebKitNamedFlow.cpp:
(WebCore::WebKitNamedFlow::firstEmptyRegionIndex):
(WebCore::WebKitNamedFlow::getRegionsByContent):
(WebCore::WebKitNamedFlow::getRegions):
(WebCore::WebKitNamedFlow::getContent):
* inspector/InspectorOverlay.cpp:
(WebCore::buildObjectForCSSRegionsHighlight):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::validateRegions):
(WebCore::RenderFlowThread::updateLogicalWidth):
(WebCore::RenderFlowThread::computeLogicalHeight):
(WebCore::RenderFlowThread::repaintRectangleInRegions):
(WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
(WebCore::RenderFlowThread::logicalWidthChangedInRegionsForBlock):
(WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
(WebCore::RenderFlowThread::isAutoLogicalHeightRegionsCountConsistent):
(WebCore::RenderFlowThread::markAutoLogicalHeightRegionsForLayout):
(WebCore::RenderFlowThread::markRegionsForOverflowLayoutIfNeeded):
(WebCore::RenderFlowThread::updateRegionsFlowThreadPortionRect):
(WebCore::RenderFlowThread::collectLayerFragments):
(WebCore::RenderFlowThread::fragmentsBoundingBox):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::setRegionObjectsRegionStyle):
(WebCore::RenderNamedFlowFragment::restoreRegionObjectsOriginalStyle):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::clearContentElements):
(WebCore::RenderNamedFlowThread::nextRendererForNode):
(WebCore::RenderNamedFlowThread::dependsOn):
(WebCore::RenderNamedFlowThread::computeOversetStateForRegions):
(WebCore::RenderNamedFlowThread::checkInvalidRegions):
(WebCore::RenderNamedFlowThread::pushDependencies):
(WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
(WebCore::isContainedInElements):
(WebCore::RenderNamedFlowThread::getRanges):
(WebCore::RenderNamedFlowThread::checkRegionsWithStyling):
(WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeRenderRegionList):
2014-01-23 László Langó <llango.u-szeged@partner.samsung.com>
Range should be constructable.
......@@ -99,16 +99,15 @@ int WebKitNamedFlow::firstEmptyRegionIndex() const
return -1;
int countNonPseudoRegions = -1;
auto iter = regionList.begin();
for (int index = 0; iter != regionList.end(); ++index, ++iter) {
for (const auto& renderRegion : regionList) {
const RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(renderRegion);
// FIXME: Pseudo-elements are not included in the list.
// They will be included when we will properly support the Region interface
// http://dev.w3.org/csswg/css-regions/#the-region-interface
const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(*iter);
if (renderRegion->isPseudoElementRegion())
if (namedFlowFragment->isPseudoElementRegion())
continue;
countNonPseudoRegions++;
if (renderRegion->regionOversetState() == RegionEmpty)
if (namedFlowFragment->regionOversetState() == RegionEmpty)
return countNonPseudoRegions;
}
return -1;
......@@ -131,16 +130,16 @@ PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode)
if (inFlowThread(contentNode->renderer(), m_parentFlowThread)) {
const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
for (auto iter = regionList.begin(), end = regionList.end(); iter != end; ++iter) {
for (const auto& renderRegion : regionList) {
const RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(renderRegion);
// FIXME: Pseudo-elements are not included in the list.
// They will be included when we will properly support the Region interface
// http://dev.w3.org/csswg/css-regions/#the-region-interface
const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(*iter);
if (renderRegion->isPseudoElementRegion())
if (namedFlowFragment->isPseudoElementRegion())
continue;
if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion)) {
ASSERT(renderRegion->generatingElement());
regionElements.append(*renderRegion->generatingElement());
if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), namedFlowFragment)) {
ASSERT(namedFlowFragment->generatingElement());
regionElements.append(*namedFlowFragment->generatingElement());
}
}
}
......@@ -161,15 +160,15 @@ PassRefPtr<NodeList> WebKitNamedFlow::getRegions()
Vector<Ref<Element>> regionElements;
const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
for (auto iter = regionList.begin(), end = regionList.end(); iter != end; ++iter) {
for (const auto& renderRegion : regionList) {
const RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(renderRegion);
// FIXME: Pseudo-elements are not included in the list.
// They will be included when we will properly support the Region interface
// http://dev.w3.org/csswg/css-regions/#the-region-interface
const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(*iter);
if (renderRegion->isPseudoElementRegion())
if (namedFlowFragment->isPseudoElementRegion())
continue;
ASSERT(renderRegion->generatingElement());
regionElements.append(*renderRegion->generatingElement());
ASSERT(namedFlowFragment->generatingElement());
regionElements.append(*namedFlowFragment->generatingElement());
}
return StaticElementList::adopt(regionElements);
......@@ -188,8 +187,7 @@ PassRefPtr<NodeList> WebKitNamedFlow::getContent()
Vector<Ref<Element>> contentElements;
const NamedFlowContentElements& contentElementsList = m_parentFlowThread->contentElements();
for (auto it = contentElementsList.begin(), end = contentElementsList.end(); it != end; ++it) {
Element* element = *it;
for (auto& element : contentElementsList) {
ASSERT(element->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName());
contentElements.append(*element);
}
......
......@@ -434,8 +434,7 @@ static PassRefPtr<InspectorArray> buildObjectForCSSRegionsHighlight(RenderRegion
RefPtr<InspectorArray> array = InspectorArray::create();
const RenderRegionList& regionList = flowThread->renderRegionList();
for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
RenderRegion* iterRegion = *iter;
for (auto& iterRegion : regionList) {
if (!iterRegion->isValid())
continue;
RefPtr<InspectorObject> regionHighlightObject = buildObjectForRegionHighlight(mainFrameView, iterRegion);
......
......@@ -161,8 +161,7 @@ void RenderFlowThread::validateRegions()
LayoutUnit previousRegionLogicalHeight = 0;
bool firstRegionVisited = false;
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
ASSERT(!region->needsLayout() || region->isRenderRegionSet());
region->deleteAllRenderBoxRegionInfo();
......@@ -365,16 +364,14 @@ bool RenderFlowThread::collectsGraphicsLayersUnderRegions() const
void RenderFlowThread::updateLogicalWidth()
{
LayoutUnit logicalWidth = initialLogicalWidth();
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
ASSERT(!region->needsLayout() || region->isRenderRegionSet());
logicalWidth = std::max(region->pageLogicalWidth(), logicalWidth);
}
setLogicalWidth(logicalWidth);
// If the regions have non-uniform logical widths, then insert inset information for the RenderFlowThread.
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
LayoutUnit regionLogicalWidth = region->pageLogicalWidth();
LayoutUnit logicalLeft = style().direction() == LTR ? LayoutUnit() : logicalWidth - regionLogicalWidth;
region->setRenderBoxRegionInfo(this, logicalLeft, regionLogicalWidth, false);
......@@ -387,8 +384,7 @@ void RenderFlowThread::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, L
computedValues.m_extent = 0;
const LayoutUnit maxFlowSize = RenderFlowThread::maxLogicalHeight();
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
ASSERT(!region->needsLayout() || region->isRenderRegionSet());
LayoutUnit distanceToMaxSize = maxFlowSize - computedValues.m_extent;
......@@ -434,11 +430,8 @@ void RenderFlowThread::repaintRectangleInRegions(const LayoutRect& repaintRect,
// Let each region figure out the proper enclosing flow thread.
CurrentRenderFlowThreadDisabler disabler(&view());
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList)
region->repaintFlowThreadContent(repaintRect, immediate);
}
}
RenderRegion* RenderFlowThread::regionAtBlockOffset(const RenderBox* clampBox, LayoutUnit offset, bool extendLastRegion, RegionAutoGenerationPolicy autoGenerationPolicy)
......@@ -629,8 +622,7 @@ void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box)
RenderRegion* endRegion;
getRegionRangeForBox(box, startRegion, endRegion);
for (auto iter = m_regionList.find(startRegion), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
region->removeRenderBoxRegionInfo(box);
if (region == endRegion)
break;
......@@ -638,10 +630,8 @@ void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box)
#ifndef NDEBUG
// We have to make sure we did not leave any RenderBoxRegionInfo attached.
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList)
ASSERT(!region->renderBoxRegionInfo(box));
}
#endif
m_regionRangeMap.remove(box);
......@@ -676,8 +666,7 @@ void RenderFlowThread::logicalWidthChangedInRegionsForBlock(const RenderBlock* b
return;
}
for (auto iter = m_regionList.find(startRegion), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
ASSERT(!region->needsLayout() || region->isRenderRegionSet());
// We have no information computed for this region so we need to do it.
......@@ -745,9 +734,7 @@ void RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle(const RenderBox* b
bool insideOldRegionRange = false;
bool insideNewRegionRange = false;
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
if (oldStartRegion == region)
insideOldRegionRange = true;
if (newStartRegion == region)
......@@ -896,8 +883,7 @@ bool RenderFlowThread::objectInFlowRegion(const RenderObject* object, const Rend
bool RenderFlowThread::isAutoLogicalHeightRegionsCountConsistent() const
{
unsigned autoLogicalHeightRegions = 0;
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
const RenderRegion* region = *iter;
for (const auto& region : m_regionList) {
if (region->hasAutoLogicalHeight())
autoLogicalHeightRegions++;
}
......@@ -929,8 +915,7 @@ void RenderFlowThread::markAutoLogicalHeightRegionsForLayout()
{
ASSERT(hasAutoLogicalHeightRegions());
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
if (!region->hasAutoLogicalHeight())
continue;
......@@ -945,10 +930,8 @@ void RenderFlowThread::markRegionsForOverflowLayoutIfNeeded()
if (!hasRegions())
return;
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList)
region->setNeedsSimplifiedNormalFlowLayout();
}
}
void RenderFlowThread::updateRegionsFlowThreadPortionRect(const RenderRegion* lastRegionWithContent)
......@@ -959,9 +942,7 @@ void RenderFlowThread::updateRegionsFlowThreadPortionRect(const RenderRegion* la
// FIXME: Optimize not to clear the interval all the time. This implies manually managing the tree nodes lifecycle.
m_regionIntervalTree.clear();
m_regionIntervalTree.initIfNeeded();
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
// If we find an empty auto-height region, clear the computedAutoHeight value.
if (emptyRegionsSegment && region->hasAutoLogicalHeight())
toRenderNamedFlowFragment(region)->clearComputedAutoHeight();
......@@ -1081,10 +1062,8 @@ void RenderFlowThread::collectLayerFragments(LayerFragments& layerFragments, con
{
ASSERT(!m_regionsInvalidated);
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList)
region->collectLayerFragments(layerFragments, layerBoundingBox, dirtyRect);
}
}
LayoutRect RenderFlowThread::fragmentsBoundingBox(const LayoutRect& layerBoundingBox)
......@@ -1092,12 +1071,10 @@ LayoutRect RenderFlowThread::fragmentsBoundingBox(const LayoutRect& layerBoundin
ASSERT(!m_regionsInvalidated);
LayoutRect result;
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
LayerFragments fragments;
region->collectLayerFragments(fragments, layerBoundingBox, LayoutRect::infiniteRect());
for (size_t i = 0; i < fragments.size(); ++i) {
const LayerFragment& fragment = fragments.at(i);
for (const auto& fragment : fragments) {
LayoutRect fragmentRect(layerBoundingBox);
fragmentRect.intersect(fragment.paginationClip);
fragmentRect.moveBy(fragment.paginationOffset);
......
......@@ -308,8 +308,7 @@ void RenderNamedFlowFragment::setRegionObjectsRegionStyle()
const RenderNamedFlowThread& namedFlow = view().flowThreadController().ensureRenderFlowThreadWithName(style().regionThread());
const NamedFlowContentElements& contentElements = namedFlow.contentElements();
for (auto iter = contentElements.begin(), end = contentElements.end(); iter != end; ++iter) {
const Element* element = *iter;
for (const auto& element : contentElements) {
// The list of content nodes contains also the nodes with display:none.
if (!element->renderer())
continue;
......@@ -343,14 +342,14 @@ void RenderNamedFlowFragment::restoreRegionObjectsOriginalStyle()
return;
RenderObjectRegionStyleMap temp;
for (auto iter = m_renderObjectRegionStyle.begin(), end = m_renderObjectRegionStyle.end(); iter != end; ++iter) {
RenderObject* object = const_cast<RenderObject*>(iter->key);
for (auto& objectPair : m_renderObjectRegionStyle) {
RenderObject* object = const_cast<RenderObject*>(objectPair.key);
RefPtr<RenderStyle> objectRegionStyle = &object->style();
RefPtr<RenderStyle> objectOriginalStyle = iter->value.style;
RefPtr<RenderStyle> objectOriginalStyle = objectPair.value.style;
if (object->isRenderElement())
toRenderElement(object)->setStyleInternal(*objectOriginalStyle);
bool shouldCacheRegionStyle = iter->value.cached;
bool shouldCacheRegionStyle = objectPair.value.cached;
if (!shouldCacheRegionStyle) {
// Check whether we should cache the computed style in region.
unsigned changedContextSensitiveProperties = ContextSensitivePropertyNone;
......
......@@ -73,9 +73,7 @@ const char* RenderNamedFlowThread::renderName() const
void RenderNamedFlowThread::clearContentElements()
{
for (auto it = m_contentElements.begin(), end = m_contentElements.end(); it != end; ++it) {
Element* contentElement = *it;
for (auto& contentElement : m_contentElements) {
ASSERT(contentElement);
ASSERT(contentElement->inNamedFlow());
ASSERT(&contentElement->document() == &document());
......@@ -102,8 +100,8 @@ void RenderNamedFlowThread::updateWritingMode()
RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const
{
for (auto it = m_flowThreadChildList->begin(), end = m_flowThreadChildList->end(); it != end; ++it) {
RenderObject* child = *it;
const FlowThreadChildList& childList = *(m_flowThreadChildList.get());
for (auto& child : childList) {
ASSERT(child->node());
unsigned short position = node->compareDocumentPosition(child->node());
if (position & Node::DOCUMENT_POSITION_FOLLOWING)
......@@ -165,8 +163,8 @@ bool RenderNamedFlowThread::dependsOn(RenderNamedFlowThread* otherRenderFlowThre
return true;
// Recursively traverse the m_layoutBeforeThreadsSet.
for (auto iterator = m_layoutBeforeThreadsSet.begin(), end = m_layoutBeforeThreadsSet.end(); iterator != end; ++iterator) {
const RenderNamedFlowThread* beforeFlowThread = (*iterator).key;
for (const auto& beforeFlowThreadPair : m_layoutBeforeThreadsSet) {
const auto& beforeFlowThread = beforeFlowThreadPair.key;
if (beforeFlowThread->dependsOn(otherRenderFlowThread))
return true;
}
......@@ -326,8 +324,7 @@ void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAf
height = isHorizontalWritingMode() ? visualOverflowRect().maxY() : visualOverflowRect().maxX();
RenderRegion* lastReg = lastRegion();
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_regionList) {
LayoutUnit flowMin = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().y() : region->flowThreadPortionRect().x());
LayoutUnit flowMax = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().maxY() : region->flowThreadPortionRect().maxX());
RegionOversetState previousState = region->regionOversetState();
......@@ -363,8 +360,7 @@ void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAf
void RenderNamedFlowThread::checkInvalidRegions()
{
Vector<RenderRegion*> newValidRegions;
for (auto iter = m_invalidRegionList.begin(), end = m_invalidRegionList.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : m_invalidRegionList) {
// The only reason a region would be invalid is because it has a parent flow thread.
ASSERT(!region->isValid() && region->parentNamedFlowThread());
if (region->parentNamedFlowThread()->dependsOn(this))
......@@ -373,8 +369,7 @@ void RenderNamedFlowThread::checkInvalidRegions()
newValidRegions.append(region);
}
for (auto iter = newValidRegions.begin(), end = newValidRegions.end(); iter != end; ++iter) {
RenderRegion* region = *iter;
for (auto& region : newValidRegions) {
m_invalidRegionList.remove(region);
region->parentNamedFlowThread()->m_observerThreadsSet.remove(this);
addRegionToNamedFlowThread(region);
......@@ -392,10 +387,8 @@ void RenderNamedFlowThread::checkInvalidRegions()
Vector<RenderNamedFlowThread*> observers;
copyToVector(m_observerThreadsSet, observers);
for (size_t i = 0; i < observers.size(); ++i) {
RenderNamedFlowThread* flowThread = observers.at(i);
for (auto& flowThread : observers)
flowThread->checkInvalidRegions();
}
}
void RenderNamedFlowThread::addDependencyOnFlowThread(RenderNamedFlowThread* otherFlowThread)
......@@ -418,8 +411,8 @@ void RenderNamedFlowThread::removeDependencyOnFlowThread(RenderNamedFlowThread*
void RenderNamedFlowThread::pushDependencies(RenderNamedFlowThreadList& list)
{
for (auto iter = m_layoutBeforeThreadsSet.begin(), end = m_layoutBeforeThreadsSet.end(); iter != end; ++iter) {
RenderNamedFlowThread* flowThread = (*iter).key;
for (auto& flowThreadPair : m_layoutBeforeThreadsSet) {
auto& flowThread = flowThreadPair.key;
if (list.contains(flowThread))
continue;
flowThread->pushDependencies(list);
......@@ -439,8 +432,7 @@ void RenderNamedFlowThread::registerNamedFlowContentElement(Element& contentElem
resetMarkForDestruction();
// Find the first content node following the new content node.
for (auto it = m_contentElements.begin(), end = m_contentElements.end(); it != end; ++it) {
Element* element = *it;
for (auto& element : m_contentElements) {
unsigned short position = contentElement.compareDocumentPosition(element);
if (position & Node::DOCUMENT_POSITION_FOLLOWING) {
m_contentElements.insertBefore(element, &contentElement);
......@@ -550,8 +542,7 @@ bool RenderNamedFlowThread::isMarkedForDestruction() const
static bool isContainedInElements(const Vector<Element*>& others, Element* element)
{
for (size_t i = 0; i < others.size(); i++) {
Element* other = others.at(i);
for (auto& other : others) {
if (other->contains(element))
return true;
}
......@@ -599,14 +590,12 @@ void RenderNamedFlowThread::getRanges(Vector<RefPtr<Range>>& rangeObjects, const
Vector<Element*> elements;
// eliminate the contentElements that are descendants of other contentElements
for (auto it = contentElements().begin(), end = contentElements().end(); it != end; ++it) {
Element* element = *it;
for (auto& element : contentElements()) {
if (!isContainedInElements(elements, element))
elements.append(element);
}
for (size_t i = 0; i < elements.size(); i++) {
Element* contentElement = elements.at(i);
for (auto& contentElement : elements) {
if (!contentElement->renderer())
continue;
......@@ -744,9 +733,9 @@ bool RenderNamedFlowThread::collectsGraphicsLayersUnderRegions() const
void RenderNamedFlowThread::checkRegionsWithStyling()
{
bool hasRegionsWithStyling = false;
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderNamedFlowFragment* region = toRenderNamedFlowFragment(*iter);
if (region->hasCustomRegionStyle()) {
for (const auto& region : m_regionList) {
const RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(region);
if (namedFlowFragment->hasCustomRegionStyle()) {
hasRegionsWithStyling = true;
break;
}
......@@ -758,9 +747,9 @@ void RenderNamedFlowThread::clearRenderObjectCustomStyle(const RenderObject* obj
{
// Clear the styles for the object in the regions.
// FIXME: Region styling is not computed only for the region range of the object so this is why we need to walk the whole chain.
for (auto iter = m_regionList.begin(), end = m_regionList.end(); iter != end; ++iter) {
RenderNamedFlowFragment* region = toRenderNamedFlowFragment(*iter);
region->clearObjectStyleInRegion(object);
for (auto& region : m_regionList) {
RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(region);
namedFlowFragment->clearObjectStyleInRegion(object);
}
}
......
......@@ -657,9 +657,7 @@ static void write(TextStream& ts, RenderLayer& l,
static void writeRenderRegionList(const RenderRegionList& flowThreadRegionList, TextStream& ts, int indent)
{
for (RenderRegionList::const_iterator itRR = flowThreadRegionList.begin(); itRR != flowThreadRegionList.end(); ++itRR) {
RenderRegion* renderRegion = *itRR;
for (const auto& renderRegion : flowThreadRegionList) {
writeIndent(ts, indent);
ts << static_cast<const RenderObject*>(renderRegion)->renderName();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment