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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleImage.h

Issue 2941533002: Break StyleImage dependency on LayoutObject (Closed)
Patch Set: Address reviewer comments Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 15 matching lines...) Expand all
26 26
27 #include "core/CoreExport.h" 27 #include "core/CoreExport.h"
28 #include "platform/graphics/Image.h" 28 #include "platform/graphics/Image.h"
29 #include "platform/wtf/Forward.h" 29 #include "platform/wtf/Forward.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 class CSSValue; 33 class CSSValue;
34 class ImageResourceContent; 34 class ImageResourceContent;
35 class IntSize; 35 class IntSize;
36 class LayoutObject;
37 class LayoutSize; 36 class LayoutSize;
38 class SVGImage; 37 class SVGImage;
39 class Document; 38 class Document;
40 class ComputedStyle; 39 class ComputedStyle;
40 class ImageResourceObserver;
41 41
42 typedef void* WrappedImagePtr; 42 typedef void* WrappedImagePtr;
43 43
44 class CORE_EXPORT StyleImage : public GarbageCollectedFinalized<StyleImage> { 44 class CORE_EXPORT StyleImage : public GarbageCollectedFinalized<StyleImage> {
45 public: 45 public:
46 virtual ~StyleImage() {} 46 virtual ~StyleImage() {}
47 47
48 bool operator==(const StyleImage& other) const { 48 bool operator==(const StyleImage& other) const {
49 return Data() == other.Data(); 49 return Data() == other.Data();
50 } 50 }
51 51
52 virtual CSSValue* CssValue() const = 0; 52 virtual CSSValue* CssValue() const = 0;
53 virtual CSSValue* ComputedCSSValue() const = 0; 53 virtual CSSValue* ComputedCSSValue() const = 0;
54 54
55 virtual bool CanRender() const { return true; } 55 virtual bool CanRender() const { return true; }
56 virtual bool IsLoaded() const { return true; } 56 virtual bool IsLoaded() const { return true; }
57 virtual bool ErrorOccurred() const { return false; } 57 virtual bool ErrorOccurred() const { return false; }
58 // Note that the defaultObjectSize is assumed to be in the 58 // Note that the defaultObjectSize is assumed to be in the
59 // effective zoom level given by multiplier, i.e. if multiplier is 59 // effective zoom level given by multiplier, i.e. if multiplier is
60 // the constant 1 the defaultObjectSize should be unzoomed. 60 // the constant 1 the defaultObjectSize should be unzoomed.
61 virtual LayoutSize ImageSize(const Document&, 61 virtual LayoutSize ImageSize(const Document&,
62 float multiplier, 62 float multiplier,
63 const LayoutSize& default_object_size) const = 0; 63 const LayoutSize& default_object_size) const = 0;
64 virtual bool ImageHasRelativeSize() const = 0; 64 virtual bool ImageHasRelativeSize() const = 0;
65 virtual bool UsesImageContainerSize() const = 0; 65 virtual bool UsesImageContainerSize() const = 0;
66 virtual void AddClient(LayoutObject*) = 0; 66 virtual void AddClient(ImageResourceObserver*) = 0;
67 virtual void RemoveClient(LayoutObject*) = 0; 67 virtual void RemoveClient(ImageResourceObserver*) = 0;
68 // Note that the container_size is in the effective zoom level of 68 // Note that the container_size is in the effective zoom level of
69 // the style that applies to the given LayoutObject, i.e if the zoom 69 // the style that applies to the given ImageResourceObserver, i.e if the zoom
70 // level is 1.0 the container_size should be unzoomed. 70 // level is 1.0 the container_size should be unzoomed.
71 virtual PassRefPtr<Image> GetImage(const LayoutObject&, 71 virtual PassRefPtr<Image> GetImage(const ImageResourceObserver&,
72 const Document&,
73 const ComputedStyle&,
72 const IntSize& container_size) const = 0; 74 const IntSize& container_size) const = 0;
73 virtual WrappedImagePtr Data() const = 0; 75 virtual WrappedImagePtr Data() const = 0;
74 virtual float ImageScaleFactor() const { return 1; } 76 virtual float ImageScaleFactor() const { return 1; }
75 virtual bool KnownToBeOpaque(const Document&, const ComputedStyle&) const = 0; 77 virtual bool KnownToBeOpaque(const Document&, const ComputedStyle&) const = 0;
76 virtual ImageResourceContent* CachedImage() const { return 0; } 78 virtual ImageResourceContent* CachedImage() const { return 0; }
77 79
78 ALWAYS_INLINE bool IsImageResource() const { return is_image_resource_; } 80 ALWAYS_INLINE bool IsImageResource() const { return is_image_resource_; }
79 ALWAYS_INLINE bool IsPendingImage() const { return is_pending_image_; } 81 ALWAYS_INLINE bool IsPendingImage() const { return is_pending_image_; }
80 ALWAYS_INLINE bool IsGeneratedImage() const { return is_generated_image_; } 82 ALWAYS_INLINE bool IsGeneratedImage() const { return is_generated_image_; }
81 ALWAYS_INLINE bool IsImageResourceSet() const { 83 ALWAYS_INLINE bool IsImageResourceSet() const {
(...skipping 28 matching lines...) Expand all
110 #define DEFINE_STYLE_IMAGE_TYPE_CASTS(thisType, function) \ 112 #define DEFINE_STYLE_IMAGE_TYPE_CASTS(thisType, function) \
111 DEFINE_TYPE_CASTS(thisType, StyleImage, styleImage, styleImage->function, \ 113 DEFINE_TYPE_CASTS(thisType, StyleImage, styleImage, styleImage->function, \
112 styleImage.function); \ 114 styleImage.function); \
113 inline thisType* To##thisType(const Member<StyleImage>& styleImage) { \ 115 inline thisType* To##thisType(const Member<StyleImage>& styleImage) { \
114 return To##thisType(styleImage.Get()); \ 116 return To##thisType(styleImage.Get()); \
115 } \ 117 } \
116 typedef int NeedsSemiColonAfterDefineStyleImageTypeCasts 118 typedef int NeedsSemiColonAfterDefineStyleImageTypeCasts
117 119
118 } // namespace blink 120 } // namespace blink
119 #endif 121 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp ('k') | third_party/WebKit/Source/core/style/StyleInvalidImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698