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

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

Issue 156943004: Remove minimum layout delay (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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') | no next file » | 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 228 m_inPerformLayout = false;
230 m_canRepaintDuringPerformLayout = false; 229 m_canRepaintDuringPerformLayout = false;
231 m_doingPreLayoutStyleUpdate = false; 230 m_doingPreLayoutStyleUpdate = false;
232 m_inSynchronousPostLayout = false; 231 m_inSynchronousPostLayout = false;
233 m_layoutCount = 0; 232 m_layoutCount = 0;
234 m_nestedLayoutCount = 0; 233 m_nestedLayoutCount = 0;
235 m_postLayoutTasksTimer.stop(); 234 m_postLayoutTasksTimer.stop();
236 m_updateWidgetsTimer.stop(); 235 m_updateWidgetsTimer.stop();
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
914 912
915 // we shouldn't enter layout() while painting 913 // we shouldn't enter layout() while painting
916 ASSERT(!isPainting()); 914 ASSERT(!isPainting());
917 if (isPainting()) 915 if (isPainting())
918 return; 916 return;
919 917
920 // Store the current maximal outline size to use when computing the old/new 918 // Store the current maximal outline size to use when computing the old/new
921 // outline rects for repainting. 919 // outline rects for repainting.
922 renderView()->setOldMaximalOutlineSize(renderView()->maximalOutlineSize()); 920 renderView()->setOldMaximalOutlineSize(renderView()->maximalOutlineSize());
923 921
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 m_layoutSubtreeRoot = 0; 1799 m_layoutSubtreeRoot = 0;
1802 } 1800 }
1803 if (!m_layoutSchedulingEnabled) 1801 if (!m_layoutSchedulingEnabled)
1804 return; 1802 return;
1805 if (!needsLayout()) 1803 if (!needsLayout())
1806 return; 1804 return;
1807 if (!m_frame->document()->shouldScheduleLayout()) 1805 if (!m_frame->document()->shouldScheduleLayout())
1808 return; 1806 return;
1809 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); 1807 InspectorInstrumentation::didInvalidateLayout(m_frame.get());
1810 1808
1811 int delay = m_frame->document()->minimumLayoutDelay();
1812 if (m_hasPendingLayout && m_delayedLayout && !delay)
1813 unscheduleRelayout();
1814 if (m_hasPendingLayout) 1809 if (m_hasPendingLayout)
1815 return; 1810 return;
1816
1817 m_delayedLayout = delay != 0;
1818 m_hasPendingLayout = true; 1811 m_hasPendingLayout = true;
1819 scheduleAnimation(); 1812 scheduleAnimation();
1820 } 1813 }
1821 1814
1822 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant) 1815 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant)
1823 { 1816 {
1824 for (RenderObject* r = descendant; r; r = r->container()) { 1817 for (RenderObject* r = descendant; r; r = r->container()) {
1825 if (r == ancestor) 1818 if (r == ancestor)
1826 return true; 1819 return true;
1827 } 1820 }
(...skipping 26 matching lines...) Expand all
1854 } else { 1847 } else {
1855 // Just do a full relayout 1848 // Just do a full relayout
1856 if (isSubtreeLayout()) 1849 if (isSubtreeLayout())
1857 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); 1850 m_layoutSubtreeRoot->markContainingBlocksForLayout(false);
1858 m_layoutSubtreeRoot = 0; 1851 m_layoutSubtreeRoot = 0;
1859 relayoutRoot->markContainingBlocksForLayout(false); 1852 relayoutRoot->markContainingBlocksForLayout(false);
1860 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); 1853 InspectorInstrumentation::didInvalidateLayout(m_frame.get());
1861 } 1854 }
1862 } 1855 }
1863 } else if (m_layoutSchedulingEnabled) { 1856 } else if (m_layoutSchedulingEnabled) {
1864 int delay = m_frame->document()->minimumLayoutDelay();
1865 m_layoutSubtreeRoot = relayoutRoot; 1857 m_layoutSubtreeRoot = relayoutRoot;
1866 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai ner()->needsLayout()); 1858 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai ner()->needsLayout());
1867 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); 1859 InspectorInstrumentation::didInvalidateLayout(m_frame.get());
1868 m_delayedLayout = delay != 0;
1869 m_hasPendingLayout = true; 1860 m_hasPendingLayout = true;
1870 scheduleAnimation(); 1861 scheduleAnimation();
1871 } 1862 }
1872 } 1863 }
1873 1864
1874 bool FrameView::layoutPending() const 1865 bool FrameView::layoutPending() const
1875 { 1866 {
1876 return m_hasPendingLayout; 1867 return m_hasPendingLayout;
1877 } 1868 }
1878 1869
1879 bool FrameView::needsLayout() const 1870 bool FrameView::needsLayout() const
1880 { 1871 {
1881 // This can return true in cases where the document does not have a body yet . 1872 // 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 1873 // Document::shouldScheduleLayout takes care of preventing us from schedulin g
1883 // layout in that case. 1874 // layout in that case.
1884 1875
1885 RenderView* renderView = this->renderView(); 1876 RenderView* renderView = this->renderView();
1886 return layoutPending() 1877 return layoutPending()
1887 || (renderView && renderView->needsLayout()) 1878 || (renderView && renderView->needsLayout())
1888 || isSubtreeLayout(); 1879 || isSubtreeLayout();
1889 } 1880 }
1890 1881
1891 void FrameView::setNeedsLayout() 1882 void FrameView::setNeedsLayout()
1892 { 1883 {
1893 if (RenderView* renderView = this->renderView()) 1884 if (RenderView* renderView = this->renderView())
1894 renderView->setNeedsLayout(); 1885 renderView->setNeedsLayout();
1895 } 1886 }
1896 1887
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) 1888 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime)
1907 { 1889 {
1908 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex t()) { 1890 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex t()) {
1909 frame->view()->serviceScrollAnimations(); 1891 frame->view()->serviceScrollAnimations();
1910 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 1892 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
1911 frame->animation().serviceAnimations(); 1893 frame->animation().serviceAnimations();
1912 1894
1913 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni cAnimationStartTime); 1895 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni cAnimationStartTime);
1914 } 1896 }
1915 1897
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
3237 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3219 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3238 { 3220 {
3239 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3221 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3240 if (AXObjectCache* cache = axObjectCache()) { 3222 if (AXObjectCache* cache = axObjectCache()) {
3241 cache->remove(scrollbar); 3223 cache->remove(scrollbar);
3242 cache->handleScrollbarUpdate(this); 3224 cache->handleScrollbarUpdate(this);
3243 } 3225 }
3244 } 3226 }
3245 3227
3246 } // namespace WebCore 3228 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698