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

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

Powered by Google App Engine
This is Rietveld 408576698