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

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: jamesr comments 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 #if ENABLE(NAVIGATOR_CONTENT_UTILS) 420 #if ENABLE(NAVIGATOR_CONTENT_UTILS)
421 , m_navigatorContentUtilsClient(NavigatorContentUtilsClientImpl::create(this )) 421 , m_navigatorContentUtilsClient(NavigatorContentUtilsClientImpl::create(this ))
422 #endif 422 #endif
423 , m_flingModifier(0) 423 , m_flingModifier(0)
424 , m_flingSourceDevice(false) 424 , m_flingSourceDevice(false)
425 , m_showFPSCounter(false) 425 , m_showFPSCounter(false)
426 , m_showPaintRects(false) 426 , m_showPaintRects(false)
427 , m_showDebugBorders(false) 427 , m_showDebugBorders(false)
428 , m_continuousPaintingEnabled(false) 428 , m_continuousPaintingEnabled(false)
429 , m_showScrollBottleneckRects(false) 429 , m_showScrollBottleneckRects(false)
430 , m_baseBackgroundColor(Color::white)
430 { 431 {
431 Page::PageClients pageClients; 432 Page::PageClients pageClients;
432 pageClients.chromeClient = &m_chromeClientImpl; 433 pageClients.chromeClient = &m_chromeClientImpl;
433 pageClients.contextMenuClient = &m_contextMenuClientImpl; 434 pageClients.contextMenuClient = &m_contextMenuClientImpl;
434 pageClients.editorClient = &m_editorClientImpl; 435 pageClients.editorClient = &m_editorClientImpl;
435 pageClients.dragClient = &m_dragClientImpl; 436 pageClients.dragClient = &m_dragClientImpl;
436 pageClients.inspectorClient = &m_inspectorClientImpl; 437 pageClients.inspectorClient = &m_inspectorClientImpl;
437 pageClients.backForwardClient = &m_backForwardClientImpl; 438 pageClients.backForwardClient = &m_backForwardClientImpl;
438 439
439 m_page = adoptPtr(new Page(pageClients)); 440 m_page = adoptPtr(new Page(pageClients));
(...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 if (!frame) 2455 if (!frame)
2455 return false; 2456 return false;
2456 return frame->selection()->isContentEditable(); 2457 return frame->selection()->isContentEditable();
2457 } 2458 }
2458 2459
2459 WebColor WebViewImpl::backgroundColor() const 2460 WebColor WebViewImpl::backgroundColor() const
2460 { 2461 {
2461 if (isTransparent()) 2462 if (isTransparent())
2462 return Color::transparent; 2463 return Color::transparent;
2463 if (!m_page) 2464 if (!m_page)
2464 return Color::white; 2465 return m_baseBackgroundColor;
2465 FrameView* view = m_page->mainFrame()->view(); 2466 FrameView* view = m_page->mainFrame()->view();
2466 StyleColor backgroundColor = view->documentBackgroundColor(); 2467 StyleColor backgroundColor = view->documentBackgroundColor();
2467 if (!backgroundColor.isValid()) 2468 if (!backgroundColor.isValid())
2468 return Color::white; 2469 return m_baseBackgroundColor;
2469 return backgroundColor.rgb(); 2470 return backgroundColor.rgb();
2470 } 2471 }
2471 2472
2472 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) 2473 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length)
2473 { 2474 {
2474 const Frame* focused = focusedWebCoreFrame(); 2475 const Frame* focused = focusedWebCoreFrame();
2475 if (!focused) 2476 if (!focused)
2476 return false; 2477 return false;
2477 2478
2478 FrameSelection* selection = focused->selection(); 2479 FrameSelection* selection = focused->selection();
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
3571 3572
3572 // Future frames check this to know whether to be transparent. 3573 // Future frames check this to know whether to be transparent.
3573 m_isTransparent = isTransparent; 3574 m_isTransparent = isTransparent;
3574 } 3575 }
3575 3576
3576 bool WebViewImpl::isTransparent() const 3577 bool WebViewImpl::isTransparent() const
3577 { 3578 {
3578 return m_isTransparent; 3579 return m_isTransparent;
3579 } 3580 }
3580 3581
3582 void WebViewImpl::setBaseBackgroundColor(WebColor color)
3583 {
3584 if (m_baseBackgroundColor == color)
3585 return;
3586
3587 m_baseBackgroundColor = color;
3588
3589 m_page->mainFrame()->view()->updateBackgroundRecursively(color, m_isTranspar ent);
jamesr 2013/07/25 00:02:28 hmm, why recursive? won't this only change the bac
jamesr 2013/07/25 00:16:06 I'm pretty sure calling FrameView::setBaseBackgrou
joth 2013/07/25 00:39:43 Done. (just to clarify: I am relying on the exist
3590
3591 if (m_layerTreeView)
3592 m_layerTreeView->setBackgroundColor(backgroundColor());
3593 }
3594
3581 void WebViewImpl::setIsActive(bool active) 3595 void WebViewImpl::setIsActive(bool active)
3582 { 3596 {
3583 if (page() && page()->focusController()) 3597 if (page() && page()->focusController())
3584 page()->focusController()->setActive(active); 3598 page()->focusController()->setActive(active);
3585 } 3599 }
3586 3600
3587 bool WebViewImpl::isActive() const 3601 bool WebViewImpl::isActive() const
3588 { 3602 {
3589 return (page() && page()->focusController()) ? page()->focusController()->is Active() : false; 3603 return (page() && page()->focusController()) ? page()->focusController()->is Active() : false;
3590 } 3604 }
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 } 4158 }
4145 4159
4146 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4160 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4147 { 4161 {
4148 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4162 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4149 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4163 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4150 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4164 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4151 } 4165 }
4152 4166
4153 } // namespace WebKit 4167 } // 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