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

Unified Diff: Source/web/WebPageSerializer.cpp

Issue 202633009: Add Element::subResourceAttributeName() virtual function (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use nullQName() 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/html/forms/InputType.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebPageSerializer.cpp
diff --git a/Source/web/WebPageSerializer.cpp b/Source/web/WebPageSerializer.cpp
index ad880078c6136b73a6192511621304ebcdf430f0..9982ae41d0a1317192275919d552d220b7b8763e 100644
--- a/Source/web/WebPageSerializer.cpp
+++ b/Source/web/WebPageSerializer.cpp
@@ -65,38 +65,11 @@ namespace {
KURL getSubResourceURLFromElement(Element* element)
{
ASSERT(element);
- const QualifiedName* attributeName = 0;
- if (element->hasTagName(HTMLNames::imgTag) || element->hasTagName(HTMLNames::scriptTag))
- attributeName = &HTMLNames::srcAttr;
- else if (element->hasTagName(HTMLNames::inputTag)) {
- if (toHTMLInputElement(element)->isImageButton())
- attributeName = &HTMLNames::srcAttr;
- } else if (element->hasTagName(HTMLNames::bodyTag)
- || element->hasTagName(HTMLNames::tableTag)
- || element->hasTagName(HTMLNames::trTag)
- || element->hasTagName(HTMLNames::tdTag))
- attributeName = &HTMLNames::backgroundAttr;
- else if (element->hasTagName(HTMLNames::blockquoteTag)
- || element->hasTagName(HTMLNames::qTag)
- || element->hasTagName(HTMLNames::delTag)
- || element->hasTagName(HTMLNames::insTag))
- attributeName = &HTMLNames::citeAttr;
- else if (element->hasTagName(HTMLNames::linkTag)) {
- // If the link element is not css, ignore it.
- if (equalIgnoringCase(element->getAttribute(HTMLNames::typeAttr), "text/css")) {
- // FIXME: Add support for extracting links of sub-resources which
- // are inside style-sheet such as @import, @font-face, url(), etc.
- attributeName = &HTMLNames::hrefAttr;
- }
- } else if (element->hasTagName(HTMLNames::objectTag))
- attributeName = &HTMLNames::dataAttr;
- else if (element->hasTagName(HTMLNames::embedTag))
- attributeName = &HTMLNames::srcAttr;
-
- if (!attributeName)
+ const QualifiedName& attributeName = element->subResourceAttributeName();
+ if (attributeName == nullQName())
return KURL();
- String value = element->getAttribute(*attributeName);
+ String value = element->getAttribute(attributeName);
// Ignore javascript content.
if (value.isEmpty() || value.stripWhiteSpace().startsWith("javascript:", false))
return KURL();
« no previous file with comments | « Source/core/html/forms/InputType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698