| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/frame/Deprecation.h" | 5 #include "core/frame/Deprecation.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
| 9 #include "core/frame/FrameConsole.h" | 9 #include "core/frame/FrameConsole.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/inspector/ConsoleMessage.h" | 11 #include "core/inspector/ConsoleMessage.h" |
| 12 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
| 13 #include "core/workers/WorkerOrWorkletGlobalScope.h" | 13 #include "core/workers/WorkerOrWorkletGlobalScope.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 enum Milestone { | 17 enum Milestone { |
| 18 M58, | |
| 19 M59, | 18 M59, |
| 20 M60, | 19 M60, |
| 21 M61, | 20 M61, |
| 22 M62, | 21 M62, |
| 23 }; | 22 }; |
| 24 | 23 |
| 25 const char* milestoneString(Milestone milestone) { | 24 const char* milestoneString(Milestone milestone) { |
| 26 // These are the Estimated Stable Dates: | 25 // These are the Estimated Stable Dates: |
| 27 // https://www.chromium.org/developers/calendar | 26 // https://www.chromium.org/developers/calendar |
| 28 | 27 |
| 29 switch (milestone) { | 28 switch (milestone) { |
| 30 case M58: | |
| 31 return "M58, around April 2017"; | |
| 32 case M59: | 29 case M59: |
| 33 return "M59, around June 2017"; | 30 return "M59, around June 2017"; |
| 34 case M60: | 31 case M60: |
| 35 return "M60, around August 2017"; | 32 return "M60, around August 2017"; |
| 36 case M61: | 33 case M61: |
| 37 return "M61, around September 2017"; | 34 return "M61, around September 2017"; |
| 38 case M62: | 35 case M62: |
| 39 return "M62, around October 2017"; | 36 return "M62, around October 2017"; |
| 40 } | 37 } |
| 41 | 38 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 String message = DeprecationMessage(unresolved_property); | 107 String message = DeprecationMessage(unresolved_property); |
| 111 if (!message.IsEmpty()) { | 108 if (!message.IsEmpty()) { |
| 112 page->GetDeprecation().Suppress(unresolved_property); | 109 page->GetDeprecation().Suppress(unresolved_property); |
| 113 ConsoleMessage* console_message = ConsoleMessage::Create( | 110 ConsoleMessage* console_message = ConsoleMessage::Create( |
| 114 kDeprecationMessageSource, kWarningMessageLevel, message); | 111 kDeprecationMessageSource, kWarningMessageLevel, message); |
| 115 frame->Console().AddMessage(console_message); | 112 frame->Console().AddMessage(console_message); |
| 116 } | 113 } |
| 117 } | 114 } |
| 118 | 115 |
| 119 String Deprecation::DeprecationMessage(CSSPropertyID unresolved_property) { | 116 String Deprecation::DeprecationMessage(CSSPropertyID unresolved_property) { |
| 120 switch (unresolved_property) { | 117 // TODO: Add a switch here when there are properties that we intend to |
| 121 case CSSPropertyAliasMotionOffset: | 118 // deprecate. |
| 122 return replacedWillBeRemoved("motion-offset", "offset-distance", M58, | 119 // Returning an empty string for now. |
| 123 "6390764217040896"); | 120 return g_empty_string; |
| 124 default: | |
| 125 return g_empty_string; | |
| 126 } | |
| 127 } | 121 } |
| 128 | 122 |
| 129 void Deprecation::CountDeprecation(const LocalFrame* frame, | 123 void Deprecation::CountDeprecation(const LocalFrame* frame, |
| 130 UseCounter::Feature feature) { | 124 UseCounter::Feature feature) { |
| 131 if (!frame) | 125 if (!frame) |
| 132 return; | 126 return; |
| 133 Page* page = frame->GetPage(); | 127 Page* page = frame->GetPage(); |
| 134 if (!page || page->GetDeprecation().mute_count_) | 128 if (!page || page->GetDeprecation().mute_count_) |
| 135 return; | 129 return; |
| 136 | 130 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 return willBeRemoved("SVGPathElement.getPathSegAtLength", M62, | 414 return willBeRemoved("SVGPathElement.getPathSegAtLength", M62, |
| 421 "5638783282184192"); | 415 "5638783282184192"); |
| 422 | 416 |
| 423 // Features that aren't deprecated don't have a deprecation message. | 417 // Features that aren't deprecated don't have a deprecation message. |
| 424 default: | 418 default: |
| 425 return String(); | 419 return String(); |
| 426 } | 420 } |
| 427 } | 421 } |
| 428 | 422 |
| 429 } // namespace blink | 423 } // namespace blink |
| OLD | NEW |