From bb3c3be4c96a204d8ef6ff0107447e8537bf9442 Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Thu, 15 Feb 2018 19:48:40 +0900 Subject: [PATCH] Allow @supports and @viewport (without checking) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is a temporary workaround that adds an interim/initial/partial level of support for allowing the @supports and @viewport at-rules. The intent is that we’ll add full support for them later, and then at that time back this change out (because adding real, full support will make it unnecessary). This change simply causes no errors to be reported for stylesheets that use @supports and @viewport. Beyond that, it doesn’t add any checking to report an error if the content of a particular @supports at-rule or @viewport at-rule doesn’t conform to the requirements in the relevant CSS specs. Addresses https://github.com/w3c/css-validator/issues/71 --- org/w3c/css/parser/analyzer/CssParser.java | 67 +++++++++++----------- org/w3c/css/parser/analyzer/CssParser.jj | 5 +- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/org/w3c/css/parser/analyzer/CssParser.java b/org/w3c/css/parser/analyzer/CssParser.java index e8f9f9a18..89d2f5429 100644 --- a/org/w3c/css/parser/analyzer/CssParser.java +++ b/org/w3c/css/parser/analyzer/CssParser.java @@ -2412,7 +2412,10 @@ final public void ignoreStatement() throws ParseException { addAtRuleError(); } } else { - addAtRuleError(); + if (!n.toString().startsWith("@supports") + && !n.toString().startsWith("@viewport")) { + addAtRuleError(); + } } skipStatement(); } @@ -5743,37 +5746,6 @@ private boolean jj_2_5(int xla) finally { jj_save(4, xla); } } - private boolean jj_3R_175() - { - if (jj_scan_token(STRING)) return true; - return false; - } - - private boolean jj_3R_154() - { - if (jj_scan_token(PLUS)) return true; - return false; - } - - private boolean jj_3R_174() - { - if (jj_3R_183()) return true; - return false; - } - - private boolean jj_3_5() - { - if (jj_3R_127()) return true; - if (jj_scan_token(LPARAN)) return true; - return false; - } - - private boolean jj_3R_173() - { - if (jj_3R_152()) return true; - return false; - } - private boolean jj_3R_172() { if (jj_3R_151()) return true; @@ -6387,6 +6359,37 @@ private boolean jj_3R_176() return false; } + private boolean jj_3R_175() + { + if (jj_scan_token(STRING)) return true; + return false; + } + + private boolean jj_3R_154() + { + if (jj_scan_token(PLUS)) return true; + return false; + } + + private boolean jj_3R_174() + { + if (jj_3R_183()) return true; + return false; + } + + private boolean jj_3_5() + { + if (jj_3R_127()) return true; + if (jj_scan_token(LPARAN)) return true; + return false; + } + + private boolean jj_3R_173() + { + if (jj_3R_152()) return true; + return false; + } + /** Generated Token Manager. */ public CssParserTokenManager token_source; SimpleCharStream jj_input_stream; diff --git a/org/w3c/css/parser/analyzer/CssParser.jj b/org/w3c/css/parser/analyzer/CssParser.jj index e354d045f..2344d7eab 100644 --- a/org/w3c/css/parser/analyzer/CssParser.jj +++ b/org/w3c/css/parser/analyzer/CssParser.jj @@ -1553,7 +1553,10 @@ void atRuleDeclaration() : addAtRuleError(); } } else { - addAtRuleError(); + if (!n.toString().startsWith("@supports") + && !n.toString().startsWith("@viewport")) { + addAtRuleError(); + } } skipStatement(); }