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

Side by Side Diff: Source/core/css/CSSCursorImageValue.cpp

Issue 24020008: Introduce CSS_VALUE_TYPE_CASTS macro to cast CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | Source/core/css/CSSImageSetValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Rob Buis <buis@kde.org> 2 * Copyright (C) 2006 Rob Buis <buis@kde.org>
3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 cursorElement->addClient(svgElement); 115 cursorElement->addClient(svgElement);
116 return true; 116 return true;
117 } 117 }
118 118
119 return false; 119 return false;
120 } 120 }
121 121
122 StyleImage* CSSCursorImageValue::cachedImage(ResourceFetcher* loader, float devi ceScaleFactor) 122 StyleImage* CSSCursorImageValue::cachedImage(ResourceFetcher* loader, float devi ceScaleFactor)
123 { 123 {
124 if (m_imageValue->isImageSetValue()) 124 if (m_imageValue->isImageSetValue())
125 return static_cast<CSSImageSetValue*>(m_imageValue.get())->cachedImageSe t(loader, deviceScaleFactor); 125 return toCSSImageSetValue(m_imageValue.get())->cachedImageSet(loader, de viceScaleFactor);
126 126
127 if (!m_accessedImage) { 127 if (!m_accessedImage) {
128 m_accessedImage = true; 128 m_accessedImage = true;
129 129
130 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt 130 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt
131 // to change the URL of the CSSImageValue (which would then change behav ior like cssText), 131 // to change the URL of the CSSImageValue (which would then change behav ior like cssText),
132 // we create an alternate CSSImageValue to use. 132 // we create an alternate CSSImageValue to use.
133 if (isSVGCursor() && loader && loader->document()) { 133 if (isSVGCursor() && loader && loader->document()) {
134 RefPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get( )); 134 RefPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get( ));
135 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827) 135 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
(...skipping 12 matching lines...) Expand all
148 if (m_image && m_image->isImageResource()) 148 if (m_image && m_image->isImageResource())
149 return static_cast<StyleFetchedImage*>(m_image.get()); 149 return static_cast<StyleFetchedImage*>(m_image.get());
150 150
151 return 0; 151 return 0;
152 } 152 }
153 153
154 StyleImage* CSSCursorImageValue::cachedOrPendingImage(float deviceScaleFactor) 154 StyleImage* CSSCursorImageValue::cachedOrPendingImage(float deviceScaleFactor)
155 { 155 {
156 // Need to delegate completely so that changes in device scale factor can be handled appropriately. 156 // Need to delegate completely so that changes in device scale factor can be handled appropriately.
157 if (m_imageValue->isImageSetValue()) 157 if (m_imageValue->isImageSetValue())
158 return static_cast<CSSImageSetValue*>(m_imageValue.get())->cachedOrPendi ngImageSet(deviceScaleFactor); 158 return toCSSImageSetValue(m_imageValue.get())->cachedOrPendingImageSet(d eviceScaleFactor);
159 159
160 if (!m_image) 160 if (!m_image)
161 m_image = StylePendingImage::create(this); 161 m_image = StylePendingImage::create(this);
162 162
163 return m_image.get(); 163 return m_image.get();
164 } 164 }
165 165
166 bool CSSCursorImageValue::isSVGCursor() const 166 bool CSSCursorImageValue::isSVGCursor() const
167 { 167 {
168 if (m_imageValue->isImageValue()) { 168 if (m_imageValue->isImageValue()) {
(...skipping 22 matching lines...) Expand all
191 m_referencedElements.remove(element); 191 m_referencedElements.remove(element);
192 } 192 }
193 193
194 bool CSSCursorImageValue::equals(const CSSCursorImageValue& other) const 194 bool CSSCursorImageValue::equals(const CSSCursorImageValue& other) const
195 { 195 {
196 return m_hasHotSpot ? other.m_hasHotSpot && m_hotSpot == other.m_hotSpot : ! other.m_hasHotSpot 196 return m_hasHotSpot ? other.m_hasHotSpot && m_hotSpot == other.m_hotSpot : ! other.m_hasHotSpot
197 && compareCSSValuePtr(m_imageValue, other.m_imageValue); 197 && compareCSSValuePtr(m_imageValue, other.m_imageValue);
198 } 198 }
199 199
200 } // namespace WebCore 200 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSImageSetValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698