Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
| diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
| index 46aaa667af615c7f7d8d56196f31ec09d3e7f754..bd9ea8671395811c6cbfdd961bbff9123251d23f 100644 |
| --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
| +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
| @@ -198,9 +198,34 @@ void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolverState& stat |
| CSSValue* item = list->item(i); |
| if (item->isCursorImageValue()) { |
| CSSCursorImageValue* image = toCSSCursorImageValue(item); |
| - if (image->updateIfSVGCursorIsUsed(state.element())) // Elements with SVG cursors are not allowed to share style. |
| + IntPoint hotSpot = image->hotSpot(); |
| + bool hotSpotSpecified = image->hotSpotSpecified(); |
| + |
| + Element* element = state.element(); |
| + if (SVGCursorElement* cursorElement = image->getSVGCursorElement(element)) { |
| + // Set the hot spot if it wasn't specified in the CSS but is specified in the SVG. |
| + if (!hotSpotSpecified) { |
| + hotSpotSpecified = true; |
| + SVGLengthContext lengthContext(0); |
| + // x() and y() return 0 if they're not specified in cursorElement. |
| + float svgX = roundf(cursorElement->x()->currentValue()->value(lengthContext)); |
| + hotSpot.setX(static_cast<int>(svgX)); |
| + float svgY = roundf(cursorElement->y()->currentValue()->value(lengthContext)); |
| + hotSpot.setY(static_cast<int>(svgY)); |
| + } |
| + |
| + if (image->cachedImageURL() != element->document().completeURL(cursorElement->href()->currentValue()->value())) |
|
Timothy Loh
2016/05/31 05:04:35
I think you missed when I commented earlier, this
sashab
2016/05/31 05:24:12
Oh yup cool, done
|
| + image->clearCachedImage(); |
| + |
| + SVGElement* svgElement = toSVGElement(element); |
| + svgElement->setCursorImageValue(image); |
| + cursorElement->addClient(svgElement); |
| + |
| + // Elements with SVG cursors are not allowed to share style. |
| state.style()->setUnique(); |
| - state.style()->addCursor(state.styleImage(CSSPropertyCursor, *image), image->hotSpotSpecified(), image->hotSpot()); |
| + } |
| + |
| + state.style()->addCursor(state.styleImage(CSSPropertyCursor, *image), hotSpotSpecified, hotSpot); |
| } else { |
| state.style()->setCursor(toCSSPrimitiveValue(item)->convertTo<ECursor>()); |
| } |