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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 2522443002: Remove SVGCursorElement (Closed)
Patch Set: Rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
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 27531b2241bd92d50d083dbd6658f7dc303663ef..a456f834ac1005f64aea9195b077c2d5dc7762ec 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -213,51 +213,16 @@ void StyleBuilderFunctions::applyValueCSSPropertyCursor(
const CSSValue& value) {
state.style()->clearCursorList();
if (value.isValueList()) {
- const CSSValueList& list = toCSSValueList(value);
- int len = list.length();
state.style()->setCursor(ECursor::Auto);
- for (int i = 0; i < len; i++) {
- const CSSValue& item = list.item(i);
- if (item.isCursorImageValue()) {
- const CSSCursorImageValue& image = toCSSCursorImageValue(item);
- IntPoint hotSpot = image.hotSpot();
- bool hotSpotSpecified = image.hotSpotSpecified();
-
- Element* element = state.element();
- if (SVGCursorElement* cursorElement =
- image.getSVGCursorElement(element)) {
- if (image.cachedImageURL() !=
- element->document().completeURL(
- cursorElement->href()->currentValue()->value()))
- image.clearImageResource();
-
- // 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));
- }
-
- SVGElement* svgElement = toSVGElement(element);
- svgElement->setCursorImageValue(&image);
- cursorElement->addClient(svgElement);
-
- // Elements with SVG cursors are not allowed to share style.
- state.style()->setUnique();
- }
-
+ for (const auto& item : toCSSValueList(value)) {
+ if (item->isCursorImageValue()) {
+ const CSSCursorImageValue& cursor = toCSSCursorImageValue(*item);
+ const CSSValue& image = cursor.imageValue();
state.style()->addCursor(state.styleImage(CSSPropertyCursor, image),
- hotSpotSpecified, hotSpot);
+ cursor.hotSpotSpecified(), cursor.hotSpot());
} else {
state.style()->setCursor(
- toCSSIdentifierValue(item).convertTo<ECursor>());
+ toCSSIdentifierValue(*item).convertTo<ECursor>());
}
}
} else {

Powered by Google App Engine
This is Rietveld 408576698