OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1239 // If viewport is not enabled, frameRect change will cause layout size chang e and then layout. | 1239 // If viewport is not enabled, frameRect change will cause layout size chang e and then layout. |
1240 // Otherwise, viewport constrained objects need their layout flags set separ ately to ensure | 1240 // Otherwise, viewport constrained objects need their layout flags set separ ately to ensure |
1241 // they are positioned correctly. In the virtual-viewport pinch mode frame r ect changes wont | 1241 // they are positioned correctly. In the virtual-viewport pinch mode frame r ect changes wont |
1242 // necessarily cause a layout size change so only take this early-out if we' re in old-style | 1242 // necessarily cause a layout size change so only take this early-out if we' re in old-style |
1243 // pinch. | 1243 // pinch. |
1244 if (m_frame->settings() | 1244 if (m_frame->settings() |
1245 && !m_frame->settings()->viewportEnabled() | 1245 && !m_frame->settings()->viewportEnabled() |
1246 && !m_frame->settings()->pinchVirtualViewportEnabled()) | 1246 && !m_frame->settings()->pinchVirtualViewportEnabled()) |
1247 return; | 1247 return; |
1248 | 1248 |
1249 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end(); | 1249 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { |
1250 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) { | 1250 RenderObject* renderer = viewportConstrainedObject; |
1251 RenderObject* renderer = *it; | |
1252 RenderStyle* style = renderer->style(); | 1251 RenderStyle* style = renderer->style(); |
1253 if (widthChanged) { | 1252 if (widthChanged) { |
1254 if (style->width().isFixed() && (style->left().isAuto() || style->ri ght().isAuto())) | 1253 if (style->width().isFixed() && (style->left().isAuto() || style->ri ght().isAuto())) |
1255 renderer->setNeedsPositionedMovementLayout(); | 1254 renderer->setNeedsPositionedMovementLayout(); |
1256 else | 1255 else |
1257 renderer->setNeedsLayoutAndFullPaintInvalidation(); | 1256 renderer->setNeedsLayoutAndFullPaintInvalidation(); |
1258 } | 1257 } |
1259 if (heightChanged) { | 1258 if (heightChanged) { |
1260 if (style->height().isFixed() && (style->top().isAuto() || style->bo ttom().isAuto())) | 1259 if (style->height().isFixed() && (style->top().isAuto() || style->bo ttom().isAuto())) |
1261 renderer->setNeedsPositionedMovementLayout(); | 1260 renderer->setNeedsPositionedMovementLayout(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1310 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) | 1309 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) |
1311 { | 1310 { |
1312 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) | 1311 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) |
1313 return false; | 1312 return false; |
1314 | 1313 |
1315 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty() ) { | 1314 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty() ) { |
1316 InspectorInstrumentation::didScroll(page()); | 1315 InspectorInstrumentation::didScroll(page()); |
1317 return true; | 1316 return true; |
1318 } | 1317 } |
1319 | 1318 |
1320 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end(); | 1319 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { |
1321 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) { | 1320 RenderObject* renderer = viewportConstrainedObject; |
1322 RenderObject* renderer = *it; | |
1323 ASSERT(renderer->style()->hasViewportConstrainedPosition()); | 1321 ASSERT(renderer->style()->hasViewportConstrainedPosition()); |
1324 ASSERT(renderer->hasLayer()); | 1322 ASSERT(renderer->hasLayer()); |
1325 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 1323 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
1326 | 1324 |
1327 if (layer->isPaintInvalidationContainer()) | 1325 if (layer->isPaintInvalidationContainer()) |
1328 continue; | 1326 continue; |
1329 | 1327 |
1330 if (layer->subtreeIsInvisible()) | 1328 if (layer->subtreeIsInvisible()) |
1331 continue; | 1329 continue; |
1332 | 1330 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1904 // m_updateWidgetsTimer should only be scheduled if we have widgets to updat e. | 1902 // m_updateWidgetsTimer should only be scheduled if we have widgets to updat e. |
1905 // Thus I believe we can stop checking isEmpty here, and just ASSERT isEmpty : | 1903 // Thus I believe we can stop checking isEmpty here, and just ASSERT isEmpty : |
1906 ASSERT(!m_partUpdateSet.isEmpty()); | 1904 ASSERT(!m_partUpdateSet.isEmpty()); |
1907 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty()) | 1905 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty()) |
1908 return true; | 1906 return true; |
1909 | 1907 |
1910 // Need to swap because script will run inside the below loop and invalidate the iterator. | 1908 // Need to swap because script will run inside the below loop and invalidate the iterator. |
1911 EmbeddedObjectSet objects; | 1909 EmbeddedObjectSet objects; |
1912 objects.swap(m_partUpdateSet); | 1910 objects.swap(m_partUpdateSet); |
1913 | 1911 |
1914 for (EmbeddedObjectSet::iterator it = objects.begin(); it != objects.end(); ++it) { | 1912 for (const auto& embeddedObject : objects) { |
1915 RenderEmbeddedObject& object = **it; | 1913 RenderEmbeddedObject& object = *embeddedObject; |
1916 HTMLPlugInElement* element = toHTMLPlugInElement(object.node()); | 1914 HTMLPlugInElement* element = toHTMLPlugInElement(object.node()); |
1917 | 1915 |
1918 // The object may have already been destroyed (thus node cleared), | 1916 // The object may have already been destroyed (thus node cleared), |
1919 // but FrameView holds a manual ref, so it won't have been deleted. | 1917 // but FrameView holds a manual ref, so it won't have been deleted. |
1920 if (!element) | 1918 if (!element) |
1921 continue; | 1919 continue; |
1922 | 1920 |
1923 // No need to update if it's already crashed or known to be missing. | 1921 // No need to update if it's already crashed or known to be missing. |
1924 if (object.showsUnavailablePluginIndicator()) | 1922 if (object.showsUnavailablePluginIndicator()) |
1925 continue; | 1923 continue; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2287 { | 2285 { |
2288 Page* page = m_frame->page(); | 2286 Page* page = m_frame->page(); |
2289 if (!page) | 2287 if (!page) |
2290 return; | 2288 return; |
2291 | 2289 |
2292 contentAreaWillPaint(); | 2290 contentAreaWillPaint(); |
2293 | 2291 |
2294 if (!m_scrollableAreas) | 2292 if (!m_scrollableAreas) |
2295 return; | 2293 return; |
2296 | 2294 |
2297 for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin( ), end = m_scrollableAreas->end(); it != end; ++it) { | 2295 for (const auto& it : *m_scrollableAreas) { |
Mike West
2014/10/16 09:09:40
s/it/scrollableArea/, and then just change the ref
riju_
2014/10/16 11:30:45
Done.
| |
2298 ScrollableArea* scrollableArea = *it; | 2296 ScrollableArea* scrollableArea = it; |
2299 | 2297 |
2300 if (!scrollableArea->scrollbarsCanBeActive()) | 2298 if (!scrollableArea->scrollbarsCanBeActive()) |
2301 continue; | 2299 continue; |
2302 | 2300 |
2303 scrollableArea->contentAreaWillPaint(); | 2301 scrollableArea->contentAreaWillPaint(); |
2304 } | 2302 } |
2305 } | 2303 } |
2306 | 2304 |
2307 bool FrameView::scrollAnimatorEnabled() const | 2305 bool FrameView::scrollAnimatorEnabled() const |
2308 { | 2306 { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2413 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); | 2411 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); |
2414 if (bodyElement && bodyElement->renderer()) | 2412 if (bodyElement && bodyElement->renderer()) |
2415 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); | 2413 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); |
2416 | 2414 |
2417 return result; | 2415 return result; |
2418 } | 2416 } |
2419 | 2417 |
2420 bool FrameView::hasCustomScrollbars() const | 2418 bool FrameView::hasCustomScrollbars() const |
2421 { | 2419 { |
2422 const ChildrenWidgetSet* viewChildren = children(); | 2420 const ChildrenWidgetSet* viewChildren = children(); |
2423 ChildrenWidgetSet::const_iterator end = viewChildren->end(); | 2421 for (const auto& current : *viewChildren) { |
Mike West
2014/10/16 09:09:39
s/current/child/
riju_
2014/10/16 11:30:45
Done.
| |
2424 for (ChildrenWidgetSet::const_iterator current = viewChildren->begin(); curr ent != end; ++current) { | 2422 Widget* widget = current.get(); |
2425 Widget* widget = current->get(); | |
2426 if (widget->isFrameView()) { | 2423 if (widget->isFrameView()) { |
2427 if (toFrameView(widget)->hasCustomScrollbars()) | 2424 if (toFrameView(widget)->hasCustomScrollbars()) |
2428 return true; | 2425 return true; |
2429 } else if (widget->isScrollbar()) { | 2426 } else if (widget->isScrollbar()) { |
2430 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); | 2427 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); |
2431 if (scrollbar->isCustomScrollbar()) | 2428 if (scrollbar->isCustomScrollbar()) |
2432 return true; | 2429 return true; |
2433 } | 2430 } |
2434 } | 2431 } |
2435 | 2432 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2649 // FIXME: Calling layout() shouldn't trigger scripe execution or have any | 2646 // FIXME: Calling layout() shouldn't trigger scripe execution or have any |
2650 // observable effects on the frame tree but we're not quite there yet. | 2647 // observable effects on the frame tree but we're not quite there yet. |
2651 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; | 2648 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; |
2652 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | 2649 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { |
2653 if (!child->isLocalFrame()) | 2650 if (!child->isLocalFrame()) |
2654 continue; | 2651 continue; |
2655 if (FrameView* view = toLocalFrame(child)->view()) | 2652 if (FrameView* view = toLocalFrame(child)->view()) |
2656 frameViews.append(view); | 2653 frameViews.append(view); |
2657 } | 2654 } |
2658 | 2655 |
2659 const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frame Views.end(); | 2656 for (const auto& frameView : frameViews) |
2660 for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameVi ews.begin(); it != end; ++it) | 2657 frameView->updateLayoutAndStyleIfNeededRecursive(); |
2661 (*it)->updateLayoutAndStyleIfNeededRecursive(); | |
2662 | 2658 |
2663 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. | 2659 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. |
2664 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another | 2660 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another |
2665 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. | 2661 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. |
2666 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. | 2662 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. |
2667 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2663 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
2668 m_frame->document()->updateRenderTreeIfNeeded(); | 2664 m_frame->document()->updateRenderTreeIfNeeded(); |
2669 | 2665 |
2670 if (needsLayout()) | 2666 if (needsLayout()) |
2671 layout(); | 2667 layout(); |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3808 | 3804 |
3809 Widget::setFrameRect(newRect); | 3805 Widget::setFrameRect(newRect); |
3810 | 3806 |
3811 updateScrollbars(scrollOffsetDouble()); | 3807 updateScrollbars(scrollOffsetDouble()); |
3812 | 3808 |
3813 frameRectsChanged(); | 3809 frameRectsChanged(); |
3814 } | 3810 } |
3815 | 3811 |
3816 void FrameView::frameRectsChangedInternal() | 3812 void FrameView::frameRectsChangedInternal() |
3817 { | 3813 { |
3818 ChildrenWidgetSet::const_iterator end = m_children.end(); | 3814 for (const auto& current : m_children) |
Mike West
2014/10/16 09:09:39
s/current/child/
riju_
2014/10/16 11:30:45
Done.
| |
3819 for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current != end; ++current) | 3815 current->frameRectsChanged(); |
3820 (*current)->frameRectsChanged(); | |
3821 } | 3816 } |
3822 | 3817 |
3823 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro llbar) | 3818 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro llbar) |
3824 { | 3819 { |
3825 if (!graphicsLayer || !scrollbar) | 3820 if (!graphicsLayer || !scrollbar) |
3826 return; | 3821 return; |
3827 | 3822 |
3828 IntRect scrollbarRect = scrollbar->frameRect(); | 3823 IntRect scrollbarRect = scrollbar->frameRect(); |
3829 graphicsLayer->setPosition(scrollbarRect.location()); | 3824 graphicsLayer->setPosition(scrollbarRect.location()); |
3830 | 3825 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4151 void FrameView::setParentVisible(bool visible) | 4146 void FrameView::setParentVisible(bool visible) |
4152 { | 4147 { |
4153 if (isParentVisible() == visible) | 4148 if (isParentVisible() == visible) |
4154 return; | 4149 return; |
4155 | 4150 |
4156 Widget::setParentVisible(visible); | 4151 Widget::setParentVisible(visible); |
4157 | 4152 |
4158 if (!isSelfVisible()) | 4153 if (!isSelfVisible()) |
4159 return; | 4154 return; |
4160 | 4155 |
4161 ChildrenWidgetSet::const_iterator end = m_children.end(); | 4156 for (const auto& child : m_children) |
4162 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; + +it) | 4157 child->setParentVisible(visible); |
4163 (*it)->setParentVisible(visible); | |
4164 } | 4158 } |
4165 | 4159 |
4166 void FrameView::show() | 4160 void FrameView::show() |
4167 { | 4161 { |
4168 if (!isSelfVisible()) { | 4162 if (!isSelfVisible()) { |
4169 setSelfVisible(true); | 4163 setSelfVisible(true); |
4170 if (isParentVisible()) { | 4164 if (isParentVisible()) { |
4171 ChildrenWidgetSet::const_iterator end = m_children.end(); | 4165 for (const auto& it : m_children) |
Mike West
2014/10/16 09:09:40
s/it/child/
riju_
2014/10/16 11:30:45
Done.
| |
4172 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it ! = end; ++it) | 4166 it->setParentVisible(true); |
4173 (*it)->setParentVisible(true); | |
4174 } | 4167 } |
4175 } | 4168 } |
4176 | 4169 |
4177 Widget::show(); | 4170 Widget::show(); |
4178 } | 4171 } |
4179 | 4172 |
4180 void FrameView::hide() | 4173 void FrameView::hide() |
4181 { | 4174 { |
4182 if (isSelfVisible()) { | 4175 if (isSelfVisible()) { |
4183 if (isParentVisible()) { | 4176 if (isParentVisible()) { |
4184 ChildrenWidgetSet::const_iterator end = m_children.end(); | 4177 for (const auto& child : m_children) |
4185 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it ! = end; ++it) | 4178 child->setParentVisible(false); |
4186 (*it)->setParentVisible(false); | |
4187 } | 4179 } |
4188 setSelfVisible(false); | 4180 setSelfVisible(false); |
4189 } | 4181 } |
4190 | 4182 |
4191 Widget::hide(); | 4183 Widget::hide(); |
4192 } | 4184 } |
4193 | 4185 |
4194 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) | 4186 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) |
4195 { | 4187 { |
4196 HostWindow* window = hostWindow(); | 4188 HostWindow* window = hostWindow(); |
(...skipping 19 matching lines...) Expand all Loading... | |
4216 return; | 4208 return; |
4217 | 4209 |
4218 ScrollableArea::setScrollOrigin(origin); | 4210 ScrollableArea::setScrollOrigin(origin); |
4219 | 4211 |
4220 // Update if the scroll origin changes, since our position will be different if the content size did not change. | 4212 // Update if the scroll origin changes, since our position will be different if the content size did not change. |
4221 if (updatePositionAtAll && updatePositionSynchronously) | 4213 if (updatePositionAtAll && updatePositionSynchronously) |
4222 updateScrollbars(scrollOffsetDouble()); | 4214 updateScrollbars(scrollOffsetDouble()); |
4223 } | 4215 } |
4224 | 4216 |
4225 } // namespace blink | 4217 } // namespace blink |
OLD | NEW |