Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 #include "core/page/ChromeClient.h" | 48 #include "core/page/ChromeClient.h" |
| 49 #include "core/page/EventHandler.h" | 49 #include "core/page/EventHandler.h" |
| 50 #include "core/page/FocusController.h" | 50 #include "core/page/FocusController.h" |
| 51 #include "core/page/Frame.h" | 51 #include "core/page/Frame.h" |
| 52 #include "core/page/FrameActionScheduler.h" | 52 #include "core/page/FrameActionScheduler.h" |
| 53 #include "core/page/FrameTree.h" | 53 #include "core/page/FrameTree.h" |
| 54 #include "core/page/Settings.h" | 54 #include "core/page/Settings.h" |
| 55 #include "core/page/animation/AnimationController.h" | 55 #include "core/page/animation/AnimationController.h" |
| 56 #include "core/page/scrolling/ScrollingCoordinator.h" | 56 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 57 #include "core/platform/ScrollAnimator.h" | 57 #include "core/platform/ScrollAnimator.h" |
| 58 #include "core/platform/ScrollbarTheme.h" | |
| 58 #include "core/platform/graphics/FloatRect.h" | 59 #include "core/platform/graphics/FloatRect.h" |
| 59 #include "core/platform/graphics/FontCache.h" | 60 #include "core/platform/graphics/FontCache.h" |
| 60 #include "core/platform/graphics/GraphicsContext.h" | 61 #include "core/platform/graphics/GraphicsContext.h" |
| 61 #include "core/platform/text/TextStream.h" | 62 #include "core/platform/text/TextStream.h" |
| 62 #include "core/rendering/RenderEmbeddedObject.h" | 63 #include "core/rendering/RenderEmbeddedObject.h" |
| 63 #include "core/rendering/RenderLayer.h" | 64 #include "core/rendering/RenderLayer.h" |
| 64 #include "core/rendering/RenderLayerBacking.h" | 65 #include "core/rendering/RenderLayerBacking.h" |
| 65 #include "core/rendering/RenderLayerCompositor.h" | 66 #include "core/rendering/RenderLayerCompositor.h" |
| 66 #include "core/rendering/RenderPart.h" | 67 #include "core/rendering/RenderPart.h" |
| 67 #include "core/rendering/RenderScrollbar.h" | 68 #include "core/rendering/RenderScrollbar.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 , m_isTrackingRepaints(false) | 173 , m_isTrackingRepaints(false) |
| 173 , m_shouldUpdateWhileOffscreen(true) | 174 , m_shouldUpdateWhileOffscreen(true) |
| 174 , m_deferSetNeedsLayouts(0) | 175 , m_deferSetNeedsLayouts(0) |
| 175 , m_setNeedsLayoutWasDeferred(false) | 176 , m_setNeedsLayoutWasDeferred(false) |
| 176 , m_scrollCorner(0) | 177 , m_scrollCorner(0) |
| 177 , m_shouldAutoSize(false) | 178 , m_shouldAutoSize(false) |
| 178 , m_inAutoSize(false) | 179 , m_inAutoSize(false) |
| 179 , m_didRunAutosize(false) | 180 , m_didRunAutosize(false) |
| 180 , m_hasSoftwareFilters(false) | 181 , m_hasSoftwareFilters(false) |
| 181 , m_visibleContentScaleFactor(1) | 182 , m_visibleContentScaleFactor(1) |
| 183 , m_partialLayout(PartialLayoutState()) | |
|
eseidel
2013/09/03 19:14:27
This isn't needed.
pdr.
2013/09/03 21:37:35
how do i c++?
Fixed.
| |
| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 m_trackedRepaintRects.clear(); | 274 m_trackedRepaintRects.clear(); |
| 273 m_lastPaintTime = 0; | 275 m_lastPaintTime = 0; |
| 274 m_paintBehavior = PaintBehaviorNormal; | 276 m_paintBehavior = PaintBehaviorNormal; |
| 275 m_isPainting = false; | 277 m_isPainting = false; |
| 276 m_visuallyNonEmptyCharacterCount = 0; | 278 m_visuallyNonEmptyCharacterCount = 0; |
| 277 m_visuallyNonEmptyPixelCount = 0; | 279 m_visuallyNonEmptyPixelCount = 0; |
| 278 m_isVisuallyNonEmpty = false; | 280 m_isVisuallyNonEmpty = false; |
| 279 m_firstVisuallyNonEmptyLayoutCallbackPending = true; | 281 m_firstVisuallyNonEmptyLayoutCallbackPending = true; |
| 280 m_maintainScrollPositionAnchor = 0; | 282 m_maintainScrollPositionAnchor = 0; |
| 281 m_disableRepaints = 0; | 283 m_disableRepaints = 0; |
| 284 m_partialLayout.reset(); | |
|
eseidel
2013/09/03 19:14:27
Or m_partialLayout = PartialLayoutState(). I susp
| |
| 282 } | 285 } |
| 283 | 286 |
| 284 void FrameView::removeFromAXObjectCache() | 287 void FrameView::removeFromAXObjectCache() |
| 285 { | 288 { |
| 286 if (AXObjectCache* cache = axObjectCache()) | 289 if (AXObjectCache* cache = axObjectCache()) |
| 287 cache->remove(this); | 290 cache->remove(this); |
| 288 } | 291 } |
| 289 | 292 |
| 290 void FrameView::clearFrame() | 293 void FrameView::clearFrame() |
| 291 { | 294 { |
| (...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. | 872 // the layout beats any sort of style recalc update that needs to occur. |
| 870 TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleU pdate, true); | 873 TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleU pdate, true); |
| 871 document->updateStyleIfNeeded(); | 874 document->updateStyleIfNeeded(); |
| 872 } | 875 } |
| 873 | 876 |
| 874 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay out) | 877 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay out) |
| 875 { | 878 { |
| 876 // performLayout is the actual guts of layout(). | 879 // performLayout is the actual guts of layout(). |
| 877 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions | 880 // 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. | 881 // so that a single human could understand what layout() is actually doing. |
| 882 { | |
| 883 bool disableLayoutState = false; | |
| 884 if (inSubtreeLayout) { | |
| 885 RenderView* view = rootForThisLayout->view(); | |
| 886 disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootFo rThisLayout); | |
| 887 view->pushLayoutState(rootForThisLayout); | |
| 888 } | |
| 889 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThis Layout->view() : 0); | |
| 879 | 890 |
| 880 bool disableLayoutState = false; | 891 m_inLayout = true; |
| 881 if (inSubtreeLayout) { | 892 beginDeferredRepaints(); |
| 882 RenderView* view = rootForThisLayout->view(); | 893 forceLayoutParentViewIfNeeded(); |
| 883 disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootForThi sLayout); | 894 |
| 884 view->pushLayoutState(rootForThisLayout); | 895 // Text Autosizing requires two-pass layout which is incompatible with p artial layout. If |
| 896 // enabled, only do partial layout for the second layout. | |
| 897 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. | |
| 898 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->se ttings() && m_frame->settings()->textAutosizingEnabled()); | |
| 899 rootForThisLayout->layout(); // THIS IS WHERE LAYOUT ACTUALLY HAPPENS. | |
|
eseidel
2013/09/03 18:16:08
Do you mean to keep this comment?
eseidel
2013/09/03 19:14:27
nm. I now see it predates your patch.
pdr.
2013/09/03 21:37:35
While you were on vacation I complained about this
| |
| 885 } | 900 } |
| 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 | 901 |
| 894 bool autosized = frame()->document()->textAutosizer()->processSubtree(rootFo rThisLayout); | 902 bool autosized = frame()->document()->textAutosizer()->processSubtree(rootFo rThisLayout); |
| 895 if (autosized && rootForThisLayout->needsLayout()) { | 903 if (autosized && rootForThisLayout->needsLayout()) { |
| 896 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); | 904 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); |
| 897 rootForThisLayout->layout(); | 905 rootForThisLayout->layout(); |
| 898 } | 906 } |
| 899 | 907 |
| 900 endDeferredRepaints(); | 908 endDeferredRepaints(); |
| 901 m_inLayout = false; | 909 m_inLayout = false; |
| 902 | 910 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 939 void FrameView::layout(bool allowSubtree) | 947 void FrameView::layout(bool allowSubtree) |
| 940 { | 948 { |
| 941 // We should never layout a Document which is not in a Frame. | 949 // We should never layout a Document which is not in a Frame. |
| 942 ASSERT(m_frame); | 950 ASSERT(m_frame); |
| 943 ASSERT(m_frame->view() == this); | 951 ASSERT(m_frame->view() == this); |
| 944 ASSERT(m_frame->page()); | 952 ASSERT(m_frame->page()); |
| 945 | 953 |
| 946 if (m_inLayout) | 954 if (m_inLayout) |
| 947 return; | 955 return; |
| 948 | 956 |
| 957 ASSERT(!m_partialLayout.shouldStop()); | |
| 958 | |
| 949 TRACE_EVENT0("webkit", "FrameView::layout"); | 959 TRACE_EVENT0("webkit", "FrameView::layout"); |
| 950 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); | 960 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout"); |
| 951 | 961 |
| 952 // Protect the view from being deleted during layout (in recalcStyle) | 962 // Protect the view from being deleted during layout (in recalcStyle) |
| 953 RefPtr<FrameView> protector(this); | 963 RefPtr<FrameView> protector(this); |
| 954 | 964 |
| 955 // Every scroll that happens during layout is programmatic. | 965 // Every scroll that happens during layout is programmatic. |
| 956 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); | 966 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); |
| 957 | 967 |
| 958 m_layoutTimer.stop(); | 968 m_layoutTimer.stop(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1042 bodyRenderer->setChildNeedsLayout(); | 1052 bodyRenderer->setChildNeedsLayout(); |
| 1043 else if (rootRenderer && rootRenderer->stretchesToViewport() ) | 1053 else if (rootRenderer && rootRenderer->stretchesToViewport() ) |
| 1044 rootRenderer->setChildNeedsLayout(); | 1054 rootRenderer->setChildNeedsLayout(); |
| 1045 } | 1055 } |
| 1046 } | 1056 } |
| 1047 } | 1057 } |
| 1048 | 1058 |
| 1049 layer = rootForThisLayout->enclosingLayer(); | 1059 layer = rootForThisLayout->enclosingLayer(); |
| 1050 | 1060 |
| 1051 m_actionScheduler->pause(); | 1061 m_actionScheduler->pause(); |
| 1062 // Non-overlay scrollbars can cause a second layout; disable partial lay out for the first of these layouts. | |
| 1063 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), !ScrollbarT heme::theme()->usesOverlayScrollbars()); | |
| 1052 performLayout(rootForThisLayout, inSubtreeLayout); | 1064 performLayout(rootForThisLayout, inSubtreeLayout); |
| 1053 m_layoutRoot = 0; | 1065 m_layoutRoot = 0; |
| 1054 } // Reset m_layoutSchedulingEnabled to its previous value. | 1066 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 1055 | 1067 |
| 1068 if (partialLayout().shouldStop()) | |
| 1069 return; | |
| 1070 | |
| 1056 bool neededFullRepaint = m_doFullRepaint; | 1071 bool neededFullRepaint = m_doFullRepaint; |
| 1057 | 1072 |
| 1058 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) | 1073 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->printing()) |
| 1059 adjustViewSize(); | 1074 adjustViewSize(); |
| 1060 | 1075 |
| 1076 // adjustViewSize() can cause a layout due to scrollbars so a second shouldS top() check is required. | |
| 1077 if (partialLayout().shouldStop()) | |
| 1078 return; | |
| 1079 | |
| 1061 m_doFullRepaint = neededFullRepaint; | 1080 m_doFullRepaint = neededFullRepaint; |
| 1062 | 1081 |
| 1063 // Now update the positions of all layers. | 1082 // Now update the positions of all layers. |
| 1064 beginDeferredRepaints(); | 1083 beginDeferredRepaints(); |
| 1065 if (m_doFullRepaint) { | 1084 if (m_doFullRepaint) { |
| 1066 // FIXME: This isn't really right, since the RenderView doesn't fully en compass | 1085 // 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, | 1086 // 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. | 1087 // since first layouts and printing don't have you scrolled anywhere. |
| 1069 rootForThisLayout->view()->repaint(); | 1088 rootForThisLayout->view()->repaint(); |
| 1070 } | 1089 } |
| (...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3359 } | 3378 } |
| 3360 | 3379 |
| 3361 AXObjectCache* FrameView::axObjectCache() const | 3380 AXObjectCache* FrameView::axObjectCache() const |
| 3362 { | 3381 { |
| 3363 if (frame() && frame()->document()) | 3382 if (frame() && frame()->document()) |
| 3364 return frame()->document()->existingAXObjectCache(); | 3383 return frame()->document()->existingAXObjectCache(); |
| 3365 return 0; | 3384 return 0; |
| 3366 } | 3385 } |
| 3367 | 3386 |
| 3368 } // namespace WebCore | 3387 } // namespace WebCore |
| OLD | NEW |