|
|
Created:
5 years ago by shans Modified:
5 years ago CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, chromium-reviews, dglazkov+blink, rwlbuis Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionSwitch CSSVariableResolver to use CSSParserTokenRange internally.
BUG=465126
Committed: https://crrev.com/7ec1eb82ba5261e1f1eb9df4b202c67cbde1f690
Cr-Commit-Position: refs/heads/master@{#361868}
Patch Set 1 #
Total comments: 10
Patch Set 2 : review comments #Patch Set 3 : For science! #
Messages
Total messages: 21 (9 generated)
shans@chromium.org changed reviewers: + leviw@chromium.org, timloh@chromium.org
The CQ bit was checked by shans@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1477093002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1477093002/1
Description was changed from ========== Switch CSSVariableResolver to use CSSParserTokenRange internally. BUG= ========== to ========== Switch CSSVariableResolver to use CSSParserTokenRange internally. BUG=465126 ==========
This is pretty good, some comments below on how to have less loops ;-) I noticed while reviewing this that we currently do cycle-detection incorrectly (filed bug 561872), but fixing that should probably be separate. https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp (right): https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:30: while ((token = &varReference.consume())->type() != IdentToken) { } I think you can do as follows because we validated the input earlier. Should make it obvious that we're only skipping whitespace. varReference.consumeWhitespace(); ASSERT(varReference.peek().type() == IdentToken); variableName = varReference.consumeIncludingWhitespace()->value(); ASSERT(varReference.atEnd() || varReference.peek().type() == CommaToken); https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:55: if (tokens.size()) { !tokens.isEmpty() probably https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:74: void CSSVariableResolver::resolveVariableReferencesFromTokens(const Vector<CSSParserToken>& tokens, This might as well take a CSSParserTokenRange, so you don't need to explicitly make one and you can avoid copying the default tokens. Also I think it should return a bool? Seems weird that the other function would return true in the default case regardless of whether the recursive call succeeds. https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:79: while (true) { I think this is clearer as while (!range.atEnd()) { if (!var) append; else .. } https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:95: // Vector<CSSParserToken> tokens = value.variableDataValue()->tokens(); did you mean to delete the line?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp (right): https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:30: while ((token = &varReference.consume())->type() != IdentToken) { } On 2015/11/26 at 04:55:31, Timothy Loh wrote: > I think you can do as follows because we validated the input earlier. Should make it obvious that we're only skipping whitespace. > > varReference.consumeWhitespace(); > ASSERT(varReference.peek().type() == IdentToken); > variableName = varReference.consumeIncludingWhitespace()->value(); > ASSERT(varReference.atEnd() || varReference.peek().type() == CommaToken); Done. https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:55: if (tokens.size()) { On 2015/11/26 at 04:55:31, Timothy Loh wrote: > !tokens.isEmpty() probably Done. https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:74: void CSSVariableResolver::resolveVariableReferencesFromTokens(const Vector<CSSParserToken>& tokens, On 2015/11/26 at 04:55:31, Timothy Loh wrote: > This might as well take a CSSParserTokenRange, so you don't need to explicitly make one and you can avoid copying the default tokens. Also I think it should return a bool? Seems weird that the other function would return true in the default case regardless of whether the recursive call succeeds. Done. https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:79: while (true) { On 2015/11/26 at 04:55:31, Timothy Loh wrote: > I think this is clearer as > > while (!range.atEnd()) { > if (!var) > append; > else .. > } Done. https://codereview.chromium.org/1477093002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp:95: // Vector<CSSParserToken> tokens = value.variableDataValue()->tokens(); On 2015/11/26 at 04:55:31, Timothy Loh wrote: > did you mean to delete the line? Yep.
The CQ bit was checked by shans@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1477093002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1477093002/20001
The CQ bit was checked by shans@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1477093002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1477093002/40001
lgtm
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by shans@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1477093002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1477093002/40001
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== Switch CSSVariableResolver to use CSSParserTokenRange internally. BUG=465126 ========== to ========== Switch CSSVariableResolver to use CSSParserTokenRange internally. BUG=465126 Committed: https://crrev.com/7ec1eb82ba5261e1f1eb9df4b202c67cbde1f690 Cr-Commit-Position: refs/heads/master@{#361868} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/7ec1eb82ba5261e1f1eb9df4b202c67cbde1f690 Cr-Commit-Position: refs/heads/master@{#361868} |