| OLD | NEW |
| (Empty) |
| 1 /** | |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | |
| 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) | |
| 4 * Copyright (C) 2002, 2005, 2006, 2012 Apple Computer, Inc. | |
| 5 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) | |
| 6 * | |
| 7 * This library is free software; you can redistribute it and/or | |
| 8 * modify it under the terms of the GNU Library General Public | |
| 9 * License as published by the Free Software Foundation; either | |
| 10 * version 2 of the License, or (at your option) any later version. | |
| 11 * | |
| 12 * This library is distributed in the hope that it will be useful, | |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 * Library General Public License for more details. | |
| 16 * | |
| 17 * You should have received a copy of the GNU Library General Public License | |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 20 * Boston, MA 02110-1301, USA. | |
| 21 */ | |
| 22 | |
| 23 #include "sky/engine/config.h" | |
| 24 #include "sky/engine/core/css/CSSMediaRule.h" | |
| 25 | |
| 26 #include "sky/engine/core/css/StyleRule.h" | |
| 27 #include "sky/engine/wtf/text/StringBuilder.h" | |
| 28 | |
| 29 namespace blink { | |
| 30 | |
| 31 CSSMediaRule::CSSMediaRule(StyleRuleMedia* mediaRule, CSSStyleSheet* parent) | |
| 32 : CSSGroupingRule(mediaRule, parent) | |
| 33 { | |
| 34 } | |
| 35 | |
| 36 CSSMediaRule::~CSSMediaRule() | |
| 37 { | |
| 38 #if !ENABLE(OILPAN) | |
| 39 if (m_mediaCSSOMWrapper) | |
| 40 m_mediaCSSOMWrapper->clearParentRule(); | |
| 41 #endif | |
| 42 } | |
| 43 | |
| 44 MediaQuerySet* CSSMediaRule::mediaQueries() const | |
| 45 { | |
| 46 return toStyleRuleMedia(m_groupRule.get())->mediaQueries(); | |
| 47 } | |
| 48 | |
| 49 String CSSMediaRule::cssText() const | |
| 50 { | |
| 51 StringBuilder result; | |
| 52 result.appendLiteral("@media "); | |
| 53 if (mediaQueries()) { | |
| 54 result.append(mediaQueries()->mediaText()); | |
| 55 result.append(' '); | |
| 56 } | |
| 57 result.appendLiteral("{ \n"); | |
| 58 appendCSSTextForItems(result); | |
| 59 result.append('}'); | |
| 60 return result.toString(); | |
| 61 } | |
| 62 | |
| 63 MediaList* CSSMediaRule::media() const | |
| 64 { | |
| 65 if (!mediaQueries()) | |
| 66 return 0; | |
| 67 if (!m_mediaCSSOMWrapper) | |
| 68 m_mediaCSSOMWrapper = MediaList::create(mediaQueries(), const_cast<CSSMe
diaRule*>(this)); | |
| 69 return m_mediaCSSOMWrapper.get(); | |
| 70 } | |
| 71 | |
| 72 void CSSMediaRule::reattach(StyleRuleBase* rule) | |
| 73 { | |
| 74 CSSGroupingRule::reattach(rule); | |
| 75 if (m_mediaCSSOMWrapper && mediaQueries()) | |
| 76 m_mediaCSSOMWrapper->reattach(mediaQueries()); | |
| 77 } | |
| 78 | |
| 79 } // namespace blink | |
| OLD | NEW |