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

Side by Side Diff: Source/core/rendering/RenderImage.h

Issue 481753002: Use Shadow DOM to display fallback content for images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 1 month 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual void destroy() override; 44 virtual void destroy() override;
45 45
46 static RenderImage* createAnonymous(Document*); 46 static RenderImage* createAnonymous(Document*);
47 47
48 void setImageResource(PassOwnPtr<RenderImageResource>); 48 void setImageResource(PassOwnPtr<RenderImageResource>);
49 49
50 RenderImageResource* imageResource() { return m_imageResource.get(); } 50 RenderImageResource* imageResource() { return m_imageResource.get(); }
51 const RenderImageResource* imageResource() const { return m_imageResource.ge t(); } 51 const RenderImageResource* imageResource() const { return m_imageResource.ge t(); }
52 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc e->cachedImage() : 0; } 52 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc e->cachedImage() : 0; }
53 53
54 bool setImageSizeForAltText(ImageResource* newImage = 0);
55
56 void updateAltText();
57
58 HTMLMapElement* imageMap() const; 54 HTMLMapElement* imageMap() const;
59 void areaElementFocusChanged(HTMLAreaElement*); 55 void areaElementFocusChanged(HTMLAreaElement*);
60 56
61 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g enerated; } 57 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g enerated; }
62 58
63 bool isGeneratedContent() const { return m_isGeneratedContent; } 59 bool isGeneratedContent() const { return m_isGeneratedContent; }
64 60
65 String altText() const { return m_altText; }
66
67 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; } 61 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
68 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } 62 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
69 63
70 virtual void intrinsicSizeChanged() override 64 virtual void intrinsicSizeChanged() override
71 { 65 {
72 if (m_imageResource) 66 if (m_imageResource)
73 imageChanged(m_imageResource->imagePtr()); 67 imageChanged(m_imageResource->imagePtr());
74 } 68 }
75 69
76 protected: 70 protected:
(...skipping 21 matching lines...) Expand all
98 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override final; 92 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override final;
99 virtual bool computeBackgroundIsKnownToBeObscured() override final; 93 virtual bool computeBackgroundIsKnownToBeObscured() override final;
100 94
101 virtual LayoutUnit minimumReplacedHeight() const override; 95 virtual LayoutUnit minimumReplacedHeight() const override;
102 96
103 virtual void notifyFinished(Resource*) override final; 97 virtual void notifyFinished(Resource*) override final;
104 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override final; 98 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override final;
105 99
106 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final; 100 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final;
107 101
108 IntSize imageSizeForError(ImageResource*) const; 102 void repaintOrMarkForLayout(const IntRect* = 0);
109 void paintInvalidationOrMarkForLayout(bool imageSizeChanged, const IntRect* = 0);
110 void updateIntrinsicSizeIfNeeded(const LayoutSize&); 103 void updateIntrinsicSizeIfNeeded(const LayoutSize&);
111 // Update the size of the image to be rendered. Object-fit may cause this to be different from the CSS box's content rect. 104 // Update the size of the image to be rendered. Object-fit may cause this to be different from the CSS box's content rect.
112 void updateInnerContentRect(); 105 void updateInnerContentRect();
113 106
114 // Text to display as long as the image isn't available. 107 // Text to display as long as the image isn't available.
115 String m_altText;
116 OwnPtr<RenderImageResource> m_imageResource; 108 OwnPtr<RenderImageResource> m_imageResource;
117 bool m_didIncrementVisuallyNonEmptyPixelCount; 109 bool m_didIncrementVisuallyNonEmptyPixelCount;
118 bool m_isGeneratedContent; 110 bool m_isGeneratedContent;
119 float m_imageDevicePixelRatio; 111 float m_imageDevicePixelRatio;
120 112
121 friend class RenderImageScaleObserver; 113 friend class RenderImageScaleObserver;
122 }; 114 };
123 115
124 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); 116 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage());
125 117
126 } // namespace blink 118 } // namespace blink
127 119
128 #endif // RenderImage_h 120 #endif // RenderImage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698