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

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

Issue 2643723008: [devtools] Add a command to emulate the default background color. (Closed)
Patch Set: Created 3 years, 11 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/page/Page.h" 11 #include "core/page/Page.h"
11 #include "platform/geometry/DoubleRect.h" 12 #include "platform/geometry/DoubleRect.h"
13 #include "platform/graphics/Color.h"
12 #include "public/platform/Platform.h" 14 #include "public/platform/Platform.h"
13 #include "public/platform/WebFloatPoint.h" 15 #include "public/platform/WebFloatPoint.h"
14 #include "public/platform/WebThread.h" 16 #include "public/platform/WebThread.h"
15 #include "public/platform/WebViewScheduler.h" 17 #include "public/platform/WebViewScheduler.h"
16 #include "web/DevToolsEmulator.h" 18 #include "web/DevToolsEmulator.h"
19 #include "web/WebFrameWidgetBase.h"
17 #include "web/WebLocalFrameImpl.h" 20 #include "web/WebLocalFrameImpl.h"
18 #include "web/WebViewImpl.h" 21 #include "web/WebViewImpl.h"
19 22
20 namespace blink { 23 namespace blink {
21 24
22 namespace EmulationAgentState { 25 namespace EmulationAgentState {
23 static const char scriptExecutionDisabled[] = "scriptExecutionDisabled"; 26 static const char scriptExecutionDisabled[] = "scriptExecutionDisabled";
24 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; 27 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
25 static const char emulatedMedia[] = "emulatedMedia"; 28 static const char emulatedMedia[] = "emulatedMedia";
26 static const char forcedViewportEnabled[] = "forcedViewportEnabled"; 29 static const char forcedViewportEnabled[] = "forcedViewportEnabled";
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 165 }
163 return Response::OK(); 166 return Response::OK();
164 } 167 }
165 168
166 void InspectorEmulationAgent::virtualTimeBudgetExpired() { 169 void InspectorEmulationAgent::virtualTimeBudgetExpired() {
167 m_webLocalFrameImpl->view()->scheduler()->setVirtualTimePolicy( 170 m_webLocalFrameImpl->view()->scheduler()->setVirtualTimePolicy(
168 WebViewScheduler::VirtualTimePolicy::PAUSE); 171 WebViewScheduler::VirtualTimePolicy::PAUSE);
169 frontend()->virtualTimeBudgetExpired(); 172 frontend()->virtualTimeBudgetExpired();
170 } 173 }
171 174
175 Response InspectorEmulationAgent::setDefaultBackgroundColor(
176 std::unique_ptr<protocol::DOM::RGBA> color) {
dgozman 2017/01/20 17:57:07 I'd like this to be optional, so that passing noth
Eric Seckler 2017/01/23 18:06:24 Done. Also renamed the command to overrideDefaultB
177 int alpha = lroundf(255.0f * color->getA(1.0f));
178 // Clamping of values is done by Color() constructor.
179 m_webLocalFrameImpl->frameWidget()->setBaseBackgroundColor(
dgozman 2017/01/20 17:57:07 We use WebViewImpl::setBackgroundColorOverride in
Eric Seckler 2017/01/23 18:06:24 Sounds good. I'm trying to use this method now, bu
dgozman 2017/01/23 20:27:04 Hmm... Looks like they are different. The one we u
Eric Seckler 2017/01/24 14:08:26 Ah, okay, that makes sense then. Back to setBaseBa
180 Color(color->getR(), color->getG(), color->getB(), alpha).rgb());
181 return Response::OK();
182 }
183
172 DEFINE_TRACE(InspectorEmulationAgent) { 184 DEFINE_TRACE(InspectorEmulationAgent) {
173 visitor->trace(m_webLocalFrameImpl); 185 visitor->trace(m_webLocalFrameImpl);
174 InspectorBaseAgent::trace(visitor); 186 InspectorBaseAgent::trace(visitor);
175 } 187 }
176 188
177 } // namespace blink 189 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698