summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp99
1 files changed, 75 insertions, 24 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
index 338cf565b..f0e34efdc 100644
--- a/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
@@ -28,22 +28,26 @@
#include "config.h"
#include "WebPage.h"
+#include "EditorState.h"
#include "NotImplemented.h"
#include "WebEvent.h"
+#include "WebFrame.h"
#include "WebPageAccessibilityObject.h"
#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
#include "WindowsKeyboardCodes.h"
#include <WebCore/BackForwardController.h>
#include <WebCore/EventHandler.h>
#include <WebCore/FocusController.h>
#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
#include <WebCore/KeyboardEvent.h>
#include <WebCore/Page.h>
#include <WebCore/PasteboardHelper.h>
#include <WebCore/PlatformKeyboardEvent.h>
#include <WebCore/Settings.h>
-#include <WebCore/UserAgentGtk.h>
-#include <wtf/gobject/GUniquePtr.h>
+#include <WebCore/UserAgent.h>
+#include <wtf/glib/GUniquePtr.h>
using namespace WebCore;
@@ -60,10 +64,46 @@ void WebPage::platformInitialize()
GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get())));
send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
#endif
+}
-#if USE(TEXTURE_MAPPER_GL)
- m_nativeWindowHandle = 0;
-#endif
+void WebPage::platformDetach()
+{
+}
+
+void WebPage::platformEditorState(Frame& frame, EditorState& result, IncludePostLayoutDataHint shouldIncludePostLayoutData) const
+{
+ if (shouldIncludePostLayoutData == IncludePostLayoutDataHint::No) {
+ result.isMissingPostLayoutData = true;
+ return;
+ }
+
+ auto& postLayoutData = result.postLayoutData();
+ postLayoutData.caretRectAtStart = frame.selection().absoluteCaretBounds();
+
+ const VisibleSelection& selection = frame.selection().selection();
+ if (selection.isNone())
+ return;
+
+ const Editor& editor = frame.editor();
+ if (selection.isRange()) {
+ if (editor.selectionHasStyle(CSSPropertyFontWeight, "bold") == TrueTriState)
+ postLayoutData.typingAttributes |= AttributeBold;
+ if (editor.selectionHasStyle(CSSPropertyFontStyle, "italic") == TrueTriState)
+ postLayoutData.typingAttributes |= AttributeItalics;
+ if (editor.selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline") == TrueTriState)
+ postLayoutData.typingAttributes |= AttributeUnderline;
+ if (editor.selectionHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "line-through") == TrueTriState)
+ postLayoutData.typingAttributes |= AttributeStrikeThrough;
+ } else if (selection.isCaret()) {
+ if (editor.selectionStartHasStyle(CSSPropertyFontWeight, "bold"))
+ postLayoutData.typingAttributes |= AttributeBold;
+ if (editor.selectionStartHasStyle(CSSPropertyFontStyle, "italic"))
+ postLayoutData.typingAttributes |= AttributeItalics;
+ if (editor.selectionStartHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "underline"))
+ postLayoutData.typingAttributes |= AttributeUnderline;
+ if (editor.selectionStartHasStyle(CSSPropertyWebkitTextDecorationsInEffect, "line-through"))
+ postLayoutData.typingAttributes |= AttributeStrikeThrough;
+ }
}
#if HAVE(ACCESSIBILITY)
@@ -81,23 +121,12 @@ void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
notImplemented();
}
-static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity)
-{
- page->focusController().focusedOrMainFrame().eventHandler().scrollRecursively(direction, granularity);
-}
-
bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent)
{
if (keyboardEvent.type() != WebEvent::KeyDown && keyboardEvent.type() != WebEvent::RawKeyDown)
return false;
switch (keyboardEvent.windowsVirtualKeyCode()) {
- case VK_BACK:
- if (keyboardEvent.shiftKey())
- m_page->backForward().goForward();
- else
- m_page->backForward().goBack();
- break;
case VK_SPACE:
scroll(m_page.get(), keyboardEvent.shiftKey() ? ScrollUp : ScrollDown, ScrollByPage);
break;
@@ -156,19 +185,12 @@ String WebPage::cachedSuggestedFilenameForURL(const URL&)
return String();
}
-PassRefPtr<SharedBuffer> WebPage::cachedResponseDataForURL(const URL&)
+RefPtr<SharedBuffer> WebPage::cachedResponseDataForURL(const URL&)
{
notImplemented();
return 0;
}
-#if USE(TEXTURE_MAPPER_GL)
-void WebPage::setAcceleratedCompositingWindowId(int64_t nativeWindowHandle)
-{
- m_nativeWindowHandle = nativeWindowHandle;
-}
-#endif
-
String WebPage::platformUserAgent(const URL& url) const
{
if (url.isNull() || !m_page->settings().needsSiteSpecificQuirks())
@@ -177,4 +199,33 @@ String WebPage::platformUserAgent(const URL& url) const
return WebCore::standardUserAgentForURL(url);
}
+#if HAVE(GTK_GESTURES)
+void WebPage::getCenterForZoomGesture(const IntPoint& centerInViewCoordinates, IntPoint& result)
+{
+ result = mainFrameView()->rootViewToContents(centerInViewCoordinates);
+ double scale = m_page->pageScaleFactor();
+ result.scale(1 / scale, 1 / scale);
+}
+#endif
+
+void WebPage::setInputMethodState(bool enabled)
+{
+ if (m_inputMethodEnabled == enabled)
+ return;
+
+ m_inputMethodEnabled = enabled;
+ send(Messages::WebPageProxy::SetInputMethodState(enabled));
+}
+
+void WebPage::collapseSelectionInFrame(uint64_t frameID)
+{
+ WebFrame* frame = WebProcess::singleton().webFrame(frameID);
+ if (!frame || !frame->coreFrame())
+ return;
+
+ // Collapse the selection without clearing it.
+ const VisibleSelection& selection = frame->coreFrame()->selection().selection();
+ frame->coreFrame()->selection().setBase(selection.extent(), selection.affinity());
+}
+
} // namespace WebKit