RESOLVED FIXED143925
CSSParser::parseValue() copies the m_parsedProperties vector at addParsedProperties()
https://bugs.webkit.org/show_bug.cgi?id=143925
Summary CSSParser::parseValue() copies the m_parsedProperties vector at addParsedProp...
Simon Fraser (smfr)
Reported 2015-04-18 14:58:26 PDT
MutableStyleProperties::addParsedProperties() takes a const Vector<CSSProperty>& but m_parsedProperties is a Vector<CSSProperty, 256>, and apparently this forces a copy.
Attachments
Patch (4.12 KB, patch)
2015-04-20 11:34 PDT, Chris Dumez
no flags
Patch (4.16 KB, patch)
2015-04-20 11:57 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2015-04-20 10:34:36 PDT
Very nice find :) We really supposed to use ParsedPropertyVector type here.
Chris Dumez
Comment 2 2015-04-20 11:34:04 PDT
Simon Fraser (smfr)
Comment 3 2015-04-20 11:46:49 PDT
Comment on attachment 251171 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251171&action=review > Source/WebCore/css/CSSParser.h:84 > + using ParsedPropertyVector = Vector<CSSProperty, 256>; Does the compiler enforce a match between this and the typedef? > Source/WebCore/css/StyleProperties.cpp:770 > + for (auto& property : properties) const auto&?
Chris Dumez
Comment 4 2015-04-20 11:50:07 PDT
Comment on attachment 251171 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251171&action=review >> Source/WebCore/css/CSSParser.h:84 >> + using ParsedPropertyVector = Vector<CSSProperty, 256>; > > Does the compiler enforce a match between this and the typedef? Which typedef? I just made the typedef public so it could be used in StyleProperties. I used a 'using' statement but it is equivalent to a typedef in this case. >> Source/WebCore/css/StyleProperties.cpp:770 >> + for (auto& property : properties) > > const auto&? auto will be a const CSSProperty so it is equivalent but OK.
Chris Dumez
Comment 5 2015-04-20 11:57:05 PDT
Chris Dumez
Comment 6 2015-04-20 12:07:22 PDT
To avoid mistakes like this in the future, I think we should make the following constructor explicit: template<size_t otherCapacity, typename otherOverflowBehaviour> Vector(const Vector<T, otherCapacity, otherOverflowBehaviour>&); I can look into this in a follow-up patch as it likely is a larger change.
Chris Dumez
Comment 7 2015-04-20 12:41:07 PDT
Comment on attachment 251179 [details] Patch Clearing flags on attachment: 251179 Committed r183024: <http://trac.webkit.org/changeset/183024>
Chris Dumez
Comment 8 2015-04-20 12:41:13 PDT
All reviewed patches have been landed. Closing bug.
Chris Dumez
Comment 9 2015-04-20 19:27:17 PDT
(In reply to comment #6) > To avoid mistakes like this in the future, I think we should make the > following constructor explicit: > template<size_t otherCapacity, typename otherOverflowBehaviour> > Vector(const Vector<T, otherCapacity, otherOverflowBehaviour>&); > > I can look into this in a follow-up patch as it likely is a larger change. -> https://bugs.webkit.org/show_bug.cgi?id=143970
Note You need to log in before you can comment on or make changes to this bug.