Changeset 200534 in webkit


Ignore:
Timestamp:
May 6, 2016, 5:05:58 PM (9 years ago)
Author:
Simon Fraser
Message:

Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
https://bugs.webkit.org/show_bug.cgi?id=157432
rdar://problem/16406720

Reviewed by Dean Jackson.

Source/JavaScriptCore:

Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.

  • Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.

Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
These two settings are shared with TEXT_AUTOSIZING.

Add a TextAutosizing log channel, which is useful for generated -expected.html results.

Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
without changes.

An implication of this set of changes is that the way clients enable text autosizing
has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
on iPhone only, not iPad.

Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.

UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
which will now always return 15, but had no other code that toggled this. So it's safe to just rely
on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.

Test: fast/text-autosizing/ios/autosize-width.html

  • Configurations/FeatureDefines.xcconfig:
  • dom/Document.cpp:

(WebCore::Document::addAutoSizingNode):

  • page/FrameView.cpp:

(WebCore::FrameView::layout):

  • page/Settings.cpp:

(WebCore::Settings::Settings): Deleted.
(WebCore::Settings::setTextAutosizingEnabled): Deleted.
(WebCore::Settings::setTextAutosizingWindowSizeOverride): Deleted.

  • page/Settings.h:

(WebCore::Settings::textAutosizingEnabled): Deleted.
(WebCore::Settings::textAutosizingWindowSizeOverride): Deleted.

  • page/Settings.in:
  • page/cocoa/SettingsCocoa.mm:

(WebCore::Settings::defaultMinimumZoomFontSize):
(WebCore::Settings::defaultTextAutosizingEnabled):

  • platform/Logging.h:
  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::adjustComputedFontSizes):

  • rendering/RenderElement.cpp:

