| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/HTMLNames.h" | 30 #include "core/HTMLNames.h" |
| 31 #include "core/accessibility/AXObjectCache.h" | 31 #include "core/accessibility/AXObjectCache.h" |
| 32 #include "core/css/FontFaceSet.h" | 32 #include "core/css/FontFaceSet.h" |
| 33 #include "core/css/resolver/StyleResolver.h" | 33 #include "core/css/resolver/StyleResolver.h" |
| 34 #include "core/dom/DocumentMarkerController.h" | 34 #include "core/dom/DocumentMarkerController.h" |
| 35 #include "core/editing/FrameSelection.h" | 35 #include "core/editing/FrameSelection.h" |
| 36 #include "core/events/OverflowEvent.h" | 36 #include "core/events/OverflowEvent.h" |
| 37 #include "core/fetch/ResourceFetcher.h" | 37 #include "core/fetch/ResourceFetcher.h" |
| 38 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 38 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
| 39 #include "core/frame/FrameHost.h" | 39 #include "core/frame/FrameHost.h" |
| 40 #include "core/frame/FrameProtector.h" |
| 40 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
| 42 #include "core/html/HTMLFrameElement.h" | 43 #include "core/html/HTMLFrameElement.h" |
| 43 #include "core/html/HTMLPlugInElement.h" | 44 #include "core/html/HTMLPlugInElement.h" |
| 44 #include "core/html/parser/TextResourceDecoder.h" | 45 #include "core/html/parser/TextResourceDecoder.h" |
| 45 #include "core/inspector/InspectorInstrumentation.h" | 46 #include "core/inspector/InspectorInstrumentation.h" |
| 46 #include "core/inspector/InspectorTraceEvents.h" | 47 #include "core/inspector/InspectorTraceEvents.h" |
| 47 #include "core/loader/FrameLoader.h" | 48 #include "core/loader/FrameLoader.h" |
| 48 #include "core/loader/FrameLoaderClient.h" | 49 #include "core/loader/FrameLoaderClient.h" |
| 49 #include "core/page/Chrome.h" | 50 #include "core/page/Chrome.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) | 662 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) |
| 662 return; | 663 return; |
| 663 | 664 |
| 664 // If the embedded SVG document appears the first time, the ownerRenderer ha
s already finished | 665 // If the embedded SVG document appears the first time, the ownerRenderer ha
s already finished |
| 665 // layout without knowing about the existence of the embedded SVG document,
because RenderReplaced | 666 // layout without knowing about the existence of the embedded SVG document,
because RenderReplaced |
| 666 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before | 667 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before |
| 667 // bothering to lay out the SVG document, mark the ownerRenderer needing lay
out and ask its | 668 // bothering to lay out the SVG document, mark the ownerRenderer needing lay
out and ask its |
| 668 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere
r) carries the | 669 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere
r) carries the |
| 669 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying | 670 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying |
| 670 // out for the first time, or when the RenderSVGRoot size has changed dynami
cally (eg. via <script>). | 671 // out for the first time, or when the RenderSVGRoot size has changed dynami
cally (eg. via <script>). |
| 671 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); | 672 FrameView* frameView = ownerRenderer->frame()->view(); |
| 673 FrameViewProtector protect(frameView); |
| 672 | 674 |
| 673 // Mark the owner renderer as needing layout. | 675 // Mark the owner renderer as needing layout. |
| 674 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 676 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 675 | 677 |
| 676 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 678 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
| 677 ASSERT(frameView); | 679 ASSERT(frameView); |
| 678 frameView->layout(); | 680 frameView->layout(); |
| 679 } | 681 } |
| 680 | 682 |
| 681 void FrameView::performPreLayoutTasks() | 683 void FrameView::performPreLayoutTasks() |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 | 774 |
| 773 ScriptForbiddenScope forbidScript; | 775 ScriptForbiddenScope forbidScript; |
| 774 | 776 |
| 775 if (isInPerformLayout() || !m_frame->document()->isActive()) | 777 if (isInPerformLayout() || !m_frame->document()->isActive()) |
| 776 return; | 778 return; |
| 777 | 779 |
| 778 TRACE_EVENT0("blink", "FrameView::layout"); | 780 TRACE_EVENT0("blink", "FrameView::layout"); |
| 779 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 781 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
| 780 | 782 |
| 781 // Protect the view from being deleted during layout (in recalcStyle) | 783 // Protect the view from being deleted during layout (in recalcStyle) |
| 782 RefPtr<FrameView> protector(this); | 784 FrameViewProtector protector(this); |
| 783 | 785 |
| 784 // Every scroll that happens during layout is programmatic. | 786 // Every scroll that happens during layout is programmatic. |
| 785 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 787 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
| 786 | 788 |
| 787 m_hasPendingLayout = false; | 789 m_hasPendingLayout = false; |
| 788 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); | 790 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
| 789 | 791 |
| 790 RELEASE_ASSERT(!isPainting()); | 792 RELEASE_ASSERT(!isPainting()); |
| 791 | 793 |
| 792 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); | 794 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); |
| 793 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 795 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
| 794 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 796 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| 795 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout
(m_frame.get()); | 797 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout
(m_frame.get()); |
| 796 | 798 |
| 797 if (!allowSubtree && isSubtreeLayout()) { | 799 if (!allowSubtree && isSubtreeLayout()) { |
| 798 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 800 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
| 799 m_layoutSubtreeRoot = 0; | 801 m_layoutSubtreeRoot = 0; |
| 800 } | 802 } |
| 801 | 803 |
| 802 performPreLayoutTasks(); | 804 performPreLayoutTasks(); |
| 803 | 805 |
| 804 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, | 806 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, |
| 805 // so there's no point to continuing to layout | 807 // so there's no point to continuing to layout |
| 806 if (protector->hasOneRef()) | 808 if (protector.willDelete()) |
| 807 return; | 809 return; |
| 808 | 810 |
| 809 Document* document = m_frame->document(); | 811 Document* document = m_frame->document(); |
| 810 bool inSubtreeLayout = isSubtreeLayout(); | 812 bool inSubtreeLayout = isSubtreeLayout(); |
| 811 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); | 813 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); |
| 812 if (!rootForThisLayout) { | 814 if (!rootForThisLayout) { |
| 813 // FIXME: Do we need to set m_size here? | 815 // FIXME: Do we need to set m_size here? |
| 814 ASSERT_NOT_REACHED(); | 816 ASSERT_NOT_REACHED(); |
| 815 return; | 817 return; |
| 816 } | 818 } |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl
lImageResourcePriorities(); | 1507 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl
lImageResourcePriorities(); |
| 1506 } | 1508 } |
| 1507 } | 1509 } |
| 1508 | 1510 |
| 1509 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() | 1511 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
| 1510 { | 1512 { |
| 1511 // Nothing to do after scrolling if there are no fixed position elements. | 1513 // Nothing to do after scrolling if there are no fixed position elements. |
| 1512 if (!hasViewportConstrainedObjects()) | 1514 if (!hasViewportConstrainedObjects()) |
| 1513 return; | 1515 return; |
| 1514 | 1516 |
| 1515 RefPtr<FrameView> protect(this); | 1517 FrameViewProtector protect(this); |
| 1516 | 1518 |
| 1517 // If there fixed position elements, scrolling may cause compositing layers
to change. | 1519 // 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 | 1520 // Update widget and layer positions after scrolling, but only if we're not
inside of |
| 1519 // layout. | 1521 // layout. |
| 1520 if (!m_nestedLayoutCount) { | 1522 if (!m_nestedLayoutCount) { |
| 1521 updateWidgetPositions(); | 1523 updateWidgetPositions(); |
| 1522 if (RenderView* renderView = this->renderView()) | 1524 if (RenderView* renderView = this->renderView()) |
| 1523 renderView->layer()->setNeedsCompositingInputsUpdate(); | 1525 renderView->layer()->setNeedsCompositingInputsUpdate(); |
| 1524 } | 1526 } |
| 1525 } | 1527 } |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 // FIXME: Do we really need to prevent this? | 1874 // FIXME: Do we really need to prevent this? |
| 1873 m_widgetUpdateSet.remove(&object); | 1875 m_widgetUpdateSet.remove(&object); |
| 1874 } | 1876 } |
| 1875 | 1877 |
| 1876 return m_widgetUpdateSet.isEmpty(); | 1878 return m_widgetUpdateSet.isEmpty(); |
| 1877 } | 1879 } |
| 1878 | 1880 |
| 1879 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 1881 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
| 1880 { | 1882 { |
| 1881 ASSERT(!isInPerformLayout()); | 1883 ASSERT(!isInPerformLayout()); |
| 1882 RefPtr<FrameView> protect(this); | 1884 FrameViewProtector protect(this); |
| 1883 m_updateWidgetsTimer.stop(); | 1885 m_updateWidgetsTimer.stop(); |
| 1884 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 1886 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
| 1885 if (updateWidgets()) | 1887 if (updateWidgets()) |
| 1886 return; | 1888 return; |
| 1887 } | 1889 } |
| 1888 } | 1890 } |
| 1889 | 1891 |
| 1890 void FrameView::flushAnyPendingPostLayoutTasks() | 1892 void FrameView::flushAnyPendingPostLayoutTasks() |
| 1891 { | 1893 { |
| 1892 ASSERT(!isInPerformLayout()); | 1894 ASSERT(!isInPerformLayout()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1905 } | 1907 } |
| 1906 | 1908 |
| 1907 void FrameView::performPostLayoutTasks() | 1909 void FrameView::performPostLayoutTasks() |
| 1908 { | 1910 { |
| 1909 // FIXME: We can reach here, even when the page is not active! | 1911 // FIXME: We can reach here, even when the page is not active! |
| 1910 // http/tests/inspector/elements/html-link-import.html and many other | 1912 // http/tests/inspector/elements/html-link-import.html and many other |
| 1911 // tests hit that case. | 1913 // tests hit that case. |
| 1912 // We should ASSERT(isActive()); or at least return early if we can! | 1914 // We should ASSERT(isActive()); or at least return early if we can! |
| 1913 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. | 1915 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. |
| 1914 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); | 1916 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); |
| 1915 RefPtr<FrameView> protect(this); | 1917 FrameViewProtector protect(this); |
| 1916 | 1918 |
| 1917 m_postLayoutTasksTimer.stop(); | 1919 m_postLayoutTasksTimer.stop(); |
| 1918 | 1920 |
| 1919 m_frame->selection().setCaretRectNeedsUpdate(); | 1921 m_frame->selection().setCaretRectNeedsUpdate(); |
| 1920 | 1922 |
| 1921 { | 1923 { |
| 1922 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l
ayers.html | 1924 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l
ayers.html |
| 1923 DisableCompositingQueryAsserts disabler; | 1925 DisableCompositingQueryAsserts disabler; |
| 1924 m_frame->selection().updateAppearance(); | 1926 m_frame->selection().updateAppearance(); |
| 1925 } | 1927 } |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 return; | 2532 return; |
| 2531 | 2533 |
| 2532 m_needsUpdateWidgetPositions = false; | 2534 m_needsUpdateWidgetPositions = false; |
| 2533 | 2535 |
| 2534 updateWidgetPositions(); | 2536 updateWidgetPositions(); |
| 2535 } | 2537 } |
| 2536 | 2538 |
| 2537 void FrameView::updateLayoutAndStyleForPainting() | 2539 void FrameView::updateLayoutAndStyleForPainting() |
| 2538 { | 2540 { |
| 2539 // Updating layout can run script, which can tear down the FrameView. | 2541 // Updating layout can run script, which can tear down the FrameView. |
| 2540 RefPtr<FrameView> protector(this); | 2542 FrameViewProtector protect(this); |
| 2541 | 2543 |
| 2542 updateLayoutAndStyleIfNeededRecursive(); | 2544 updateLayoutAndStyleIfNeededRecursive(); |
| 2543 | 2545 |
| 2544 updateWidgetPositionsIfNeeded(); | 2546 updateWidgetPositionsIfNeeded(); |
| 2545 | 2547 |
| 2546 if (RenderView* view = renderView()) { | 2548 if (RenderView* view = renderView()) { |
| 2547 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "frame", m_frame.get()); | 2549 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "frame", m_frame.get()); |
| 2548 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. | 2550 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. |
| 2549 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); | 2551 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); |
| 2550 | 2552 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3000 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3002 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
| 3001 { | 3003 { |
| 3002 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3004 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3003 if (AXObjectCache* cache = axObjectCache()) { | 3005 if (AXObjectCache* cache = axObjectCache()) { |
| 3004 cache->remove(scrollbar); | 3006 cache->remove(scrollbar); |
| 3005 cache->handleScrollbarUpdate(this); | 3007 cache->handleScrollbarUpdate(this); |
| 3006 } | 3008 } |
| 3007 } | 3009 } |
| 3008 | 3010 |
| 3009 } // namespace blink | 3011 } // namespace blink |
| OLD | NEW |