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

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

Issue 2352193004: Document* -> Document& for loadSubimages and friends. (Closed)
Patch Set: Added constness Created 4 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
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 18 matching lines...) Expand all
29 #include "core/style/StyleImage.h" 29 #include "core/style/StyleImage.h"
30 #include "core/svg/SVGCursorElement.h" 30 #include "core/svg/SVGCursorElement.h"
31 #include "core/svg/SVGLengthContext.h" 31 #include "core/svg/SVGLengthContext.h"
32 #include "core/svg/SVGURIReference.h" 32 #include "core/svg/SVGURIReference.h"
33 #include "wtf/MathExtras.h" 33 #include "wtf/MathExtras.h"
34 #include "wtf/text/StringBuilder.h" 34 #include "wtf/text/StringBuilder.h"
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, const 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(CSSValue* imageValue, bool hotSpotSpeci fied, 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)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 StyleImage* CSSCursorImageValue::cachedImage(float deviceScaleFactor) const 91 StyleImage* CSSCursorImageValue::cachedImage(float deviceScaleFactor) const
92 { 92 {
93 ASSERT(!isCachePending(deviceScaleFactor)); 93 ASSERT(!isCachePending(deviceScaleFactor));
94 94
95 if (m_imageValue->isImageSetValue()) 95 if (m_imageValue->isImageSetValue())
96 return toCSSImageSetValue(*m_imageValue).cachedImage(deviceScaleFactor); 96 return toCSSImageSetValue(*m_imageValue).cachedImage(deviceScaleFactor);
97 return m_cachedImage.get(); 97 return m_cachedImage.get();
98 } 98 }
99 99
100 StyleImage* CSSCursorImageValue::cacheImage(Document* document, float deviceScal eFactor) 100 StyleImage* CSSCursorImageValue::cacheImage(const Document& document, float devi ceScaleFactor)
101 { 101 {
102 if (m_imageValue->isImageSetValue()) 102 if (m_imageValue->isImageSetValue())
103 return toCSSImageSetValue(*m_imageValue).cacheImage(document, deviceScal eFactor); 103 return toCSSImageSetValue(*m_imageValue).cacheImage(document, deviceScal eFactor);
104 104
105 if (m_isCachePending) { 105 if (m_isCachePending) {
106 m_isCachePending = false; 106 m_isCachePending = false;
107 107
108 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt 108 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt
109 // to change the URL of the CSSImageValue (which would then change behav ior like cssText), 109 // to change the URL of the CSSImageValue (which would then change behav ior like cssText),
110 // we create an alternate CSSImageValue to use. 110 // we create an alternate CSSImageValue to use.
111 if (hasFragmentInURL() && document) { 111 if (hasFragmentInURL()) {
112 CSSImageValue* imageValue = toCSSImageValue(m_imageValue.get()); 112 CSSImageValue* imageValue = toCSSImageValue(m_imageValue.get());
113 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827) 113 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
114 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), *document)) { 114 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), document)) {
115 CSSImageValue* svgImageValue = CSSImageValue::create(document->c ompleteURL(cursorElement->href()->currentValue()->value())); 115 CSSImageValue* svgImageValue = CSSImageValue::create(document.co mpleteURL(cursorElement->href()->currentValue()->value()));
116 svgImageValue->setReferrer(imageValue->referrer()); 116 svgImageValue->setReferrer(imageValue->referrer());
117 m_cachedImage = svgImageValue->cacheImage(document); 117 m_cachedImage = svgImageValue->cacheImage(document);
118 return m_cachedImage.get(); 118 return m_cachedImage.get();
119 } 119 }
120 } 120 }
121 121
122 if (m_imageValue->isImageValue()) 122 if (m_imageValue->isImageValue())
123 m_cachedImage = toCSSImageValue(*m_imageValue).cacheImage(document); 123 m_cachedImage = toCSSImageValue(*m_imageValue).cacheImage(document);
124 } 124 }
125 125
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 DEFINE_TRACE_AFTER_DISPATCH(CSSCursorImageValue) 160 DEFINE_TRACE_AFTER_DISPATCH(CSSCursorImageValue)
161 { 161 {
162 visitor->trace(m_imageValue); 162 visitor->trace(m_imageValue);
163 visitor->trace(m_cachedImage); 163 visitor->trace(m_cachedImage);
164 CSSValue::traceAfterDispatch(visitor); 164 CSSValue::traceAfterDispatch(visitor);
165 } 165 }
166 166
167 } // namespace blink 167 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCursorImageValue.h ('k') | third_party/WebKit/Source/core/css/CSSGradientValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698