| 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 9873d8db82f09471c74d4b5c8671c79ff86caa53..f6384c021790f6d58f9729e956faddec330e3e8a 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
|
|
|