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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 ASSERT(m_frame); | 126 ASSERT(m_frame); |
127 init(); | 127 init(); |
128 | 128 |
129 if (!m_frame->isMainFrame()) | 129 if (!m_frame->isMainFrame()) |
130 return; | 130 return; |
131 | 131 |
132 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); | 132 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); |
133 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); | 133 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); |
134 } | 134 } |
135 | 135 |
136 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) | 136 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) |
137 { | 137 { |
138 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 138 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) ); |
139 view->show(); | 139 view->show(); |
140 return view.release(); | 140 return view.release(); |
141 } | 141 } |
142 | 142 |
143 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia lSize) | 143 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int Size& initialSize) |
144 { | 144 { |
145 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); | 145 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) ); |
146 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 146 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
147 view->setLayoutSizeInternal(initialSize); | 147 view->setLayoutSizeInternal(initialSize); |
148 | 148 |
149 view->show(); | 149 view->show(); |
150 return view.release(); | 150 return view.release(); |
151 } | 151 } |
152 | 152 |
153 FrameView::~FrameView() | 153 FrameView::~FrameView() |
154 { | 154 { |
155 #if !ENABLE(OILPAN) | |
haraken
2014/09/29 14:16:35
Can we add an assertion to oilpan builds to verify
sof
2014/10/07 11:03:36
Done.
| |
156 dispose(); | |
157 #endif | |
158 } | |
159 | |
160 void FrameView::dispose() | |
161 { | |
155 if (m_postLayoutTasksTimer.isActive()) | 162 if (m_postLayoutTasksTimer.isActive()) |
156 m_postLayoutTasksTimer.stop(); | 163 m_postLayoutTasksTimer.stop(); |
157 | 164 |
158 if (m_didScrollTimer.isActive()) | 165 if (m_didScrollTimer.isActive()) |
159 m_didScrollTimer.stop(); | 166 m_didScrollTimer.stop(); |
160 | 167 |
161 removeFromAXObjectCache(); | 168 removeFromAXObjectCache(); |
162 | 169 |
163 // Custom scrollbars should already be destroyed at this point | 170 // Custom scrollbars should already be destroyed at this point |
164 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar() ); | 171 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar() ); |
165 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); | 172 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); |
166 | 173 |
167 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow. | 174 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow. |
168 setHasVerticalScrollbar(false); | 175 setHasVerticalScrollbar(false); |
169 | 176 |
170 ASSERT(!m_scrollCorner); | 177 ASSERT(!m_scrollCorner); |
171 | 178 |
172 ASSERT(m_frame); | 179 ASSERT(m_frame); |
173 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); | 180 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); |
174 // FIXME: Do we need to do something here for OOPI? | 181 // FIXME: Do we need to do something here for OOPI? |
175 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 182 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
176 if (ownerElement && ownerElement->ownedWidget() == this) | 183 if (ownerElement && ownerElement->ownedWidget() == this) |
177 ownerElement->setWidget(nullptr); | 184 ownerElement->setWidget(nullptr); |
185 | |
186 disposeAutoSizeInfo(); | |
187 } | |
188 | |
189 void FrameView::trace(Visitor* visitor) | |
190 { | |
191 #if ENABLE(OILPAN) | |
192 visitor->trace(m_widgetUpdateSet); | |
193 visitor->trace(m_widgets); | |
194 visitor->trace(m_frame); | |
195 visitor->trace(m_nodeToDraw); | |
196 visitor->trace(m_maintainScrollPositionAnchor); | |
197 visitor->trace(m_scrollCorner); | |
198 visitor->trace(m_autoSizeInfo); | |
199 #endif | |
200 ScrollView::trace(visitor); | |
178 } | 201 } |
179 | 202 |
180 void FrameView::reset() | 203 void FrameView::reset() |
181 { | 204 { |
182 m_hasPendingLayout = false; | 205 m_hasPendingLayout = false; |
183 m_layoutSubtreeRoot = 0; | 206 m_layoutSubtreeRoot = 0; |
184 m_doFullPaintInvalidation = false; | 207 m_doFullPaintInvalidation = false; |
185 m_layoutSchedulingEnabled = true; | 208 m_layoutSchedulingEnabled = true; |
186 m_inPerformLayout = false; | 209 m_inPerformLayout = false; |
187 m_canInvalidatePaintDuringPerformLayout = false; | 210 m_canInvalidatePaintDuringPerformLayout = false; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also. | 421 // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also. |
399 RenderPart* frameRenderer = m_frame->ownerRenderer(); | 422 RenderPart* frameRenderer = m_frame->ownerRenderer(); |
400 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) { | 423 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) { |
401 customScrollbarFrame = m_frame.get(); | 424 customScrollbarFrame = m_frame.get(); |
402 return true; | 425 return true; |
403 } | 426 } |
404 | 427 |
405 return false; | 428 return false; |
406 } | 429 } |
407 | 430 |
408 PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientatio n) | 431 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientatio n orientation) |
409 { | 432 { |
410 Element* customScrollbarElement = 0; | 433 Element* customScrollbarElement = 0; |
411 LocalFrame* customScrollbarFrame = 0; | 434 LocalFrame* customScrollbarFrame = 0; |
412 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) | 435 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) |
413 return RenderScrollbar::createCustomScrollbar(this, orientation, customS crollbarElement, customScrollbarFrame); | 436 return RenderScrollbar::createCustomScrollbar(this, orientation, customS crollbarElement, customScrollbarFrame); |
414 | 437 |
415 // Nobody set a custom style, so we just use a native scrollbar. | 438 // Nobody set a custom style, so we just use a native scrollbar. |
416 return ScrollView::createScrollbar(orientation); | 439 return ScrollView::createScrollbar(orientation); |
417 } | 440 } |
418 | 441 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) | 692 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) |
670 return; | 693 return; |
671 | 694 |
672 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished | 695 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished |
673 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced | 696 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced |
674 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before | 697 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before |
675 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its | 698 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its |
676 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the | 699 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the |
677 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying | 700 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying |
678 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>). | 701 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>). |
679 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); | 702 RefPtrWillBeRawPtr<FrameView> frameView = ownerRenderer->frame()->view(); |
680 | 703 |
681 // Mark the owner renderer as needing layout. | 704 // Mark the owner renderer as needing layout. |
682 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 705 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
683 | 706 |
684 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. | 707 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. |
685 ASSERT(frameView); | 708 ASSERT(frameView); |
686 frameView->layout(); | 709 frameView->layout(); |
687 } | 710 } |
688 | 711 |
689 void FrameView::performPreLayoutTasks() | 712 void FrameView::performPreLayoutTasks() |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 | 804 |
782 ScriptForbiddenScope forbidScript; | 805 ScriptForbiddenScope forbidScript; |
783 | 806 |
784 if (isInPerformLayout() || !m_frame->document()->isActive()) | 807 if (isInPerformLayout() || !m_frame->document()->isActive()) |
785 return; | 808 return; |
786 | 809 |
787 TRACE_EVENT0("blink", "FrameView::layout"); | 810 TRACE_EVENT0("blink", "FrameView::layout"); |
788 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 811 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
789 | 812 |
790 // Protect the view from being deleted during layout (in recalcStyle) | 813 // Protect the view from being deleted during layout (in recalcStyle) |
791 RefPtr<FrameView> protector(this); | 814 RefPtrWillBeRawPtr<FrameView> protector(this); |
792 | 815 |
793 // Every scroll that happens during layout is programmatic. | 816 // Every scroll that happens during layout is programmatic. |
794 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); | 817 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); |
795 | 818 |
796 if (m_autoSizeInfo) | 819 if (m_autoSizeInfo) |
797 m_autoSizeInfo->autoSizeIfNeeded(); | 820 m_autoSizeInfo->autoSizeIfNeeded(); |
798 | 821 |
799 m_hasPendingLayout = false; | 822 m_hasPendingLayout = false; |
800 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean); | 823 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean); |
801 | 824 |
802 RELEASE_ASSERT(!isPainting()); | 825 RELEASE_ASSERT(!isPainting()); |
803 | 826 |
804 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this)); | 827 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this)); |
805 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 828 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
806 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. | 829 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. |
807 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout (m_frame.get()); | 830 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout (m_frame.get()); |
808 | 831 |
809 if (!allowSubtree && isSubtreeLayout()) { | 832 if (!allowSubtree && isSubtreeLayout()) { |
810 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 833 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
811 m_layoutSubtreeRoot = 0; | 834 m_layoutSubtreeRoot = 0; |
812 } | 835 } |
813 | 836 |
814 performPreLayoutTasks(); | 837 performPreLayoutTasks(); |
815 | 838 |
839 #if !ENABLE(OILPAN) | |
816 // If there is only one ref to this view left, then its going to be destroye d as soon as we exit, | 840 // If there is only one ref to this view left, then its going to be destroye d as soon as we exit, |
817 // so there's no point to continuing to layout | 841 // so there's no point to continuing to layout |
818 if (protector->hasOneRef()) | 842 if (protector->hasOneRef()) |
819 return; | 843 return; |
844 #endif | |
820 | 845 |
821 Document* document = m_frame->document(); | 846 Document* document = m_frame->document(); |
822 bool inSubtreeLayout = isSubtreeLayout(); | 847 bool inSubtreeLayout = isSubtreeLayout(); |
823 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderView(); | 848 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderView(); |
824 if (!rootForThisLayout) { | 849 if (!rootForThisLayout) { |
825 // FIXME: Do we need to set m_size here? | 850 // FIXME: Do we need to set m_size here? |
826 ASSERT_NOT_REACHED(); | 851 ASSERT_NOT_REACHED(); |
827 return; | 852 return; |
828 } | 853 } |
829 | 854 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1491 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); | 1516 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); |
1492 } | 1517 } |
1493 } | 1518 } |
1494 | 1519 |
1495 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() | 1520 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
1496 { | 1521 { |
1497 // Nothing to do after scrolling if there are no fixed position elements. | 1522 // Nothing to do after scrolling if there are no fixed position elements. |
1498 if (!hasViewportConstrainedObjects()) | 1523 if (!hasViewportConstrainedObjects()) |
1499 return; | 1524 return; |
1500 | 1525 |
1501 RefPtr<FrameView> protect(this); | 1526 RefPtrWillBeMember<FrameView> protect(this); |
haraken
2014/09/29 14:16:36
RefPtrWillBeRawPtr
| |
1502 | 1527 |
1503 // If there fixed position elements, scrolling may cause compositing layers to change. | 1528 // If there fixed position elements, scrolling may cause compositing layers to change. |
1504 // Update widget and layer positions after scrolling, but only if we're not inside of | 1529 // Update widget and layer positions after scrolling, but only if we're not inside of |
1505 // layout. | 1530 // layout. |
1506 if (!m_nestedLayoutCount) { | 1531 if (!m_nestedLayoutCount) { |
1507 updateWidgetPositions(); | 1532 updateWidgetPositions(); |
1508 if (RenderView* renderView = this->renderView()) | 1533 if (RenderView* renderView = this->renderView()) |
1509 renderView->layer()->setNeedsCompositingInputsUpdate(); | 1534 renderView->layer()->setNeedsCompositingInputsUpdate(); |
1510 } | 1535 } |
1511 } | 1536 } |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1860 // FIXME: Do we really need to prevent this? | 1885 // FIXME: Do we really need to prevent this? |
1861 m_widgetUpdateSet.remove(&object); | 1886 m_widgetUpdateSet.remove(&object); |
1862 } | 1887 } |
1863 | 1888 |
1864 return m_widgetUpdateSet.isEmpty(); | 1889 return m_widgetUpdateSet.isEmpty(); |
1865 } | 1890 } |
1866 | 1891 |
1867 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 1892 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
1868 { | 1893 { |
1869 ASSERT(!isInPerformLayout()); | 1894 ASSERT(!isInPerformLayout()); |
1870 RefPtr<FrameView> protect(this); | 1895 RefPtrWillBeRawPtr<FrameView> protect(this); |
1871 m_updateWidgetsTimer.stop(); | 1896 m_updateWidgetsTimer.stop(); |
1872 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 1897 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
1873 if (updateWidgets()) | 1898 if (updateWidgets()) |
1874 return; | 1899 return; |
1875 } | 1900 } |
1876 } | 1901 } |
1877 | 1902 |
1878 void FrameView::flushAnyPendingPostLayoutTasks() | 1903 void FrameView::flushAnyPendingPostLayoutTasks() |
1879 { | 1904 { |
1880 ASSERT(!isInPerformLayout()); | 1905 ASSERT(!isInPerformLayout()); |
(...skipping 12 matching lines...) Expand all Loading... | |
1893 } | 1918 } |
1894 | 1919 |
1895 void FrameView::performPostLayoutTasks() | 1920 void FrameView::performPostLayoutTasks() |
1896 { | 1921 { |
1897 // FIXME: We can reach here, even when the page is not active! | 1922 // FIXME: We can reach here, even when the page is not active! |
1898 // http/tests/inspector/elements/html-link-import.html and many other | 1923 // http/tests/inspector/elements/html-link-import.html and many other |
1899 // tests hit that case. | 1924 // tests hit that case. |
1900 // We should ASSERT(isActive()); or at least return early if we can! | 1925 // We should ASSERT(isActive()); or at least return early if we can! |
1901 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call. | 1926 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call. |
1902 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); | 1927 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); |
1903 RefPtr<FrameView> protect(this); | 1928 RefPtrWillBeRawPtr<FrameView> protect(this); |
1904 | 1929 |
1905 m_postLayoutTasksTimer.stop(); | 1930 m_postLayoutTasksTimer.stop(); |
1906 | 1931 |
1907 m_frame->selection().setCaretRectNeedsUpdate(); | 1932 m_frame->selection().setCaretRectNeedsUpdate(); |
1908 | 1933 |
1909 { | 1934 { |
1910 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l ayers.html | 1935 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l ayers.html |
1911 DisableCompositingQueryAsserts disabler; | 1936 DisableCompositingQueryAsserts disabler; |
1912 m_frame->selection().updateAppearance(); | 1937 m_frame->selection().updateAppearance(); |
1913 } | 1938 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2340 if (htmlElement && htmlElement->renderer()) | 2365 if (htmlElement && htmlElement->renderer()) |
2341 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); | 2366 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); |
2342 if (bodyElement && bodyElement->renderer()) | 2367 if (bodyElement && bodyElement->renderer()) |
2343 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); | 2368 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); |
2344 | 2369 |
2345 return result; | 2370 return result; |
2346 } | 2371 } |
2347 | 2372 |
2348 bool FrameView::hasCustomScrollbars() const | 2373 bool FrameView::hasCustomScrollbars() const |
2349 { | 2374 { |
2350 const HashSet<RefPtr<Widget> >* viewChildren = children(); | 2375 const WillBeHeapHashSet<RefPtrWillBeMember<Widget> >* viewChildren = childre n(); |
2351 HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); | 2376 WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator end = viewChi ldren->end(); |
2352 for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin( ); current != end; ++current) { | 2377 for (WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) { |
2353 Widget* widget = current->get(); | 2378 Widget* widget = current->get(); |
2354 if (widget->isFrameView()) { | 2379 if (widget->isFrameView()) { |
2355 if (toFrameView(widget)->hasCustomScrollbars()) | 2380 if (toFrameView(widget)->hasCustomScrollbars()) |
2356 return true; | 2381 return true; |
2357 } else if (widget->isScrollbar()) { | 2382 } else if (widget->isScrollbar()) { |
2358 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); | 2383 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); |
2359 if (scrollbar->isCustomScrollbar()) | 2384 if (scrollbar->isCustomScrollbar()) |
2360 return true; | 2385 return true; |
2361 } | 2386 } |
2362 } | 2387 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2519 return; | 2544 return; |
2520 | 2545 |
2521 m_needsUpdateWidgetPositions = false; | 2546 m_needsUpdateWidgetPositions = false; |
2522 | 2547 |
2523 updateWidgetPositions(); | 2548 updateWidgetPositions(); |
2524 } | 2549 } |
2525 | 2550 |
2526 void FrameView::updateLayoutAndStyleForPainting() | 2551 void FrameView::updateLayoutAndStyleForPainting() |
2527 { | 2552 { |
2528 // Updating layout can run script, which can tear down the FrameView. | 2553 // Updating layout can run script, which can tear down the FrameView. |
2529 RefPtr<FrameView> protector(this); | 2554 RefPtrWillBeRawPtr<FrameView> protector(this); |
2530 | 2555 |
2531 updateLayoutAndStyleIfNeededRecursive(); | 2556 updateLayoutAndStyleIfNeededRecursive(); |
2532 | 2557 |
2533 updateWidgetPositionsIfNeeded(); | 2558 updateWidgetPositionsIfNeeded(); |
2534 | 2559 |
2535 RenderView* view = renderView(); | 2560 RenderView* view = renderView(); |
2536 if (view) { | 2561 if (view) { |
2537 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "frame", m_frame.get()); | 2562 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "frame", m_frame.get()); |
2538 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. | 2563 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. |
2539 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); | 2564 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); |
(...skipping 27 matching lines...) Expand all Loading... | |
2567 // region but then become included later by the second frame adding rects to the dirty region | 2592 // region but then become included later by the second frame adding rects to the dirty region |
2568 // when it lays out. | 2593 // when it lays out. |
2569 | 2594 |
2570 m_frame->document()->updateRenderTreeIfNeeded(); | 2595 m_frame->document()->updateRenderTreeIfNeeded(); |
2571 | 2596 |
2572 if (needsLayout()) | 2597 if (needsLayout()) |
2573 layout(); | 2598 layout(); |
2574 | 2599 |
2575 // FIXME: Calling layout() shouldn't trigger scripe execution or have any | 2600 // FIXME: Calling layout() shouldn't trigger scripe execution or have any |
2576 // observable effects on the frame tree but we're not quite there yet. | 2601 // observable effects on the frame tree but we're not quite there yet. |
2577 Vector<RefPtr<FrameView> > frameViews; | 2602 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; |
2578 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | 2603 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { |
2579 if (!child->isLocalFrame()) | 2604 if (!child->isLocalFrame()) |
2580 continue; | 2605 continue; |
2581 if (FrameView* view = toLocalFrame(child)->view()) | 2606 if (FrameView* view = toLocalFrame(child)->view()) |
2582 frameViews.append(view); | 2607 frameViews.append(view); |
2583 } | 2608 } |
2584 | 2609 |
2585 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); | 2610 const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frame Views.end(); |
2586 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it) | 2611 for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameVi ews.begin(); it != end; ++it) |
2587 (*it)->updateLayoutAndStyleIfNeededRecursive(); | 2612 (*it)->updateLayoutAndStyleIfNeededRecursive(); |
2588 | 2613 |
2589 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. | 2614 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. |
2590 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another | 2615 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another |
2591 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. | 2616 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. |
2592 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. | 2617 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. |
2593 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2618 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
2594 m_frame->document()->updateRenderTreeIfNeeded(); | 2619 m_frame->document()->updateRenderTreeIfNeeded(); |
2595 | 2620 |
2596 if (needsLayout()) | 2621 if (needsLayout()) |
(...skipping 17 matching lines...) Expand all Loading... | |
2614 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); | 2639 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); |
2615 | 2640 |
2616 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | 2641 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { |
2617 if (!child->isLocalFrame()) | 2642 if (!child->isLocalFrame()) |
2618 continue; | 2643 continue; |
2619 | 2644 |
2620 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); | 2645 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); |
2621 } | 2646 } |
2622 } | 2647 } |
2623 | 2648 |
2649 void FrameView::setLayoutSizeFixedToFrameSizeAndInvalidate(bool isFixed) | |
haraken
2014/09/29 14:16:35
Sorry, I now understand that adding this helper fu
| |
2650 { | |
2651 setLayoutSizeFixedToFrameSize(isFixed); | |
2652 setNeedsLayout(); | |
2653 scheduleRelayout(); | |
2654 } | |
2655 | |
2624 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) | 2656 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) |
2625 { | 2657 { |
2626 if (!m_autoSizeInfo) | 2658 if (!m_autoSizeInfo) |
2627 m_autoSizeInfo = adoptPtr(new FrameViewAutoSizeInfo(this)); | 2659 m_autoSizeInfo = FrameViewAutoSizeInfo::create(this); |
2628 | 2660 |
2629 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); | 2661 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); |
2662 setLayoutSizeFixedToFrameSizeAndInvalidate(true); | |
2663 } | |
2664 | |
2665 void FrameView::disposeAutoSizeInfo() | |
2666 { | |
2667 if (!m_autoSizeInfo) | |
2668 return; | |
2669 | |
2670 setLayoutSizeFixedToFrameSizeAndInvalidate(false); | |
2671 | |
2672 // Since autosize mode forces the scrollbar mode, change them to being auto. | |
2673 setVerticalScrollbarLock(false); | |
2674 setHorizontalScrollbarLock(false); | |
2675 setScrollbarModes(ScrollbarAuto, ScrollbarAuto); | |
2676 m_autoSizeInfo.clear(); | |
2630 } | 2677 } |
2631 | 2678 |
2632 void FrameView::forceLayout(bool allowSubtree) | 2679 void FrameView::forceLayout(bool allowSubtree) |
2633 { | 2680 { |
2634 layout(allowSubtree); | 2681 layout(allowSubtree); |
2635 } | 2682 } |
2636 | 2683 |
2637 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS ize& originalPageSize, float maximumShrinkFactor) | 2684 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS ize& originalPageSize, float maximumShrinkFactor) |
2638 { | 2685 { |
2639 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri ck to see | 2686 // 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... | |
3019 IntSize visibleSize = expandedIntSize(visibleContentSizeF); | 3066 IntSize visibleSize = expandedIntSize(visibleContentSizeF); |
3020 | 3067 |
3021 IntPoint maximumOffset( | 3068 IntPoint maximumOffset( |
3022 contentsWidth() - visibleSize.width() - scrollOrigin().x(), | 3069 contentsWidth() - visibleSize.width() - scrollOrigin().x(), |
3023 contentsHeight() - visibleSize.height() - scrollOrigin().y()); | 3070 contentsHeight() - visibleSize.height() - scrollOrigin().y()); |
3024 maximumOffset.clampNegativeToZero(); | 3071 maximumOffset.clampNegativeToZero(); |
3025 return maximumOffset; | 3072 return maximumOffset; |
3026 } | 3073 } |
3027 | 3074 |
3028 } // namespace blink | 3075 } // namespace blink |
OLD | NEW |