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

Unified Diff: Source/core/editing/Editor.cpp

Issue 426433002: Use tighter typing in editing: Editor / EditorCommand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
Index: Source/core/editing/Editor.cpp
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index adb58dbcd3518a79a9e837160f46bc8b12b6a29d..e3fcc2063b7aa441e4b03268e314b366ae90018a 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -344,7 +344,7 @@ void Editor::deleteSelectionWithSmartDelete(bool smartDelete)
void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
{
- Node* target = findEventTargetFromSelection();
+ Element* target = findEventTargetFromSelection();
if (!target)
return;
target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame.domWindow(), pastingText, smartReplace), IGNORE_EXCEPTION);
@@ -352,7 +352,7 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
void Editor::pasteAsFragment(PassRefPtrWillBeRawPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)
{
- Node* target = findEventTargetFromSelection();
+ Element* target = findEventTargetFromSelection();
if (!target)
return;
target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame.domWindow(), pastingFragment, smartReplace, matchStyle), IGNORE_EXCEPTION);
@@ -457,11 +457,11 @@ static void writeImageNodeToPasteboard(Pasteboard* pasteboard, Node* node, const
// FIXME: This should probably be reconciled with HitTestResult::absoluteImageURL.
AtomicString urlString;
if (isHTMLImageElement(*node) || isHTMLInputElement(*node))
- urlString = toElement(node)->getAttribute(srcAttr);
+ urlString = toHTMLElement(node)->getAttribute(srcAttr);
else if (isSVGImageElement(*node))
- urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr);
+ urlString = toSVGElement(node)->getAttribute(XLinkNames::hrefAttr);
else if (isHTMLEmbedElement(*node) || isHTMLObjectElement(*node) || isHTMLCanvasElement(*node))
- urlString = toElement(node)->imageSourceURL();
+ urlString = toHTMLElement(node)->imageSourceURL();
KURL url = urlString.isEmpty() ? KURL() : node->document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
pasteboard->writeImage(image.get(), url, title);
@@ -469,9 +469,9 @@ static void writeImageNodeToPasteboard(Pasteboard* pasteboard, Node* node, const
// Returns whether caller should continue with "the default processing", which is the same as
// the event handler NOT setting the return value to false
-bool Editor::dispatchCPPEvent(const AtomicString &eventType, DataTransferAccessPolicy policy, PasteMode pasteMode)
+bool Editor::dispatchCPPEvent(const AtomicString& eventType, DataTransferAccessPolicy policy, PasteMode pasteMode)
{
- Node* target = findEventTargetFromSelection();
+ Element* target = findEventTargetFromSelection();
if (!target)
return true;
@@ -569,16 +569,16 @@ void Editor::clearLastEditCommand()
m_lastEditCommand.clear();
}
-Node* Editor::findEventTargetFrom(const VisibleSelection& selection) const
+Element* Editor::findEventTargetFrom(const VisibleSelection& selection) const
{
- Node* target = selection.start().element();
+ Element* target = selection.start().element();
if (!target)
target = m_frame.document()->body();
return target;
}
-Node* Editor::findEventTargetFromSelection() const
+Element* Editor::findEventTargetFromSelection() const
{
return findEventTargetFrom(m_frame.selection().selection());
}
@@ -749,7 +749,7 @@ void Editor::clear()
m_defaultParagraphSeparator = EditorParagraphSeparatorIsDiv;
}
-bool Editor::insertText(const String& text, Event* triggeringEvent)
+bool Editor::insertText(const String& text, KeyboardEvent* triggeringEvent)
{
return m_frame.eventHandler().handleTextInputEvent(text, triggeringEvent);
}

Powered by Google App Engine
This is Rietveld 408576698