Commit 2ec05012 authored by antti@apple.com's avatar antti@apple.com
Browse files

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):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158279 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 512a8e85
2013-10-30 Antti Koivisto <antti@apple.com>
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 peavo@outlook.com <peavo@outlook.com>
[Curl] Cookies are sometimes not set in download request.
......
......@@ -1192,6 +1192,7 @@ __ZN7WebCore8Settings25setMinimumLogicalFontSizeEi
__ZN7WebCore8Settings25setPrivateBrowsingEnabledEb
__ZN7WebCore8Settings25setUserStyleSheetLocationERKNS_3URLE
__ZN7WebCore8Settings26defaultMinDOMTimerIntervalEv
__ZN7WebCore8Settings26setSimpleLineLayoutEnabledEb
__ZN7WebCore8Settings27setJavaEnabledForLocalFilesEb
__ZN7WebCore8Settings27setLoadsImagesAutomaticallyEb
__ZN7WebCore8Settings28setDOMTimerAlignmentIntervalEd
......@@ -1206,6 +1207,7 @@ __ZN7WebCore8Settings33setAggressiveTileRetentionEnabledEb
__ZN7WebCore8Settings33setFontFallbackPrefersPictographsEb
__ZN7WebCore8Settings37setScrollingPerformanceLoggingEnabledEb
__ZN7WebCore8Settings38setLowPowerVideoAudioBufferSizeEnabledEb
__ZN7WebCore8Settings38setSimpleLineLayoutDebugBordersEnabledEb
__ZN7WebCore8Settings41setAcceleratedCompositedAnimationsEnabledEb
__ZN7WebCore8Settings42setHiddenPageCSSAnimationSuspensionEnabledEb
__ZN7WebCore8Settings45setShouldRespectPriorityInCSSAttributeSettersEb
......
......@@ -207,3 +207,6 @@ selectionIncludesAltImageText initial=true
useLegacyBackgroundSizeShorthandBehavior initial=false
minimumZoomFontSize type=float, initial=15, conditional=IOS_TEXT_AUTOSIZING
simpleLineLayoutEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
simpleLineLayoutDebugBordersEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
......@@ -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 @@ bool canUseFor(const RenderBlockFlow& flow)
// 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.
......
......@@ -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 @@ void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& pai
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 @@ void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& pai
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);
}
}
......
2013-10-30 Antti Koivisto <antti@apple.com>
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 <andersca@apple.com>
Add stubbed out WKRemoteObjectRegistry class
......
......@@ -165,6 +165,8 @@ namespace WebKit {
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) \
......
......@@ -1175,3 +1175,23 @@ bool WKPreferencesGetThreadedScrollingEnabled(WKPreferencesRef preferencesRef)
{
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();
}
......@@ -296,6 +296,14 @@ WK_EXPORT bool WKPreferencesGetThreadedScrollingEnabled(WKPreferencesRef prefere
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
......
......@@ -2453,6 +2453,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
#endif
settings.setLowPowerVideoAudioBufferSizeEnabled(store.getBoolValueForKey(WebPreferencesKey::lowPowerVideoAudioBufferSizeEnabledKey()));
settings.setSimpleLineLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutEnabledKey()));
settings.setSimpleLineLayoutDebugBordersEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutDebugBordersEnabledKey()));
platformPreferencesDidChange(store);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment