Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(314)

Issue 4662076: Css parsing fails if @charset is present in css. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 4 months ago by pulkitgoyal2000
Modified:
14 years, 4 months ago
Reviewers:
anupama.dutta, Jasvir, google-caja-discuss, MikeSamuel, cool-shindig-committers, satya3656
Base URL:
http://google-caja.googlecode.com/svn/trunk
Visibility:
Public.

Description

Css parsing fails if @charset is present in the css. Why it fails? Actual CSS grammar: (ref : http://www.w3.org/TR/CSS21/grammar.html) stylesheet : [ CHARSET_SYM STRING ';' ]? [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* [ [ ruleset | media | page ] [S|CDO|CDC]* ]* As per the code CSS grammar of the css parser stylesheet : [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* [ [ ruleset | media | page ] [S|CDO|CDC]* ]*

Patch Set 1 #

Patch Set 2 : Updating with correct patch #

Patch Set 3 : Patch included missing file & doc comment in CssTree #

Total comments: 8

Patch Set 4 : Addressing Satya's Comment #

Total comments: 4

Patch Set 5 : Addressing Mike & Anupama's comments. #

Total comments: 3

Patch Set 6 : Addressing Comments #

Total comments: 8

Patch Set 7 : checking "@charset " instead of "@charset" #

Patch Set 8 : Little code refactoring #

Unified diffs Side-by-side diffs Delta from patch set Stats (+160 lines, -14 lines) Patch
src/com/google/caja/lexer/CssLexer.java View 1 2 3 4 5 6 1 chunk +6 lines, -1 line 0 comments Download
src/com/google/caja/parser/css/CssParser.java View 1 2 3 4 5 6 7 4 chunks +50 lines, -2 lines 0 comments Download
src/com/google/caja/parser/css/CssTree.java View 1 2 3 4 5 6 1 chunk +37 lines, -0 lines 0 comments Download
tests/com/google/caja/parser/css/CssParserTest.java View 1 2 3 4 5 2 chunks +25 lines, -11 lines 0 comments Download
tests/com/google/caja/parser/css/CssTreeTest.java View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
tests/com/google/caja/parser/css/cssparsergolden6.txt View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download
tests/com/google/caja/parser/css/cssparsergolden7.txt View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
tests/com/google/caja/parser/css/cssparserinput6.css View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
tests/com/google/caja/parser/css/cssparserinput7.css View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
tests/com/google/caja/parser/css/cssrendergolden6.txt View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
tests/com/google/caja/parser/css/csssnippets7.txt View 1 2 3 4 5 1 chunk +9 lines, -0 lines 0 comments Download

Messages

Total messages: 13
pulkitgoyal2000
14 years, 4 months ago (2011-07-04 10:36:47 UTC) #1
satya3656
http://codereview.appspot.com/4662076/diff/9001/src/com/google/caja/parser/css/CssParser.java File src/com/google/caja/parser/css/CssParser.java (right): http://codereview.appspot.com/4662076/diff/9001/src/com/google/caja/parser/css/CssParser.java#newcode225 src/com/google/caja/parser/css/CssParser.java:225: skipTopLevelIgnorables(); @charset if present should be first in the ...
14 years, 4 months ago (2011-07-04 13:56:31 UTC) #2
pulkitgoyal2000
http://codereview.appspot.com/4662076/diff/9001/src/com/google/caja/parser/css/CssParser.java File src/com/google/caja/parser/css/CssParser.java (right): http://codereview.appspot.com/4662076/diff/9001/src/com/google/caja/parser/css/CssParser.java#newcode225 src/com/google/caja/parser/css/CssParser.java:225: skipTopLevelIgnorables(); On 2011/07/04 13:56:31, satya3656 wrote: > @charset if ...
14 years, 4 months ago (2011-07-04 14:34:33 UTC) #3
anupama.dutta
Some high level suggestions (summarizing my offline discussion with Pulkit): Ideally, we should do the ...
14 years, 4 months ago (2011-07-04 15:24:24 UTC) #4
anupama.dutta
Adding back the discussion groups so that the suggestions are visible to all. Thanks, Anupama. ...
14 years, 4 months ago (2011-07-04 15:26:55 UTC) #5
MikeSamuel
http://codereview.appspot.com/4662076/diff/13001/src/com/google/caja/parser/css/CssParser.java File src/com/google/caja/parser/css/CssParser.java (right): http://codereview.appspot.com/4662076/diff/13001/src/com/google/caja/parser/css/CssParser.java#newcode287 src/com/google/caja/parser/css/CssParser.java:287: List<CssTree> children = Lists.newArrayList(1); Prefer List<CssTree> children = Collections.<CssTree>singletonList(charset); ...
14 years, 4 months ago (2011-07-04 19:54:12 UTC) #6
pulkitgoyal2000
http://codereview.appspot.com/4662076/diff/13001/src/com/google/caja/parser/css/CssParser.java File src/com/google/caja/parser/css/CssParser.java (right): http://codereview.appspot.com/4662076/diff/13001/src/com/google/caja/parser/css/CssParser.java#newcode287 src/com/google/caja/parser/css/CssParser.java:287: List<CssTree> children = Lists.newArrayList(1); On 2011/07/04 19:54:12, MikeSamuel wrote: ...
14 years, 4 months ago (2011-07-05 06:42:17 UTC) #7
Jasvir
LGTM +1 to anupama's summary. The patch renders @charsets with UTF-8 only. HTTP headers override ...
14 years, 4 months ago (2011-07-05 09:30:45 UTC) #8
pulkitgoyal2000
http://codereview.appspot.com/4662076/diff/9001/src/com/google/caja/parser/css/CssParser.java File src/com/google/caja/parser/css/CssParser.java (right): http://codereview.appspot.com/4662076/diff/9001/src/com/google/caja/parser/css/CssParser.java#newcode274 src/com/google/caja/parser/css/CssParser.java:274: expectSymbol("@charset"); On 2011/07/04 15:24:24, anupama.dutta wrote: > Should we ...
14 years, 4 months ago (2011-07-05 10:20:46 UTC) #9
anupama.dutta
http://codereview.appspot.com/4662076/diff/6004/src/com/google/caja/parser/css/CssParser.java File src/com/google/caja/parser/css/CssParser.java (right): http://codereview.appspot.com/4662076/diff/6004/src/com/google/caja/parser/css/CssParser.java#newcode225 src/com/google/caja/parser/css/CssParser.java:225: if (lookaheadSymbol("@charset")) { In http://www.w3.org/TR/CSS21/grammar.html, the CHARSET_SYM is allowed ...
14 years, 4 months ago (2011-07-05 11:37:55 UTC) #10
pulkitgoyal2000
http://codereview.appspot.com/4662076/diff/6004/src/com/google/caja/parser/css/CssParser.java File src/com/google/caja/parser/css/CssParser.java (right): http://codereview.appspot.com/4662076/diff/6004/src/com/google/caja/parser/css/CssParser.java#newcode225 src/com/google/caja/parser/css/CssParser.java:225: if (lookaheadSymbol("@charset")) { On 2011/07/05 11:37:55, anupama.dutta wrote: > ...
14 years, 4 months ago (2011-07-05 12:27:49 UTC) #11
anupama.dutta
LGTM.
14 years, 4 months ago (2011-07-05 15:04:03 UTC) #12
pulkitgoyal2000
14 years, 4 months ago (2011-07-05 17:25:19 UTC) #13
Thanks..
committed as r4536
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b