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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1136 void FrameView::addPart(LayoutPart* object) | 1136 void FrameView::addPart(LayoutPart* object) |
1137 { | 1137 { |
1138 m_parts.add(object); | 1138 m_parts.add(object); |
1139 } | 1139 } |
1140 | 1140 |
1141 void FrameView::removePart(LayoutPart* object) | 1141 void FrameView::removePart(LayoutPart* object) |
1142 { | 1142 { |
1143 m_parts.remove(object); | 1143 m_parts.remove(object); |
1144 } | 1144 } |
1145 | 1145 |
1146 void FrameView::updateWidgetPositions() | 1146 void FrameView::updateWidgetGeometries() |
1147 { | 1147 { |
1148 if (!layoutView()) | |
1149 return; | |
1150 | |
1148 Vector<RefPtr<LayoutPart>> parts; | 1151 Vector<RefPtr<LayoutPart>> parts; |
1149 copyToVector(m_parts, parts); | 1152 copyToVector(m_parts, parts); |
1150 | 1153 |
1151 // Script or plugins could detach the frame so abort processing if that happ ens. | 1154 // Script or plugins could detach the frame so abort processing if that happ ens. |
1155 Vector<bool> wasUpdated; | |
1156 wasUpdated.resize(parts.size()); | |
wkorman
2015/12/12 06:54:55
Can we initialize it with the right size from the
| |
1152 | 1157 |
1153 for (size_t i = 0; i < parts.size() && layoutView(); ++i) | 1158 for (size_t i = 0; i < parts.size(); ++i) |
1154 parts[i]->updateWidgetPosition(); | 1159 wasUpdated[i] = parts[i]->updateWidgetGeometry(); |
1155 | 1160 |
1156 for (size_t i = 0; i < parts.size() && layoutView(); ++i) | 1161 for (size_t i = 0; i < parts.size(); ++i) { |
1157 parts[i]->widgetPositionsUpdated(); | 1162 if (wasUpdated[i]) |
chrishtr
2015/12/12 05:08:54
This is the money line in this patch. The rest is
| |
1163 parts[i]->widgetGeometriesUpdated(); | |
wkorman
2015/12/12 06:54:55
Re: the comment at line 1154, just double-checking
| |
1164 } | |
1158 } | 1165 } |
1159 | 1166 |
1160 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object) | 1167 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object) |
1161 { | 1168 { |
1162 ASSERT(isInPerformLayout()); | 1169 ASSERT(isInPerformLayout()); |
1163 // Tell the DOM element that it needs a widget update. | 1170 // Tell the DOM element that it needs a widget update. |
1164 Node* node = object.node(); | 1171 Node* node = object.node(); |
1165 ASSERT(node); | 1172 ASSERT(node); |
1166 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node)) | 1173 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node)) |
1167 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true); | 1174 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1562 // Nothing to do after scrolling if there are no fixed position elements. | 1569 // Nothing to do after scrolling if there are no fixed position elements. |
1563 if (!hasViewportConstrainedObjects()) | 1570 if (!hasViewportConstrainedObjects()) |
1564 return; | 1571 return; |
1565 | 1572 |
1566 RefPtrWillBeRawPtr<FrameView> protect(this); | 1573 RefPtrWillBeRawPtr<FrameView> protect(this); |
1567 | 1574 |
1568 // If there fixed position elements, scrolling may cause compositing layers to change. | 1575 // If there fixed position elements, scrolling may cause compositing layers to change. |
1569 // Update widget and layer positions after scrolling, but only if we're not inside of | 1576 // Update widget and layer positions after scrolling, but only if we're not inside of |
1570 // layout. | 1577 // layout. |
1571 if (!m_nestedLayoutCount) { | 1578 if (!m_nestedLayoutCount) { |
1572 updateWidgetPositions(); | 1579 updateWidgetGeometries(); |
1573 if (LayoutView* layoutView = this->layoutView()) | 1580 if (LayoutView* layoutView = this->layoutView()) |
1574 layoutView->layer()->setNeedsCompositingInputsUpdate(); | 1581 layoutView->layer()->setNeedsCompositingInputsUpdate(); |
1575 } | 1582 } |
1576 } | 1583 } |
1577 | 1584 |
1578 bool FrameView::computeCompositedSelection(LocalFrame& frame, CompositedSelectio n& selection) | 1585 bool FrameView::computeCompositedSelection(LocalFrame& frame, CompositedSelectio n& selection) |
1579 { | 1586 { |
1580 const VisibleSelection& visibleSelection = frame.selection().selection(); | 1587 const VisibleSelection& visibleSelection = frame.selection().selection(); |
1581 if (!visibleSelection.isCaretOrRange()) | 1588 if (!visibleSelection.isCaretOrRange()) |
1582 return false; | 1589 return false; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1895 // but FrameView holds a manual ref, so it won't have been deleted. | 1902 // but FrameView holds a manual ref, so it won't have been deleted. |
1896 if (!element) | 1903 if (!element) |
1897 continue; | 1904 continue; |
1898 | 1905 |
1899 // No need to update if it's already crashed or known to be missing. | 1906 // No need to update if it's already crashed or known to be missing. |
1900 if (object.showsUnavailablePluginIndicator()) | 1907 if (object.showsUnavailablePluginIndicator()) |
1901 continue; | 1908 continue; |
1902 | 1909 |
1903 if (element->needsWidgetUpdate()) | 1910 if (element->needsWidgetUpdate()) |
1904 element->updateWidget(); | 1911 element->updateWidget(); |
1905 object.updateWidgetPosition(); | 1912 object.updateWidgetGeometry(); |
1906 | 1913 |
1907 // Prevent plugins from causing infinite updates of themselves. | 1914 // Prevent plugins from causing infinite updates of themselves. |
1908 // FIXME: Do we really need to prevent this? | 1915 // FIXME: Do we really need to prevent this? |
1909 m_partUpdateSet.remove(&object); | 1916 m_partUpdateSet.remove(&object); |
1910 } | 1917 } |
1911 | 1918 |
1912 return m_partUpdateSet.isEmpty(); | 1919 return m_partUpdateSet.isEmpty(); |
1913 } | 1920 } |
1914 | 1921 |
1915 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 1922 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1957 | 1964 |
1958 ASSERT(m_frame->document()); | 1965 ASSERT(m_frame->document()); |
1959 | 1966 |
1960 FontFaceSet::didLayout(*m_frame->document()); | 1967 FontFaceSet::didLayout(*m_frame->document()); |
1961 // Cursor update scheduling is done by the local root, which is the main fra me if there | 1968 // Cursor update scheduling is done by the local root, which is the main fra me if there |
1962 // are no RemoteFrame ancestors in the frame tree. Use of localFrameRoot() i s | 1969 // are no RemoteFrame ancestors in the frame tree. Use of localFrameRoot() i s |
1963 // discouraged but will change when cursor update scheduling is moved from E ventHandler | 1970 // discouraged but will change when cursor update scheduling is moved from E ventHandler |
1964 // to PageEventHandler. | 1971 // to PageEventHandler. |
1965 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); | 1972 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); |
1966 | 1973 |
1967 updateWidgetPositions(); | 1974 updateWidgetGeometries(); |
1968 | 1975 |
1969 // Plugins could have torn down the page inside updateWidgetPositions(). | 1976 // Plugins could have torn down the page inside updateWidgetGeometries(). |
1970 if (!layoutView()) | 1977 if (!layoutView()) |
1971 return; | 1978 return; |
1972 | 1979 |
1973 scheduleUpdateWidgetsIfNecessary(); | 1980 scheduleUpdateWidgetsIfNecessary(); |
1974 | 1981 |
1975 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 1982 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
1976 scrollingCoordinator->notifyLayoutUpdated(); | 1983 scrollingCoordinator->notifyLayoutUpdated(); |
1977 | 1984 |
1978 scrollToAnchor(); | 1985 scrollToAnchor(); |
1979 | 1986 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2330 bool FrameView::isPainting() const | 2337 bool FrameView::isPainting() const |
2331 { | 2338 { |
2332 return m_isPainting; | 2339 return m_isPainting; |
2333 } | 2340 } |
2334 | 2341 |
2335 void FrameView::setNodeToDraw(Node* node) | 2342 void FrameView::setNodeToDraw(Node* node) |
2336 { | 2343 { |
2337 m_nodeToDraw = node; | 2344 m_nodeToDraw = node; |
2338 } | 2345 } |
2339 | 2346 |
2340 void FrameView::updateWidgetPositionsIfNeeded() | 2347 void FrameView::updateWidgetGeometriesIfNeeded() |
2341 { | 2348 { |
2342 if (!m_needsUpdateWidgetPositions) | 2349 if (!m_needsUpdateWidgetGeometries) |
2343 return; | 2350 return; |
2344 | 2351 |
2345 m_needsUpdateWidgetPositions = false; | 2352 m_needsUpdateWidgetGeometries = false; |
2346 | 2353 |
2347 updateWidgetPositions(); | 2354 updateWidgetGeometries(); |
2348 } | 2355 } |
2349 | 2356 |
2350 void FrameView::updateAllLifecyclePhases() | 2357 void FrameView::updateAllLifecyclePhases() |
2351 { | 2358 { |
2352 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases); | 2359 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(AllPhases); |
2353 } | 2360 } |
2354 | 2361 |
2355 // TODO(chrishtr): add a scrolling update lifecycle phase. | 2362 // TODO(chrishtr): add a scrolling update lifecycle phase. |
2356 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() | 2363 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
2357 { | 2364 { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2558 layout(); | 2565 layout(); |
2559 } | 2566 } |
2560 | 2567 |
2561 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. | 2568 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. |
2562 ASSERT(!needsLayout()); | 2569 ASSERT(!needsLayout()); |
2563 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); | 2570 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); |
2564 #if ENABLE(ASSERT) | 2571 #if ENABLE(ASSERT) |
2565 m_frame->document()->layoutView()->assertLaidOut(); | 2572 m_frame->document()->layoutView()->assertLaidOut(); |
2566 #endif | 2573 #endif |
2567 | 2574 |
2568 updateWidgetPositionsIfNeeded(); | 2575 updateWidgetGeometriesIfNeeded(); |
2569 | 2576 |
2570 if (lifecycle().state() < DocumentLifecycle::LayoutClean) | 2577 if (lifecycle().state() < DocumentLifecycle::LayoutClean) |
2571 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); | 2578 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); |
2572 | 2579 |
2573 // Ensure that we become visually non-empty eventually. | 2580 // Ensure that we become visually non-empty eventually. |
2574 // TODO(esprehn): This should check isRenderingReady() instead. | 2581 // TODO(esprehn): This should check isRenderingReady() instead. |
2575 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad()) | 2582 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad()) |
2576 m_isVisuallyNonEmpty = true; | 2583 m_isVisuallyNonEmpty = true; |
2577 } | 2584 } |
2578 | 2585 |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4014 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4021 return m_hiddenForThrottling && m_crossOriginForThrottling; |
4015 } | 4022 } |
4016 | 4023 |
4017 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4024 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4018 { | 4025 { |
4019 ASSERT(layoutView()); | 4026 ASSERT(layoutView()); |
4020 return *layoutView(); | 4027 return *layoutView(); |
4021 } | 4028 } |
4022 | 4029 |
4023 } // namespace blink | 4030 } // namespace blink |
OLD | NEW |