-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Revamp coords parsing to be more compatible and less insane #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5a1c99a
to
c2eb90e
Compare
Do we have tests for how many browsers this new algorithm matches? |
I don't know how to test this in an automated fashion :( since the parsed list is not exposed and the only way to tell what happens, AFAIK, is with hit testing or looking at focus rings. |
But as noted in the bug, the new algorithm doesn't exactly match any one browser, but is more of a mix of the different approaches that seems to give good results for actual Web content. |
It could be tested using |
@bzbarsky @jchaffraix @hober is there interest in aligning coords parsing? I'd be happy to write some tests in web-platform-tests. |
If there's sufficient interest for this from other parties, I can work on aligning the parser in Blink. |
I'm definitely interested in having tests by the time we implement image maps in Servo :) |
c2eb90e
to
ca8c695
Compare
This tests whatwg/html#514. In Gecko currently these tests fail because of https://bugzilla.mozilla.org/show_bug.cgi?id=1227469
I'm interested in aligning parsing here at least in theory. This is not code that's well-owned in Gecko and hasn't been changed much in a long time; I don't feel like I have a good understanding of what's likely to be compatible here and what's not. But if there's a simple enough and compatible spec I would certainly support it getting implemented. |
I would be okay with merging this given that the old algorithm aligned with IE and nobody wants to implement that anymore, and given that we now have tests and bugs filed. |
ca8c695
to
14a0201
Compare
Tests are reviewed now and @fsoder has an implementation that passes the tests. Can we merge, or does someone else want to review also? |
|
||
<li>Let <var>negated</var> be false.</li> | ||
<li><p><span>Collect a sequence of characters</span> that are not <span data-x="space | ||
character">space characters</span>, U+002C COMMA, U+003B SEMICOLON characters, and let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"or" before U+003B
A couple minor editorial nits. LGTM once fixed. Very nice to just reuse the float algorithm instead of the existing complicated thing. |
The old parser tried to mimic IE as close as possible. Now Edge is instead interested in aligning with Gecko/WebKit. This new algorithm was designed by studying implementations as well as invalid Web content. At the same time, support parsing of floating point numbers, as suggested by Travis Leithead in the bug below. Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=28148.
14a0201
to
ead6cfe
Compare
@@ -4557,13 +4557,13 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
U+002E FULL STOP, or U+002D HYPHEN-MINUS characters. This skips past leading garbage.</p></li>
<li><p><span>Collect a sequence of characters</span> that are not <span data-x="space
- character">space characters</span>, U+002C COMMA, U+003B SEMICOLON characters, and let
+ character">space characters</span>, U+002C COMMA, or U+003B SEMICOLON characters, and let
<var>unparsed number</var> be the result.</p></li>
- <li><p>Let <var>number</var> be the result of using the <span>rules for parsing floating-point
- number values</span> for <var>unparsed number</var>.</p></li>
+ <li><p>Let <var>number</var> be the result of parsing <var>unparsed number</var> using the
+ <span>rules for parsing floating-point number values</span>.</p></li>
- <li><p>If <var>number</var> is an error, let <var>number</var> be zero.</p></li>
+ <li><p>If <var>number</var> is an error, set <var>number</var> to zero.</p></li>
<li><p>Append <var>number</var> to <var>numbers</var>.</p></li> |
Thanks for the review! |
This tests whatwg/html#514. In Gecko currently these tests fail because of https://bugzilla.mozilla.org/show_bug.cgi?id=1227469
FYI, the relevant fixes have now landed in Blink. @fsoder++ |
The old parser tried to mimic IE as close as possible. Now Edge is instead interested in aligning with Gecko/WebKit. This new algorithm was designed by studying implementations as well as invalid Web content.
At the same time, support parsing of floating point numbers, as suggested by @travisleithead in the bug below.
Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=28148.