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

Unified Diff: third_party/WebKit/Source/core/frame/DeprecationHelper.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/DeprecationHelper.cpp
diff --git a/third_party/WebKit/Source/core/frame/DeprecationHelper.cpp b/third_party/WebKit/Source/core/frame/DeprecationHelper.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dcc651845234e4a9cbfe3cf8d1b4e9aac0954953
--- /dev/null
+++ b/third_party/WebKit/Source/core/frame/DeprecationHelper.cpp
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 Google, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "core/frame/DeprecationHelper.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 {
+
+DeprecationHelper::DeprecationHelper()
+{
+ m_CSSPropertyDeprecationBits.ensureSize(lastUnresolvedCSSProperty + 1);
+ m_CSSPropertyDeprecationBits.clearAll();
+}
+
+DeprecationHelper::~DeprecationHelper()
+{
+ m_CSSPropertyDeprecationBits.clearAll();
+}
+
+void DeprecationHelper::showDeprecationWarning(const LocalFrame* frame, CSSPropertyID propertyID)
+{
+ if (!frame)
+ return;
+ FrameHost* host = frame->host();
+ if (!host)
+ return;
+
+ String message = deprecationMessage(propertyID);
+ if (!host->deprecationHelper().isCounted(propertyID) && !message.isEmpty()) {
+ host->deprecationHelper().count(propertyID);
+ frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSource, WarningMessageLevel, message));
+ }
+}
+
+const char* milestoneString(int milestone)
+{
+ switch (milestone) {
+ case 50:
+ return "M50, around April 2016";
+ case 51:
+ return "M51, around June 2016";
+ case 53:
+ return "M53, around September 2016";
+ }
+ ASSERT_NOT_REACHED();
+ return nullptr;
+}
+
+String willBeRemoved(const char* feature, int milestone, const char* details)
+{
+ return String::format("%s is deprecated and will be removed in %s. See https://www.chromestatus.com/features/%s for more details.", feature, milestoneString(milestone), details);
+}
alancutter (OOO until 2018) 2016/01/21 00:58:38 Don't copy paste this, expose it as a static metho
nainar 2016/01/21 02:39:06 Done.
+
+String DeprecationHelper::deprecationMessage(CSSPropertyID cssPropertyID)
+{
+ switch (cssPropertyID) {
+ case CSSPropertyWebkitBackgroundComposite:
+ return willBeRemoved("'-webkit-background-composite'", 51, "6607299456008192");
+ default:
+ return emptyString();
+ }
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698