Bug 161216

Summary: HTMLAreaElement's coords attributes parsing does not comply with the HTML specification
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, cdumez, commit-queue, darin, esprehn+autocc, gyuyoung.kim, kling, rniwa, sam, zcorpan
Priority: P2 Keywords: WebExposed
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Follow-up fixes none

Description Chris Dumez 2016-08-25 15:01:40 PDT
HTMLAreaElement's coords attributes parsing does not comply with the HTML specification:
- https://html.spec.whatwg.org/#attr-area-coords
Comment 1 Chris Dumez 2016-08-25 15:08:39 PDT
Created attachment 287028 [details]
Patch
Comment 2 Andreas Kling 2016-08-26 11:00:32 PDT
Comment on attachment 287028 [details]
Patch

r=me
Comment 3 WebKit Commit Bot 2016-08-26 11:10:48 PDT
Comment on attachment 287028 [details]
Patch

Clearing flags on attachment: 287028

Committed r205030: <http://trac.webkit.org/changeset/205030>
Comment 4 WebKit Commit Bot 2016-08-26 11:10:55 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Chris Dumez 2016-08-26 12:09:35 PDT
Reopening to attach new patch.
Comment 6 Chris Dumez 2016-08-26 12:09:38 PDT
Created attachment 287128 [details]
Patch
Comment 7 Darin Adler 2016-08-26 22:10:27 PDT
Comment on attachment 287128 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287128&action=review

> Source/WebCore/html/parser/HTMLParserIdioms.cpp:229
> +template <typename CharacterType>
> +static inline bool isHTMLSpaceOrDelimiter(CharacterType character)
> +{
> +    return isHTMLSpace(character) || character == ',' || character == ';';
> +}
> +
> +template <typename CharacterType>
> +static inline bool isNumberStart(CharacterType character)
> +{
> +    return isASCIIDigit(character) || character == '.' || character == '-';
> +}

Is a template really needed? I think these could be be written to work on UChar and should work fine for LChar too.

> Source/WebCore/html/parser/HTMLParserIdioms.cpp:262
> +Vector<double> parseHTMLListOfOfFloatingPointNumberValues(const String& input)

Should take a StringView rather than a String.

> Source/WebCore/html/parser/HTMLParserIdioms.cpp:266
> +    unsigned length = input.length();
> +    if (!length)
> +        return { };

This won’t be needed if the argument is a StringView.
Comment 8 Chris Dumez 2016-08-27 21:35:33 PDT
Created attachment 287220 [details]
Follow-up fixes

Patch to take Darin's feedback into consideration.
Comment 9 WebKit Commit Bot 2016-08-27 22:26:27 PDT
Comment on attachment 287220 [details]
Follow-up fixes

Clearing flags on attachment: 287220

Committed r205095: <http://trac.webkit.org/changeset/205095>
Comment 10 WebKit Commit Bot 2016-08-27 22:26:32 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Chris Dumez 2016-09-13 09:18:13 PDT
*** Bug 153124 has been marked as a duplicate of this bug. ***
Comment 12 zalan 2023-12-18 08:15:20 PST
*** Bug 155516 has been marked as a duplicate of this bug. ***