Changeset 121907 in webkit


Ignore:
Timestamp:
Jul 5, 2012 8:38:10 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Text Autosizing: Add test framework and simple test.
https://bugs.webkit.org/show_bug.cgi?id=90561

Source/WebCore:

Exposes methods allowing Layout Tests to enable Text Autosizing and
get the same results as if they were running on a mobile device.

Patch by John Mellor <johnme@chromium.org> on 2012-07-05
Reviewed by Adam Barth.

Test: fast/text-autosizing/simple-paragraph.html

  • page/Settings.cpp:

(WebCore::Settings::Settings):
(WebCore):
(WebCore::Settings::setTextAutosizingWindowSizeOverride):

  • page/Settings.h:

(Settings):
(WebCore::Settings::textAutosizingWindowSizeOverride):

  • rendering/TextAutosizer.cpp:

(WebCore::TextAutosizer::boostSubtree):

  • testing/InternalSettings.cpp:

(WebCore::InternalSettings::InternalSettings):
(WebCore::InternalSettings::restoreTo):
(WebCore::InternalSettings::setTextAutosizingEnabled):
(WebCore):
(WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):

  • testing/InternalSettings.h:

(InternalSettings):

  • testing/InternalSettings.idl:

Source/WebKit/chromium:

ENABLE(TEXT_AUTOSIZING) is now on in Chromium (but disabled at runtime).
This allows it to be used in Layout Tests (and in future by Web
Inspector's mobile device emulation).

Patch by John Mellor <johnme@chromium.org> on 2012-07-05
Reviewed by Adam Barth.

  • features.gypi:

LayoutTests:

Added a RefTest checking that Text Autosizing is active.
Skipped the text-autosizing test directory on platforms that
currently disable ENABLE(TEXT_AUTOSIZING).

Patch by John Mellor <johnme@chromium.org> on 2012-07-05
Reviewed by Adam Barth.

  • fast/text-autosizing/simple-paragraph-expected.html: Added.
  • fast/text-autosizing/simple-paragraph.html: Added.
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/win/Skipped:
  • platform/wincairo/Skipped:
  • platform/wk2/Skipped:
Location:
trunk
Files:
3 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121897 r121907  
     12012-07-05  John Mellor  <johnme@chromium.org>
     2
     3        Text Autosizing: Add test framework and simple test.
     4        https://bugs.webkit.org/show_bug.cgi?id=90561
     5
     6        Added a RefTest checking that Text Autosizing is active.
     7        Skipped the text-autosizing test directory on platforms that
     8        currently disable ENABLE(TEXT_AUTOSIZING).
     9
     10        Reviewed by Adam Barth.
     11
     12        * fast/text-autosizing/simple-paragraph-expected.html: Added.
     13        * fast/text-autosizing/simple-paragraph.html: Added.
     14        * platform/efl/TestExpectations:
     15        * platform/gtk/TestExpectations:
     16        * platform/mac/TestExpectations:
     17        * platform/qt/TestExpectations:
     18        * platform/win/Skipped:
     19        * platform/wincairo/Skipped:
     20        * platform/wk2/Skipped:
     21
    1222012-07-05  Dongwoo Im  <dw.im@samsung.com>
    223
  • trunk/LayoutTests/platform/efl/TestExpectations

    r121833 r121907  
    132132// Disable webaudio codec tests, including proprietary codecs.
    133133BUGWK88794 SKIP : webaudio/codec-tests = PASS
     134
     135// Text Autosizing is not yet enabled.
     136BUGWK84186 SKIP : fast/text-autosizing = PASS
    134137
    135138//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r121888 r121907  
    345345// Content Security Policy 1.1 (ENABLE_CSP_NEXT) is not enabled
    346346BUGWK85558 SKIP : http/tests/security/contentSecurityPolicy/1.1 = TEXT
     347
     348// Text Autosizing is not yet enabled.
     349BUGWK84186 SKIP : fast/text-autosizing = PASS
    347350
    348351//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/mac/TestExpectations

    r121874 r121907  
    287287BUGWK88171 : fast/block/float/010.html = TEXT
    288288BUGWK88171 : css1/formatting_model/floating_elements.html = TEXT
     289
     290// Text Autosizing is not enabled.
     291BUGWK84186 SKIP : fast/text-autosizing = PASS
  • trunk/LayoutTests/platform/qt/TestExpectations

    r121874 r121907  
    107107BUGWK88171 : fast/block/float/010.html = TEXT
    108108BUGWK88171 : css1/formatting_model/floating_elements.html = TEXT
     109
     110// Text Autosizing is not enabled.
     111BUGWK84186 SKIP : fast/text-autosizing = PASS
  • trunk/LayoutTests/platform/win/Skipped

    r121879 r121907  
    12861286# viewport meta tag support
    12871287fast/viewport
     1288
     1289# Text Autosizing is not enabled (http://webkit.org/b/84186).
     1290fast/text-autosizing
    12881291
    12891292# https://bugs.webkit.org/show_bug.cgi?id=45983
  • trunk/LayoutTests/platform/wincairo/Skipped

    r121879 r121907  
    17951795fast/viewport
    17961796
     1797# Text Autosizing is not enabled (http://webkit.org/b/84186).
     1798fast/text-autosizing
     1799
    17971800# https://bugs.webkit.org/show_bug.cgi?id=45983
    17981801media/media-can-play-mpeg4-video.html
  • trunk/LayoutTests/platform/wk2/Skipped

    r121879 r121907  
    813813http/tests/security/referrer-policy-redirect-link.html
    814814
     815# Text Autosizing is not yet enabled.
     816# https://bugs.webkit.org/show_bug.cgi?id=84186
     817fast/text-autosizing
     818
    815819### END OF (1) Classified failures with bug reports
    816820########################################
  • trunk/Source/WebCore/ChangeLog

    r121906 r121907  
     12012-07-05  John Mellor  <johnme@chromium.org>
     2
     3        Text Autosizing: Add test framework and simple test.
     4        https://bugs.webkit.org/show_bug.cgi?id=90561
     5
     6        Exposes methods allowing Layout Tests to enable Text Autosizing and
     7        get the same results as if they were running on a mobile device.
     8
     9        Reviewed by Adam Barth.
     10
     11        Test: fast/text-autosizing/simple-paragraph.html
     12
     13        * page/Settings.cpp:
     14        (WebCore::Settings::Settings):
     15        (WebCore):
     16        (WebCore::Settings::setTextAutosizingWindowSizeOverride):
     17        * page/Settings.h:
     18        (Settings):
     19        (WebCore::Settings::textAutosizingWindowSizeOverride):
     20        * rendering/TextAutosizer.cpp:
     21        (WebCore::TextAutosizer::boostSubtree):
     22        * testing/InternalSettings.cpp:
     23        (WebCore::InternalSettings::InternalSettings):
     24        (WebCore::InternalSettings::restoreTo):
     25        (WebCore::InternalSettings::setTextAutosizingEnabled):
     26        (WebCore):
     27        (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):
     28        * testing/InternalSettings.h:
     29        (InternalSettings):
     30        * testing/InternalSettings.idl:
     31
    1322012-07-04  Andrey Kosyakov  <caseq@chromium.org>
    233
  • trunk/Source/WebCore/page/Settings.cpp

    r121861 r121907  
    140140    , m_maximumHTMLParserDOMTreeDepth(defaultMaximumHTMLParserDOMTreeDepth)
    141141#if ENABLE(TEXT_AUTOSIZING)
     142#if HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP
     143    , m_textAutosizingWindowSizeOverride(320, 480)
    142144    , m_textAutosizingEnabled(true)
     145#else
     146    , m_textAutosizingEnabled(false)
     147#endif
    143148#endif
    144149    , m_isSpatialNavigationEnabled(false)
     
    415420    m_page->setNeedsRecalcStyleInAllFrames();
    416421}
     422
     423void Settings::setTextAutosizingWindowSizeOverride(const IntSize& textAutosizingWindowSizeOverride)
     424{
     425    if (m_textAutosizingWindowSizeOverride == textAutosizingWindowSizeOverride)
     426        return;
     427
     428    m_textAutosizingWindowSizeOverride = textAutosizingWindowSizeOverride;
     429    m_page->setNeedsRecalcStyleInAllFrames();
     430}
    417431#endif
    418432
  • trunk/Source/WebCore/page/Settings.h

    r121861 r121907  
    3737#include <wtf/unicode/Unicode.h>
    3838
     39#if ENABLE(TEXT_AUTOSIZING)
     40#include "IntSize.h"
     41#endif
     42
    3943namespace WebCore {
    4044
     
    107111        void setTextAutosizingEnabled(bool);
    108112        bool textAutosizingEnabled() const { return m_textAutosizingEnabled; }
     113
     114        // Only set by Layout Tests, and only used if textAutosizingEnabled() returns true.
     115        void setTextAutosizingWindowSizeOverride(const IntSize&);
     116        const IntSize& textAutosizingWindowSizeOverride() const { return m_textAutosizingWindowSizeOverride; }
    109117#endif
    110118
     
    635643        unsigned m_maximumHTMLParserDOMTreeDepth;
    636644#if ENABLE(TEXT_AUTOSIZING)
     645        IntSize m_textAutosizingWindowSizeOverride;
    637646        bool m_textAutosizingEnabled : 1;
    638647#endif
  • trunk/Source/WebCore/rendering/TextAutosizer.cpp

    r121866 r121907  
    5050        return false;
    5151
    52 #ifdef HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP
    53     IntSize windowSize(320, 480);
    54 #else
    55     Frame* mainFrame = m_document->page()->mainFrame();
    56     bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame);
    57     IntSize windowSize = mainFrame->view()->visibleContentRect(includeScrollbars).size(); // FIXME: Check that this is always in logical (density-independent) pixels (see wkbug.com/87440).
    58 #endif
     52    IntSize windowSize = m_document->settings()->textAutosizingWindowSizeOverride();
     53    if (windowSize.isEmpty()) {
     54        Frame* mainFrame = m_document->page()->mainFrame();
     55        bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame);
     56        windowSize = mainFrame->view()->visibleContentRect(includeScrollbars).size(); // FIXME: Check that this is always in logical (density-independent) pixels (see wkbug.com/87440).
     57    }
    5958
    6059    for (RenderObject* descendant = traverseNext(layoutRoot, layoutRoot); descendant; descendant = traverseNext(descendant, layoutRoot)) {
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r121229 r121907  
    108108    , m_originalDeviceSupportsTouch(settings()->deviceSupportsTouch())
    109109    , m_originalDeviceSupportsMouse(settings()->deviceSupportsMouse())
     110#if ENABLE(TEXT_AUTOSIZING)
     111    , m_originalTextAutosizingEnabled(settings()->textAutosizingEnabled())
     112    , m_originalTextAutosizingWindowSizeOverride(settings()->textAutosizingWindowSizeOverride())
     113#endif
    110114{
    111115}
     
    129133    settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch);
    130134    settings->setDeviceSupportsMouse(m_originalDeviceSupportsMouse);
     135#if ENABLE(TEXT_AUTOSIZING)
     136    settings->setTextAutosizingEnabled(m_originalTextAutosizingEnabled);
     137    settings->setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride);
     138#endif
    131139}
    132140
     
    319327    InternalSettingsGuardForSettings();
    320328    setFontFamily(settings(), family, script, &Settings::setPictographFontFamily);
     329}
     330
     331void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec)
     332{
     333#if ENABLE(TEXT_AUTOSIZING)
     334    InternalSettingsGuardForSettings();
     335    settings()->setTextAutosizingEnabled(enabled);
     336#else
     337    UNUSED_PARAM(enabled);
     338    UNUSED_PARAM(ec);
     339#endif
     340}
     341
     342void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec)
     343{
     344#if ENABLE(TEXT_AUTOSIZING)
     345    InternalSettingsGuardForSettings();
     346    settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
     347#else
     348    UNUSED_PARAM(width);
     349    UNUSED_PARAM(height);
     350    UNUSED_PARAM(ec);
     351#endif
    321352}
    322353
  • trunk/Source/WebCore/testing/InternalSettings.h

    r121229 r121907  
    3232#include <wtf/RefCounted.h>
    3333#include <wtf/text/WTFString.h>
     34
     35#if ENABLE(TEXT_AUTOSIZING)
     36#include "IntSize.h"
     37#endif
    3438
    3539namespace WebCore {
     
    7377    void setFantasyFontFamily(const String& family, const String& script, ExceptionCode&);
    7478    void setPictographFontFamily(const String& family, const String& script, ExceptionCode&);
     79    void setTextAutosizingEnabled(bool enabled, ExceptionCode&);
     80    void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode&);
    7581    void setEnableScrollAnimator(bool enabled, ExceptionCode&);
    7682    bool scrollAnimatorEnabled(ExceptionCode&);
     
    110116    bool m_originalDeviceSupportsTouch;
    111117    bool m_originalDeviceSupportsMouse;
     118#if ENABLE(TEXT_AUTOSIZING)
     119    bool m_originalTextAutosizingEnabled;
     120    IntSize m_originalTextAutosizingWindowSizeOverride;
     121#endif
    112122};
    113123
  • trunk/Source/WebCore/testing/InternalSettings.idl

    r121229 r121907  
    5252        void setFantasyFontFamily(in DOMString family, in DOMString script) raises(DOMException);
    5353        void setPictographFontFamily(in DOMString family, in DOMString script) raises(DOMException);
     54        void setTextAutosizingEnabled(in boolean enabled) raises(DOMException);
     55        void setTextAutosizingWindowSizeOverride(in long width, in long height) raises(DOMException);
    5456        void setEnableScrollAnimator(in boolean enabled) raises(DOMException);
    5557        boolean scrollAnimatorEnabled() raises(DOMException);
  • trunk/Source/WebKit/chromium/ChangeLog

    r121904 r121907  
     12012-07-05  John Mellor  <johnme@chromium.org>
     2
     3        Text Autosizing: Add test framework and simple test.
     4        https://bugs.webkit.org/show_bug.cgi?id=90561
     5
     6        ENABLE(TEXT_AUTOSIZING) is now on in Chromium (but disabled at runtime).
     7        This allows it to be used in Layout Tests (and in future by Web
     8        Inspector's mobile device emulation).
     9
     10        Reviewed by Adam Barth.
     11
     12        * features.gypi:
     13
    1142012-07-05  Oli Lan  <olilan@chromium.org>
    215
  • trunk/Source/WebKit/chromium/features.gypi

    r121861 r121907  
    9393      'ENABLE_SVG=<(enable_svg)',
    9494      'ENABLE_SVG_FONTS=<(enable_svg)',
     95      'ENABLE_TEXT_AUTOSIZING=1',
    9596      'ENABLE_TOUCH_ADJUSTMENT=1',
    9697      'ENABLE_TOUCH_EVENTS=<(enable_touch_events)',
     
    154155          # https://bugs.webkit.org/show_bug.cgi?id=88636
    155156          'ENABLE_SHARED_WORKERS=1',
    156           'ENABLE_TEXT_AUTOSIZING=1',
    157157          'ENABLE_WEB_AUDIO=0',
    158158          'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1',
     
    173173          'ENABLE_PAGE_POPUP=1',
    174174          'ENABLE_SHARED_WORKERS=1',
    175           'ENABLE_TEXT_AUTOSIZING=0',
    176175          'ENABLE_WEB_AUDIO=1',
    177176        ],
Note: See TracChangeset for help on using the changeset viewer.