| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 #endif | 198 #endif |
| 199 | 199 |
| 200 void LayoutView::setShouldDoFullPaintInvalidationOnResizeIfNeeded() | 200 void LayoutView::setShouldDoFullPaintInvalidationOnResizeIfNeeded() |
| 201 { | 201 { |
| 202 // When background-attachment is 'fixed', we treat the viewport (instead of
the 'root' | 202 // When background-attachment is 'fixed', we treat the viewport (instead of
the 'root' |
| 203 // i.e. html or body) as the background positioning area, and we should full
y invalidate | 203 // i.e. html or body) as the background positioning area, and we should full
y invalidate |
| 204 // on viewport resize if the background image is not composited and needs fu
ll paint | 204 // on viewport resize if the background image is not composited and needs fu
ll paint |
| 205 // invalidation on background positioning area resize. | 205 // invalidation on background positioning area resize. |
| 206 if (style()->hasFixedBackgroundImage() && (!m_compositor || !m_compositor->n
eedsFixedRootBackgroundLayer(layer()))) { | 206 if (style()->hasFixedBackgroundImage() && (!m_compositor || !m_compositor->n
eedsFixedRootBackgroundLayer(layer()))) { |
| 207 IncludeScrollbarsInRect includeScrollbars = document().settings() && doc
ument().settings()->rootLayerScrolls() ? IncludeScrollbars : ExcludeScrollbars; | 207 IncludeScrollbarsInRect includeScrollbars = RuntimeEnabledFeatures::root
LayerScrollingEnabled() ? IncludeScrollbars : ExcludeScrollbars; |
| 208 if ((offsetWidth() != viewWidth(includeScrollbars) && mustInvalidateFill
LayersPaintOnWidthChange(style()->backgroundLayers())) | 208 if ((offsetWidth() != viewWidth(includeScrollbars) && mustInvalidateFill
LayersPaintOnWidthChange(style()->backgroundLayers())) |
| 209 || (offsetHeight() != viewHeight(includeScrollbars) && mustInvalidat
eFillLayersPaintOnHeightChange(style()->backgroundLayers()))) | 209 || (offsetHeight() != viewHeight(includeScrollbars) && mustInvalidat
eFillLayersPaintOnHeightChange(style()->backgroundLayers()))) |
| 210 setShouldDoFullPaintInvalidation(PaintInvalidationBoundsChange); | 210 setShouldDoFullPaintInvalidation(PaintInvalidationBoundsChange); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 void LayoutView::layout() | 214 void LayoutView::layout() |
| 215 { | 215 { |
| 216 if (!document().paginated()) | 216 if (!document().paginated()) |
| 217 setPageLogicalHeight(LayoutUnit()); | 217 setPageLogicalHeight(LayoutUnit()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 #if ENABLE(ASSERT) | 274 #if ENABLE(ASSERT) |
| 275 checkLayoutState(); | 275 checkLayoutState(); |
| 276 #endif | 276 #endif |
| 277 clearNeedsLayout(); | 277 clearNeedsLayout(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 LayoutRect LayoutView::visualOverflowRect() const | 280 LayoutRect LayoutView::visualOverflowRect() const |
| 281 { | 281 { |
| 282 // In root layer scrolling mode, the LayoutView performs overflow clipping | 282 // In root layer scrolling mode, the LayoutView performs overflow clipping |
| 283 // like a regular scrollable div. | 283 // like a regular scrollable div. |
| 284 if (document().settings() && document().settings()->rootLayerScrolls()) | 284 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 285 return LayoutBlockFlow::visualOverflowRect(); | 285 return LayoutBlockFlow::visualOverflowRect(); |
| 286 | 286 |
| 287 // Ditto when not in compositing mode. | 287 // Ditto when not in compositing mode. |
| 288 if (!usesCompositing()) | 288 if (!usesCompositing()) |
| 289 return LayoutBlockFlow::visualOverflowRect(); | 289 return LayoutBlockFlow::visualOverflowRect(); |
| 290 | 290 |
| 291 // In normal compositing mode, LayoutView doesn't actually apply clipping | 291 // In normal compositing mode, LayoutView doesn't actually apply clipping |
| 292 // on its descendants. Instead their visual overflow is propagated to | 292 // on its descendants. Instead their visual overflow is propagated to |
| 293 // compositor()->m_rootContentLayer for accelerated scrolling. | 293 // compositor()->m_rootContentLayer for accelerated scrolling. |
| 294 return LayoutRect(documentRect()); | 294 return LayoutRect(documentRect()); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 return style()->isHorizontalWritingMode() ? viewWidth(scrollbarInclusion) :
viewHeight(scrollbarInclusion); | 850 return style()->isHorizontalWritingMode() ? viewWidth(scrollbarInclusion) :
viewHeight(scrollbarInclusion); |
| 851 } | 851 } |
| 852 | 852 |
| 853 int LayoutView::viewLogicalHeight(IncludeScrollbarsInRect scrollbarInclusion) co
nst | 853 int LayoutView::viewLogicalHeight(IncludeScrollbarsInRect scrollbarInclusion) co
nst |
| 854 { | 854 { |
| 855 return style()->isHorizontalWritingMode() ? viewHeight(scrollbarInclusion) :
viewWidth(scrollbarInclusion); | 855 return style()->isHorizontalWritingMode() ? viewHeight(scrollbarInclusion) :
viewWidth(scrollbarInclusion); |
| 856 } | 856 } |
| 857 | 857 |
| 858 int LayoutView::viewLogicalWidthForBoxSizing() const | 858 int LayoutView::viewLogicalWidthForBoxSizing() const |
| 859 { | 859 { |
| 860 return viewLogicalWidth(document().settings() && document().settings()->root
LayerScrolls() ? IncludeScrollbars : ExcludeScrollbars); | 860 return viewLogicalWidth(RuntimeEnabledFeatures::rootLayerScrollingEnabled()
? IncludeScrollbars : ExcludeScrollbars); |
| 861 } | 861 } |
| 862 | 862 |
| 863 int LayoutView::viewLogicalHeightForBoxSizing() const | 863 int LayoutView::viewLogicalHeightForBoxSizing() const |
| 864 { | 864 { |
| 865 return viewLogicalHeight(document().settings() && document().settings()->roo
tLayerScrolls() ? IncludeScrollbars : ExcludeScrollbars); | 865 return viewLogicalHeight(RuntimeEnabledFeatures::rootLayerScrollingEnabled()
? IncludeScrollbars : ExcludeScrollbars); |
| 866 } | 866 } |
| 867 | 867 |
| 868 LayoutUnit LayoutView::viewLogicalHeightForPercentages() const | 868 LayoutUnit LayoutView::viewLogicalHeightForPercentages() const |
| 869 { | 869 { |
| 870 if (shouldUsePrintingLayout()) | 870 if (shouldUsePrintingLayout()) |
| 871 return pageLogicalHeight(); | 871 return pageLogicalHeight(); |
| 872 return LayoutUnit(viewLogicalHeight()); | 872 return LayoutUnit(viewLogicalHeight()); |
| 873 } | 873 } |
| 874 | 874 |
| 875 float LayoutView::zoomFactor() const | 875 float LayoutView::zoomFactor() const |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 { | 970 { |
| 971 LayoutBlockFlow::updateFromStyle(); | 971 LayoutBlockFlow::updateFromStyle(); |
| 972 | 972 |
| 973 // LayoutView of the main frame is responsible for painting base background. | 973 // LayoutView of the main frame is responsible for painting base background. |
| 974 if (document().isInMainFrame()) | 974 if (document().isInMainFrame()) |
| 975 setHasBoxDecorationBackground(true); | 975 setHasBoxDecorationBackground(true); |
| 976 } | 976 } |
| 977 | 977 |
| 978 bool LayoutView::allowsOverflowClip() const | 978 bool LayoutView::allowsOverflowClip() const |
| 979 { | 979 { |
| 980 return document().settings() && document().settings()->rootLayerScrolls(); | 980 return RuntimeEnabledFeatures::rootLayerScrollingEnabled(); |
| 981 } | 981 } |
| 982 | 982 |
| 983 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) | 983 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) |
| 984 { | 984 { |
| 985 // TODO(bokan): We shouldn't need this specialization but we currently do | 985 // TODO(bokan): We shouldn't need this specialization but we currently do |
| 986 // because of the Windows pan scrolling path. That should go through a more | 986 // because of the Windows pan scrolling path. That should go through a more |
| 987 // normalized ScrollManager-like scrolling path and we should get rid of | 987 // normalized ScrollManager-like scrolling path and we should get rid of |
| 988 // of this override. All frame scrolling should be handled by | 988 // of this override. All frame scrolling should be handled by |
| 989 // ViewportScrollCallback. | 989 // ViewportScrollCallback. |
| 990 | 990 |
| 991 if (!frameView()) | 991 if (!frameView()) |
| 992 return ScrollResult(false, false, delta.width(), delta.height()); | 992 return ScrollResult(false, false, delta.width(), delta.height()); |
| 993 | 993 |
| 994 return frameView()->getScrollableArea()->userScroll(granularity, delta); | 994 return frameView()->getScrollableArea()->userScroll(granularity, delta); |
| 995 } | 995 } |
| 996 | 996 |
| 997 } // namespace blink | 997 } // namespace blink |
| OLD | NEW |