OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 RenderView::RenderView(Document* document) | 50 RenderView::RenderView(Document* document) |
51 : RenderBlockFlow(document) | 51 : RenderBlockFlow(document) |
52 , m_frameView(document->view()) | 52 , m_frameView(document->view()) |
53 , m_selectionStart(0) | 53 , m_selectionStart(0) |
54 , m_selectionEnd(0) | 54 , m_selectionEnd(0) |
55 , m_selectionStartPos(-1) | 55 , m_selectionStartPos(-1) |
56 , m_selectionEndPos(-1) | 56 , m_selectionEndPos(-1) |
57 , m_pageLogicalHeight(0) | 57 , m_pageLogicalHeight(0) |
58 , m_pageLogicalHeightChanged(false) | 58 , m_pageLogicalHeightChanged(false) |
59 , m_layoutState(0) | 59 , m_layoutState(0) |
60 , m_layoutStateDisableCount(0) | |
61 , m_renderQuoteHead(0) | 60 , m_renderQuoteHead(0) |
62 , m_renderCounterCount(0) | 61 , m_renderCounterCount(0) |
63 { | 62 { |
64 // init RenderObject attributes | 63 // init RenderObject attributes |
65 setInline(false); | 64 setInline(false); |
66 | 65 |
67 m_minPreferredLogicalWidth = 0; | 66 m_minPreferredLogicalWidth = 0; |
68 m_maxPreferredLogicalWidth = 0; | 67 m_maxPreferredLogicalWidth = 0; |
69 | 68 |
70 setPreferredLogicalWidthsDirty(MarkOnlyThis); | 69 setPreferredLogicalWidthsDirty(MarkOnlyThis); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 checkLayoutState(); | 175 checkLayoutState(); |
177 #endif | 176 #endif |
178 } | 177 } |
179 | 178 |
180 #ifndef NDEBUG | 179 #ifndef NDEBUG |
181 void RenderView::checkLayoutState() | 180 void RenderView::checkLayoutState() |
182 { | 181 { |
183 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 182 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
184 ASSERT(layoutDeltaMatches(LayoutSize())); | 183 ASSERT(layoutDeltaMatches(LayoutSize())); |
185 } | 184 } |
186 ASSERT(!m_layoutStateDisableCount); | |
187 ASSERT(!m_layoutState->next()); | 185 ASSERT(!m_layoutState->next()); |
188 } | 186 } |
189 #endif | 187 #endif |
190 | 188 |
191 bool RenderView::shouldDoFullRepaintForNextLayout() const | 189 bool RenderView::shouldDoFullRepaintForNextLayout() const |
192 { | 190 { |
193 // It's hard to predict here which of full repaint or per-descendant repaint costs less. | 191 // It's hard to predict here which of full repaint or per-descendant repaint costs less. |
194 // For vertical writing mode or width change it's more likely that per-desce ndant repaint | 192 // For vertical writing mode or width change it's more likely that per-desce ndant repaint |
195 // eventually turns out to be full repaint but with the cost to handle more layout states | 193 // eventually turns out to be full repaint but with the cost to handle more layout states |
196 // and discrete repaint rects, so marking full repaint here is more likely t o cost less. | 194 // and discrete repaint rects, so marking full repaint here is more likely t o cost less. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 } | 243 } |
246 | 244 |
247 if (document().svgExtensions()) | 245 if (document().svgExtensions()) |
248 document().accessSVGExtensions().invalidateSVGRootsWithRelativeLengt hDescendents(&layoutScope); | 246 document().accessSVGExtensions().invalidateSVGRootsWithRelativeLengt hDescendents(&layoutScope); |
249 } | 247 } |
250 | 248 |
251 ASSERT(!m_layoutState); | 249 ASSERT(!m_layoutState); |
252 if (!needsLayout()) | 250 if (!needsLayout()) |
253 return; | 251 return; |
254 | 252 |
255 RootLayoutStateScope rootLayoutStateScope(*this); | 253 LayoutState rootLayoutState(pageLogicalHeight(), pageLogicalHeightChanged(), *this); |
256 | 254 |
257 m_pageLogicalHeightChanged = false; | 255 m_pageLogicalHeightChanged = false; |
258 | 256 |
259 layoutContent(); | 257 layoutContent(); |
260 | 258 |
261 #ifndef NDEBUG | 259 #ifndef NDEBUG |
262 checkLayoutState(); | 260 checkLayoutState(); |
263 #endif | 261 #endif |
264 clearNeedsLayout(); | 262 clearNeedsLayout(); |
265 } | 263 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 void RenderView::invalidateTreeAfterLayout(const RenderLayerModelObject& paintIn validationContainer) | 449 void RenderView::invalidateTreeAfterLayout(const RenderLayerModelObject& paintIn validationContainer) |
452 { | 450 { |
453 ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); | 451 ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); |
454 ASSERT(!needsLayout()); | 452 ASSERT(!needsLayout()); |
455 | 453 |
456 // We specifically need to repaint the viewRect since other renderers | 454 // We specifically need to repaint the viewRect since other renderers |
457 // short-circuit on full-repaint. | 455 // short-circuit on full-repaint. |
458 if (doingFullRepaint() && !viewRect().isEmpty()) | 456 if (doingFullRepaint() && !viewRect().isEmpty()) |
459 repaintViewRectangle(viewRect()); | 457 repaintViewRectangle(viewRect()); |
460 | 458 |
459 LayoutState rootLayoutState(0, false, *this); | |
461 RenderBlock::invalidateTreeAfterLayout(paintInvalidationContainer); | 460 RenderBlock::invalidateTreeAfterLayout(paintInvalidationContainer); |
462 } | 461 } |
463 | 462 |
464 void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const | 463 void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const |
465 { | 464 { |
466 ASSERT(!repaintRect.isEmpty()); | 465 ASSERT(!repaintRect.isEmpty()); |
467 | 466 |
468 if (document().printing() || !m_frameView) | 467 if (document().printing() || !m_frameView) |
469 return; | 468 return; |
470 | 469 |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
900 if (shouldUsePrintingLayout()) | 899 if (shouldUsePrintingLayout()) |
901 return pageLogicalHeight(); | 900 return pageLogicalHeight(); |
902 return viewLogicalHeight(); | 901 return viewLogicalHeight(); |
903 } | 902 } |
904 | 903 |
905 float RenderView::zoomFactor() const | 904 float RenderView::zoomFactor() const |
906 { | 905 { |
907 return m_frameView->frame().pageZoomFactor(); | 906 return m_frameView->frame().pageZoomFactor(); |
908 } | 907 } |
909 | 908 |
910 void RenderView::pushLayoutState(RenderObject& root) | |
911 { | |
912 ASSERT(m_layoutStateDisableCount == 0); | |
913 ASSERT(m_layoutState == 0); | |
914 | |
915 pushLayoutStateForCurrentFlowThread(root); | |
916 m_layoutState = new LayoutState(root); | |
917 } | |
918 | |
919 bool RenderView::shouldDisableLayoutStateForSubtree(RenderObject& renderer) cons t | |
920 { | |
921 RenderObject* o = &renderer; | |
922 while (o) { | |
923 if (o->shouldDisableLayoutState()) | |
924 return true; | |
925 o = o->container(); | |
926 } | |
927 return false; | |
928 } | |
929 | |
930 void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p oint) | 909 void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p oint) |
931 { | 910 { |
932 if (result.innerNode()) | 911 if (result.innerNode()) |
933 return; | 912 return; |
934 | 913 |
935 Node* node = document().documentElement(); | 914 Node* node = document().documentElement(); |
936 if (node) { | 915 if (node) { |
937 result.setInnerNode(node); | 916 result.setInnerNode(node); |
938 if (!result.innerNonSharedNode()) | 917 if (!result.innerNonSharedNode()) |
939 result.setInnerNonSharedNode(node); | 918 result.setInnerNonSharedNode(node); |
(...skipping 25 matching lines...) Expand all Loading... | |
965 } | 944 } |
966 | 945 |
967 FlowThreadController* RenderView::flowThreadController() | 946 FlowThreadController* RenderView::flowThreadController() |
968 { | 947 { |
969 if (!m_flowThreadController) | 948 if (!m_flowThreadController) |
970 m_flowThreadController = FlowThreadController::create(); | 949 m_flowThreadController = FlowThreadController::create(); |
971 | 950 |
972 return m_flowThreadController.get(); | 951 return m_flowThreadController.get(); |
973 } | 952 } |
974 | 953 |
975 void RenderView::pushLayoutStateForCurrentFlowThread(const RenderObject& object) | 954 void RenderView::pushLayoutState(LayoutState& layoutState) |
976 { | 955 { |
956 m_layoutState = &layoutState; | |
esprehn
2014/06/13 23:25:26
Can we unify the pushLayoutState and setLayoutStat
leviw_travelin_and_unemployed
2014/06/13 23:46:16
This is actually leftover from where I broke multi
| |
977 if (!m_flowThreadController) | 957 if (!m_flowThreadController) |
978 return; | 958 return; |
979 | 959 |
980 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderF lowThread(); | 960 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderF lowThread(); |
981 if (!currentFlowThread) | 961 if (!currentFlowThread) |
982 return; | 962 return; |
983 | 963 |
984 currentFlowThread->pushFlowThreadLayoutState(object); | 964 currentFlowThread->pushFlowThreadLayoutState(layoutState.renderer()); |
985 } | 965 } |
986 | 966 |
987 void RenderView::popLayoutStateForCurrentFlowThread() | 967 void RenderView::popLayoutState() |
988 { | 968 { |
969 ASSERT(m_layoutState); | |
970 m_layoutState = m_layoutState->next(); | |
989 if (!m_flowThreadController) | 971 if (!m_flowThreadController) |
990 return; | 972 return; |
991 | 973 |
992 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderF lowThread(); | 974 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderF lowThread(); |
993 if (!currentFlowThread) | 975 if (!currentFlowThread) |
994 return; | 976 return; |
995 | 977 |
996 currentFlowThread->popFlowThreadLayoutState(); | 978 currentFlowThread->popFlowThreadLayoutState(); |
997 } | 979 } |
998 | 980 |
(...skipping 19 matching lines...) Expand all Loading... | |
1018 return viewWidth(IncludeScrollbars) / scale; | 1000 return viewWidth(IncludeScrollbars) / scale; |
1019 } | 1001 } |
1020 | 1002 |
1021 double RenderView::layoutViewportHeight() const | 1003 double RenderView::layoutViewportHeight() const |
1022 { | 1004 { |
1023 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1005 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
1024 return viewHeight(IncludeScrollbars) / scale; | 1006 return viewHeight(IncludeScrollbars) / scale; |
1025 } | 1007 } |
1026 | 1008 |
1027 } // namespace WebCore | 1009 } // namespace WebCore |
OLD | NEW |