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

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

Issue 1240443003: Fix slow repaint object registration (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revise Created 5 years, 5 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
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 if (isDocumentElement() || isBody()) { 239 if (isDocumentElement() || isBody()) {
240 document().view()->recalculateScrollbarOverlayStyle(); 240 document().view()->recalculateScrollbarOverlayStyle();
241 document().view()->recalculateCustomScrollbarStyle(); 241 document().view()->recalculateCustomScrollbarStyle();
242 } 242 }
243 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle); 243 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle);
244 updateGridPositionAfterStyleChange(oldStyle); 244 updateGridPositionAfterStyleChange(oldStyle);
245 245
246 if (LayoutMultiColumnSpannerPlaceholder* placeholder = this->spannerPlacehol der()) 246 if (LayoutMultiColumnSpannerPlaceholder* placeholder = this->spannerPlacehol der())
247 placeholder->layoutObjectInFlowThreadStyleDidChange(oldStyle); 247 placeholder->layoutObjectInFlowThreadStyleDidChange(oldStyle);
248
249 updateSlowRepaintStatusAfterStyleChange();
250 }
251
252 void LayoutBox::updateSlowRepaintStatusAfterStyleChange()
253 {
254 if (!frameView())
255 return;
256
257 // On low-powered/mobile devices, preventing blitting on a scroll can cause noticeable delays
258 // when scrolling a page with a fixed background image. As an optimization, assuming there are
259 // no fixed positoned elements on the page, we can acclerate scrolling (via blitting) if we
260 // ignore the CSS property "background-attachment: fixed".
261 bool ignoreFixedBackgroundAttachment = RuntimeEnabledFeatures::fastMobileScr ollingEnabled();
262 if (ignoreFixedBackgroundAttachment)
263 return;
264
265 // An object needs to be repainted on frame scroll when it has background-at tachment:fixed.
266 // LayoutObject is responsible for painting root background, thus the root e lement (and the
267 // body element if html element has no background) skips painting background s.
268 bool isSlowRepaintObject = !isDocumentElement() && !backgroundStolenForBeing Body() && styleRef().hasFixedBackgroundImage();
269 if (isLayoutView() && view()->compositor()->supportsFixedRootBackgroundCompo siting()) {
270 if (styleRef().hasEntirelyFixedBackground())
271 isSlowRepaintObject = false;
272 }
273
274 setIsSlowRepaintObject(isSlowRepaintObject);
248 } 275 }
249 276
250 void LayoutBox::updateShapeOutsideInfoAfterStyleChange(const ComputedStyle& styl e, const ComputedStyle* oldStyle) 277 void LayoutBox::updateShapeOutsideInfoAfterStyleChange(const ComputedStyle& styl e, const ComputedStyle* oldStyle)
251 { 278 {
252 const ShapeValue* shapeOutside = style.shapeOutside(); 279 const ShapeValue* shapeOutside = style.shapeOutside();
253 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Co mputedStyle::initialShapeOutside(); 280 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Co mputedStyle::initialShapeOutside();
254 281
255 Length shapeMargin = style.shapeMargin(); 282 Length shapeMargin = style.shapeMargin();
256 Length oldShapeMargin = oldStyle ? oldStyle->shapeMargin() : ComputedStyle:: initialShapeMargin(); 283 Length oldShapeMargin = oldStyle ? oldStyle->shapeMargin() : ComputedStyle:: initialShapeMargin();
257 284
(...skipping 4498 matching lines...) Expand 10 before | Expand all | Expand 10 after
4756 StyleImage* borderImage = style()->borderImage().image(); 4783 StyleImage* borderImage = style()->borderImage().image();
4757 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4784 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4758 } 4785 }
4759 4786
4760 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4787 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4761 { 4788 {
4762 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4789 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4763 } 4790 }
4764 4791
4765 } // namespace blink 4792 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698