Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutView.cpp

Issue 2461463004: Resize background-attachment: fixed when inertTopControls is enabled. (Closed)
Patch Set: Added test for non-fixed-attachment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 checkLayoutState(); 198 checkLayoutState();
199 #endif 199 #endif
200 } 200 }
201 201
202 #if ENABLE(ASSERT) 202 #if ENABLE(ASSERT)
203 void LayoutView::checkLayoutState() { 203 void LayoutView::checkLayoutState() {
204 ASSERT(!m_layoutState->next()); 204 ASSERT(!m_layoutState->next());
205 } 205 }
206 #endif 206 #endif
207 207
208 void LayoutView::setShouldDoFullPaintInvalidationOnResizeIfNeeded() { 208 void LayoutView::setShouldDoFullPaintInvalidationOnResizeIfNeeded(
209 bool widthChanged,
210 bool heightChanged) {
209 // When background-attachment is 'fixed', we treat the viewport (instead of 211 // When background-attachment is 'fixed', we treat the viewport (instead of
210 // the 'root' i.e. html or body) as the background positioning area, and we 212 // the 'root' i.e. html or body) as the background positioning area, and we
211 // should fully invalidate on viewport resize if the background image is not 213 // should fully invalidate on viewport resize if the background image is not
212 // composited and needs full paint invalidation on background positioning area 214 // composited and needs full paint invalidation on background positioning area
213 // resize. 215 // resize.
214 if (style()->hasFixedBackgroundImage() && 216 if (style()->hasFixedBackgroundImage() &&
215 (!m_compositor || 217 (!m_compositor ||
216 !m_compositor->needsFixedRootBackgroundLayer(layer()))) { 218 !m_compositor->needsFixedRootBackgroundLayer(layer()))) {
217 IncludeScrollbarsInRect includeScrollbars = 219 if ((widthChanged && mustInvalidateFillLayersPaintOnWidthChange(
218 RuntimeEnabledFeatures::rootLayerScrollingEnabled() ? IncludeScrollbars 220 style()->backgroundLayers())) ||
219 : ExcludeScrollbars; 221 (heightChanged && mustInvalidateFillLayersPaintOnHeightChange(
220 if ((offsetWidth() != viewWidth(includeScrollbars) && 222 style()->backgroundLayers())))
221 mustInvalidateFillLayersPaintOnWidthChange(
222 style()->backgroundLayers())) ||
223 (offsetHeight() != viewHeight(includeScrollbars) &&
224 mustInvalidateFillLayersPaintOnHeightChange(
225 style()->backgroundLayers())))
226 setShouldDoFullPaintInvalidation(PaintInvalidationBoundsChange); 223 setShouldDoFullPaintInvalidation(PaintInvalidationBoundsChange);
227 } 224 }
228 } 225 }
229 226
230 void LayoutView::layout() { 227 void LayoutView::layout() {
231 if (!document().paginated()) 228 if (!document().paginated())
232 setPageLogicalHeight(LayoutUnit()); 229 setPageLogicalHeight(LayoutUnit());
233 230
234 setShouldDoFullPaintInvalidationOnResizeIfNeeded(); 231 IncludeScrollbarsInRect includeScrollbars =
232 RuntimeEnabledFeatures::rootLayerScrollingEnabled() ? IncludeScrollbars
233 : ExcludeScrollbars;
234 FloatSize viewSize(frameView()->visibleContentSize(includeScrollbars));
235 setShouldDoFullPaintInvalidationOnResizeIfNeeded(
236 offsetWidth() != viewSize.width(), offsetHeight() != viewSize.height());
235 237
236 if (pageLogicalHeight() && shouldUsePrintingLayout()) { 238 if (pageLogicalHeight() && shouldUsePrintingLayout()) {
237 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); 239 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth();
238 if (!m_fragmentationContext) { 240 if (!m_fragmentationContext) {
239 m_fragmentationContext = wrapUnique(new ViewFragmentationContext(*this)); 241 m_fragmentationContext = wrapUnique(new ViewFragmentationContext(*this));
240 m_paginationStateChanged = true; 242 m_paginationStateChanged = true;
241 } 243 }
242 } else if (m_fragmentationContext) { 244 } else if (m_fragmentationContext) {
243 m_fragmentationContext.reset(); 245 m_fragmentationContext.reset();
244 m_paginationStateChanged = true; 246 m_paginationStateChanged = true;
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 LayoutRect overflowRect(layoutOverflowRect()); 883 LayoutRect overflowRect(layoutOverflowRect());
882 flipForWritingMode(overflowRect); 884 flipForWritingMode(overflowRect);
883 // TODO(crbug.com/650768): The pixel snapping looks incorrect. 885 // TODO(crbug.com/650768): The pixel snapping looks incorrect.
884 return pixelSnappedIntRect(overflowRect); 886 return pixelSnappedIntRect(overflowRect);
885 } 887 }
886 888
887 bool LayoutView::rootBackgroundIsEntirelyFixed() const { 889 bool LayoutView::rootBackgroundIsEntirelyFixed() const {
888 return style()->hasEntirelyFixedBackground(); 890 return style()->hasEntirelyFixedBackground();
889 } 891 }
890 892
891 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const {
892 return LayoutRect(documentRect());
893 }
894
895 IntSize LayoutView::layoutSize( 893 IntSize LayoutView::layoutSize(
896 IncludeScrollbarsInRect scrollbarInclusion) const { 894 IncludeScrollbarsInRect scrollbarInclusion) const {
897 if (shouldUsePrintingLayout()) 895 if (shouldUsePrintingLayout())
898 return IntSize(size().width().toInt(), pageLogicalHeight().toInt()); 896 return IntSize(size().width().toInt(), pageLogicalHeight().toInt());
899 897
900 if (!m_frameView) 898 if (!m_frameView)
901 return IntSize(); 899 return IntSize();
902 900
903 IntSize result = m_frameView->layoutSize(IncludeScrollbars); 901 IntSize result = m_frameView->layoutSize(IncludeScrollbars);
904 if (scrollbarInclusion == ExcludeScrollbars) 902 if (scrollbarInclusion == ExcludeScrollbars)
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (block) 1055 if (block)
1058 block->adjustChildDebugRect(rect); 1056 block->adjustChildDebugRect(rect);
1059 1057
1060 rect.setWidth(LayoutUnit(viewWidth(IncludeScrollbars))); 1058 rect.setWidth(LayoutUnit(viewWidth(IncludeScrollbars)));
1061 rect.setHeight(LayoutUnit(viewHeight(IncludeScrollbars))); 1059 rect.setHeight(LayoutUnit(viewHeight(IncludeScrollbars)));
1062 1060
1063 return rect; 1061 return rect;
1064 } 1062 }
1065 1063
1066 } // namespace blink 1064 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.h ('k') | third_party/WebKit/Source/web/tests/VisualViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698