| 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& scrollableArea : *m_scrollableAreas) { |
| 2298 ScrollableArea* scrollableArea = *it; | |
| 2299 | |
| 2300 if (!scrollableArea->scrollbarsCanBeActive()) | 2296 if (!scrollableArea->scrollbarsCanBeActive()) |
| 2301 continue; | 2297 continue; |
| 2302 | 2298 |
| 2303 scrollableArea->contentAreaWillPaint(); | 2299 scrollableArea->contentAreaWillPaint(); |
| 2304 } | 2300 } |
| 2305 } | 2301 } |
| 2306 | 2302 |
| 2307 bool FrameView::scrollAnimatorEnabled() const | 2303 bool FrameView::scrollAnimatorEnabled() const |
| 2308 { | 2304 { |
| 2309 return m_frame->settings() && m_frame->settings()->scrollAnimatorEnabled(); | 2305 return m_frame->settings() && m_frame->settings()->scrollAnimatorEnabled(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 result = result.blend(htmlElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); | 2409 result = result.blend(htmlElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); |
| 2414 if (bodyElement && bodyElement->renderer()) | 2410 if (bodyElement && bodyElement->renderer()) |
| 2415 result = result.blend(bodyElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); | 2411 result = result.blend(bodyElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); |
| 2416 | 2412 |
| 2417 return result; | 2413 return result; |
| 2418 } | 2414 } |
| 2419 | 2415 |
| 2420 bool FrameView::hasCustomScrollbars() const | 2416 bool FrameView::hasCustomScrollbars() const |
| 2421 { | 2417 { |
| 2422 const ChildrenWidgetSet* viewChildren = children(); | 2418 const ChildrenWidgetSet* viewChildren = children(); |
| 2423 ChildrenWidgetSet::const_iterator end = viewChildren->end(); | 2419 for (const auto& child : *viewChildren) { |
| 2424 for (ChildrenWidgetSet::const_iterator current = viewChildren->begin(); curr
ent != end; ++current) { | 2420 Widget* widget = child.get(); |
| 2425 Widget* widget = current->get(); | |
| 2426 if (widget->isFrameView()) { | 2421 if (widget->isFrameView()) { |
| 2427 if (toFrameView(widget)->hasCustomScrollbars()) | 2422 if (toFrameView(widget)->hasCustomScrollbars()) |
| 2428 return true; | 2423 return true; |
| 2429 } else if (widget->isScrollbar()) { | 2424 } else if (widget->isScrollbar()) { |
| 2430 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); | 2425 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); |
| 2431 if (scrollbar->isCustomScrollbar()) | 2426 if (scrollbar->isCustomScrollbar()) |
| 2432 return true; | 2427 return true; |
| 2433 } | 2428 } |
| 2434 } | 2429 } |
| 2435 | 2430 |
| (...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 | 2644 // 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. | 2645 // observable effects on the frame tree but we're not quite there yet. |
| 2651 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; | 2646 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; |
| 2652 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 2647 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
| 2653 if (!child->isLocalFrame()) | 2648 if (!child->isLocalFrame()) |
| 2654 continue; | 2649 continue; |
| 2655 if (FrameView* view = toLocalFrame(child)->view()) | 2650 if (FrameView* view = toLocalFrame(child)->view()) |
| 2656 frameViews.append(view); | 2651 frameViews.append(view); |
| 2657 } | 2652 } |
| 2658 | 2653 |
| 2659 const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frame
Views.end(); | 2654 for (const auto& frameView : frameViews) |
| 2660 for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameVi
ews.begin(); it != end; ++it) | 2655 frameView->updateLayoutAndStyleIfNeededRecursive(); |
| 2661 (*it)->updateLayoutAndStyleIfNeededRecursive(); | |
| 2662 | 2656 |
| 2663 // When an <iframe> gets composited, it triggers an extra style recalc in it
s containing FrameView. | 2657 // 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 | 2658 // 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. | 2659 // 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. | 2660 // FIXME: We shouldn't be triggering an extra style recalc in the first plac
e. |
| 2667 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2661 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
| 2668 m_frame->document()->updateRenderTreeIfNeeded(); | 2662 m_frame->document()->updateRenderTreeIfNeeded(); |
| 2669 | 2663 |
| 2670 if (needsLayout()) | 2664 if (needsLayout()) |
| 2671 layout(); | 2665 layout(); |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3808 | 3802 |
| 3809 Widget::setFrameRect(newRect); | 3803 Widget::setFrameRect(newRect); |
| 3810 | 3804 |
| 3811 updateScrollbars(scrollOffsetDouble()); | 3805 updateScrollbars(scrollOffsetDouble()); |
| 3812 | 3806 |
| 3813 frameRectsChanged(); | 3807 frameRectsChanged(); |
| 3814 } | 3808 } |
| 3815 | 3809 |
| 3816 void FrameView::frameRectsChangedInternal() | 3810 void FrameView::frameRectsChangedInternal() |
| 3817 { | 3811 { |
| 3818 ChildrenWidgetSet::const_iterator end = m_children.end(); | 3812 for (const auto& child : m_children) |
| 3819 for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current
!= end; ++current) | 3813 child->frameRectsChanged(); |
| 3820 (*current)->frameRectsChanged(); | |
| 3821 } | 3814 } |
| 3822 | 3815 |
| 3823 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) | 3816 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) |
| 3824 { | 3817 { |
| 3825 if (!graphicsLayer || !scrollbar) | 3818 if (!graphicsLayer || !scrollbar) |
| 3826 return; | 3819 return; |
| 3827 | 3820 |
| 3828 IntRect scrollbarRect = scrollbar->frameRect(); | 3821 IntRect scrollbarRect = scrollbar->frameRect(); |
| 3829 graphicsLayer->setPosition(scrollbarRect.location()); | 3822 graphicsLayer->setPosition(scrollbarRect.location()); |
| 3830 | 3823 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4151 void FrameView::setParentVisible(bool visible) | 4144 void FrameView::setParentVisible(bool visible) |
| 4152 { | 4145 { |
| 4153 if (isParentVisible() == visible) | 4146 if (isParentVisible() == visible) |
| 4154 return; | 4147 return; |
| 4155 | 4148 |
| 4156 Widget::setParentVisible(visible); | 4149 Widget::setParentVisible(visible); |
| 4157 | 4150 |
| 4158 if (!isSelfVisible()) | 4151 if (!isSelfVisible()) |
| 4159 return; | 4152 return; |
| 4160 | 4153 |
| 4161 ChildrenWidgetSet::const_iterator end = m_children.end(); | 4154 for (const auto& child : m_children) |
| 4162 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; +
+it) | 4155 child->setParentVisible(visible); |
| 4163 (*it)->setParentVisible(visible); | |
| 4164 } | 4156 } |
| 4165 | 4157 |
| 4166 void FrameView::show() | 4158 void FrameView::show() |
| 4167 { | 4159 { |
| 4168 if (!isSelfVisible()) { | 4160 if (!isSelfVisible()) { |
| 4169 setSelfVisible(true); | 4161 setSelfVisible(true); |
| 4170 if (isParentVisible()) { | 4162 if (isParentVisible()) { |
| 4171 ChildrenWidgetSet::const_iterator end = m_children.end(); | 4163 for (const auto& child : m_children) |
| 4172 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) | 4164 child->setParentVisible(true); |
| 4173 (*it)->setParentVisible(true); | |
| 4174 } | 4165 } |
| 4175 } | 4166 } |
| 4176 | 4167 |
| 4177 Widget::show(); | 4168 Widget::show(); |
| 4178 } | 4169 } |
| 4179 | 4170 |
| 4180 void FrameView::hide() | 4171 void FrameView::hide() |
| 4181 { | 4172 { |
| 4182 if (isSelfVisible()) { | 4173 if (isSelfVisible()) { |
| 4183 if (isParentVisible()) { | 4174 if (isParentVisible()) { |
| 4184 ChildrenWidgetSet::const_iterator end = m_children.end(); | 4175 for (const auto& child : m_children) |
| 4185 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) | 4176 child->setParentVisible(false); |
| 4186 (*it)->setParentVisible(false); | |
| 4187 } | 4177 } |
| 4188 setSelfVisible(false); | 4178 setSelfVisible(false); |
| 4189 } | 4179 } |
| 4190 | 4180 |
| 4191 Widget::hide(); | 4181 Widget::hide(); |
| 4192 } | 4182 } |
| 4193 | 4183 |
| 4194 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) | 4184 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) |
| 4195 { | 4185 { |
| 4196 HostWindow* window = hostWindow(); | 4186 HostWindow* window = hostWindow(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4216 return; | 4206 return; |
| 4217 | 4207 |
| 4218 ScrollableArea::setScrollOrigin(origin); | 4208 ScrollableArea::setScrollOrigin(origin); |
| 4219 | 4209 |
| 4220 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 4210 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
| 4221 if (updatePositionAtAll && updatePositionSynchronously) | 4211 if (updatePositionAtAll && updatePositionSynchronously) |
| 4222 updateScrollbars(scrollOffsetDouble()); | 4212 updateScrollbars(scrollOffsetDouble()); |
| 4223 } | 4213 } |
| 4224 | 4214 |
| 4225 } // namespace blink | 4215 } // namespace blink |
| OLD | NEW |