Chromium Code Reviews| 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 } | |
|
nainar
2016/02/01 07:48:41
removed m_cssPropertyDeprecationBits.clearAll();
| |
| 19 | |
| 20 Deprecation::~Deprecation() | |
| 21 { | |
|
nainar
2016/02/01 07:48:41
m_cssPropertyDeprecationBits.clearAll();
| |
| 22 } | |
| 23 | |
| 24 void Deprecation::clearSuppression() | |
| 25 { | |
| 26 m_cssPropertyDeprecationBits.clearAll(); | |
| 27 } | |
| 28 | |
| 29 void Deprecation::suppress(CSSPropertyID unresolvedProperty) | |
| 30 { | |
| 31 ASSERT(unresolvedProperty >= firstCSSProperty); | |
| 32 ASSERT(unresolvedProperty <= lastUnresolvedCSSProperty); | |
| 33 m_cssPropertyDeprecationBits.quickSet(unresolvedProperty); | |
| 34 } | |
| 35 bool Deprecation::isSuppressed(CSSPropertyID unresolvedProperty) | |
| 36 { | |
| 37 ASSERT(unresolvedProperty >= firstCSSProperty); | |
| 38 ASSERT(unresolvedProperty <= lastUnresolvedCSSProperty); | |
| 39 return m_cssPropertyDeprecationBits.quickGet(unresolvedProperty); | |
| 40 } | |
| 41 | |
| 42 void Deprecation::warnOnDeprecatedProperties(const LocalFrame* frame, CSSPropert yID unresolvedProperty) | |
| 43 { | |
| 44 FrameHost* host = frame ? frame->host() : nullptr; | |
| 45 if (!host || host->deprecation().isSuppressed(unresolvedProperty)) | |
| 46 return; | |
| 47 | |
| 48 String message = deprecationMessage(unresolvedProperty); | |
| 49 if (!message.isEmpty()) { | |
| 50 host->deprecation().suppress(unresolvedProperty); | |
| 51 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou rce, WarningMessageLevel, message)); | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty) | |
| 56 { | |
| 57 switch (unresolvedProperty) { | |
| 58 case CSSPropertyWebkitBackgroundComposite: | |
| 59 return UseCounter::willBeRemoved("'-webkit-background-composite'", 51, " 6607299456008192"); | |
| 60 default: | |
| 61 return emptyString(); | |
| 62 } | |
| 63 } | |
| 64 | |
| 65 } // namespace blink | |
| OLD | NEW |