Remove MediaWiki site specific quirks
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 06:09:58 +0000 (06:09 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 06:09:58 +0000 (06:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195597

Reviewed by Simon Fraser.

r47383 added a site specific quirk for the KHTML workaround in MediaWiki.

Blink since removed this workaround:
https://github.com/chromium/chromium/commit/ecf84fc9c1a51c8ede7adfd0b0cba446d9a8caa0

Given Chrome has been shipping without this quirk for six years, it's safe to assume
this site specific quirk is no longer neeed for Web compatibility.

* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242780 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/StyleSheetContents.cpp
Source/WebCore/css/parser/CSSParserContext.cpp
Source/WebCore/css/parser/CSSParserContext.h

index ce9bc4f..af8db6e 100644 (file)
@@ -1,3 +1,26 @@
+2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove MediaWiki site specific quirks
+        https://bugs.webkit.org/show_bug.cgi?id=195597
+
+        Reviewed by Simon Fraser.
+
+        r47383 added a site specific quirk for the KHTML workaround in MediaWiki.
+
+        Blink since removed this workaround:
+        https://github.com/chromium/chromium/commit/ecf84fc9c1a51c8ede7adfd0b0cba446d9a8caa0
+
+        Given Chrome has been shipping without this quirk for six years, it's safe to assume
+        this site specific quirk is no longer neeed for Web compatibility.
+
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::parseAuthorStyleSheet):
+        * css/parser/CSSParserContext.cpp:
+        (WebCore::CSSParserContext::CSSParserContext):
+        (WebCore::operator==):
+        * css/parser/CSSParserContext.h:
+        (WebCore::CSSParserContextHash::hash):
+
 2019-03-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         Remove OpenCube QuickMenu quirks from navigator.appVersion
index e8ac0c1..7a6b40f 100644 (file)
@@ -337,18 +337,7 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached
         return;
     }
 
-    CSSParser p(parserContext());
-    p.parseSheet(this, sheetText, CSSParser::RuleParsing::Deferred);
-
-    if (m_parserContext.needsSiteSpecificQuirks && isStrictParserMode(m_parserContext.mode)) {
-        // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>.
-        static NeverDestroyed<const String> mediaWikiKHTMLFixesStyleSheet(MAKE_STATIC_STRING_IMPL("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n"));
-        // There are two variants of KHTMLFixes.css. One is equal to mediaWikiKHTMLFixesStyleSheet,
-        // while the other lacks the second trailing newline.
-        if (baseURL().string().endsWith("/KHTMLFixes.css") && !sheetText.isNull() && mediaWikiKHTMLFixesStyleSheet.get().startsWith(sheetText)
-            && sheetText.length() >= mediaWikiKHTMLFixesStyleSheet.get().length() - 1)
-            clearRules();
-    }
+    CSSParser(parserContext()).parseSheet(this, sheetText, CSSParser::RuleParsing::Deferred);
 }
 
 bool StyleSheetContents::parseString(const String& sheetText)
index 06c702a..e3d0532 100644 (file)
@@ -44,12 +44,6 @@ CSSParserContext::CSSParserContext(CSSParserMode mode, const URL& baseURL)
     : baseURL(baseURL)
     , mode(mode)
 {
-#if PLATFORM(IOS_FAMILY)
-    // FIXME: Force the site specific quirk below to work on iOS. Investigating other site specific quirks
-    // to see if we can enable the preference all together is to be handled by:
-    // <rdar://problem/8493309> Investigate Enabling Site Specific Quirks in MobileSafari and UIWebView
-    needsSiteSpecificQuirks = true;
-#endif
 }
 
 CSSParserContext::CSSParserContext(const Document& document, const URL& sheetBaseURL, const String& charset)
