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

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: 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (block) 1059 if (block)
1058 block->adjustChildDebugRect(rect); 1060 block->adjustChildDebugRect(rect);
1059 1061
1060 rect.setWidth(LayoutUnit(viewWidth(IncludeScrollbars))); 1062 rect.setWidth(LayoutUnit(viewWidth(IncludeScrollbars)));
1061 rect.setHeight(LayoutUnit(viewHeight(IncludeScrollbars))); 1063 rect.setHeight(LayoutUnit(viewHeight(IncludeScrollbars)));
1062 1064
1063 return rect; 1065 return rect;
1064 } 1066 }
1065 1067
1066 } // namespace blink 1068 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698