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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 642293004: Use C++11 range-based loop in core/frame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: mike's comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/Frame.cpp ('k') | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 1f408250578509ebdc55c433317e2c896e92dccf..9b2e414b858f4be38eaf3d679cc503986d9adf23 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -1246,9 +1246,8 @@ void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged,
&& !m_frame->settings()->pinchVirtualViewportEnabled())
return;
- ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
- for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
- RenderObject* renderer = *it;
+ for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
+ RenderObject* renderer = viewportConstrainedObject;
RenderStyle* style = renderer->style();
if (widthChanged) {
if (style->width().isFixed() && (style->left().isAuto() || style->right().isAuto()))
@@ -1317,9 +1316,8 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta)
return true;
}
- ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
- for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
- RenderObject* renderer = *it;
+ for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
+ RenderObject* renderer = viewportConstrainedObject;
ASSERT(renderer->style()->hasViewportConstrainedPosition());
ASSERT(renderer->hasLayer());
RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
@@ -1911,8 +1909,8 @@ bool FrameView::updateWidgets()
EmbeddedObjectSet objects;
objects.swap(m_partUpdateSet);
- for (EmbeddedObjectSet::iterator it = objects.begin(); it != objects.end(); ++it) {
- RenderEmbeddedObject& object = **it;
+ for (const auto& embeddedObject : objects) {
+ RenderEmbeddedObject& object = *embeddedObject;
HTMLPlugInElement* element = toHTMLPlugInElement(object.node());
// The object may have already been destroyed (thus node cleared),
@@ -2294,9 +2292,7 @@ void FrameView::notifyPageThatContentAreaWillPaint() const
if (!m_scrollableAreas)
return;
- for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) {
- ScrollableArea* scrollableArea = *it;
-
+ for (const auto& scrollableArea : *m_scrollableAreas) {
if (!scrollableArea->scrollbarsCanBeActive())
continue;
@@ -2420,9 +2416,8 @@ Color FrameView::documentBackgroundColor() const
bool FrameView::hasCustomScrollbars() const
{
const ChildrenWidgetSet* viewChildren = children();
- ChildrenWidgetSet::const_iterator end = viewChildren->end();
- for (ChildrenWidgetSet::const_iterator current = viewChildren->begin(); current != end; ++current) {
- Widget* widget = current->get();
+ for (const auto& child : *viewChildren) {
+ Widget* widget = child.get();
if (widget->isFrameView()) {
if (toFrameView(widget)->hasCustomScrollbars())
return true;
@@ -2656,9 +2651,8 @@ void FrameView::updateLayoutAndStyleIfNeededRecursive()
frameViews.append(view);
}
- const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frameViews.end();
- for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameViews.begin(); it != end; ++it)
- (*it)->updateLayoutAndStyleIfNeededRecursive();
+ for (const auto& frameView : frameViews)
+ frameView->updateLayoutAndStyleIfNeededRecursive();
// When an <iframe> gets composited, it triggers an extra style recalc in its containing FrameView.
// To avoid pushing an invalid tree for display, we have to check for this case and do another
@@ -3815,9 +3809,8 @@ void FrameView::setFrameRectInternal(const IntRect& newRect)
void FrameView::frameRectsChangedInternal()
{
- ChildrenWidgetSet::const_iterator end = m_children.end();
- for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current != end; ++current)
- (*current)->frameRectsChanged();
+ for (const auto& child : m_children)
+ child->frameRectsChanged();
}
static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scrollbar)
@@ -4158,9 +4151,8 @@ void FrameView::setParentVisible(bool visible)
if (!isSelfVisible())
return;
- ChildrenWidgetSet::const_iterator end = m_children.end();
- for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; ++it)
- (*it)->setParentVisible(visible);
+ for (const auto& child : m_children)
+ child->setParentVisible(visible);
}
void FrameView::show()
@@ -4168,9 +4160,8 @@ void FrameView::show()
if (!isSelfVisible()) {
setSelfVisible(true);
if (isParentVisible()) {
- ChildrenWidgetSet::const_iterator end = m_children.end();
- for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; ++it)
- (*it)->setParentVisible(true);
+ for (const auto& child : m_children)
+ child->setParentVisible(true);
}
}
@@ -4181,9 +4172,8 @@ void FrameView::hide()
{
if (isSelfVisible()) {
if (isParentVisible()) {
- ChildrenWidgetSet::const_iterator end = m_children.end();
- for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; ++it)
- (*it)->setParentVisible(false);
+ for (const auto& child : m_children)
+ child->setParentVisible(false);
}
setSelfVisible(false);
}
« no previous file with comments | « Source/core/frame/Frame.cpp ('k') | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698