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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 , m_viewportRenderer(0) | 118 , m_viewportRenderer(0) |
119 , m_wasScrolledByUser(false) | 119 , m_wasScrolledByUser(false) |
120 , m_inProgrammaticScroll(false) | 120 , m_inProgrammaticScroll(false) |
121 , m_safeToPropagateScrollToParent(true) | 121 , m_safeToPropagateScrollToParent(true) |
122 , m_isTrackingPaintInvalidations(false) | 122 , m_isTrackingPaintInvalidations(false) |
123 , m_scrollCorner(nullptr) | 123 , m_scrollCorner(nullptr) |
124 , m_visibleContentScaleFactor(1) | 124 , m_visibleContentScaleFactor(1) |
125 , m_inputEventsScaleFactorForEmulation(1) | 125 , m_inputEventsScaleFactorForEmulation(1) |
126 , m_layoutSizeFixedToFrameSize(true) | 126 , m_layoutSizeFixedToFrameSize(true) |
127 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) | 127 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
128 , m_topControlsViewportAdjustment(0) | |
128 , m_needsUpdateWidgetPositions(false) | 129 , m_needsUpdateWidgetPositions(false) |
129 , m_topControlsViewportAdjustment(0) | 130 #if ENABLE(OILPAN) && ENABLE(ASSERT) |
131 , m_hasBeenDisposed(false) | |
132 #endif | |
130 , m_horizontalScrollbarMode(ScrollbarAuto) | 133 , m_horizontalScrollbarMode(ScrollbarAuto) |
131 , m_verticalScrollbarMode(ScrollbarAuto) | 134 , m_verticalScrollbarMode(ScrollbarAuto) |
132 , m_horizontalScrollbarLock(false) | 135 , m_horizontalScrollbarLock(false) |
133 , m_verticalScrollbarLock(false) | 136 , m_verticalScrollbarLock(false) |
134 , m_scrollbarsAvoidingResizer(0) | 137 , m_scrollbarsAvoidingResizer(0) |
135 , m_scrollbarsSuppressed(false) | 138 , m_scrollbarsSuppressed(false) |
136 , m_inUpdateScrollbars(false) | 139 , m_inUpdateScrollbars(false) |
137 , m_drawPanScrollIcon(false) | 140 , m_drawPanScrollIcon(false) |
138 , m_clipsRepaints(true) | 141 , m_clipsRepaints(true) |
139 { | 142 { |
140 ASSERT(m_frame); | 143 ASSERT(m_frame); |
141 init(); | 144 init(); |
142 | 145 |
143 if (!m_frame->isMainFrame()) | 146 if (!m_frame->isMainFrame()) |
144 return; | 147 return; |
145 | 148 |
146 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); | 149 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); |
147 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); | 150 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); |
148 } | 151 } |
149 | 152 |
150 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) | 153 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) |
151 { | 154 { |
152 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 155 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) ); |
153 view->show(); | 156 view->show(); |
154 return view.release(); | 157 return view.release(); |
155 } | 158 } |
156 | 159 |
157 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia lSize) | 160 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int Size& initialSize) |
158 { | 161 { |
159 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 162 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) ); |
160 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 163 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
161 view->setLayoutSizeInternal(initialSize); | 164 view->setLayoutSizeInternal(initialSize); |
162 | 165 |
163 view->show(); | 166 view->show(); |
164 return view.release(); | 167 return view.release(); |
165 } | 168 } |
166 | 169 |
167 FrameView::~FrameView() | 170 FrameView::~FrameView() |
168 { | 171 { |
172 #if ENABLE(OILPAN) | |
173 ASSERT(m_hasBeenDisposed); | |
174 #else | |
175 // Verify that the LocalFrame has a different FrameView or | |
176 // that it is being detached and destructed. | |
177 ASSERT(frame().view() != this || !renderView()); | |
178 dispose(); | |
179 #endif | |
180 } | |
181 | |
182 void FrameView::dispose() | |
183 { | |
169 if (m_postLayoutTasksTimer.isActive()) | 184 if (m_postLayoutTasksTimer.isActive()) |
170 m_postLayoutTasksTimer.stop(); | 185 m_postLayoutTasksTimer.stop(); |
171 | 186 |
172 if (m_didScrollTimer.isActive()) | 187 if (m_didScrollTimer.isActive()) |
173 m_didScrollTimer.stop(); | 188 m_didScrollTimer.stop(); |
174 | 189 |
175 removeFromAXObjectCache(); | 190 removeFromAXObjectCache(); |
176 | 191 |
177 // Custom scrollbars should already be destroyed at this point | 192 // Custom scrollbars should already be destroyed at this point |
178 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar() ); | 193 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar() ); |
179 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); | 194 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); |
180 | 195 |
181 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow. | 196 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow. |
182 setHasVerticalScrollbar(false); | 197 setHasVerticalScrollbar(false); |
183 | 198 |
184 ASSERT(!m_scrollCorner); | 199 ASSERT(!m_scrollCorner); |
185 | 200 |
186 ASSERT(m_frame); | |
187 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); | |
188 // FIXME: Do we need to do something here for OOPI? | 201 // FIXME: Do we need to do something here for OOPI? |
189 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 202 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
190 if (ownerElement && ownerElement->ownedWidget() == this) | 203 if (ownerElement && ownerElement->ownedWidget() == this) |
191 ownerElement->setWidget(nullptr); | 204 ownerElement->setWidget(nullptr); |
205 | |
206 disposeAutoSizeInfo(); | |
207 #if ENABLE(OILPAN) && ENABLE(ASSERT) | |
208 m_hasBeenDisposed = true; | |
209 #endif | |
210 } | |
211 | |
212 void FrameView::trace(Visitor* visitor) | |
213 { | |
214 #if ENABLE(OILPAN) | |
215 visitor->trace(m_partUpdateSet); | |
216 visitor->trace(m_parts); | |
217 visitor->trace(m_frame); | |
218 visitor->trace(m_nodeToDraw); | |
219 visitor->trace(m_maintainScrollPositionAnchor); | |
220 visitor->trace(m_scrollCorner); | |
221 visitor->trace(m_autoSizeInfo); | |
222 visitor->trace(m_horizontalScrollbar); | |
223 visitor->trace(m_verticalScrollbar); | |
224 visitor->trace(m_children); | |
225 #endif | |
226 Widget::trace(visitor); | |
192 } | 227 } |
193 | 228 |
194 void FrameView::reset() | 229 void FrameView::reset() |
195 { | 230 { |
196 m_hasPendingLayout = false; | 231 m_hasPendingLayout = false; |
197 m_layoutSubtreeRoot = 0; | 232 m_layoutSubtreeRoot = 0; |
198 m_doFullPaintInvalidation = false; | 233 m_doFullPaintInvalidation = false; |
199 m_layoutSchedulingEnabled = true; | 234 m_layoutSchedulingEnabled = true; |
200 m_inPerformLayout = false; | 235 m_inPerformLayout = false; |
201 m_canInvalidatePaintDuringPerformLayout = false; | 236 m_canInvalidatePaintDuringPerformLayout = false; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 | 292 |
258 detachCustomScrollbars(); | 293 detachCustomScrollbars(); |
259 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache | 294 // When the view is no longer associated with a frame, it needs to be remove d from the ax object cache |
260 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later. | 295 // right now, otherwise it won't be able to reach the topDocument()'s axObje ct cache later. |
261 removeFromAXObjectCache(); | 296 removeFromAXObjectCache(); |
262 | 297 |
263 if (m_frame->page()) { | 298 if (m_frame->page()) { |
264 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) | 299 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) |
265 scrollingCoordinator->willDestroyScrollableArea(this); | 300 scrollingCoordinator->willDestroyScrollableArea(this); |
266 } | 301 } |
302 | |
303 #if ENABLE(OILPAN) | |
304 // FIXME: once/if dust settles, do this always (non-Oilpan)? | |
305 // | |
306 // FIXME: Oilpan: is this safe to dispose() if there are FrameView protectio ns on the stack? | |
307 dispose(); | |
308 #endif | |
267 } | 309 } |
268 | 310 |
269 void FrameView::detachCustomScrollbars() | 311 void FrameView::detachCustomScrollbars() |
270 { | 312 { |
271 Scrollbar* horizontalBar = horizontalScrollbar(); | 313 Scrollbar* horizontalBar = horizontalScrollbar(); |
272 if (horizontalBar && horizontalBar->isCustomScrollbar()) | 314 if (horizontalBar && horizontalBar->isCustomScrollbar()) |
273 setHasHorizontalScrollbar(false); | 315 setHasHorizontalScrollbar(false); |
274 | 316 |
275 Scrollbar* verticalBar = verticalScrollbar(); | 317 Scrollbar* verticalBar = verticalScrollbar(); |
276 if (verticalBar && verticalBar->isCustomScrollbar()) | 318 if (verticalBar && verticalBar->isCustomScrollbar()) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also. | 454 // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also. |
413 RenderPart* frameRenderer = m_frame->ownerRenderer(); | 455 RenderPart* frameRenderer = m_frame->ownerRenderer(); |
414 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) { | 456 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) { |
415 customScrollbarFrame = m_frame.get(); | 457 customScrollbarFrame = m_frame.get(); |
416 return true; | 458 return true; |
417 } | 459 } |
418 | 460 |
419 return false; | 461 return false; |
420 } | 462 } |
421 | 463 |
422 PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientatio n) | 464 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientatio n orientation) |
423 { | 465 { |
424 Element* customScrollbarElement = 0; | 466 Element* customScrollbarElement = 0; |
425 LocalFrame* customScrollbarFrame = 0; | 467 LocalFrame* customScrollbarFrame = 0; |
426 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) | 468 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) |
427 return RenderScrollbar::createCustomScrollbar(this, orientation, customS crollbarElement, customScrollbarFrame); | 469 return RenderScrollbar::createCustomScrollbar(this, orientation, customS crollbarElement, customScrollbarFrame); |
428 | 470 |
429 // Nobody set a custom style, so we just use a native scrollbar. | 471 // Nobody set a custom style, so we just use a native scrollbar. |
430 return createScrollbarInternal(orientation); | 472 return createScrollbarInternal(orientation); |
431 } | 473 } |
432 | 474 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) | 725 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) |
684 return; | 726 return; |
685 | 727 |
686 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished | 728 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished |
687 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced | 729 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced |
688 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before | 730 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before |
689 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its | 731 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its |
690 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the | 732 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the |
691 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying | 733 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying |
692 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>). | 734 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>). |
693 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); | 735 RefPtrWillBeRawPtr<FrameView> frameView = ownerRenderer->frame()->view(); |
694 | 736 |
695 // Mark the owner renderer as needing layout. | 737 // Mark the owner renderer as needing layout. |
696 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 738 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
697 | 739 |
698 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. | 740 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. |
699 ASSERT(frameView); | 741 ASSERT(frameView); |
700 frameView->layout(); | 742 frameView->layout(); |
701 } | 743 } |
702 | 744 |
703 void FrameView::performPreLayoutTasks() | 745 void FrameView::performPreLayoutTasks() |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 | 837 |
796 ScriptForbiddenScope forbidScript; | 838 ScriptForbiddenScope forbidScript; |
797 | 839 |
798 if (isInPerformLayout() || !m_frame->document()->isActive()) | 840 if (isInPerformLayout() || !m_frame->document()->isActive()) |
799 return; | 841 return; |
800 | 842 |
801 TRACE_EVENT0("blink", "FrameView::layout"); | 843 TRACE_EVENT0("blink", "FrameView::layout"); |
802 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 844 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
803 | 845 |
804 // Protect the view from being deleted during layout (in recalcStyle) | 846 // Protect the view from being deleted during layout (in recalcStyle) |
805 RefPtr<FrameView> protector(this); | 847 RefPtrWillBeRawPtr<FrameView> protector(this); |
806 | 848 |
807 // Every scroll that happens during layout is programmatic. | 849 // Every scroll that happens during layout is programmatic. |
808 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); | 850 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); |
809 | 851 |
810 if (m_autoSizeInfo) | 852 if (m_autoSizeInfo) |
811 m_autoSizeInfo->autoSizeIfNeeded(); | 853 m_autoSizeInfo->autoSizeIfNeeded(); |
812 | 854 |
813 m_hasPendingLayout = false; | 855 m_hasPendingLayout = false; |
814 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean); | 856 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean); |
815 | 857 |
816 RELEASE_ASSERT(!isPainting()); | 858 RELEASE_ASSERT(!isPainting()); |
817 | 859 |
818 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this)); | 860 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this)); |
819 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 861 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
820 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. | 862 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. |
821 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout (m_frame.get()); | 863 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout (m_frame.get()); |
822 | 864 |
823 if (!allowSubtree && isSubtreeLayout()) { | 865 if (!allowSubtree && isSubtreeLayout()) { |
824 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 866 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
825 m_layoutSubtreeRoot = 0; | 867 m_layoutSubtreeRoot = 0; |
826 } | 868 } |
827 | 869 |
828 performPreLayoutTasks(); | 870 performPreLayoutTasks(); |
829 | 871 |
872 #if !ENABLE(OILPAN) | |
830 // If there is only one ref to this view left, then its going to be destroye d as soon as we exit, | 873 // If there is only one ref to this view left, then its going to be destroye d as soon as we exit, |
831 // so there's no point to continuing to layout | 874 // so there's no point to continuing to layout |
832 if (protector->hasOneRef()) | 875 if (protector->hasOneRef()) |
833 return; | 876 return; |
877 #endif | |
834 | 878 |
835 Document* document = m_frame->document(); | 879 Document* document = m_frame->document(); |
836 bool inSubtreeLayout = isSubtreeLayout(); | 880 bool inSubtreeLayout = isSubtreeLayout(); |
837 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderView(); | 881 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderView(); |
838 if (!rootForThisLayout) { | 882 if (!rootForThisLayout) { |
839 // FIXME: Do we need to set m_size here? | 883 // FIXME: Do we need to set m_size here? |
840 ASSERT_NOT_REACHED(); | 884 ASSERT_NOT_REACHED(); |
841 return; | 885 return; |
842 } | 886 } |
843 | 887 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1505 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); | 1549 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); |
1506 } | 1550 } |
1507 } | 1551 } |
1508 | 1552 |
1509 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() | 1553 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
1510 { | 1554 { |
1511 // Nothing to do after scrolling if there are no fixed position elements. | 1555 // Nothing to do after scrolling if there are no fixed position elements. |
1512 if (!hasViewportConstrainedObjects()) | 1556 if (!hasViewportConstrainedObjects()) |
1513 return; | 1557 return; |
1514 | 1558 |
1515 RefPtr<FrameView> protect(this); | 1559 RefPtrWillBeRawPtr<FrameView> protect(this); |
1516 | 1560 |
1517 // If there fixed position elements, scrolling may cause compositing layers to change. | 1561 // If there fixed position elements, scrolling may cause compositing layers to change. |
1518 // Update widget and layer positions after scrolling, but only if we're not inside of | 1562 // Update widget and layer positions after scrolling, but only if we're not inside of |
1519 // layout. | 1563 // layout. |
1520 if (!m_nestedLayoutCount) { | 1564 if (!m_nestedLayoutCount) { |
1521 updateWidgetPositions(); | 1565 updateWidgetPositions(); |
1522 if (RenderView* renderView = this->renderView()) | 1566 if (RenderView* renderView = this->renderView()) |
1523 renderView->layer()->setNeedsCompositingInputsUpdate(); | 1567 renderView->layer()->setNeedsCompositingInputsUpdate(); |
1524 } | 1568 } |
1525 } | 1569 } |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1887 // FIXME: Do we really need to prevent this? | 1931 // FIXME: Do we really need to prevent this? |
1888 m_partUpdateSet.remove(&object); | 1932 m_partUpdateSet.remove(&object); |
1889 } | 1933 } |
1890 | 1934 |
1891 return m_partUpdateSet.isEmpty(); | 1935 return m_partUpdateSet.isEmpty(); |
1892 } | 1936 } |
1893 | 1937 |
1894 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 1938 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
1895 { | 1939 { |
1896 ASSERT(!isInPerformLayout()); | 1940 ASSERT(!isInPerformLayout()); |
1897 RefPtr<FrameView> protect(this); | 1941 RefPtrWillBeRawPtr<FrameView> protect(this); |
1898 m_updateWidgetsTimer.stop(); | 1942 m_updateWidgetsTimer.stop(); |
1899 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 1943 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
1900 if (updateWidgets()) | 1944 if (updateWidgets()) |
1901 return; | 1945 return; |
1902 } | 1946 } |
1903 } | 1947 } |
1904 | 1948 |
1905 void FrameView::flushAnyPendingPostLayoutTasks() | 1949 void FrameView::flushAnyPendingPostLayoutTasks() |
1906 { | 1950 { |
1907 ASSERT(!isInPerformLayout()); | 1951 ASSERT(!isInPerformLayout()); |
(...skipping 12 matching lines...) Expand all Loading... | |
1920 } | 1964 } |
1921 | 1965 |
1922 void FrameView::performPostLayoutTasks() | 1966 void FrameView::performPostLayoutTasks() |
1923 { | 1967 { |
1924 // FIXME: We can reach here, even when the page is not active! | 1968 // FIXME: We can reach here, even when the page is not active! |
1925 // http/tests/inspector/elements/html-link-import.html and many other | 1969 // http/tests/inspector/elements/html-link-import.html and many other |
1926 // tests hit that case. | 1970 // tests hit that case. |
1927 // We should ASSERT(isActive()); or at least return early if we can! | 1971 // We should ASSERT(isActive()); or at least return early if we can! |
1928 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call. | 1972 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call. |
1929 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); | 1973 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); |
1930 RefPtr<FrameView> protect(this); | 1974 RefPtrWillBeRawPtr<FrameView> protect(this); |
1931 | 1975 |
1932 m_postLayoutTasksTimer.stop(); | 1976 m_postLayoutTasksTimer.stop(); |
1933 | 1977 |
1934 m_frame->selection().setCaretRectNeedsUpdate(); | 1978 m_frame->selection().setCaretRectNeedsUpdate(); |
1935 | 1979 |
1936 { | 1980 { |
1937 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l ayers.html | 1981 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l ayers.html |
1938 DisableCompositingQueryAsserts disabler; | 1982 DisableCompositingQueryAsserts disabler; |
1939 m_frame->selection().updateAppearance(); | 1983 m_frame->selection().updateAppearance(); |
1940 } | 1984 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2367 if (htmlElement && htmlElement->renderer()) | 2411 if (htmlElement && htmlElement->renderer()) |
2368 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); | 2412 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); |
2369 if (bodyElement && bodyElement->renderer()) | 2413 if (bodyElement && bodyElement->renderer()) |
2370 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); | 2414 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); |
2371 | 2415 |
2372 return result; | 2416 return result; |
2373 } | 2417 } |
2374 | 2418 |
2375 bool FrameView::hasCustomScrollbars() const | 2419 bool FrameView::hasCustomScrollbars() const |
2376 { | 2420 { |
2377 const HashSet<RefPtr<Widget> >* viewChildren = children(); | 2421 const WillBeHeapHashSet<RefPtrWillBeMember<Widget> >* viewChildren = childre n(); |
haraken
2014/10/11 17:33:02
Can we use ChildrenWidgetSet ?
sof
2014/10/12 08:16:22
Certainly can, thanks for catching.
| |
2378 HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); | 2422 WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator end = viewChi ldren->end(); |
2379 for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin( ); current != end; ++current) { | 2423 for (WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) { |
2380 Widget* widget = current->get(); | 2424 Widget* widget = current->get(); |
2381 if (widget->isFrameView()) { | 2425 if (widget->isFrameView()) { |
2382 if (toFrameView(widget)->hasCustomScrollbars()) | 2426 if (toFrameView(widget)->hasCustomScrollbars()) |
2383 return true; | 2427 return true; |
2384 } else if (widget->isScrollbar()) { | 2428 } else if (widget->isScrollbar()) { |
2385 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); | 2429 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); |
2386 if (scrollbar->isCustomScrollbar()) | 2430 if (scrollbar->isCustomScrollbar()) |
2387 return true; | 2431 return true; |
2388 } | 2432 } |
2389 } | 2433 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2548 return; | 2592 return; |
2549 | 2593 |
2550 m_needsUpdateWidgetPositions = false; | 2594 m_needsUpdateWidgetPositions = false; |
2551 | 2595 |
2552 updateWidgetPositions(); | 2596 updateWidgetPositions(); |
2553 } | 2597 } |
2554 | 2598 |
2555 void FrameView::updateLayoutAndStyleForPainting() | 2599 void FrameView::updateLayoutAndStyleForPainting() |
2556 { | 2600 { |
2557 // Updating layout can run script, which can tear down the FrameView. | 2601 // Updating layout can run script, which can tear down the FrameView. |
2558 RefPtr<FrameView> protector(this); | 2602 RefPtrWillBeRawPtr<FrameView> protector(this); |
2559 | 2603 |
2560 updateLayoutAndStyleIfNeededRecursive(); | 2604 updateLayoutAndStyleIfNeededRecursive(); |
2561 | 2605 |
2562 updateWidgetPositionsIfNeeded(); | 2606 updateWidgetPositionsIfNeeded(); |
2563 | 2607 |
2564 RenderView* view = renderView(); | 2608 RenderView* view = renderView(); |
2565 if (view) { | 2609 if (view) { |
2566 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "frame", m_frame.get()); | 2610 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "frame", m_frame.get()); |
2567 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. | 2611 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. |
2568 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); | 2612 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); |
(...skipping 27 matching lines...) Expand all Loading... | |
2596 // region but then become included later by the second frame adding rects to the dirty region | 2640 // region but then become included later by the second frame adding rects to the dirty region |
2597 // when it lays out. | 2641 // when it lays out. |
2598 | 2642 |
2599 m_frame->document()->updateRenderTreeIfNeeded(); | 2643 m_frame->document()->updateRenderTreeIfNeeded(); |
2600 | 2644 |
2601 if (needsLayout()) | 2645 if (needsLayout()) |
2602 layout(); | 2646 layout(); |
2603 | 2647 |
2604 // FIXME: Calling layout() shouldn't trigger scripe execution or have any | 2648 // FIXME: Calling layout() shouldn't trigger scripe execution or have any |
2605 // observable effects on the frame tree but we're not quite there yet. | 2649 // observable effects on the frame tree but we're not quite there yet. |
2606 Vector<RefPtr<FrameView> > frameViews; | 2650 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; |
2607 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | 2651 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { |
2608 if (!child->isLocalFrame()) | 2652 if (!child->isLocalFrame()) |
2609 continue; | 2653 continue; |
2610 if (FrameView* view = toLocalFrame(child)->view()) | 2654 if (FrameView* view = toLocalFrame(child)->view()) |
2611 frameViews.append(view); | 2655 frameViews.append(view); |
2612 } | 2656 } |
2613 | 2657 |
2614 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); | 2658 const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frame Views.end(); |
2615 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it) | 2659 for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameVi ews.begin(); it != end; ++it) |
2616 (*it)->updateLayoutAndStyleIfNeededRecursive(); | 2660 (*it)->updateLayoutAndStyleIfNeededRecursive(); |
2617 | 2661 |
2618 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. | 2662 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. |
2619 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another | 2663 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another |
2620 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. | 2664 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. |
2621 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. | 2665 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. |
2622 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2666 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
2623 m_frame->document()->updateRenderTreeIfNeeded(); | 2667 m_frame->document()->updateRenderTreeIfNeeded(); |
2624 | 2668 |
2625 if (needsLayout()) | 2669 if (needsLayout()) |
(...skipping 20 matching lines...) Expand all Loading... | |
2646 if (!child->isLocalFrame()) | 2690 if (!child->isLocalFrame()) |
2647 continue; | 2691 continue; |
2648 | 2692 |
2649 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); | 2693 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); |
2650 } | 2694 } |
2651 } | 2695 } |
2652 | 2696 |
2653 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) | 2697 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) |
2654 { | 2698 { |
2655 if (!m_autoSizeInfo) | 2699 if (!m_autoSizeInfo) |
2656 m_autoSizeInfo = adoptPtr(new FrameViewAutoSizeInfo(this)); | 2700 m_autoSizeInfo = FrameViewAutoSizeInfo::create(this); |
2657 | 2701 |
2658 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); | 2702 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); |
2703 setLayoutSizeFixedToFrameSize(true); | |
2704 setNeedsLayout(); | |
2705 scheduleRelayout(); | |
2706 } | |
2707 | |
2708 void FrameView::disposeAutoSizeInfo() | |
2709 { | |
2710 if (!m_autoSizeInfo) | |
2711 return; | |
2712 | |
2713 setLayoutSizeFixedToFrameSize(false); | |
2714 setNeedsLayout(); | |
2715 scheduleRelayout(); | |
2716 | |
2717 // Since autosize mode forces the scrollbar mode, change them to being auto. | |
2718 setVerticalScrollbarLock(false); | |
2719 setHorizontalScrollbarLock(false); | |
2720 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); | |
2721 m_autoSizeInfo.clear(); | |
2659 } | 2722 } |
2660 | 2723 |
2661 void FrameView::forceLayout(bool allowSubtree) | 2724 void FrameView::forceLayout(bool allowSubtree) |
2662 { | 2725 { |
2663 layout(allowSubtree); | 2726 layout(allowSubtree); |
2664 } | 2727 } |
2665 | 2728 |
2666 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS ize& originalPageSize, float maximumShrinkFactor) | 2729 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS ize& originalPageSize, float maximumShrinkFactor) |
2667 { | 2730 { |
2668 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri ck to see | 2731 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri ck to see |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3049 | 3112 |
3050 IntPoint maximumOffset( | 3113 IntPoint maximumOffset( |
3051 contentsWidth() - visibleSize.width() - scrollOrigin().x(), | 3114 contentsWidth() - visibleSize.width() - scrollOrigin().x(), |
3052 contentsHeight() - visibleSize.height() - scrollOrigin().y()); | 3115 contentsHeight() - visibleSize.height() - scrollOrigin().y()); |
3053 maximumOffset.clampNegativeToZero(); | 3116 maximumOffset.clampNegativeToZero(); |
3054 return maximumOffset; | 3117 return maximumOffset; |
3055 } | 3118 } |
3056 | 3119 |
3057 // --- ScrollView --- | 3120 // --- ScrollView --- |
3058 | 3121 |
3059 void FrameView::addChild(PassRefPtr<Widget> prpChild) | 3122 void FrameView::addChild(PassRefPtrWillBeRawPtr<Widget> prpChild) |
3060 { | 3123 { |
3061 Widget* child = prpChild.get(); | 3124 Widget* child = prpChild.get(); |
3062 ASSERT(child != this && !child->parent()); | 3125 ASSERT(child != this && !child->parent()); |
3063 child->setParent(this); | 3126 child->setParent(this); |
3064 m_children.add(prpChild); | 3127 m_children.add(prpChild); |
3065 } | 3128 } |
3066 | 3129 |
3067 void FrameView::removeChildInternal(Widget* child) | 3130 void FrameView::removeChildInternal(Widget* child) |
3068 { | 3131 { |
3069 ASSERT(child->parent() == this); | 3132 ASSERT(child->parent() == this); |
(...skipping 30 matching lines...) Expand all Loading... | |
3100 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 3163 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
3101 // If the scrollbar has been marked as overlapping the window resizer, | 3164 // If the scrollbar has been marked as overlapping the window resizer, |
3102 // then its removal should reduce the count. | 3165 // then its removal should reduce the count. |
3103 if (m_verticalScrollbar->overlapsResizer()) | 3166 if (m_verticalScrollbar->overlapsResizer()) |
3104 adjustScrollbarsAvoidingResizerCount(-1); | 3167 adjustScrollbarsAvoidingResizerCount(-1); |
3105 removeChild(m_verticalScrollbar.get()); | 3168 removeChild(m_verticalScrollbar.get()); |
3106 m_verticalScrollbar = nullptr; | 3169 m_verticalScrollbar = nullptr; |
3107 } | 3170 } |
3108 } | 3171 } |
3109 | 3172 |
3110 PassRefPtr<Scrollbar> FrameView::createScrollbarInternal(ScrollbarOrientation or ientation) | 3173 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbarInternal(ScrollbarOr ientation orientation) |
3111 { | 3174 { |
3112 return Scrollbar::create(this, orientation, RegularScrollbar); | 3175 return Scrollbar::create(this, orientation, RegularScrollbar); |
3113 } | 3176 } |
3114 | 3177 |
3115 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve rticalMode, | 3178 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve rticalMode, |
3116 bool horizontalLock, bool verticalLock) | 3179 bool horizontalLock, bool verticalLock) |
3117 { | 3180 { |
3118 bool needsUpdate = false; | 3181 bool needsUpdate = false; |
3119 | 3182 |
3120 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc k) { | 3183 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc k) { |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3769 | 3832 |
3770 Widget::setFrameRect(newRect); | 3833 Widget::setFrameRect(newRect); |
3771 | 3834 |
3772 updateScrollbars(scrollOffsetDouble()); | 3835 updateScrollbars(scrollOffsetDouble()); |
3773 | 3836 |
3774 frameRectsChanged(); | 3837 frameRectsChanged(); |
3775 } | 3838 } |
3776 | 3839 |
3777 void FrameView::frameRectsChangedInternal() | 3840 void FrameView::frameRectsChangedInternal() |
3778 { | 3841 { |
3779 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); | 3842 ChildrenWidgetSet::const_iterator end = m_children.end(); |
3780 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin(); current != end; ++current) | 3843 for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current != end; ++current) |
3781 (*current)->frameRectsChanged(); | 3844 (*current)->frameRectsChanged(); |
3782 } | 3845 } |
3783 | 3846 |
3784 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro llbar) | 3847 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro llbar) |
3785 { | 3848 { |
3786 if (!graphicsLayer || !scrollbar) | 3849 if (!graphicsLayer || !scrollbar) |
3787 return; | 3850 return; |
3788 | 3851 |
3789 IntRect scrollbarRect = scrollbar->frameRect(); | 3852 IntRect scrollbarRect = scrollbar->frameRect(); |
3790 graphicsLayer->setPosition(scrollbarRect.location()); | 3853 graphicsLayer->setPosition(scrollbarRect.location()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4107 void FrameView::setParentVisible(bool visible) | 4170 void FrameView::setParentVisible(bool visible) |
4108 { | 4171 { |
4109 if (isParentVisible() == visible) | 4172 if (isParentVisible() == visible) |
4110 return; | 4173 return; |
4111 | 4174 |
4112 Widget::setParentVisible(visible); | 4175 Widget::setParentVisible(visible); |
4113 | 4176 |
4114 if (!isSelfVisible()) | 4177 if (!isSelfVisible()) |
4115 return; | 4178 return; |
4116 | 4179 |
4117 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 4180 ChildrenWidgetSet::const_iterator end = m_children.end(); |
4118 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it) | 4181 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; + +it) |
4119 (*it)->setParentVisible(visible); | 4182 (*it)->setParentVisible(visible); |
4120 } | 4183 } |
4121 | 4184 |
4122 void FrameView::show() | 4185 void FrameView::show() |
4123 { | 4186 { |
4124 if (!isSelfVisible()) { | 4187 if (!isSelfVisible()) { |
4125 setSelfVisible(true); | 4188 setSelfVisible(true); |
4126 if (isParentVisible()) { | 4189 if (isParentVisible()) { |
4127 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 4190 ChildrenWidgetSet::const_iterator end = m_children.end(); |
4128 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it) | 4191 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it ! = end; ++it) |
4129 (*it)->setParentVisible(true); | 4192 (*it)->setParentVisible(true); |
4130 } | 4193 } |
4131 } | 4194 } |
4132 | 4195 |
4133 Widget::show(); | 4196 Widget::show(); |
4134 } | 4197 } |
4135 | 4198 |
4136 void FrameView::hide() | 4199 void FrameView::hide() |
4137 { | 4200 { |
4138 if (isSelfVisible()) { | 4201 if (isSelfVisible()) { |
4139 if (isParentVisible()) { | 4202 if (isParentVisible()) { |
4140 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 4203 ChildrenWidgetSet::const_iterator end = m_children.end(); |
4141 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it) | 4204 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it ! = end; ++it) |
4142 (*it)->setParentVisible(false); | 4205 (*it)->setParentVisible(false); |
4143 } | 4206 } |
4144 setSelfVisible(false); | 4207 setSelfVisible(false); |
4145 } | 4208 } |
4146 | 4209 |
4147 Widget::hide(); | 4210 Widget::hide(); |
4148 } | 4211 } |
4149 | 4212 |
4150 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) | 4213 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) |
4151 { | 4214 { |
(...skipping 20 matching lines...) Expand all Loading... | |
4172 return; | 4235 return; |
4173 | 4236 |
4174 ScrollableArea::setScrollOrigin(origin); | 4237 ScrollableArea::setScrollOrigin(origin); |
4175 | 4238 |
4176 // Update if the scroll origin changes, since our position will be different if the content size did not change. | 4239 // Update if the scroll origin changes, since our position will be different if the content size did not change. |
4177 if (updatePositionAtAll && updatePositionSynchronously) | 4240 if (updatePositionAtAll && updatePositionSynchronously) |
4178 updateScrollbars(scrollOffsetDouble()); | 4241 updateScrollbars(scrollOffsetDouble()); |
4179 } | 4242 } |
4180 | 4243 |
4181 } // namespace blink | 4244 } // namespace blink |
OLD | NEW |