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

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

Issue 1858753003: Remove RawPtr from core/css (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 24 matching lines...) Expand all
35 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 static inline SVGCursorElement* resourceReferencedByCursorElement(const String& url, TreeScope& treeScope) 39 static inline SVGCursorElement* resourceReferencedByCursorElement(const String& url, TreeScope& treeScope)
40 { 40 {
41 Element* element = SVGURIReference::targetElementFromIRIString(url, treeScop e); 41 Element* element = SVGURIReference::targetElementFromIRIString(url, treeScop e);
42 return isSVGCursorElement(element) ? toSVGCursorElement(element) : nullptr; 42 return isSVGCursorElement(element) ? toSVGCursorElement(element) : nullptr;
43 } 43 }
44 44
45 CSSCursorImageValue::CSSCursorImageValue(RawPtr<CSSValue> imageValue, bool hotSp otSpecified, const IntPoint& hotSpot) 45 CSSCursorImageValue::CSSCursorImageValue(CSSValue* imageValue, bool hotSpotSpeci fied, const IntPoint& hotSpot)
46 : CSSValue(CursorImageClass) 46 : CSSValue(CursorImageClass)
47 , m_imageValue(imageValue) 47 , m_imageValue(imageValue)
48 , m_hotSpotSpecified(hotSpotSpecified) 48 , m_hotSpotSpecified(hotSpotSpecified)
49 , m_hotSpot(hotSpot) 49 , m_hotSpot(hotSpot)
50 , m_isCachePending(true) 50 , m_isCachePending(true)
51 { 51 {
52 } 52 }
53 53
54 CSSCursorImageValue::~CSSCursorImageValue() 54 CSSCursorImageValue::~CSSCursorImageValue()
55 { 55 {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (m_imageValue->isImageSetValue()) 137 if (m_imageValue->isImageSetValue())
138 return toCSSImageSetValue(*m_imageValue).cacheImage(document, deviceScal eFactor); 138 return toCSSImageSetValue(*m_imageValue).cacheImage(document, deviceScal eFactor);
139 139
140 if (m_isCachePending) { 140 if (m_isCachePending) {
141 m_isCachePending = false; 141 m_isCachePending = false;
142 142
143 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt 143 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt
144 // to change the URL of the CSSImageValue (which would then change behav ior like cssText), 144 // to change the URL of the CSSImageValue (which would then change behav ior like cssText),
145 // we create an alternate CSSImageValue to use. 145 // we create an alternate CSSImageValue to use.
146 if (isSVGCursor() && document) { 146 if (isSVGCursor() && document) {
147 RawPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get( )); 147 CSSImageValue* imageValue = toCSSImageValue(m_imageValue.get());
148 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827) 148 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
149 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), *document)) { 149 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), *document)) {
150 RawPtr<CSSImageValue> svgImageValue = CSSImageValue::create(docu ment->completeURL(cursorElement->href()->currentValue()->value())); 150 CSSImageValue* svgImageValue = CSSImageValue::create(document->c ompleteURL(cursorElement->href()->currentValue()->value()));
151 svgImageValue->setReferrer(imageValue->referrer()); 151 svgImageValue->setReferrer(imageValue->referrer());
152 m_cachedImage = svgImageValue->cacheImage(document); 152 m_cachedImage = svgImageValue->cacheImage(document);
153 return m_cachedImage.get(); 153 return m_cachedImage.get();
154 } 154 }
155 } 155 }
156 156
157 if (m_imageValue->isImageValue()) 157 if (m_imageValue->isImageValue())
158 m_cachedImage = toCSSImageValue(*m_imageValue).cacheImage(document); 158 m_cachedImage = toCSSImageValue(*m_imageValue).cacheImage(document);
159 } 159 }
160 160
161 if (m_cachedImage && m_cachedImage->isImageResource()) 161 if (m_cachedImage && m_cachedImage->isImageResource())
162 return toStyleFetchedImage(m_cachedImage); 162 return toStyleFetchedImage(m_cachedImage);
163 return nullptr; 163 return nullptr;
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()) {
169 RawPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get()); 169 CSSImageValue* imageValue = toCSSImageValue(m_imageValue.get());
170 KURL kurl(ParsedURLString, imageValue->url()); 170 KURL kurl(ParsedURLString, imageValue->url());
171 return kurl.hasFragmentIdentifier(); 171 return kurl.hasFragmentIdentifier();
172 } 172 }
173 return false; 173 return false;
174 } 174 }
175 175
176 String CSSCursorImageValue::cachedImageURL() 176 String CSSCursorImageValue::cachedImageURL()
177 { 177 {
178 if (!m_cachedImage || !m_cachedImage->isImageResource()) 178 if (!m_cachedImage || !m_cachedImage->isImageResource())
179 return String(); 179 return String();
(...skipping 20 matching lines...) Expand all
200 } 200 }
201 201
202 DEFINE_TRACE_AFTER_DISPATCH(CSSCursorImageValue) 202 DEFINE_TRACE_AFTER_DISPATCH(CSSCursorImageValue)
203 { 203 {
204 visitor->trace(m_imageValue); 204 visitor->trace(m_imageValue);
205 visitor->trace(m_cachedImage); 205 visitor->trace(m_cachedImage);
206 CSSValue::traceAfterDispatch(visitor); 206 CSSValue::traceAfterDispatch(visitor);
207 } 207 }
208 208
209 } // namespace blink 209 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCursorImageValue.h ('k') | third_party/WebKit/Source/core/css/CSSCustomIdentValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698