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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // is vertical, then we use TextDirection to choose between those options. | 129 // is vertical, then we use TextDirection to choose between those options. |
130 if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && te
xtDirection == RTL)) | 130 if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && te
xtDirection == RTL)) |
131 return Pagination::TopToBottomPaginated; | 131 return Pagination::TopToBottomPaginated; |
132 return Pagination::BottomToTopPaginated; | 132 return Pagination::BottomToTopPaginated; |
133 } | 133 } |
134 | 134 |
135 FrameView::FrameView(Frame* frame) | 135 FrameView::FrameView(Frame* frame) |
136 : m_frame(frame) | 136 : m_frame(frame) |
137 , m_canHaveScrollbars(true) | 137 , m_canHaveScrollbars(true) |
138 , m_slowRepaintObjectCount(0) | 138 , m_slowRepaintObjectCount(0) |
139 , m_hasPendingLayout(false) | 139 , m_layoutTimer(this, &FrameView::layoutTimerFired) |
140 , m_layoutSubtreeRoot(0) | 140 , m_layoutSubtreeRoot(0) |
141 , m_inSynchronousPostLayout(false) | 141 , m_inSynchronousPostLayout(false) |
142 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) | 142 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) |
143 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) | 143 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) |
144 , m_isTransparent(false) | 144 , m_isTransparent(false) |
145 , m_baseBackgroundColor(Color::white) | 145 , m_baseBackgroundColor(Color::white) |
146 , m_mediaType("screen") | 146 , m_mediaType("screen") |
147 , m_overflowStatusDirty(true) | 147 , m_overflowStatusDirty(true) |
148 , m_viewportRenderer(0) | 148 , m_viewportRenderer(0) |
149 , m_wasScrolledByUser(false) | 149 , m_wasScrolledByUser(false) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 RenderPart* renderer = m_frame->ownerRenderer(); | 213 RenderPart* renderer = m_frame->ownerRenderer(); |
214 if (renderer && renderer->widget() == this) | 214 if (renderer && renderer->widget() == this) |
215 renderer->setWidget(0); | 215 renderer->setWidget(0); |
216 } | 216 } |
217 | 217 |
218 void FrameView::reset() | 218 void FrameView::reset() |
219 { | 219 { |
220 m_cannotBlitToWindow = false; | 220 m_cannotBlitToWindow = false; |
221 m_isOverlapped = false; | 221 m_isOverlapped = false; |
222 m_contentIsOpaque = false; | 222 m_contentIsOpaque = false; |
223 m_hasPendingLayout = false; | 223 m_layoutTimer.stop(); |
224 m_layoutSubtreeRoot = 0; | 224 m_layoutSubtreeRoot = 0; |
225 m_delayedLayout = false; | 225 m_delayedLayout = false; |
226 m_doFullRepaint = true; | 226 m_doFullRepaint = true; |
227 m_layoutSchedulingEnabled = true; | 227 m_layoutSchedulingEnabled = true; |
228 m_inPerformLayout = false; | 228 m_inPerformLayout = false; |
229 m_doingPreLayoutStyleUpdate = false; | 229 m_doingPreLayoutStyleUpdate = false; |
230 m_inSynchronousPostLayout = false; | 230 m_inSynchronousPostLayout = false; |
231 m_layoutCount = 0; | 231 m_layoutCount = 0; |
232 m_nestedLayoutCount = 0; | 232 m_nestedLayoutCount = 0; |
233 m_postLayoutTasksTimer.stop(); | 233 m_postLayoutTasksTimer.stop(); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_hasPendingLayout = false; | 912 m_layoutTimer.stop(); |
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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 } | 1754 } |
1755 } | 1755 } |
1756 | 1756 |
1757 void FrameView::handleLoadCompleted() | 1757 void FrameView::handleLoadCompleted() |
1758 { | 1758 { |
1759 // Once loading has completed, allow autoSize one last opportunity to | 1759 // Once loading has completed, allow autoSize one last opportunity to |
1760 // reduce the size of the frame. | 1760 // reduce the size of the frame. |
1761 autoSizeIfEnabled(); | 1761 autoSizeIfEnabled(); |
1762 } | 1762 } |
1763 | 1763 |
| 1764 void FrameView::layoutTimerFired(Timer<FrameView>*) |
| 1765 { |
| 1766 layout(); |
| 1767 } |
| 1768 |
1764 void FrameView::scheduleRelayout() | 1769 void FrameView::scheduleRelayout() |
1765 { | 1770 { |
1766 ASSERT(m_frame->view() == this); | 1771 ASSERT(m_frame->view() == this); |
1767 | 1772 |
1768 if (isSubtreeLayout()) { | 1773 if (isSubtreeLayout()) { |
1769 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 1774 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
1770 m_layoutSubtreeRoot = 0; | 1775 m_layoutSubtreeRoot = 0; |
1771 } | 1776 } |
1772 if (!m_layoutSchedulingEnabled) | 1777 if (!m_layoutSchedulingEnabled) |
1773 return; | 1778 return; |
1774 if (!needsLayout()) | 1779 if (!needsLayout()) |
1775 return; | 1780 return; |
1776 if (!m_frame->document()->shouldScheduleLayout()) | 1781 if (!m_frame->document()->shouldScheduleLayout()) |
1777 return; | 1782 return; |
1778 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1783 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1779 | 1784 |
1780 int delay = m_frame->document()->minimumLayoutDelay(); | 1785 int delay = m_frame->document()->minimumLayoutDelay(); |
1781 if (m_hasPendingLayout && m_delayedLayout && !delay) | 1786 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) |
1782 unscheduleRelayout(); | 1787 unscheduleRelayout(); |
1783 if (m_hasPendingLayout) | 1788 if (m_layoutTimer.isActive()) |
1784 return; | 1789 return; |
1785 | 1790 |
1786 m_delayedLayout = delay != 0; | 1791 m_delayedLayout = delay != 0; |
1787 m_hasPendingLayout = true; | 1792 m_layoutTimer.startOneShot(delay * 0.001); |
1788 scheduleAnimation(); | |
1789 } | 1793 } |
1790 | 1794 |
1791 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) | 1795 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) |
1792 { | 1796 { |
1793 for (RenderObject* r = descendant; r; r = r->container()) { | 1797 for (RenderObject* r = descendant; r; r = r->container()) { |
1794 if (r == ancestor) | 1798 if (r == ancestor) |
1795 return true; | 1799 return true; |
1796 } | 1800 } |
1797 return false; | 1801 return false; |
1798 } | 1802 } |
(...skipping 29 matching lines...) Expand all Loading... |
1828 relayoutRoot->markContainingBlocksForLayout(false); | 1832 relayoutRoot->markContainingBlocksForLayout(false); |
1829 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1833 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1830 } | 1834 } |
1831 } | 1835 } |
1832 } else if (m_layoutSchedulingEnabled) { | 1836 } else if (m_layoutSchedulingEnabled) { |
1833 int delay = m_frame->document()->minimumLayoutDelay(); | 1837 int delay = m_frame->document()->minimumLayoutDelay(); |
1834 m_layoutSubtreeRoot = relayoutRoot; | 1838 m_layoutSubtreeRoot = relayoutRoot; |
1835 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); | 1839 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); |
1836 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1840 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1837 m_delayedLayout = delay != 0; | 1841 m_delayedLayout = delay != 0; |
1838 m_hasPendingLayout = true; | 1842 m_layoutTimer.startOneShot(delay * 0.001); |
1839 scheduleAnimation(); | |
1840 } | 1843 } |
1841 } | 1844 } |
1842 | 1845 |
1843 bool FrameView::layoutPending() const | 1846 bool FrameView::layoutPending() const |
1844 { | 1847 { |
1845 return m_hasPendingLayout; | 1848 return m_layoutTimer.isActive(); |
1846 } | 1849 } |
1847 | 1850 |
1848 bool FrameView::needsLayout() const | 1851 bool FrameView::needsLayout() const |
1849 { | 1852 { |
1850 // This can return true in cases where the document does not have a body yet
. | 1853 // This can return true in cases where the document does not have a body yet
. |
1851 // Document::shouldScheduleLayout takes care of preventing us from schedulin
g | 1854 // Document::shouldScheduleLayout takes care of preventing us from schedulin
g |
1852 // layout in that case. | 1855 // layout in that case. |
1853 | 1856 |
1854 RenderView* renderView = this->renderView(); | 1857 RenderView* renderView = this->renderView(); |
1855 return layoutPending() | 1858 return layoutPending() |
1856 || (renderView && renderView->needsLayout()) | 1859 || (renderView && renderView->needsLayout()) |
1857 || isSubtreeLayout(); | 1860 || isSubtreeLayout(); |
1858 } | 1861 } |
1859 | 1862 |
1860 void FrameView::setNeedsLayout() | 1863 void FrameView::setNeedsLayout() |
1861 { | 1864 { |
1862 if (RenderView* renderView = this->renderView()) | 1865 if (RenderView* renderView = this->renderView()) |
1863 renderView->setNeedsLayout(); | 1866 renderView->setNeedsLayout(); |
1864 } | 1867 } |
1865 | 1868 |
1866 void FrameView::unscheduleRelayout() | 1869 void FrameView::unscheduleRelayout() |
1867 { | 1870 { |
1868 if (!m_hasPendingLayout) | 1871 if (!m_layoutTimer.isActive()) |
1869 return; | 1872 return; |
1870 | 1873 |
1871 m_hasPendingLayout = false; | 1874 m_layoutTimer.stop(); |
1872 m_delayedLayout = false; | 1875 m_delayedLayout = false; |
1873 } | 1876 } |
1874 | 1877 |
1875 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) | 1878 void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) |
1876 { | 1879 { |
1877 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex
t()) { | 1880 for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree().traverseNex
t()) { |
1878 frame->view()->serviceScrollAnimations(); | 1881 frame->view()->serviceScrollAnimations(); |
1879 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) | 1882 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) |
1880 frame->animation().serviceAnimations(); | 1883 frame->animation().serviceAnimations(); |
1881 | 1884 |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3192 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3195 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
3193 { | 3196 { |
3194 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3197 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3195 if (AXObjectCache* cache = axObjectCache()) { | 3198 if (AXObjectCache* cache = axObjectCache()) { |
3196 cache->remove(scrollbar); | 3199 cache->remove(scrollbar); |
3197 cache->handleScrollbarUpdate(this); | 3200 cache->handleScrollbarUpdate(this); |
3198 } | 3201 } |
3199 } | 3202 } |
3200 | 3203 |
3201 } // namespace WebCore | 3204 } // namespace WebCore |
OLD | NEW |