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

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);
......
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