|
|
DescriptionRework the "rules for parsing dimension values" implementation
This CL reworks the current implementation of the "rules for parsing
dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a
separate function and moves it to HTMLDimension.{cpp,h}.
In general, behavior deviating from the specced version is kept with the
following exceptions:
* Allow all of the "space characters" [2], rather than just U+0020.
* Cases with multiple full stops (ex: "1.2.3") now parse the same as
"1.2" rather than failing.
Comments are added where the implementation is known to deviate from the
spec.
This also makes it possible to avoid calling into the CSS parser for
actual parsing, which should reduce the amount of special-cases needed
there. This requires a mechanism for disallowing percentage values
though, to properly handle 'cellspacing' on <table>.
[1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-dimension-values
[2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character
BUG=668478
Committed: https://crrev.com/337cac12ea5b43b0d8dd2d1a9fe64a8e0dbb523b
Cr-Commit-Position: refs/heads/master@{#434678}
Patch Set 1 #Patch Set 2 : Fix table[cellspacing] #
Total comments: 3
Patch Set 3 : Rebase; clarify comment. #
Messages
Total messages: 31 (23 generated)
The CQ bit was checked by fs@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension. In general, behavior deviating from the specced version is kept. The only exception being that this allows all of the "space characters" [2], rather than just U+0020. Add comments where the implementation deviates from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ========== to ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept. The only exception being that this allows all of the "space characters" [2], rather than just U+0020. Add comments where the implementation deviates from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by fs@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept. The only exception being that this allows all of the "space characters" [2], rather than just U+0020. Add comments where the implementation deviates from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ========== to ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept. The only exception being that this allows all of the "space characters" [2], rather than just U+0020. Add comments where the implementation deviates from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Description was changed from ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept. The only exception being that this allows all of the "space characters" [2], rather than just U+0020. Add comments where the implementation deviates from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ========== to ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept. The only exception being that this allows all of the "space characters" [2], rather than just U+0020. Add comments where the implementation deviates from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ==========
Description was changed from ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept. The only exception being that this allows all of the "space characters" [2], rather than just U+0020. Add comments where the implementation deviates from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ========== to ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept with the following exceptions: * Allow all of the "space characters" [2], rather than just U+0020. * Cases with multiple full stops (ex: "1.2.3") now parse as "1.2" rather than failing. Comments are added where the implementation is known to deviate from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ==========
Description was changed from ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept with the following exceptions: * Allow all of the "space characters" [2], rather than just U+0020. * Cases with multiple full stops (ex: "1.2.3") now parse as "1.2" rather than failing. Comments are added where the implementation is known to deviate from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ========== to ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept with the following exceptions: * Allow all of the "space characters" [2], rather than just U+0020. * Cases with multiple full stops (ex: "1.2.3") now parse the same as "1.2" rather than failing. Comments are added where the implementation is known to deviate from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ==========
Description was changed from ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept with the following exceptions: * Allow all of the "space characters" [2], rather than just U+0020. * Cases with multiple full stops (ex: "1.2.3") now parse the same as "1.2" rather than failing. Comments are added where the implementation is known to deviate from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character ========== to ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept with the following exceptions: * Allow all of the "space characters" [2], rather than just U+0020. * Cases with multiple full stops (ex: "1.2.3") now parse the same as "1.2" rather than failing. Comments are added where the implementation is known to deviate from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character BUG=668478 ==========
fs@opera.com changed reviewers: + foolip@chromium.org, timloh@chromium.org
lgtm https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/HTMLDimension.cpp (right): https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/HTMLDimension.cpp:162: // Deviation: HTML requires a digit after the full stop. Gecko and Edge I think you misread the spec here? From my reading it's fine to not have a digit after, we just return the value immediately (so 10.... -> 10, 10.% -> 10). It looks like we currently interpret 10.% as a percentage and so does FF.
https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/HTMLDimension.cpp (right): https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/HTMLDimension.cpp:162: // Deviation: HTML requires a digit after the full stop. Gecko and Edge On 2016/11/25 at 00:07:47, Timothy Loh wrote: > I think you misread the spec here? From my reading it's fine to not have a digit after, we just return the value immediately (so 10.... -> 10, 10.% -> 10). It looks like we currently interpret 10.% as a percentage and so does FF. My comment could be made more clear I guess. I was thinking of the case you mention (10.% -> 10), which both we, Gecko and Edge (and WebKit) interpret as a percentage (while we should not per spec.) I'll make sure to update the comment to mention this.
Explicitly leaving this to timloh@
The CQ bit was checked by fs@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by fs@opera.com
The patchset sent to the CQ was uploaded after l-g-t-m from timloh@chromium.org Link to the patchset: https://codereview.chromium.org/2528673003/#ps40001 (title: "Rebase; clarify comment.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 40001, "attempt_start_ts": 1480354423262360, "parent_rev": "dd76add0ae573d67d25dc03bd8f2475208c5f741", "commit_rev": "a9726fe40cf1b3b226fd0d3460e9d9c07cac8e5b"}
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept with the following exceptions: * Allow all of the "space characters" [2], rather than just U+0020. * Cases with multiple full stops (ex: "1.2.3") now parse the same as "1.2" rather than failing. Comments are added where the implementation is known to deviate from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character BUG=668478 ========== to ========== Rework the "rules for parsing dimension values" implementation This CL reworks the current implementation of the "rules for parsing dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a separate function and moves it to HTMLDimension.{cpp,h}. In general, behavior deviating from the specced version is kept with the following exceptions: * Allow all of the "space characters" [2], rather than just U+0020. * Cases with multiple full stops (ex: "1.2.3") now parse the same as "1.2" rather than failing. Comments are added where the implementation is known to deviate from the spec. This also makes it possible to avoid calling into the CSS parser for actual parsing, which should reduce the amount of special-cases needed there. This requires a mechanism for disallowing percentage values though, to properly handle 'cellspacing' on <table>. [1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-... [2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character BUG=668478 Committed: https://crrev.com/337cac12ea5b43b0d8dd2d1a9fe64a8e0dbb523b Cr-Commit-Position: refs/heads/master@{#434678} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/337cac12ea5b43b0d8dd2d1a9fe64a8e0dbb523b Cr-Commit-Position: refs/heads/master@{#434678}
Message was sent while issue was closed.
https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/HTMLDimension.cpp (right): https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/HTMLDimension.cpp:162: // Deviation: HTML requires a digit after the full stop. Gecko and Edge On 2016/11/25 at 10:18:43, fs wrote: > On 2016/11/25 at 00:07:47, Timothy Loh wrote: > > I think you misread the spec here? From my reading it's fine to not have a digit after, we just return the value immediately (so 10.... -> 10, 10.% -> 10). It looks like we currently interpret 10.% as a percentage and so does FF. > > My comment could be made more clear I guess. I was thinking of the case you mention (10.% -> 10), which both we, Gecko and Edge (and WebKit) interpret as a percentage (while we should not per spec.) I'll make sure to update the comment to mention this. Clarified. |