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

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

Issue 196683003: Use new is*Element() helper functions more in editing code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « Source/core/editing/EditingStyle.cpp ('k') | Source/core/editing/FormatBlockCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/Editor.cpp
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index ba4484d2aac3492583c216773431702b3b8b7d96..72277832ce0f946523b772e2330574818256859f 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -80,6 +80,7 @@
#include "core/page/Page.h"
#include "core/rendering/HitTestResult.h"
#include "core/rendering/RenderImage.h"
+#include "core/svg/SVGImageElement.h"
#include "platform/KillRing.h"
#include "platform/weborigin/KURL.h"
#include "wtf/unicode/CharacterNames.h"
@@ -224,9 +225,7 @@ static HTMLImageElement* imageElementFromImageDocument(Document* document)
return 0;
Node* node = body->firstChild();
- if (!node)
- return 0;
- if (!node->hasTagName(imgTag))
+ if (!isHTMLImageElement(node))
return 0;
return toHTMLImageElement(node);
}
@@ -440,11 +439,11 @@ static void writeImageNodeToPasteboard(Pasteboard* pasteboard, Node* node, const
// FIXME: This should probably be reconciled with HitTestResult::absoluteImageURL.
AtomicString urlString;
- if (node->hasTagName(imgTag) || node->hasTagName(inputTag))
+ if (isHTMLImageElement(*node) || isHTMLInputElement(*node))
urlString = toElement(node)->getAttribute(srcAttr);
- else if (node->hasTagName(SVGNames::imageTag))
+ else if (isSVGImageElement(*node))
urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr);
- else if (node->hasTagName(embedTag) || node->hasTagName(objectTag))
+ else if (isHTMLEmbedElement(*node) || isHTMLObjectElement(*node))
urlString = toElement(node)->imageSourceURL();
KURL url = urlString.isEmpty() ? KURL() : node->document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
« no previous file with comments | « Source/core/editing/EditingStyle.cpp ('k') | Source/core/editing/FormatBlockCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698