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

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

Issue 148173018: [SVG] SVGAnimatedString{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove debug print Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.cpp » ('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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) { 99 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) {
100 // FIXME: This will override hot spot specified in CSS, which is probabl y incorrect. 100 // FIXME: This will override hot spot specified in CSS, which is probabl y incorrect.
101 SVGLengthContext lengthContext(0); 101 SVGLengthContext lengthContext(0);
102 m_hasHotSpot = true; 102 m_hasHotSpot = true;
103 float x = roundf(cursorElement->x()->currentValue()->value(lengthContext )); 103 float x = roundf(cursorElement->x()->currentValue()->value(lengthContext ));
104 m_hotSpot.setX(static_cast<int>(x)); 104 m_hotSpot.setX(static_cast<int>(x));
105 105
106 float y = roundf(cursorElement->y()->currentValue()->value(lengthContext )); 106 float y = roundf(cursorElement->y()->currentValue()->value(lengthContext ));
107 m_hotSpot.setY(static_cast<int>(y)); 107 m_hotSpot.setY(static_cast<int>(y));
108 108
109 if (cachedImageURL() != element->document().completeURL(cursorElement->h refCurrentValue())) 109 if (cachedImageURL() != element->document().completeURL(cursorElement->h ref()->currentValue()->value()))
110 clearImageResource(); 110 clearImageResource();
111 111
112 SVGElement* svgElement = toSVGElement(element); 112 SVGElement* svgElement = toSVGElement(element);
113 m_referencedElements.add(svgElement); 113 m_referencedElements.add(svgElement);
114 svgElement->setCursorImageValue(this); 114 svgElement->setCursorImageValue(this);
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 toCSSImageSetValue(m_imageValue.get())->cachedImageSet(loader, de viceScaleFactor); 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)
136 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), *loader->document())) { 136 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), *loader->document())) {
137 RefPtr<CSSImageValue> svgImageValue = CSSImageValue::create(load er->document()->completeURL(cursorElement->hrefCurrentValue())); 137 RefPtr<CSSImageValue> svgImageValue = CSSImageValue::create(load er->document()->completeURL(cursorElement->href()->currentValue()->value()));
138 StyleFetchedImage* cachedImage = svgImageValue->cachedImage(load er); 138 StyleFetchedImage* cachedImage = svgImageValue->cachedImage(load er);
139 m_image = cachedImage; 139 m_image = cachedImage;
140 return cachedImage; 140 return cachedImage;
141 } 141 }
142 } 142 }
143 143
144 if (m_imageValue->isImageValue()) 144 if (m_imageValue->isImageValue())
145 m_image = toCSSImageValue(m_imageValue.get())->cachedImage(loader); 145 m_image = toCSSImageValue(m_imageValue.get())->cachedImage(loader);
146 } 146 }
147 147
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 m_referencedElements.remove(element); 190 m_referencedElements.remove(element);
191 } 191 }
192 192
193 bool CSSCursorImageValue::equals(const CSSCursorImageValue& other) const 193 bool CSSCursorImageValue::equals(const CSSCursorImageValue& other) const
194 { 194 {
195 return m_hasHotSpot ? other.m_hasHotSpot && m_hotSpot == other.m_hotSpot : ! other.m_hasHotSpot 195 return m_hasHotSpot ? other.m_hasHotSpot && m_hotSpot == other.m_hotSpot : ! other.m_hasHotSpot
196 && compareCSSValuePtr(m_imageValue, other.m_imageValue); 196 && compareCSSValuePtr(m_imageValue, other.m_imageValue);
197 } 197 }
198 198
199 } // namespace WebCore 199 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698