summaryrefslogtreecommitdiffstats
path: root/webkit/api
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/api')
-rw-r--r--webkit/api/public/WebEditingAction.h8
-rw-r--r--webkit/api/public/WebEditingClient.h45
-rw-r--r--webkit/api/public/WebTextAffinity.h8
-rw-r--r--webkit/api/src/AssertMatchingEnums.cpp56
4 files changed, 85 insertions, 32 deletions
diff --git a/webkit/api/public/WebEditingAction.h b/webkit/api/public/WebEditingAction.h
index de716ca..4ac6653 100644
--- a/webkit/api/public/WebEditingAction.h
+++ b/webkit/api/public/WebEditingAction.h
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,8 +31,6 @@
#ifndef WebEditingAction_h
#define WebEditingAction_h
-#error "This header file is still a work in progress; do not include!"
-
namespace WebKit {
enum WebEditingAction {
diff --git a/webkit/api/public/WebEditingClient.h b/webkit/api/public/WebEditingClient.h
index 8cc0e01..9b20593 100644
--- a/webkit/api/public/WebEditingClient.h
+++ b/webkit/api/public/WebEditingClient.h
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,38 +31,39 @@
#ifndef WebEditingClient_h
#define WebEditingClient_h
-#error "This header file is still a work in progress; do not include!"
+#include "WebEditingAction.h"
+#include "WebTextAffinity.h"
namespace WebKit {
class WebNode;
class WebRange;
- class WebView;
+ class WebString;
+ // This interface allow the client to intercept and overrule editing
+ // operations.
class WebEditingClient {
public:
- // The following methods allow the client to intercept and overrule
- // editing operations.
- virtual bool shouldBeginEditing(WebView*, const WebRange&) = 0;
- virtual bool shouldEndEditing(WebView*, const WebRange&) = 0;
+ virtual bool shouldBeginEditing(const WebRange&) = 0;
+ virtual bool shouldEndEditing(const WebRange&) = 0;
virtual bool shouldInsertNode(
- WebView*, const WebNode&, const WebRange&, const WebEditingAction&) = 0;
+ const WebNode&, const WebRange&, WebEditingAction) = 0;
virtual bool shouldInsertText(
- WebView*, const WebString&, const WebRange&, const WebEditingAction&) = 0;
+ const WebString&, const WebRange&, WebEditingAction) = 0;
virtual bool shouldChangeSelectedRange(
- WebView*, const WebRange& from, const WebRange& to, const WebTextAffinity&,
+ const WebRange& from, const WebRange& to, WebTextAffinity,
bool stillSelecting) = 0;
- virtual bool shouldDeleteRange(WebView*, const WebRange&) = 0;
- virtual bool shouldApplyStyle(WebView*, const WebString& style, const WebRange&) = 0;
+ virtual bool shouldDeleteRange(const WebRange&) = 0;
+ virtual bool shouldApplyStyle(const WebString& style, const WebRange&) = 0;
- virtual bool isSmartInsertDeleteEnabled(WebView*) = 0;
- virtual bool isSelectTrailingWhitespaceEnabled(WebView*) = 0;
- virtual void setInputMethodEnabled(WebView*, bool enabled) = 0;
+ virtual bool isSmartInsertDeleteEnabled() = 0;
+ virtual bool isSelectTrailingWhitespaceEnabled() = 0;
+ virtual void setInputMethodEnabled(bool enabled) = 0;
- virtual void didBeginEditing(WebView*) = 0;
- virtual void didChangeSelection(WebView*, bool isSelectionEmpty) = 0;
- virtual void didChangeContents(WebView*) = 0;
- virtual void didExecuteCommand(WebView*, const WebString& commandName) = 0;
- virtual void didEndEditing(WebView*) = 0;
+ virtual void didBeginEditing() = 0;
+ virtual void didChangeSelection(bool isSelectionEmpty) = 0;
+ virtual void didChangeContents() = 0;
+ virtual void didExecuteCommand(const WebString& commandName) = 0;
+ virtual void didEndEditing() = 0;
};
} // namespace WebKit
diff --git a/webkit/api/public/WebTextAffinity.h b/webkit/api/public/WebTextAffinity.h
index 3fcea31..2ca86aa 100644
--- a/webkit/api/public/WebTextAffinity.h
+++ b/webkit/api/public/WebTextAffinity.h
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -31,8 +31,6 @@
#ifndef WebTextAffinity_h
#define WebTextAffinity_h
-#error "This header file is still a work in progress; do not include!"
-
namespace WebKit {
// These constants specify the preferred direction of selection.
diff --git a/webkit/api/src/AssertMatchingEnums.cpp b/webkit/api/src/AssertMatchingEnums.cpp
new file mode 100644
index 0000000..5477d37
--- /dev/null
+++ b/webkit/api/src/AssertMatchingEnums.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Use this file to assert that various WebKit API enum values continue
+// matching WebCore defined enum values.
+
+// FIXME: Move all of the COMPILE_ASSERTs for enums into this file.
+
+#include "EditorInsertAction.h"
+#include "TextAffinity.h"
+#include "WebEditingAction.h"
+#include "WebTextAffinity.h"
+#include <wtf/Assertions.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
+ COMPILE_ASSERT(int(webkit_name) == int(webcore_name), webkit_name)
+
+COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped);
+COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionPasted, EditorInsertActionPasted);
+COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM);
+COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM);
+
+} // namespace WebKit