Changeset 158279 in webkit


Ignore:
Timestamp:
Oct 30, 2013 10:40:06 AM (10 years ago)
Author:
Antti Koivisto
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):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r158277 r158279  
     12013-10-30  Antti Koivisto  <antti@apple.com>
     2
     3        Add debug settings for simple line layout
     4        https://bugs.webkit.org/show_bug.cgi?id=123514
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCore.exp.in:
     9        * page/Settings.in:
     10       
     11            Add simpleLineLayoutEnabled and simpleLineLayoutDebugBordersEnabled.
     12
     13        * rendering/SimpleLineLayout.cpp:
     14        (WebCore::SimpleLineLayout::canUseFor):
     15        * rendering/SimpleLineLayoutFunctions.cpp:
     16        (WebCore::SimpleLineLayout::paintDebugBorders):
     17        (WebCore::SimpleLineLayout::paintFlow):
     18
    1192013-10-30  peavo@outlook.com  <peavo@outlook.com>
    220
  • trunk/Source/WebCore/WebCore.exp.in

    r158230 r158279  
    11931193__ZN7WebCore8Settings25setUserStyleSheetLocationERKNS_3URLE
    11941194__ZN7WebCore8Settings26defaultMinDOMTimerIntervalEv
     1195__ZN7WebCore8Settings26setSimpleLineLayoutEnabledEb
    11951196__ZN7WebCore8Settings27setJavaEnabledForLocalFilesEb
    11961197__ZN7WebCore8Settings27setLoadsImagesAutomaticallyEb
     
    12071208__ZN7WebCore8Settings37setScrollingPerformanceLoggingEnabledEb
    12081209__ZN7WebCore8Settings38setLowPowerVideoAudioBufferSizeEnabledEb
     1210__ZN7WebCore8Settings38setSimpleLineLayoutDebugBordersEnabledEb
    12091211__ZN7WebCore8Settings41setAcceleratedCompositedAnimationsEnabledEb
    12101212__ZN7WebCore8Settings42setHiddenPageCSSAnimationSuspensionEnabledEb
  • trunk/Source/WebCore/page/Settings.in

    r158129 r158279  
    208208
    209209minimumZoomFontSize type=float, initial=15, conditional=IOS_TEXT_AUTOSIZING
     210
     211simpleLineLayoutEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
     212simpleLineLayoutDebugBordersEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
  • trunk/Source/WebCore/rendering/SimpleLineLayout.cpp

    r158268 r158279  
    2828
    2929#include "FontCache.h"
     30#include "Frame.h"
    3031#include "GraphicsContext.h"
    3132#include "HitTestLocation.h"
     
    3940#include "RenderText.h"
    4041#include "RenderView.h"
     42#include "Settings.h"
    4143#include "SimpleLineLayoutResolver.h"
    4244#include "Text.h"
     
    6062    return false;
    6163#endif
     64    if (!flow.frame().settings().simpleLineLayoutEnabled())
     65        return false;
    6266    if (!flow.firstChild())
    6367        return false;
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp

    r158268 r158279  
    2828
    2929#include "FontCache.h"
     30#include "Frame.h"
    3031#include "GraphicsContext.h"
    3132#include "HitTestLocation.h"
     
    3839#include "RenderStyle.h"
    3940#include "RenderText.h"
     41#include "Settings.h"
    4042#include "SimpleLineLayoutResolver.h"
    4143#include "Text.h"
     
    4648namespace SimpleLineLayout {
    4749
     50static void paintDebugBorders(GraphicsContext& context, const LayoutRect& borderRect, const LayoutPoint& paintOffset)
     51{
     52    GraphicsContextStateSaver stateSaver(context);
     53    context.setStrokeColor(Color(0, 255, 0), ColorSpaceDeviceRGB);
     54    context.setFillColor(Color::transparent, ColorSpaceDeviceRGB);
     55    IntRect rect(pixelSnappedIntRect(borderRect));
     56    rect.moveBy(flooredIntPoint(paintOffset));
     57    context.drawRect(rect);
     58}
     59
    4860void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    4961{
     
    5264    RenderText& textRenderer = toRenderText(*flow.firstChild());
    5365    ASSERT(!textRenderer.firstTextBox());
     66
     67    bool debugBordersEnabled = flow.frame().settings().simpleLineLayoutDebugBordersEnabled();
    5468
    5569    RenderStyle& style = flow.style();
     
    6781        auto run = *it;
    6882        context.drawText(font, TextRun(run.text()), run.baseline() + paintOffset);
     83        if (debugBordersEnabled)
     84            paintDebugBorders(context, run.rect(), paintOffset);
    6985    }
    7086}
  • trunk/Source/WebKit2/ChangeLog

    r158274 r158279  
     12013-10-30  Antti Koivisto  <antti@apple.com>
     2
     3        Add debug settings for simple line layout
     4        https://bugs.webkit.org/show_bug.cgi?id=123514
     5
     6        Reviewed by Andreas Kling.
     7       
     8        Expose debug settings.
     9
     10        * Shared/WebPreferencesStore.h:
     11        * UIProcess/API/C/WKPreferences.cpp:
     12        (WKPreferencesSetSimpleLineLayoutEnabled):
     13        (WKPreferencesGetSimpleLineLayoutEnabled):
     14        (WKPreferencesSetSimpleLineLayoutDebugBordersEnabled):
     15        (WKPreferencesGetSimpleLineLayoutDebugBordersEnabled):
     16        * UIProcess/API/C/WKPreferencesPrivate.h:
     17        * WebProcess/WebPage/WebPage.cpp:
     18        (WebKit::WebPage::updatePreferences):
     19
    1202013-10-30  Anders Carlsson  <andersca@apple.com>
    221
  • trunk/Source/WebKit2/Shared/WebPreferencesStore.h

    r157843 r158279  
    166166    macro(LowPowerVideoAudioBufferSizeEnabled, lowPowerVideoAudioBufferSizeEnabled, Bool, bool, false) \
    167167    macro(ThreadedScrollingEnabled, threadedScrollingEnabled, Bool, bool, true) \
     168    macro(SimpleLineLayoutEnabled, simpleLineLayoutEnabled, Bool, bool, true) \
     169    macro(SimpleLineLayoutDebugBordersEnabled, simpleLineLayoutDebugBordersEnabled, Bool, bool, false) \
    168170    \
    169171
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r157843 r158279  
    11761176    return toImpl(preferencesRef)->threadedScrollingEnabled();
    11771177}
     1178
     1179void WKPreferencesSetSimpleLineLayoutEnabled(WKPreferencesRef preferencesRef, bool flag)
     1180{
     1181    toImpl(preferencesRef)->setSimpleLineLayoutEnabled(flag);
     1182}
     1183
     1184bool WKPreferencesGetSimpleLineLayoutEnabled(WKPreferencesRef preferencesRef)
     1185{
     1186    return toImpl(preferencesRef)->simpleLineLayoutEnabled();
     1187}
     1188
     1189void WKPreferencesSetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef preferencesRef, bool flag)
     1190{
     1191    toImpl(preferencesRef)->setSimpleLineLayoutDebugBordersEnabled(flag);
     1192}
     1193
     1194bool WKPreferencesGetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef preferencesRef)
     1195{
     1196    return toImpl(preferencesRef)->simpleLineLayoutDebugBordersEnabled();
     1197}
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h

    r157843 r158279  
    297297WK_EXPORT double WKPreferencesGetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef);
    298298
     299// Defaults to true.
     300WK_EXPORT void WKPreferencesSetSimpleLineLayoutEnabled(WKPreferencesRef, bool);
     301WK_EXPORT bool WKPreferencesGetSimpleLineLayoutEnabled(WKPreferencesRef);
     302
     303// Defaults to false.
     304WK_EXPORT void WKPreferencesSetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef, bool);
     305WK_EXPORT bool WKPreferencesGetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef);
     306
    299307WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
    300308
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r158210 r158279  
    24542454
    24552455    settings.setLowPowerVideoAudioBufferSizeEnabled(store.getBoolValueForKey(WebPreferencesKey::lowPowerVideoAudioBufferSizeEnabledKey()));
     2456    settings.setSimpleLineLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutEnabledKey()));
     2457    settings.setSimpleLineLayoutDebugBordersEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutDebugBordersEnabledKey()));
    24562458
    24572459    platformPreferencesDidChange(store);
Note: See TracChangeset for help on using the changeset viewer.