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

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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 bool FrameView::isPainting() const 2310 bool FrameView::isPainting() const
2315 { 2311 {
2316 return m_isPainting; 2312 return m_isPainting;
2317 } 2313 }
2318 2314
2319 void FrameView::setNodeToDraw(Node* node) 2315 void FrameView::setNodeToDraw(Node* node)
2320 { 2316 {
2321 m_nodeToDraw = node; 2317 m_nodeToDraw = node;
2322 } 2318 }
2323 2319
2324 void FrameView::updateWidgetPositionsIfNeeded() 2320 void FrameView::updateWidgetGeometriesIfNeeded()
2325 { 2321 {
2326 if (!m_needsUpdateWidgetPositions) 2322 if (!m_needsUpdateWidgetGeometries)
2327 return; 2323 return;
2328 2324
2329 m_needsUpdateWidgetPositions = false; 2325 m_needsUpdateWidgetGeometries = false;
2330 2326
2331 updateWidgetPositions(); 2327 updateWidgetGeometries();
2332 } 2328 }
2333 2329
2334 void FrameView::updateAllLifecyclePhases() 2330 void FrameView::updateAllLifecyclePhases()
2335 { 2331 {
2336 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases); 2332 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases);
2337 } 2333 }
2338 2334
2339 // TODO(chrishtr): add a scrolling update lifecycle phase. 2335 // TODO(chrishtr): add a scrolling update lifecycle phase.
2340 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() 2336 void FrameView::updateLifecycleToCompositingCleanPlusScrolling()
2341 { 2337 {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 layout(); 2552 layout();
2557 } 2553 }
2558 2554
2559 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. 2555 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style.
2560 ASSERT(!needsLayout()); 2556 ASSERT(!needsLayout());
2561 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); 2557 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate());
2562 #if ENABLE(ASSERT) 2558 #if ENABLE(ASSERT)
2563 m_frame->document()->layoutView()->assertLaidOut(); 2559 m_frame->document()->layoutView()->assertLaidOut();
2564 #endif 2560 #endif
2565 2561
2566 updateWidgetPositionsIfNeeded(); 2562 updateWidgetGeometriesIfNeeded();
2567 2563
2568 if (lifecycle().state() < DocumentLifecycle::LayoutClean) 2564 if (lifecycle().state() < DocumentLifecycle::LayoutClean)
2569 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); 2565 lifecycle().advanceTo(DocumentLifecycle::LayoutClean);
2570 2566
2571 // Ensure that we become visually non-empty eventually. 2567 // Ensure that we become visually non-empty eventually.
2572 // TODO(esprehn): This should check isRenderingReady() instead. 2568 // TODO(esprehn): This should check isRenderingReady() instead.
2573 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad()) 2569 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad())
2574 m_isVisuallyNonEmpty = true; 2570 m_isVisuallyNonEmpty = true;
2575 } 2571 }
2576 2572
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
4012 return m_hiddenForThrottling && m_crossOriginForThrottling; 4008 return m_hiddenForThrottling && m_crossOriginForThrottling;
4013 } 4009 }
4014 4010
4015 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4011 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4016 { 4012 {
4017 ASSERT(layoutView()); 4013 ASSERT(layoutView());
4018 return *layoutView(); 4014 return *layoutView();
4019 } 4015 }
4020 4016
4021 } // namespace blink 4017 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/layout/LayoutPart.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698