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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 , m_isTrackingRepaints(false) | 172 , m_isTrackingRepaints(false) |
173 , m_shouldUpdateWhileOffscreen(true) | 173 , m_shouldUpdateWhileOffscreen(true) |
174 , m_deferSetNeedsLayouts(0) | 174 , m_deferSetNeedsLayouts(0) |
175 , m_setNeedsLayoutWasDeferred(false) | 175 , m_setNeedsLayoutWasDeferred(false) |
176 , m_scrollCorner(0) | 176 , m_scrollCorner(0) |
177 , m_shouldAutoSize(false) | 177 , m_shouldAutoSize(false) |
178 , m_inAutoSize(false) | 178 , m_inAutoSize(false) |
179 , m_didRunAutosize(false) | 179 , m_didRunAutosize(false) |
180 , m_hasSoftwareFilters(false) | 180 , m_hasSoftwareFilters(false) |
181 , m_visibleContentScaleFactor(1) | 181 , m_visibleContentScaleFactor(1) |
| 182 , m_partialLayout(PartialLayoutState()) |
182 { | 183 { |
183 init(); | 184 init(); |
184 | 185 |
185 // FIXME: Can m_frame ever be null here? | 186 // FIXME: Can m_frame ever be null here? |
186 if (!m_frame) | 187 if (!m_frame) |
187 return; | 188 return; |
188 | 189 |
189 Page* page = m_frame->page(); | 190 Page* page = m_frame->page(); |
190 if (!page) | 191 if (!page) |
191 return; | 192 return; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 m_trackedRepaintRects.clear(); | 273 m_trackedRepaintRects.clear(); |
273 m_lastPaintTime = 0; | 274 m_lastPaintTime = 0; |
274 m_paintBehavior = PaintBehaviorNormal; | 275 m_paintBehavior = PaintBehaviorNormal; |
275 m_isPainting = false; | 276 m_isPainting = false; |
276 m_visuallyNonEmptyCharacterCount = 0; | 277 m_visuallyNonEmptyCharacterCount = 0; |
277 m_visuallyNonEmptyPixelCount = 0; | 278 m_visuallyNonEmptyPixelCount = 0; |
278 m_isVisuallyNonEmpty = false; | 279 m_isVisuallyNonEmpty = false; |
279 m_firstVisuallyNonEmptyLayoutCallbackPending = true; | 280 m_firstVisuallyNonEmptyLayoutCallbackPending = true; |
280 m_maintainScrollPositionAnchor = 0; | 281 m_maintainScrollPositionAnchor = 0; |
281 m_disableRepaints = 0; | 282 m_disableRepaints = 0; |
| 283 m_partialLayout.reset(); |
282 } | 284 } |
283 | 285 |
284 void FrameView::removeFromAXObjectCache() | 286 void FrameView::removeFromAXObjectCache() |
285 { | 287 { |
286 if (AXObjectCache* cache = axObjectCache()) | 288 if (AXObjectCache* cache = axObjectCache()) |
287 cache->remove(this); | 289 cache->remove(this); |
288 } | 290 } |
289 | 291 |
290 void FrameView::clearFrame() | 292 void FrameView::clearFrame() |
291 { | 293 { |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 // the layout beats any sort of style recalc update that needs to occur. | 871 // the layout beats any sort of style recalc update that needs to occur. |
870 TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleU
pdate, true); | 872 TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleU
pdate, true); |
871 document->updateStyleIfNeeded(); | 873 document->updateStyleIfNeeded(); |
872 } | 874 } |
873 | 875 |
874 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
out) | 876 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
out) |
875 { | 877 { |
876 // performLayout is the actual guts of layout(). | 878 // performLayout is the actual guts of layout(). |
877 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions | 879 // FIXME: The 300 other lines in layout() probably belong in other helper fu
nctions |
878 // so that a single human could understand what layout() is actually doing. | 880 // so that a single human could understand what layout() is actually doing. |
| 881 { |
| 882 bool disableLayoutState = false; |
| 883 if (inSubtreeLayout) { |
| 884 RenderView* view = rootForThisLayout->view(); |
| 885 disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootFo
rThisLayout); |
| 886 view->pushLayoutState(rootForThisLayout); |
| 887 } |
| 888 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThis
Layout->view() : 0); |
879 | 889 |
880 bool disableLayoutState = false; | 890 m_inLayout = true; |
881 if (inSubtreeLayout) { | 891 beginDeferredRepaints(); |
882 RenderView* view = rootForThisLayout->view(); | 892 forceLayoutParentViewIfNeeded(); |
883 disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootForThi
sLayout); | 893 |
884 view->pushLayoutState(rootForThisLayout); | 894 // Text Autosizing requires two-pass layout which is incompatible with p
artial layout. If |
| 895 // enabled, only do partial layout for the second layout. |
| 896 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. |
| 897 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->se
ttings() && m_frame->settings()->textAutosizingEnabled()); |
| 898 rootForThisLayout->layout(); // THIS IS WHERE LAYOUT ACTUALLY HAPPENS. |
885 } | 899 } |
886 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayo
ut->view() : 0); | |
887 | |
888 m_inLayout = true; | |
889 beginDeferredRepaints(); | |
890 forceLayoutParentViewIfNeeded(); | |
891 | |
892 rootForThisLayout->layout(); // THIS IS WHERE LAYOUT ACTUALLY HAPPENS. | |
893 | 900 |
894 bool autosized = frame()->document()->textAutosizer()->processSubtree(rootFo
rThisLayout); | 901 bool autosized = frame()->document()->textAutosizer()->processSubtree(rootFo
rThisLayout); |
895 if (autosized && rootForThisLayout->needsLayout()) { | 902 if (autosized && rootForThisLayout->needsLayout()) { |
896 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); | 903 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); |
897 rootForThisLayout->layout(); | 904 rootForThisLayout->layout(); |
898 } | 905 } |
899 | 906 |
900 endDeferredRepaints(); | 907 endDeferredRepaints(); |
901 m_inLayout = false; | 908 m_inLayout = false; |
902 | 909 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 void FrameView::layout(bool allowSubtree) | 946 void FrameView::layout(bool allowSubtree) |
940 { | 947 { |
941 // We should never layout a Document which is not in a Frame. | 948 // We should never layout a Document which is not in a Frame. |
942 ASSERT(m_frame); | 949 ASSERT(m_frame); |
943 ASSERT(m_frame->view() == this); | 950 ASSERT(m_frame->view() == this); |
944 ASSERT(m_frame->page()); | 951 ASSERT(m_frame->page()); |
945 | 952 |
946 if (m_inLayout) | 953 if (m_inLayout) |
947 return; | 954 return; |
948 | 955 |
| 956 ASSERT(!m_partialLayout.shouldStop()); |
| 957 |
949 TRACE_EVENT0("webkit", "FrameView::layout"); | 958 TRACE_EVENT0("webkit", "FrameView::layout"); |
950 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); | 959 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); |
951 | 960 |
952 // Protect the view from being deleted during layout (in recalcStyle) | 961 // Protect the view from being deleted during layout (in recalcStyle) |
953 RefPtr<FrameView> protector(this); | 962 RefPtr<FrameView> protector(this); |
954 | 963 |
955 // Every scroll that happens during layout is programmatic. | 964 // Every scroll that happens during layout is programmatic. |
956 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 965 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
957 | 966 |
958 m_layoutTimer.stop(); | 967 m_layoutTimer.stop(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 bodyRenderer->setChildNeedsLayout(); | 1051 bodyRenderer->setChildNeedsLayout(); |
1043 else if (rootRenderer && rootRenderer->stretchesToViewport()
) | 1052 else if (rootRenderer && rootRenderer->stretchesToViewport()
) |
1044 rootRenderer->setChildNeedsLayout(); | 1053 rootRenderer->setChildNeedsLayout(); |
1045 } | 1054 } |
1046 } | 1055 } |
1047 } | 1056 } |
1048 | 1057 |
1049 layer = rootForThisLayout->enclosingLayer(); | 1058 layer = rootForThisLayout->enclosingLayer(); |
1050 | 1059 |
1051 m_actionScheduler->pause(); | 1060 m_actionScheduler->pause(); |
| 1061 // Non-overlay scrollbars can cause a second layout; disable partial lay
out for the first of these layouts. |
| 1062 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->se
ttings() && !m_frame->settings()->usesOverlayScrollbars()); |
1052 performLayout(rootForThisLayout, inSubtreeLayout); | 1063 performLayout(rootForThisLayout, inSubtreeLayout); |
1053 m_layoutRoot = 0; | 1064 m_layoutRoot = 0; |
1054 } // Reset m_layoutSchedulingEnabled to its previous value. | 1065 } // Reset m_layoutSchedulingEnabled to its previous value. |
1055 | 1066 |
| 1067 if (partialLayout().shouldStop()) |
| 1068 return; |
| 1069 |
1056 bool neededFullRepaint = m_doFullRepaint; | 1070 bool neededFullRepaint = m_doFullRepaint; |
1057 | 1071 |
1058 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) | 1072 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) |
1059 adjustViewSize(); | 1073 adjustViewSize(); |
1060 | 1074 |
| 1075 // adjustViewSize() can cause a layout due to scrollbars so a second shouldS
top() check is required. |
| 1076 if (partialLayout().shouldStop()) |
| 1077 return; |
| 1078 |
1061 m_doFullRepaint = neededFullRepaint; | 1079 m_doFullRepaint = neededFullRepaint; |
1062 | 1080 |
1063 // Now update the positions of all layers. | 1081 // Now update the positions of all layers. |
1064 beginDeferredRepaints(); | 1082 beginDeferredRepaints(); |
1065 if (m_doFullRepaint) { | 1083 if (m_doFullRepaint) { |
1066 // FIXME: This isn't really right, since the RenderView doesn't fully en
compass | 1084 // FIXME: This isn't really right, since the RenderView doesn't fully en
compass |
1067 // the visibleContentRect(). It just happens to work out most of the tim
e, | 1085 // the visibleContentRect(). It just happens to work out most of the tim
e, |
1068 // since first layouts and printing don't have you scrolled anywhere. | 1086 // since first layouts and printing don't have you scrolled anywhere. |
1069 rootForThisLayout->view()->repaint(); | 1087 rootForThisLayout->view()->repaint(); |
1070 } | 1088 } |
(...skipping 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3360 } | 3378 } |
3361 | 3379 |
3362 AXObjectCache* FrameView::axObjectCache() const | 3380 AXObjectCache* FrameView::axObjectCache() const |
3363 { | 3381 { |
3364 if (frame() && frame()->document()) | 3382 if (frame() && frame()->document()) |
3365 return frame()->document()->existingAXObjectCache(); | 3383 return frame()->document()->existingAXObjectCache(); |
3366 return 0; | 3384 return 0; |
3367 } | 3385 } |
3368 | 3386 |
3369 } // namespace WebCore | 3387 } // namespace WebCore |
OLD | NEW |