| OLD | NEW |
| 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. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #ifndef StyleImage_h | 24 #ifndef StyleImage_h |
| 25 #define StyleImage_h | 25 #define StyleImage_h |
| 26 | 26 |
| 27 #include "core/CoreExport.h" | 27 #include "core/CoreExport.h" |
| 28 #include "core/css/CSSValue.h" | 28 #include "core/css/CSSValue.h" |
| 29 #include "core/fetch/ImageResource.h" |
| 29 #include "platform/geometry/IntSize.h" | 30 #include "platform/geometry/IntSize.h" |
| 30 #include "platform/geometry/LayoutSize.h" | 31 #include "platform/geometry/LayoutSize.h" |
| 31 #include "platform/graphics/Image.h" | 32 #include "platform/graphics/Image.h" |
| 32 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
| 33 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
| 34 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 class ImageResource; | |
| 39 class CSSValue; | 39 class CSSValue; |
| 40 class LayoutObject; | 40 class LayoutObject; |
| 41 | 41 |
| 42 typedef void* WrappedImagePtr; | 42 typedef void* WrappedImagePtr; |
| 43 | 43 |
| 44 class CORE_EXPORT StyleImage : public RefCountedWillBeGarbageCollectedFinalized<
StyleImage> { | 44 class CORE_EXPORT StyleImage : public RefCountedWillBeGarbageCollectedFinalized<
StyleImage> { |
| 45 public: | 45 public: |
| 46 virtual ~StyleImage() { } | 46 virtual ~StyleImage() { printf("%p: StyleImage freed\n", this); } |
| 47 | 47 |
| 48 bool operator==(const StyleImage& other) const | 48 bool operator==(const StyleImage& other) const |
| 49 { | 49 { |
| 50 return data() == other.data(); | 50 return data() == other.data(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const = 0; | 53 virtual PassRefPtrWillBeRawPtr<CSSValue> cssValue() const = 0; |
| 54 | 54 |
| 55 virtual bool canRender(const LayoutObject&, float /*multiplier*/) const { re
turn true; } | 55 virtual bool canRender(const LayoutObject&, float /*multiplier*/) const { re
turn true; } |
| 56 virtual bool isLoaded() const { return true; } | 56 virtual bool isLoaded() const { return true; } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 83 , m_isGeneratedImage(false) | 83 , m_isGeneratedImage(false) |
| 84 , m_isImageResourceSet(false) | 84 , m_isImageResourceSet(false) |
| 85 { | 85 { |
| 86 } | 86 } |
| 87 bool m_isImageResource:1; | 87 bool m_isImageResource:1; |
| 88 bool m_isPendingImage:1; | 88 bool m_isPendingImage:1; |
| 89 bool m_isGeneratedImage:1; | 89 bool m_isGeneratedImage:1; |
| 90 bool m_isImageResourceSet:1; | 90 bool m_isImageResourceSet:1; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 class CSSStyleImageMap { |
| 94 public: |
| 95 typedef WillBeHeapHashMap<CSSValue*, RefPtrWillBeRawPtr<StyleImage>> StyleIm
ageMap; |
| 96 typedef WillBeHeapHashMap<CSSValue*, ResourcePtr<ImageResource>> ImageResour
ceMap; |
| 97 typedef WillBeHeapHashMap<CSSValue*, RefPtr<Image>> ImageMap; |
| 98 |
| 99 StyleImageMap::AddResult getStyleImageEntry(CSSValue* value) { return m_styl
eImages.add(value, nullptr); } |
| 100 ImageResourceMap::AddResult getImageResourceEntry(CSSValue* value) { return
m_imageResources.add(value, nullptr); } |
| 101 ImageMap::AddResult getImageEntry(CSSValue* value) { return m_images.add(val
ue, nullptr); } |
| 102 |
| 103 private: |
| 104 StyleImageMap m_styleImages; |
| 105 ImageResourceMap m_imageResources; |
| 106 ImageMap m_images; |
| 107 }; |
| 108 |
| 93 #define DEFINE_STYLE_IMAGE_TYPE_CASTS(thisType, function) \ | 109 #define DEFINE_STYLE_IMAGE_TYPE_CASTS(thisType, function) \ |
| 94 DEFINE_TYPE_CASTS(thisType, StyleImage, styleImage, styleImage->function, st
yleImage.function); \ | 110 DEFINE_TYPE_CASTS(thisType, StyleImage, styleImage, styleImage->function, st
yleImage.function); \ |
| 95 inline thisType* to##thisType(const RefPtrWillBeMember<StyleImage>& styleIma
ge) { return to##thisType(styleImage.get()); } \ | 111 inline thisType* to##thisType(const RefPtrWillBeMember<StyleImage>& styleIma
ge) { return to##thisType(styleImage.get()); } \ |
| 96 typedef int NeedsSemiColonAfterDefineStyleImageTypeCasts | 112 typedef int NeedsSemiColonAfterDefineStyleImageTypeCasts |
| 97 | 113 |
| 98 } | 114 } |
| 99 #endif | 115 #endif |
| OLD | NEW |