[GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 May 2019 10:12:14 +0000 (10:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 May 2019 10:12:14 +0000 (10:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196142

This patch introduces some experimental runtime flag to let users
disable MathML features that are removed from MathML Core [1]. For now,
LayoutTests/imported/w3c:

these features are only disabled on GTK and WPE ports. This patch also
adds a condition to disable "thin", "thick", "medium" values of
mfrac@linethickness at runtime as agreed in [2].

[1] https://mathml-refresh.github.io/mathml-core/
[2] https://github.com/mathml-refresh/mathml/issues/4

Patch by Frederic Wang <fwang@igalia.com> on 2019-05-02
Reviewed by Rob Buis.

* web-platform-tests/mathml/presentation-markup/fractions/frac-linethickness-001.html:
Explicitly enable deprecated features in this test. It should be moved
back to WebKit's test suite if/when it is updated in the upstream WPT
repository so also add a reminder for the next synchronization.

Source/WebCore:

these features are only disabled on GTK and WPE ports. This patch also
adds a condition to disable "thin", "thick", "medium" values of
mfrac@linethickness at runtime as agreed in [2].

[1] https://mathml-refresh.github.io/mathml-core/
[2] https://github.com/mathml-refresh/mathml/issues/4

Patch by Frederic Wang <fwang@igalia.com> on 2019-05-02
Reviewed by Rob Buis.

No new tests, covered by frac-linethickness-0001.html

* mathml/MathMLFractionElement.cpp:
(WebCore::MathMLFractionElement::lineThickness): Just do standard
parsing for MathML lengths when non-core MathML features are disabled.
* page/Settings.yaml: Add WebCore setting.

Source/WebKit:

these features are only disabled on GTK and WPE ports.

[1] https://mathml-refresh.github.io/mathml-core/

Patch by Frederic Wang <fwang@igalia.com> on 2019-05-02
Reviewed by Rob Buis.

* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.h:

Source/WebKitLegacy/mac:

these features are only disabled on GTK and WPE ports.

[1] https://mathml-refresh.github.io/mathml-core/

Patch by Frederic Wang <fwang@igalia.com> on 2019-05-02
Reviewed by Rob Buis.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences coreMathMLEnabled]):
(-[WebPreferences setCoreMathMLEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKitLegacy/win:

these features are only disabled on GTK and WPE ports.

[1] https://mathml-refresh.github.io/mathml-core/

Patch by Frederic Wang <fwang@igalia.com> on 2019-05-02
Reviewed by Rob Buis.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::coreMathMLEnabled):
(WebPreferences::setCoreMathMLEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Tools:

these features are only disabled on GTK and WPE ports.

[1] https://mathml-refresh.github.io/mathml-core/

Patch by Frederic Wang <fwang@igalia.com> on 2019-05-02
Reviewed by Rob Buis.

* DumpRenderTree/TestOptions.cpp:
(TestOptions::TestOptions):
* DumpRenderTree/TestOptions.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(setWebPreferencesForTestOptions):

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

23 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/fractions/frac-linethickness-001.html
Source/WebCore/ChangeLog
Source/WebCore/mathml/MathMLFractionElement.cpp
Source/WebCore/page/Settings.yaml
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/Shared/WebPreferencesDefaultValues.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/win/WebPreferences.cpp
Source/WebKitLegacy/win/WebPreferences.h
Source/WebKitLegacy/win/WebView.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.cpp
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/mac/DumpRenderTree.mm

index b67bdb6..e210bae 100644 (file)
@@ -1,3 +1,24 @@
+2019-05-02  Frederic Wang  <fwang@igalia.com>
+
+        [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=196142
+
+        This patch introduces some experimental runtime flag to let users
+        disable MathML features that are removed from MathML Core [1]. For now,
+        these features are only disabled on GTK and WPE ports. This patch also
+        adds a condition to disable "thin", "thick", "medium" values of
+        mfrac@linethickness at runtime as agreed in [2].
+
+        [1] https://mathml-refresh.github.io/mathml-core/
+        [2] https://github.com/mathml-refresh/mathml/issues/4
+
+        Reviewed by Rob Buis.
+
+        * web-platform-tests/mathml/presentation-markup/fractions/frac-linethickness-001.html:
+        Explicitly enable deprecated features in this test. It should be moved
+        back to WebKit's test suite if/when it is updated in the upstream WPT
+        repository so also add a reminder for the next synchronization.
+
 2019-05-01  Darin Adler  <darin@apple.com>
 
         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support
index 83e15c8..8ee991b 100644 (file)
@@ -1,4 +1,6 @@
-<!DOCTYPE html>
+<!DOCTYPE html> <!-- webkit-test-runner [ experimental:CoreMathMLEnabled=false ] -->
+<!-- FIXME: Ensure that thin/medium/thick/unitless values are still tested in LayoutTests/mathml with
+     CoreMathMLEnabled=false if/when this test is updated in the upstream WPT repository. -->
 <html>
   <head>
     <meta charset="utf-8">
index 70a4440..69d11d4 100644 (file)
@@ -1,3 +1,26 @@
+2019-05-02  Frederic Wang  <fwang@igalia.com>
+
+        [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=196142
+
+        This patch introduces some experimental runtime flag to let users
+        disable MathML features that are removed from MathML Core [1]. For now,
+        these features are only disabled on GTK and WPE ports. This patch also
+        adds a condition to disable "thin", "thick", "medium" values of
+        mfrac@linethickness at runtime as agreed in [2].
+
+        [1] https://mathml-refresh.github.io/mathml-core/
+        [2] https://github.com/mathml-refresh/mathml/issues/4
+
+        Reviewed by Rob Buis.
+
+        No new tests, covered by frac-linethickness-0001.html
+
+        * mathml/MathMLFractionElement.cpp:
+        (WebCore::MathMLFractionElement::lineThickness): Just do standard
+        parsing for MathML lengths when non-core MathML features are disabled.
+        * page/Settings.yaml: Add WebCore setting.
+
 2019-05-01  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthN] Adopt SecurityOrigin::isMatchingRegistrableDomainSuffix()
index 77988d5..5311934 100644 (file)
@@ -30,6 +30,7 @@
 #if ENABLE(MATHML)
 
 #include "RenderMathMLFraction.h"
+#include "Settings.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -53,10 +54,15 @@ const MathMLElement::Length& MathMLFractionElement::lineThickness()
     if (m_lineThickness)
         return m_lineThickness.value();
 
+    auto& thickness = attributeWithoutSynchronization(linethicknessAttr);
+    if (document().settings().coreMathMLEnabled()) {
+        m_lineThickness = parseMathMLLength(thickness);
+        return m_lineThickness.value();
+    }
+
     // The MathML3 recommendation states that "medium" is the default thickness.
     // However, it only states that "thin" and "thick" are respectively thiner and thicker.
     // The MathML in HTML5 implementation note suggests 50% and 200% and these values are also used in Gecko.
-    auto& thickness = attributeWithoutSynchronization(linethicknessAttr);
     m_lineThickness = Length();
     if (equalLettersIgnoringASCIICase(thickness, "thin")) {
         m_lineThickness.value().type = LengthType::UnitLess;
index e47d7eb..d30c815 100644 (file)
@@ -824,6 +824,10 @@ editableImagesEnabled:
 adClickAttributionEnabled:
   initial: false
 
+coreMathMLEnabled:
+  initial: false
+  onChange: setNeedsRecalcStyleInAllFrames
+
 blockingOfSmallPluginsEnabled:
   initial: true
 
index 4da3384..b65e6c3 100644 (file)
@@ -1,3 +1,19 @@
+2019-05-02  Frederic Wang  <fwang@igalia.com>
+
+        [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=196142
+
+        This patch introduces some experimental runtime flag to let users
+        disable MathML features that are removed from MathML Core [1]. For now,
+        these features are only disabled on GTK and WPE ports.
+
+        [1] https://mathml-refresh.github.io/mathml-core/
+
+        Reviewed by Rob Buis.
+
+        * Shared/WebPreferences.yaml:
+        * Shared/WebPreferencesDefaultValues.h:
+
 2019-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Add the ability to import WebKitAdditions snippets in WebKit.apinotes
index cd9326e..20156d0 100644 (file)
@@ -1650,6 +1650,13 @@ PageAtRuleSupportEnabled:
   category: experimental
   webcoreBinding: RuntimeEnabledFeatures
 
+CoreMathMLEnabled:
+  type: bool
+  defaultValue: DEFAULT_CORE_MATHML_ENABLED
+  humanReadableName: "MathML Core"
+  humanReadableDescription: "Disable features removed from the MathML Core spec."
+  category: experimental
+
 ApplePayRemoteUIEnabled:
   category: internal
   condition: ENABLE(APPLE_PAY_REMOTE_UI)
index a5bcbd4..3643966 100644 (file)
 #define DEFAULT_WEBKIT_TABSTOLINKS_ENABLED false
 #endif
 
+#if PLATFORM(GTK) || PLATFORM(WPE)
+#define DEFAULT_CORE_MATHML_ENABLED true
+#else
+#define DEFAULT_CORE_MATHML_ENABLED false
+#endif
+
 #if ENABLE(SMOOTH_SCROLLING)
 #define DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED true
 #else
index 1e97046..d924bdf 100644 (file)
@@ -1,3 +1,25 @@
+2019-05-02  Frederic Wang  <fwang@igalia.com>
+
+        [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=196142
+
+        This patch introduces some experimental runtime flag to let users
+        disable MathML features that are removed from MathML Core [1]. For now,
+        these features are only disabled on GTK and WPE ports.
+
+        [1] https://mathml-refresh.github.io/mathml-core/
+
+        Reviewed by Rob Buis.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences coreMathMLEnabled]):
+        (-[WebPreferences setCoreMathMLEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2019-04-29  Alex Christensen  <achristensen@webkit.org>
 
         <rdar://problem/50299396> Fix internal High Sierra build
index 2b5e73f..1dcbc25 100644 (file)
 #define WebKitAdClickAttributionEnabledPreferenceKey @"WebKitAdClickAttributionEnabled"
 #define WebKitReferrerPolicyAttributeEnabledPreferenceKey @"WebKitReferrerPolicyAttributeEnabled"
 #define WebKitResizeObserverEnabledPreferenceKey @"WebKitResizeObserverEnabled"
+#define WebKitCoreMathMLEnabledPreferenceKey @"WebKitCoreMathMLEnabled"
+
index fc524f7..9f1c226 100644 (file)
@@ -691,6 +691,7 @@ public:
 #if ENABLE(RESIZE_OBSERVER)
         @NO, WebKitResizeObserverEnabledPreferenceKey,
 #endif
+        @NO, WebKitCoreMathMLEnabledPreferenceKey,
         nil];
 
 #if !PLATFORM(IOS_FAMILY)
@@ -3456,6 +3457,17 @@ static NSString *classIBCreatorID = nil;
 {
     [self _setBoolValue:flag forKey:WebKitResizeObserverEnabledPreferenceKey];
 }
+
+- (BOOL)coreMathMLEnabled
+{
+    return [self _boolValueForKey:WebKitCoreMathMLEnabledPreferenceKey];
+}
+
+- (void)setCoreMathMLEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitCoreMathMLEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)
index f4c5ff3..4c6581f 100644 (file)
@@ -603,6 +603,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
 - (void)setReferrerPolicyAttributeEnabled:(BOOL)flag;
 - (BOOL)referrerPolicyAttributeEnabled;
 
+- (void)setCoreMathMLEnabled:(BOOL)flag;
+- (BOOL)coreMathMLEnabled;
+
 @property (nonatomic) BOOL visualViewportAPIEnabled;
 @property (nonatomic) BOOL CSSOMViewScrollingAPIEnabled;
 @property (nonatomic) BOOL largeImageAsyncDecodingEnabled;
@@ -635,6 +638,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
 @property (nonatomic) BOOL sourceBufferChangeTypeEnabled;
 @property (nonatomic) BOOL referrerPolicyAttributeEnabled;
 @property (nonatomic) BOOL resizeObserverEnabled;
+@property (nonatomic) BOOL coreMathMLEnabled;
 
 #if TARGET_OS_IPHONE
 @property (nonatomic) BOOL quickLookDocumentSavingEnabled;
index 3998a5b..16dd65b 100644 (file)
@@ -3214,6 +3214,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings.setAnimatedImageAsyncDecodingEnabled([preferences animatedImageAsyncDecodingEnabled]);
     settings.setMediaCapabilitiesEnabled([preferences mediaCapabilitiesEnabled]);
 
+    settings.setCoreMathMLEnabled([preferences coreMathMLEnabled]);
+
     RuntimeEnabledFeatures::sharedFeatures().setServerTimingEnabled([preferences serverTimingEnabled]);
 
     settings.setSelectionAcrossShadowBoundariesEnabled(preferences.selectionAcrossShadowBoundariesEnabled);
index b0d1ee4..1c8ff84 100644 (file)
@@ -1,3 +1,26 @@
+2019-05-02  Frederic Wang  <fwang@igalia.com>
+
+        [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=196142
+
+        This patch introduces some experimental runtime flag to let users
+        disable MathML features that are removed from MathML Core [1]. For now,
+        these features are only disabled on GTK and WPE ports.
+
+        [1] https://mathml-refresh.github.io/mathml-core/
+
+        Reviewed by Rob Buis.
+
+        * Interfaces/IWebPreferencesPrivate.idl:
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::coreMathMLEnabled):
+        (WebPreferences::setCoreMathMLEnabled):
+        * WebPreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2019-04-24  Zalan Bujtas  <zalan@apple.com>
 
         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
index ed8b1cc..cb8dda4 100644 (file)
@@ -240,4 +240,6 @@ interface IWebPreferencesPrivate7 : IWebPreferencesPrivate6
     HRESULT setCrossOriginWindowPolicySupportEnabled([in] BOOL enabled);
     HRESULT resizeObserverEnabled([out, retval] BOOL*);
     HRESULT setResizeObserverEnabled([in] BOOL enabled);
+    HRESULT coreMathMLEnabled([out, retval] BOOL* enabled);
+    HRESULT setCoreMathMLEnabled([in] BOOL enabled);
 }
index 413a6fd..ba66270 100644 (file)
 #define WebKitCSSOMViewScrollingAPIEnabledPreferenceKey "WebKitCSSOMViewScrollingAPIEnabled"
 
 #define WebKitResizeObserverEnabledPreferenceKey "WebKitResizeObserverEnabled"
+
+#define WebKitCoreMathMLEnabledPreferenceKey "WebKitCoreMathMLEnabled"
index 9023e3f..1394868 100644 (file)
@@ -331,6 +331,8 @@ void WebPreferences::initializeDefaultSettings()
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitResizeObserverEnabledPreferenceKey), kCFBooleanFalse);
 
+    CFDictionaryAddValue(defaults, CFSTR(WebKitCoreMathMLEnabledPreferenceKey), kCFBooleanFalse);
+
     defaultSettings = defaults;
 }
 
@@ -2201,6 +2203,20 @@ HRESULT WebPreferences::setCSSOMViewScrollingAPIEnabled(BOOL enabled)
     return S_OK;
 }
 
