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

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

Issue 1145993002: Refactor root element background painting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase, adding back TestExpectation Created 5 years, 6 months 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 | Annotate | Revision Log
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. 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (!style()->isHorizontalWritingMode()) 160 if (!style()->isHorizontalWritingMode())
161 return true; 161 return true;
162 162
163 // The width/height checks below assume horizontal writing mode. 163 // The width/height checks below assume horizontal writing mode.
164 ASSERT(style()->isHorizontalWritingMode()); 164 ASSERT(style()->isHorizontalWritingMode());
165 165
166 if (size().width() != viewLogicalWidthForBoxSizing()) 166 if (size().width() != viewLogicalWidthForBoxSizing())
167 return true; 167 return true;
168 168
169 if (size().height() != viewLogicalHeightForBoxSizing()) { 169 if (size().height() != viewLogicalHeightForBoxSizing()) {
170 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject( )) { 170 // When background-attachment is 'fixed', we treat the viewport (instead of the 'root'
171 // When background-attachment is 'fixed', we treat the viewport (ins tead of the 'root' 171 // i.e. html or body) as the background positioning area, and we should full paint invalidation
172 // i.e. html or body) as the background positioning area, and we sho uld full paint invalidation 172 // viewport resize if the background image is not composited and needs f ull paint invalidation on
173 // viewport resize if the background image is not composited and nee ds full paint invalidation on 173 // background positioning area resize.
174 // background positioning area resize. 174 if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(layer( ))) {
175 if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(la yer())) { 175 if (style()->hasFixedBackgroundImage()
176 if (backgroundLayoutObject->style()->hasFixedBackgroundImage() 176 && mustInvalidateFillLayersPaintOnHeightChange(style()->backgrou ndLayers()))
177 && mustInvalidateFillLayersPaintOnHeightChange(backgroundLay outObject->style()->backgroundLayers())) 177 return true;
178 return true;
179 }
180 } 178 }
181 } 179 }
182 180
183 return false; 181 return false;
184 } 182 }
185 183
186 void LayoutView::layout() 184 void LayoutView::layout()
187 { 185 {
188 if (!document().paginated()) 186 if (!document().paginated())
189 setPageLogicalHeight(0); 187 setPageLogicalHeight(0);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 rootObject->setShouldDoFullPaintInvalidation(); 233 rootObject->setShouldDoFullPaintInvalidation();
236 } 234 }
237 } 235 }
238 236
239 #if ENABLE(ASSERT) 237 #if ENABLE(ASSERT)
240 checkLayoutState(); 238 checkLayoutState();
241 #endif 239 #endif
242 clearNeedsLayout(); 240 clearNeedsLayout();
243 } 241 }
244 242
243 LayoutRect LayoutView::visualOverflowRect() const
244 {
245 // In root layer scrolling mode, the LayoutView performs overflow clipping
246 // like a regular scrollable div.
247 if (document().settings() && document().settings()->rootLayerScrolls())
248 return LayoutBlockFlow::visualOverflowRect();
249
250 // Ditto when not in compositing mode.
251 if (!usesCompositing())
252 return LayoutBlockFlow::visualOverflowRect();
253
254 // In normal compositing mode, LayoutView doesn't actually apply clipping
255 // on its descendants. Instead their visual overflow is propagated to
256 // compositor()->m_rootContentLayer for accelerated scrolling.
257 return LayoutRect(unscaledDocumentRect());
258 }
259
245 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const 260 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const
246 { 261 {
247 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); 262 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed));
248 263
249 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) { 264 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) {
250 TransformationMatrix t; 265 TransformationMatrix t;
251 getTransformFromContainer(0, LayoutSize(), t); 266 getTransformFromContainer(0, LayoutSize(), t);
252 transformState.applyTransform(t); 267 transformState.applyTransform(t);
253 } 268 }
254 269
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 824
810 IntRect LayoutView::unscaledDocumentRect() const 825 IntRect LayoutView::unscaledDocumentRect() const
811 { 826 {
812 LayoutRect overflowRect(layoutOverflowRect()); 827 LayoutRect overflowRect(layoutOverflowRect());
813 flipForWritingMode(overflowRect); 828 flipForWritingMode(overflowRect);
814 return pixelSnappedIntRect(overflowRect); 829 return pixelSnappedIntRect(overflowRect);
815 } 830 }
816 831
817 bool LayoutView::rootBackgroundIsEntirelyFixed() const 832 bool LayoutView::rootBackgroundIsEntirelyFixed() const
818 { 833 {
819 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject()) 834 return style()->hasEntirelyFixedBackground();
820 return backgroundLayoutObject->style()->hasEntirelyFixedBackground();
821 return false;
822 }
823
824 LayoutObject* LayoutView::backgroundLayoutObject() const
825 {
826 if (Element* documentElement = document().documentElement()) {
827 if (LayoutObject* rootObject = documentElement->layoutObject())
828 return rootObject->layoutObjectForRootBackground();
829 }
830 return nullptr;
831 } 835 }
832 836
833 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const 837 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const
834 { 838 {
835 return LayoutRect(unscaledDocumentRect()); 839 return LayoutRect(unscaledDocumentRect());
836 } 840 }
837 841
838 IntRect LayoutView::documentRect() const 842 IntRect LayoutView::documentRect() const
839 { 843 {
840 FloatRect overflowRect(unscaledDocumentRect()); 844 FloatRect overflowRect(unscaledDocumentRect());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 return viewHeight(IncludeScrollbars) / scale; 950 return viewHeight(IncludeScrollbars) / scale;
947 } 951 }
948 952
949 void LayoutView::willBeDestroyed() 953 void LayoutView::willBeDestroyed()
950 { 954 {
951 LayoutBlockFlow::willBeDestroyed(); 955 LayoutBlockFlow::willBeDestroyed();
952 m_compositor.clear(); 956 m_compositor.clear();
953 } 957 }
954 958
955 } // namespace blink 959 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutView.h ('k') | Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698