(WebCore::includeNonFixedHeight):
(WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
(WebCore::RenderElement::resetTextAutosizing):

  • rendering/RenderElement.h:
  • rendering/RenderObject.cpp:

(WebCore::includeNonFixedHeight): Deleted.
(WebCore::RenderObject::adjustComputedFontSizesOnBlocks): Deleted.
(WebCore::RenderObject::resetTextAutosizing): Deleted.

  • rendering/RenderObject.h:
  • rendering/TextAutoSizing.cpp:

(WebCore::TextAutoSizingValue::adjustNodeSizes):

  • testing/InternalSettings.cpp:

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

  • testing/InternalSettings.h:

Source/WebKit/ios:

Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.

Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
These two settings are shared with TEXT_AUTOSIZING.

Add a TextAutosizing log channel, which is useful for generated -expected.html results.

Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
without changes.

An implication of this set of changes is that the way clients enable text autosizing
has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
on iPhone only, not iPad.

Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.

UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
which will now always return 15, but had no other code that toggled this. So it's safe to just rely
on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.

  • Misc/WebUIKitSupport.mm:

(WebKitGetMinimumZoomFontSize):

Source/WebKit/mac:

Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.

Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
These two settings are shared with TEXT_AUTOSIZING.

Add a TextAutosizing log channel, which is useful for generated -expected.html results.

Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
without changes.

An implication of this set of changes is that the way clients enable text autosizing
has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
on iPhone only, not iPad.

Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.

UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
which will now always return 15, but had no other code that toggled this. So it's safe to just rely
on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.

  • Configurations/FeatureDefines.xcconfig:
  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.mm:

(+[WebPreferences initialize]):
(-[WebPreferences _setTextAutosizingEnabled:]):
(-[WebPreferences _textAutosizingEnabled]):

  • WebView/WebPreferencesPrivate.h:

Source/WebKit2:

Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.

Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
These two settings are shared with TEXT_AUTOSIZING.

Add a TextAutosizing log channel, which is useful for generated -expected.html results.

Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
without changes.

An implication of this set of changes is that the way clients enable text autosizing
has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
on iPhone only, not iPad.

Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.

UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
which will now always return 15, but had no other code that toggled this. So it's safe to just rely
on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.

  • Configurations/FeatureDefines.xcconfig:
  • Shared/WebPreferencesDefinitions.h:
  • UIProcess/API/Cocoa/WKPreferences.mm:

(-[WKPreferences _textAutosizingEnabled]):
(-[WKPreferences _setTextAutosizingEnabled:]):

  • UIProcess/API/Cocoa/WKPreferencesPrivate.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

Tools:

Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.

Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
These two settings are shared with TEXT_AUTOSIZING.

Add a TextAutosizing log channel, which is useful for generated -expected.html results.

Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
without changes.

An implication of this set of changes is that the way clients enable text autosizing
has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
on iPhone only, not iPad.

Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.

UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
which will now always return 15, but had no other code that toggled this. So it's safe to just rely
on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.

  • DumpRenderTree/mac/DumpRenderTree.mm:

(resetWebPreferencesToConsistentValues):

  • DumpRenderTree/mac/TestRunnerMac.mm:

(TestRunner::setTextAutosizingEnabled):

  • TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
  • WebKitTestRunner/ios/TestControllerIOS.mm:

(WTR::TestController::platformResetPreferencesToConsistentValues):

LayoutTests:

Enable fast/text-autosizing/ios/ on Mac and iOS

  • fast/text-autosizing/ios/autosize-width-expected.html: Added.
  • fast/text-autosizing/ios/autosize-width.html: Added.
  • platform/ios-simulator/TestExpectations:
  • platform/mac-wk2/TestExpectations:
  • platform/mac/TestExpectations:
Location:
trunk
Files:
6 added
43 edited
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r200533 r200534  
     12016-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
     4        https://bugs.webkit.org/show_bug.cgi?id=157432
     5        rdar://problem/16406720
     6
     7        Reviewed by Dean Jackson.
     8
     9        Enable fast/text-autosizing/ios/ on Mac and iOS
     10
     11        * fast/text-autosizing/ios/autosize-width-expected.html: Added.
     12        * fast/text-autosizing/ios/autosize-width.html: Added.
     13        * platform/ios-simulator/TestExpectations:
     14        * platform/mac-wk2/TestExpectations:
     15        * platform/mac/TestExpectations:
     16
    1172016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
    218
  • trunk/LayoutTests/fast/text-autosizing/ios/line-height-text-autosizing.html

    r200533 r200534  
    22<html>
    33<head>
    4 <script src="../../resources/js-test-pre.js"></script>
     4<script src="../../../resources/js-test-pre.js"></script>
    55<style>
    66#testDivAdjust {
     
    1212}
    1313</style>
     14<script>
     15if (window.internals) {
     16    window.internals.settings.setTextAutosizingEnabled(true);
     17    window.internals.settings.setTextAutosizingWindowSizeOverride(320, 480);
     18}
     19</script>
    1420</head>
    1521<boby>
     
    5460}
    5561</script>
    56 <script src="../../resources/js-test-post.js"></script>
     62<script src="../../../resources/js-test-post.js"></script>
    5763</body>
    5864</html>
  • trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations

    r200488 r200534  
    794794fast/block/min-max-height-percent-height-child.html [ Failure ]
    795795fast/borders/hidpi-border-clipping-right-after-move.html [ ImageOnlyFailure ]
    796 fast/css/line-height-text-autosizing.html [ Failure ]
     796fast/text-autosizing/ios/line-height-text-autosizing.html [ Failure ]
    797797fast/css/nested-rounded-corners.html [ Failure ]
    798798fast/css/relative-positioned-block-crash.html [ Failure ]
  • trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations

    r200487 r200534  
    546546fast/css/hover-display-block-none.html [ Failure ]
    547547fast/css/hover-display-block.html [ Failure ]
    548 fast/css/line-height-text-autosizing.html [ Failure ]
     548fast/text-autosizing/ios/line-height-text-autosizing.html [ Failure ]
    549549fast/css/nested-layers-with-hover.html [ Failure ]
    550550fast/dom/HTMLDocument/hasFocus.html [ Failure ]
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r200494 r200534  
    1111quicklook [ Pass ]
    1212http/tests/quicklook [ Pass ]
     13
     14fast/text-autosizing/ios [ Pass ]
    1315
    1416# <rdar://problem/22898927> Crashes in iWorkImport.framework
     
    22112213fast/table/wide-colspan.html [ Failure ]
    22122214fast/table/wide-column.html [ Failure ]
     2215
     2216# Tests designed for TEXT_AUTOSIZING, not IOS_TEXT_AUTOSIZING behavior.
    22132217fast/text-autosizing/cluster-inline-block-or-table.html [ ImageOnlyFailure ]
    22142218fast/text-autosizing/cluster-inline-grid-flex-box.html [ ImageOnlyFailure ]
     
    22582262fast/text-autosizing/wide-iframe.html [ ImageOnlyFailure ]
    22592263fast/text-autosizing/wide-in-narrow-overflow-scroll.html [ ImageOnlyFailure ]
     2264
    22602265fast/text/decorations-transformed.html [ Failure ]
    22612266fast/text/emphasis-avoid-ruby.html [ Failure ]
     
    25602565# Mark as passing specific tests in folders that were skipped temporarily above.
    25612566##
    2562 webkit.org/b/138970 fast/css/line-height-text-autosizing.html [ Pass ]
     2567webkit.org/b/138970 fast/text-autosizing/ios/line-height-text-autosizing.html [ Pass ]
    25632568
    25642569# Skipped for mac as well:
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r200392 r200534  
    88tiled-drawing [ Pass ]
    99swipe [ Pass ]
     10
     11fast/text-autosizing/ios [ Pass ]
    1012
    1113fast/events/cancelled-force-click-link-navigation.html [ Pass ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r200315 r200534  
    1616
    1717fast/url/user-visible [ Pass ]
     18
     19fast/text-autosizing/ios [ Pass ]
    1820
    1921#//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/mac/fast/text-autosizing/ios/line-height-text-autosizing-expected.txt

    r200533 r200534  
    1414PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is "12px"
    1515Case with text size adjust.
    16 Platform does not support  -webkit-text-size-adjust
     16Platform supports -webkit-text-size-adjust
     17FAIL window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') should be normal. Was 36px.
     18PASS window.getComputedStyle(testDivAdjust).getPropertyValue('font-size') is "30px"
     19testDivAdjust.style['line-height'] = '1.6'
     20PASS window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') is "48px"
     21testDivAdjust.style['line-height'] = '80%'
     22PASS window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') is "24px"
     23testDivAdjust.style['line-height'] = '12px'
     24PASS window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') is "18px"
    1725PASS successfullyParsed is true
    1826
  • trunk/Source/JavaScriptCore/ChangeLog

    r200533 r200534  
     12016-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
     4        https://bugs.webkit.org/show_bug.cgi?id=157432
     5        rdar://problem/16406720
     6
     7        Reviewed by Dean Jackson.
     8
     9        Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
     10
     11        * Configurations/FeatureDefines.xcconfig:
     12
    1132016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
    214
  • trunk/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig

    r200075 r200534  
    108108ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
    109109
    110 ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
     110ENABLE_IOS_TEXT_AUTOSIZING = ENABLE_IOS_TEXT_AUTOSIZING;
    111111ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
    112112
  • trunk/Source/WebCore/ChangeLog

    r200533 r200534  
     12016-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
     4        https://bugs.webkit.org/show_bug.cgi?id=157432
     5        rdar://problem/16406720
     6
     7        Reviewed by Dean Jackson.
     8
     9        Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
     10
     11        Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
     12        preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
     13        These two settings are shared with TEXT_AUTOSIZING.
     14
     15        Add a TextAutosizing log channel, which is useful for generated -expected.html results.
     16
     17        Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
     18        without changes.
     19
     20        An implication of this set of changes is that the way clients enable text autosizing
     21        has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
     22        Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
     23        on iPhone only, not iPad.
     24
     25        Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
     26        instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
     27
     28        UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
     29        which will now always return 15, but had no other code that toggled this. So it's safe to just rely
     30        on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
     31
     32        Test: fast/text-autosizing/ios/autosize-width.html
     33
     34        * Configurations/FeatureDefines.xcconfig:
     35        * dom/Document.cpp:
     36        (WebCore::Document::addAutoSizingNode):
     37        * page/FrameView.cpp:
     38        (WebCore::FrameView::layout):
     39        * page/Settings.cpp:
     40        (WebCore::Settings::Settings): Deleted.
     41        (WebCore::Settings::setTextAutosizingEnabled): Deleted.
     42        (WebCore::Settings::setTextAutosizingWindowSizeOverride): Deleted.
     43        * page/Settings.h:
     44        (WebCore::Settings::textAutosizingEnabled): Deleted.
     45        (WebCore::Settings::textAutosizingWindowSizeOverride): Deleted.
     46        * page/Settings.in:
     47        * page/cocoa/SettingsCocoa.mm:
     48        (WebCore::Settings::defaultMinimumZoomFontSize):
     49        (WebCore::Settings::defaultTextAutosizingEnabled):
     50        * platform/Logging.h:
     51        * rendering/RenderBlockFlow.cpp:
     52        (WebCore::RenderBlockFlow::adjustComputedFontSizes):
     53        * rendering/RenderElement.cpp:
     54        (WebCore::includeNonFixedHeight):
     55        (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
     56        (WebCore::RenderElement::resetTextAutosizing):
     57        * rendering/RenderElement.h:
     58        * rendering/RenderObject.cpp:
     59        (WebCore::includeNonFixedHeight): Deleted.
     60        (WebCore::RenderObject::adjustComputedFontSizesOnBlocks): Deleted.
     61        (WebCore::RenderObject::resetTextAutosizing): Deleted.
     62        * rendering/RenderObject.h:
     63        * rendering/TextAutoSizing.cpp:
     64        (WebCore::TextAutoSizingValue::adjustNodeSizes):
     65        * testing/InternalSettings.cpp:
     66        (WebCore::InternalSettings::Backup::Backup):
     67        (WebCore::InternalSettings::Backup::restoreTo):
     68        (WebCore::InternalSettings::setTextAutosizingEnabled):
     69        (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):
     70        * testing/InternalSettings.h:
     71
    1722016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
    273
  • trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig

    r200075 r200534  
    108108ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
    109109
    110 ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
     110ENABLE_IOS_TEXT_AUTOSIZING = ENABLE_IOS_TEXT_AUTOSIZING;
    111111ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
    112112
  • trunk/Source/WebCore/dom/Document.cpp

    r200524 r200534  
    52815281
    52825282#if ENABLE(IOS_TEXT_AUTOSIZING)
     5283
    52835284void Document::addAutoSizingNode(Node* node, float candidateSize)
    52845285{
     5286    LOG(TextAutosizing, " addAutoSizingNode %p candidateSize=%f", node, candidateSize);
     5287
    52855288    TextAutoSizingKey key(&node->renderer()->style());
    52865289    auto addResult = m_textAutoSizedNodes.ensure(WTFMove(key), [] {
  • trunk/Source/WebCore/page/FrameView.cpp

    r200494 r200534  
    14031403
    14041404        root->layout();
     1405
    14051406#if ENABLE(IOS_TEXT_AUTOSIZING)
    1406         if (Page* page = frame().page()) {
     1407        if (frame().settings().textAutosizingEnabled() && !root->view().printing()) {
    14071408            float minimumZoomFontSize = frame().settings().minimumZoomFontSize();
    1408             float textAutosizingWidth = page->textAutosizingWidth();
    1409             if (minimumZoomFontSize && textAutosizingWidth && !root->view().printing()) {
     1409            float textAutosizingWidth = frame().page() ? frame().page()->textAutosizingWidth() : 0;
     1410            if (int overrideWidth = frame().settings().textAutosizingWindowSizeOverride().width())
     1411                textAutosizingWidth = overrideWidth;
     1412
     1413            LOG(TextAutosizing, "Text Autosizing: minimumZoomFontSize=%.2f textAutosizingWidth=%.2f", minimumZoomFontSize, textAutosizingWidth);
     1414           
     1415            if (minimumZoomFontSize && textAutosizingWidth) {
    14101416                root->adjustComputedFontSizesOnBlocks(minimumZoomFontSize, textAutosizingWidth);
    14111417                if (root->needsLayout())
  • trunk/Source/WebCore/page/Settings.cpp

    r200166 r200534  
    186186#if ENABLE(TEXT_AUTOSIZING)
    187187    , m_textAutosizingFontScaleFactor(1)
    188 #if HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP
    189     , m_textAutosizingWindowSizeOverride(320, 480)
    190     , m_textAutosizingEnabled(true)
    191 #else
    192     , m_textAutosizingEnabled(false)
    193 #endif
    194188#endif
    195189    SETTINGS_INITIALIZER_LIST
     
    327321
    328322#if ENABLE(TEXT_AUTOSIZING)
    329 void Settings::setTextAutosizingEnabled(bool textAutosizingEnabled)
    330 {
    331     if (m_textAutosizingEnabled == textAutosizingEnabled)
    332         return;
    333 
    334     m_textAutosizingEnabled = textAutosizingEnabled;
    335     if (m_page)
    336         m_page->setNeedsRecalcStyleInAllFrames();
    337 }
    338 
    339 void Settings::setTextAutosizingWindowSizeOverride(const IntSize& textAutosizingWindowSizeOverride)
    340 {
    341     if (m_textAutosizingWindowSizeOverride == textAutosizingWindowSizeOverride)
    342         return;
    343 
    344     m_textAutosizingWindowSizeOverride = textAutosizingWindowSizeOverride;
    345     if (m_page)
    346         m_page->setNeedsRecalcStyleInAllFrames();
    347 }
    348 
    349323void Settings::setTextAutosizingFontScaleFactor(float fontScaleFactor)
    350324{
     
    360334    m_page->setNeedsRecalcStyleInAllFrames();
    361335}
    362 
     336#endif
     337
     338float Settings::defaultMinimumZoomFontSize()
     339{
     340    return 15;
     341}
     342
     343#if !PLATFORM(IOS)
     344bool Settings::defaultTextAutosizingEnabled()
     345{
     346    return false;
     347}
    363348#endif
    364349
  • trunk/Source/WebCore/page/Settings.h

    r200301 r200534  
    110110
    111111#if ENABLE(TEXT_AUTOSIZING)
    112     void setTextAutosizingEnabled(bool);
    113     bool textAutosizingEnabled() const { return m_textAutosizingEnabled; }
    114 
    115112    void setTextAutosizingFontScaleFactor(float);
    116113    float textAutosizingFontScaleFactor() const { return m_textAutosizingFontScaleFactor; }
    117 
    118     // Only set by Layout Tests, and only used if textAutosizingEnabled() returns true.
    119     void setTextAutosizingWindowSizeOverride(const IntSize&);
    120     const IntSize& textAutosizingWindowSizeOverride() const { return m_textAutosizingWindowSizeOverride; }
    121 #endif
     114#endif
     115
     116    WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
     117    WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
    122118
    123119    // Only set by Layout Tests.
     
    291287    bool isForcePendingWebGLPolicy() const { return m_forcePendingWebGLPolicy; }
    292288   
    293 #if PLATFORM(IOS)
    294     WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
    295 #endif
    296 
    297289#if USE(APPLE_INTERNAL_SDK)
    298290#import <WebKitAdditions/SettingsGettersAndSetters.h>
     
    315307#if ENABLE(TEXT_AUTOSIZING)
    316308    float m_textAutosizingFontScaleFactor;
    317     IntSize m_textAutosizingWindowSizeOverride;
    318     bool m_textAutosizingEnabled : 1;
    319309#endif
    320310
  • trunk/Source/WebCore/page/Settings.in

    r200412 r200534  
    198198fixedBackgroundsPaintRelativeToDocument initial=defaultFixedBackgroundsPaintRelativeToDocument
    199199
    200 minimumZoomFontSize type=float, initial=15, conditional=IOS_TEXT_AUTOSIZING
     200textAutosizingEnabled initial=false, setNeedsStyleRecalcInAllFrames=1, conditional=TEXT_AUTOSIZING
     201textAutosizingEnabled initial=defaultTextAutosizingEnabled(), setNeedsStyleRecalcInAllFrames=1, conditional=IOS_TEXT_AUTOSIZING
     202
     203textAutosizingWindowSizeOverride type=IntSize, setNeedsStyleRecalcInAllFrames=1, conditional=TEXT_AUTOSIZING
     204textAutosizingWindowSizeOverride type=IntSize, setNeedsStyleRecalcInAllFrames=1, conditional=IOS_TEXT_AUTOSIZING
     205
     206minimumZoomFontSize type=float, initial=defaultMinimumZoomFontSize(), conditional=IOS_TEXT_AUTOSIZING
    201207
    202208simpleLineLayoutEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
  • trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm

    r194318 r200534  
    112112    setSansSerifFontFamily("Helvetica", USCRIPT_COMMON);
    113113}
    114    
    115 float Settings::defaultMinimumZoomFontSize()
     114
     115bool Settings::defaultTextAutosizingEnabled()
    116116{
    117     if (deviceHasIPadCapability() && ![[getUIApplicationClass() sharedApplication] _isClassic])
    118         return 0;
    119     return 15;
     117    return !deviceHasIPadCapability() || [[getUIApplicationClass() sharedApplication] _isClassic];
    120118}
    121119
  • trunk/Source/WebCore/platform/Logging.h

    r200346 r200534  
    8282    M(SpellingAndGrammar) \
    8383    M(StorageAPI) \
     84    M(TextAutosizing) \
    8485    M(Threading) \
    8586    M(WebAudio) \
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r200524 r200534  
    3333#include "InlineTextBox.h"
    3434#include "LayoutRepainter.h"
     35#include "Logging.h"
    3536#include "RenderCombineText.h"
    3637#include "RenderFlowThread.h"
     
    37623763void RenderBlockFlow::adjustComputedFontSizes(float size, float visibleWidth)
    37633764{
     3765    LOG(TextAutosizing, "RenderBlockFlow %p adjustComputedFontSizes, size=%f visibleWidth=%f, width()=%f. Bailing: %d", this, size, visibleWidth, width().toFloat(), visibleWidth >= width());
     3766
    37643767    // Don't do any work if the block is smaller than the visible area.
    37653768    if (visibleWidth >= width())
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r200098 r200534  
    21682168}
    21692169
     2170#if ENABLE(IOS_TEXT_AUTOSIZING)
     2171static RenderObject::BlockContentHeightType includeNonFixedHeight(const RenderObject* renderer)
     2172{
     2173    const RenderStyle& style = renderer->style();
     2174    if (style.height().type() == Fixed) {
     2175        if (is<RenderBlock>(*renderer)) {
     2176            // For fixed height styles, if the overflow size of the element spills out of the specified
     2177            // height, assume we can apply text auto-sizing.
     2178            if (style.overflowY() == OVISIBLE
     2179                && style.height().value() < downcast<RenderBlock>(renderer)->layoutOverflowRect().maxY())
     2180                return RenderObject::OverflowHeight;
     2181        }
     2182        return RenderObject::FixedHeight;
     2183    }
     2184    return RenderObject::FlexibleHeight;
     2185}
     2186
     2187void RenderElement::adjustComputedFontSizesOnBlocks(float size, float visibleWidth)
     2188{
     2189    Document* document = view().frameView().frame().document();
     2190    if (!document)
     2191        return;
     2192
     2193    Vector<int> depthStack;
     2194    int currentDepth = 0;
     2195    int newFixedDepth = 0;
     2196
     2197    // We don't apply autosizing to nodes with fixed height normally.
     2198    // But we apply it to nodes which are located deep enough
     2199    // (nesting depth is greater than some const) inside of a parent block
     2200    // which has fixed height but its content overflows intentionally.
     2201    for (RenderObject* descendent = traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth); descendent; descendent = descendent->traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth)) {
     2202        while (depthStack.size() > 0 && currentDepth <= depthStack[depthStack.size() - 1])
     2203            depthStack.remove(depthStack.size() - 1);
     2204        if (newFixedDepth)
     2205            depthStack.append(newFixedDepth);
     2206
     2207        int stackSize = depthStack.size();
     2208        if (is<RenderBlockFlow>(*descendent) && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
     2209            downcast<RenderBlockFlow>(*descendent).adjustComputedFontSizes(size, visibleWidth);
     2210        newFixedDepth = 0;
     2211    }
     2212
     2213    // Remove style from auto-sizing table that are no longer valid.
     2214    document->validateAutoSizingNodes();
     2215}
     2216
     2217void RenderElement::resetTextAutosizing()
     2218{
     2219    Document* document = view().frameView().frame().document();
     2220    if (!document)
     2221        return;
     2222
     2223    document->resetAutoSizingNodes();
     2224
     2225    Vector<int> depthStack;
     2226    int currentDepth = 0;
     2227    int newFixedDepth = 0;
     2228
     2229    for (RenderObject* descendent = traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth); descendent; descendent = descendent->traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth)) {
     2230        while (depthStack.size() > 0 && currentDepth <= depthStack[depthStack.size() - 1])
     2231            depthStack.remove(depthStack.size() - 1);
     2232        if (newFixedDepth)
     2233            depthStack.append(newFixedDepth);
     2234
     2235        int stackSize = depthStack.size();
     2236        if (is<RenderBlockFlow>(*descendent) && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
     2237            downcast<RenderBlockFlow>(*descendent).resetComputedFontSize();
     2238        newFixedDepth = 0;
     2239    }
     2240}
     2241#endif // ENABLE(IOS_TEXT_AUTOSIZING)
     2242
    21702243RenderBlock* containingBlockForFixedPosition(const RenderElement* element)
    21712244{
  • trunk/Source/WebCore/rendering/RenderElement.h

    r200098 r200534  
    216216    bool hasContinuation() const { return m_hasContinuation; }
    217217
     218#if ENABLE(IOS_TEXT_AUTOSIZING)
     219    void adjustComputedFontSizesOnBlocks(float size, float visibleWidth);
     220    WEBCORE_EXPORT void resetTextAutosizing();
     221#endif
     222
    218223protected:
    219224    enum BaseTypeFlag {
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r200098 r200534  
    405405    return nullptr;
    406406}
    407 
    408 static RenderObject::BlockContentHeightType includeNonFixedHeight(const RenderObject* renderer)
    409 {
    410     const RenderStyle& style = renderer->style();
    411     if (style.height().type() == Fixed) {
    412         if (is<RenderBlock>(*renderer)) {
    413             // For fixed height styles, if the overflow size of the element spills out of the specified
    414             // height, assume we can apply text auto-sizing.
    415             if (style.overflowY() == OVISIBLE
    416                 && style.height().value() < downcast<RenderBlock>(renderer)->layoutOverflowRect().maxY())
    417                 return RenderObject::OverflowHeight;
    418         }
    419         return RenderObject::FixedHeight;
    420     }
    421     return RenderObject::FlexibleHeight;
    422 }
    423 
    424 
    425 void RenderObject::adjustComputedFontSizesOnBlocks(float size, float visibleWidth)
    426 {
    427     Document* document = view().frameView().frame().document();
    428     if (!document)
    429         return;
    430 
    431     Vector<int> depthStack;
    432     int currentDepth = 0;
    433     int newFixedDepth = 0;
    434 
    435     // We don't apply autosizing to nodes with fixed height normally.
    436     // But we apply it to nodes which are located deep enough
    437     // (nesting depth is greater than some const) inside of a parent block
    438     // which has fixed height but its content overflows intentionally.
    439     for (RenderObject* descendent = traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth); descendent; descendent = descendent->traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth)) {
    440         while (depthStack.size() > 0 && currentDepth <= depthStack[depthStack.size() - 1])
    441             depthStack.remove(depthStack.size() - 1);
    442         if (newFixedDepth)
    443             depthStack.append(newFixedDepth);
    444 
    445         int stackSize = depthStack.size();
    446         if (is<RenderBlockFlow>(*descendent) && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
    447             downcast<RenderBlockFlow>(*descendent).adjustComputedFontSizes(size, visibleWidth);
    448         newFixedDepth = 0;
    449     }
    450 
    451     // Remove style from auto-sizing table that are no longer valid.
    452     document->validateAutoSizingNodes();
    453 }
    454 
    455 void RenderObject::resetTextAutosizing()
    456 {
    457     Document* document = view().frameView().frame().document();
    458     if (!document)
    459         return;
    460 
    461     document->resetAutoSizingNodes();
    462 
    463     Vector<int> depthStack;
    464     int currentDepth = 0;
    465     int newFixedDepth = 0;
    466 
    467     for (RenderObject* descendent = traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth); descendent; descendent = descendent->traverseNext(this, includeNonFixedHeight, currentDepth, newFixedDepth)) {
    468         while (depthStack.size() > 0 && currentDepth <= depthStack[depthStack.size() - 1])
    469             depthStack.remove(depthStack.size() - 1);
    470         if (newFixedDepth)
    471             depthStack.append(newFixedDepth);
    472 
    473         int stackSize = depthStack.size();
    474         if (is<RenderBlockFlow>(*descendent) && !descendent->isListItem() && (!stackSize || currentDepth - depthStack[stackSize - 1] > TextAutoSizingFixedHeightDepth))
    475             downcast<RenderBlockFlow>(*descendent).resetComputedFontSize();
    476         newFixedDepth = 0;
    477     }
    478 }
    479407#endif // ENABLE(IOS_TEXT_AUTOSIZING)
    480408
  • trunk/Source/WebCore/rendering/RenderObject.h

    r200098 r200534  
    196196    RenderObject* traverseNext(const RenderObject* stayWithin, TraverseNextInclusionFunction) const;
    197197    RenderObject* traverseNext(const RenderObject* stayWithin, HeightTypeTraverseNextInclusionFunction, int& currentDepth,  int& newFixedDepth) const;
    198 
    199     void adjustComputedFontSizesOnBlocks(float size, float visibleWidth);
    200     WEBCORE_EXPORT void resetTextAutosizing();
    201198#endif
    202199
  • trunk/Source/WebCore/rendering/TextAutoSizing.cpp

    r200098 r200534  
    3131#include "CSSFontSelector.h"
    3232#include "Document.h"
     33#include "Logging.h"
    3334#include "RenderListMarker.h"
    3435#include "RenderText.h"
     
    117118                scaleChange = averageSize / specifiedSize;
    118119            }
    119            
     120
     121            LOG(TextAutosizing, "  adjust node size %p firstPass=%d averageSize=%f scaleChange=%f", autoSizingNode.get(), firstPass, averageSize, scaleChange);
     122
    120123            auto style = cloneRenderStyleWithState(text->style());
    121124            auto fontDescription = style.fontDescription();
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r200524 r200534  
    6868InternalSettings::Backup::Backup(Settings& settings)
    6969    : m_originalEditingBehavior(settings.editingBehaviorType())
    70 #if ENABLE(TEXT_AUTOSIZING)
     70#if ENABLE(TEXT_AUTOSIZING) || ENABLE(IOS_TEXT_AUTOSIZING)
    7171    , m_originalTextAutosizingEnabled(settings.textAutosizingEnabled())
    7272    , m_originalTextAutosizingWindowSizeOverride(settings.textAutosizingWindowSizeOverride())
     73#endif
     74#if ENABLE(TEXT_AUTOSIZING)
    7375    , m_originalTextAutosizingFontScaleFactor(settings.textAutosizingFontScaleFactor())
    7476#endif
     
    143145    m_pictographFontFamilies.clear();
    144146
    145 #if ENABLE(TEXT_AUTOSIZING)
     147#if ENABLE(TEXT_AUTOSIZING) || ENABLE(IOS_TEXT_AUTOSIZING)
    146148    settings.setTextAutosizingEnabled(m_originalTextAutosizingEnabled);
    147149    settings.setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride);
     150#endif
     151#if ENABLE(TEXT_AUTOSIZING)
    148152    settings.setTextAutosizingFontScaleFactor(m_originalTextAutosizingFontScaleFactor);
    149153#endif
     
    326330void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec)
    327331{
    328 #if ENABLE(TEXT_AUTOSIZING)
     332#if ENABLE(TEXT_AUTOSIZING) || ENABLE(IOS_TEXT_AUTOSIZING)
    329333    InternalSettingsGuardForSettings();
    330334    settings()->setTextAutosizingEnabled(enabled);
     
    337341void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec)
    338342{
    339 #if ENABLE(TEXT_AUTOSIZING)
     343#if ENABLE(TEXT_AUTOSIZING) || ENABLE(IOS_TEXT_AUTOSIZING)
    340344    InternalSettingsGuardForSettings();
    341345    settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
  • trunk/Source/WebCore/testing/InternalSettings.h

    r200524 r200534  
    6565        ScriptFontFamilyMap m_pictographFontFamilies;
    6666
    67 #if ENABLE(TEXT_AUTOSIZING)
     67#if ENABLE(TEXT_AUTOSIZING) || ENABLE(IOS_TEXT_AUTOSIZING)
    6868        bool m_originalTextAutosizingEnabled;
    6969        IntSize m_originalTextAutosizingWindowSizeOverride;
     70#endif
     71
     72#if ENABLE(TEXT_AUTOSIZING)
    7073        float m_originalTextAutosizingFontScaleFactor;
    7174#endif
     75
    7276        String m_originalMediaTypeOverride;
    7377        bool m_originalCanvasUsesAcceleratedDrawing;
  • trunk/Source/WebKit/ios/ChangeLog

    r198289 r200534  
     12016-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
     4        https://bugs.webkit.org/show_bug.cgi?id=157432
     5        rdar://problem/16406720
     6
     7        Reviewed by Dean Jackson.
     8
     9        Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
     10
     11        Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
     12        preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
     13        These two settings are shared with TEXT_AUTOSIZING.
     14
     15        Add a TextAutosizing log channel, which is useful for generated -expected.html results.
     16
     17        Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
     18        without changes.
     19
     20        An implication of this set of changes is that the way clients enable text autosizing
     21        has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
     22        Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
     23        on iPhone only, not iPad.
     24
     25        Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
     26        instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
     27
     28        UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
     29        which will now always return 15, but had no other code that toggled this. So it's safe to just rely
     30        on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
     31
     32        * Misc/WebUIKitSupport.mm:
     33        (WebKitGetMinimumZoomFontSize):
     34
    1352016-03-16  Jiewen Tan  <jiewen_tan@apple.com>
    236
  • trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm

    r195180 r200534  
    8585float WebKitGetMinimumZoomFontSize(void)
    8686{
    87     return Settings::defaultMinimumZoomFontSize();
     87    return WebCore::Settings::defaultMinimumZoomFontSize();
    8888}
    8989
  • trunk/Source/WebKit/mac/ChangeLog

    r200524 r200534  
     12016-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
     4        https://bugs.webkit.org/show_bug.cgi?id=157432
     5        rdar://problem/16406720
     6
     7        Reviewed by Dean Jackson.
     8
     9        Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
     10
     11        Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
     12        preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
     13        These two settings are shared with TEXT_AUTOSIZING.
     14
     15        Add a TextAutosizing log channel, which is useful for generated -expected.html results.
     16
     17        Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
     18        without changes.
     19
     20        An implication of this set of changes is that the way clients enable text autosizing
     21        has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
     22        Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
     23        on iPhone only, not iPad.
     24
     25        Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
     26        instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
     27
     28        UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
     29        which will now always return 15, but had no other code that toggled this. So it's safe to just rely
     30        on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
     31
     32        * Configurations/FeatureDefines.xcconfig:
     33        * WebView/WebPreferenceKeysPrivate.h:
     34        * WebView/WebPreferences.mm:
     35        (+[WebPreferences initialize]):
     36        (-[WebPreferences _setTextAutosizingEnabled:]):
     37        (-[WebPreferences _textAutosizingEnabled]):
     38        * WebView/WebPreferencesPrivate.h:
     39
    1402016-05-06  Dean Jackson  <dino@apple.com>
    241
  • trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig

    r200075 r200534  
    108108ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
    109109
    110 ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
     110ENABLE_IOS_TEXT_AUTOSIZING = ENABLE_IOS_TEXT_AUTOSIZING;
    111111ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
    112112
  • trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r200524 r200534  
    185185#define WebKitDebugFullPageZoomPreferenceKey @"WebKitDebugFullPageZoomPreferenceKey"
    186186#define WebKitMinimumZoomFontSizePreferenceKey @"WebKitMinimumZoomFontSizePreferenceKey"
     187#define WebKitTextAutosizingEnabledPreferenceKey @"WebKitTextAutosizingEnabled"
    187188#define WebKitHTTPEquivEnabledPreferenceKey @"WebKitHTTPEquivEnabled"
    188189
  • trunk/Source/WebKit/mac/WebView/WebPreferences.mm

    r200524 r200534  
    580580#if ENABLE(IOS_TEXT_AUTOSIZING)
    581581        [NSNumber numberWithFloat:Settings::defaultMinimumZoomFontSize()], WebKitMinimumZoomFontSizePreferenceKey,
     582        [NSNumber numberWithBool:Settings::defaultTextAutosizingEnabled()], WebKitTextAutosizingEnabledPreferenceKey,
    582583#endif
    583584        [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
     
    14751476{
    14761477    return [self _floatValueForKey:WebKitMinimumZoomFontSizePreferenceKey];
     1478}
     1479
     1480- (void)_setTextAutosizingEnabled:(BOOL)enabled
     1481{
     1482    [self _setBoolValue:enabled forKey:WebKitTextAutosizingEnabledPreferenceKey];
     1483}
     1484
     1485- (BOOL)_textAutosizingEnabled
     1486{
     1487    return [self _boolValueForKey:WebKitTextAutosizingEnabledPreferenceKey];
    14771488}
    14781489#endif
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r200524 r200534  
    315315#endif
    316316
     317- (void)_setTextAutosizingEnabled:(BOOL)enabled;
     318- (BOOL)_textAutosizingEnabled;
     319
    317320- (BOOL)isInheritURIQueryComponentEnabled;
    318321- (void)setEnableInheritURIQueryComponent:(BOOL)flag;
  • trunk/Source/WebKit2/ChangeLog

    r200524 r200534  
     12016-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
     4        https://bugs.webkit.org/show_bug.cgi?id=157432
     5        rdar://problem/16406720
     6
     7        Reviewed by Dean Jackson.
     8
     9        Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
     10       
     11        Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
     12        preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
     13        These two settings are shared with TEXT_AUTOSIZING.
     14
     15        Add a TextAutosizing log channel, which is useful for generated -expected.html results.
     16
     17        Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
     18        without changes.
     19
     20        An implication of this set of changes is that the way clients enable text autosizing
     21        has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
     22        Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
     23        on iPhone only, not iPad.
     24
     25        Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
     26        instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
     27
     28        UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
     29        which will now always return 15, but had no other code that toggled this. So it's safe to just rely
     30        on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
     31
     32        * Configurations/FeatureDefines.xcconfig:
     33        * Shared/WebPreferencesDefinitions.h:
     34        * UIProcess/API/Cocoa/WKPreferences.mm:
     35        (-[WKPreferences _textAutosizingEnabled]):
     36        (-[WKPreferences _setTextAutosizingEnabled:]):
     37        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
     38        * WebProcess/WebPage/WebPage.cpp:
     39        (WebKit::WebPage::updatePreferences):
     40
    1412016-05-06  Dean Jackson  <dino@apple.com>
    242
  • trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig

    r200075 r200534  
    108108ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
    109109
    110 ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
     110ENABLE_IOS_TEXT_AUTOSIZING = ENABLE_IOS_TEXT_AUTOSIZING;
    111111ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
    112112
  • trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h

    r200524 r200534  
    7070#define DEFAULT_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY false
    7171#define DEFAULT_SHOULD_RESPECT_IMAGE_ORIENTATION true
    72 #define DEFAULT_MINIMUM_FONT_ZOOM_SIZE WebCore::Settings::defaultMinimumZoomFontSize()
    7372#define DEFAULT_PASSWORD_ECHO_ENABLED true
    7473#define DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK false
     
    8685#define DEFAULT_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY true
    8786#define DEFAULT_SHOULD_RESPECT_IMAGE_ORIENTATION false
    88 #define DEFAULT_MINIMUM_FONT_ZOOM_SIZE 0
    8987#define DEFAULT_PASSWORD_ECHO_ENABLED false
    9088#define DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK true
     
    195193    macro(PDFPluginEnabled, pdfPluginEnabled, Bool, bool, DEFAULT_PDFPLUGIN_ENABLED, "", "") \
    196194    macro(UsesEncodingDetector, usesEncodingDetector, Bool, bool, false, "", "") \
    197     macro(TextAutosizingEnabled, textAutosizingEnabled, Bool, bool, false, "", "") \
     195    macro(TextAutosizingEnabled, textAutosizingEnabled, Bool, bool, WebCore::Settings::defaultTextAutosizingEnabled(), "", "") \
    198196    macro(AggressiveTileRetentionEnabled, aggressiveTileRetentionEnabled, Bool, bool, false, "", "") \
    199197    macro(TemporaryTileCohortRetentionEnabled, temporaryTileCohortRetentionEnabled, Bool, bool, DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED, "", "") \
     
    241239    macro(MinimumFontSize, minimumFontSize, Double, double, 0, "", "") \
    242240    macro(MinimumLogicalFontSize, minimumLogicalFontSize, Double, double, 9, "", "") \
    243     macro(MinimumZoomFontSize, minimumZoomFontSize, Double, double, DEFAULT_MINIMUM_FONT_ZOOM_SIZE, "", "") \
     241    macro(MinimumZoomFontSize, minimumZoomFontSize, Double, double, WebCore::Settings::defaultMinimumZoomFontSize(), "", "") \
    244242    macro(DefaultFontSize, defaultFontSize, Double, double, 16, "", "") \
    245243    macro(DefaultFixedFontSize, defaultFixedFontSize, Double, double, 13, "", "") \
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm

    r199700 r200534  
    304304}
    305305
     306- (BOOL)_textAutosizingEnabled
     307{
     308    return _preferences->textAutosizingEnabled();
     309}
     310
     311- (void)_setTextAutosizingEnabled:(BOOL)enabled
     312{
     313    _preferences->setTextAutosizingEnabled(enabled);
     314}
     315
    306316- (BOOL)_developerExtrasEnabled
    307317{
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r200033 r200534  
    6363@property (nonatomic, setter=_setAcceleratedDrawingEnabled:) BOOL _acceleratedDrawingEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
    6464@property (nonatomic, setter=_setDisplayListDrawingEnabled:) BOOL _displayListDrawingEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
     65@property (nonatomic, setter=_setTextAutosizingEnabled:) BOOL _textAutosizingEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
    6566
    6667@property (nonatomic, setter=_setDeveloperExtrasEnabled:) BOOL _developerExtrasEnabled WK_AVAILABLE(10_11, 9_0);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r200524 r200534  
    29692969#endif
    29702970
    2971 #if ENABLE(IOS_TEXT_AUTOSIZING)
    2972     settings.setMinimumZoomFontSize(store.getDoubleValueForKey(WebPreferencesKey::minimumZoomFontSizeKey()));
    2973 #endif
    2974 
    29752971#if ENABLE(WEB_AUDIO)
    29762972    settings.setWebAudioEnabled(store.getBoolValueForKey(WebPreferencesKey::webAudioEnabledKey()));
     
    30233019    settings.setUsesEncodingDetector(store.getBoolValueForKey(WebPreferencesKey::usesEncodingDetectorKey()));
    30243020
    3025 #if ENABLE(TEXT_AUTOSIZING)
     3021#if ENABLE(TEXT_AUTOSIZING) || ENABLE(IOS_TEXT_AUTOSIZING)
    30263022    settings.setTextAutosizingEnabled(store.getBoolValueForKey(WebPreferencesKey::textAutosizingEnabledKey()));
     3023#endif
     3024#if ENABLE(IOS_TEXT_AUTOSIZING)
     3025    settings.setMinimumZoomFontSize(store.getDoubleValueForKey(WebPreferencesKey::minimumZoomFontSizeKey()));
    30273026#endif
    30283027
  • trunk/Tools/ChangeLog

    r200524 r200534  
     12016-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
     4        https://bugs.webkit.org/show_bug.cgi?id=157432
     5        rdar://problem/16406720
     6
     7        Reviewed by Dean Jackson.
     8
     9        Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
     10
     11        Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
     12        preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
     13        These two settings are shared with TEXT_AUTOSIZING.
     14
     15        Add a TextAutosizing log channel, which is useful for generated -expected.html results.
     16
     17        Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
     18        without changes.
     19
     20        An implication of this set of changes is that the way clients enable text autosizing
     21        has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
     22        Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
     23        on iPhone only, not iPad.
     24
     25        Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
     26        instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
     27
     28        UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
     29        which will now always return 15, but had no other code that toggled this. So it's safe to just rely
     30        on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
     31
     32        * DumpRenderTree/mac/DumpRenderTree.mm:
     33        (resetWebPreferencesToConsistentValues):
     34        * DumpRenderTree/mac/TestRunnerMac.mm:
     35        (TestRunner::setTextAutosizingEnabled):
     36        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
     37        * WebKitTestRunner/ios/TestControllerIOS.mm:
     38        (WTR::TestController::platformResetPreferencesToConsistentValues):
     39
    1402016-05-06  Dean Jackson  <dino@apple.com>
    241
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r200524 r200534  
    955955
    956956#if ENABLE(IOS_TEXT_AUTOSIZING)
    957     // Disable text autosizing by default.
    958     [preferences _setMinimumZoomFontSize:0];
     957    [preferences _setTextAutosizingEnabled:NO];
    959958#endif
    960959
     
    975974#if ENABLE(WEB_AUDIO)
    976975    [preferences setWebAudioEnabled:YES];
    977 #endif
    978 
    979 #if ENABLE(IOS_TEXT_AUTOSIZING)
    980     // Disable text autosizing by default.
    981     [preferences _setMinimumZoomFontSize:0];
    982976#endif
    983977
  • trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm

    r199200 r200534  
    540540void TestRunner::setTextAutosizingEnabled(bool enabled)
    541541{
    542     const float phoneMinimumZoomFontSize = 15;
    543     [[[mainFrame webView] preferences] _setMinimumZoomFontSize:(enabled ? phoneMinimumZoomFontSize : 0)];
     542    [[[mainFrame webView] preferences] _setTextAutosizingEnabled:enabled];
    544543}
    545544#endif
  • trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig

    r200075 r200534  
    108108ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
    109109
    110 ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
     110ENABLE_IOS_TEXT_AUTOSIZING = ENABLE_IOS_TEXT_AUTOSIZING;
    111111ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
    112112
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r190335 r200534  
    7878{
    7979    WKPreferencesRef preferences = platformPreferences();
    80     // Note that WKPreferencesSetTextAutosizingEnabled has no effect on iOS.
    81     WKPreferencesSetMinimumZoomFontSize(preferences, 0);
     80    WKPreferencesSetTextAutosizingEnabled(preferences, false);
    8281}
    8382
Note: See TracChangeset for help on using the changeset viewer.