+HRESULT WebPreferences::coreMathMLEnabled(_Out_ BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = boolValueForKey(WebKitCoreMathMLEnabledPreferenceKey);
+    return S_OK;
+}
+
+HRESULT WebPreferences::setCoreMathMLEnabled(BOOL enabled)
+{
+    setBoolValue(WebKitCoreMathMLEnabledPreferenceKey, enabled);
+    return S_OK;
+}
+
 HRESULT WebPreferences::setApplicationId(BSTR applicationId)
 {
     m_applicationId = String(applicationId).createCFString();
index 6eba17c..5ee6427 100644 (file)
@@ -285,6 +285,8 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setCrossOriginWindowPolicySupportEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE resizeObserverEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setResizeObserverEnabled(BOOL);
+    virtual HRESULT STDMETHODCALLTYPE coreMathMLEnabled(_Out_ BOOL*);
+    virtual HRESULT STDMETHODCALLTYPE setCoreMathMLEnabled(BOOL);
 
     // WebPreferences
 
index 381f1a6..10fad78 100644 (file)
@@ -5601,6 +5601,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
         return hr;
     settings.setResizeObserverEnabled(!!enabled);
 
+    hr = prefsPrivate->coreMathMLEnabled(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings.setCoreMathMLEnabled(!!enabled);
+
     return S_OK;
 }
 
index 68cf46b..5022fc6 100644 (file)
@@ -1,3 +1,22 @@
+2019-05-02  Frederic Wang  <fwang@igalia.com>
+
+        [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=196142
+
+        This patch introduces some experimental runtime flag to let users
+        disable MathML features that are removed from MathML Core [1]. For now,
+        these features are only disabled on GTK and WPE ports.
+
+        [1] https://mathml-refresh.github.io/mathml-core/
+
+        Reviewed by Rob Buis.
+
+        * DumpRenderTree/TestOptions.cpp:
+        (TestOptions::TestOptions):
+        * DumpRenderTree/TestOptions.h:
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (setWebPreferencesForTestOptions):
+
 2019-05-01  Don Olmstead  <don.olmstead@sony.com>
 
         TestWebKitAPI config.h should be aware of what suite is being built
index 0c93c80..3ca91c4 100644 (file)
@@ -113,6 +113,8 @@ TestOptions::TestOptions(const std::string& pathOrURL, const std::string& absolu
             adClickAttributionEnabled = parseBooleanTestHeaderValue(value);
         else if (key == "experimental:ResizeObserverEnabled")
             enableResizeObserver = parseBooleanTestHeaderValue(value);
+        else if (key == "experimental:CoreMathMLEnabled")
+            enableCoreMathML = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }
index d885edb..f4eb671 100644 (file)
@@ -47,6 +47,7 @@ struct TestOptions {
     bool enableCSSLogical { false };
     bool adClickAttributionEnabled { false };
     bool enableResizeObserver { false };
+    bool enableCoreMathML { false };
     std::string jscOptions;
 
     TestOptions(const std::string& pathOrURL, const std::string& absolutePath);
index 4935322..9fb0a47 100644 (file)
@@ -1019,6 +1019,7 @@ static void setWebPreferencesForTestOptions(const TestOptions& options)
     preferences.CSSLogicalEnabled = options.enableCSSLogical;
     preferences.adClickAttributionEnabled = options.adClickAttributionEnabled;
     preferences.resizeObserverEnabled = options.enableResizeObserver;
+    preferences.coreMathMLEnabled = options.enableCoreMathML;
 }
 
 // Called once on DumpRenderTree startup.