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

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: Rebase Created 7 years, 4 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 | Source/web/tests/PageSerializerTest.cpp » ('j') | 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 c669640e9dc34dc0e45dae4bcb551a3140344209..f29f833c83ffa8c73cafb3376a89263419edd47e 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 = toHTMLInputElement(element);
+ if (inputElement->isImageButton() && inputElement->hasImageLoader()) {
+ KURL url = inputElement->src();
+ CachedImage* cachedImage = inputElement->imageLoader()->image();
+ addImageToResources(cachedImage, inputElement->renderer(), url);
+ }
} else if (element->hasTagName(HTMLNames::linkTag)) {
HTMLLinkElement* linkElement = toHTMLLinkElement(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 | Source/web/tests/PageSerializerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698