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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 renderer->setWidget(0); | 216 renderer->setWidget(0); |
217 } | 217 } |
218 | 218 |
219 void FrameView::reset() | 219 void FrameView::reset() |
220 { | 220 { |
221 m_cannotBlitToWindow = false; | 221 m_cannotBlitToWindow = false; |
222 m_isOverlapped = false; | 222 m_isOverlapped = false; |
223 m_contentIsOpaque = false; | 223 m_contentIsOpaque = false; |
224 m_hasPendingLayout = false; | 224 m_hasPendingLayout = false; |
225 m_layoutSubtreeRoot = 0; | 225 m_layoutSubtreeRoot = 0; |
226 m_delayedLayout = false; | |
227 m_doFullRepaint = true; | 226 m_doFullRepaint = true; |
228 m_layoutSchedulingEnabled = true; | 227 m_layoutSchedulingEnabled = true; |
229 m_inPerformLayout = false; | |
230 m_canRepaintDuringPerformLayout = false; | 228 m_canRepaintDuringPerformLayout = false; |
231 m_doingPreLayoutStyleUpdate = false; | 229 m_doingPreLayoutStyleUpdate = false; |
232 m_inSynchronousPostLayout = false; | 230 m_inSynchronousPostLayout = false; |
233 m_layoutCount = 0; | 231 m_layoutCount = 0; |
234 m_nestedLayoutCount = 0; | 232 m_nestedLayoutCount = 0; |
235 m_postLayoutTasksTimer.stop(); | 233 m_postLayoutTasksTimer.stop(); |
236 m_updateWidgetsTimer.stop(); | 234 m_updateWidgetsTimer.stop(); |
237 m_firstLayout = true; | 235 m_firstLayout = true; |
238 m_firstLayoutCallbackPending = false; | 236 m_firstLayoutCallbackPending = false; |
239 m_wasScrolledByUser = false; | 237 m_wasScrolledByUser = false; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 { | 489 { |
492 RenderView* renderView = this->renderView(); | 490 RenderView* renderView = this->renderView(); |
493 if (!renderView) | 491 if (!renderView) |
494 return; | 492 return; |
495 | 493 |
496 ASSERT(m_frame->view() == this); | 494 ASSERT(m_frame->view() == this); |
497 | 495 |
498 const IntRect rect = renderView->documentRect(); | 496 const IntRect rect = renderView->documentRect(); |
499 const IntSize& size = rect.size(); | 497 const IntSize& size = rect.size(); |
500 ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->docume
nt()->printing(), size == contentsSize()); | 498 ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->docume
nt()->printing(), size == contentsSize()); |
501 | |
502 setContentsSize(size); | 499 setContentsSize(size); |
503 } | 500 } |
504 | 501 |
505 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar
Mode& hMode, ScrollbarMode& vMode) | 502 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar
Mode& hMode, ScrollbarMode& vMode) |
506 { | 503 { |
507 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE
treats | 504 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE
treats |
508 // overflow:hidden and overflow:scroll on <body> as applying to the document
's | 505 // overflow:hidden and overflow:scroll on <body> as applying to the document
's |
509 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html>
or <body> element and XML/XHTML UAs should | 506 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html>
or <body> element and XML/XHTML UAs should |
510 // use the root element. | 507 // use the root element. |
511 | 508 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalc(); | 768 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalc(); |
772 | 769 |
773 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 770 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
774 ASSERT(frameView); | 771 ASSERT(frameView); |
775 frameView->layout(); | 772 frameView->layout(); |
776 } | 773 } |
777 | 774 |
778 void FrameView::performPreLayoutTasks() | 775 void FrameView::performPreLayoutTasks() |
779 { | 776 { |
780 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks"); | 777 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks"); |
| 778 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); |
781 | 779 |
782 // Don't schedule more layouts, we're in one. | 780 // Don't schedule more layouts, we're in one. |
783 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, fal
se); | 781 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, fal
se); |
784 | 782 |
785 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT
imer.isActive()) { | 783 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT
imer.isActive()) { |
786 // This is a new top-level layout. If there are any remaining tasks from
the previous layout, finish them now. | 784 // This is a new top-level layout. If there are any remaining tasks from
the previous layout, finish them now. |
787 m_inSynchronousPostLayout = true; | 785 m_inSynchronousPostLayout = true; |
788 performPostLayoutTasks(); | 786 performPostLayoutTasks(); |
789 m_inSynchronousPostLayout = false; | 787 m_inSynchronousPostLayout = false; |
790 } | 788 } |
791 | 789 |
792 Document* document = m_frame->document(); | 790 Document* document = m_frame->document(); |
| 791 |
| 792 // FIXME: Should we move this code to FrameView::setContentsSize? |
793 document->notifyResizeForViewportUnits(); | 793 document->notifyResizeForViewportUnits(); |
794 | 794 |
795 // Viewport-dependent media queries may cause us to need completely differen
t style information. | 795 // Viewport-dependent media queries may cause us to need completely differen
t style information. |
796 if (!document->styleResolver() || document->styleResolver()->mediaQueryAffec
tedByViewportChange()) { | 796 if (!document->styleResolver() || document->styleResolver()->mediaQueryAffec
tedByViewportChange()) { |
797 document->styleResolverChanged(RecalcStyleDeferred); | 797 document->styleResolverChanged(RecalcStyleDeferred); |
798 document->mediaQueryAffectingValueChanged(); | 798 document->mediaQueryAffectingValueChanged(); |
799 | 799 |
800 // FIXME: This instrumentation event is not strictly accurate since cach
ed media query results | 800 // FIXME: This instrumentation event is not strictly accurate since cach
ed media query results |
801 // do not persist across StyleResolver rebuilds. | 801 // do not persist across StyleResolver rebuilds. |
802 InspectorInstrumentation::mediaQueryResultChanged(document); | 802 InspectorInstrumentation::mediaQueryResultChanged(document); |
803 } else { | 803 } else { |
804 document->evaluateMediaQueryList(); | 804 document->evaluateMediaQueryList(); |
805 } | 805 } |
806 | 806 |
807 // If there is any pagination to apply, it will affect the RenderView's styl
e, so we should | 807 // If there is any pagination to apply, it will affect the RenderView's styl
e, so we should |
808 // take care of that now. | 808 // take care of that now. |
809 applyPaginationToViewport(); | 809 applyPaginationToViewport(); |
810 | 810 |
811 // Always ensure our style info is up-to-date. This can happen in situations
where | 811 // Always ensure our style info is up-to-date. This can happen in situations
where |
812 // the layout beats any sort of style recalc update that needs to occur. | 812 // the layout beats any sort of style recalc update that needs to occur. |
813 TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleU
pdate, true); | 813 TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleU
pdate, true); |
814 document->updateStyleIfNeeded(); | 814 document->updateStyleIfNeeded(); |
| 815 lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
815 } | 816 } |
816 | 817 |
817 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
out) | 818 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
out) |
818 { | 819 { |
819 ASSERT(!m_inPerformLayout); | |
820 | |
821 TRACE_EVENT0("webkit", "FrameView::performLayout"); | 820 TRACE_EVENT0("webkit", "FrameView::performLayout"); |
822 | 821 |
823 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); | 822 ASSERT(!isInPerformLayout()); |
| 823 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); |
824 | 824 |
825 // performLayout is the actual guts of layout(). | 825 // performLayout is the actual guts of layout(). |
826 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions | 826 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions |
827 // so that a single human could understand what layout() is actually doing. | 827 // so that a single human could understand what layout() is actually doing. |
828 | 828 |
829 { | 829 { |
830 bool disableLayoutState = false; | 830 bool disableLayoutState = false; |
831 if (inSubtreeLayout) { | 831 if (inSubtreeLayout) { |
832 RenderView* view = rootForThisLayout->view(); | 832 RenderView* view = rootForThisLayout->view(); |
833 disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootFo
rThisLayout); | 833 disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootFo
rThisLayout); |
(...skipping 16 matching lines...) Expand all Loading... |
850 TextAutosizer* textAutosizer = frame().document()->textAutosizer(); | 850 TextAutosizer* textAutosizer = frame().document()->textAutosizer(); |
851 bool autosized = textAutosizer && textAutosizer->processSubtree(rootForThisL
ayout); | 851 bool autosized = textAutosizer && textAutosizer->processSubtree(rootForThisL
ayout); |
852 if (autosized && rootForThisLayout->needsLayout()) { | 852 if (autosized && rootForThisLayout->needsLayout()) { |
853 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); | 853 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); |
854 rootForThisLayout->layout(); | 854 rootForThisLayout->layout(); |
855 gatherDebugLayoutRects(rootForThisLayout); | 855 gatherDebugLayoutRects(rootForThisLayout); |
856 } | 856 } |
857 | 857 |
858 if (inSubtreeLayout) | 858 if (inSubtreeLayout) |
859 rootForThisLayout->view()->popLayoutState(rootForThisLayout); | 859 rootForThisLayout->view()->popLayoutState(rootForThisLayout); |
| 860 |
| 861 lifecycle().advanceTo(DocumentLifecycle::AfterPerformLayout); |
860 } | 862 } |
861 | 863 |
862 void FrameView::scheduleOrPerformPostLayoutTasks() | 864 void FrameView::scheduleOrPerformPostLayoutTasks() |
863 { | 865 { |
864 if (m_postLayoutTasksTimer.isActive()) | 866 if (m_postLayoutTasksTimer.isActive()) |
865 return; | 867 return; |
866 | 868 |
867 // Partial layouts should not happen with synchronous post layouts. | 869 // Partial layouts should not happen with synchronous post layouts. |
868 ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping())); | 870 ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping())); |
869 | 871 |
(...skipping 15 matching lines...) Expand all Loading... |
885 } | 887 } |
886 } | 888 } |
887 | 889 |
888 void FrameView::layout(bool allowSubtree) | 890 void FrameView::layout(bool allowSubtree) |
889 { | 891 { |
890 // We should never layout a Document which is not in a Frame. | 892 // We should never layout a Document which is not in a Frame. |
891 ASSERT(m_frame); | 893 ASSERT(m_frame); |
892 ASSERT(m_frame->view() == this); | 894 ASSERT(m_frame->view() == this); |
893 ASSERT(m_frame->page()); | 895 ASSERT(m_frame->page()); |
894 | 896 |
895 if (m_inPerformLayout) | 897 if (isInPerformLayout() || !lifecycle().isActive()) |
896 return; | |
897 | |
898 if (!m_frame->document()->isActive()) | |
899 return; | 898 return; |
900 | 899 |
901 ASSERT(!partialLayout().isStopping()); | 900 ASSERT(!partialLayout().isStopping()); |
902 | 901 |
903 TRACE_EVENT0("webkit", "FrameView::layout"); | 902 TRACE_EVENT0("webkit", "FrameView::layout"); |
904 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); | 903 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); |
905 | 904 |
906 // Protect the view from being deleted during layout (in recalcStyle) | 905 // Protect the view from being deleted during layout (in recalcStyle) |
907 RefPtr<FrameView> protector(this); | 906 RefPtr<FrameView> protector(this); |
908 | 907 |
909 // Every scroll that happens during layout is programmatic. | 908 // Every scroll that happens during layout is programmatic. |
910 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 909 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
911 | 910 |
912 m_hasPendingLayout = false; | 911 m_hasPendingLayout = false; |
913 m_delayedLayout = false; | 912 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
914 | 913 |
915 // we shouldn't enter layout() while painting | 914 // We shouldn't enter layout() while painting |
916 ASSERT(!isPainting()); | 915 RELEASE_ASSERT(!isPainting()); |
917 if (isPainting()) | |
918 return; | |
919 | 916 |
920 // Store the current maximal outline size to use when computing the old/new | 917 // Store the current maximal outline size to use when computing the old/new |
921 // outline rects for repainting. | 918 // outline rects for repainting. |
922 renderView()->setOldMaximalOutlineSize(renderView()->maximalOutlineSize()); | 919 renderView()->setOldMaximalOutlineSize(renderView()->maximalOutlineSize()); |
923 | 920 |
924 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout
(m_frame.get()); | 921 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout
(m_frame.get()); |
925 | 922 |
926 if (!allowSubtree && isSubtreeLayout()) { | 923 if (!allowSubtree && isSubtreeLayout()) { |
927 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 924 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
928 m_layoutSubtreeRoot = 0; | 925 m_layoutSubtreeRoot = 0; |
(...skipping 10 matching lines...) Expand all Loading... |
939 bool inSubtreeLayout = isSubtreeLayout(); | 936 bool inSubtreeLayout = isSubtreeLayout(); |
940 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderer(); | 937 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderer(); |
941 if (!rootForThisLayout) { | 938 if (!rootForThisLayout) { |
942 // FIXME: Do we need to set m_size here? | 939 // FIXME: Do we need to set m_size here? |
943 ASSERT_NOT_REACHED(); | 940 ASSERT_NOT_REACHED(); |
944 return; | 941 return; |
945 } | 942 } |
946 | 943 |
947 bool isPartialLayout = partialLayout().isPartialLayout(); | 944 bool isPartialLayout = partialLayout().isPartialLayout(); |
948 | 945 |
| 946 if (isPartialLayout) |
| 947 lifecycleScope.setFinalState(DocumentLifecycle::StyleClean); |
| 948 |
949 FontCachePurgePreventer fontCachePurgePreventer; | 949 FontCachePurgePreventer fontCachePurgePreventer; |
950 RenderLayer* layer; | 950 RenderLayer* layer; |
951 { | 951 { |
952 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); | 952 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); |
953 | 953 |
954 m_nestedLayoutCount++; | 954 m_nestedLayoutCount++; |
955 if (!inSubtreeLayout) { | 955 if (!inSubtreeLayout) { |
956 Document* document = m_frame->document(); | 956 Document* document = m_frame->document(); |
957 Node* body = document->body(); | 957 Node* body = document->body(); |
958 if (body && body->renderer()) { | 958 if (body && body->renderer()) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 renderView()->setOldMaximalOutlineSize(0); | 1153 renderView()->setOldMaximalOutlineSize(0); |
1154 | 1154 |
1155 // Repaint the frameviews scrollbars if needed | 1155 // Repaint the frameviews scrollbars if needed |
1156 if (hasVerticalBarDamage()) | 1156 if (hasVerticalBarDamage()) |
1157 invalidateRect(verticalBarDamage()); | 1157 invalidateRect(verticalBarDamage()); |
1158 if (hasHorizontalBarDamage()) | 1158 if (hasHorizontalBarDamage()) |
1159 invalidateRect(horizontalBarDamage()); | 1159 invalidateRect(horizontalBarDamage()); |
1160 resetScrollbarDamage(); | 1160 resetScrollbarDamage(); |
1161 } | 1161 } |
1162 | 1162 |
| 1163 DocumentLifecycle& FrameView::lifecycle() const |
| 1164 { |
| 1165 return m_frame->document()->lifecycle(); |
| 1166 } |
| 1167 |
1163 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) | 1168 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) |
1164 { | 1169 { |
1165 bool isTracing; | 1170 bool isTracing; |
1166 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); | 1171 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); |
1167 if (!isTracing) | 1172 if (!isTracing) |
1168 return; | 1173 return; |
1169 if (!layoutRoot->enclosingLayer()->hasCompositedLayerMapping()) | 1174 if (!layoutRoot->enclosingLayer()->hasCompositedLayerMapping()) |
1170 return; | 1175 return; |
1171 GraphicsLayer* graphicsLayer = layoutRoot->enclosingLayer()->compositedLayer
Mapping()->mainGraphicsLayer(); | 1176 GraphicsLayer* graphicsLayer = layoutRoot->enclosingLayer()->compositedLayer
Mapping()->mainGraphicsLayer(); |
1172 if (!graphicsLayer) | 1177 if (!graphicsLayer) |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1801 m_layoutSubtreeRoot = 0; | 1806 m_layoutSubtreeRoot = 0; |
1802 } | 1807 } |
1803 if (!m_layoutSchedulingEnabled) | 1808 if (!m_layoutSchedulingEnabled) |
1804 return; | 1809 return; |
1805 if (!needsLayout()) | 1810 if (!needsLayout()) |
1806 return; | 1811 return; |
1807 if (!m_frame->document()->shouldScheduleLayout()) | 1812 if (!m_frame->document()->shouldScheduleLayout()) |
1808 return; | 1813 return; |
1809 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1814 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1810 | 1815 |
1811 int delay = m_frame->document()->minimumLayoutDelay(); | |
1812 if (m_hasPendingLayout && m_delayedLayout && !delay) | |
1813 unscheduleRelayout(); | |
1814 if (m_hasPendingLayout) | |
1815 return; | |
1816 | |
1817 m_delayedLayout = delay != 0; | |
1818 m_hasPendingLayout = true; | 1816 m_hasPendingLayout = true; |
1819 scheduleAnimation(); | 1817 scheduleAnimation(); |
1820 } | 1818 } |
1821 | 1819 |
1822 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) | 1820 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) |
1823 { | 1821 { |
1824 for (RenderObject* r = descendant; r; r = r->container()) { | 1822 for (RenderObject* r = descendant; r; r = r->container()) { |
1825 if (r == ancestor) | 1823 if (r == ancestor) |
1826 return true; | 1824 return true; |
1827 } | 1825 } |
(...skipping 26 matching lines...) Expand all Loading... |
1854 } else { | 1852 } else { |
1855 // Just do a full relayout | 1853 // Just do a full relayout |
1856 if (isSubtreeLayout()) | 1854 if (isSubtreeLayout()) |
1857 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 1855 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
1858 m_layoutSubtreeRoot = 0; | 1856 m_layoutSubtreeRoot = 0; |
1859 relayoutRoot->markContainingBlocksForLayout(false); | 1857 relayoutRoot->markContainingBlocksForLayout(false); |
1860 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1858 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1861 } | 1859 } |
1862 } | 1860 } |
1863 } else if (m_layoutSchedulingEnabled) { | 1861 } else if (m_layoutSchedulingEnabled) { |
1864 int delay = m_frame->document()->minimumLayoutDelay(); | |
1865 m_layoutSubtreeRoot = relayoutRoot; | 1862 m_layoutSubtreeRoot = relayoutRoot; |
1866 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); | 1863 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); |
1867 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1864 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1868 m_delayedLayout = delay != 0; | |
1869 m_hasPendingLayout = true; | 1865 m_hasPendingLayout = true; |
1870 scheduleAnimation(); | 1866 scheduleAnimation(); |
1871 } | 1867 } |
1872 } | 1868 } |
1873 | 1869 |
1874 bool FrameView::layoutPending() const | 1870 bool FrameView::layoutPending() const |
1875 { | 1871 { |
1876 return m_hasPendingLayout; | 1872 return m_hasPendingLayout; |
1877 } | 1873 } |
1878 | 1874 |
| 1875 bool FrameView::isInPerformLayout() const |
| 1876 { |
| 1877 return lifecycle().state() == DocumentLifecycle::InPerformLayout; |
| 1878 } |
| 1879 |
1879 bool FrameView::needsLayout() const | 1880 bool FrameView::needsLayout() const |
1880 { | 1881 { |
1881 // This can return true in cases where the document does not have a body yet
. | 1882 // This can return true in cases where the document does not have a body yet
. |
1882 // Document::shouldScheduleLayout takes care of preventing us from schedulin
g | 1883 // Document::shouldScheduleLayout takes care of preventing us from schedulin
g |
1883 // layout in that case. | 1884 // layout in that case. |
1884 | 1885 |
1885 RenderView* renderView = this->renderView(); | 1886 RenderView* renderView = this->renderView(); |
1886 return layoutPending() | 1887 return layoutPending() |
1887 || (renderView && renderView->needsLayout()) | 1888 || (renderView && renderView->needsLayout()) |
1888 || isSubtreeLayout(); | 1889 || isSubtreeLayout(); |
1889 } | 1890 } |
1890 | 1891 |
1891 void FrameView::setNeedsLayout() | 1892 void FrameView::setNeedsLayout() |
1892 { | 1893 { |
1893 if (RenderView* renderView = this->renderView()) | 1894 if (RenderView* renderView = this->renderView()) |
1894 renderView->setNeedsLayout(); | 1895 renderView->setNeedsLayout(); |
1895 } | 1896 } |
1896 | 1897 |
1897 void FrameView::unscheduleRelayout() | |
1898 { | |
1899 if (!m_hasPendingLayout) | |
1900 return; | |
1901 | |
1902 m_hasPendingLayout = false; | |
1903 m_delayedLayout = false; | |
1904 } | |
1905 | |
1906 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) | 1898 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) |
1907 { | 1899 { |
1908 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex
t()) { | 1900 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex
t()) { |
1909 frame->view()->serviceScrollAnimations(); | 1901 frame->view()->serviceScrollAnimations(); |
1910 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) | 1902 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) |
1911 frame->animation().serviceAnimations(); | 1903 frame->animation().serviceAnimations(); |
1912 | 1904 |
1913 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni
cAnimationStartTime); | 1905 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni
cAnimationStartTime); |
1914 } | 1906 } |
1915 | 1907 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 scrollPositionChanged(); | 2316 scrollPositionChanged(); |
2325 frame().loader().client()->didChangeScrollOffset(); | 2317 frame().loader().client()->didChangeScrollOffset(); |
2326 } | 2318 } |
2327 | 2319 |
2328 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
t) | 2320 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
t) |
2329 { | 2321 { |
2330 // Add in our offset within the FrameView. | 2322 // Add in our offset within the FrameView. |
2331 IntRect dirtyRect = rect; | 2323 IntRect dirtyRect = rect; |
2332 dirtyRect.moveBy(scrollbar->location()); | 2324 dirtyRect.moveBy(scrollbar->location()); |
2333 | 2325 |
2334 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && m_inPerformLayout
) { | 2326 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && isInPerformLayout
()) { |
2335 if (scrollbar == verticalScrollbar()) { | 2327 if (scrollbar == verticalScrollbar()) { |
2336 m_verticalBarDamage = dirtyRect; | 2328 m_verticalBarDamage = dirtyRect; |
2337 m_hasVerticalBarDamage = true; | 2329 m_hasVerticalBarDamage = true; |
2338 } else { | 2330 } else { |
2339 m_horizontalBarDamage = dirtyRect; | 2331 m_horizontalBarDamage = dirtyRect; |
2340 m_hasHorizontalBarDamage = true; | 2332 m_hasHorizontalBarDamage = true; |
2341 } | 2333 } |
2342 } else { | 2334 } else { |
2343 invalidateRect(dirtyRect); | 2335 invalidateRect(dirtyRect); |
2344 } | 2336 } |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3224 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3216 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
3225 { | 3217 { |
3226 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3218 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3227 if (AXObjectCache* cache = axObjectCache()) { | 3219 if (AXObjectCache* cache = axObjectCache()) { |
3228 cache->remove(scrollbar); | 3220 cache->remove(scrollbar); |
3229 cache->handleScrollbarUpdate(this); | 3221 cache->handleScrollbarUpdate(this); |
3230 } | 3222 } |
3231 } | 3223 } |
3232 | 3224 |
3233 } // namespace WebCore | 3225 } // namespace WebCore |
OLD | NEW |