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