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 ChildrenWidgetSet* viewChildren = children(); |
2378 HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); | 2422 ChildrenWidgetSet::const_iterator end = viewChildren->end(); |
2379 for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(
); current != end; ++current) { | 2423 for (ChildrenWidgetSet::const_iterator current = viewChildren->begin(); curr
ent != 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 visibleContentSizeF.scale(1 / visibleContentScaleFactor()); | 3087 visibleContentSizeF.scale(1 / visibleContentScaleFactor()); |
3025 IntSize visibleSize = expandedIntSize(visibleContentSizeF); | 3088 IntSize visibleSize = expandedIntSize(visibleContentSizeF); |
3026 | 3089 |
3027 IntPoint maximumOffset( | 3090 IntPoint maximumOffset( |
3028 contentsWidth() - visibleSize.width() - scrollOrigin().x(), | 3091 contentsWidth() - visibleSize.width() - scrollOrigin().x(), |
3029 contentsHeight() - visibleSize.height() - scrollOrigin().y()); | 3092 contentsHeight() - visibleSize.height() - scrollOrigin().y()); |
3030 maximumOffset.clampNegativeToZero(); | 3093 maximumOffset.clampNegativeToZero(); |
3031 return maximumOffset; | 3094 return maximumOffset; |
3032 } | 3095 } |
3033 | 3096 |
3034 void FrameView::addChild(PassRefPtr<Widget> prpChild) | 3097 void FrameView::addChild(PassRefPtrWillBeRawPtr<Widget> prpChild) |
3035 { | 3098 { |
3036 Widget* child = prpChild.get(); | 3099 Widget* child = prpChild.get(); |
3037 ASSERT(child != this && !child->parent()); | 3100 ASSERT(child != this && !child->parent()); |
3038 child->setParent(this); | 3101 child->setParent(this); |
3039 m_children.add(prpChild); | 3102 m_children.add(prpChild); |
3040 } | 3103 } |
3041 | 3104 |
3042 void FrameView::removeChildInternal(Widget* child) | 3105 void FrameView::removeChildInternal(Widget* child) |
3043 { | 3106 { |
3044 ASSERT(child->parent() == this); | 3107 ASSERT(child->parent() == this); |
(...skipping 30 matching lines...) Expand all Loading... |
3075 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 3138 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
3076 // If the scrollbar has been marked as overlapping the window resizer, | 3139 // If the scrollbar has been marked as overlapping the window resizer, |
3077 // then its removal should reduce the count. | 3140 // then its removal should reduce the count. |
3078 if (m_verticalScrollbar->overlapsResizer()) | 3141 if (m_verticalScrollbar->overlapsResizer()) |
3079 adjustScrollbarsAvoidingResizerCount(-1); | 3142 adjustScrollbarsAvoidingResizerCount(-1); |
3080 removeChild(m_verticalScrollbar.get()); | 3143 removeChild(m_verticalScrollbar.get()); |
3081 m_verticalScrollbar = nullptr; | 3144 m_verticalScrollbar = nullptr; |
3082 } | 3145 } |
3083 } | 3146 } |
3084 | 3147 |
3085 PassRefPtr<Scrollbar> FrameView::createScrollbarInternal(ScrollbarOrientation or
ientation) | 3148 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbarInternal(ScrollbarOr
ientation orientation) |
3086 { | 3149 { |
3087 return Scrollbar::create(this, orientation, RegularScrollbar); | 3150 return Scrollbar::create(this, orientation, RegularScrollbar); |
3088 } | 3151 } |
3089 | 3152 |
3090 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve
rticalMode, | 3153 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode ve
rticalMode, |
3091 bool horizontalLock, bool verticalLock) | 3154 bool horizontalLock, bool verticalLock) |
3092 { | 3155 { |
3093 bool needsUpdate = false; | 3156 bool needsUpdate = false; |
3094 | 3157 |
3095 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc
k) { | 3158 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc
k) { |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3744 | 3807 |
3745 Widget::setFrameRect(newRect); | 3808 Widget::setFrameRect(newRect); |
3746 | 3809 |
3747 updateScrollbars(scrollOffsetDouble()); | 3810 updateScrollbars(scrollOffsetDouble()); |
3748 | 3811 |
3749 frameRectsChanged(); | 3812 frameRectsChanged(); |
3750 } | 3813 } |
3751 | 3814 |
3752 void FrameView::frameRectsChangedInternal() | 3815 void FrameView::frameRectsChangedInternal() |
3753 { | 3816 { |
3754 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); | 3817 ChildrenWidgetSet::const_iterator end = m_children.end(); |
3755 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) | 3818 for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current
!= end; ++current) |
3756 (*current)->frameRectsChanged(); | 3819 (*current)->frameRectsChanged(); |
3757 } | 3820 } |
3758 | 3821 |
3759 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) | 3822 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) |
3760 { | 3823 { |
3761 if (!graphicsLayer || !scrollbar) | 3824 if (!graphicsLayer || !scrollbar) |
3762 return; | 3825 return; |
3763 | 3826 |
3764 IntRect scrollbarRect = scrollbar->frameRect(); | 3827 IntRect scrollbarRect = scrollbar->frameRect(); |
3765 graphicsLayer->setPosition(scrollbarRect.location()); | 3828 graphicsLayer->setPosition(scrollbarRect.location()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4082 void FrameView::setParentVisible(bool visible) | 4145 void FrameView::setParentVisible(bool visible) |
4083 { | 4146 { |
4084 if (isParentVisible() == visible) | 4147 if (isParentVisible() == visible) |
4085 return; | 4148 return; |
4086 | 4149 |
4087 Widget::setParentVisible(visible); | 4150 Widget::setParentVisible(visible); |
4088 | 4151 |
4089 if (!isSelfVisible()) | 4152 if (!isSelfVisible()) |
4090 return; | 4153 return; |
4091 | 4154 |
4092 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 4155 ChildrenWidgetSet::const_iterator end = m_children.end(); |
4093 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end;
++it) | 4156 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; +
+it) |
4094 (*it)->setParentVisible(visible); | 4157 (*it)->setParentVisible(visible); |
4095 } | 4158 } |
4096 | 4159 |
4097 void FrameView::show() | 4160 void FrameView::show() |
4098 { | 4161 { |
4099 if (!isSelfVisible()) { | 4162 if (!isSelfVisible()) { |
4100 setSelfVisible(true); | 4163 setSelfVisible(true); |
4101 if (isParentVisible()) { | 4164 if (isParentVisible()) { |
4102 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 4165 ChildrenWidgetSet::const_iterator end = m_children.end(); |
4103 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it
!= end; ++it) | 4166 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) |
4104 (*it)->setParentVisible(true); | 4167 (*it)->setParentVisible(true); |
4105 } | 4168 } |
4106 } | 4169 } |
4107 | 4170 |
4108 Widget::show(); | 4171 Widget::show(); |
4109 } | 4172 } |
4110 | 4173 |
4111 void FrameView::hide() | 4174 void FrameView::hide() |
4112 { | 4175 { |
4113 if (isSelfVisible()) { | 4176 if (isSelfVisible()) { |
4114 if (isParentVisible()) { | 4177 if (isParentVisible()) { |
4115 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 4178 ChildrenWidgetSet::const_iterator end = m_children.end(); |
4116 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it
!= end; ++it) | 4179 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) |
4117 (*it)->setParentVisible(false); | 4180 (*it)->setParentVisible(false); |
4118 } | 4181 } |
4119 setSelfVisible(false); | 4182 setSelfVisible(false); |
4120 } | 4183 } |
4121 | 4184 |
4122 Widget::hide(); | 4185 Widget::hide(); |
4123 } | 4186 } |
4124 | 4187 |
4125 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) | 4188 void FrameView::addPanScrollIcon(const IntPoint& iconPosition) |
4126 { | 4189 { |
(...skipping 20 matching lines...) Expand all Loading... |
4147 return; | 4210 return; |
4148 | 4211 |
4149 ScrollableArea::setScrollOrigin(origin); | 4212 ScrollableArea::setScrollOrigin(origin); |
4150 | 4213 |
4151 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 4214 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
4152 if (updatePositionAtAll && updatePositionSynchronously) | 4215 if (updatePositionAtAll && updatePositionSynchronously) |
4153 updateScrollbars(scrollOffsetDouble()); | 4216 updateScrollbars(scrollOffsetDouble()); |
4154 } | 4217 } |
4155 | 4218 |
4156 } // namespace blink | 4219 } // namespace blink |
OLD | NEW |