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

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

Issue 2646663002: [Blink] Don't center images in Android WebViews (Closed)
Patch Set: Update test 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
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/ImageDocumentTest.cpp
diff --git a/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp b/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp
index 28b344e0616a10e82a6a15261ac6fd75f78d441b..e7a752d66bd0b7977452a4306d1345d3cd0b905f 100644
--- a/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp
+++ b/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp
@@ -6,6 +6,7 @@
#include "core/dom/Document.h"
#include "core/dom/DocumentParser.h"
+#include "core/frame/Settings.h"
#include "core/loader/EmptyClients.h"
#include "core/testing/DummyPageHolder.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -182,4 +183,26 @@ TEST_F(ImageDocumentTest, ImageScalesDownWithDsf) {
EXPECT_EQ(10, imageHeight());
}
+TEST_F(ImageDocumentTest, ImageNotCenteredWithForceZeroLayoutHeight) {
+ createDocumentWithoutLoadingImage(80, 70);
+ document().page()->settings().setForceZeroLayoutHeight(true);
+ loadImage();
+ EXPECT_FALSE(document().shouldShrinkToFit());
+ EXPECT_EQ(0, document().imageElement()->offsetLeft());
+ EXPECT_EQ(0, document().imageElement()->offsetTop());
+ EXPECT_EQ(50, imageWidth());
+ EXPECT_EQ(50, imageHeight());
+}
+
+TEST_F(ImageDocumentTest, ImageCenteredWithoutForceZeroLayoutHeight) {
+ createDocumentWithoutLoadingImage(80, 70);
+ document().page()->settings().setForceZeroLayoutHeight(false);
+ loadImage();
+ EXPECT_TRUE(document().shouldShrinkToFit());
+ EXPECT_EQ(15, document().imageElement()->offsetLeft());
+ EXPECT_EQ(10, document().imageElement()->offsetTop());
+ EXPECT_EQ(50, imageWidth());
+ EXPECT_EQ(50, imageHeight());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698