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

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

Issue 19097005: Remove one SVG animated type special case from the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix the regressions Created 7 years, 5 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
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return false; 95 return false;
96 96
97 if (!isSVGCursor()) 97 if (!isSVGCursor())
98 return false; 98 return false;
99 99
100 String url = toCSSImageValue(m_imageValue.get())->url(); 100 String url = toCSSImageValue(m_imageValue.get())->url();
101 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) { 101 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) {
102 // FIXME: This will override hot spot specified in CSS, which is probabl y incorrect. 102 // FIXME: This will override hot spot specified in CSS, which is probabl y incorrect.
103 SVGLengthContext lengthContext(0); 103 SVGLengthContext lengthContext(0);
104 m_hasHotSpot = true; 104 m_hasHotSpot = true;
105 float x = roundf(cursorElement->x().value(lengthContext)); 105 float x = roundf(cursorElement->xCurrentValue().value(lengthContext));
106 m_hotSpot.setX(static_cast<int>(x)); 106 m_hotSpot.setX(static_cast<int>(x));
107 107
108 float y = roundf(cursorElement->y().value(lengthContext)); 108 float y = roundf(cursorElement->yCurrentValue().value(lengthContext));
109 m_hotSpot.setY(static_cast<int>(y)); 109 m_hotSpot.setY(static_cast<int>(y));
110 110
111 if (cachedImageURL() != element->document()->completeURL(cursorElement-> href())) 111 if (cachedImageURL() != element->document()->completeURL(cursorElement-> hrefCurrentValue()))
112 clearCachedImage(); 112 clearCachedImage();
113 113
114 SVGElement* svgElement = toSVGElement(element); 114 SVGElement* svgElement = toSVGElement(element);
115 m_referencedElements.add(svgElement); 115 m_referencedElements.add(svgElement);
116 svgElement->setCursorImageValue(this); 116 svgElement->setCursorImageValue(this);
117 cursorElement->addClient(svgElement); 117 cursorElement->addClient(svgElement);
118 return true; 118 return true;
119 } 119 }
120 120
121 return false; 121 return false;
122 } 122 }
123 123
124 StyleImage* CSSCursorImageValue::cachedImage(CachedResourceLoader* loader, float deviceScaleFactor) 124 StyleImage* CSSCursorImageValue::cachedImage(CachedResourceLoader* loader, float deviceScaleFactor)
125 { 125 {
126 if (m_imageValue->isImageSetValue()) 126 if (m_imageValue->isImageSetValue())
127 return static_cast<CSSImageSetValue*>(m_imageValue.get())->cachedImageSe t(loader, deviceScaleFactor); 127 return static_cast<CSSImageSetValue*>(m_imageValue.get())->cachedImageSe t(loader, deviceScaleFactor);
128 128
129 if (!m_accessedImage) { 129 if (!m_accessedImage) {
130 m_accessedImage = true; 130 m_accessedImage = true;
131 131
132 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt 132 // For SVG images we need to lazily substitute in the correct URL. Rathe r than attempt
133 // to change the URL of the CSSImageValue (which would then change behav ior like cssText), 133 // to change the URL of the CSSImageValue (which would then change behav ior like cssText),
134 // we create an alternate CSSImageValue to use. 134 // we create an alternate CSSImageValue to use.
135 if (isSVGCursor() && loader && loader->document()) { 135 if (isSVGCursor() && loader && loader->document()) {
136 RefPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get( )); 136 RefPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get( ));
137 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827) 137 // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
138 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), loader->document())) { 138 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElem ent(imageValue->url(), loader->document())) {
139 RefPtr<CSSImageValue> svgImageValue = CSSImageValue::create(curs orElement->href()); 139 RefPtr<CSSImageValue> svgImageValue = CSSImageValue::create(curs orElement->hrefCurrentValue());
140 StyleCachedImage* cachedImage = svgImageValue->cachedImage(loade r); 140 StyleCachedImage* cachedImage = svgImageValue->cachedImage(loade r);
141 m_image = cachedImage; 141 m_image = cachedImage;
142 return cachedImage; 142 return cachedImage;
143 } 143 }
144 } 144 }
145 145
146 if (m_imageValue->isImageValue()) 146 if (m_imageValue->isImageValue())
147 m_image = toCSSImageValue(m_imageValue.get())->cachedImage(loader); 147 m_image = toCSSImageValue(m_imageValue.get())->cachedImage(loader);
148 } 148 }
149 149
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 void CSSCursorImageValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryOb jectInfo) const 202 void CSSCursorImageValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryOb jectInfo) const
203 { 203 {
204 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); 204 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
205 m_imageValue->reportMemoryUsage(memoryObjectInfo); 205 m_imageValue->reportMemoryUsage(memoryObjectInfo);
206 // FIXME: report m_image. It has never been allocated from any of our render ing custom heaps. 206 // FIXME: report m_image. It has never been allocated from any of our render ing custom heaps.
207 info.addMember(m_referencedElements, "referencedElements"); 207 info.addMember(m_referencedElements, "referencedElements");
208 } 208 }
209 209
210 } // namespace WebCore 210 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698