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

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

Issue 2821323002: Optimize offscreen animation: don't update paint properties/visual rects (Closed)
Patch Set: Add unit test 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutImage.cpp » ('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. 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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 return ForegroundIsKnownToBeOpaqueInRect(background_rect, 1746 return ForegroundIsKnownToBeOpaqueInRect(background_rect,
1747 kBackgroundObscurationTestMaxDepth); 1747 kBackgroundObscurationTestMaxDepth);
1748 } 1748 }
1749 1749
1750 void LayoutBox::PaintMask(const PaintInfo& paint_info, 1750 void LayoutBox::PaintMask(const PaintInfo& paint_info,
1751 const LayoutPoint& paint_offset) const { 1751 const LayoutPoint& paint_offset) const {
1752 BoxPainter(*this).PaintMask(paint_info, paint_offset); 1752 BoxPainter(*this).PaintMask(paint_info, paint_offset);
1753 } 1753 }
1754 1754
1755 void LayoutBox::ImageChanged(WrappedImagePtr image, const IntRect*) { 1755 void LayoutBox::ImageChanged(WrappedImagePtr image, const IntRect*) {
1756 // TODO(chrishtr): support PaintInvalidationDelayedFull for animated border 1756 // TODO(chrishtr): support kPaintInvalidationDelayedFull for animated border
1757 // images. 1757 // images.
1758 if ((StyleRef().BorderImage().GetImage() && 1758 if ((StyleRef().BorderImage().GetImage() &&
1759 StyleRef().BorderImage().GetImage()->Data() == image) || 1759 StyleRef().BorderImage().GetImage()->Data() == image) ||
1760 (StyleRef().MaskBoxImage().GetImage() && 1760 (StyleRef().MaskBoxImage().GetImage() &&
1761 StyleRef().MaskBoxImage().GetImage()->Data() == image) || 1761 StyleRef().MaskBoxImage().GetImage()->Data() == image) ||
1762 (StyleRef().BoxReflect() && StyleRef().BoxReflect()->Mask().GetImage() && 1762 (StyleRef().BoxReflect() && StyleRef().BoxReflect()->Mask().GetImage() &&
1763 StyleRef().BoxReflect()->Mask().GetImage()->Data() == image)) { 1763 StyleRef().BoxReflect()->Mask().GetImage()->Data() == image)) {
1764 SetShouldDoFullPaintInvalidationWithoutGeometryChange(); 1764 SetShouldDoFullPaintInvalidationWithoutGeometryChange();
1765 } else { 1765 } else {
1766 for (const FillLayer* layer = &StyleRef().MaskLayers(); layer; 1766 for (const FillLayer* layer = &StyleRef().MaskLayers(); layer;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 !BackgroundIsKnownToBeObscured()) { 1868 !BackgroundIsKnownToBeObscured()) {
1869 SetShouldDoFullPaintInvalidationWithoutGeometryChange( 1869 SetShouldDoFullPaintInvalidationWithoutGeometryChange(
1870 kPaintInvalidationDelayedFull); 1870 kPaintInvalidationDelayedFull);
1871 } 1871 }
1872 1872
1873 if (FullPaintInvalidationReason() != kPaintInvalidationDelayedFull || 1873 if (FullPaintInvalidationReason() != kPaintInvalidationDelayedFull ||
1874 !IntersectsVisibleViewport()) 1874 !IntersectsVisibleViewport())
1875 return; 1875 return;
1876 1876
1877 // Do regular full paint invalidation if the object with 1877 // Do regular full paint invalidation if the object with
1878 // PaintInvalidationDelayedFull is onscreen. 1878 // kPaintInvalidationDelayedFull is onscreen.
1879 if (IntersectsVisibleViewport()) { 1879 // Conservatively assume the delayed paint invalidation was caused by
1880 // Conservatively assume the delayed paint invalidation was caused by 1880 // background image change.
1881 // background image change. 1881 SetBackgroundChangedSinceLastPaintInvalidation();
1882 SetBackgroundChangedSinceLastPaintInvalidation(); 1882 SetShouldDoFullPaintInvalidationWithoutGeometryChange(kPaintInvalidationFull);
1883 SetShouldDoFullPaintInvalidationWithoutGeometryChange(
1884 kPaintInvalidationFull);
1885 }
1886 } 1883 }
1887 1884
1888 PaintInvalidationReason LayoutBox::InvalidatePaintIfNeeded( 1885 PaintInvalidationReason LayoutBox::InvalidatePaintIfNeeded(
1889 const PaintInvalidationState& paint_invalidation_state) { 1886 const PaintInvalidationState& paint_invalidation_state) {
1890 if (HasBoxDecorationBackground() 1887 if (HasBoxDecorationBackground()
1891 // We also paint overflow controls in background phase. 1888 // We also paint overflow controls in background phase.
1892 || (HasOverflowClip() && GetScrollableArea()->HasOverflowControls())) { 1889 || (HasOverflowClip() && GetScrollableArea()->HasOverflowControls())) {
1893 PaintLayer& layer = paint_invalidation_state.PaintingLayer(); 1890 PaintLayer& layer = paint_invalidation_state.PaintingLayer();
1894 if (&layer.GetLayoutObject() != this) 1891 if (&layer.GetLayoutObject() != this)
1895 layer.SetNeedsPaintPhaseDescendantBlockBackgrounds(); 1892 layer.SetNeedsPaintPhaseDescendantBlockBackgrounds();
(...skipping 4004 matching lines...) Expand 10 before | Expand all | Expand 10 after
5900 void LayoutBox::MutableForPainting:: 5897 void LayoutBox::MutableForPainting::
5901 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5898 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5902 auto& rare_data = GetLayoutBox().EnsureRareData(); 5899 auto& rare_data = GetLayoutBox().EnsureRareData();
5903 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5900 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5904 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5901 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5905 rare_data.previous_layout_overflow_rect_ = 5902 rare_data.previous_layout_overflow_rect_ =
5906 GetLayoutBox().LayoutOverflowRect(); 5903 GetLayoutBox().LayoutOverflowRect();
5907 } 5904 }
5908 5905
5909 } // namespace blink 5906 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698