@@ -59,8 +53,6 @@ CSSParserContext::CSSParserContext(const Document& document, const URL& sheetBas
     , isHTMLDocument(document.isHTMLDocument())
     , hasDocumentSecurityOrigin(sheetBaseURL.isNull() || document.securityOrigin().canRequest(baseURL))
 {
-
-    needsSiteSpecificQuirks = document.settings().needsSiteSpecificQuirks();
     enforcesCSSMIMETypeInNoQuirksMode = document.settings().enforceCSSMIMETypeInNoQuirksMode();
     useLegacyBackgroundSizeShorthandBehavior = document.settings().useLegacyBackgroundSizeShorthandBehavior();
 #if ENABLE(TEXT_AUTOSIZING)
@@ -74,13 +66,6 @@ CSSParserContext::CSSParserContext(const Document& document, const URL& sheetBas
 #endif
     deferredCSSParserEnabled = document.settings().deferredCSSParserEnabled();
     useSystemAppearance = document.page() ? document.page()->useSystemAppearance() : false;
-
-#if PLATFORM(IOS_FAMILY)
-    // FIXME: Force the site specific quirk below to work on iOS. Investigating other site specific quirks
-    // to see if we can enable the preference all together is to be handled by:
-    // <rdar://problem/8493309> Investigate Enabling Site Specific Quirks in MobileSafari and UIWebView
-    needsSiteSpecificQuirks = true;
-#endif
 }
 
 bool operator==(const CSSParserContext& a, const CSSParserContext& b)
@@ -92,7 +77,6 @@ bool operator==(const CSSParserContext& a, const CSSParserContext& b)
 #if ENABLE(TEXT_AUTOSIZING)
         && a.textAutosizingEnabled == b.textAutosizingEnabled
 #endif
-        && a.needsSiteSpecificQuirks == b.needsSiteSpecificQuirks
         && a.enforcesCSSMIMETypeInNoQuirksMode == b.enforcesCSSMIMETypeInNoQuirksMode
         && a.useLegacyBackgroundSizeShorthandBehavior == b.useLegacyBackgroundSizeShorthandBehavior
         && a.springTimingFunctionEnabled == b.springTimingFunctionEnabled
index 758b6ee..e0c5759 100644 (file)
@@ -49,7 +49,6 @@ public:
 #if ENABLE(TEXT_AUTOSIZING)
     bool textAutosizingEnabled { false };
 #endif
-    bool needsSiteSpecificQuirks { false };
     bool enforcesCSSMIMETypeInNoQuirksMode { true };
     bool useLegacyBackgroundSizeShorthandBehavior { false };
     bool springTimingFunctionEnabled { false };
@@ -94,19 +93,18 @@ struct CSSParserContextHash {
 #if ENABLE(TEXT_AUTOSIZING)
             & key.textAutosizingEnabled                     << 1
 #endif
-            & key.needsSiteSpecificQuirks                   << 2
-            & key.enforcesCSSMIMETypeInNoQuirksMode         << 3
-            & key.useLegacyBackgroundSizeShorthandBehavior  << 4
-            & key.springTimingFunctionEnabled               << 5
-            & key.constantPropertiesEnabled                 << 6
-            & key.colorFilterEnabled                        << 7
-            & key.deferredCSSParserEnabled                  << 8
-            & key.hasDocumentSecurityOrigin                 << 9
-            & key.useSystemAppearance                       << 10
+            & key.enforcesCSSMIMETypeInNoQuirksMode         << 2
+            & key.useLegacyBackgroundSizeShorthandBehavior  << 3
+            & key.springTimingFunctionEnabled               << 4
+            & key.constantPropertiesEnabled                 << 5
+            & key.colorFilterEnabled                        << 6
+            & key.deferredCSSParserEnabled                  << 7
+            & key.hasDocumentSecurityOrigin                 << 8
+            & key.useSystemAppearance                       << 9
 #if ENABLE(ATTACHMENT_ELEMENT)
-            & key.attachmentEnabled                         << 11
+            & key.attachmentEnabled                         << 10
 #endif
-            & key.mode                                      << 12; // Keep this last.
+            & key.mode                                      << 11; // Keep this last.
         hash ^= WTF::intHash(bits);
         return hash;
     }