summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderImage.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderImage.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/RenderImage.h')
-rw-r--r--Source/WebCore/rendering/RenderImage.h90
1 files changed, 53 insertions, 37 deletions
diff --git a/Source/WebCore/rendering/RenderImage.h b/Source/WebCore/rendering/RenderImage.h
index cc9440867..9148da9b9 100644
--- a/Source/WebCore/rendering/RenderImage.h
+++ b/Source/WebCore/rendering/RenderImage.h
@@ -22,8 +22,7 @@
*
*/
-#ifndef RenderImage_h
-#define RenderImage_h
+#pragma once
#include "RenderImageResource.h"
#include "RenderReplaced.h"
@@ -33,27 +32,30 @@ namespace WebCore {
class HTMLAreaElement;
class HTMLMapElement;
+enum ImageSizeChangeType {
+ ImageSizeChangeNone,
+ ImageSizeChangeForAltText
+};
+
class RenderImage : public RenderReplaced {
public:
- RenderImage(Element&, PassRef<RenderStyle>, StyleImage* = nullptr);
- RenderImage(Document&, PassRef<RenderStyle>, StyleImage* = nullptr);
+ RenderImage(Element&, RenderStyle&&, StyleImage* = nullptr, const float = 1.0f);
+ RenderImage(Document&, RenderStyle&&, StyleImage* = nullptr);
virtual ~RenderImage();
RenderImageResource& imageResource() { return *m_imageResource; }
const RenderImageResource& imageResource() const { return *m_imageResource; }
CachedImage* cachedImage() const { return imageResource().cachedImage(); }
- bool setImageSizeForAltText(CachedImage* newImage = 0);
+ ImageSizeChangeType setImageSizeForAltText(CachedImage* newImage = nullptr);
void updateAltText();
HTMLMapElement* imageMap() const;
void areaElementFocusChanged(HTMLAreaElement*);
-
- void highQualityRepaintTimerFired(Timer<RenderImage>*);
#if PLATFORM(IOS)
- virtual void collectSelectionRects(Vector<SelectionRect>&, unsigned, unsigned) override;
+ void collectSelectionRects(Vector<SelectionRect>&, unsigned, unsigned) override;
#endif
void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = generated; }
@@ -62,63 +64,77 @@ public:
const String& altText() const { return m_altText; }
void setAltText(const String& altText) { m_altText = altText; }
-
+
+ inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
+ float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
+
+ void setHasShadowControls(bool hasShadowControls) { m_hasShadowControls = hasShadowControls; }
+
protected:
- virtual bool needsPreferredWidthsRecalculation() const override final;
- virtual RenderBox* embeddedContentBox() const override final;
- virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const override final;
- virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override;
+ void willBeDestroyed() override;
+
+ bool needsPreferredWidthsRecalculation() const final;
+ RenderBox* embeddedContentBox() const final;
+ void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const final;
+ bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override;
- virtual void styleDidChange(StyleDifference, const RenderStyle*) override final;
+ void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
+ void styleDidChange(StyleDifference, const RenderStyle*) override;
- virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
+ void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
- void paintIntoRect(GraphicsContext*, const LayoutRect&);
- virtual void paint(PaintInfo&, const LayoutPoint&) override final;
- virtual void layout() override;
+ void paintIntoRect(GraphicsContext&, const FloatRect&);
+ void paint(PaintInfo&, const LayoutPoint&) final;
+ void layout() override;
- virtual void intrinsicSizeChanged() override
+ void intrinsicSizeChanged() override
{
imageChanged(imageResource().imagePtr());
}
private:
- virtual const char* renderName() const override { return "RenderImage"; }
+ const char* renderName() const override { return "RenderImage"; }
+
+ bool canHaveChildren() const override;
- virtual bool isImage() const override { return true; }
- virtual bool isRenderImage() const override final { return true; }
+ bool isImage() const override { return true; }
+ bool isRenderImage() const final { return true; }
- virtual void paintReplaced(PaintInfo&, const LayoutPoint&) override;
+ void paintReplaced(PaintInfo&, const LayoutPoint&) override;
- virtual bool computeBackgroundIsKnownToBeObscured() override final;
+ bool computeBackgroundIsKnownToBeObscured(const LayoutPoint& paintOffset) final;
- virtual LayoutUnit minimumReplacedHeight() const override;
+ LayoutUnit minimumReplacedHeight() const override;
- virtual void notifyFinished(CachedResource*) override final;
- virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override final;
+ void notifyFinished(CachedResource&) final;
+ bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final;
- virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final;
+ bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance, InlineFlowBox*) const final;
+
+ virtual bool shadowControlsNeedCustomLayoutMetrics() const { return false; }
IntSize imageSizeForError(CachedImage*) const;
- void imageDimensionsChanged(bool imageSizeChanged, const IntRect* = 0);
- bool updateIntrinsicSizeIfNeeded(const LayoutSize&, bool imageSizeChanged);
+ void repaintOrMarkForLayout(ImageSizeChangeType, const IntRect* = nullptr);
+ void updateIntrinsicSizeIfNeeded(const LayoutSize&);
// Update the size of the image to be rendered. Object-fit may cause this to be different from the CSS box's content rect.
void updateInnerContentRect();
- void paintAreaElementFocusRing(PaintInfo&);
+ void paintAreaElementFocusRing(PaintInfo&, const LayoutPoint& paintOffset);
+
+ void layoutShadowControls(const LayoutSize& oldSize);
// Text to display as long as the image isn't available.
String m_altText;
std::unique_ptr<RenderImageResource> m_imageResource;
- bool m_needsToSetSizeForAltText;
- bool m_didIncrementVisuallyNonEmptyPixelCount;
- bool m_isGeneratedContent;
+ bool m_needsToSetSizeForAltText { false };
+ bool m_didIncrementVisuallyNonEmptyPixelCount { false };
+ bool m_isGeneratedContent { false };
+ bool m_hasShadowControls { false };
+ float m_imageDevicePixelRatio { 1 };
friend class RenderImageScaleObserver;
};
-RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage())
-
} // namespace WebCore
-#endif // RenderImage_h
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderImage, isRenderImage())