Title: [159460] trunk
Revision
159460
Author
[email protected]
Date
2013-11-18 15:08:30 -0800 (Mon, 18 Nov 2013)

Log Message

Add a quirk to not respect center text-align when positioning

<rdar://problem/15427571>
https://bugs.webkit.org/show_bug.cgi?id=124522

Reviewed by Simon Fraser.

Added fast/block/legacy-text-align-position-quirk.html

Source/WebCore: 

* page/Settings.in:
Add the quirk setting.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::startAlignedOffsetForLine):
Don't pay attention to center text-align when the quirk is set.

Source/WebKit/mac: 

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

Source/WebKit2: 

* Shared/WebPreferencesStore.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesUseLegacyTextAlignPositionedElementBehavior):
(WKPreferencesSetUseLegacyTextAlignPositionedElementBehavior):
* UIProcess/API/C/WKPreferencesPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests: 

* fast/block/legacy-text-align-position-quirk-expected.html: Added.
* fast/block/legacy-text-align-position-quirk.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (159459 => 159460)


--- trunk/LayoutTests/ChangeLog	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/LayoutTests/ChangeLog	2013-11-18 23:08:30 UTC (rev 159460)
@@ -1,3 +1,17 @@
+2013-11-18  David Hyatt  <[email protected]>
+
+        Add a quirk to not respect center text-align when positioning
+
+        <rdar://problem/15427571>
+        https://bugs.webkit.org/show_bug.cgi?id=124522
+
+        Reviewed by Simon Fraser.
+
+        Added fast/block/legacy-text-align-position-quirk.html
+
+        * fast/block/legacy-text-align-position-quirk-expected.html: Added.
+        * fast/block/legacy-text-align-position-quirk.html: Added.
+
 2013-11-18  Michał Pakuła vel Rutka  <[email protected]>
 
         Unreviewed EFL gardening

Added: trunk/LayoutTests/fast/block/legacy-text-align-position-quirk-expected.html (0 => 159460)


--- trunk/LayoutTests/fast/block/legacy-text-align-position-quirk-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/legacy-text-align-position-quirk-expected.html	2013-11-18 23:08:30 UTC (rev 159460)
@@ -0,0 +1,24 @@
+<html>
+<head>
+    <style>
+    #block {
+        margin: 0px;
+        padding: 0px;
+        position: absolute;
+        width: 200px;
+        background: blue;
+        height: 20px;
+        display: inline-block;
+    }
+    </style>
+</head>
+<body style="width: 800px;">
+    <p> The two blue bars should be aligned with each other. </p>
+    <div>
+        <span style="position: absolute; top: 44px;">
+            <div id="block"></div>
+        </span>
+    </div>
+    <div id="block" style="position: absolute; top: 80px;"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/block/legacy-text-align-position-quirk.html (0 => 159460)


--- trunk/LayoutTests/fast/block/legacy-text-align-position-quirk.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/legacy-text-align-position-quirk.html	2013-11-18 23:08:30 UTC (rev 159460)
@@ -0,0 +1,28 @@
+<html>
+<head>
+    <style>
+    #block {
+        margin: 0px;
+        padding: 0px;
+        position: absolute;
+        width: 200px;
+        background: blue;
+        height: 20px;
+        display: inline-block;
+    }
+    </style>
+    <script>
+    if (internals)
+        internals.settings.setUseLegacyTextAlignPositionedElementBehavior(true)
+    </script>
+</head>
+<body style="width: 800px;">
+    <p> The two blue bars should be aligned with each other. </p>
+    <div style="text-align: center" >
+        <span style="position: absolute; top: 44px;">
+            <div id="block"></div>
+        </span>
+    </div>
+    <div id="block" style="position: absolute; top: 80px;"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (159459 => 159460)


