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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 , m_viewportRenderer(0) | 115 , m_viewportRenderer(0) |
116 , m_wasScrolledByUser(false) | 116 , m_wasScrolledByUser(false) |
117 , m_inProgrammaticScroll(false) | 117 , m_inProgrammaticScroll(false) |
118 , m_safeToPropagateScrollToParent(true) | 118 , m_safeToPropagateScrollToParent(true) |
119 , m_isTrackingPaintInvalidations(false) | 119 , m_isTrackingPaintInvalidations(false) |
120 , m_scrollCorner(nullptr) | 120 , m_scrollCorner(nullptr) |
121 , m_visibleContentScaleFactor(1) | 121 , m_visibleContentScaleFactor(1) |
122 , m_inputEventsScaleFactorForEmulation(1) | 122 , m_inputEventsScaleFactorForEmulation(1) |
123 , m_layoutSizeFixedToFrameSize(true) | 123 , m_layoutSizeFixedToFrameSize(true) |
124 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) | 124 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
| 125 , m_topControlsViewportAdjustment(0) |
125 , m_needsUpdateWidgetPositions(false) | 126 , m_needsUpdateWidgetPositions(false) |
126 , m_topControlsViewportAdjustment(0) | 127 #if ENABLE(OILPAN) && ENABLE(ASSERT) |
| 128 , m_hasBeenDisposed(false) |
| 129 #endif |
127 { | 130 { |
128 ASSERT(m_frame); | 131 ASSERT(m_frame); |
129 init(); | 132 init(); |
130 | 133 |
131 if (!m_frame->isMainFrame()) | 134 if (!m_frame->isMainFrame()) |
132 return; | 135 return; |
133 | 136 |
134 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); | 137 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); |
135 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); | 138 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); |
136 } | 139 } |
137 | 140 |
138 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) | 141 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) |
139 { | 142 { |
140 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 143 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); |
141 view->show(); | 144 view->show(); |
142 return view.release(); | 145 return view.release(); |
143 } | 146 } |
144 | 147 |
145 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia
lSize) | 148 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int
Size& initialSize) |
146 { | 149 { |
147 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 150 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); |
148 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 151 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
149 view->setLayoutSizeInternal(initialSize); | 152 view->setLayoutSizeInternal(initialSize); |
150 | 153 |
151 view->show(); | 154 view->show(); |
152 return view.release(); | 155 return view.release(); |
153 } | 156 } |
154 | 157 |
155 FrameView::~FrameView() | 158 FrameView::~FrameView() |
156 { | 159 { |
| 160 #if ENABLE(OILPAN) |
| 161 ASSERT(m_hasBeenDisposed); |
| 162 #else |
| 163 // Verify that the LocalFrame has a different FrameView or |
| 164 // that it is being detached and destructed. |
| 165 ASSERT(frame().view() != this || !renderView()); |
| 166 dispose(); |
| 167 #endif |
| 168 } |
| 169 |
| 170 void FrameView::dispose() |
| 171 { |
157 if (m_postLayoutTasksTimer.isActive()) | 172 if (m_postLayoutTasksTimer.isActive()) |
158 m_postLayoutTasksTimer.stop(); | 173 m_postLayoutTasksTimer.stop(); |
159 | 174 |
160 if (m_didScrollTimer.isActive()) | 175 if (m_didScrollTimer.isActive()) |
161 m_didScrollTimer.stop(); | 176 m_didScrollTimer.stop(); |
162 | 177 |
163 removeFromAXObjectCache(); | 178 removeFromAXObjectCache(); |
164 | 179 |
165 // Custom scrollbars should already be destroyed at this point | 180 // Custom scrollbars should already be destroyed at this point |
166 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar()
); | 181 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar()
); |
167 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); | 182 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); |
168 | 183 |
169 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we
lose the connection to the HostWindow. | 184 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we
lose the connection to the HostWindow. |
170 setHasVerticalScrollbar(false); | 185 setHasVerticalScrollbar(false); |
171 | 186 |
172 ASSERT(!m_scrollCorner); | 187 ASSERT(!m_scrollCorner); |
173 | 188 |
174 ASSERT(m_frame); | |
175 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); | |
176 // FIXME: Do we need to do something here for OOPI? | 189 // FIXME: Do we need to do something here for OOPI? |
177 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 190 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
178 if (ownerElement && ownerElement->ownedWidget() == this) | 191 if (ownerElement && ownerElement->ownedWidget() == this) |
179 ownerElement->setWidget(nullptr); | 192 ownerElement->setWidget(nullptr); |
| 193 |
| 194 disposeAutoSizeInfo(); |
| 195 #if ENABLE(OILPAN) && ENABLE(ASSERT) |
| 196 m_hasBeenDisposed = true; |
| 197 #endif |
| 198 } |
| 199 |
| 200 void FrameView::trace(Visitor* visitor) |
| 201 { |
| 202 #if ENABLE(OILPAN) |
| 203 visitor->trace(m_widgetUpdateSet); |
| 204 visitor->trace(m_widgets); |
| 205 visitor->trace(m_frame); |
| 206 visitor->trace(m_nodeToDraw); |
| 207 visitor->trace(m_maintainScrollPositionAnchor); |
| 208 visitor->trace(m_scrollCorner); |
| 209 visitor->trace(m_autoSizeInfo); |
| 210 #endif |
| 211 ScrollView::trace(visitor); |
180 } | 212 } |
181 | 213 |
182 void FrameView::reset() | 214 void FrameView::reset() |
183 { | 215 { |
184 m_hasPendingLayout = false; | 216 m_hasPendingLayout = false; |
185 m_layoutSubtreeRoot = 0; | 217 m_layoutSubtreeRoot = 0; |
186 m_doFullPaintInvalidation = false; | 218 m_doFullPaintInvalidation = false; |
187 m_layoutSchedulingEnabled = true; | 219 m_layoutSchedulingEnabled = true; |
188 m_inPerformLayout = false; | 220 m_inPerformLayout = false; |
189 m_canInvalidatePaintDuringPerformLayout = false; | 221 m_canInvalidatePaintDuringPerformLayout = false; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 277 |
246 detachCustomScrollbars(); | 278 detachCustomScrollbars(); |
247 // When the view is no longer associated with a frame, it needs to be remove
d from the ax object cache | 279 // When the view is no longer associated with a frame, it needs to be remove
d from the ax object cache |
248 // right now, otherwise it won't be able to reach the topDocument()'s axObje
ct cache later. | 280 // right now, otherwise it won't be able to reach the topDocument()'s axObje
ct cache later. |
249 removeFromAXObjectCache(); | 281 removeFromAXObjectCache(); |
250 | 282 |
251 if (m_frame->page()) { | 283 if (m_frame->page()) { |
252 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) | 284 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) |
253 scrollingCoordinator->willDestroyScrollableArea(this); | 285 scrollingCoordinator->willDestroyScrollableArea(this); |
254 } | 286 } |
| 287 |
| 288 #if ENABLE(OILPAN) |
| 289 // FIXME: once/if dust settles, do this always (non-Oilpan)? |
| 290 // |
| 291 // FIXME: Oilpan: is this safe to dispose() if there are FrameView protectio
ns on the stack? |
| 292 dispose(); |
| 293 #endif |
255 } | 294 } |
256 | 295 |
257 void FrameView::detachCustomScrollbars() | 296 void FrameView::detachCustomScrollbars() |
258 { | 297 { |
259 Scrollbar* horizontalBar = horizontalScrollbar(); | 298 Scrollbar* horizontalBar = horizontalScrollbar(); |
260 if (horizontalBar && horizontalBar->isCustomScrollbar()) | 299 if (horizontalBar && horizontalBar->isCustomScrollbar()) |
261 setHasHorizontalScrollbar(false); | 300 setHasHorizontalScrollbar(false); |
262 | 301 |
263 Scrollbar* verticalBar = verticalScrollbar(); | 302 Scrollbar* verticalBar = verticalScrollbar(); |
264 if (verticalBar && verticalBar->isCustomScrollbar()) | 303 if (verticalBar && verticalBar->isCustomScrollbar()) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. | 439 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. |
401 RenderPart* frameRenderer = m_frame->ownerRenderer(); | 440 RenderPart* frameRenderer = m_frame->ownerRenderer(); |
402 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) { | 441 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) { |
403 customScrollbarFrame = m_frame.get(); | 442 customScrollbarFrame = m_frame.get(); |
404 return true; | 443 return true; |
405 } | 444 } |
406 | 445 |
407 return false; | 446 return false; |
408 } | 447 } |
409 | 448 |
410 PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientatio
n) | 449 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientatio
n orientation) |
411 { | 450 { |
412 Element* customScrollbarElement = 0; | 451 Element* customScrollbarElement = 0; |
413 LocalFrame* customScrollbarFrame = 0; | 452 LocalFrame* customScrollbarFrame = 0; |
414 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) | 453 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) |
415 return RenderScrollbar::createCustomScrollbar(this, orientation, customS
crollbarElement, customScrollbarFrame); | 454 return RenderScrollbar::createCustomScrollbar(this, orientation, customS
crollbarElement, customScrollbarFrame); |
416 | 455 |
417 // Nobody set a custom style, so we just use a native scrollbar. | 456 // Nobody set a custom style, so we just use a native scrollbar. |
418 return ScrollView::createScrollbar(orientation); | 457 return ScrollView::createScrollbar(orientation); |
419 } | 458 } |
420 | 459 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) | 710 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) |
672 return; | 711 return; |
673 | 712 |
674 // If the embedded SVG document appears the first time, the ownerRenderer ha
s already finished | 713 // If the embedded SVG document appears the first time, the ownerRenderer ha
s already finished |
675 // layout without knowing about the existence of the embedded SVG document,
because RenderReplaced | 714 // layout without knowing about the existence of the embedded SVG document,
because RenderReplaced |
676 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before | 715 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before |
677 // bothering to lay out the SVG document, mark the ownerRenderer needing lay
out and ask its | 716 // bothering to lay out the SVG document, mark the ownerRenderer needing lay
out and ask its |
678 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere
r) carries the | 717 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere
r) carries the |
679 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying | 718 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying |
680 // out for the first time, or when the RenderSVGRoot size has changed dynami
cally (eg. via <script>). | 719 // out for the first time, or when the RenderSVGRoot size has changed dynami
cally (eg. via <script>). |
681 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); | 720 RefPtrWillBeRawPtr<FrameView> frameView = ownerRenderer->frame()->view(); |
682 | 721 |
683 // Mark the owner renderer as needing layout. | 722 // Mark the owner renderer as needing layout. |
684 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 723 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
685 | 724 |
686 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 725 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
687 ASSERT(frameView); | 726 ASSERT(frameView); |
688 frameView->layout(); | 727 frameView->layout(); |
689 } | 728 } |
690 | 729 |
691 void FrameView::performPreLayoutTasks() | 730 void FrameView::performPreLayoutTasks() |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 | 822 |
784 ScriptForbiddenScope forbidScript; | 823 ScriptForbiddenScope forbidScript; |
785 | 824 |
786 if (isInPerformLayout() || !m_frame->document()->isActive()) | 825 if (isInPerformLayout() || !m_frame->document()->isActive()) |
787 return; | 826 return; |
788 | 827 |
789 TRACE_EVENT0("blink", "FrameView::layout"); | 828 TRACE_EVENT0("blink", "FrameView::layout"); |
790 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 829 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
791 | 830 |
792 // Protect the view from being deleted during layout (in recalcStyle) | 831 // Protect the view from being deleted during layout (in recalcStyle) |
793 RefPtr<FrameView> protector(this); | 832 RefPtrWillBeRawPtr<FrameView> protector(this); |
794 | 833 |
795 // Every scroll that happens during layout is programmatic. | 834 // Every scroll that happens during layout is programmatic. |
796 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 835 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
797 | 836 |
798 if (m_autoSizeInfo) | 837 if (m_autoSizeInfo) |
799 m_autoSizeInfo->autoSizeIfNeeded(); | 838 m_autoSizeInfo->autoSizeIfNeeded(); |
800 | 839 |
801 m_hasPendingLayout = false; | 840 m_hasPendingLayout = false; |
802 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); | 841 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
803 | 842 |
804 RELEASE_ASSERT(!isPainting()); | 843 RELEASE_ASSERT(!isPainting()); |
805 | 844 |
806 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); | 845 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); |
807 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 846 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
808 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 847 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
809 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout
(m_frame.get()); | 848 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout
(m_frame.get()); |
810 | 849 |
811 if (!allowSubtree && isSubtreeLayout()) { | 850 if (!allowSubtree && isSubtreeLayout()) { |
812 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 851 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
813 m_layoutSubtreeRoot = 0; | 852 m_layoutSubtreeRoot = 0; |
814 } | 853 } |
815 | 854 |
816 performPreLayoutTasks(); | 855 performPreLayoutTasks(); |
817 | 856 |
| 857 #if !ENABLE(OILPAN) |
818 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, | 858 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, |
819 // so there's no point to continuing to layout | 859 // so there's no point to continuing to layout |
820 if (protector->hasOneRef()) | 860 if (protector->hasOneRef()) |
821 return; | 861 return; |
| 862 #endif |
822 | 863 |
823 Document* document = m_frame->document(); | 864 Document* document = m_frame->document(); |
824 bool inSubtreeLayout = isSubtreeLayout(); | 865 bool inSubtreeLayout = isSubtreeLayout(); |
825 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); | 866 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); |
826 if (!rootForThisLayout) { | 867 if (!rootForThisLayout) { |
827 // FIXME: Do we need to set m_size here? | 868 // FIXME: Do we need to set m_size here? |
828 ASSERT_NOT_REACHED(); | 869 ASSERT_NOT_REACHED(); |
829 return; | 870 return; |
830 } | 871 } |
831 | 872 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl
lImageResourcePriorities(); | 1534 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl
lImageResourcePriorities(); |
1494 } | 1535 } |
1495 } | 1536 } |
1496 | 1537 |
1497 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() | 1538 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
1498 { | 1539 { |
1499 // Nothing to do after scrolling if there are no fixed position elements. | 1540 // Nothing to do after scrolling if there are no fixed position elements. |
1500 if (!hasViewportConstrainedObjects()) | 1541 if (!hasViewportConstrainedObjects()) |
1501 return; | 1542 return; |
1502 | 1543 |
1503 RefPtr<FrameView> protect(this); | 1544 RefPtrWillBeRawPtr<FrameView> protect(this); |
1504 | 1545 |
1505 // If there fixed position elements, scrolling may cause compositing layers
to change. | 1546 // If there fixed position elements, scrolling may cause compositing layers
to change. |
1506 // Update widget and layer positions after scrolling, but only if we're not
inside of | 1547 // Update widget and layer positions after scrolling, but only if we're not
inside of |
1507 // layout. | 1548 // layout. |
1508 if (!m_nestedLayoutCount) { | 1549 if (!m_nestedLayoutCount) { |
1509 updateWidgetPositions(); | 1550 updateWidgetPositions(); |
1510 if (RenderView* renderView = this->renderView()) | 1551 if (RenderView* renderView = this->renderView()) |
1511 renderView->layer()->setNeedsCompositingInputsUpdate(); | 1552 renderView->layer()->setNeedsCompositingInputsUpdate(); |
1512 } | 1553 } |
1513 } | 1554 } |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 // FIXME: Do we really need to prevent this? | 1916 // FIXME: Do we really need to prevent this? |
1876 m_widgetUpdateSet.remove(&object); | 1917 m_widgetUpdateSet.remove(&object); |
1877 } | 1918 } |
1878 | 1919 |
1879 return m_widgetUpdateSet.isEmpty(); | 1920 return m_widgetUpdateSet.isEmpty(); |
1880 } | 1921 } |
1881 | 1922 |
1882 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 1923 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
1883 { | 1924 { |
1884 ASSERT(!isInPerformLayout()); | 1925 ASSERT(!isInPerformLayout()); |
1885 RefPtr<FrameView> protect(this); | 1926 RefPtrWillBeRawPtr<FrameView> protect(this); |
1886 m_updateWidgetsTimer.stop(); | 1927 m_updateWidgetsTimer.stop(); |
1887 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 1928 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
1888 if (updateWidgets()) | 1929 if (updateWidgets()) |
1889 return; | 1930 return; |
1890 } | 1931 } |
1891 } | 1932 } |
1892 | 1933 |
1893 void FrameView::flushAnyPendingPostLayoutTasks() | 1934 void FrameView::flushAnyPendingPostLayoutTasks() |
1894 { | 1935 { |
1895 ASSERT(!isInPerformLayout()); | 1936 ASSERT(!isInPerformLayout()); |
(...skipping 12 matching lines...) Expand all Loading... |
1908 } | 1949 } |
1909 | 1950 |
1910 void FrameView::performPostLayoutTasks() | 1951 void FrameView::performPostLayoutTasks() |
1911 { | 1952 { |
1912 // FIXME: We can reach here, even when the page is not active! | 1953 // FIXME: We can reach here, even when the page is not active! |
1913 // http/tests/inspector/elements/html-link-import.html and many other | 1954 // http/tests/inspector/elements/html-link-import.html and many other |
1914 // tests hit that case. | 1955 // tests hit that case. |
1915 // We should ASSERT(isActive()); or at least return early if we can! | 1956 // We should ASSERT(isActive()); or at least return early if we can! |
1916 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. | 1957 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. |
1917 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); | 1958 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); |
1918 RefPtr<FrameView> protect(this); | 1959 RefPtrWillBeRawPtr<FrameView> protect(this); |
1919 | 1960 |
1920 m_postLayoutTasksTimer.stop(); | 1961 m_postLayoutTasksTimer.stop(); |
1921 | 1962 |
1922 m_frame->selection().setCaretRectNeedsUpdate(); | 1963 m_frame->selection().setCaretRectNeedsUpdate(); |
1923 | 1964 |
1924 { | 1965 { |
1925 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l
ayers.html | 1966 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l
ayers.html |
1926 DisableCompositingQueryAsserts disabler; | 1967 DisableCompositingQueryAsserts disabler; |
1927 m_frame->selection().updateAppearance(); | 1968 m_frame->selection().updateAppearance(); |
1928 } | 1969 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2355 if (htmlElement && htmlElement->renderer()) | 2396 if (htmlElement && htmlElement->renderer()) |
2356 result = result.blend(htmlElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); | 2397 result = result.blend(htmlElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); |
2357 if (bodyElement && bodyElement->renderer()) | 2398 if (bodyElement && bodyElement->renderer()) |
2358 result = result.blend(bodyElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); | 2399 result = result.blend(bodyElement->renderer()->style()->visitedDependent
Color(CSSPropertyBackgroundColor)); |
2359 | 2400 |
2360 return result; | 2401 return result; |
2361 } | 2402 } |
2362 | 2403 |
2363 bool FrameView::hasCustomScrollbars() const | 2404 bool FrameView::hasCustomScrollbars() const |
2364 { | 2405 { |
2365 const HashSet<RefPtr<Widget> >* viewChildren = children(); | 2406 const WillBeHeapHashSet<RefPtrWillBeMember<Widget> >* viewChildren = childre
n(); |
2366 HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); | 2407 WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator end = viewChi
ldren->end(); |
2367 for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(
); current != end; ++current) { | 2408 for (WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator current
= viewChildren->begin(); current != end; ++current) { |
2368 Widget* widget = current->get(); | 2409 Widget* widget = current->get(); |
2369 if (widget->isFrameView()) { | 2410 if (widget->isFrameView()) { |
2370 if (toFrameView(widget)->hasCustomScrollbars()) | 2411 if (toFrameView(widget)->hasCustomScrollbars()) |
2371 return true; | 2412 return true; |
2372 } else if (widget->isScrollbar()) { | 2413 } else if (widget->isScrollbar()) { |
2373 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); | 2414 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); |
2374 if (scrollbar->isCustomScrollbar()) | 2415 if (scrollbar->isCustomScrollbar()) |
2375 return true; | 2416 return true; |
2376 } | 2417 } |
2377 } | 2418 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2536 return; | 2577 return; |
2537 | 2578 |
2538 m_needsUpdateWidgetPositions = false; | 2579 m_needsUpdateWidgetPositions = false; |
2539 | 2580 |
2540 updateWidgetPositions(); | 2581 updateWidgetPositions(); |
2541 } | 2582 } |
2542 | 2583 |
2543 void FrameView::updateLayoutAndStyleForPainting() | 2584 void FrameView::updateLayoutAndStyleForPainting() |
2544 { | 2585 { |
2545 // Updating layout can run script, which can tear down the FrameView. | 2586 // Updating layout can run script, which can tear down the FrameView. |
2546 RefPtr<FrameView> protector(this); | 2587 RefPtrWillBeRawPtr<FrameView> protector(this); |
2547 | 2588 |
2548 updateLayoutAndStyleIfNeededRecursive(); | 2589 updateLayoutAndStyleIfNeededRecursive(); |
2549 | 2590 |
2550 updateWidgetPositionsIfNeeded(); | 2591 updateWidgetPositionsIfNeeded(); |
2551 | 2592 |
2552 RenderView* view = renderView(); | 2593 RenderView* view = renderView(); |
2553 if (view) { | 2594 if (view) { |
2554 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "frame", m_frame.get()); | 2595 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "frame", m_frame.get()); |
2555 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. | 2596 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. |
2556 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); | 2597 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); |
(...skipping 27 matching lines...) Expand all Loading... |
2584 // region but then become included later by the second frame adding rects to
the dirty region | 2625 // region but then become included later by the second frame adding rects to
the dirty region |
2585 // when it lays out. | 2626 // when it lays out. |
2586 | 2627 |
2587 m_frame->document()->updateRenderTreeIfNeeded(); | 2628 m_frame->document()->updateRenderTreeIfNeeded(); |
2588 | 2629 |
2589 if (needsLayout()) | 2630 if (needsLayout()) |
2590 layout(); | 2631 layout(); |
2591 | 2632 |
2592 // FIXME: Calling layout() shouldn't trigger scripe execution or have any | 2633 // FIXME: Calling layout() shouldn't trigger scripe execution or have any |
2593 // observable effects on the frame tree but we're not quite there yet. | 2634 // observable effects on the frame tree but we're not quite there yet. |
2594 Vector<RefPtr<FrameView> > frameViews; | 2635 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; |
2595 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 2636 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
2596 if (!child->isLocalFrame()) | 2637 if (!child->isLocalFrame()) |
2597 continue; | 2638 continue; |
2598 if (FrameView* view = toLocalFrame(child)->view()) | 2639 if (FrameView* view = toLocalFrame(child)->view()) |
2599 frameViews.append(view); | 2640 frameViews.append(view); |
2600 } | 2641 } |
2601 | 2642 |
2602 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); | 2643 const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frame
Views.end(); |
2603 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end
; ++it) | 2644 for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameVi
ews.begin(); it != end; ++it) |
2604 (*it)->updateLayoutAndStyleIfNeededRecursive(); | 2645 (*it)->updateLayoutAndStyleIfNeededRecursive(); |
2605 | 2646 |
2606 // When an <iframe> gets composited, it triggers an extra style recalc in it
s containing FrameView. | 2647 // When an <iframe> gets composited, it triggers an extra style recalc in it
s containing FrameView. |
2607 // To avoid pushing an invalid tree for display, we have to check for this c
ase and do another | 2648 // To avoid pushing an invalid tree for display, we have to check for this c
ase and do another |
2608 // style recalc. The extra style recalc needs to happen after our child <ifr
ames> were updated. | 2649 // style recalc. The extra style recalc needs to happen after our child <ifr
ames> were updated. |
2609 // FIXME: We shouldn't be triggering an extra style recalc in the first plac
e. | 2650 // FIXME: We shouldn't be triggering an extra style recalc in the first plac
e. |
2610 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2651 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
2611 m_frame->document()->updateRenderTreeIfNeeded(); | 2652 m_frame->document()->updateRenderTreeIfNeeded(); |
2612 | 2653 |
2613 if (needsLayout()) | 2654 if (needsLayout()) |
(...skipping 20 matching lines...) Expand all Loading... |
2634 if (!child->isLocalFrame()) | 2675 if (!child->isLocalFrame()) |
2635 continue; | 2676 continue; |
2636 | 2677 |
2637 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); | 2678 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); |
2638 } | 2679 } |
2639 } | 2680 } |
2640 | 2681 |
2641 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz
e) | 2682 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz
e) |
2642 { | 2683 { |
2643 if (!m_autoSizeInfo) | 2684 if (!m_autoSizeInfo) |
2644 m_autoSizeInfo = adoptPtr(new FrameViewAutoSizeInfo(this)); | 2685 m_autoSizeInfo = FrameViewAutoSizeInfo::create(this); |
2645 | 2686 |
2646 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); | 2687 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); |
| 2688 setLayoutSizeFixedToFrameSize(true); |
| 2689 setNeedsLayout(); |
| 2690 scheduleRelayout(); |
| 2691 } |
| 2692 |
| 2693 void FrameView::disposeAutoSizeInfo() |
| 2694 { |
| 2695 if (!m_autoSizeInfo) |
| 2696 return; |
| 2697 |
| 2698 setLayoutSizeFixedToFrameSize(false); |
| 2699 setNeedsLayout(); |
| 2700 scheduleRelayout(); |
| 2701 |
| 2702 // Since autosize mode forces the scrollbar mode, change them to being auto. |
| 2703 setVerticalScrollbarLock(false); |
| 2704 setHorizontalScrollbarLock(false); |
| 2705 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); |
| 2706 m_autoSizeInfo.clear(); |
2647 } | 2707 } |
2648 | 2708 |
2649 void FrameView::forceLayout(bool allowSubtree) | 2709 void FrameView::forceLayout(bool allowSubtree) |
2650 { | 2710 { |
2651 layout(allowSubtree); | 2711 layout(allowSubtree); |
2652 } | 2712 } |
2653 | 2713 |
2654 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS
ize& originalPageSize, float maximumShrinkFactor) | 2714 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS
ize& originalPageSize, float maximumShrinkFactor) |
2655 { | 2715 { |
2656 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri
ck to see | 2716 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri
ck to see |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3036 IntSize visibleSize = expandedIntSize(visibleContentSizeF); | 3096 IntSize visibleSize = expandedIntSize(visibleContentSizeF); |
3037 | 3097 |
3038 IntPoint maximumOffset( | 3098 IntPoint maximumOffset( |
3039 contentsWidth() - visibleSize.width() - scrollOrigin().x(), | 3099 contentsWidth() - visibleSize.width() - scrollOrigin().x(), |
3040 contentsHeight() - visibleSize.height() - scrollOrigin().y()); | 3100 contentsHeight() - visibleSize.height() - scrollOrigin().y()); |
3041 maximumOffset.clampNegativeToZero(); | 3101 maximumOffset.clampNegativeToZero(); |
3042 return maximumOffset; | 3102 return maximumOffset; |
3043 } | 3103 } |
3044 | 3104 |
3045 } // namespace blink | 3105 } // namespace blink |
OLD | NEW |