bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element) { #if !ENABLE(SVG) UNUSED_PARAM(element); #else if (!element || !element->isSVGElement()) return false; if (!isSVGCursor()) return false; String url = static_cast<CSSImageValue*>(m_imageValue.get())->url(); if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) { // FIXME: This will override hot spot specified in CSS, which is probably incorrect. SVGLengthContext lengthContext(0); m_hasHotSpot = true; float x = roundf(cursorElement->x().value(lengthContext)); m_hotSpot.setX(static_cast<int>(x)); float y = roundf(cursorElement->y().value(lengthContext)); m_hotSpot.setY(static_cast<int>(y)); if (cachedImageURL() != element->document()->completeURL(cursorElement->href())) clearCachedImage(); SVGElement* svgElement = toSVGElement(element); m_referencedElements.add(svgElement); svgElement->setCursorImageValue(this); cursorElement->addClient(svgElement); return true; } #endif return false; }
bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element) { #if !ENABLE(SVG) UNUSED_PARAM(element); #else if (!element || !element->isSVGElement()) return false; const String& url = getStringValue(); if (!isSVGCursorIdentifier(url)) return false; if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) { float x = roundf(cursorElement->x().value(0)); m_hotspot.setX(static_cast<int>(x)); float y = roundf(cursorElement->y().value(0)); m_hotspot.setY(static_cast<int>(y)); if (cachedImageURL() != element->document()->completeURL(cursorElement->href())) clearCachedImage(); SVGElement* svgElement = static_cast<SVGElement*>(element); m_referencedElements.add(svgElement); svgElement->setCursorImageValue(this); cursorElement->addClient(svgElement); return true; } #endif return false; }
bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element) { if (!element || !element->isSVGElement()) return false; if (!isSVGCursor()) return false; if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(downcast<CSSImageValue>(m_imageValue.get()).url(), element->document())) { // FIXME: This will override hot spot specified in CSS, which is probably incorrect. SVGLengthContext lengthContext(0); m_hasHotSpot = true; float x = roundf(cursorElement->x().value(lengthContext)); m_hotSpot.setX(static_cast<int>(x)); float y = roundf(cursorElement->y().value(lengthContext)); m_hotSpot.setY(static_cast<int>(y)); if (cachedImageURL() != element->document().completeURL(cursorElement->href())) clearCachedImage(); SVGElement& svgElement = downcast<SVGElement>(*element); m_referencedElements.add(&svgElement); svgElement.setCursorImageValue(this); cursorElement->addClient(&svgElement); return true; } return false; }