Commit 16a50c6d authored by zhenw@chromium.org's avatar zhenw@chromium.org

Navigation transitions (web to native app): Bug fix for hide/Show transition elements

This CL fixes a bug when hiding and showing transition elements and adds the test for it.

BUG=370696

Review URL: https://codereview.chromium.org/723073003

git-svn-id: svn://svn.chromium.org/blink/trunk@185328 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1f641661
......@@ -306,7 +306,7 @@ void WebDocument::hideTransitionElements(const WebString& cssSelector)
void WebDocument::showTransitionElements(const WebString& cssSelector)
{
RefPtrWillBeRawPtr<Document> document = unwrap<Document>();
document->hideTransitionElements(cssSelector);
document->showTransitionElements(cssSelector);
}
WebAXObject WebDocument::accessibilityObject() const
......
......@@ -101,4 +101,40 @@ TEST(WebDocumentTest, BeginExitTransition)
ASSERT_EQ(Color(0, 128, 0), bodyStyle->visitedDependentColor(CSSPropertyColor));
}
TEST(WebDocumentTest, HideAndShowTransitionElements)
{
std::string baseURL = "http://www.test.com:0/";
const char* htmlURL = "transition_hide_and_show.html";
URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + htmlURL), WebString::fromUTF8(htmlURL));
WebViewHelper webViewHelper;
webViewHelper.initializeAndLoad(baseURL + htmlURL);
WebFrame* frame = webViewHelper.webView()->mainFrame();
Document* coreDoc = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->document();
Element* transitionElement = coreDoc->getElementById("foo");
ASSERT(transitionElement);
RenderStyle* transitionStyle = transitionElement->renderStyle();
ASSERT(transitionStyle);
EXPECT_EQ(transitionStyle->opacity(), 1);
// Hide transition elements
frame->document().hideTransitionElements("#foo");
FrameTestHelpers::pumpPendingRequestsDoNotUse(frame);
coreDoc->updateRenderTreeIfNeeded();
transitionStyle = transitionElement->renderStyle();
ASSERT_TRUE(transitionStyle);
EXPECT_EQ(transitionStyle->opacity(), 0);
// Show transition elements
frame->document().showTransitionElements("#foo");
FrameTestHelpers::pumpPendingRequestsDoNotUse(frame);
coreDoc->updateRenderTreeIfNeeded();
transitionStyle = transitionElement->renderStyle();
ASSERT_TRUE(transitionStyle);
EXPECT_EQ(transitionStyle->opacity(), 1);
}
}
<!DOCTYPE html>
<div id='foo'>Hello World!</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment