| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "core/frame/Deprecation.h" | |
| 6 | |
| 7 #include "core/frame/FrameConsole.h" | |
| 8 #include "core/frame/FrameHost.h" | |
| 9 #include "core/frame/LocalFrame.h" | |
| 10 #include "core/frame/UseCounter.h" | |
| 11 #include "core/inspector/ConsoleMessage.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 Deprecation::Deprecation() | |
| 16 { | |
| 17 m_cssPropertyDeprecationBits.ensureSize(lastUnresolvedCSSProperty + 1); | |
| 18 m_cssPropertyDeprecationBits.clearAll(); | |
| 19 } | |
| 20 | |
| 21 Deprecation::~Deprecation() | |
| 22 { | |
| 23 m_cssPropertyDeprecationBits.clearAll(); | |
| 24 } | |
| 25 | |
| 26 void Deprecation::suppress(CSSPropertyID unresolvedProperty) | |
| 27 { | |
| 28 ASSERT(unresolvedProperty >= firstCSSProperty); | |
| 29 ASSERT(unresolvedProperty <= lastUnresolvedCSSProperty); | |
| 30 m_cssPropertyDeprecationBits.quickSet(unresolvedProperty); | |
| 31 } | |
| 32 bool Deprecation::isSuppressed(CSSPropertyID unresolvedProperty) | |
| 33 { | |
| 34 ASSERT(unresolvedProperty >= firstCSSProperty); | |
| 35 ASSERT(unresolvedProperty <= lastUnresolvedCSSProperty); | |
| 36 return m_cssPropertyDeprecationBits.quickGet(unresolvedProperty); | |
| 37 } | |
| 38 | |
| 39 void Deprecation::warnOnDeprecatedProperties(const LocalFrame* frame, CSSPropert
yID unresolvedProperty) | |
| 40 { | |
| 41 FrameHost* host = frame ? frame->host() : nullptr; | |
| 42 if (!host || host->deprecation().isSuppressed(unresolvedProperty)) { | |
| 43 return; | |
| 44 } | |
| 45 | |
| 46 String message = deprecationMessage(unresolvedProperty); | |
| 47 if (!message.isEmpty()) { | |
| 48 host->deprecation().suppress(unresolvedProperty); | |
| 49 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou
rce, WarningMessageLevel, message)); | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty) | |
| 54 { | |
| 55 switch (unresolvedProperty) { | |
| 56 case CSSPropertyWebkitBackgroundComposite: | |
| 57 return UseCounter::willBeRemoved("'-webkit-background-composite'", 51, "
6607299456008192"); | |
| 58 default: | |
| 59 return emptyString(); | |
| 60 } | |
| 61 } | |
| 62 | |
| 63 } // namespace blink | |
| OLD | NEW |