Changeset 65029 in webkit


Ignore:
Timestamp:
Aug 9, 2010 6:43:05 PM (14 years ago)
Author:
weinig@apple.com
Message:

Add zoom support for injected bundle
https://bugs.webkit.org/show_bug.cgi?id=43759

Reviewed by Geoffrey Garen.

WebKit2:

Add SPI to change the zoom factor for a page.

  • WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:

(toZoomMode):

  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:

(WKBundlePageGetZoomFactor):
(WKBundlePageSetZoomFactor):
(WKBundlePageSetZoomMode):

  • WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::zoomFactor):
(WebKit::WebPage::setZoomFactor):
(WebKit::WebPage::setZoomMode):

  • WebProcess/WebPage/WebPage.h:

WebKitTools:

Use zoom factor SPI to implement zoom related eventSender functions.

  • WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
  • WebKitTestRunner/InjectedBundle/EventSendingController.cpp:

(WTR::EventSendingController::textZoomIn):
(WTR::EventSendingController::textZoomOut):
(WTR::EventSendingController::zoomPageIn):
(WTR::EventSendingController::zoomPageOut):

  • WebKitTestRunner/InjectedBundle/EventSendingController.h:
  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::reset): Reset zoom mode and level for each test.

LayoutTests:

  • platform/mac-wk2/Skipped: Remove now passing tests.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65019 r65029  
     12010-08-09  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Add zoom support for injected bundle
     6        https://bugs.webkit.org/show_bug.cgi?id=43759
     7
     8        * platform/mac-wk2/Skipped: Remove now passing tests.
     9
    1102010-08-09  Ryosuke Niwa  <rniwa@webkit.org>
    211
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r64985 r65029  
    234234fast/css/hover-affects-child.html
    235235fast/css/hover-subselector.html
    236 fast/css/ignore-text-zoom.html
    237236fast/css/layerZOrderCrash.html
    238237fast/css/list-item-pseudo-nocrash.html
     
    243242fast/css/universal-hover-quirk.html
    244243fast/css/user-drag-none.html
    245 fast/css/zoom-body-scroll.html
    246244fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll.html
    247 fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html
    248 fast/dom/elementFromPoint-relative-to-viewport.html
    249245fast/dom/HTMLTableColElement/resize-table-using-col-width.html
    250246fast/dom/Node/mutation-blur.html
     
    516512platform/mac/fast/forms/listbox-scrollbar-hit-test.html
    517513platform/mac/fast/overflow/overflow-scrollbar-hit-test.html
    518 plugins/createScriptableObject-before-start.html
    519 plugins/destroy-during-npp-new.html
    520514plugins/resize-from-plugin.html
    521515scrollbars/overflow-custom-scrollbar-crash.html
     
    580574svg/custom/stroke-width-click.svg
    581575svg/custom/text-hit-test.svg
    582 svg/custom/text-zoom.xhtml
    583576svg/custom/use-clipped-hit.svg
    584577svg/custom/use-css-events.svg
     
    807800svg/text/selection-doubleclick.svg
    808801svg/text/selection-tripleclick.svg
    809 svg/zoom/page/absolute-sized-document-no-scrollbars.svg
    810 svg/zoom/page/absolute-sized-document-scrollbars.svg
    811 svg/zoom/page/relative-sized-document-scrollbars.svg
    812802svg/zoom/page/zoom-coords-viewattr-01-b.svg
    813 svg/zoom/page/zoom-foreignObject.svg
    814 svg/zoom/page/zoom-hixie-mixed-008.xml
    815 svg/zoom/page/zoom-hixie-mixed-009.xml
    816 svg/zoom/page/zoom-hixie-rendering-model-004.xhtml
    817 svg/zoom/page/zoom-svg-float-border-padding.xml
    818 svg/zoom/text/absolute-sized-document-no-scrollbars.svg
    819 svg/zoom/text/absolute-sized-document-scrollbars.svg
    820 svg/zoom/text/relative-sized-document-scrollbars.svg
    821803svg/zoom/text/zoom-coords-viewattr-01-b.svg
    822 svg/zoom/text/zoom-foreignObject.svg
    823 svg/zoom/text/zoom-hixie-mixed-008.xml
    824 svg/zoom/text/zoom-hixie-mixed-009.xml
    825 svg/zoom/text/zoom-hixie-rendering-model-004.xhtml
    826 svg/zoom/text/zoom-svg-float-border-padding.xml
    827804
    828805# WebKitTestRunner needs to support layoutTestController.setXSSAuditorEnabled
  • trunk/WebKit2/ChangeLog

    r65021 r65029  
     12010-08-09  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Add zoom support for injected bundle
     6        https://bugs.webkit.org/show_bug.cgi?id=43759
     7
     8        Add SPI to change the zoom factor for a page.
     9
     10        * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
     11        (toZoomMode):
     12        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     13        (WKBundlePageGetZoomFactor):
     14        (WKBundlePageSetZoomFactor):
     15        (WKBundlePageSetZoomMode):
     16        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
     17        * WebProcess/WebPage/WebPage.cpp:
     18        (WebKit::WebPage::zoomFactor):
     19        (WebKit::WebPage::setZoomFactor):
     20        (WebKit::WebPage::setZoomMode):
     21        * WebProcess/WebPage/WebPage.h:
     22
    1232010-08-06  Gavin Barraclough  <barraclough@apple.com>
    224
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h

    r64788 r65029  
    2929#include "WKBundleBase.h"
    3030#include "WKBundlePage.h"
     31#include "WKBundlePagePrivate.h"
    3132#include <WebCore/EditorInsertAction.h>
    3233#include <WebCore/TextAffinity.h>
     34#include <WebCore/ZoomMode.h>
    3335
    3436namespace WebCore {
     
    113115}
    114116
     117inline WebCore::ZoomMode toZoomMode(WKBundlePageZoomMode wkZoomMode)
     118{
     119    switch (wkZoomMode) {
     120    case kWKBundlePageZoomModeTextOnly:
     121        return WebCore::ZoomTextOnly;
     122    case kWKBundlePageZoomModePage:
     123        return WebCore::ZoomPage;
     124    }
     125
     126    ASSERT_NOT_REACHED();
     127    return WebCore::ZoomTextOnly;
     128}
     129
    115130#endif // WKBundleAPICast_h
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r64862 r65029  
    9292    toWK(pageRef)->sendClose();
    9393}
     94
     95float WKBundlePageGetZoomFactor(WKBundlePageRef pageRef)
     96{
     97    return toWK(pageRef)->zoomFactor();
     98}
     99
     100void WKBundlePageSetZoomFactor(WKBundlePageRef pageRef, float zoomFactor)
     101{
     102    toWK(pageRef)->setZoomFactor(zoomFactor);
     103}
     104
     105void WKBundlePageSetZoomMode(WKBundlePageRef pageRef, WKBundlePageZoomMode zoomMode)
     106{
     107    toWK(pageRef)->setZoomMode(toZoomMode(zoomMode));
     108}
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h

    r64485 r65029  
    3434#endif
    3535
     36enum WKBundlePageZoomMode {
     37    kWKBundlePageZoomModePage = 0,
     38    kWKBundlePageZoomModeTextOnly = 1
     39};
     40typedef enum WKBundlePageZoomMode WKBundlePageZoomMode;
     41
    3642WK_EXPORT bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef page, WKStringRef commandName);
    3743WK_EXPORT void WKBundlePageClearMainFrameName(WKBundlePageRef page);
     
    4046WK_EXPORT void WKBundlePageExecuteEditingCommand(WKBundlePageRef page, WKStringRef commandName, WKStringRef argument);
    4147
     48WK_EXPORT float WKBundlePageGetZoomFactor(WKBundlePageRef page);
     49WK_EXPORT void WKBundlePageSetZoomFactor(WKBundlePageRef page, float zoomFactor);
     50WK_EXPORT void WKBundlePageSetZoomMode(WKBundlePageRef page, WKBundlePageZoomMode zoomMode);
     51
    4252#ifdef __cplusplus
    4353}
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r65021 r65029  
    311311}
    312312
     313float WebPage::zoomFactor() const
     314{
     315    if (Frame* coreFrame = m_mainFrame->coreFrame()) {
     316        if (FrameView* view = coreFrame->view())
     317            return view->zoomFactor();
     318    }
     319   
     320    return 1.0f;
     321}
     322
     323void WebPage::setZoomFactor(float zoomFactor)
     324{
     325    if (Frame* coreFrame = m_mainFrame->coreFrame()) {
     326        if (FrameView* view = coreFrame->view())
     327            return view->setZoomFactor(zoomFactor, m_page->settings()->zoomMode());
     328    }
     329}
     330
     331void WebPage::setZoomMode(ZoomMode mode)
     332{
     333    m_page->settings()->setZoomMode(mode);
     334}
     335
    313336// Events
    314337
  • trunk/WebKit2/WebProcess/WebPage/WebPage.h

    r65021 r65029  
    3535#include <WebCore/FrameLoaderTypes.h>
    3636#include <WebCore/IntRect.h>
     37#include <WebCore/ZoomMode.h>
    3738#include <wtf/Forward.h>
    3839#include <wtf/HashMap.h>
     
    114115    void clearMainFrameName();
    115116    void sendClose();
     117   
     118    float zoomFactor() const;
     119    void setZoomFactor(float);
     120    void setZoomMode(WebCore::ZoomMode);
    116121
    117122#if USE(ACCELERATED_COMPOSITING)
     
    151156    void platformPreferencesDidChange(const WebPreferencesStore&);
    152157    void didReceivePolicyDecision(WebFrame*, uint64_t listenerID, WebCore::PolicyAction policyAction);
    153    
     158
    154159    WebCore::Page* m_page;
    155160    RefPtr<WebFrame> m_mainFrame;
  • trunk/WebKitTools/ChangeLog

    r65028 r65029  
     12010-08-09  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Add zoom support for injected bundle
     6        https://bugs.webkit.org/show_bug.cgi?id=43759
     7
     8        Use zoom factor SPI to implement zoom related eventSender functions.
     9
     10        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
     11        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
     12        (WTR::EventSendingController::textZoomIn):
     13        (WTR::EventSendingController::textZoomOut):
     14        (WTR::EventSendingController::zoomPageIn):
     15        (WTR::EventSendingController::zoomPageOut):
     16        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
     17        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     18        (WTR::InjectedBundlePage::reset): Reset zoom mode and level for each test.
     19
    1202010-08-09  Gavin Barraclough  <barraclough@apple.com>
    221
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl

    r64985 r65029  
    3535
    3636        // Zoom functions.
    37         [CustomArgumentHandling] void textZoomIn(); // CustomArgumentHandling only to throw exception while not implemented.
    38         [CustomArgumentHandling] void textZoomOut(); // CustomArgumentHandling only to throw exception while not implemented.
    39         [CustomArgumentHandling] void zoomPageIn(); // CustomArgumentHandling only to throw exception while not implemented.
    40         [CustomArgumentHandling] void zoomPageOut(); // CustomArgumentHandling only to throw exception while not implemented.
     37        void textZoomIn();
     38        void textZoomOut();
     39        void zoomPageIn();
     40        void zoomPageOut();
    4141    };
    4242
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp

    r64985 r65029  
    2727
    2828#include "InjectedBundle.h"
     29#include "InjectedBundlePage.h"
    2930#include "JSEventSendingController.h"
     31#include <WebKit2/WKBundlePage.h>
     32#include <WebKit2/WKBundlePagePrivate.h>
    3033#include <WebKit2/WKBundlePrivate.h>
    3134
    3235namespace WTR {
     36
     37static const float ZoomMultiplierRatio = 1.2f;
    3338
    3439PassRefPtr<EventSendingController> EventSendingController::create()
     
    8691}
    8792
    88 void EventSendingController::textZoomIn(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     93void EventSendingController::textZoomIn()
    8994{
    90     setExceptionForString(context, exception, "EventSender.textZoomIn is not yet supported.");
     95    WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModeTextOnly);
     96    float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
     97    WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor * ZoomMultiplierRatio);
    9198}
    9299
    93 void EventSendingController::textZoomOut(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     100void EventSendingController::textZoomOut()
    94101{
    95     setExceptionForString(context, exception, "EventSender.textZoomOut is not yet supported.");
     102    WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModeTextOnly);
     103    float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
     104    WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor / ZoomMultiplierRatio);
    96105}
    97106
    98 void EventSendingController::zoomPageIn(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     107void EventSendingController::zoomPageIn()
    99108{
    100     setExceptionForString(context, exception, "EventSender.zoomPageIn is not yet supported.");
     109    WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModePage);
     110    float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
     111    WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor * ZoomMultiplierRatio);
    101112}
    102113
    103 void EventSendingController::zoomPageOut(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     114void EventSendingController::zoomPageOut()
    104115{
    105     setExceptionForString(context, exception, "EventSender.zoomPageOut is not yet supported.");
     116    WKBundlePageSetZoomMode(InjectedBundle::shared().page()->page(), kWKBundlePageZoomModePage);
     117    float zoomFactor = WKBundlePageGetZoomFactor(InjectedBundle::shared().page()->page());
     118    WKBundlePageSetZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor / ZoomMultiplierRatio);
    106119}
    107120
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/EventSendingController.h

    r64985 r65029  
    4949    void leapForward(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
    5050
    51     void textZoomIn(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
    52     void textZoomOut(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
    53     void zoomPageIn(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
    54     void zoomPageOut(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
     51    // Zoom functions.
     52    void textZoomIn();
     53    void textZoomOut();
     54    void zoomPageIn();
     55    void zoomPageOut();
    5556
    5657private:
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r64985 r65029  
    151151{
    152152    WKBundlePageClearMainFrameName(m_page);
     153
     154    WKBundlePageSetZoomFactor(m_page, 1.0f);
     155    WKBundlePageSetZoomMode(m_page, kWKBundlePageZoomModePage);
    153156}
    154157
Note: See TracChangeset for help on using the changeset viewer.