Commit e1c20efe authored by jam@chromium.org's avatar jam@chromium.org

Move didChangeSelection to WebFrameClient.

BUG=304341

Review URL: https://codereview.chromium.org/204673007

git-svn-id: svn://svn.chromium.org/blink/trunk@169603 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c63fe18a
...@@ -525,7 +525,7 @@ bool Editor::shouldDeleteRange(Range* range) const ...@@ -525,7 +525,7 @@ bool Editor::shouldDeleteRange(Range* range) const
void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions options) void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions options)
{ {
client().respondToChangedSelection(m_frame.selection().selectionType()); client().respondToChangedSelection(&m_frame, m_frame.selection().selectionType());
setStartNewKillRingSequence(true); setStartNewKillRingSequence(true);
} }
...@@ -1045,7 +1045,7 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, ...@@ -1045,7 +1045,7 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection,
// does not call EditorClient::respondToChangedSelection(), which, on the Mac, sends selection change notifications and // does not call EditorClient::respondToChangedSelection(), which, on the Mac, sends selection change notifications and
// starts a new kill ring sequence, but we want to do these things (matches AppKit). // starts a new kill ring sequence, but we want to do these things (matches AppKit).
if (selectionDidNotChangeDOMPosition) if (selectionDidNotChangeDOMPosition)
client().respondToChangedSelection(m_frame.selection().selectionType()); client().respondToChangedSelection(&m_frame, m_frame.selection().selectionType());
} }
IntRect Editor::firstRectForRange(Range* range) const IntRect Editor::firstRectForRange(Range* range) const
......
...@@ -289,7 +289,7 @@ public: ...@@ -289,7 +289,7 @@ public:
virtual ~EmptyEditorClient() { } virtual ~EmptyEditorClient() { }
virtual void respondToChangedContents() OVERRIDE { } virtual void respondToChangedContents() OVERRIDE { }
virtual void respondToChangedSelection(SelectionType) OVERRIDE { } virtual void respondToChangedSelection(LocalFrame*, SelectionType) OVERRIDE { }
virtual bool canCopyCut(LocalFrame*, bool defaultValue) const OVERRIDE { return defaultValue; } virtual bool canCopyCut(LocalFrame*, bool defaultValue) const OVERRIDE { return defaultValue; }
virtual bool canPaste(LocalFrame*, bool defaultValue) const OVERRIDE { return defaultValue; } virtual bool canPaste(LocalFrame*, bool defaultValue) const OVERRIDE { return defaultValue; }
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
virtual ~EditorClient() { } virtual ~EditorClient() { }
virtual void respondToChangedContents() = 0; virtual void respondToChangedContents() = 0;
virtual void respondToChangedSelection(SelectionType) = 0; virtual void respondToChangedSelection(LocalFrame*, SelectionType) = 0;
virtual bool canCopyCut(LocalFrame*, bool defaultValue) const = 0; virtual bool canCopyCut(LocalFrame*, bool defaultValue) const = 0;
virtual bool canPaste(LocalFrame*, bool defaultValue) const = 0; virtual bool canPaste(LocalFrame*, bool defaultValue) const = 0;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "config.h" #include "config.h"
#include "EditorClientImpl.h" #include "EditorClientImpl.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h" #include "WebFrameImpl.h"
#include "WebPermissionClient.h" #include "WebPermissionClient.h"
#include "WebViewClient.h" #include "WebViewClient.h"
...@@ -46,10 +47,11 @@ EditorClientImpl::~EditorClientImpl() ...@@ -46,10 +47,11 @@ EditorClientImpl::~EditorClientImpl()
{ {
} }
void EditorClientImpl::respondToChangedSelection(WebCore::SelectionType selectionType) void EditorClientImpl::respondToChangedSelection(LocalFrame* frame, WebCore::SelectionType selectionType)
{ {
if (m_webView->client()) WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
m_webView->client()->didChangeSelection(selectionType != WebCore::RangeSelection); if (webFrame->client())
webFrame->client()->didChangeSelection(selectionType != WebCore::RangeSelection);
} }
void EditorClientImpl::respondToChangedContents() void EditorClientImpl::respondToChangedContents()
......
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
virtual ~EditorClientImpl(); virtual ~EditorClientImpl();
virtual void respondToChangedContents() OVERRIDE; virtual void respondToChangedContents() OVERRIDE;
virtual void respondToChangedSelection(WebCore::SelectionType) OVERRIDE; virtual void respondToChangedSelection(WebCore::LocalFrame*, WebCore::SelectionType) OVERRIDE;
virtual bool canCopyCut(WebCore::LocalFrame*, bool defaultValue) const OVERRIDE; virtual bool canCopyCut(WebCore::LocalFrame*, bool defaultValue) const OVERRIDE;
virtual bool canPaste(WebCore::LocalFrame*, bool defaultValue) const OVERRIDE; virtual bool canPaste(WebCore::LocalFrame*, bool defaultValue) const OVERRIDE;
virtual void didExecuteCommand(String commandName) OVERRIDE; virtual void didExecuteCommand(String commandName) OVERRIDE;
......
...@@ -224,6 +224,12 @@ public: ...@@ -224,6 +224,12 @@ public:
// WARNING: This method may be called very frequently. // WARNING: This method may be called very frequently.
virtual void didUpdateCurrentHistoryItem(WebFrame*) { } virtual void didUpdateCurrentHistoryItem(WebFrame*) { }
// Editing -------------------------------------------------------------
// These methods allow the client to intercept and overrule editing
// operations.
virtual void didChangeSelection(bool isSelectionEmpty) { }
// UI ------------------------------------------------------------------ // UI ------------------------------------------------------------------
......
...@@ -162,7 +162,6 @@ public: ...@@ -162,7 +162,6 @@ public:
// These methods allow the client to intercept and overrule editing // These methods allow the client to intercept and overrule editing
// operations. // operations.
virtual void didCancelCompositionOnSelectionChange() { } virtual void didCancelCompositionOnSelectionChange() { }
virtual void didChangeSelection(bool isSelectionEmpty) { }
virtual void didChangeContents() { } virtual void didChangeContents() { }
virtual void didExecuteCommand(const WebString& commandName) { } virtual void didExecuteCommand(const WebString& commandName) { }
......
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