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/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 String willBeRemoved(const char* feature, | 48 String willBeRemoved(const char* feature, |
49 Milestone milestone, | 49 Milestone milestone, |
50 const char* details) { | 50 const char* details) { |
51 return String::format( | 51 return String::format( |
52 "%s is deprecated and will be removed in %s. See " | 52 "%s is deprecated and will be removed in %s. See " |
53 "https://www.chromestatus.com/features/%s for more details.", | 53 "https://www.chromestatus.com/features/%s for more details.", |
54 feature, milestoneString(milestone), details); | 54 feature, milestoneString(milestone), details); |
55 } | 55 } |
56 | 56 |
57 #if 0 | |
58 // TODO(jsbell): Currently unused, but likely to be needed in the future. | |
59 String replacedWillBeRemoved(const char* feature, | 57 String replacedWillBeRemoved(const char* feature, |
60 const char* replacement, | 58 const char* replacement, |
61 Milestone milestone, | 59 Milestone milestone, |
62 const char* details) { | 60 const char* details) { |
63 return String::format( | 61 return String::format( |
64 "%s is deprecated and will be removed in %s. Please use %s instead. See " | 62 "%s is deprecated and will be removed in %s. Please use %s instead. See " |
65 "https://www.chromestatus.com/features/%s for more details.", | 63 "https://www.chromestatus.com/features/%s for more details.", |
66 feature, milestoneString(milestone), replacement, details); | 64 feature, milestoneString(milestone), replacement, details); |
67 } | 65 } |
68 #endif | |
69 | 66 |
70 } // anonymous namespace | 67 } // anonymous namespace |
71 | 68 |
72 namespace blink { | 69 namespace blink { |
73 | 70 |
74 Deprecation::Deprecation() : m_muteCount(0) { | 71 Deprecation::Deprecation() : m_muteCount(0) { |
75 m_cssPropertyDeprecationBits.ensureSize(lastUnresolvedCSSProperty + 1); | 72 m_cssPropertyDeprecationBits.ensureSize(lastUnresolvedCSSProperty + 1); |
76 } | 73 } |
77 | 74 |
78 Deprecation::~Deprecation() {} | 75 Deprecation::~Deprecation() {} |
(...skipping 30 matching lines...) Expand all Loading... |
109 String message = deprecationMessage(unresolvedProperty); | 106 String message = deprecationMessage(unresolvedProperty); |
110 if (!message.isEmpty()) { | 107 if (!message.isEmpty()) { |
111 host->deprecation().suppress(unresolvedProperty); | 108 host->deprecation().suppress(unresolvedProperty); |
112 ConsoleMessage* consoleMessage = ConsoleMessage::create( | 109 ConsoleMessage* consoleMessage = ConsoleMessage::create( |
113 DeprecationMessageSource, WarningMessageLevel, message); | 110 DeprecationMessageSource, WarningMessageLevel, message); |
114 frame->console().addMessage(consoleMessage); | 111 frame->console().addMessage(consoleMessage); |
115 } | 112 } |
116 } | 113 } |
117 | 114 |
118 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty) { | 115 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty) { |
119 // TODO: Add a switch here when there are properties that we intend to | 116 switch (unresolvedProperty) { |
120 // deprecate. | 117 case CSSPropertyAliasMotionOffset: |
121 // Returning an empty string for now. | 118 return replacedWillBeRemoved("motion-offset", "offset-distance", M58, |
122 return emptyString(); | 119 "6390764217040896"); |
| 120 case CSSPropertyAliasMotionRotation: |
| 121 return replacedWillBeRemoved("motion-rotation", "offset-rotate", M58, |
| 122 "6390764217040896"); |
| 123 case CSSPropertyAliasMotionPath: |
| 124 return replacedWillBeRemoved("motion-path", "offset-path", M58, |
| 125 "6390764217040896"); |
| 126 case CSSPropertyMotion: |
| 127 return replacedWillBeRemoved("motion", "offset", M58, "6390764217040896"); |
| 128 case CSSPropertyOffsetRotation: |
| 129 return replacedWillBeRemoved("offset-rotation", "offset-rotate", M58, |
| 130 "6390764217040896"); |
| 131 |
| 132 default: |
| 133 return emptyString(); |
| 134 } |
123 } | 135 } |
124 | 136 |
125 void Deprecation::countDeprecation(const LocalFrame* frame, | 137 void Deprecation::countDeprecation(const LocalFrame* frame, |
126 UseCounter::Feature feature) { | 138 UseCounter::Feature feature) { |
127 if (!frame) | 139 if (!frame) |
128 return; | 140 return; |
129 FrameHost* host = frame->host(); | 141 FrameHost* host = frame->host(); |
130 if (!host || host->deprecation().m_muteCount) | 142 if (!host || host->deprecation().m_muteCount) |
131 return; | 143 return; |
132 | 144 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 return willBeRemoved("HTMLObjectElement legacy caller", M58, | 414 return willBeRemoved("HTMLObjectElement legacy caller", M58, |
403 "5715026367217664"); | 415 "5715026367217664"); |
404 | 416 |
405 // Features that aren't deprecated don't have a deprecation message. | 417 // Features that aren't deprecated don't have a deprecation message. |
406 default: | 418 default: |
407 return String(); | 419 return String(); |
408 } | 420 } |
409 } | 421 } |
410 | 422 |
411 } // namespace blink | 423 } // namespace blink |
OLD | NEW |