Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: sky/engine/core/editing/Editor.cpp

Issue 928393003: Remove the concept of document.documentElement (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/editing/Editor.h ('k') | sky/engine/core/editing/FrameSelection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « sky/engine/core/editing/Editor.h ('k') | sky/engine/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698