RESOLVED FIXED 82040
CSSParser doesn't set border-*-width/style/color to initial by border shorthand property
https://bugs.webkit.org/show_bug.cgi?id=82040
Summary CSSParser doesn't set border-*-width/style/color to initial by border shortha...
Ryosuke Niwa
Reported 2012-03-23 03:13:34 PDT
​<div id="test" style="border:solid;">hello</div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ alert(​document.getElementById('test').style.borderTopColor); should alert "initial". ​
Attachments
Fixes the bug (10.84 KB, patch)
2012-03-23 04:14 PDT, Ryosuke Niwa
no flags
Rebaseliined the failling test (13.26 KB, patch)
2012-03-23 11:28 PDT, Ryosuke Niwa
no flags
Fixed typos in the change log (13.26 KB, patch)
2012-03-23 11:50 PDT, Ryosuke Niwa
koivisto: review+
Ryosuke Niwa
Comment 1 2012-03-23 04:14:22 PDT
Created attachment 133457 [details] Fixes the bug
WebKit Review Bot
Comment 2 2012-03-23 04:45:36 PDT
Comment on attachment 133457 [details] Fixes the bug Attachment 133457 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12120603 New failing tests: inspector/styles/styles-new-API.html
Andy Estes
Comment 3 2012-03-23 11:20:27 PDT
Comment on attachment 133457 [details] Fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=133457&action=review I just have a few drive-by comments about ChangeLog typos. > Source/WebCore/ChangeLog:9 > + While CSSParser::parseValue can process these shorthand properties property and set the longhand properties "shorthand properties *properly*" > Source/WebCore/ChangeLog:20 > + This allows us to initialize mutliple properties (e.g. border-*-color) for a signle property missing in the set. s/mutliple/multiple > Source/WebCore/ChangeLog:26 > + (CSSPropertyLonghand): Added the version that takes longhands instances for initialization purposes. longhand instances, not longhands instances.
Ryosuke Niwa
Comment 4 2012-03-23 11:28:49 PDT
Created attachment 133519 [details] Rebaseliined the failling test
Simon Fraser (smfr)
Comment 5 2012-03-23 11:32:28 PDT
Comment on attachment 133519 [details] Rebaseliined the failling test View in context: https://bugs.webkit.org/attachment.cgi?id=133519&action=review > Source/WebCore/ChangeLog:9 > + While CSSParser::parseValue can process these shorthand properties property and set the longhand properties properties property? Did you mean "properties properly"?
Ryosuke Niwa
Comment 6 2012-03-23 11:35:27 PDT
Comment on attachment 133519 [details] Rebaseliined the failling test View in context: https://bugs.webkit.org/attachment.cgi?id=133519&action=review >> Source/WebCore/ChangeLog:9 >> + While CSSParser::parseValue can process these shorthand properties property and set the longhand properties > > properties property? Did you mean "properties properly"? Oops, yes. properly.
Ryosuke Niwa
Comment 7 2012-03-23 11:50:23 PDT
Created attachment 133525 [details] Fixed typos in the change log
Simon Fraser (smfr)
Comment 8 2012-03-23 12:00:48 PDT
Comment on attachment 133525 [details] Fixed typos in the change log View in context: https://bugs.webkit.org/attachment.cgi?id=133525&action=review > Source/WebCore/ChangeLog:11 > + The border shorthand property sets values for border-width, border-style, and border-color shorthand properties. > + While CSSParser::parseValue can process these shorthand properties properly and set the longhand properties > + such as border-top-width, border-right-width, ... border-left-color, CSSParser::addProperty can't and the > + initialization in parseShorthand fails for the border property. Please state why you think this won't break the web. > Source/WebCore/css/CSSParser.cpp:2805 > + bool propertyFound[6]= { false, false, false, false, false, false }; // 6 is enough size. The comment is terribly worded. > Source/WebCore/css/CSSParser.cpp:2811 > + propertyFound[propIndex] = found = true; We shy away from multiple assignments like this in general. Please split onto 2 lines. > Source/WebCore/css/CSSParser.cpp:2827 > + const CSSPropertyLonghand* const* const longhandsForInitialization = longhand.longhandsForInitialization(); That's a lot of consts. > Source/WebCore/css/CSSParser.cpp:2833 > + const CSSPropertyLonghand& initLonghand = *(longhandsForInitialization[i]); I don't really see the benefit of using a reference rather than a pointer here. > Source/WebCore/css/CSSPropertyLonghand.h:35 > + CSSPropertyLonghand(const int* properties, unsigned numProperties) I wish we used CSSPropertyID and not int. > Source/WebCore/css/CSSPropertyLonghand.h:42 > + CSSPropertyLonghand(const int* properties, const CSSPropertyLonghand** longhandsForInitialization, unsigned numProperties) Would const CSSPropertyLonghand*[] be clearer?
Daniel Bates
Comment 9 2012-03-23 12:03:39 PDT
Comment on attachment 133525 [details] Fixed typos in the change log View in context: https://bugs.webkit.org/attachment.cgi?id=133525&action=review The majority of my remarks were already raised by Simon Fraser. I had some very minor nits. > Source/WebCore/ChangeLog:9 > + While CSSParser::parseValue can process these shorthand properties properly and set the longhand properties Nit: CSSParser::parseValue => CSSParser::parseValue() Since you are referring to the function here as opposed to the name of the function. > Source/WebCore/ChangeLog:10 > + such as border-top-width, border-right-width, ... border-left-color, CSSParser::addProperty can't and the Similarly, "CSSParser::addProperty" should be "CSSParser::addProperty()". >> Source/WebCore/ChangeLog:11 >> + initialization in parseShorthand fails for the border property. > > Please state why you think this won't break the web. Similarly, "parseShorthand" should be "parseShorthand()". > Source/WebCore/ChangeLog:20 > + This allows us to initialize mutliple properties (e.g. border-*-color) for a single property missing in the set. Nit: mutliple => multiple
Ryosuke Niwa
Comment 10 2012-03-23 12:23:38 PDT
(In reply to comment #9) > (From update of attachment 133525 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=133525&action=review > > The majority of my remarks were already raised by Simon Fraser. I had some very minor nits. > > > Source/WebCore/ChangeLog:9 > > + While CSSParser::parseValue can process these shorthand properties properly and set the longhand properties > > Nit: CSSParser::parseValue => CSSParser::parseValue() > > Since you are referring to the function here as opposed to the name of the function. I'm not a big fun of this particular notation since it doesn't state the full signature. In fact, CSSParser::parseValue() is strictly different from CSSParser::parseValue(StylePropertySet*, int, const String&, bool, bool, CSSStyleSheet*). While CSSParser::parseValue can refer to any symbols or functions of the same name.
Ryosuke Niwa
Comment 11 2012-03-23 12:37:45 PDT
Ryosuke Niwa
Comment 12 2012-03-23 12:59:05 PDT
Thanks for the review guys :D
Note You need to log in before you can comment on or make changes to this bug.