| Index: Source/core/page/PageSerializer.cpp
|
| diff --git a/Source/core/page/PageSerializer.cpp b/Source/core/page/PageSerializer.cpp
|
| index 6cff82f3532b51622b593c30c1776647c8eedd4c..e0d33427e37c32458e7c29a82e17f749ffe84514 100644
|
| --- a/Source/core/page/PageSerializer.cpp
|
| +++ b/Source/core/page/PageSerializer.cpp
|
| @@ -53,6 +53,7 @@
|
| #include "core/html/HTMLImageElement.h"
|
| #include "core/html/HTMLInputElement.h"
|
| #include "core/html/HTMLLinkElement.h"
|
| +#include "core/html/HTMLMetaElement.h"
|
| #include "core/html/HTMLStyleElement.h"
|
| #include "core/html/parser/HTMLParserIdioms.h"
|
| #include "core/page/Page.h"
|
| @@ -70,12 +71,10 @@ namespace WebCore {
|
|
|
| static bool isCharsetSpecifyingNode(const Node& node)
|
| {
|
| - if (!node.isHTMLElement())
|
| + if (!isHTMLMetaElement(node))
|
| return false;
|
|
|
| - const HTMLElement& element = toHTMLElement(node);
|
| - if (!element.hasTagName(HTMLNames::metaTag))
|
| - return false;
|
| + const HTMLMetaElement& element = toHTMLMetaElement(node);
|
| HTMLAttributeList attributes;
|
| if (element.hasAttributes()) {
|
| unsigned attributeCount = element.attributeCount();
|
| @@ -91,13 +90,13 @@ static bool isCharsetSpecifyingNode(const Node& node)
|
|
|
| static bool shouldIgnoreElement(const Element& element)
|
| {
|
| - return element.hasTagName(HTMLNames::scriptTag) || element.hasTagName(HTMLNames::noscriptTag) || isCharsetSpecifyingNode(element);
|
| + return isHTMLScriptElement(element) || isHTMLNoScriptElement(element) || isCharsetSpecifyingNode(element);
|
| }
|
|
|
| static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerElement& frameOwner)
|
| {
|
| // FIXME: We should support all frame owners including applets.
|
| - return frameOwner.hasTagName(HTMLNames::objectTag) ? HTMLNames::dataAttr : HTMLNames::srcAttr;
|
| + return isHTMLObjectElement(frameOwner) ? HTMLNames::dataAttr : HTMLNames::srcAttr;
|
| }
|
|
|
| class SerializerMarkupAccumulator FINAL : public MarkupAccumulator {
|
| @@ -139,7 +138,7 @@ void SerializerMarkupAccumulator::appendElement(StringBuilder& out, Element& ele
|
| if (!shouldIgnoreElement(element))
|
| MarkupAccumulator::appendElement(out, element, namespaces);
|
|
|
| - if (element.hasTagName(HTMLNames::headTag)) {
|
| + if (isHTMLHeadElement(element)) {
|
| out.append("<meta charset=\"");
|
| out.append(m_document.charset());
|
| out.append("\">");
|
| @@ -225,26 +224,26 @@ void PageSerializer::serializeFrame(LocalFrame* frame)
|
| if (element.isStyledElement())
|
| retrieveResourcesForProperties(element.inlineStyle(), document);
|
|
|
| - if (element.hasTagName(HTMLNames::imgTag)) {
|
| + if (isHTMLImageElement(element)) {
|
| HTMLImageElement& imageElement = toHTMLImageElement(element);
|
| KURL url = document.completeURL(imageElement.getAttribute(HTMLNames::srcAttr));
|
| ImageResource* cachedImage = imageElement.cachedImage();
|
| addImageToResources(cachedImage, imageElement.renderer(), url);
|
| - } else if (element.hasTagName(HTMLNames::inputTag)) {
|
| + } else if (isHTMLInputElement(element)) {
|
| HTMLInputElement& inputElement = toHTMLInputElement(element);
|
| if (inputElement.isImageButton() && inputElement.hasImageLoader()) {
|
| KURL url = inputElement.src();
|
| ImageResource* cachedImage = inputElement.imageLoader()->image();
|
| addImageToResources(cachedImage, inputElement.renderer(), url);
|
| }
|
| - } else if (element.hasTagName(HTMLNames::linkTag)) {
|
| + } else if (isHTMLLinkElement(element)) {
|
| HTMLLinkElement& linkElement = toHTMLLinkElement(element);
|
| if (CSSStyleSheet* sheet = linkElement.sheet()) {
|
| KURL url = document.completeURL(linkElement.getAttribute(HTMLNames::hrefAttr));
|
| serializeCSSStyleSheet(sheet, url);
|
| ASSERT(m_resourceURLs.contains(url));
|
| }
|
| - } else if (element.hasTagName(HTMLNames::styleTag)) {
|
| + } else if (isHTMLStyleElement(element)) {
|
| HTMLStyleElement& styleElement = toHTMLStyleElement(element);
|
| if (CSSStyleSheet* sheet = styleElement.sheet())
|
| serializeCSSStyleSheet(sheet, KURL());
|
|
|