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 propertyID) | |
Timothy Loh
2016/01/25 04:48:41
propertyID -> unresolvedProperty everywhere
nainar
2016/01/25 05:33:22
Done
| |
27 { | |
28 ASSERT(propertyID >= firstCSSProperty); | |
29 ASSERT(propertyID <= lastUnresolvedCSSProperty); | |
30 m_cssPropertyDeprecationBits.quickSet(propertyID); | |
31 } | |
32 bool Deprecation::isSuppressed(CSSPropertyID propertyID) | |
33 { | |
34 ASSERT(propertyID >= firstCSSProperty); | |
35 ASSERT(propertyID <= lastUnresolvedCSSProperty); | |
36 return m_cssPropertyDeprecationBits.quickGet(propertyID); | |
37 } | |
38 | |
39 void Deprecation::showConsoleWarning(const LocalFrame* frame, CSSPropertyID prop ertyID) | |
40 { | |
41 FrameHost* host = frame ? frame->host() : nullptr; | |
42 if (!host || host->deprecation().isSuppressed(propertyID)) { | |
43 return; | |
44 } | |
45 | |
46 String message = deprecationMessage(propertyID); | |
47 if (!message.isEmpty()) { | |
48 host->deprecation().suppress(propertyID); | |
49 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou rce, WarningMessageLevel, message)); | |
50 } | |
51 } | |
52 | |
53 String Deprecation::deprecationMessage(CSSPropertyID cssPropertyID) | |
54 { | |
55 switch (cssPropertyID) { | |
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 |