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

Unified Diff: third_party/WebKit/Source/core/frame/Deprecation.cpp

Issue 1585383003: Add deprecation message for -webkit-background-composite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/core/frame/Deprecation.cpp
diff --git a/third_party/WebKit/Source/core/frame/Deprecation.cpp b/third_party/WebKit/Source/core/frame/Deprecation.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4d98668002936e55c45df4b75eb4298c07b50c80
--- /dev/null
+++ b/third_party/WebKit/Source/core/frame/Deprecation.cpp
@@ -0,0 +1,63 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/frame/Deprecation.h"
+
+#include "core/frame/FrameConsole.h"
+#include "core/frame/FrameHost.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/UseCounter.h"
+#include "core/inspector/ConsoleMessage.h"
+
+namespace blink {
+
+Deprecation::Deprecation()
+{
+ m_cssPropertyDeprecationBits.ensureSize(lastUnresolvedCSSProperty + 1);
+ m_cssPropertyDeprecationBits.clearAll();
+}
+
+Deprecation::~Deprecation()
+{
+ m_cssPropertyDeprecationBits.clearAll();
+}
+
+void Deprecation::suppress(CSSPropertyID propertyID)
Timothy Loh 2016/01/25 04:48:41 propertyID -> unresolvedProperty everywhere
nainar 2016/01/25 05:33:22 Done
+{
+ ASSERT(propertyID >= firstCSSProperty);
+ ASSERT(propertyID <= lastUnresolvedCSSProperty);
+ m_cssPropertyDeprecationBits.quickSet(propertyID);
+}
+bool Deprecation::isSuppressed(CSSPropertyID propertyID)
+{
+ ASSERT(propertyID >= firstCSSProperty);
+ ASSERT(propertyID <= lastUnresolvedCSSProperty);
+ return m_cssPropertyDeprecationBits.quickGet(propertyID);
+}
+
+void Deprecation::showConsoleWarning(const LocalFrame* frame, CSSPropertyID propertyID)
+{
+ FrameHost* host = frame ? frame->host() : nullptr;
+ if (!host || host->deprecation().isSuppressed(propertyID)) {
+ return;
+ }
+
+ String message = deprecationMessage(propertyID);
+ if (!message.isEmpty()) {
+ host->deprecation().suppress(propertyID);
+ frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSource, WarningMessageLevel, message));
+ }
+}
+
+String Deprecation::deprecationMessage(CSSPropertyID cssPropertyID)
+{
+ switch (cssPropertyID) {
+ case CSSPropertyWebkitBackgroundComposite:
+ return UseCounter::willBeRemoved("'-webkit-background-composite'", 51, "6607299456008192");
+ default:
+ return emptyString();
+ }
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698