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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
diff --git a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
index f661594577ef716c1108aaf48cbcc8102f487974..0bee22ee3d362c65e58211cca084cd0111466f67 100644
--- a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
+++ b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp
@@ -7,13 +7,16 @@
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/Settings.h"
+#include "core/inspector/protocol/DOM.h"
#include "core/page/Page.h"
#include "platform/geometry/DoubleRect.h"
+#include "platform/graphics/Color.h"
#include "public/platform/Platform.h"
#include "public/platform/WebFloatPoint.h"
#include "public/platform/WebThread.h"
#include "public/platform/WebViewScheduler.h"
#include "web/DevToolsEmulator.h"
+#include "web/WebFrameWidgetBase.h"
#include "web/WebLocalFrameImpl.h"
#include "web/WebViewImpl.h"
@@ -169,6 +172,15 @@ void InspectorEmulationAgent::virtualTimeBudgetExpired() {
frontend()->virtualTimeBudgetExpired();
}
+Response InspectorEmulationAgent::setDefaultBackgroundColor(
+ 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
+ int alpha = lroundf(255.0f * color->getA(1.0f));
+ // Clamping of values is done by Color() constructor.
+ 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
+ Color(color->getR(), color->getG(), color->getB(), alpha).rgb());
+ return Response::OK();
+}
+
DEFINE_TRACE(InspectorEmulationAgent) {
visitor->trace(m_webLocalFrameImpl);
InspectorBaseAgent::trace(visitor);

Powered by Google App Engine
This is Rietveld 408576698