Commit 255a8cf1 authored by mrobinson@webkit.org's avatar mrobinson@webkit.org

2010-05-20 Martin Robinson <mrobinson@webkit.org>

        Reviewed by Ojan Vafai.

        Expose the editing behavior setting in DRT to test all editing code paths
        https://bugs.webkit.org/show_bug.cgi?id=38603

        * editing/selection/extend-selection-after-double-click.html: Use the new DRT support for changing editing behavior.
        * editing/selection/extend-selection-after-double-click-expected.txt: Update expected results to reflect both behaviors.
2010-05-20  Martin Robinson  <mrobinson@webkit.org>

        Reviewed by Ojan Vafai.

        Expose the editing behavior setting in DRT to test all editing code paths
        https://bugs.webkit.org/show_bug.cgi?id=38603

        * public/WebSettings.h:
        (WebKit::WebSettings::): Added an enum for EditingBehavior types.
        * src/WebSettingsImpl.cpp:
        (WebKit::WebSettingsImpl::setEditingBehavior): Added.
        * src/WebSettingsImpl.h:
2010-05-20  Martin Robinson  <mrobinson@webkit.org>

        Reviewed by Ojan Vafai.

        Expose the editing behavior setting in DRT to test all editing code paths
        https://bugs.webkit.org/show_bug.cgi?id=38603

        * WebView/WebFrame.mm:
        (core):
        * WebView/WebFrameInternal.h: Added a conversion method from the API enum to the WebCore enum.
        * WebView/WebPreferenceKeysPrivate.h: Added a preference key for the new setting.
        * WebView/WebPreferences.mm:
        (+[WebPreferences initialize]): Initialize the EditingBehavior to Mac style.
        (-[WebPreferences editingBehavior]): Added.
        (-[WebPreferences setEditingBehavior:]): Added.
        * WebView/WebPreferencesPrivate.h: Added the new API points to the private API.
        * WebView/WebView.mm:
        (-[WebView _preferencesChangedNotification:]): Set the editing behavior via the WebPreferences setting.
2010-05-20  Martin Robinson  <mrobinson@webkit.org>

        Reviewed by Ojan Vafai.

        Expose the editing behavior setting in DRT to test all editing code paths
        https://bugs.webkit.org/show_bug.cgi?id=38603

        Expose the EditingBehavior setting in the Windows API.

        * Interfaces/IWebPreferences.idl: Add the API point for setting the editing behavior.
        * WebPreferenceKeysPrivate.h: Add a key for the editing behavior setting.
        * WebPreferences.cpp:
        (WebPreferences::editingBehavior): Added.
        (WebPreferences::setEditingBehavior): Added.
        * WebPreferences.h: Add method declarations.
        * WebView.cpp:
        (WebView::notifyPreferencesChanged): Update the WebCore setting based on the WebPreferences setting.
2010-05-20  Martin Robinson  <mrobinson@webkit.org>

        Reviewed by Ojan Vafai.

        Expose the editing behavior setting in DRT to test all editing code paths
        https://bugs.webkit.org/show_bug.cgi?id=38603

        * DumpRenderTree/LayoutTestController.cpp:
        (setEditingBehaviorCallback): Added.
        (LayoutTestController::staticFunctions): Expose the setEditingBehaviorCallback function.
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/chromium/LayoutTestController.cpp: Add callback method for setting editing behavior.
        * DumpRenderTree/chromium/LayoutTestController.h: Declaration for this method.
        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
        (LayoutTestController::setEditingBehavior): Implementation of editing behavior control.
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::setEditingBehavior): Ditto
        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
        (LayoutTestController::setEditingBehavior): Added stub implementation of editing behavior control.
        * DumpRenderTree/qt/LayoutTestControllerQt.h:
        (LayoutTestController::setEditingBehavior): Add slot for controlling editor behavior.
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::setEditingBehavior): Implementation of editing behavior control.
        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
        (LayoutTestController::setEditingBehavior): Added stub implementation of editing behavior control.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dce4a0eb
