Title: [158279] trunk/Source
Revision
158279
Author
[email protected]
Date
2013-10-30 10:40:06 -0700 (Wed, 30 Oct 2013)

Log Message

Add debug settings for simple line layout
https://bugs.webkit.org/show_bug.cgi?id=123514

Source/WebCore: 

Reviewed by Andreas Kling.

* WebCore.exp.in:
* page/Settings.in:
        
    Add simpleLineLayoutEnabled and simpleLineLayoutDebugBordersEnabled.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintDebugBorders):
(WebCore::SimpleLineLayout::paintFlow):

Source/WebKit2: 

Reviewed by Andreas Kling.
        
Expose debug settings.

* Shared/WebPreferencesStore.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetSimpleLineLayoutEnabled):
(WKPreferencesGetSimpleLineLayoutEnabled):
(WKPreferencesSetSimpleLineLayoutDebugBordersEnabled):
(WKPreferencesGetSimpleLineLayoutDebugBordersEnabled):
* UIProcess/API/C/WKPreferencesPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158278 => 158279)


--- trunk/Source/WebCore/ChangeLog	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebCore/ChangeLog	2013-10-30 17:40:06 UTC (rev 158279)
@@ -1,3 +1,21 @@
+2013-10-30  Antti Koivisto  <[email protected]>
+
+        Add debug settings for simple line layout
+        https://bugs.webkit.org/show_bug.cgi?id=123514
+
+        Reviewed by Andreas Kling.
+
+        * WebCore.exp.in:
+        * page/Settings.in:
+        
+            Add simpleLineLayoutEnabled and simpleLineLayoutDebugBordersEnabled.
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseFor):
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::paintDebugBorders):
+        (WebCore::SimpleLineLayout::paintFlow):
+
 2013-10-30  [email protected]  <[email protected]>
 
         [Curl] Cookies are sometimes not set in download request.

Modified: trunk/Source/WebCore/WebCore.exp.in (158278 => 158279)


--- trunk/Source/WebCore/WebCore.exp.in	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-10-30 17:40:06 UTC (rev 158279)
@@ -1192,6 +1192,7 @@
 __ZN7WebCore8Settings25setPrivateBrowsingEnabledEb
 __ZN7WebCore8Settings25setUserStyleSheetLocationERKNS_3URLE
 __ZN7WebCore8Settings26defaultMinDOMTimerIntervalEv
+__ZN7WebCore8Settings26setSimpleLineLayoutEnabledEb
 __ZN7WebCore8Settings27setJavaEnabledForLocalFilesEb
 __ZN7WebCore8Settings27setLoadsImagesAutomaticallyEb
 __ZN7WebCore8Settings28setDOMTimerAlignmentIntervalEd
@@ -1206,6 +1207,7 @@
 __ZN7WebCore8Settings33setFontFallbackPrefersPictographsEb
 __ZN7WebCore8Settings37setScrollingPerformanceLoggingEnabledEb
 __ZN7WebCore8Settings38setLowPowerVideoAudioBufferSizeEnabledEb
+__ZN7WebCore8Settings38setSimpleLineLayoutDebugBordersEnabledEb
 __ZN7WebCore8Settings41setAcceleratedCompositedAnimationsEnabledEb
 __ZN7WebCore8Settings42setHiddenPageCSSAnimationSuspensionEnabledEb
 __ZN7WebCore8Settings45setShouldRespectPriorityInCSSAttributeSettersEb

Modified: trunk/Source/WebCore/page/Settings.in (158278 => 158279)


--- trunk/Source/WebCore/page/Settings.in	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebCore/page/Settings.in	2013-10-30 17:40:06 UTC (rev 158279)
@@ -207,3 +207,6 @@
 useLegacyBackgroundSizeShorthandBehavior initial=false
 
 minimumZoomFontSize type=float, initial=15, conditional=IOS_TEXT_AUTOSIZING
+
+simpleLineLayoutEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
+simpleLineLayoutDebugBordersEnabled initial=false, setNeedsStyleRecalcInAllFrames=1

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (158278 => 158279)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2013-10-30 17:40:06 UTC (rev 158279)
@@ -27,6 +27,7 @@
 #include "SimpleLineLayout.h"
 
 #include "FontCache.h"
+#include "Frame.h"
 #include "GraphicsContext.h"
 #include "HitTestLocation.h"
 #include "HitTestRequest.h"
@@ -38,6 +39,7 @@
 #include "RenderStyle.h"
 #include "RenderText.h"
 #include "RenderView.h"
+#include "Settings.h"
 #include "SimpleLineLayoutResolver.h"
 #include "Text.h"
 #include "TextPaintStyle.h"
@@ -59,6 +61,8 @@
     // https://bugs.webkit.org/show_bug.cgi?id=123338
     return false;
 #endif
+    if (!flow.frame().settings().simpleLineLayoutEnabled())
+        return false;
     if (!flow.firstChild())
         return false;
     // This currently covers <blockflow>#text</blockflow> case.

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (158278 => 158279)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2013-10-30 17:40:06 UTC (rev 158279)
@@ -27,6 +27,7 @@
 #include "SimpleLineLayoutFunctions.h"
 
 #include "FontCache.h"
+#include "Frame.h"
 #include "GraphicsContext.h"
 #include "HitTestLocation.h"
 #include "HitTestRequest.h"
@@ -37,6 +38,7 @@
 #include "RenderBlockFlow.h"
 #include "RenderStyle.h"
 #include "RenderText.h"
+#include "Settings.h"
 #include "SimpleLineLayoutResolver.h"
 #include "Text.h"
 #include "TextPaintStyle.h"
@@ -45,6 +47,16 @@
 namespace WebCore {
 namespace SimpleLineLayout {
 
+static void paintDebugBorders(GraphicsContext& context, const LayoutRect& borderRect, const LayoutPoint& paintOffset)
+{
+    GraphicsContextStateSaver stateSaver(context);
+    context.setStrokeColor(Color(0, 255, 0), ColorSpaceDeviceRGB);
+    context.setFillColor(Color::transparent, ColorSpaceDeviceRGB);
+    IntRect rect(pixelSnappedIntRect(borderRect));
+    rect.moveBy(flooredIntPoint(paintOffset));
+    context.drawRect(rect);
+}
+
 void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     if (paintInfo.phase != PaintPhaseForeground)
@@ -52,6 +64,8 @@
     RenderText& textRenderer = toRenderText(*flow.firstChild());
     ASSERT(!textRenderer.firstTextBox());
 
+    bool debugBordersEnabled = flow.frame().settings().simpleLineLayoutDebugBordersEnabled();
+
     RenderStyle& style = flow.style();
     const Font& font = style.font();
 
@@ -66,6 +80,8 @@
     for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
         auto run = *it;
         context.drawText(font, TextRun(run.text()), run.baseline() + paintOffset);
+        if (debugBordersEnabled)
+            paintDebugBorders(context, run.rect(), paintOffset);
     }
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (158278 => 158279)


--- trunk/Source/WebKit2/ChangeLog	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebKit2/ChangeLog	2013-10-30 17:40:06 UTC (rev 158279)
@@ -1,3 +1,22 @@
+2013-10-30  Antti Koivisto  <[email protected]>
+
+        Add debug settings for simple line layout
+        https://bugs.webkit.org/show_bug.cgi?id=123514
+
+        Reviewed by Andreas Kling.
+        
+        Expose debug settings.
+
+        * Shared/WebPreferencesStore.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetSimpleLineLayoutEnabled):
+        (WKPreferencesGetSimpleLineLayoutEnabled):
+        (WKPreferencesSetSimpleLineLayoutDebugBordersEnabled):
+        (WKPreferencesGetSimpleLineLayoutDebugBordersEnabled):
+        * UIProcess/API/C/WKPreferencesPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2013-10-30  Anders Carlsson  <[email protected]>
 
         Add stubbed out WKRemoteObjectRegistry class

Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (158278 => 158279)


--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2013-10-30 17:40:06 UTC (rev 158279)
@@ -165,6 +165,8 @@
     macro(HiddenPageCSSAnimationSuspensionEnabled, hiddenPageCSSAnimationSuspensionEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED) \
     macro(LowPowerVideoAudioBufferSizeEnabled, lowPowerVideoAudioBufferSizeEnabled, Bool, bool, false) \
     macro(ThreadedScrollingEnabled, threadedScrollingEnabled, Bool, bool, true) \
+    macro(SimpleLineLayoutEnabled, simpleLineLayoutEnabled, Bool, bool, true) \
+    macro(SimpleLineLayoutDebugBordersEnabled, simpleLineLayoutDebugBordersEnabled, Bool, bool, false) \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \

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


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2013-10-30 17:40:06 UTC (rev 158279)
@@ -1175,3 +1175,23 @@
 {
     return toImpl(preferencesRef)->threadedScrollingEnabled();
 }
+
+void WKPreferencesSetSimpleLineLayoutEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setSimpleLineLayoutEnabled(flag);
+}
+
+bool WKPreferencesGetSimpleLineLayoutEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->simpleLineLayoutEnabled();
+}
+
+void WKPreferencesSetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setSimpleLineLayoutDebugBordersEnabled(flag);
+}
+
+bool WKPreferencesGetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->simpleLineLayoutDebugBordersEnabled();
+}

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


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h	2013-10-30 17:40:06 UTC (rev 158279)
@@ -296,6 +296,14 @@
 WK_EXPORT void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef, double timeout);
 WK_EXPORT double WKPreferencesGetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef);
 
+// Defaults to true.
+WK_EXPORT void WKPreferencesSetSimpleLineLayoutEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetSimpleLineLayoutEnabled(WKPreferencesRef);
+
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef);
+
 WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
 
 #ifdef __cplusplus

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (158278 => 158279)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-10-30 17:33:39 UTC (rev 158278)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-10-30 17:40:06 UTC (rev 158279)
@@ -2453,6 +2453,8 @@
 #endif
 
     settings.setLowPowerVideoAudioBufferSizeEnabled(store.getBoolValueForKey(WebPreferencesKey::lowPowerVideoAudioBufferSizeEnabledKey()));
+    settings.setSimpleLineLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutEnabledKey()));
+    settings.setSimpleLineLayoutDebugBordersEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutDebugBordersEnabledKey()));
 
     platformPreferencesDidChange(store);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to