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

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

Issue 2704213002: [devtools] Allow transparent base background color overrides. (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/InspectorEmulationAgent.h" 5 #include "web/InspectorEmulationAgent.h"
6 6
7 #include "core/frame/FrameHost.h" 7 #include "core/frame/FrameHost.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/inspector/protocol/DOM.h" 10 #include "core/inspector/protocol/DOM.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void InspectorEmulationAgent::virtualTimeBudgetExpired() { 181 void InspectorEmulationAgent::virtualTimeBudgetExpired() {
182 m_webLocalFrameImpl->view()->scheduler()->setVirtualTimePolicy( 182 m_webLocalFrameImpl->view()->scheduler()->setVirtualTimePolicy(
183 WebViewScheduler::VirtualTimePolicy::PAUSE); 183 WebViewScheduler::VirtualTimePolicy::PAUSE);
184 frontend()->virtualTimeBudgetExpired(); 184 frontend()->virtualTimeBudgetExpired();
185 } 185 }
186 186
187 Response InspectorEmulationAgent::setDefaultBackgroundColorOverride( 187 Response InspectorEmulationAgent::setDefaultBackgroundColorOverride(
188 Maybe<protocol::DOM::RGBA> color) { 188 Maybe<protocol::DOM::RGBA> color) {
189 if (!color.isJust()) { 189 if (!color.isJust()) {
190 // Clear the override and state. 190 // Clear the override and state.
191 webViewImpl()->setBaseBackgroundColorOverride(Color::transparent); 191 webViewImpl()->clearBaseBackgroundColorOverride();
192 m_state->remove(EmulationAgentState::defaultBackgroundColorOverrideRGBA); 192 m_state->remove(EmulationAgentState::defaultBackgroundColorOverrideRGBA);
193 return Response::OK(); 193 return Response::OK();
194 } 194 }
195 195
196 blink::protocol::DOM::RGBA* rgba = color.fromJust(); 196 blink::protocol::DOM::RGBA* rgba = color.fromJust();
197 m_state->setValue(EmulationAgentState::defaultBackgroundColorOverrideRGBA, 197 m_state->setValue(EmulationAgentState::defaultBackgroundColorOverrideRGBA,
198 rgba->toValue()); 198 rgba->toValue());
199 // Clamping of values is done by Color() constructor. 199 // Clamping of values is done by Color() constructor.
200 int alpha = lroundf(255.0f * rgba->getA(1.0f)); 200 int alpha = lroundf(255.0f * rgba->getA(1.0f));
201 webViewImpl()->setBaseBackgroundColorOverride( 201 webViewImpl()->setBaseBackgroundColorOverride(
202 Color(rgba->getR(), rgba->getG(), rgba->getB(), alpha).rgb()); 202 Color(rgba->getR(), rgba->getG(), rgba->getB(), alpha).rgb());
203 return Response::OK(); 203 return Response::OK();
204 } 204 }
205 205
206 DEFINE_TRACE(InspectorEmulationAgent) { 206 DEFINE_TRACE(InspectorEmulationAgent) {
207 visitor->trace(m_webLocalFrameImpl); 207 visitor->trace(m_webLocalFrameImpl);
208 InspectorBaseAgent::trace(visitor); 208 InspectorBaseAgent::trace(visitor);
209 } 209 }
210 210
211 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/WebViewImpl.h » ('j') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698