RESOLVED FIXED 156659
CSSCursorImageValue shouldn't mutate element during style resolution
https://bugs.webkit.org/show_bug.cgi?id=156659
Summary CSSCursorImageValue shouldn't mutate element during style resolution
Antti Koivisto
Reported 2016-04-16 04:40:32 PDT
CSSCursorImageValue::updateIfSVGCursorIsUsed may mutate the argument element.
Attachments
patch (20.65 KB, patch)
2016-04-16 06:54 PDT, Antti Koivisto
no flags
patch (22.46 KB, patch)
2016-04-16 10:01 PDT, Antti Koivisto
darin: review+
Antti Koivisto
Comment 1 2016-04-16 06:54:15 PDT
Antti Koivisto
Comment 2 2016-04-16 10:01:14 PDT
Darin Adler
Comment 3 2016-04-16 10:15:53 PDT
Comment on attachment 276558 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=276558&action=review I would probably refer to these as "cursor elements" rather than "SVG cursor elements" even more consistently in the code. Names like m_cursorElements and updateCursorElement would be nicer than m_svgCursorElements and updateSVGCursorElement. Type would still make it clear it’s specific to SVG. > Source/WebCore/css/CSSCursorImageValue.cpp:91 > + auto* svgCursorElement = downcast<SVGCursorElement>(element); I would use a reference: auto& svgCursorElement = downcast<SVGCursorElement>(*element); > Source/WebCore/css/CSSCursorImageValue.cpp:110 > + SVGLengthContext lengthContext(0); Should be nullptr rather than 0. > Source/WebCore/css/CSSCursorImageValue.cpp:112 > + float x = roundf(cursorElement.x().value(lengthContext)); I suggest using std::round instead of roundf. Also not sure if rounding is correct. Also wondering if we should clamp to the size of the image. > Source/WebCore/css/CSSCursorImageValue.cpp:115 > + float y = roundf(cursorElement.y().value(lengthContext)); Ditto. > Source/WebCore/css/CSSCursorImageValue.h:-78 > + HashSet<SVGCursorElement*> m_svgCursorElements; > > - HashSet<SVGElement*> m_referencedElements; There’s a stray blank line here. I suggest removing it.
Antti Koivisto
Comment 4 2016-04-16 10:54:47 PDT
Note You need to log in before you can comment on or make changes to this bug.