RESOLVED FIXED 120215
MediaQuery::expressions() should return a reference
https://bugs.webkit.org/show_bug.cgi?id=120215
Summary MediaQuery::expressions() should return a reference
Pratik Solanki
Reported 2013-08-23 11:28:27 PDT
Code ensures that m_expressions is never null so we can just return a reference.
Attachments
Patch (4.62 KB, patch)
2013-08-23 11:35 PDT, Pratik Solanki
no flags
Patch (6.13 KB, patch)
2013-08-23 12:29 PDT, Pratik Solanki
andersca: review+
Pratik Solanki
Comment 1 2013-08-23 11:35:44 PDT
Andreas Kling
Comment 2 2013-08-23 11:39:44 PDT
Comment on attachment 209479 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209479&action=review > Source/WebCore/css/MediaQueryEvaluator.cpp:145 > - const Vector<OwnPtr<MediaQueryExp> >* exps = query->expressions(); > + const Vector<OwnPtr<MediaQueryExp> >& exps = query->expressions(); Since you are touching every line with this variable on it, you could also rename it to "expressions" while you're here :)
Early Warning System Bot
Comment 3 2013-08-23 11:41:18 PDT
Early Warning System Bot
Comment 4 2013-08-23 11:42:20 PDT
EFL EWS Bot
Comment 5 2013-08-23 11:56:20 PDT
EFL EWS Bot
Comment 6 2013-08-23 12:14:59 PDT
Pratik Solanki
Comment 7 2013-08-23 12:29:49 PDT
WebKit Commit Bot
Comment 8 2013-08-23 12:32:29 PDT
Attachment 209491 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/css/MediaList.cpp', u'Source/WebCore/css/MediaQuery.cpp', u'Source/WebCore/css/MediaQuery.h', u'Source/WebCore/css/MediaQueryEvaluator.cpp']" exit_code: 1 Source/WebCore/css/MediaQueryEvaluator.cpp:145: Missing spaces around >> [whitespace/operators] [3] Source/WebCore/css/MediaList.cpp:331: Missing spaces around >> [whitespace/operators] [3] Total errors found: 2 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Anders Carlsson
Comment 9 2013-08-23 15:59:35 PDT
Comment on attachment 209491 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209491&action=review > Source/WebCore/css/MediaQuery.cpp:82 > +MediaQuery::MediaQuery(Restrictor r, const String& mediaType, PassOwnPtr<ExpressionVector> exprs) Didn’t we decide that this should be PassOwnPtr<Vector<OwnPtr<MediaQueryExp>>>?
Pratik Solanki
Comment 10 2013-08-23 16:25:31 PDT
Comment on attachment 209491 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209491&action=review >> Source/WebCore/css/MediaQuery.cpp:82 >> +MediaQuery::MediaQuery(Restrictor r, const String& mediaType, PassOwnPtr<ExpressionVector> exprs) > > Didn’t we decide that this should be PassOwnPtr<Vector<OwnPtr<MediaQueryExp>>>? Since this was in MediaQuery.cpp, I felt it was okay to use the internal typedef ExpressionVector. Header says PassOwnPtr<Vector<OwnPtr<MediaQueryExp>>> for clarity.
Pratik Solanki
Comment 11 2013-08-23 16:32:49 PDT
Actually, MediaQuery.h uses ExpressionVector in some of it's public methods. We should just use Vector<OwnPtr<MediaQueryExp>> there to be clearer for callers. I'll make that change and land. Thanks for the review.
Pratik Solanki
Comment 12 2013-08-23 17:13:12 PDT
Note You need to log in before you can comment on or make changes to this bug.