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); | |
ojan
2014/02/06 05:11:39
I wonder if updateStyleIfNeeded should be doing th
abarth-chromium
2014/02/06 05:31:15
Yeah, I wondered that too. I tried a few variatio
| |
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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1800 m_layoutSubtreeRoot = 0; | 1805 m_layoutSubtreeRoot = 0; |
1801 } | 1806 } |
1802 if (!m_layoutSchedulingEnabled) | 1807 if (!m_layoutSchedulingEnabled) |
1803 return; | 1808 return; |
1804 if (!needsLayout()) | 1809 if (!needsLayout()) |
1805 return; | 1810 return; |
1806 if (!m_frame->document()->shouldScheduleLayout()) | 1811 if (!m_frame->document()->shouldScheduleLayout()) |
1807 return; | 1812 return; |
1808 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1813 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1809 | 1814 |
1810 int delay = m_frame->document()->minimumLayoutDelay(); | |
1811 if (m_hasPendingLayout && m_delayedLayout && !delay) | |
1812 unscheduleRelayout(); | |
1813 if (m_hasPendingLayout) | |
1814 return; | |
1815 | |
1816 m_delayedLayout = delay != 0; | |
1817 m_hasPendingLayout = true; | 1815 m_hasPendingLayout = true; |
1818 scheduleAnimation(); | 1816 scheduleAnimation(); |
1819 } | 1817 } |
1820 | 1818 |
1821 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant) | 1819 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant) |
1822 { | 1820 { |
1823 for (RenderObject* r = descendant; r; r = r->container()) { | 1821 for (RenderObject* r = descendant; r; r = r->container()) { |
1824 if (r == ancestor) | 1822 if (r == ancestor) |
1825 return true; | 1823 return true; |
1826 } | 1824 } |
(...skipping 26 matching lines...) Expand all Loading... | |
1853 } else { | 1851 } else { |
1854 // Just do a full relayout | 1852 // Just do a full relayout |
1855 if (isSubtreeLayout()) | 1853 if (isSubtreeLayout()) |
1856 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 1854 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
1857 m_layoutSubtreeRoot = 0; | 1855 m_layoutSubtreeRoot = 0; |
1858 relayoutRoot->markContainingBlocksForLayout(false); | 1856 relayoutRoot->markContainingBlocksForLayout(false); |
1859 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1857 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1860 } | 1858 } |
1861 } | 1859 } |
1862 } else if (m_layoutSchedulingEnabled) { | 1860 } else if (m_layoutSchedulingEnabled) { |
1863 int delay = m_frame->document()->minimumLayoutDelay(); | |
1864 m_layoutSubtreeRoot = relayoutRoot; | 1861 m_layoutSubtreeRoot = relayoutRoot; |
1865 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai ner()->needsLayout()); | 1862 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai ner()->needsLayout()); |
1866 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1863 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1867 m_delayedLayout = delay != 0; | |
1868 m_hasPendingLayout = true; | 1864 m_hasPendingLayout = true; |
1869 scheduleAnimation(); | 1865 scheduleAnimation(); |
1870 } | 1866 } |
1871 } | 1867 } |
1872 | 1868 |
1873 bool FrameView::layoutPending() const | 1869 bool FrameView::layoutPending() const |
1874 { | 1870 { |
1875 return m_hasPendingLayout; | 1871 return m_hasPendingLayout; |
1876 } | 1872 } |
1877 | 1873 |
1874 bool FrameView::isInPerformLayout() const | |
1875 { | |
1876 return lifecycle().state() == DocumentLifecycle::InPerformLayout; | |
1877 } | |
1878 | |
1878 bool FrameView::needsLayout() const | 1879 bool FrameView::needsLayout() const |
1879 { | 1880 { |
1880 // This can return true in cases where the document does not have a body yet . | 1881 // This can return true in cases where the document does not have a body yet . |
1881 // Document::shouldScheduleLayout takes care of preventing us from schedulin g | 1882 // Document::shouldScheduleLayout takes care of preventing us from schedulin g |
1882 // layout in that case. | 1883 // layout in that case. |
1883 | 1884 |
1884 RenderView* renderView = this->renderView(); | 1885 RenderView* renderView = this->renderView(); |
1885 return layoutPending() | 1886 return layoutPending() |
1886 || (renderView && renderView->needsLayout()) | 1887 || (renderView && renderView->needsLayout()) |
1887 || isSubtreeLayout(); | 1888 || isSubtreeLayout(); |
1888 } | 1889 } |
1889 | 1890 |
1890 void FrameView::setNeedsLayout() | 1891 void FrameView::setNeedsLayout() |
1891 { | 1892 { |
1892 if (RenderView* renderView = this->renderView()) | 1893 if (RenderView* renderView = this->renderView()) |
1893 renderView->setNeedsLayout(); | 1894 renderView->setNeedsLayout(); |
1894 } | 1895 } |
1895 | 1896 |
1896 void FrameView::unscheduleRelayout() | |
1897 { | |
1898 if (!m_hasPendingLayout) | |
1899 return; | |
1900 | |
1901 m_hasPendingLayout = false; | |
1902 m_delayedLayout = false; | |
1903 } | |
1904 | |
1905 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) | 1897 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) |
1906 { | 1898 { |
1907 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex t()) { | 1899 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex t()) { |
1908 frame->view()->serviceScrollAnimations(); | 1900 frame->view()->serviceScrollAnimations(); |
1909 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) | 1901 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) |
1910 frame->animation().serviceAnimations(); | 1902 frame->animation().serviceAnimations(); |
1911 | 1903 |
1912 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni cAnimationStartTime); | 1904 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni cAnimationStartTime); |
1913 } | 1905 } |
1914 | 1906 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2323 scrollPositionChanged(); | 2315 scrollPositionChanged(); |
2324 frame().loader().client()->didChangeScrollOffset(); | 2316 frame().loader().client()->didChangeScrollOffset(); |
2325 } | 2317 } |
2326 | 2318 |
2327 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec t) | 2319 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec t) |
2328 { | 2320 { |
2329 // Add in our offset within the FrameView. | 2321 // Add in our offset within the FrameView. |
2330 IntRect dirtyRect = rect; | 2322 IntRect dirtyRect = rect; |
2331 dirtyRect.moveBy(scrollbar->location()); | 2323 dirtyRect.moveBy(scrollbar->location()); |
2332 | 2324 |
2333 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && m_inPerformLayout ) { | 2325 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && isInPerformLayout ()) { |
2334 if (scrollbar == verticalScrollbar()) { | 2326 if (scrollbar == verticalScrollbar()) { |
2335 m_verticalBarDamage = dirtyRect; | 2327 m_verticalBarDamage = dirtyRect; |
2336 m_hasVerticalBarDamage = true; | 2328 m_hasVerticalBarDamage = true; |
2337 } else { | 2329 } else { |
2338 m_horizontalBarDamage = dirtyRect; | 2330 m_horizontalBarDamage = dirtyRect; |
2339 m_hasHorizontalBarDamage = true; | 2331 m_hasHorizontalBarDamage = true; |
2340 } | 2332 } |
2341 } else { | 2333 } else { |
2342 invalidateRect(dirtyRect); | 2334 invalidateRect(dirtyRect); |
2343 } | 2335 } |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3223 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) | 3215 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) |
3224 { | 3216 { |
3225 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3217 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3226 if (AXObjectCache* cache = axObjectCache()) { | 3218 if (AXObjectCache* cache = axObjectCache()) { |
3227 cache->remove(scrollbar); | 3219 cache->remove(scrollbar); |
3228 cache->handleScrollbarUpdate(this); | 3220 cache->handleScrollbarUpdate(this); |
3229 } | 3221 } |
3230 } | 3222 } |
3231 | 3223 |
3232 } // namespace WebCore | 3224 } // namespace WebCore |
OLD | NEW |