| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 void FrameView::layout(bool allowSubtree) | 839 void FrameView::layout(bool allowSubtree) |
| 838 { | 840 { |
| 839 // We should never layout a Document which is not in a Frame. | 841 // We should never layout a Document which is not in a Frame. |
| 840 ASSERT(m_frame); | 842 ASSERT(m_frame); |
| 841 ASSERT(m_frame->view() == this); | 843 ASSERT(m_frame->view() == this); |
| 842 ASSERT(m_frame->page()); | 844 ASSERT(m_frame->page()); |
| 843 | 845 |
| 844 if (m_inLayout) | 846 if (m_inLayout) |
| 845 return; | 847 return; |
| 846 | 848 |
| 849 ASSERT(!shouldStopPartialLayout()); |
| 850 /* |
| 851 if (shouldStopPartialLayout()) { |
| 852 resetPartialLayoutState(); |
| 853 return; |
| 854 } |
| 855 */ |
| 856 |
| 847 TRACE_EVENT0("webkit", "FrameView::layout"); | 857 TRACE_EVENT0("webkit", "FrameView::layout"); |
| 848 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); | 858 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); |
| 849 | 859 |
| 850 // Protect the view from being deleted during layout (in recalcStyle) | 860 // Protect the view from being deleted during layout (in recalcStyle) |
| 851 RefPtr<FrameView> protector(this); | 861 RefPtr<FrameView> protector(this); |
| 852 | 862 |
| 853 // Every scroll that happens during layout is programmatic. | 863 // Every scroll that happens during layout is programmatic. |
| 854 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 864 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
| 855 | 865 |
| 856 m_layoutTimer.stop(); | 866 m_layoutTimer.stop(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1013 |
| 1004 endDeferredRepaints(); | 1014 endDeferredRepaints(); |
| 1005 m_inLayout = false; | 1015 m_inLayout = false; |
| 1006 | 1016 |
| 1007 if (inSubtreeLayout) | 1017 if (inSubtreeLayout) |
| 1008 rootForThisLayout->view()->popLayoutState(rootForThisLayout); | 1018 rootForThisLayout->view()->popLayoutState(rootForThisLayout); |
| 1009 } | 1019 } |
| 1010 m_layoutRoot = 0; | 1020 m_layoutRoot = 0; |
| 1011 } // Reset m_layoutSchedulingEnabled to its previous value. | 1021 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 1012 | 1022 |
| 1023 if (shouldStopPartialLayout()) { |
| 1024 // Reset partial layout state post-layout. |
| 1025 resetPartialLayoutState(); |
| 1026 return; |
| 1027 } |
| 1028 |
| 1013 bool neededFullRepaint = m_doFullRepaint; | 1029 bool neededFullRepaint = m_doFullRepaint; |
| 1014 | 1030 |
| 1015 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) | 1031 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) |
| 1016 adjustViewSize(); | 1032 adjustViewSize(); |
| 1017 | 1033 |
| 1018 m_doFullRepaint = neededFullRepaint; | 1034 m_doFullRepaint = neededFullRepaint; |
| 1019 | 1035 |
| 1020 // Now update the positions of all layers. | 1036 // Now update the positions of all layers. |
| 1021 beginDeferredRepaints(); | 1037 beginDeferredRepaints(); |
| 1022 if (m_doFullRepaint) | 1038 if (m_doFullRepaint) |
| 1023 rootForThisLayout->view()->repaint(); // FIXME: This isn't really right,
since the RenderView doesn't fully encompass the visibleContentRect(). It just
happens | 1039 rootForThisLayout->view()->repaint(); // FIXME: This isn't really right,
since the RenderView doesn't fully encompass the visibleContentRect(). It just
happens |
| 1024 // to work out most of the time, since first la
youts and printing don't have you scrolled anywhere. | 1040 // to work out most of the time, since first la
youts and printing don't have you scrolled anywhere. |
| 1025 | 1041 |
| 1026 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos
itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); | 1042 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos
itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); |
| 1027 | 1043 |
| 1028 endDeferredRepaints(); | 1044 endDeferredRepaints(); |
| 1029 | 1045 |
| 1030 updateCompositingLayersAfterLayout(); | 1046 updateCompositingLayersAfterLayout(); |
| 1031 | 1047 |
| 1032 m_layoutCount++; | 1048 m_layoutCount++; |
| 1033 | 1049 |
| 1034 if (AXObjectCache* cache = rootForThisLayout->document()->existingAXObjectCa
che()) | 1050 if (AXObjectCache* cache = rootForThisLayout->document()->existingAXObjectCa
che()) |
| 1035 cache->postNotification(rootForThisLayout, AXObjectCache::AXLayoutComple
te, true); | 1051 cache->postNotification(rootForThisLayout, AXObjectCache::AXLayoutComple
te, true); |
| 1036 updateAnnotatedRegions(); | 1052 updateAnnotatedRegions(); |
| 1037 | 1053 |
| 1054 if (shouldStopPartialLayout()) { |
| 1055 // Reset partial layout state post-layout. |
| 1056 resetPartialLayoutState(); |
| 1057 return; |
| 1058 } |
| 1059 |
| 1038 layoutLazyBlocks(); | 1060 layoutLazyBlocks(); |
| 1039 | 1061 |
| 1040 ASSERT(!rootForThisLayout->needsLayout()); | 1062 if (shouldStopPartialLayout()) { |
| 1063 // Reset partial layout state post-layout. |
| 1064 resetPartialLayoutState(); |
| 1065 return; |
| 1066 } |
| 1067 |
| 1068 if (!shouldStopPartialLayout()) |
| 1069 ASSERT(!rootForThisLayout->needsLayout()); |
| 1041 | 1070 |
| 1042 updateCanBlitOnScrollRecursively(); | 1071 updateCanBlitOnScrollRecursively(); |
| 1043 | 1072 |
| 1044 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) | 1073 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) |
| 1045 updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < c
ontentsHeight()); | 1074 updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < c
ontentsHeight()); |
| 1046 | 1075 |
| 1047 if (!m_postLayoutTasksTimer.isActive()) { | 1076 if (!m_postLayoutTasksTimer.isActive()) { |
| 1048 if (!m_inSynchronousPostLayout) { | 1077 if (!m_inSynchronousPostLayout) { |
| 1049 if (frame()->document()->shouldDisplaySeamlesslyWithParent()) { | 1078 if (frame()->document()->shouldDisplaySeamlesslyWithParent()) { |
| 1050 if (RenderView* renderView = this->renderView()) | 1079 if (RenderView* renderView = this->renderView()) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1072 m_actionScheduler->resume(); | 1101 m_actionScheduler->resume(); |
| 1073 } | 1102 } |
| 1074 | 1103 |
| 1075 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); | 1104 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); |
| 1076 | 1105 |
| 1077 m_nestedLayoutCount--; | 1106 m_nestedLayoutCount--; |
| 1078 if (m_nestedLayoutCount) | 1107 if (m_nestedLayoutCount) |
| 1079 return; | 1108 return; |
| 1080 | 1109 |
| 1081 #ifndef NDEBUG | 1110 #ifndef NDEBUG |
| 1082 // Post-layout assert that nobody was re-marked as needing layout during lay
out. | 1111 if (!shouldStopPartialLayout()) { |
| 1083 for (RenderObject* renderer = document->renderer(); renderer; renderer = ren
derer->nextInPreOrder()) | 1112 // Post-layout assert that nobody was re-marked as needing layout during
layout. |
| 1084 ASSERT(!renderer->needsLayout()); | 1113 for (RenderObject* renderer = document->renderer(); renderer; renderer =
renderer->nextInPreOrder()) |
| 1114 ASSERT(!renderer->needsLayout()); |
| 1115 } |
| 1085 #endif | 1116 #endif |
| 1086 | 1117 |
| 1118 // Reset partial layout state post-layout. |
| 1119 resetPartialLayoutState(); |
| 1120 |
| 1087 // FIXME: It should be not possible to remove the FrameView from the frame/p
age during layout | 1121 // FIXME: It should be not possible to remove the FrameView from the frame/p
age during layout |
| 1088 // however m_inLayout is not set for most of this function, so none of our R
ELEASE_ASSERTS | 1122 // however m_inLayout is not set for most of this function, so none of our R
ELEASE_ASSERTS |
| 1089 // in Frame/Page will fire. One of the post-layout tasks is disconnecting th
e Frame from | 1123 // in Frame/Page will fire. One of the post-layout tasks is disconnecting th
e Frame from |
| 1090 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht
ml | 1124 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht
ml |
| 1091 // necessitating this check here. | 1125 // necessitating this check here. |
| 1092 ASSERT(frame()); | 1126 ASSERT(frame()); |
| 1093 // ASSERT(frame()->page()); | 1127 // ASSERT(frame()->page()); |
| 1094 if (frame() && frame()->page()) | 1128 if (frame() && frame()->page()) |
| 1095 frame()->page()->chrome().client()->layoutUpdated(frame()); | 1129 frame()->page()->chrome().client()->layoutUpdated(frame()); |
| 1096 } | 1130 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1117 // Next walk all lazy blocks and find nested ones, these need another layout | 1151 // Next walk all lazy blocks and find nested ones, these need another layout |
| 1118 // since the first one would not have placed them correctly inside the viewp
ort. | 1152 // since the first one would not have placed them correctly inside the viewp
ort. |
| 1119 for (RenderLazyBlock* block = renderView()->firstLazyBlock(); block; block =
block->next()) { | 1153 for (RenderLazyBlock* block = renderView()->firstLazyBlock(); block; block =
block->next()) { |
| 1120 if (!block->isNested()) | 1154 if (!block->isNested()) |
| 1121 continue; | 1155 continue; |
| 1122 block->setNeedsLayout(); | 1156 block->setNeedsLayout(); |
| 1123 layout(); | 1157 layout(); |
| 1124 } | 1158 } |
| 1125 } | 1159 } |
| 1126 | 1160 |
| 1161 void FrameView::checkPartialLayoutComplete(RenderObject* renderer) |
| 1162 { |
| 1163 ASSERT(renderer); |
| 1164 if (renderer == m_stopLayoutAtRenderer) { |
| 1165 // Make sure a partial layout was allowed. |
| 1166 do { |
| 1167 ASSERT(renderer->supportsPartialLayout()); |
| 1168 } while ((renderer = renderer->parent())); |
| 1169 |
| 1170 m_shouldStopPartialLayout = true; |
| 1171 } |
| 1172 } |
| 1173 |
| 1127 RenderBox* FrameView::embeddedContentBox() const | 1174 RenderBox* FrameView::embeddedContentBox() const |
| 1128 { | 1175 { |
| 1129 RenderView* renderView = this->renderView(); | 1176 RenderView* renderView = this->renderView(); |
| 1130 if (!renderView) | 1177 if (!renderView) |
| 1131 return 0; | 1178 return 0; |
| 1132 | 1179 |
| 1133 RenderObject* firstChild = renderView->firstChild(); | 1180 RenderObject* firstChild = renderView->firstChild(); |
| 1134 if (!firstChild || !firstChild->isBox()) | 1181 if (!firstChild || !firstChild->isBox()) |
| 1135 return 0; | 1182 return 0; |
| 1136 | 1183 |
| (...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3356 } | 3403 } |
| 3357 | 3404 |
| 3358 AXObjectCache* FrameView::axObjectCache() const | 3405 AXObjectCache* FrameView::axObjectCache() const |
| 3359 { | 3406 { |
| 3360 if (frame() && frame()->document()) | 3407 if (frame() && frame()->document()) |
| 3361 return frame()->document()->existingAXObjectCache(); | 3408 return frame()->document()->existingAXObjectCache(); |
| 3362 return 0; | 3409 return 0; |
| 3363 } | 3410 } |
| 3364 | 3411 |
| 3365 } // namespace WebCore | 3412 } // namespace WebCore |
| OLD | NEW |