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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 19883002: Expose a way to set a view's base background color. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix unittests for Android, to reland Created 7 years, 5 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
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 #if ENABLE(NAVIGATOR_CONTENT_UTILS) 421 #if ENABLE(NAVIGATOR_CONTENT_UTILS)
422 , m_navigatorContentUtilsClient(NavigatorContentUtilsClientImpl::create(this )) 422 , m_navigatorContentUtilsClient(NavigatorContentUtilsClientImpl::create(this ))
423 #endif 423 #endif
424 , m_flingModifier(0) 424 , m_flingModifier(0)
425 , m_flingSourceDevice(false) 425 , m_flingSourceDevice(false)
426 , m_showFPSCounter(false) 426 , m_showFPSCounter(false)
427 , m_showPaintRects(false) 427 , m_showPaintRects(false)
428 , m_showDebugBorders(false) 428 , m_showDebugBorders(false)
429 , m_continuousPaintingEnabled(false) 429 , m_continuousPaintingEnabled(false)
430 , m_showScrollBottleneckRects(false) 430 , m_showScrollBottleneckRects(false)
431 , m_baseBackgroundColor(Color::white)
431 { 432 {
432 Page::PageClients pageClients; 433 Page::PageClients pageClients;
433 pageClients.chromeClient = &m_chromeClientImpl; 434 pageClients.chromeClient = &m_chromeClientImpl;
434 pageClients.contextMenuClient = &m_contextMenuClientImpl; 435 pageClients.contextMenuClient = &m_contextMenuClientImpl;
435 pageClients.editorClient = &m_editorClientImpl; 436 pageClients.editorClient = &m_editorClientImpl;
436 pageClients.dragClient = &m_dragClientImpl; 437 pageClients.dragClient = &m_dragClientImpl;
437 pageClients.inspectorClient = &m_inspectorClientImpl; 438 pageClients.inspectorClient = &m_inspectorClientImpl;
438 pageClients.backForwardClient = &m_backForwardClientImpl; 439 pageClients.backForwardClient = &m_backForwardClientImpl;
439 440
440 m_page = adoptPtr(new Page(pageClients)); 441 m_page = adoptPtr(new Page(pageClients));
(...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2455 if (!frame) 2456 if (!frame)
2456 return false; 2457 return false;
2457 return frame->selection()->isContentEditable(); 2458 return frame->selection()->isContentEditable();
2458 } 2459 }
2459 2460
2460 WebColor WebViewImpl::backgroundColor() const 2461 WebColor WebViewImpl::backgroundColor() const
2461 { 2462 {
2462 if (isTransparent()) 2463 if (isTransparent())
2463 return Color::transparent; 2464 return Color::transparent;
2464 if (!m_page) 2465 if (!m_page)
2465 return Color::white; 2466 return m_baseBackgroundColor;
2466 FrameView* view = m_page->mainFrame()->view(); 2467 FrameView* view = m_page->mainFrame()->view();
2467 StyleColor backgroundColor = view->documentBackgroundColor(); 2468 StyleColor backgroundColor = view->documentBackgroundColor();
2468 if (!backgroundColor.isValid()) 2469 if (!backgroundColor.isValid())
2469 return Color::white; 2470 return m_baseBackgroundColor;
2470 return backgroundColor.rgb(); 2471 return backgroundColor.rgb();
2471 } 2472 }
2472 2473
2473 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) 2474 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length)
2474 { 2475 {
2475 const Frame* focused = focusedWebCoreFrame(); 2476 const Frame* focused = focusedWebCoreFrame();
2476 if (!focused) 2477 if (!focused)
2477 return false; 2478 return false;
2478 2479
2479 FrameSelection* selection = focused->selection(); 2480 FrameSelection* selection = focused->selection();
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
3572 3573
3573 // Future frames check this to know whether to be transparent. 3574 // Future frames check this to know whether to be transparent.
3574 m_isTransparent = isTransparent; 3575 m_isTransparent = isTransparent;
3575 } 3576 }
3576 3577
3577 bool WebViewImpl::isTransparent() const 3578 bool WebViewImpl::isTransparent() const
3578 { 3579 {
3579 return m_isTransparent; 3580 return m_isTransparent;
3580 } 3581 }
3581 3582
3583 void WebViewImpl::setBaseBackgroundColor(WebColor color)
3584 {
3585 if (m_baseBackgroundColor == color)
3586 return;
3587
3588 m_baseBackgroundColor = color;
3589
3590 m_page->mainFrame()->view()->setBaseBackgroundColor(color);
3591
3592 if (m_layerTreeView)
3593 m_layerTreeView->setBackgroundColor(backgroundColor());
3594 }
3595
3582 void WebViewImpl::setIsActive(bool active) 3596 void WebViewImpl::setIsActive(bool active)
3583 { 3597 {
3584 if (page() && page()->focusController()) 3598 if (page() && page()->focusController())
3585 page()->focusController()->setActive(active); 3599 page()->focusController()->setActive(active);
3586 } 3600 }
3587 3601
3588 bool WebViewImpl::isActive() const 3602 bool WebViewImpl::isActive() const
3589 { 3603 {
3590 return (page() && page()->focusController()) ? page()->focusController()->is Active() : false; 3604 return (page() && page()->focusController()) ? page()->focusController()->is Active() : false;
3591 } 3605 }
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
4150 } 4164 }
4151 4165
4152 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4166 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4153 { 4167 {
4154 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4168 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4155 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4169 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4156 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4170 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4157 } 4171 }
4158 4172
4159 } // namespace WebKit 4173 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698