Parsing of <body link vlink alink> is not per spec
Reported by
sim...@opera.com,
Apr 21 2016
|
|||
Issue descriptionhttps://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp&sq=package:chromium&type=cs&l=96 This code does not match the requirements in the HTML spec: [[ When a body element has a bgcolor attribute set, the new value is expected to be parsed using the rules for parsing a legacy colour value, and if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the element's 'background-color' property to the resulting colour. When a body element has a text attribute, its value is expected to be parsed using the rules for parsing a legacy colour value, and if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the element's 'color' property to the resulting colour. When a body element has a link attribute, its value is expected to be parsed using the rules for parsing a legacy colour value, and if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the 'color' property of any element in the Document matching the :link pseudo-class to the resulting colour. When a body element has a vlink attribute, its value is expected to be parsed using the rules for parsing a legacy colour value, and if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the 'color' property of any element in the Document matching the :visited pseudo-class to the resulting colour. When a body element has an alink attribute, its value is expected to be parsed using the rules for parsing a legacy colour value, and if that does not return an error, the user agent is expected to treat the attribute as a presentational hint setting the 'color' property of any element in the Document matching the :active pseudo-class and either the :link pseudo-class or the :visited pseudo-class to the resulting colour. ]] https://html.spec.whatwg.org/multipage/rendering.html#the-page It seems we use the correct rules for bgcolor (on various elements, and <font color>, <table bordercolor>, <hr color>) and text but not the link/vlink/alink attributes on body. This should also not be conditional on quirks mode. Gecko matches the spec AFAICT. Simple tests: <!doctype html> <body bgcolor="00ff0x">This should have a green background. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4091 bgcolor --- <!doctype html> <body link="00800x"><a href=javascript:>This text should be green. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4092 link (standards mode) --- <!doctype html> <body link="00800x"><a href=javascript:>This text should be green. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4093 link (quirks mode) --- <body link="008000"><a href=javascript:>This text should be green. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4094 link (quirks mode, using a value we successfully parse today)
,
Apr 21 2016
(Same issue for WebKit: https://bugs.webkit.org/show_bug.cgi?id=156849 )
,
Apr 25 2016
Please feel free to poach. I believe this is where we parse bgcolor: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/html/HTMLElement.cpp&sq=package:chromium&type=cs&l=932&rcl=1461539842
,
Apr 27 2016
I'd like to try fixing it.
,
Apr 28 2016
OK, I would be happy to review your patch.
,
Apr 28 2016
,
May 9 2016
Hi Dominic, please have a look, I updated my patch some time ago and run all layout tests - seems to be no regressions.
,
May 21 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ac6c480c0c078999a785de7ef1e10c6c0c928c75 commit ac6c480c0c078999a785de7ef1e10c6c0c928c75 Author: a.obzhirov <a.obzhirov@samsung.com> Date: Sat May 21 03:21:21 2016 Fix parsing of <body link vlink alink> We use the correct legacy rules for bgcolor and text but not the link/vlink/alink attributes on body. This should also not be conditional on quirks mode. The change adds parsing color from link/vlink/alink attributes using legacy rules. BUG= 605534 Review-Url: https://codereview.chromium.org/1921823006 Cr-Commit-Position: refs/heads/master@{#395242} [modify] https://crrev.com/ac6c480c0c078999a785de7ef1e10c6c0c928c75/AUTHORS [add] https://crrev.com/ac6c480c0c078999a785de7ef1e10c6c0c928c75/third_party/WebKit/LayoutTests/fast/dom/HTMLBodyElement/body-legacy-colors-expected.txt [add] https://crrev.com/ac6c480c0c078999a785de7ef1e10c6c0c928c75/third_party/WebKit/LayoutTests/fast/dom/HTMLBodyElement/body-legacy-colors.html [modify] https://crrev.com/ac6c480c0c078999a785de7ef1e10c6c0c928c75/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp [modify] https://crrev.com/ac6c480c0c078999a785de7ef1e10c6c0c928c75/third_party/WebKit/Source/core/html/HTMLElement.cpp [modify] https://crrev.com/ac6c480c0c078999a785de7ef1e10c6c0c928c75/third_party/WebKit/Source/core/html/HTMLElement.h
,
Jul 4 2016
Test cases work as expected in 54.0.2787.0 canary. |
|||
►
Sign in to add a comment |
|||
Comment 1 by sim...@opera.com
, Apr 21 2016