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

Side by Side Diff: Source/core/layout/LayoutImage.h

Issue 1008043002: [S.P.] Don't draw frames of animated images that are offscreen. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override; 77 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
78 78
79 virtual void paint(const PaintInfo&, const LayoutPoint&) override final; 79 virtual void paint(const PaintInfo&, const LayoutPoint&) override final;
80 80
81 virtual void layout() override; 81 virtual void layout() override;
82 virtual bool updateImageLoadingPriorities() override final; 82 virtual bool updateImageLoadingPriorities() override final;
83 83
84 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutImage || LayoutReplaced::isOfType(type); } 84 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutImage || LayoutReplaced::isOfType(type); }
85 85
86 virtual PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidat ionState&, const LayoutBoxModelObject&) override;
87
86 private: 88 private:
87 virtual bool isImage() const override { return true; } 89 virtual bool isImage() const override { return true; }
88 90
89 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) override; 91 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) override;
90 92
91 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override final; 93 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override final;
92 virtual bool computeBackgroundIsKnownToBeObscured() override final; 94 virtual bool computeBackgroundIsKnownToBeObscured() override final;
93 95
94 virtual bool backgroundShouldAlwaysBeClipped() const override { return true; } 96 virtual bool backgroundShouldAlwaysBeClipped() const override { return true; }
95 97
96 virtual LayoutUnit minimumReplacedHeight() const override; 98 virtual LayoutUnit minimumReplacedHeight() const override;
97 99
98 virtual void notifyFinished(Resource*) override final; 100 virtual void notifyFinished(Resource*) override final;
99 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override final; 101 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override final;
100 102
101 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final; 103 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final;
102 104
103 void invalidatePaintAndMarkForLayoutIfNeeded(); 105 void invalidatePaintAndMarkForLayoutIfNeeded();
104 void updateIntrinsicSizeIfNeeded(const LayoutSize&); 106 void updateIntrinsicSizeIfNeeded(const LayoutSize&);
105 // Update the size of the image to be rendered. Object-fit may cause this to be different from the CSS box's content rect. 107 // Update the size of the image to be rendered. Object-fit may cause this to be different from the CSS box's content rect.
106 void updateInnerContentRect(); 108 void updateInnerContentRect();
107 109
110 // The given rect is in the local coordinate space of the LayoutImage.
111 bool rectIntersectsVisibleViewport(const LayoutRect&);
112
108 // Text to display as long as the image isn't available. 113 // Text to display as long as the image isn't available.
109 OwnPtr<LayoutImageResource> m_imageResource; 114 OwnPtr<LayoutImageResource> m_imageResource;
110 bool m_didIncrementVisuallyNonEmptyPixelCount; 115 bool m_didIncrementVisuallyNonEmptyPixelCount;
111 bool m_isGeneratedContent; 116 bool m_isGeneratedContent;
112 float m_imageDevicePixelRatio; 117 float m_imageDevicePixelRatio;
113 }; 118 };
114 119
115 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutImage, isLayoutImage()); 120 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutImage, isLayoutImage());
116 121
117 } // namespace blink 122 } // namespace blink
118 123
119 #endif // LayoutImage_h 124 #endif // LayoutImage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698