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

Unified Diff: Source/core/page/PageSerializer.cpp

Issue 16520007: Serialize <input type="image"> images (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/PageSerializer.cpp
diff --git a/Source/core/page/PageSerializer.cpp b/Source/core/page/PageSerializer.cpp
index 6593e3e09a299086178fe96a0c676e62bcf8030a..18216c3d64490f76156400a572d4af926f485822 100644
--- a/Source/core/page/PageSerializer.cpp
+++ b/Source/core/page/PageSerializer.cpp
@@ -44,6 +44,7 @@
#include "core/editing/MarkupAccumulator.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLImageElement.h"
+#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLinkElement.h"
#include "core/html/HTMLStyleElement.h"
#include "core/html/parser/HTMLMetaCharsetParser.h"
@@ -52,6 +53,7 @@
#include "core/page/Page.h"
#include "core/platform/SerializedResource.h"
#include "core/platform/graphics/Image.h"
+#include "core/rendering/RenderImage.h"
#include "core/rendering/style/StyleCachedImage.h"
#include "core/rendering/style/StyleImage.h"
#include "wtf/text/CString.h"
@@ -223,6 +225,13 @@ void PageSerializer::serializeFrame(Frame* frame)
KURL url = document->completeURL(imageElement->getAttribute(HTMLNames::srcAttr));
CachedImage* cachedImage = imageElement->cachedImage();
addImageToResources(cachedImage, imageElement->renderer(), url);
+ } else if (element->hasTagName(HTMLNames::inputTag)) {
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element);
abarth-chromium 2013/06/12 18:41:11 static_cast<HTMLInputElement*> -> toHTMLInputE
+ if (inputElement->isImageButton()) {
+ KURL url = inputElement->src();
+ CachedImage* cachedImage = static_cast<RenderImage*>(inputElement->renderer())->cachedImage();
abarth-chromium 2013/06/12 18:41:11 Is this static_cast always safe?
+ addImageToResources(cachedImage, inputElement->renderer(), url);
+ }
} else if (element->hasTagName(HTMLNames::linkTag)) {
HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(element);
if (CSSStyleSheet* sheet = linkElement->sheet()) {
@@ -263,8 +272,9 @@ void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KUR
} else if (rule->type() == CSSRule::FONT_FACE_RULE) {
// FIXME: Add support for font face rule. It is not clear to me at this point if the actual otf/eot file can
// be retrieved from the CSSFontFaceRule object.
- } else if (rule->type() == CSSRule::STYLE_RULE)
+ } else if (rule->type() == CSSRule::STYLE_RULE) {
retrieveResourcesForRule(static_cast<CSSStyleRule*>(rule)->styleRule(), document);
+ }
}
if (url.isValid() && !m_resourceURLs.contains(url)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698