source: webkit/trunk/Source/WebCore/css/CSSMediaRule.cpp

Last change on this file was 291286, checked in by Antti Koivisto, 3 years ago

CSSConditionRule.conditionText should be readonly
https://bugs.webkit.org/show_bug.cgi?id=237880

Reviewed by Antoine Quint.

LayoutTests/imported/w3c:

  • web-platform-tests/interfaces/css-conditional.idl:

Source/WebCore:

Per CSSWG resolution https://github.com/w3c/csswg-drafts/issues/6819#issuecomment-1016695585

This also matches Blink.

  • css/CSSConditionRule.h:
  • css/CSSConditionRule.idl:
  • css/CSSMediaRule.cpp:

(WebCore::CSSMediaRule::setConditionText): Deleted.

  • css/CSSMediaRule.h:
  • css/CSSSupportsRule.cpp:

(WebCore::CSSSupportsRule::setConditionText): Deleted.

  • css/CSSSupportsRule.h:
  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1/**
2 * (C) 1999-2003 Lars Knoll ([email protected])
3 * (C) 2002-2003 Dirk Mueller ([email protected])
4 * Copyright (C) 2002-2020 Apple Inc.
5 * Copyright (C) 2006 Samuel Weinig ([email protected])
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 "config.h"
24#include "CSSMediaRule.h"
25
26#include "CSSStyleSheet.h"
27#include "MediaList.h"
28#include "StyleRule.h"
29#include <wtf/text/StringBuilder.h>
30
31namespace WebCore {
32
33CSSMediaRule::CSSMediaRule(StyleRuleMedia& mediaRule, CSSStyleSheet* parent)
34 : CSSConditionRule(mediaRule, parent)
35{
36}
37
38CSSMediaRule::~CSSMediaRule()
39{
40 if (m_mediaCSSOMWrapper)
41 m_mediaCSSOMWrapper->clearParentRule();
42}
43
44MediaQuerySet& CSSMediaRule::mediaQueries() const
45{
46 return downcast<StyleRuleMedia>(groupRule()).mediaQueries();
47}
48
49String CSSMediaRule::cssText() const
50{
51 StringBuilder result;
52 result.append("@media ", conditionText(), " {\n");
53 appendCSSTextForItems(result);
54 result.append('}');
55 return result.toString();
56}
57
58String CSSMediaRule::conditionText() const
59{
60 return mediaQueries().mediaText();
61}
62
63MediaList* CSSMediaRule::media() const
64{
65 if (!m_mediaCSSOMWrapper)
66 m_mediaCSSOMWrapper = MediaList::create(&mediaQueries(), const_cast<CSSMediaRule*>(this));
67 return m_mediaCSSOMWrapper.get();
68}
69
70void CSSMediaRule::reattach(StyleRuleBase& rule)
71{
72 CSSConditionRule::reattach(rule);
73 if (m_mediaCSSOMWrapper)
74 m_mediaCSSOMWrapper->reattach(&mediaQueries());
75}
76
77} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.