WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
139334
Get rid of error-prone ReleaseParsedCalcValueCondition argument in CSSParser
https://bugs.webkit.org/show_bug.cgi?id=139334
Summary
Get rid of error-prone ReleaseParsedCalcValueCondition argument in CSSParser
Chris Dumez
Reported
2014-12-05 21:23:15 PST
Get rid of error-prone ReleaseParsedCalcValueCondition argument in CSSParser.
Attachments
Patch
(110.26 KB, patch)
2014-12-05 21:53 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(111.23 KB, patch)
2014-12-05 23:20 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(113.10 KB, patch)
2014-12-06 10:20 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(116.41 KB, patch)
2014-12-08 21:07 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(116.40 KB, patch)
2014-12-16 16:08 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(117.92 KB, patch)
2014-12-20 13:41 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(118.39 KB, patch)
2014-12-20 14:02 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(1.45 KB, patch)
2014-12-20 22:23 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2014-12-05 21:53:08 PST
Created
attachment 242702
[details]
Patch
WebKit Commit Bot
Comment 2
2014-12-05 21:55:24 PST
Attachment 242702
[details]
did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:1641: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.cpp:9357: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.h:705: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Total errors found: 3 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 3
2014-12-05 23:20:28 PST
Created
attachment 242704
[details]
Patch
WebKit Commit Bot
Comment 4
2014-12-05 23:22:16 PST
Attachment 242704
[details]
did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:1641: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.cpp:9358: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.h:705: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Total errors found: 3 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 5
2014-12-06 10:20:05 PST
Created
attachment 242718
[details]
Patch
WebKit Commit Bot
Comment 6
2014-12-06 10:21:26 PST
Attachment 242718
[details]
did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:1641: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.cpp:9358: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.h:705: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Total errors found: 3 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 7
2014-12-08 18:10:43 PST
Comment on
attachment 242718
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=242718&action=review
> Source/WebCore/ChangeLog:14 > + the parsed calculation value is not associated with its CSSParserValue.
"is associated" rather than is *not* associated
> Source/WebCore/css/CSSParser.h:695 > +class CSSParserValueWithState {
What does “with state” mean? I am having trouble coming up with a good name, but the current name does not make sense to me. Maybe: CSSParserValueOrCalculation, CSSParserValueAndCalculation, or CSSParserValueWithCalculation. Maybe we should consider making this a member of the CSSParser class to make the class name shorter in most of the code.
> Source/WebCore/css/CSSParser.h:704 > + CSSCalcValue* parsedCalculation() const { return m_parsedCalculation.get(); }
Why the word “parsed” here? I don’t see how the calculation is any more “parsed” than the value is.
> Source/WebCore/css/CSSParser.h:705 > + void setParsedCalculation(RefPtr<CSSCalcValue> calculation) { m_parsedCalculation = calculation; }
This should take PassRefPtr or a raw pointer, or alternatively use WTF::move in the function body.
> Source/WebCore/css/CSSParser.h:709 > + private: > + CSSParserValue& m_value; > + RefPtr<CSSCalcValue> m_parsedCalculation;
This is not our normal indentation.
Chris Dumez
Comment 8
2014-12-08 19:01:11 PST
Comment on
attachment 242718
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=242718&action=review
>> Source/WebCore/css/CSSParser.h:705 >> + void setParsedCalculation(RefPtr<CSSCalcValue> calculation) { m_parsedCalculation = calculation; } > > This should take PassRefPtr or a raw pointer, or alternatively use WTF::move in the function body.
I hear we are transitioning away from PassRefPtr, which is why I used a RefPtr<> argument. I will add the WTF::move().
Chris Dumez
Comment 9
2014-12-08 21:07:55 PST
Created
attachment 242877
[details]
Patch
WebKit Commit Bot
Comment 10
2014-12-08 21:09:56 PST
Attachment 242877
[details]
did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:1641: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.cpp:9356: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.h:93: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Total errors found: 3 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 11
2014-12-16 16:08:18 PST
Created
attachment 243402
[details]
Patch
WebKit Commit Bot
Comment 12
2014-12-16 16:11:04 PST
Attachment 243402
[details]
did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:1641: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.cpp:9356: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 2 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 13
2014-12-16 21:32:24 PST
Comment on
attachment 243402
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=243402&action=review
> Source/WebCore/css/CSSParser.cpp:1584 > +bool CSSParser::validCalculationUnit(ValueWithCalculation& valueWithCalculation, Units unitflags)
I find this function very strange. It’s name is “valid calculation unit”, so it should return a “calculation unit”. But also it has a side effect of filling in the calculation. That’s really unclear from the name of the function. I have the same problem with the function validUnit and the many other functions that store the calculation into the ValueWithCalculation as a side effect. I think these functions should be named “validate” instead of “valid”, but also, I think they may want to be more explicit about how they fill in the calculation. It’s also wrong capitalization to have an argument named “unitflags” with all lower case.
> Source/WebCore/css/CSSParser.cpp:1711 > + ASSERT(isCalculation(valueWithCalculation));
Seems to me that this assertion should be moved into the ValueWithCalculation class instead of done at this call site.
> Source/WebCore/css/CSSParser.cpp:1781 > + if (isCalculation(valueWithCalculation))
I think this maybe should be checking valueWithCalculation.calculation() for null instead of calling isCalculation.
> Source/WebCore/css/CSSParser.h:90 > + CSSParserValue& value() const { return m_value; } > + operator CSSParserValue&() { return m_value; }
There’s no reason for the CSSParserValue& operator to be non-const. It should be const too.
Chris Dumez
Comment 14
2014-12-20 13:41:01 PST
Created
attachment 243608
[details]
Patch
WebKit Commit Bot
Comment 15
2014-12-20 13:43:39 PST
Attachment 243608
[details]
did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:1642: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.cpp:1651: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/css/CSSParser.cpp:9359: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 3 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 16
2014-12-20 14:02:52 PST
Created
attachment 243609
[details]
Patch
WebKit Commit Bot
Comment 17
2014-12-20 14:05:02 PST
Attachment 243609
[details]
did not pass style-queue: ERROR: Source/WebCore/css/CSSParser.cpp:1642: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/css/CSSParser.cpp:1651: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/css/CSSParser.cpp:9359: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 3 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 18
2014-12-20 18:56:26 PST
Comment on
attachment 243609
[details]
Patch Clearing flags on attachment: 243609 Committed
r177623
: <
http://trac.webkit.org/changeset/177623
>
WebKit Commit Bot
Comment 19
2014-12-20 18:56:30 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 20
2014-12-20 19:33:25 PST
Chris, in the
r177623
patch in ValueWithCalculation::setCalculation, it says isCalculation(m_value) where I think we wanted ASSERT(isCalculation(m_value)).
Chris Dumez
Comment 21
2014-12-20 22:23:43 PST
Reopening to attach new patch.
Chris Dumez
Comment 22
2014-12-20 22:23:46 PST
Created
attachment 243612
[details]
Patch
Chris Dumez
Comment 23
2014-12-20 22:25:39 PST
(In reply to
comment #20
)
> Chris, in the
r177623
patch in ValueWithCalculation::setCalculation, it says > isCalculation(m_value) where I think we wanted > ASSERT(isCalculation(m_value)).
Yes indeed. Thanks for double checking and catching it. I uploaded a tiny patch to fix this.
WebKit Commit Bot
Comment 24
2014-12-21 17:52:28 PST
Comment on
attachment 243612
[details]
Patch Clearing flags on attachment: 243612 Committed
r177628
: <
http://trac.webkit.org/changeset/177628
>
WebKit Commit Bot
Comment 25
2014-12-21 17:52:34 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug