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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp

Issue 1510233006: Revert of Reland: Fix incorrect sign in scroll and content box offset in absoluteToLocalPoint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/layout/compositing/CompositedLayerMappingTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
index 3cc3fffa9210a9f25a62a460e8e70dc2a178847d..283be2ff23491f030cce8f7b135386aade40d5b0 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -6,9 +6,11 @@
#include "core/layout/compositing/CompositedLayerMapping.h"
#include "core/frame/FrameView.h"
+#include "core/html/HTMLIFrameElement.h"
#include "core/layout/LayoutBoxModelObject.h"
#include "core/layout/LayoutTestHelper.h"
#include "core/layout/LayoutView.h"
+#include "core/loader/EmptyClients.h"
#include "core/paint/PaintLayer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -56,8 +58,6 @@
{
GraphicsLayer::setDrawDebugRedFillForTesting(true);
RuntimeEnabledFeatures::setSlimmingPaintSynchronizedPaintingEnabled(m_originalSlimmingPaintSynchronizedPaintingEnabled);
-
- RenderingTest::TearDown();
}
bool m_originalSlimmingPaintSynchronizedPaintingEnabled;
@@ -65,11 +65,10 @@
#define EXPECT_RECT_EQ(expected, actual) \
do { \
- const IntRect& actualRect = actual; \
- EXPECT_EQ(expected.x(), actualRect.x()); \
- EXPECT_EQ(expected.y(), actualRect.y()); \
- EXPECT_EQ(expected.width(), actualRect.width()); \
- EXPECT_EQ(expected.height(), actualRect.height()); \
+ EXPECT_EQ(expected.x(), actual.x()); \
+ EXPECT_EQ(expected.y(), actual.y()); \
+ EXPECT_EQ(expected.width(), actual.width()); \
+ EXPECT_EQ(expected.height(), actual.height()); \
} while (false)
TEST_F(CompositedLayerMappingTest, SimpleInterestRect)
@@ -489,7 +488,7 @@
EXPECT_RECT_EQ(IntRect(5600, 0, 4400, 1000), groupedMapping->computeInterestRect(groupedMapping->squashingLayer(), IntRect()));
}
-TEST_F(CompositedLayerMappingTest, InterestRectOfIframeInScrolledDiv)
+TEST_F(CompositedLayerMappingTest, InterestRectOfScrolledIframe)
{
document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
setBodyInnerHTML(
@@ -498,7 +497,18 @@
"<iframe id=frame src='http://test.com' width='500' height='500' frameBorder='0'>"
"</iframe>");
- Document& frameDocument = setupChildIframe("frame", "<style>body { margin: 0; } #target { width: 200px; height: 200px; will-change: transform}</style><div id=target></div>");
+ HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById("frame"));
+ OwnPtrWillBeRawPtr<FrameLoaderClient> frameLoaderClient = FrameLoaderClientWithParent::create(document().frame());
+ RefPtrWillBePersistent<LocalFrame> subframe = LocalFrame::create(frameLoaderClient.get(), document().frame()->host(), &iframe);
+ subframe->setView(FrameView::create(subframe.get(), IntSize(500, 500)));
+ subframe->init();
+ static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->setChild(subframe.get());
+ document().frame()->host()->incrementSubframeCount();
+ Document& frameDocument = *iframe.contentDocument();
+
+ frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
+ frameDocument.body()->setInnerHTML("<style>body { margin: 0; } #target { width: 200px; height: 200px; will-change: transform}</style><div id=target></div>",
+ ASSERT_NO_EXCEPTION);
// Scroll 8000 pixels down to move the iframe into view.
document().view()->setScrollPosition(DoublePoint(0.0, 8000.0), ProgrammaticScroll);
@@ -508,51 +518,10 @@
ASSERT_TRUE(target);
EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), recomputeInterestRect(target->layoutObject()->enclosingLayer()->graphicsLayerBacking()));
-}
-
-TEST_F(CompositedLayerMappingTest, InterestRectOfScrolledIframe)
-{
- document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
- document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
- setBodyInnerHTML(
- "<style>body { margin: 0; }</style>"
- "<iframe id=frame src='http://test.com' width='500' height='500' frameBorder='0'>"
- "</iframe>");
-
- Document& frameDocument = setupChildIframe("frame", "<style>body { margin: 0; } #target { width: 200px; height: 8000px;}</style><div id=target></div>");
-
- document().view()->updateAllLifecyclePhases();
-
- // Scroll 7500 pixels down to bring the scrollable area to the bottom.
- frameDocument.view()->setScrollPosition(DoublePoint(0.0, 7500.0), ProgrammaticScroll);
- document().view()->updateAllLifecyclePhases();
-
- ASSERT_TRUE(frameDocument.view()->layoutView()->hasLayer());
- // The width is 485 pixels due to the size of the scrollbar.
- EXPECT_RECT_EQ(IntRect(0, 3500, 485, 4500), recomputeInterestRect(frameDocument.view()->layoutView()->enclosingLayer()->graphicsLayerBacking()));
-}
-
-TEST_F(CompositedLayerMappingTest, InterestRectOfIframeWithContentBoxOffset)
-{
- document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
- document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
- // Set a 10px border in order to have a contentBoxOffset for the iframe element.
- setBodyInnerHTML(
- "<style>body { margin: 0; } #frame { border: 10px solid black; }</style>"
- "<iframe id=frame src='http://test.com' width='500' height='500' frameBorder='0'>"
- "</iframe>");
-
- Document& frameDocument = setupChildIframe("frame", "<style>body { margin: 0; } #target { width: 200px; height: 8000px;}</style> <div id=target></div>");
-
- document().view()->updateAllLifecyclePhases();
-
- // Scroll 3000 pixels down to bring the scrollable area to somewhere in the middle.
- frameDocument.view()->setScrollPosition(DoublePoint(0.0, 3000.0), ProgrammaticScroll);
- document().view()->updateAllLifecyclePhases();
-
- ASSERT_TRUE(frameDocument.view()->layoutView()->hasLayer());
- // The width is 485 pixels due to the size of the scrollbar.
- EXPECT_RECT_EQ(IntRect(0, 0, 485, 7500), recomputeInterestRect(frameDocument.view()->layoutView()->enclosingLayer()->graphicsLayerBacking()));
+
+ subframe->detach(FrameDetachType::Remove);
+ static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->setChild(nullptr);
+ document().frame()->host()->decrementSubframeCount();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.cpp ('k') | third_party/WebKit/Source/core/page/PrintContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698