2010-05-20 Martin Robinson <mrobinson@webkit.org>
Reviewed by Ojan Vafai.
Expose the editing behavior setting in DRT to test all editing code paths
https://bugs.webkit.org/show_bug.cgi?id=38603
* editing/selection/extend-selection-after-double-click.html: Use the new DRT support for changing editing behavior.
* editing/selection/extend-selection-after-double-click-expected.txt: Update expected results to reflect both behaviors.
2010-05-20 Adam Langley <agl@chromium.org>
Reviewed by David Levin.
......@@ -5,3 +5,5 @@ This test does not run interactively. It uses the event sender to do mouse click
This is a paragraph.
SUCCESS
SUCCESS
......@@ -18,13 +18,25 @@
eventSender.leapForward(1000);
}
function runTest()
function logResult(result)
{
document.getElementById("result").innerHTML += result + "<br/>";
}
function runTests()
{
if (!window.eventSender || !window.layoutTestController)
return;
layoutTestController.dumpAsText();
runTest("mac", "a paragraph");
runTest("win", "paragra");
}
function runTest(behavior, expectedText)
{
layoutTestController.setEditingBehavior(behavior);
doubleClickWord();
getSelection().modify("extend", "backward", "character");
getSelection().modify("extend", "backward", "character");
......@@ -32,19 +44,15 @@
getSelection().modify("extend", "backward", "character");
getSelection().modify("extend", "backward", "character");
var result;
var selectedText = getSelection().toString();
var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
var expectedText = onMacPlatform ? "a paragraph" : "paragra";
if (selectedText == expectedText)
result = "SUCCESS";
logResult("SUCCESS");
else
result = "FAILURE: The selected text is \"" + selectedText + "\" and should be \"" + expectedText + "\".";
document.getElementById("result").firstChild.data = result;
logResult("FAILURE: The selected text is \"" + selectedText + "\" and should be \"" + expectedText + "\".");
}
</script>
</head>
<body onload="runTest()">
<body onload="runTests()">
<p>This tests modifying a selection created with a double click with shift arrow key.</p>
<p style="color:green">
This test does not run interactively.
......@@ -54,5 +62,5 @@
The selection should include the words "a paragraph" on mac and "paragra" on win/linux..
</p>
<p>This is a para<span style="color:blue" id="start">g</span>raph.</p>
<p id="result">TEST HAS NOT RUN</p>
<p id="result"></p>
</body>
2010-05-20 Martin Robinson <mrobinson@webkit.org>
Reviewed by Ojan Vafai.
Expose the editing behavior setting in DRT to test all editing code paths
https://bugs.webkit.org/show_bug.cgi?id=38603
* public/WebSettings.h:
(WebKit::WebSettings::): Added an enum for EditingBehavior types.
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setEditingBehavior): Added.
* src/WebSettingsImpl.h:
2010-05-19 Vangelis Kokkevis <vangelis@chromium.org>
Reviewed by Darin Fisher.
......
......@@ -43,6 +43,11 @@ class WebURL;
// these functions have a 1:1 mapping with the methods in WebCore/page/settings.h.
class WebSettings {
public:
enum EditingBehavior {
EditingBehaviorMac,
EditingBehaviorWin
};
virtual void setStandardFontFamily(const WebString&) = 0;
virtual void setFixedFontFamily(const WebString&) = 0;
virtual void setSerifFontFamily(const WebString&) = 0;
......@@ -84,6 +89,7 @@ public:
virtual void setOfflineWebApplicationCacheEnabled(bool) = 0;
virtual void setExperimentalWebGLEnabled(bool) = 0;
virtual void setShowDebugBorders(bool) = 0;
virtual void setEditingBehavior(EditingBehavior) = 0;
protected:
~WebSettings() { }
......
......@@ -41,6 +41,7 @@
#include "NotificationPresenter.h"
#include "PasteboardPrivate.h"
#include "PlatformCursor.h"
#include "Settings.h"
#include "StringImpl.h"
#include "TextAffinity.h"
#include "WebAccessibilityObject.h"
......@@ -52,6 +53,7 @@
#include "WebMediaPlayer.h"
#include "WebNotificationPresenter.h"
#include "WebScrollbar.h"
#include "WebSettings.h"
#include "WebTextAffinity.h"
#include "WebTextCaseSensitivity.h"
#include <wtf/Assertions.h>
......@@ -300,6 +302,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPage, ScrollByPage);
COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByDocument, ScrollByDocument);
COMPILE_ASSERT_MATCHING_ENUM(WebScrollbar::ScrollByPixel, ScrollByPixel);
COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorMac, EditingMacBehavior);
COMPILE_ASSERT_MATCHING_ENUM(WebSettings::EditingBehaviorWin, EditingWindowsBehavior);
COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM);
COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM);
......
......@@ -269,4 +269,9 @@ void WebSettingsImpl::setShowDebugBorders(bool show)
m_settings->setShowDebugBorders(show);
}
void WebSettingsImpl::setEditingBehavior(EditingBehavior behavior)
{
m_settings->setEditingBehavior(static_cast<WebCore::EditingBehavior>(behavior));
}
} // namespace WebKit
......@@ -85,6 +85,7 @@ public:
virtual void setOfflineWebApplicationCacheEnabled(bool);
virtual void setExperimentalWebGLEnabled(bool);
virtual void setShowDebugBorders(bool);
virtual void setEditingBehavior(EditingBehavior);
private:
WebCore::Settings* m_settings;
......
2010-05-20 Martin Robinson <mrobinson@webkit.org>
Reviewed by Ojan Vafai.
Expose the editing behavior setting in DRT to test all editing code paths
https://bugs.webkit.org/show_bug.cgi?id=38603
* WebView/WebFrame.mm:
(core):
* WebView/WebFrameInternal.h: Added a conversion method from the API enum to the WebCore enum.
* WebView/WebPreferenceKeysPrivate.h: Added a preference key for the new setting.
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Initialize the EditingBehavior to Mac style.
(-[WebPreferences editingBehavior]): Added.
(-[WebPreferences setEditingBehavior:]): Added.
* WebView/WebPreferencesPrivate.h: Added the new API points to the private API.
* WebView/WebView.mm:
(-[WebView _preferencesChangedNotification:]): Set the editing behavior via the WebPreferences setting.
2010-05-19 Anders Carlsson <andersca@apple.com>
Reviewed by Kevin Decker and Simon Fraser.
......
......@@ -196,6 +196,18 @@ EditableLinkBehavior core(WebKitEditableLinkBehavior editableLinkBehavior)
return EditableLinkDefaultBehavior;
}
WebCore::EditingBehavior core(WebKitEditingBehavior behavior)
{
switch (behavior) {
case WebKitEditingMacBehavior:
return WebCore::EditingMacBehavior;
case WebKitEditingWinBehavior:
return WebCore::EditingWindowsBehavior;
}
ASSERT_NOT_REACHED();
return WebCore::EditingMacBehavior;
}
TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior behavior)
{
switch (behavior) {
......
......@@ -71,6 +71,7 @@ WebView *kit(WebCore::Page*);
WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior);
WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior);
WebCore::EditingBehavior core(WebKitEditingBehavior);
WebView *getWebView(WebFrame *webFrame);
......
......@@ -105,6 +105,7 @@
#define WebKitEditableLinkBehaviorPreferenceKey @"WebKitEditableLinkBehavior"
#define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey"
#define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey"
#define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior"
// CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
// to NO, or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are OFF by
......
......@@ -334,6 +334,7 @@ static WebCacheModel cacheModelForMainBundle(void)
@"0", WebKitPDFScaleFactorPreferenceKey,
@"0", WebKitUseSiteSpecificSpoofingPreferenceKey,
[NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
[NSNumber numberWithInt:WebKitEditingMacBehavior], WebKitEditingBehaviorPreferenceKey,
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
[NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
#else
......@@ -1247,6 +1248,16 @@ static NSString *classIBCreatorID = nil;
[self _setBoolValue:flag forKey:WebKitHTML5ParserEnabledPreferenceKey];
}
- (WebKitEditingBehavior)editingBehavior
{
return static_cast<WebKitEditingBehavior>([self _integerValueForKey:WebKitEditingBehaviorPreferenceKey]);
}
- (void)setEditingBehavior:(WebKitEditingBehavior)behavior
{
[self _setIntegerValue:behavior forKey:WebKitEditingBehaviorPreferenceKey];
}
- (void)didRemoveFromWebView
{
ASSERT(_private->numWebViews);
......
......@@ -43,6 +43,11 @@ typedef enum {
WebTextDirectionSubmenuAlwaysIncluded
} WebTextDirectionSubmenuInclusionBehavior;
typedef enum {
WebKitEditingMacBehavior,
WebKitEditingWinBehavior
} WebKitEditingBehavior;
extern NSString *WebPreferencesChangedNotification;
extern NSString *WebPreferencesRemovedNotification;
......@@ -129,6 +134,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (WebKitEditableLinkBehavior)editableLinkBehavior;
- (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior;
- (WebKitEditingBehavior)editingBehavior;
- (void)setEditingBehavior:(WebKitEditingBehavior)behavior;
- (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior;
- (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior;
......
......@@ -1368,6 +1368,7 @@ static bool fastDocumentTeardownEnabled()
settings->setTextAreasAreResizable([preferences textAreasAreResizable]);
settings->setShrinksStandaloneImagesToFit([preferences shrinksStandaloneImagesToFit]);
settings->setEditableLinkBehavior(core([preferences editableLinkBehavior]));
settings->setEditingBehavior(core([preferences editingBehavior]));
settings->setTextDirectionSubmenuInclusionBehavior(core([preferences textDirectionSubmenuInclusionBehavior]));
settings->setDOMPasteAllowed([preferences isDOMPasteAllowed]);
settings->setUsesPageCache([self usesPageCache]);
......
2010-05-20 Martin Robinson <mrobinson@webkit.org>
Reviewed by Ojan Vafai.
Expose the editing behavior setting in DRT to test all editing code paths
https://bugs.webkit.org/show_bug.cgi?id=38603
Expose the EditingBehavior setting in the Windows API.
* Interfaces/IWebPreferences.idl: Add the API point for setting the editing behavior.
* WebPreferenceKeysPrivate.h: Add a key for the editing behavior setting.
* WebPreferences.cpp:
(WebPreferences::editingBehavior): Added.
(WebPreferences::setEditingBehavior): Added.
* WebPreferences.h: Add method declarations.
* WebView.cpp:
(WebView::notifyPreferencesChanged): Update the WebCore setting based on the WebPreferences setting.
2010-05-20 Chris Jerdonek <cjerdonek@webkit.org>
Reviewed by Eric Seidel.
......
......@@ -47,6 +47,12 @@ typedef enum WebKitEditableLinkBehavior {
WebKitEditableLinkNeverLive
} WebKitEditableLinkBehavior;
typedef enum WebKitEditingBehavior {
WebKitEditingMacBehavior = 0,
WebKitEditingWinBehavior
} WebKitEditingBehavior;
typedef enum WebKitCookieStorageAcceptPolicy {
WebKitCookieStorageAcceptPolicyAlways = 0,
WebKitCookieStorageAcceptPolicyNever,
......@@ -162,6 +168,9 @@ interface IWebPreferences : IUnknown
HRESULT editableLinkBehavior([out, retval] WebKitEditableLinkBehavior* editableLinkBehavior);
HRESULT setEditableLinkBehavior([in] WebKitEditableLinkBehavior behavior);
HRESULT editingBehavior([out, retval] WebKitEditingBehavior* editingBehavior);
HRESULT setEditingBehavior([in] WebKitEditingBehavior behavior);
HRESULT cookieStorageAcceptPolicy([out, retval] WebKitCookieStorageAcceptPolicy* acceptPolicy);
HRESULT setCookieStorageAcceptPolicy([in] WebKitCookieStorageAcceptPolicy acceptPolicy);
......
......@@ -74,6 +74,7 @@
#define WebKitPDFDisplayModePreferenceKey "WebKitPDFDisplayMode"
#define WebKitPDFScaleFactorPreferenceKey "WebKitPDFScaleFactor"
#define WebKitEditableLinkBehaviorPreferenceKey "WebKitEditableLinkBehavior"
#define WebKitEditingBehaviorPreferenceKey "WebKitEditingBehavior"
// Window display is throttled to 60 frames per second if WebKitThrottleWindowDisplayPreferenceKey
// is set to YES. The window display throttle is OFF by default for compatibility with Mac OS X
......
......@@ -1130,6 +1130,21 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setEditableLinkBehavior(
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebPreferences::editingBehavior(
/* [out, retval] */ WebKitEditingBehavior* editingBehavior)
{
*editingBehavior = (WebKitEditingBehavior) integerValueForKey(CFSTR(WebKitEditingBehaviorPreferenceKey));
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebPreferences::setEditingBehavior(
/* [in] */ WebKitEditableLinkBehavior behavior)
{
setIntegerValue(CFSTR(WebKitEditingBehaviorPreferenceKey), behavior);
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebPreferences::cookieStorageAcceptPolicy(
/* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy )
{
......
......@@ -238,6 +238,12 @@ public:
virtual HRESULT STDMETHODCALLTYPE setEditableLinkBehavior(
/* [in] */ WebKitEditableLinkBehavior behavior);
virtual HRESULT STDMETHODCALLTYPE editingBehavior(
/* [retval][out] */ WebKitEditingBehavior* behavior);
virtual HRESULT STDMETHODCALLTYPE setEditingBehavior(
/* [in] */ WebKitEditingBehavior behavior);
virtual HRESULT STDMETHODCALLTYPE cookieStorageAcceptPolicy(
/* [retval][out] */ WebKitCookieStorageAcceptPolicy *acceptPolicy);
......
......@@ -4593,6 +4593,12 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
settings->setEditableLinkBehavior((EditableLinkBehavior)behavior);
WebKitEditingBehavior behavior;
hr = preferences->editingBehavior(&behavior);
if (FAILED(hr))
return hr;
settings->setEditingBehavior((EditingBehavior)behavior);
hr = preferences->usesPageCache(&enabled);
if (FAILED(hr))
return hr;
......
2010-05-20 Martin Robinson <mrobinson@webkit.org>
Reviewed by Ojan Vafai.
Expose the editing behavior setting in DRT to test all editing code paths
https://bugs.webkit.org/show_bug.cgi?id=38603
* DumpRenderTree/LayoutTestController.cpp:
(setEditingBehaviorCallback): Added.
(LayoutTestController::staticFunctions): Expose the setEditingBehaviorCallback function.
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/chromium/LayoutTestController.cpp: Add callback method for setting editing behavior.
* DumpRenderTree/chromium/LayoutTestController.h: Declaration for this method.
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::setEditingBehavior): Implementation of editing behavior control.
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::setEditingBehavior): Ditto
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::setEditingBehavior): Added stub implementation of editing behavior control.
* DumpRenderTree/qt/LayoutTestControllerQt.h:
(LayoutTestController::setEditingBehavior): Add slot for controlling editor behavior.
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::setEditingBehavior): Implementation of editing behavior control.
* DumpRenderTree/wx/LayoutTestControllerWx.cpp:
(LayoutTestController::setEditingBehavior): Added stub implementation of editing behavior control.
2010-05-20 Kent Tamura <tkent@chromium.org>
Reviewed by Eric Seidel.
......@@ -31,6 +31,7 @@
#include "WorkQueue.h"
#include "WorkQueueItem.h"
#include <cstring>
#include <JavaScriptCore/JSContextRef.h>
#include <JavaScriptCore/JSObjectRef.h>
#include <JavaScriptCore/JSRetainPtr.h>
......@@ -1453,6 +1454,33 @@ static JSValueRef authenticateSessionCallback(JSContextRef context, JSObjectRef,
return JSValueMakeUndefined(context);
}
static JSValueRef setEditingBehaviorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// The editing behavior string.
if (argumentCount < 1)
return JSValueMakeUndefined(context);
JSRetainPtr<JSStringRef> editingBehavior(Adopt, JSValueToStringCopy(context, arguments[0], exception));
ASSERT(!*exception);
size_t maxLength = JSStringGetMaximumUTF8CStringSize(editingBehavior.get());
char* behaviorBuffer = new char[maxLength + 1];
JSStringGetUTF8CString(editingBehavior.get(), behaviorBuffer, maxLength);
if (strcmp(behaviorBuffer, "mac") && strcmp(behaviorBuffer, "win")) {
JSRetainPtr<JSStringRef> invalidArgument(JSStringCreateWithUTF8CString("Passed invalid editing behavior. Must be 'mac' or 'win'."));
*exception = JSValueMakeString(context, invalidArgument.get());
return JSValueMakeUndefined(context);
}
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
controller->setEditingBehavior(behaviorBuffer);
delete [] behaviorBuffer;
return JSValueMakeUndefined(context);
}
// Static Values
static JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
......@@ -1602,6 +1630,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setEditingBehavior", setEditingBehaviorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
......
......@@ -99,6 +99,7 @@ public:
void setFrameFlatteningEnabled(bool enable);
void setSpatialNavigationEnabled(bool enable);
void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy);
void setEditingBehavior(const char* editingBehavior);
void waitForPolicyDelegate();
size_t webHistoryItemCount();
......
......@@ -159,6 +159,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelineProfilingEnabled);
bindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspector);
bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
// The fallback method is called when an unknown method is invoked.
bindFallbackMethod(&LayoutTestController::fallbackMethod);
......@@ -1272,3 +1273,15 @@ void LayoutTestController::addUserStyleSheet(const CppArgumentList& arguments, C
return;
m_shell->webView()->addUserStyleSheet(WebString::fromUTF8(arguments[0].toString()));
}
void LayoutTestController::setEditingBehavior(const CppArgumentList& arguments, CppVariant* results)
{
WebSettings* settings = m_shell->webView()->settings();
string key = arguments[0].toString();
if (key == "mac")
settings->setEditingBehavior(WebSettings::EditingBehaviorMac);
else if (key == "win")
settings->setEditingBehavior(WebSettings::EditingBehaviorWin);
else
logErrorToConsole("Passed invalid editing behavior. Should be 'mac' or 'win'.");
}
......@@ -209,6 +209,8 @@ public:
// Grants permission for desktop notifications to an origin
void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
void setEditingBehavior(const CppArgumentList&, CppVariant*);
// The following are only stubs. TODO(pamg): Implement any of these that
// are needed to pass the layout tests.
void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
......
......@@ -39,6 +39,7 @@
#include <JavaScriptCore/JSRetainPtr.h>
#include <JavaScriptCore/JSStringRef.h>
#include <cstring>
#include <iostream>
#include <sstream>
#include <stdio.h>
......@@ -693,3 +694,14 @@ JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRe
void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
{
}
void LayoutTestController::setEditingBehavior(const char* editingBehavior)
{
WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
if (!strcmp(editingBehavior, "win"))
g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_WINDOWS, NULL);
if (!strcmp(editingBehavior, "mac"))
g_object_set(G_OBJECT(settings), "editing-behavior", WEBKIT_EDITING_BEHAVIOR_MAC, NULL);
}
......@@ -849,3 +849,13 @@ void LayoutTestController::authenticateSession(JSStringRef url, JSStringRef user
[SynchronousLoader makeRequest:request withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()];
#endif
}
void LayoutTestController::setEditingBehavior(const char* editingBehavior)
{
NSString* editingBehaviorNS = [NSString stringWithUTF8String:editingBehavior];
if ([editingBehaviorNS isEqualToString:@"mac"])
[[WebPreferences standardPreferences] setEditingBehavior:WebKitEditingMacBehavior];
if ([editingBehaviorNS isEqualToString:@"win"])
[[WebPreferences standardPreferences] setEditingBehavior:WebKitEditingWinBehavior];
[editingBehaviorNS release];
}
......@@ -638,5 +638,10 @@ void LayoutTestController::setIconDatabaseEnabled(bool enable)
QWebSettings::setIconDatabasePath(QString());
}
void LayoutTestController::setEditingBehavior(const QString& editingBehavior)
{
// FIXME: Implement.
}
const unsigned LayoutTestController::maxViewWidth = 800;
const unsigned LayoutTestController::maxViewHeight = 600;
......@@ -193,6 +193,8 @@ public slots:
// Simulate a request an embedding application could make, populating per-session credential storage.
void authenticateSession(const QString& url, const QString& username, const QString& password);
void setEditingBehavior(const QString& editingBehavior);
private slots:
void processWork();
......
......@@ -1267,3 +1267,20 @@ void LayoutTestController::setWebViewEditable(bool)
void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
{
}
void LayoutTestController::setEditingBehavior(const char* editingBehavior)
{
COMPtr<IWebView> webView;
if (FAILED(frame->webView(&webView)))
return;
COMPtr<IWebPreferences> preferences;
if (FAILED(webView->preferences(&preferences)))
return;
string behaviorString(editingBehavior);
if (behaviorString == "mac")
preferences->setEditingBehavior(WebKitEditingMacBehavior);
if (behaviorString == "win")
preferences->setEditingBehavior(WebKitEditingWinBehavior);
}
......@@ -446,3 +446,8 @@ JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef,
void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
{
}
void LayoutTestController::setEditingBehavior(JSStringRef editingBehavior)
{
// FIXME: Implement
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment