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

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

Issue 2872423002: Tweak PaintInvalidationReasons (Closed)
Patch Set: Rebaseline-cl Created 3 years, 7 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
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 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 return ForegroundIsKnownToBeOpaqueInRect(background_rect, 1720 return ForegroundIsKnownToBeOpaqueInRect(background_rect,
1721 kBackgroundObscurationTestMaxDepth); 1721 kBackgroundObscurationTestMaxDepth);
1722 } 1722 }
1723 1723
1724 void LayoutBox::PaintMask(const PaintInfo& paint_info, 1724 void LayoutBox::PaintMask(const PaintInfo& paint_info,
1725 const LayoutPoint& paint_offset) const { 1725 const LayoutPoint& paint_offset) const {
1726 BoxPainter(*this).PaintMask(paint_info, paint_offset); 1726 BoxPainter(*this).PaintMask(paint_info, paint_offset);
1727 } 1727 }
1728 1728
1729 void LayoutBox::ImageChanged(WrappedImagePtr image, const IntRect*) { 1729 void LayoutBox::ImageChanged(WrappedImagePtr image, const IntRect*) {
1730 // TODO(chrishtr): support kPaintInvalidationDelayedFull for animated border 1730 // TODO(chrishtr): support PaintInvalidationReason::kDelayedFull for animated
1731 // images. 1731 // border images.
1732 if ((StyleRef().BorderImage().GetImage() && 1732 if ((StyleRef().BorderImage().GetImage() &&
1733 StyleRef().BorderImage().GetImage()->Data() == image) || 1733 StyleRef().BorderImage().GetImage()->Data() == image) ||
1734 (StyleRef().MaskBoxImage().GetImage() && 1734 (StyleRef().MaskBoxImage().GetImage() &&
1735 StyleRef().MaskBoxImage().GetImage()->Data() == image) || 1735 StyleRef().MaskBoxImage().GetImage()->Data() == image) ||
1736 (StyleRef().BoxReflect() && StyleRef().BoxReflect()->Mask().GetImage() && 1736 (StyleRef().BoxReflect() && StyleRef().BoxReflect()->Mask().GetImage() &&
1737 StyleRef().BoxReflect()->Mask().GetImage()->Data() == image)) { 1737 StyleRef().BoxReflect()->Mask().GetImage()->Data() == image)) {
1738 SetShouldDoFullPaintInvalidationWithoutGeometryChange(); 1738 SetShouldDoFullPaintInvalidationWithoutGeometryChange(
1739 PaintInvalidationReason::kImage);
1739 } else { 1740 } else {
1740 for (const FillLayer* layer = &StyleRef().MaskLayers(); layer; 1741 for (const FillLayer* layer = &StyleRef().MaskLayers(); layer;
1741 layer = layer->Next()) { 1742 layer = layer->Next()) {
1742 if (layer->GetImage() && image == layer->GetImage()->Data()) { 1743 if (layer->GetImage() && image == layer->GetImage()->Data()) {
1743 SetShouldDoFullPaintInvalidationWithoutGeometryChange(); 1744 SetShouldDoFullPaintInvalidationWithoutGeometryChange(
1745 PaintInvalidationReason::kImage);
1744 break; 1746 break;
1745 } 1747 }
1746 } 1748 }
1747 } 1749 }
1748 1750
1749 if (!IsDocumentElement() && !BackgroundStolenForBeingBody()) { 1751 if (!IsDocumentElement() && !BackgroundStolenForBeingBody()) {
1750 for (const FillLayer* layer = &StyleRef().BackgroundLayers(); layer; 1752 for (const FillLayer* layer = &StyleRef().BackgroundLayers(); layer;
1751 layer = layer->Next()) { 1753 layer = layer->Next()) {
1752 if (layer->GetImage() && image == layer->GetImage()->Data()) { 1754 if (layer->GetImage() && image == layer->GetImage()->Data()) {
1753 InvalidateBackgroundObscurationStatus(); 1755 InvalidateBackgroundObscurationStatus();
1754 bool maybe_animated = 1756 bool maybe_animated =
1755 layer->GetImage()->CachedImage() && 1757 layer->GetImage()->CachedImage() &&
1756 layer->GetImage()->CachedImage()->GetImage() && 1758 layer->GetImage()->CachedImage()->GetImage() &&
1757 layer->GetImage()->CachedImage()->GetImage()->MaybeAnimated(); 1759 layer->GetImage()->CachedImage()->GetImage()->MaybeAnimated();
1758 if (maybe_animated) { 1760 if (maybe_animated) {
1759 SetMayNeedPaintInvalidationAnimatedBackgroundImage(); 1761 SetMayNeedPaintInvalidationAnimatedBackgroundImage();
1760 } else { 1762 } else {
1761 SetShouldDoFullPaintInvalidationWithoutGeometryChange(); 1763 SetShouldDoFullPaintInvalidationWithoutGeometryChange(
1764 PaintInvalidationReason::kImage);
1762 SetBackgroundChangedSinceLastPaintInvalidation(); 1765 SetBackgroundChangedSinceLastPaintInvalidation();
1763 } 1766 }
1764 break; 1767 break;
1765 } 1768 }
1766 } 1769 }
1767 } 1770 }
1768 1771
1769 ShapeValue* shape_outside_value = Style()->ShapeOutside(); 1772 ShapeValue* shape_outside_value = Style()->ShapeOutside();
1770 if (!GetFrameView()->IsInPerformLayout() && IsFloating() && 1773 if (!GetFrameView()->IsInPerformLayout() && IsFloating() &&
1771 shape_outside_value && shape_outside_value->GetImage() && 1774 shape_outside_value && shape_outside_value->GetImage() &&
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 return rect.Intersects(LayoutRect( 1837 return rect.Intersects(LayoutRect(
1835 layout_view->GetFrameView()->GetScrollableArea()->VisibleContentRect())); 1838 layout_view->GetFrameView()->GetScrollableArea()->VisibleContentRect()));
1836 } 1839 }
1837 1840
1838 void LayoutBox::EnsureIsReadyForPaintInvalidation() { 1841 void LayoutBox::EnsureIsReadyForPaintInvalidation() {
1839 LayoutBoxModelObject::EnsureIsReadyForPaintInvalidation(); 1842 LayoutBoxModelObject::EnsureIsReadyForPaintInvalidation();
1840 1843
1841 if (MayNeedPaintInvalidationAnimatedBackgroundImage() && 1844 if (MayNeedPaintInvalidationAnimatedBackgroundImage() &&
1842 !BackgroundIsKnownToBeObscured()) { 1845 !BackgroundIsKnownToBeObscured()) {
1843 SetShouldDoFullPaintInvalidationWithoutGeometryChange( 1846 SetShouldDoFullPaintInvalidationWithoutGeometryChange(
1844 kPaintInvalidationDelayedFull); 1847 PaintInvalidationReason::kDelayedFull);
1845 } 1848 }
1846 1849
1847 if (FullPaintInvalidationReason() != kPaintInvalidationDelayedFull || 1850 if (FullPaintInvalidationReason() != PaintInvalidationReason::kDelayedFull ||
1848 !IntersectsVisibleViewport()) 1851 !IntersectsVisibleViewport())
1849 return; 1852 return;
1850 1853
1851 // Do regular full paint invalidation if the object with 1854 // Do regular full paint invalidation if the object with
1852 // kPaintInvalidationDelayedFull is onscreen. 1855 // PaintInvalidationReason::kDelayedFull is onscreen.
1853 // Conservatively assume the delayed paint invalidation was caused by 1856 // Conservatively assume the delayed paint invalidation was caused by
1854 // background image change. 1857 // background image change.
1855 SetBackgroundChangedSinceLastPaintInvalidation(); 1858 SetBackgroundChangedSinceLastPaintInvalidation();
1856 SetShouldDoFullPaintInvalidationWithoutGeometryChange(kPaintInvalidationFull); 1859 SetShouldDoFullPaintInvalidationWithoutGeometryChange(
1860 PaintInvalidationReason::kFull);
1857 } 1861 }
1858 1862
1859 PaintInvalidationReason LayoutBox::DeprecatedInvalidatePaint( 1863 PaintInvalidationReason LayoutBox::DeprecatedInvalidatePaint(
1860 const PaintInvalidationState& paint_invalidation_state) { 1864 const PaintInvalidationState& paint_invalidation_state) {
1861 if (HasBoxDecorationBackground() 1865 if (HasBoxDecorationBackground()
1862 // We also paint overflow controls in background phase. 1866 // We also paint overflow controls in background phase.
1863 || (HasOverflowClip() && GetScrollableArea()->HasOverflowControls())) { 1867 || (HasOverflowClip() && GetScrollableArea()->HasOverflowControls())) {
1864 PaintLayer& layer = paint_invalidation_state.PaintingLayer(); 1868 PaintLayer& layer = paint_invalidation_state.PaintingLayer();
1865 if (&layer.GetLayoutObject() != this) 1869 if (&layer.GetLayoutObject() != this)
1866 layer.SetNeedsPaintPhaseDescendantBlockBackgrounds(); 1870 layer.SetNeedsPaintPhaseDescendantBlockBackgrounds();
(...skipping 3994 matching lines...) Expand 10 before | Expand all | Expand 10 after
5861 void LayoutBox::MutableForPainting:: 5865 void LayoutBox::MutableForPainting::
5862 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5866 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5863 auto& rare_data = GetLayoutBox().EnsureRareData(); 5867 auto& rare_data = GetLayoutBox().EnsureRareData();
5864 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5868 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5865 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5869 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5866 rare_data.previous_layout_overflow_rect_ = 5870 rare_data.previous_layout_overflow_rect_ =
5867 GetLayoutBox().LayoutOverflowRect(); 5871 GetLayoutBox().LayoutOverflowRect();
5868 } 5872 }
5869 5873
5870 } // namespace blink 5874 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698