Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: Source/core/css/WebKitCSSViewportRule.cpp

Issue 15797004: Cleanup WebKit prefixed names for classes in css directory. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer.
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials
15 * provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31 #include "config.h"
32 #include "core/css/WebKitCSSViewportRule.h"
33
34 #if ENABLE(CSS_DEVICE_ADAPTATION)
35
36 #include "core/css/PropertySetCSSStyleDeclaration.h"
37 #include "core/css/StylePropertySet.h"
38 #include "core/css/StyleRule.h"
39 #include "core/dom/WebCoreMemoryInstrumentation.h"
40 #include <wtf/text/StringBuilder.h>
41
42 namespace WebCore {
43
44 WebKitCSSViewportRule::WebKitCSSViewportRule(StyleRuleViewport* viewportRule, CS SStyleSheet* sheet)
45 : CSSRule(sheet)
46 , m_viewportRule(viewportRule)
47 {
48 }
49
50 WebKitCSSViewportRule::~WebKitCSSViewportRule()
51 {
52 if (m_propertiesCSSOMWrapper)
53 m_propertiesCSSOMWrapper->clearParentRule();
54 }
55
56 CSSStyleDeclaration* WebKitCSSViewportRule::style() const
57 {
58 if (!m_propertiesCSSOMWrapper)
59 m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_viewpo rtRule->mutableProperties(), const_cast<WebKitCSSViewportRule*>(this));
60
61 return m_propertiesCSSOMWrapper.get();
62 }
63
64 String WebKitCSSViewportRule::cssText() const
65 {
66 StringBuilder result;
67 result.appendLiteral("@-webkit-viewport { ");
68
69 String decls = m_viewportRule->properties()->asText();
70 result.append(decls);
71 if (!decls.isEmpty())
72 result.append(' ');
73
74 result.append('}');
75
76 return result.toString();
77 }
78
79 void WebKitCSSViewportRule::reattach(StyleRuleBase* rule)
80 {
81 ASSERT(rule);
82 ASSERT_WITH_SECURITY_IMPLICATION(rule->isViewportRule());
83 m_viewportRule = static_cast<StyleRuleViewport*>(rule);
84
85 if (m_propertiesCSSOMWrapper)
86 m_propertiesCSSOMWrapper->reattach(m_viewportRule->mutableProperties());
87 }
88
89 void WebKitCSSViewportRule::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo ) const
90 {
91 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
92 CSSRule::reportMemoryUsage(memoryObjectInfo);
93 info.addMember(m_viewportRule, "viewportRule");
94 info.addMember(m_propertiesCSSOMWrapper, "propertiesCSSOMWrapper");
95 }
96
97 } // namespace WebCore
98
99 #endif // ENABLE(CSS_DEVICE_ADAPTATION)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698