Index: sky/engine/core/editing/Editor.cpp |
diff --git a/sky/engine/core/editing/Editor.cpp b/sky/engine/core/editing/Editor.cpp |
index 1eaed20ec81cd85b442466740ca131d64bddd5d4..ad478834d093d55e3d34b8806b341396e654c1bb 100644 |
--- a/sky/engine/core/editing/Editor.cpp |
+++ b/sky/engine/core/editing/Editor.cpp |
@@ -273,7 +273,7 @@ void Editor::deleteSelectionWithSmartDelete(bool smartDelete) |
void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace) |
{ |
- Element* target = findEventTargetFromSelection(); |
+ ContainerNode* target = findEventTargetFromSelection(); |
if (!target) |
return; |
target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame.domWindow(), pastingText, smartReplace), IGNORE_EXCEPTION); |
@@ -281,7 +281,7 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace) |
void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle) |
{ |
- Element* target = findEventTargetFromSelection(); |
+ ContainerNode* target = findEventTargetFromSelection(); |
if (!target) |
return; |
target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame.domWindow(), pastingFragment, smartReplace, matchStyle), IGNORE_EXCEPTION); |
@@ -352,16 +352,14 @@ void Editor::clearLastEditCommand() |
m_lastEditCommand.clear(); |
} |
-Element* Editor::findEventTargetFrom(const VisibleSelection& selection) const |
+ContainerNode* Editor::findEventTargetFrom(const VisibleSelection& selection) const |
{ |
- Element* target = selection.start().element(); |
- if (!target) |
- target = m_frame.document()->documentElement(); |
- |
- return target; |
+ if (Element* target = selection.start().element()) |
+ return target; |
+ return m_frame.document(); |
} |
-Element* Editor::findEventTargetFromSelection() const |
+ContainerNode* Editor::findEventTargetFromSelection() const |
{ |
return findEventTargetFrom(m_frame.selection().selection()); |
} |