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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 1513573013: Don't call LayoutPart::widgetPositionsUpdated unnecessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 , m_isTransparent(false) 125 , m_isTransparent(false)
126 , m_baseBackgroundColor(Color::white) 126 , m_baseBackgroundColor(Color::white)
127 , m_mediaType(MediaTypeNames::screen) 127 , m_mediaType(MediaTypeNames::screen)
128 , m_safeToPropagateScrollToParent(true) 128 , m_safeToPropagateScrollToParent(true)
129 , m_isTrackingPaintInvalidations(false) 129 , m_isTrackingPaintInvalidations(false)
130 , m_scrollCorner(nullptr) 130 , m_scrollCorner(nullptr)
131 , m_inputEventsScaleFactorForEmulation(1) 131 , m_inputEventsScaleFactorForEmulation(1)
132 , m_layoutSizeFixedToFrameSize(true) 132 , m_layoutSizeFixedToFrameSize(true)
133 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) 133 , m_didScrollTimer(this, &FrameView::didScrollTimerFired)
134 , m_topControlsViewportAdjustment(0) 134 , m_topControlsViewportAdjustment(0)
135 , m_needsUpdateWidgetPositions(false) 135 , m_needsUpdateWidgetGeometries(false)
136 , m_needsUpdateViewportIntersection(true) 136 , m_needsUpdateViewportIntersection(true)
137 , m_needsUpdateViewportIntersectionInSubtree(true) 137 , m_needsUpdateViewportIntersectionInSubtree(true)
138 #if ENABLE(ASSERT) 138 #if ENABLE(ASSERT)
139 , m_hasBeenDisposed(false) 139 , m_hasBeenDisposed(false)
140 #endif 140 #endif
141 , m_horizontalScrollbarMode(ScrollbarAuto) 141 , m_horizontalScrollbarMode(ScrollbarAuto)
142 , m_verticalScrollbarMode(ScrollbarAuto) 142 , m_verticalScrollbarMode(ScrollbarAuto)
143 , m_horizontalScrollbarLock(false) 143 , m_horizontalScrollbarLock(false)
144 , m_verticalScrollbarLock(false) 144 , m_verticalScrollbarLock(false)
145 , m_scrollbarsAvoidingResizer(0) 145 , m_scrollbarsAvoidingResizer(0)
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 void FrameView::addPart(LayoutPart* object) 1137 void FrameView::addPart(LayoutPart* object)
1138 { 1138 {
1139 m_parts.add(object); 1139 m_parts.add(object);
1140 } 1140 }
1141 1141
1142 void FrameView::removePart(LayoutPart* object) 1142 void FrameView::removePart(LayoutPart* object)
1143 { 1143 {
1144 m_parts.remove(object); 1144 m_parts.remove(object);
1145 } 1145 }
1146 1146
1147 void FrameView::updateWidgetPositions() 1147 void FrameView::updateWidgetGeometries()
1148 { 1148 {
1149 Vector<RefPtr<LayoutPart>> parts; 1149 Vector<RefPtr<LayoutPart>> parts;
1150 copyToVector(m_parts, parts); 1150 copyToVector(m_parts, parts);
1151 1151
1152 // Script or plugins could detach the frame so abort processing if that happ ens. 1152 // Script or plugins could detach the frame so abort processing if that happ ens.
1153
1154 for (size_t i = 0; i < parts.size() && layoutView(); ++i) 1153 for (size_t i = 0; i < parts.size() && layoutView(); ++i)
1155 parts[i]->updateWidgetPosition(); 1154 parts[i]->updateWidgetGeometry();
1156
1157 for (size_t i = 0; i < parts.size() && layoutView(); ++i)
1158 parts[i]->widgetPositionsUpdated();
1159 } 1155 }
1160 1156
1161 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object) 1157 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object)
1162 { 1158 {
1163 ASSERT(isInPerformLayout()); 1159 ASSERT(isInPerformLayout());
1164 // Tell the DOM element that it needs a widget update. 1160 // Tell the DOM element that it needs a widget update.
1165 Node* node = object.node(); 1161 Node* node = object.node();
1166 ASSERT(node); 1162 ASSERT(node);
1167 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node)) 1163 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node))
1168 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true); 1164 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 // Nothing to do after scrolling if there are no fixed position elements. 1559 // Nothing to do after scrolling if there are no fixed position elements.
1564 if (!hasViewportConstrainedObjects()) 1560 if (!hasViewportConstrainedObjects())
1565 return; 1561 return;
1566 1562
1567 RefPtrWillBeRawPtr<FrameView> protect(this); 1563 RefPtrWillBeRawPtr<FrameView> protect(this);
1568 1564
1569 // If there fixed position elements, scrolling may cause compositing layers to change. 1565 // If there fixed position elements, scrolling may cause compositing layers to change.
1570 // Update widget and layer positions after scrolling, but only if we're not inside of 1566 // Update widget and layer positions after scrolling, but only if we're not inside of
1571 // layout. 1567 // layout.
1572 if (!m_nestedLayoutCount) { 1568 if (!m_nestedLayoutCount) {
1573 updateWidgetPositions(); 1569 updateWidgetGeometries();
1574 if (LayoutView* layoutView = this->layoutView()) 1570 if (LayoutView* layoutView = this->layoutView())
1575 layoutView->layer()->setNeedsCompositingInputsUpdate(); 1571 layoutView->layer()->setNeedsCompositingInputsUpdate();
1576 } 1572 }
1577 } 1573 }
1578 1574
1579 bool FrameView::computeCompositedSelection(LocalFrame& frame, CompositedSelectio n& selection) 1575 bool FrameView::computeCompositedSelection(LocalFrame& frame, CompositedSelectio n& selection)
1580 { 1576 {
1581 const VisibleSelection& visibleSelection = frame.selection().selection(); 1577 const VisibleSelection& visibleSelection = frame.selection().selection();
1582 if (!visibleSelection.isCaretOrRange()) 1578 if (!visibleSelection.isCaretOrRange())
1583 return false; 1579 return false;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 // but FrameView holds a manual ref, so it won't have been deleted. 1892 // but FrameView holds a manual ref, so it won't have been deleted.
1897 if (!element) 1893 if (!element)
1898 continue; 1894 continue;
1899 1895
1900 // No need to update if it's already crashed or known to be missing. 1896 // No need to update if it's already crashed or known to be missing.
1901 if (object.showsUnavailablePluginIndicator()) 1897 if (object.showsUnavailablePluginIndicator())
1902 continue; 1898 continue;
1903 1899
1904 if (element->needsWidgetUpdate()) 1900 if (element->needsWidgetUpdate())
1905 element->updateWidget(); 1901 element->updateWidget();
1906 object.updateWidgetPosition(); 1902 object.updateWidgetGeometry();
1907 1903
1908 // Prevent plugins from causing infinite updates of themselves. 1904 // Prevent plugins from causing infinite updates of themselves.
1909 // FIXME: Do we really need to prevent this? 1905 // FIXME: Do we really need to prevent this?
1910 m_partUpdateSet.remove(&object); 1906 m_partUpdateSet.remove(&object);
1911 } 1907 }
1912 1908
1913 return m_partUpdateSet.isEmpty(); 1909 return m_partUpdateSet.isEmpty();
1914 } 1910 }
1915 1911
1916 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) 1912 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 1954
1959 ASSERT(m_frame->document()); 1955 ASSERT(m_frame->document());
1960 1956
1961 FontFaceSet::didLayout(*m_frame->document()); 1957 FontFaceSet::didLayout(*m_frame->document());
1962 // Cursor update scheduling is done by the local root, which is the main fra me if there 1958 // Cursor update scheduling is done by the local root, which is the main fra me if there
1963 // are no RemoteFrame ancestors in the frame tree. Use of localFrameRoot() i s 1959 // are no RemoteFrame ancestors in the frame tree. Use of localFrameRoot() i s
1964 // discouraged but will change when cursor update scheduling is moved from E ventHandler 1960 // discouraged but will change when cursor update scheduling is moved from E ventHandler
1965 // to PageEventHandler. 1961 // to PageEventHandler.
1966 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); 1962 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate();
1967 1963
1968 updateWidgetPositions(); 1964 updateWidgetGeometries();
1969 1965
1970 // Plugins could have torn down the page inside updateWidgetPositions(). 1966 // Plugins could have torn down the page inside updateWidgetGeometries().
1971 if (!layoutView()) 1967 if (!layoutView())
1972 return; 1968 return;
1973 1969
1974 scheduleUpdateWidgetsIfNecessary(); 1970 scheduleUpdateWidgetsIfNecessary();
1975 1971
1976 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) 1972 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
1977 scrollingCoordinator->notifyLayoutUpdated(); 1973 scrollingCoordinator->notifyLayoutUpdated();
1978 1974
1979 scrollToAnchor(); 1975 scrollToAnchor();
1980 1976
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 bool FrameView::isPainting() const 2327 bool FrameView::isPainting() const
2332 { 2328 {
2333 return m_isPainting; 2329 return m_isPainting;
2334 } 2330 }
2335 2331
2336 void FrameView::setNodeToDraw(Node* node) 2332 void FrameView::setNodeToDraw(Node* node)
2337 { 2333 {
2338 m_nodeToDraw = node; 2334 m_nodeToDraw = node;
2339 } 2335 }
2340 2336
2341 void FrameView::updateWidgetPositionsIfNeeded() 2337 void FrameView::updateWidgetGeometriesIfNeeded()
2342 { 2338 {
2343 if (!m_needsUpdateWidgetPositions) 2339 if (!m_needsUpdateWidgetGeometries)
2344 return; 2340 return;
2345 2341
2346 m_needsUpdateWidgetPositions = false; 2342 m_needsUpdateWidgetGeometries = false;
2347 2343
2348 updateWidgetPositions(); 2344 updateWidgetGeometries();
2349 } 2345 }
2350 2346
2351 void FrameView::updateAllLifecyclePhases() 2347 void FrameView::updateAllLifecyclePhases()
2352 { 2348 {
2353 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases); 2349 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases);
2354 } 2350 }
2355 2351
2356 // TODO(chrishtr): add a scrolling update lifecycle phase. 2352 // TODO(chrishtr): add a scrolling update lifecycle phase.
2357 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() 2353 void FrameView::updateLifecycleToCompositingCleanPlusScrolling()
2358 { 2354 {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2573 layout(); 2569 layout();
2574 } 2570 }
2575 2571
2576 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. 2572 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style.
2577 ASSERT(!needsLayout()); 2573 ASSERT(!needsLayout());
2578 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); 2574 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate());
2579 #if ENABLE(ASSERT) 2575 #if ENABLE(ASSERT)
2580 m_frame->document()->layoutView()->assertLaidOut(); 2576 m_frame->document()->layoutView()->assertLaidOut();
2581 #endif 2577 #endif
2582 2578
2583 updateWidgetPositionsIfNeeded(); 2579 updateWidgetGeometriesIfNeeded();
2584 2580
2585 if (lifecycle().state() < DocumentLifecycle::LayoutClean) 2581 if (lifecycle().state() < DocumentLifecycle::LayoutClean)
2586 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); 2582 lifecycle().advanceTo(DocumentLifecycle::LayoutClean);
2587 2583
2588 // Ensure that we become visually non-empty eventually. 2584 // Ensure that we become visually non-empty eventually.
2589 // TODO(esprehn): This should check isRenderingReady() instead. 2585 // TODO(esprehn): This should check isRenderingReady() instead.
2590 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad()) 2586 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad())
2591 m_isVisuallyNonEmpty = true; 2587 m_isVisuallyNonEmpty = true;
2592 } 2588 }
2593 2589
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
4029 return m_hiddenForThrottling && m_crossOriginForThrottling; 4025 return m_hiddenForThrottling && m_crossOriginForThrottling;
4030 } 4026 }
4031 4027
4032 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4028 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4033 { 4029 {
4034 ASSERT(layoutView()); 4030 ASSERT(layoutView());
4035 return *layoutView(); 4031 return *layoutView();
4036 } 4032 }
4037 4033
4038 } // namespace blink 4034 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698