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_shouldStopPartialLayout(false) | |
183 , m_stopLayoutAtRenderer(0) | |
182 { | 184 { |
183 init(); | 185 init(); |
184 | 186 |
185 // FIXME: Can m_frame ever be null here? | 187 // FIXME: Can m_frame ever be null here? |
186 if (!m_frame) | 188 if (!m_frame) |
187 return; | 189 return; |
188 | 190 |
189 Page* page = m_frame->page(); | 191 Page* page = m_frame->page(); |
190 if (!page) | 192 if (!page) |
191 return; | 193 return; |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
841 void FrameView::layout(bool allowSubtree) | 843 void FrameView::layout(bool allowSubtree) |
842 { | 844 { |
843 // We should never layout a Document which is not in a Frame. | 845 // We should never layout a Document which is not in a Frame. |
844 ASSERT(m_frame); | 846 ASSERT(m_frame); |
845 ASSERT(m_frame->view() == this); | 847 ASSERT(m_frame->view() == this); |
846 ASSERT(m_frame->page()); | 848 ASSERT(m_frame->page()); |
847 | 849 |
848 if (m_inLayout) | 850 if (m_inLayout) |
849 return; | 851 return; |
850 | 852 |
853 ASSERT(!shouldStopPartialLayout()); | |
854 | |
851 TRACE_EVENT0("webkit", "FrameView::layout"); | 855 TRACE_EVENT0("webkit", "FrameView::layout"); |
852 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); | 856 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); |
853 | 857 |
854 // Protect the view from being deleted during layout (in recalcStyle) | 858 // Protect the view from being deleted during layout (in recalcStyle) |
855 RefPtr<FrameView> protector(this); | 859 RefPtr<FrameView> protector(this); |
856 | 860 |
857 // Every scroll that happens during layout is programmatic. | 861 // Every scroll that happens during layout is programmatic. |
858 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); | 862 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); |
859 | 863 |
860 m_layoutTimer.stop(); | 864 m_layoutTimer.stop(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
978 else if (rootRenderer && rootRenderer->stretchesToViewport() ) | 982 else if (rootRenderer && rootRenderer->stretchesToViewport() ) |
979 rootRenderer->setChildNeedsLayout(); | 983 rootRenderer->setChildNeedsLayout(); |
980 } | 984 } |
981 } | 985 } |
982 } | 986 } |
983 | 987 |
984 layer = rootForThisLayout->enclosingLayer(); | 988 layer = rootForThisLayout->enclosingLayer(); |
985 | 989 |
986 m_actionScheduler->pause(); | 990 m_actionScheduler->pause(); |
987 | 991 |
992 // Text Autosizing requires two-pass layout which is incompatible with p artial layout. If | |
993 // enabled, only do partial layout for the second layout. | |
994 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. | |
995 RenderObject* delayPartialLayoutForRenderer = 0; | |
996 if (m_frame->settings() && m_frame->settings()->textAutosizingEnabled()) { | |
eseidel
2013/08/20 21:00:39
You don't need all this if you add a "m_disablePar
pdr.
2013/08/26 05:50:40
Done.
| |
997 delayPartialLayoutForRenderer = m_stopLayoutAtRenderer; | |
998 m_stopLayoutAtRenderer = 0; | |
999 } | |
1000 | |
988 { | 1001 { |
989 bool disableLayoutState = false; | 1002 bool disableLayoutState = false; |
990 if (inSubtreeLayout) { | 1003 if (inSubtreeLayout) { |
991 RenderView* view = rootForThisLayout->view(); | 1004 RenderView* view = rootForThisLayout->view(); |
992 disableLayoutState = view->shouldDisableLayoutStateForSubtree(ro otForThisLayout); | 1005 disableLayoutState = view->shouldDisableLayoutStateForSubtree(ro otForThisLayout); |
993 view->pushLayoutState(rootForThisLayout); | 1006 view->pushLayoutState(rootForThisLayout); |
994 } | 1007 } |
995 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootFor ThisLayout->view() : 0); | 1008 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootFor ThisLayout->view() : 0); |
996 | 1009 |
997 m_inLayout = true; | 1010 m_inLayout = true; |
998 beginDeferredRepaints(); | 1011 beginDeferredRepaints(); |
999 forceLayoutParentViewIfNeeded(); | 1012 forceLayoutParentViewIfNeeded(); |
1000 rootForThisLayout->layout(); | 1013 rootForThisLayout->layout(); |
1001 | 1014 |
1015 // If text autosizing is enabled, do a partial layout for the second layout. | |
1016 if (delayPartialLayoutForRenderer) { | |
1017 ASSERT(!shouldStopPartialLayout()); | |
1018 m_stopLayoutAtRenderer = delayPartialLayoutForRenderer; | |
1019 } | |
1002 bool autosized = document->textAutosizer()->processSubtree(rootForTh isLayout); | 1020 bool autosized = document->textAutosizer()->processSubtree(rootForTh isLayout); |
1003 if (autosized && rootForThisLayout->needsLayout()) { | 1021 if (autosized && rootForThisLayout->needsLayout()) { |
1004 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); | 1022 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); |
1005 rootForThisLayout->layout(); | 1023 rootForThisLayout->layout(); |
1006 } | 1024 } |
1007 | 1025 |
1008 endDeferredRepaints(); | 1026 endDeferredRepaints(); |
1009 m_inLayout = false; | 1027 m_inLayout = false; |
1010 | 1028 |
1011 if (inSubtreeLayout) | 1029 if (inSubtreeLayout) |
1012 rootForThisLayout->view()->popLayoutState(rootForThisLayout); | 1030 rootForThisLayout->view()->popLayoutState(rootForThisLayout); |
1013 } | 1031 } |
1014 m_layoutRoot = 0; | 1032 m_layoutRoot = 0; |
1015 } // Reset m_layoutSchedulingEnabled to its previous value. | 1033 } // Reset m_layoutSchedulingEnabled to its previous value. |
1016 | 1034 |
1035 // Reset partial layout state post-layout and exit here if a partial layout was done. | |
1036 if (shouldStopPartialLayout()) { | |
1037 resetPartialLayoutState(); | |
1038 return; | |
1039 } | |
1040 resetPartialLayoutState(); | |
eseidel
2013/08/20 21:00:39
Shouldn't the original caller drive this?
pdr.
2013/08/26 05:50:40
Fixing this was enlightening. resetPartialLayoutSt
| |
1041 | |
1017 bool neededFullRepaint = m_doFullRepaint; | 1042 bool neededFullRepaint = m_doFullRepaint; |
1018 | 1043 |
1019 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) | 1044 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) |
1020 adjustViewSize(); | 1045 adjustViewSize(); |
1021 | 1046 |
1022 m_doFullRepaint = neededFullRepaint; | 1047 m_doFullRepaint = neededFullRepaint; |
1023 | 1048 |
1024 // Now update the positions of all layers. | 1049 // Now update the positions of all layers. |
1025 beginDeferredRepaints(); | 1050 beginDeferredRepaints(); |
1026 if (m_doFullRepaint) | 1051 if (m_doFullRepaint) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1090 // however m_inLayout is not set for most of this function, so none of our R ELEASE_ASSERTS | 1115 // however m_inLayout is not set for most of this function, so none of our R ELEASE_ASSERTS |
1091 // in Frame/Page will fire. One of the post-layout tasks is disconnecting th e Frame from | 1116 // in Frame/Page will fire. One of the post-layout tasks is disconnecting th e Frame from |
1092 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml | 1117 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml |
1093 // necessitating this check here. | 1118 // necessitating this check here. |
1094 ASSERT(frame()); | 1119 ASSERT(frame()); |
1095 // ASSERT(frame()->page()); | 1120 // ASSERT(frame()->page()); |
1096 if (frame() && frame()->page()) | 1121 if (frame() && frame()->page()) |
1097 frame()->page()->chrome().client()->layoutUpdated(frame()); | 1122 frame()->page()->chrome().client()->layoutUpdated(frame()); |
1098 } | 1123 } |
1099 | 1124 |
1125 #ifndef NDEBUG | |
1126 void FrameView::checkPartialLayoutAllowed() | |
1127 { | |
1128 RenderObject* renderer = m_stopLayoutAtRenderer; | |
1129 while (renderer) { | |
esprehn
2013/08/23 20:47:27
This could be a for() loop :)
pdr.
2013/08/26 05:50:40
This function was useful for checking my logic in
| |
1130 ASSERT(renderer->supportsPartialLayout()); | |
1131 renderer = renderer->parent(); | |
1132 } | |
1133 } | |
1134 #endif | |
1135 | |
1100 RenderBox* FrameView::embeddedContentBox() const | 1136 RenderBox* FrameView::embeddedContentBox() const |
1101 { | 1137 { |
1102 RenderView* renderView = this->renderView(); | 1138 RenderView* renderView = this->renderView(); |
1103 if (!renderView) | 1139 if (!renderView) |
1104 return 0; | 1140 return 0; |
1105 | 1141 |
1106 RenderObject* firstChild = renderView->firstChild(); | 1142 RenderObject* firstChild = renderView->firstChild(); |
1107 if (!firstChild || !firstChild->isBox()) | 1143 if (!firstChild || !firstChild->isBox()) |
1108 return 0; | 1144 return 0; |
1109 | 1145 |
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3344 } | 3380 } |
3345 | 3381 |
3346 AXObjectCache* FrameView::axObjectCache() const | 3382 AXObjectCache* FrameView::axObjectCache() const |
3347 { | 3383 { |
3348 if (frame() && frame()->document()) | 3384 if (frame() && frame()->document()) |
3349 return frame()->document()->existingAXObjectCache(); | 3385 return frame()->document()->existingAXObjectCache(); |
3350 return 0; | 3386 return 0; |
3351 } | 3387 } |
3352 | 3388 |
3353 } // namespace WebCore | 3389 } // namespace WebCore |
OLD | NEW |