--- trunk/Source/WebCore/ChangeLog	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebCore/ChangeLog	2013-11-18 23:08:30 UTC (rev 159460)
@@ -1,3 +1,21 @@
+2013-11-18  David Hyatt  <[email protected]>
+
+        Add a quirk to not respect center text-align when positioning
+
+        <rdar://problem/15427571>
+        https://bugs.webkit.org/show_bug.cgi?id=124522
+
+        Reviewed by Simon Fraser.
+
+        Added fast/block/legacy-text-align-position-quirk.html
+
+        * page/Settings.in:
+        Add the quirk setting.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlock::startAlignedOffsetForLine):
+        Don't pay attention to center text-align when the quirk is set.
+
 2013-11-18  Brian J. Burg  <[email protected]>
 
         Consolidate various frame snapshot capabilities.

Modified: trunk/Source/WebCore/page/Settings.in (159459 => 159460)


--- trunk/Source/WebCore/page/Settings.in	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebCore/page/Settings.in	2013-11-18 23:08:30 UTC (rev 159460)
@@ -88,6 +88,7 @@
 acceleratedFiltersEnabled initial=false
 regionBasedColumnsEnabled initial=false
 cssGridLayoutEnabled initial=false
+useLegacyTextAlignPositionedElementBehavior initial=false
 
 # FIXME: This should really be disabled by default as it makes platforms that don't support the feature download files
 # they can't use by. Leaving enabled for now to not change existing behavior.

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (159459 => 159460)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-11-18 23:08:30 UTC (rev 159460)
@@ -2266,7 +2266,11 @@
 {
     ETextAlign textAlign = style().textAlign();
 
-    if (textAlign == TASTART) // FIXME: Handle TAEND here
+    // <rdar://problem/15427571>
+    // https://bugs.webkit.org/show_bug.cgi?id=124522
+    // This quirk is for legacy content that doesn't work properly with the center positioning scheme
+    // being honored (e.g., epubs).
+    if (textAlign == TASTART || document().settings()->useLegacyTextAlignPositionedElementBehavior()) // FIXME: Handle TAEND here
         return startOffsetForLine(position, firstLine);
 
     // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here

Modified: trunk/Source/WebKit/mac/ChangeLog (159459 => 159460)


--- trunk/Source/WebKit/mac/ChangeLog	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-11-18 23:08:30 UTC (rev 159460)
@@ -1,3 +1,23 @@
+2013-11-18  David Hyatt  <[email protected]>
+
+        Add a quirk to not respect center text-align when positioning
+
+        <rdar://problem/15427571>
+        https://bugs.webkit.org/show_bug.cgi?id=124522
+
+        Reviewed by Simon Fraser.
+
+        Added fast/block/legacy-text-align-position-quirk.html
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences useLegacyTextAlignPositionedElementBehavior]):
+        (-[WebPreferences setUseLegacyTextAlignPositionedElementBehavior:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2013-11-18  Brian J. Burg  <[email protected]>
 
         Consolidate various frame snapshot capabilities.

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (159459 => 159460)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2013-11-18 23:08:30 UTC (rev 159460)
@@ -135,6 +135,7 @@
 #define WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey @"WebKitHiddenPageDOMTimerThrottlingEnabled"
 #define WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey @"WebKitHiddenPageCSSAnimationSuspensionEnabled"
 #define WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey @"WebKitLowPowerVideoAudioBufferSizeEnabled"
+#define WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey @"WebKitUseLegacyTextAlignPositionedElementBehavior"
 
 // These are private both because callers should be using the cover methods and because the
 // cover methods themselves are private.

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (159459 => 159460)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2013-11-18 23:08:30 UTC (rev 159460)
@@ -425,6 +425,9 @@
         [NSNumber numberWithBool:NO], WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey,
         [NSNumber numberWithBool:NO], WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey,
         [NSNumber numberWithBool:NO], WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey,
+        
+        [NSNumber numberWithBool:NO], WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey,
+        
 #if !PLATFORM(IOS)
         [NSNumber numberWithBool:NO],   WebKitVideoPluginProxyEnabledKey,
 #endif
@@ -1933,6 +1936,16 @@
     [self _setBoolValue:enabled forKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
 }
 
+- (BOOL)useLegacyTextAlignPositionedElementBehavior
+{
+    return [self _boolValueForKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
+}
+
+- (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (159459 => 159460)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2013-11-18 23:08:30 UTC (rev 159460)
@@ -349,5 +349,7 @@
 - (BOOL)lowPowerVideoAudioBufferSizeEnabled;
 - (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled;
 
+- (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)flag;
+- (BOOL)useLegacyTextAlignPositionedElementBehavior;
 
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (159459 => 159460)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2013-11-18 23:08:30 UTC (rev 159460)
@@ -1719,6 +1719,8 @@
     settings.setDiagnosticLoggingEnabled([preferences diagnosticLoggingEnabled]);
     settings.setLowPowerVideoAudioBufferSizeEnabled([preferences lowPowerVideoAudioBufferSizeEnabled]);
 
+    settings.setUseLegacyTextAlignPositionedElementBehavior([preferences useLegacyTextAlignPositionedElementBehavior]);
+
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     settings->setVideoPluginProxyEnabled([preferences isVideoPluginProxyEnabled]);
 #endif

Modified: trunk/Source/WebKit2/ChangeLog (159459 => 159460)


--- trunk/Source/WebKit2/ChangeLog	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-18 23:08:30 UTC (rev 159460)
@@ -1,3 +1,22 @@
+2013-11-18  David Hyatt  <[email protected]>
+
+        Add a quirk to not respect center text-align when positioning
+
+        <rdar://problem/15427571>
+        https://bugs.webkit.org/show_bug.cgi?id=124522
+
+        Reviewed by Simon Fraser.
+
+        Added fast/block/legacy-text-align-position-quirk.html
+
+        * Shared/WebPreferencesStore.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesUseLegacyTextAlignPositionedElementBehavior):
+        (WKPreferencesSetUseLegacyTextAlignPositionedElementBehavior):
+        * UIProcess/API/C/WKPreferencesPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2013-11-18  Anders Carlsson  <[email protected]>
 
         Add State to PageLoadState

Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (159459 => 159460)


--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2013-11-18 23:08:30 UTC (rev 159460)
@@ -175,6 +175,7 @@
     macro(SimpleLineLayoutDebugBordersEnabled, simpleLineLayoutDebugBordersEnabled, Bool, bool, false) \
     macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false) \
     macro(VideoPluginProxyEnabled, isVideoPluginProxyEnabled, Bool, bool, DEFAULT_VIDEO_PLUGIN_PROXY_ENABLED) \
+    macro(UseLegacyTextAlignPositionedElementBehavior, useLegacyTextAlignPositionedElementBehavior, Bool, bool, false) \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (159459 => 159460)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2013-11-18 23:08:30 UTC (rev 159460)
@@ -544,6 +544,16 @@
     toImpl(preferencesRef)->setNeedsSiteSpecificQuirks(flag);
 }
 
+bool WKPreferencesUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->useLegacyTextAlignPositionedElementBehavior();
+}
+
+void WKPreferencesSetUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setUseLegacyTextAlignPositionedElementBehavior(flag);
+}
+
 bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef)
 {
     return toImpl(preferencesRef)->needsSiteSpecificQuirks();

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h (159459 => 159460)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h	2013-11-18 23:08:30 UTC (rev 159460)
@@ -306,6 +306,10 @@
 
 WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
 
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (159459 => 159460)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-11-18 23:07:03 UTC (rev 159459)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-11-18 23:08:30 UTC (rev 159460)
@@ -2483,6 +2483,8 @@
     settings.setSimpleLineLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutEnabledKey()));
     settings.setSimpleLineLayoutDebugBordersEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutDebugBordersEnabledKey()));
 
+    settings.setUseLegacyTextAlignPositionedElementBehavior(store.getBoolValueForKey(WebPreferencesKey::useLegacyTextAlignPositionedElementBehaviorKey()));
+
     platformPreferencesDidChange(store);
 
     if (m_drawingArea)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to