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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2715243004: [blink] Support (semi-)transparent background colors in WebView/Frame. (Closed)
Patch Set: add unit test for remote frame transparency Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 8152 matching lines...) Expand 10 before | Expand all | Expand 10 after
8163 EXPECT_EQ(200, layoutViewItem.logicalWidth().floor()); 8163 EXPECT_EQ(200, layoutViewItem.logicalWidth().floor());
8164 EXPECT_EQ(400, layoutViewItem.logicalHeight().floor()); 8164 EXPECT_EQ(400, layoutViewItem.logicalHeight().floor());
8165 EXPECT_FLOAT_EQ(0.5, webViewImpl->minimumPageScaleFactor()); 8165 EXPECT_FLOAT_EQ(0.5, webViewImpl->minimumPageScaleFactor());
8166 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); 8166 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor());
8167 } 8167 }
8168 8168
8169 namespace { 8169 namespace {
8170 8170
8171 class TestFullscreenWebLayerTreeView : public WebLayerTreeView { 8171 class TestFullscreenWebLayerTreeView : public WebLayerTreeView {
8172 public: 8172 public:
8173 void setHasTransparentBackground(bool value) override { 8173 void setBackgroundColor(blink::WebColor color) override {
8174 hasTransparentBackground = value; 8174 hasTransparentBackground = SkColorGetA(color) < SK_AlphaOPAQUE;
8175 } 8175 }
8176 bool hasTransparentBackground = false; 8176 bool hasTransparentBackground = false;
8177 }; 8177 };
8178 8178
8179 class TestFullscreenWebViewClient : public FrameTestHelpers::TestWebViewClient { 8179 class TestFullscreenWebViewClient : public FrameTestHelpers::TestWebViewClient {
8180 public: 8180 public:
8181 WebLayerTreeView* initializeLayerTreeView() override { 8181 WebLayerTreeView* initializeLayerTreeView() override {
8182 return &testFullscreenLayerTreeView; 8182 return &testFullscreenLayerTreeView;
8183 } 8183 }
8184 TestFullscreenWebLayerTreeView testFullscreenLayerTreeView; 8184 TestFullscreenWebLayerTreeView testFullscreenLayerTreeView;
(...skipping 3313 matching lines...) Expand 10 before | Expand all | Expand 10 after
11498 TEST_F(WebFrameTest, ContextMenuData) { 11498 TEST_F(WebFrameTest, ContextMenuData) {
11499 EXPECT_FALSE(testSelectAll("<textarea></textarea>")); 11499 EXPECT_FALSE(testSelectAll("<textarea></textarea>"));
11500 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>")); 11500 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>"));
11501 EXPECT_FALSE(testSelectAll("<input>")); 11501 EXPECT_FALSE(testSelectAll("<input>"));
11502 EXPECT_TRUE(testSelectAll("<input value='nonempty'>")); 11502 EXPECT_TRUE(testSelectAll("<input value='nonempty'>"));
11503 // TODO(amaralp): Empty contenteditable should not have select all enabled. 11503 // TODO(amaralp): Empty contenteditable should not have select all enabled.
11504 EXPECT_TRUE(testSelectAll("<div contenteditable></div>")); 11504 EXPECT_TRUE(testSelectAll("<div contenteditable></div>"));
11505 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>")); 11505 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>"));
11506 } 11506 }
11507 11507
11508 TEST_F(WebFrameTest, LocalFrameWithRemoteParentIsTransparent) {
11509 FrameTestHelpers::TestWebViewClient viewClient;
11510 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
11511 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
11512 view->settings()->setJavaScriptEnabled(true);
11513 view->setMainFrame(remoteClient.frame());
11514 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
11515 root->setReplicatedOrigin(SecurityOrigin::createUnique());
11516
11517 WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild(root);
11518 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page");
11519
11520 // Local frame with remote parent should have transparent baseBackgroundColor.
11521 Color color = localFrame->frameView()->baseBackgroundColor();
11522 EXPECT_EQ(Color::transparent, color);
11523
11524 view->close();
11525 }
11526
11508 } // namespace blink 11527 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698