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

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

Issue 2529293012: Invalidate paint properties on paint offset changes (Closed)
Patch Set: Simpler fix for overflowclip Created 4 years 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 * (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. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 updateBackgroundAttachmentFixedStatusAfterStyleChange(); 318 updateBackgroundAttachmentFixedStatusAfterStyleChange();
319 319
320 if (oldStyle) { 320 if (oldStyle) {
321 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 321 LayoutFlowThread* flowThread = flowThreadContainingBlock();
322 if (flowThread && flowThread != this) 322 if (flowThread && flowThread != this)
323 flowThread->flowThreadDescendantStyleDidChange(this, diff, *oldStyle); 323 flowThread->flowThreadDescendantStyleDidChange(this, diff, *oldStyle);
324 324
325 updateScrollSnapMappingAfterStyleChange(&newStyle, oldStyle); 325 updateScrollSnapMappingAfterStyleChange(&newStyle, oldStyle);
326 } 326 }
327 327
328 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
329 // The overflow clip paint property depends on border sizes through
330 // overflowClipRect(), so we trigger a property update if any border is or
331 // was present. This check could be more precise (checking the actual
332 // border values) if performance is an issue.
333 if (hasOverflowClip() || styleRef().containsPaint() || hasControlClip()) {
334 if (newStyle.hasBorder() || (oldStyle && oldStyle->hasBorder()))
Xianzhu 2016/12/05 16:55:53 How does it work if overflow clip changed without
335 setNeedsPaintPropertyUpdate();
336 }
337 }
338
328 // Non-atomic inlines should be LayoutInline or LayoutText, not LayoutBox. 339 // Non-atomic inlines should be LayoutInline or LayoutText, not LayoutBox.
329 DCHECK(!isInline() || isAtomicInlineLevel()); 340 DCHECK(!isInline() || isAtomicInlineLevel());
330 } 341 }
331 342
332 void LayoutBox::updateBackgroundAttachmentFixedStatusAfterStyleChange() { 343 void LayoutBox::updateBackgroundAttachmentFixedStatusAfterStyleChange() {
333 if (!frameView()) 344 if (!frameView())
334 return; 345 return;
335 346
336 // On low-powered/mobile devices, preventing blitting on a scroll can cause 347 // On low-powered/mobile devices, preventing blitting on a scroll can cause
337 // noticeable delays when scrolling a page with a fixed background image. As 348 // noticeable delays when scrolling a page with a fixed background image. As
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 1696
1686 void LayoutBox::frameRectChanged() { 1697 void LayoutBox::frameRectChanged() {
1687 if (node() && node()->isElementNode()) { 1698 if (node() && node()->isElementNode()) {
1688 Element& element = toElement(*node()); 1699 Element& element = toElement(*node());
1689 element.setNeedsResizeObserverUpdate(); 1700 element.setNeedsResizeObserverUpdate();
1690 } 1701 }
1691 // The frame rect may change because of layout of other objects. 1702 // The frame rect may change because of layout of other objects.
1692 // Should check this object for paint invalidation. 1703 // Should check this object for paint invalidation.
1693 if (!needsLayout()) 1704 if (!needsLayout())
1694 setMayNeedPaintInvalidation(); 1705 setMayNeedPaintInvalidation();
1706
1707 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
1708 // The overflow clip paint property depends on the border box rect through
1709 // overflowClipRect, which in turn depends on the frame rect.
1710 if (hasOverflowClip() || styleRef().containsPaint() || hasControlClip())
1711 setNeedsPaintPropertyUpdate();
1712 }
1695 } 1713 }
1696 1714
1697 bool LayoutBox::intersectsVisibleViewport() const { 1715 bool LayoutBox::intersectsVisibleViewport() const {
1698 LayoutRect rect = visualOverflowRect(); 1716 LayoutRect rect = visualOverflowRect();
1699 LayoutView* layoutView = view(); 1717 LayoutView* layoutView = view();
1700 while (!layoutView->frame()->ownerLayoutItem().isNull()) 1718 while (!layoutView->frame()->ownerLayoutItem().isNull())
1701 layoutView = 1719 layoutView =
1702 LayoutAPIShim::layoutObjectFrom(layoutView->frame()->ownerLayoutItem()) 1720 LayoutAPIShim::layoutObjectFrom(layoutView->frame()->ownerLayoutItem())
1703 ->view(); 1721 ->view();
1704 mapToVisualRectInAncestorSpace(layoutView, rect); 1722 mapToVisualRectInAncestorSpace(layoutView, rect);
(...skipping 3918 matching lines...) Expand 10 before | Expand all | Expand 10 after
5623 LayoutRect rect = frameRect(); 5641 LayoutRect rect = frameRect();
5624 5642
5625 LayoutBlock* block = containingBlock(); 5643 LayoutBlock* block = containingBlock();
5626 if (block) 5644 if (block)
5627 block->adjustChildDebugRect(rect); 5645 block->adjustChildDebugRect(rect);
5628 5646
5629 return rect; 5647 return rect;
5630 } 5648 }
5631 5649
5632 } // namespace blink 5650 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698