| Index: third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp b/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp
|
| index 3021886a087432347d10a903c84c01afa951a41f..bb0c878543887ac046b1a2e3ee0f4af84cfd1242 100644
|
| --- a/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp
|
| +++ b/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp
|
| @@ -68,35 +68,16 @@ String CSSCursorImageValue::customCSSText() const
|
| return result.toString();
|
| }
|
|
|
| -bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element)
|
| +SVGCursorElement* CSSCursorImageValue::getSVGCursorElement(Element* element) const
|
| {
|
| if (!element || !element->isSVGElement())
|
| - return false;
|
| + return nullptr;
|
|
|
| - if (!isSVGCursor())
|
| - return false;
|
| + if (!hasFragmentInURL())
|
| + return nullptr;
|
|
|
| String url = toCSSImageValue(m_imageValue.get())->url();
|
| - if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->treeScope())) {
|
| - // FIXME: This will override hot spot specified in CSS, which is probably incorrect.
|
| - SVGLengthContext lengthContext(0);
|
| - m_hotSpotSpecified = true;
|
| - float x = roundf(cursorElement->x()->currentValue()->value(lengthContext));
|
| - m_hotSpot.setX(static_cast<int>(x));
|
| -
|
| - float y = roundf(cursorElement->y()->currentValue()->value(lengthContext));
|
| - m_hotSpot.setY(static_cast<int>(y));
|
| -
|
| - if (cachedImageURL() != element->document().completeURL(cursorElement->href()->currentValue()->value()))
|
| - clearImageResource();
|
| -
|
| - SVGElement* svgElement = toSVGElement(element);
|
| - svgElement->setCursorImageValue(this);
|
| - cursorElement->addClient(svgElement);
|
| - return true;
|
| - }
|
| -
|
| - return false;
|
| + return resourceReferencedByCursorElement(url, element->treeScope());
|
| }
|
|
|
| bool CSSCursorImageValue::isCachePending(float deviceScaleFactor) const
|
| @@ -127,7 +108,7 @@ StyleImage* CSSCursorImageValue::cacheImage(Document* document, float deviceScal
|
| // For SVG images we need to lazily substitute in the correct URL. Rather than attempt
|
| // to change the URL of the CSSImageValue (which would then change behavior like cssText),
|
| // we create an alternate CSSImageValue to use.
|
| - if (isSVGCursor() && document) {
|
| + if (hasFragmentInURL() && document) {
|
| CSSImageValue* imageValue = toCSSImageValue(m_imageValue.get());
|
| // FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
|
| if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(imageValue->url(), *document)) {
|
| @@ -147,7 +128,7 @@ StyleImage* CSSCursorImageValue::cacheImage(Document* document, float deviceScal
|
| return nullptr;
|
| }
|
|
|
| -bool CSSCursorImageValue::isSVGCursor() const
|
| +bool CSSCursorImageValue::hasFragmentInURL() const
|
| {
|
| if (m_imageValue->isImageValue()) {
|
| CSSImageValue* imageValue = toCSSImageValue(m_imageValue.get());
|
| @@ -157,14 +138,14 @@ bool CSSCursorImageValue::isSVGCursor() const
|
| return false;
|
| }
|
|
|
| -String CSSCursorImageValue::cachedImageURL()
|
| +String CSSCursorImageValue::cachedImageURL() const
|
| {
|
| if (!m_cachedImage || !m_cachedImage->isImageResource())
|
| return String();
|
| return toStyleFetchedImage(m_cachedImage)->cachedImage()->url().getString();
|
| }
|
|
|
| -void CSSCursorImageValue::clearImageResource()
|
| +void CSSCursorImageValue::clearImageResource() const
|
| {
|
| m_cachedImage = nullptr;
|
| m_isCachePending = true;
|
|
|