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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 286903011: Show DragImage when the dragged element or its parent has transform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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 | « Source/core/rendering/RenderObject.cpp ('k') | Source/web/tests/data/nodeimage.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 6561d62da237e38cb4351eb1c621707437e43195..b0fdef8e6bd66b00cd63cdd97ed88eed4ba6fd7b 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -57,6 +57,7 @@
#include "core/rendering/RenderView.h"
#include "core/rendering/TextAutosizer.h"
#include "core/rendering/compositing/RenderLayerCompositor.h"
+#include "platform/DragImage.h"
#include "platform/UserGestureIndicator.h"
#include "platform/geometry/FloatRect.h"
#include "platform/network/ResourceError.h"
@@ -169,6 +170,17 @@ protected:
webViewHelper->webView()->resize(WebSize(640, 480));
}
+ PassOwnPtr<WebCore::DragImage> nodeImageTestSetup(FrameTestHelpers::WebViewHelper* webViewHelper, const std::string& testcase)
+ {
+ registerMockedHttpURLLoad("nodeimage.html");
+ webViewHelper->initializeAndLoad(m_baseURL + "nodeimage.html");
+ webViewHelper->webView()->resize(WebSize(640, 480));
+ webViewHelper->webView()->layout();
+ RefPtr<WebCore::LocalFrame> frame = webViewHelper->webViewImpl()->page()->mainFrame();
+ WebCore::Element* element = frame->document()->getElementById(testcase.c_str());
+ return frame->nodeImage(*element);
+ }
+
std::string m_baseURL;
std::string m_chromeURL;
};
@@ -5492,4 +5504,40 @@ TEST_F(WebFrameTest, ReloadBypassingCache)
EXPECT_EQ(WebURLRequest::ReloadBypassingCache, frame->dataSource()->request().cachePolicy());
}
+TEST_F(WebFrameTest, NodeImageTestCSSTransform)
+{
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ OwnPtr<WebCore::DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-transform"));
+ EXPECT_TRUE(dragImage);
+
+ SkBitmap bitmap;
+ ASSERT_TRUE(bitmap.allocN32Pixels(40, 40));
+ SkCanvas canvas(bitmap);
+ canvas.drawColor(SK_ColorGREEN);
+
+ EXPECT_EQ(40, dragImage->size().width());
+ EXPECT_EQ(40, dragImage->size().height());
+ const SkBitmap& dragBitmap = dragImage->bitmap();
+ SkAutoLockPixels lockPixel(dragBitmap);
+ EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSize()));
+}
+
+TEST_F(WebFrameTest, NodeImageTestCSS3DTransform)
+{
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ OwnPtr<WebCore::DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform"));
+ EXPECT_TRUE(dragImage);
+
+ SkBitmap bitmap;
+ ASSERT_TRUE(bitmap.allocN32Pixels(20, 40));
+ SkCanvas canvas(bitmap);
+ canvas.drawColor(SK_ColorGREEN);
+
+ EXPECT_EQ(20, dragImage->size().width());
+ EXPECT_EQ(40, dragImage->size().height());
+ const SkBitmap& dragBitmap = dragImage->bitmap();
+ SkAutoLockPixels lockPixel(dragBitmap);
+ EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSize()));
+}
+
} // namespace
« no previous file with comments | « Source/core/rendering/RenderObject.cpp ('k') | Source/web/tests/data/nodeimage.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698