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

Unified Diff: third_party/WebKit/Source/core/html/ImageDocument.cpp

Issue 2647633004: [Blink] Don't center images in Android WebViews (Closed)
Patch Set: Created 3 years, 11 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
Index: third_party/WebKit/Source/core/html/ImageDocument.cpp
diff --git a/third_party/WebKit/Source/core/html/ImageDocument.cpp b/third_party/WebKit/Source/core/html/ImageDocument.cpp
index a810a535bc01fcf015bf3d39489677b3d7ff7ca8..5c303658806aa6b59ceca36df66146eaf1afffcb 100644
--- a/third_party/WebKit/Source/core/html/ImageDocument.cpp
+++ b/third_party/WebKit/Source/core/html/ImageDocument.cpp
@@ -48,6 +48,7 @@
#include "core/loader/DocumentLoader.h"
#include "core/loader/FrameLoader.h"
#include "core/loader/FrameLoaderClient.h"
+#include "core/page/Page.h"
#include "platform/HostWindow.h"
#include "wtf/text/StringBuilder.h"
#include <limits>
@@ -575,7 +576,12 @@ ImageResource* ImageDocument::cachedImage() {
}
bool ImageDocument::shouldShrinkToFit() const {
- return frame()->isMainFrame();
+ // WebView automatically resizes to match the contents, causing an infinite
+ // loop as the contents then resize to match the window. To prevent this,
+ // disallow images from shrinking to fit for WebViews.
+ bool isWrapContentWebView =
+ page() ? page()->settings().getForceZeroLayoutHeight() : false;
+ return frame()->isMainFrame() && !isWrapContentWebView;
}
DEFINE_TRACE(ImageDocument) {
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.h ('k') | third_party/WebKit/Source/core/html/ImageDocumentTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698