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

Issue 2528673003: Rework the "rules for parsing dimension values" implementation (Closed)

Created:
4 years ago by fs
Modified:
4 years ago
Reviewers:
Timothy Loh, foolip
CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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-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. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -39 lines) Patch
M third_party/WebKit/Source/core/html/HTMLDimension.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLDimension.cpp View 1 2 2 chunks +51 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLDimensionTest.cpp View 1 chunk +74 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLElement.h View 1 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLElement.cpp View 1 2 chunks +18 lines, -36 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLTableElement.cpp View 1 1 chunk +4 lines, -2 lines 0 comments Download

Messages

Total messages: 31 (23 generated)
fs
4 years ago (2016-11-24 12:16:19 UTC) #16
Timothy Loh
lgtm https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Source/core/html/HTMLDimension.cpp File third_party/WebKit/Source/core/html/HTMLDimension.cpp (right): https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Source/core/html/HTMLDimension.cpp#newcode162 third_party/WebKit/Source/core/html/HTMLDimension.cpp:162: // Deviation: HTML requires a digit after the ...
4 years ago (2016-11-25 00:07:47 UTC) #17
fs
https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Source/core/html/HTMLDimension.cpp File third_party/WebKit/Source/core/html/HTMLDimension.cpp (right): https://codereview.chromium.org/2528673003/diff/20001/third_party/WebKit/Source/core/html/HTMLDimension.cpp#newcode162 third_party/WebKit/Source/core/html/HTMLDimension.cpp:162: // Deviation: HTML requires a digit after the full ...
4 years ago (2016-11-25 10:18:43 UTC) #18
foolip
Explicitly leaving this to timloh@
4 years ago (2016-11-28 13:33:00 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2528673003/40001
4 years ago (2016-11-28 17:34:01 UTC) #26
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years ago (2016-11-28 17:38:27 UTC) #28
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/337cac12ea5b43b0d8dd2d1a9fe64a8e0dbb523b Cr-Commit-Position: refs/heads/master@{#434678}
4 years ago (2016-11-28 17:40:32 UTC) #30
fs
4 years ago (2016-11-30 18:27:18 UTC) #31
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.

Powered by Google App Engine
This is Rietveld 408576698