Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1001)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 145663012: Remove the layout timer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updateLayout Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/html/HTMLPlugInElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // is vertical, then we use TextDirection to choose between those options. 130 // is vertical, then we use TextDirection to choose between those options.
131 if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && te xtDirection == LTR)) 131 if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && te xtDirection == LTR))
132 return Pagination::TopToBottomPaginated; 132 return Pagination::TopToBottomPaginated;
133 return Pagination::BottomToTopPaginated; 133 return Pagination::BottomToTopPaginated;
134 } 134 }
135 135
136 FrameView::FrameView(Frame* frame) 136 FrameView::FrameView(Frame* frame)
137 : m_frame(frame) 137 : m_frame(frame)
138 , m_canHaveScrollbars(true) 138 , m_canHaveScrollbars(true)
139 , m_slowRepaintObjectCount(0) 139 , m_slowRepaintObjectCount(0)
140 , m_layoutTimer(this, &FrameView::layoutTimerFired) 140 , m_hasPendingLayout(false)
141 , m_layoutSubtreeRoot(0) 141 , m_layoutSubtreeRoot(0)
142 , m_inSynchronousPostLayout(false) 142 , m_inSynchronousPostLayout(false)
143 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 143 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
144 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) 144 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired)
145 , m_isTransparent(false) 145 , m_isTransparent(false)
146 , m_baseBackgroundColor(Color::white) 146 , m_baseBackgroundColor(Color::white)
147 , m_mediaType("screen") 147 , m_mediaType("screen")
148 , m_overflowStatusDirty(true) 148 , m_overflowStatusDirty(true)
149 , m_viewportRenderer(0) 149 , m_viewportRenderer(0)
150 , m_wasScrolledByUser(false) 150 , m_wasScrolledByUser(false)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 RenderPart* renderer = m_frame->ownerRenderer(); 214 RenderPart* renderer = m_frame->ownerRenderer();
215 if (renderer && renderer->widget() == this) 215 if (renderer && renderer->widget() == this)
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_layoutTimer.stop(); 224 m_hasPendingLayout = false;
225 m_layoutSubtreeRoot = 0; 225 m_layoutSubtreeRoot = 0;
226 m_delayedLayout = false; 226 m_delayedLayout = false;
227 m_doFullRepaint = true; 227 m_doFullRepaint = true;
228 m_layoutSchedulingEnabled = true; 228 m_layoutSchedulingEnabled = true;
229 m_inPerformLayout = false; 229 m_inPerformLayout = false;
230 m_canRepaintDuringPerformLayout = false; 230 m_canRepaintDuringPerformLayout = false;
231 m_doingPreLayoutStyleUpdate = false; 231 m_doingPreLayoutStyleUpdate = false;
232 m_inSynchronousPostLayout = false; 232 m_inSynchronousPostLayout = false;
233 m_layoutCount = 0; 233 m_layoutCount = 0;
234 m_nestedLayoutCount = 0; 234 m_nestedLayoutCount = 0;
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 902
903 TRACE_EVENT0("webkit", "FrameView::layout"); 903 TRACE_EVENT0("webkit", "FrameView::layout");
904 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); 904 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout");
905 905
906 // Protect the view from being deleted during layout (in recalcStyle) 906 // Protect the view from being deleted during layout (in recalcStyle)
907 RefPtr<FrameView> protector(this); 907 RefPtr<FrameView> protector(this);
908 908
909 // Every scroll that happens during layout is programmatic. 909 // Every scroll that happens during layout is programmatic.
910 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); 910 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e);
911 911
912 m_layoutTimer.stop(); 912 m_hasPendingLayout = false;
913 m_delayedLayout = false; 913 m_delayedLayout = false;
914 914
915 // we shouldn't enter layout() while painting 915 // we shouldn't enter layout() while painting
916 ASSERT(!isPainting()); 916 ASSERT(!isPainting());
917 if (isPainting()) 917 if (isPainting())
918 return; 918 return;
919 919
920 // Store the current maximal outline size to use when computing the old/new 920 // Store the current maximal outline size to use when computing the old/new
921 // outline rects for repainting. 921 // outline rects for repainting.
922 renderView()->setOldMaximalOutlineSize(renderView()->maximalOutlineSize()); 922 renderView()->setOldMaximalOutlineSize(renderView()->maximalOutlineSize());
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 } 1784 }
1785 } 1785 }
1786 1786
1787 void FrameView::handleLoadCompleted() 1787 void FrameView::handleLoadCompleted()
1788 { 1788 {
1789 // Once loading has completed, allow autoSize one last opportunity to 1789 // Once loading has completed, allow autoSize one last opportunity to
1790 // reduce the size of the frame. 1790 // reduce the size of the frame.
1791 autoSizeIfEnabled(); 1791 autoSizeIfEnabled();
1792 } 1792 }
1793 1793
1794 void FrameView::layoutTimerFired(Timer<FrameView>*)
1795 {
1796 layout();
1797 }
1798
1799 void FrameView::scheduleRelayout() 1794 void FrameView::scheduleRelayout()
1800 { 1795 {
1801 ASSERT(m_frame->view() == this); 1796 ASSERT(m_frame->view() == this);
1802 1797
1803 if (isSubtreeLayout()) { 1798 if (isSubtreeLayout()) {
1804 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); 1799 m_layoutSubtreeRoot->markContainingBlocksForLayout(false);
1805 m_layoutSubtreeRoot = 0; 1800 m_layoutSubtreeRoot = 0;
1806 } 1801 }
1807 if (!m_layoutSchedulingEnabled) 1802 if (!m_layoutSchedulingEnabled)
1808 return; 1803 return;
1809 if (!needsLayout()) 1804 if (!needsLayout())
1810 return; 1805 return;
1811 if (!m_frame->document()->shouldScheduleLayout()) 1806 if (!m_frame->document()->shouldScheduleLayout())
1812 return; 1807 return;
1813 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); 1808 InspectorInstrumentation::didInvalidateLayout(m_frame.get());
1814 1809
1815 int delay = m_frame->document()->minimumLayoutDelay(); 1810 int delay = m_frame->document()->minimumLayoutDelay();
1816 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) 1811 if (m_hasPendingLayout && m_delayedLayout && !delay)
1817 unscheduleRelayout(); 1812 unscheduleRelayout();
1818 if (m_layoutTimer.isActive()) 1813 if (m_hasPendingLayout)
1819 return; 1814 return;
1820 1815
1821 m_delayedLayout = delay != 0; 1816 m_delayedLayout = delay != 0;
1822 m_layoutTimer.startOneShot(delay * 0.001); 1817 m_hasPendingLayout = true;
1818 scheduleAnimation();
1823 } 1819 }
1824 1820
1825 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant) 1821 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant)
1826 { 1822 {
1827 for (RenderObject* r = descendant; r; r = r->container()) { 1823 for (RenderObject* r = descendant; r; r = r->container()) {
1828 if (r == ancestor) 1824 if (r == ancestor)
1829 return true; 1825 return true;
1830 } 1826 }
1831 return false; 1827 return false;
1832 } 1828 }
(...skipping 29 matching lines...) Expand all
1862 relayoutRoot->markContainingBlocksForLayout(false); 1858 relayoutRoot->markContainingBlocksForLayout(false);
1863 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); 1859 InspectorInstrumentation::didInvalidateLayout(m_frame.get());
1864 } 1860 }
1865 } 1861 }
1866 } else if (m_layoutSchedulingEnabled) { 1862 } else if (m_layoutSchedulingEnabled) {
1867 int delay = m_frame->document()->minimumLayoutDelay(); 1863 int delay = m_frame->document()->minimumLayoutDelay();
1868 m_layoutSubtreeRoot = relayoutRoot; 1864 m_layoutSubtreeRoot = relayoutRoot;
1869 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai ner()->needsLayout()); 1865 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai ner()->needsLayout());
1870 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); 1866 InspectorInstrumentation::didInvalidateLayout(m_frame.get());
1871 m_delayedLayout = delay != 0; 1867 m_delayedLayout = delay != 0;
1872 m_layoutTimer.startOneShot(delay * 0.001); 1868 m_hasPendingLayout = true;
1869 scheduleAnimation();
1873 } 1870 }
1874 } 1871 }
1875 1872
1876 bool FrameView::layoutPending() const 1873 bool FrameView::layoutPending() const
1877 { 1874 {
1878 return m_layoutTimer.isActive(); 1875 return m_hasPendingLayout;
1879 } 1876 }
1880 1877
1881 bool FrameView::needsLayout() const 1878 bool FrameView::needsLayout() const
1882 { 1879 {
1883 // This can return true in cases where the document does not have a body yet . 1880 // This can return true in cases where the document does not have a body yet .
1884 // Document::shouldScheduleLayout takes care of preventing us from schedulin g 1881 // Document::shouldScheduleLayout takes care of preventing us from schedulin g
1885 // layout in that case. 1882 // layout in that case.
1886 1883
1887 RenderView* renderView = this->renderView(); 1884 RenderView* renderView = this->renderView();
1888 return layoutPending() 1885 return layoutPending()
1889 || (renderView && renderView->needsLayout()) 1886 || (renderView && renderView->needsLayout())
1890 || isSubtreeLayout(); 1887 || isSubtreeLayout();
1891 } 1888 }
1892 1889
1893 void FrameView::setNeedsLayout() 1890 void FrameView::setNeedsLayout()
1894 { 1891 {
1895 if (RenderView* renderView = this->renderView()) 1892 if (RenderView* renderView = this->renderView())
1896 renderView->setNeedsLayout(); 1893 renderView->setNeedsLayout();
1897 } 1894 }
1898 1895
1899 void FrameView::unscheduleRelayout() 1896 void FrameView::unscheduleRelayout()
1900 { 1897 {
1901 if (!m_layoutTimer.isActive()) 1898 if (!m_hasPendingLayout)
1902 return; 1899 return;
1903 1900
1904 m_layoutTimer.stop(); 1901 m_hasPendingLayout = false;
1905 m_delayedLayout = false; 1902 m_delayedLayout = false;
1906 } 1903 }
1907 1904
1908 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) 1905 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime)
1909 { 1906 {
1910 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex t()) { 1907 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex t()) {
1911 frame->view()->serviceScrollAnimations(); 1908 frame->view()->serviceScrollAnimations();
1912 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 1909 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
1913 frame->animation().serviceAnimations(); 1910 frame->animation().serviceAnimations();
1914 1911
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3223 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3227 { 3224 {
3228 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3225 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3229 if (AXObjectCache* cache = axObjectCache()) { 3226 if (AXObjectCache* cache = axObjectCache()) {
3230 cache->remove(scrollbar); 3227 cache->remove(scrollbar);
3231 cache->handleScrollbarUpdate(this); 3228 cache->handleScrollbarUpdate(this);
3232 } 3229 }
3233 } 3230 }
3234 3231
3235 } // namespace WebCore 3232 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/html/HTMLPlugInElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698