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..43a85f45526c43efcb4b6e43a7e29fb1e8f35f6a 100644 |
| --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
| +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
| @@ -198,9 +198,32 @@ 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)) { |
| + // Override the hot spot if it wasn't specified in the CSS but is specified in the SVG. |
|
Timothy Loh
2016/05/30 01:38:34
It's not really overriding anything
sashab
2016/05/31 04:22:37
Changed to 'set'
|
| + SVGLengthContext lengthContext(0); |
| + if (!hotSpotSpecified && cursorElement->x()) { |
| + float x = roundf(cursorElement->x()->currentValue()->value(lengthContext)); |
| + hotSpot.setX(static_cast<int>(x)); |
| + } |
| + if (!hotSpotSpecified && cursorElement->y()) { |
| + float y = roundf(cursorElement->y()->currentValue()->value(lengthContext)); |
| + hotSpot.setY(static_cast<int>(y)); |
| + } |
| + |
|
Timothy Loh
2016/05/30 01:38:34
don't we need to set hotSpotSpecified to true some
sashab
2016/05/31 04:22:37
Hhhhmmm maybe that's why my tests weren't working.
|
| + image->clearCachedImageIfNotURL(element->document().completeURL(cursorElement->href()->currentValue()->value())); |
|
Timothy Loh
2016/05/30 01:38:34
probably clearer if this moved to the top of this
sashab
2016/05/31 04:22:37
Yup agreed done
|
| + |
| + 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>()); |
| } |