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

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

Issue 2643723008: [devtools] Add a command to emulate the default background color. (Closed)
Patch Set: Force lifecycle update to CompositingCleanPlusScrolling. Created 3 years, 10 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 | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 m_tabsToLinks(false), 365 m_tabsToLinks(false),
366 m_layerTreeView(nullptr), 366 m_layerTreeView(nullptr),
367 m_rootLayer(nullptr), 367 m_rootLayer(nullptr),
368 m_rootGraphicsLayer(nullptr), 368 m_rootGraphicsLayer(nullptr),
369 m_visualViewportContainerLayer(nullptr), 369 m_visualViewportContainerLayer(nullptr),
370 m_matchesHeuristicsForGpuRasterization(false), 370 m_matchesHeuristicsForGpuRasterization(false),
371 m_flingModifier(0), 371 m_flingModifier(0),
372 m_flingSourceDevice(WebGestureDeviceUninitialized), 372 m_flingSourceDevice(WebGestureDeviceUninitialized),
373 m_fullscreenController(FullscreenController::create(this)), 373 m_fullscreenController(FullscreenController::create(this)),
374 m_baseBackgroundColor(Color::white), 374 m_baseBackgroundColor(Color::white),
375 m_baseBackgroundColorOverride(Color::transparent),
375 m_backgroundColorOverride(Color::transparent), 376 m_backgroundColorOverride(Color::transparent),
376 m_zoomFactorOverride(0), 377 m_zoomFactorOverride(0),
377 m_userGestureObserved(false), 378 m_userGestureObserved(false),
378 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), 379 m_shouldDispatchFirstVisuallyNonEmptyLayout(false),
379 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), 380 m_shouldDispatchFirstLayoutAfterFinishedParsing(false),
380 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), 381 m_shouldDispatchFirstLayoutAfterFinishedLoading(false),
381 m_displayMode(WebDisplayModeBrowser), 382 m_displayMode(WebDisplayModeBrowser),
382 m_elasticOverscroll(FloatSize()), 383 m_elasticOverscroll(FloatSize()),
383 m_mutator(nullptr), 384 m_mutator(nullptr),
384 m_scheduler(WTF::wrapUnique(Platform::current() 385 m_scheduler(WTF::wrapUnique(Platform::current()
(...skipping 3185 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 3571
3571 bool WebViewImpl::isTransparent() const { 3572 bool WebViewImpl::isTransparent() const {
3572 return m_isTransparent; 3573 return m_isTransparent;
3573 } 3574 }
3574 3575
3575 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController() 3576 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController()
3576 const { 3577 const {
3577 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget()); 3578 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget());
3578 } 3579 }
3579 3580
3581 Color WebViewImpl::baseBackgroundColor() const {
3582 return alphaChannel(m_baseBackgroundColorOverride)
3583 ? m_baseBackgroundColorOverride
3584 : m_baseBackgroundColor;
3585 }
3586
3580 void WebViewImpl::setBaseBackgroundColor(WebColor color) { 3587 void WebViewImpl::setBaseBackgroundColor(WebColor color) {
3581 if (m_baseBackgroundColor == color) 3588 if (m_baseBackgroundColor == color)
3582 return; 3589 return;
3583 3590
3584 m_baseBackgroundColor = color; 3591 m_baseBackgroundColor = color;
3592 updateBaseBackgroundColor();
3593 }
3585 3594
3595 void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) {
3596 m_baseBackgroundColorOverride = color;
3597 if (mainFrameImpl()) {
3598 // Force lifecycle update to ensure we're good to call
3599 // FrameView::setBaseBackgroundColor().
3600 mainFrameImpl()
3601 ->frame()
3602 ->view()
3603 ->updateLifecycleToCompositingCleanPlusScrolling();
3604 }
3605 updateBaseBackgroundColor();
3606 }
3607
3608 void WebViewImpl::updateBaseBackgroundColor() {
3609 Color color = baseBackgroundColor();
3586 if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()) 3610 if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame())
3587 m_page->deprecatedLocalMainFrame()->view()->setBaseBackgroundColor(color); 3611 m_page->deprecatedLocalMainFrame()->view()->setBaseBackgroundColor(color);
3588 } 3612 }
3589 3613
3590 void WebViewImpl::setIsActive(bool active) { 3614 void WebViewImpl::setIsActive(bool active) {
3591 if (page()) 3615 if (page())
3592 page()->focusController().setActive(active); 3616 page()->focusController().setActive(active);
3593 } 3617 }
3594 3618
3595 bool WebViewImpl::isActive() const { 3619 bool WebViewImpl::isActive() const {
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
4194 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4218 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4195 return nullptr; 4219 return nullptr;
4196 return focusedFrame; 4220 return focusedFrame;
4197 } 4221 }
4198 4222
4199 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4223 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4200 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4224 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4201 } 4225 }
4202 4226
4203 } // namespace blink 4227 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698