Commit 9d077c6f authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Move StyleRuleCounterStyle to its own files

The class will become more complicated with counter text generation
algorithm included. Hence, this patch moves it into its own files for a
better file structure.

Bug: 687225
Change-Id: Id6bc85929bbf182c74e9eb9ceb85155b5e07fb52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2545488
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828659}
parent e8f664c6
...@@ -573,6 +573,8 @@ blink_core_sources_css = [ ...@@ -573,6 +573,8 @@ blink_core_sources_css = [
"style_recalc_root.h", "style_recalc_root.h",
"style_rule.cc", "style_rule.cc",
"style_rule.h", "style_rule.h",
"style_rule_counter_style.cc",
"style_rule_counter_style.h",
"style_rule_css_style_declaration.cc", "style_rule_css_style_declaration.cc",
"style_rule_css_style_declaration.h", "style_rule_css_style_declaration.h",
"style_rule_import.cc", "style_rule_import.cc",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "third_party/blink/renderer/core/css/css_counter_style_rule.h" #include "third_party/blink/renderer/core/css/css_counter_style_rule.h"
#include "third_party/blink/renderer/core/css/style_rule.h" #include "third_party/blink/renderer/core/css/style_rule_counter_style.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink { namespace blink {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "third_party/blink/renderer/core/css/parser/media_query_parser.h" #include "third_party/blink/renderer/core/css/parser/media_query_parser.h"
#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h"
#include "third_party/blink/renderer/core/css/property_registry.h" #include "third_party/blink/renderer/core/css/property_registry.h"
#include "third_party/blink/renderer/core/css/style_rule_counter_style.h"
#include "third_party/blink/renderer/core/css/style_rule_import.h" #include "third_party/blink/renderer/core/css/style_rule_import.h"
#include "third_party/blink/renderer/core/css/style_rule_keyframe.h" #include "third_party/blink/renderer/core/css/style_rule_keyframe.h"
#include "third_party/blink/renderer/core/css/style_rule_namespace.h" #include "third_party/blink/renderer/core/css/style_rule_namespace.h"
......
...@@ -27,6 +27,7 @@ class CSSParserTokenStream; ...@@ -27,6 +27,7 @@ class CSSParserTokenStream;
class StyleRule; class StyleRule;
class StyleRuleBase; class StyleRuleBase;
class StyleRuleCharset; class StyleRuleCharset;
class StyleRuleCounterStyle;
class StyleRuleFontFace; class StyleRuleFontFace;
class StyleRuleImport; class StyleRuleImport;
class StyleRuleKeyframe; class StyleRuleKeyframe;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "third_party/blink/renderer/core/css/css_scroll_timeline_rule.h" #include "third_party/blink/renderer/core/css/css_scroll_timeline_rule.h"
#include "third_party/blink/renderer/core/css/css_style_rule.h" #include "third_party/blink/renderer/core/css/css_style_rule.h"
#include "third_party/blink/renderer/core/css/css_supports_rule.h" #include "third_party/blink/renderer/core/css/css_supports_rule.h"
#include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/style_rule_counter_style.h"
#include "third_party/blink/renderer/core/css/style_rule_import.h" #include "third_party/blink/renderer/core/css/style_rule_import.h"
#include "third_party/blink/renderer/core/css/style_rule_keyframe.h" #include "third_party/blink/renderer/core/css/style_rule_keyframe.h"
#include "third_party/blink/renderer/core/css/style_rule_namespace.h" #include "third_party/blink/renderer/core/css/style_rule_namespace.h"
...@@ -498,41 +498,4 @@ void StyleRuleViewport::TraceAfterDispatch(blink::Visitor* visitor) const { ...@@ -498,41 +498,4 @@ void StyleRuleViewport::TraceAfterDispatch(blink::Visitor* visitor) const {
StyleRuleBase::TraceAfterDispatch(visitor); StyleRuleBase::TraceAfterDispatch(visitor);
} }
StyleRuleCounterStyle::StyleRuleCounterStyle(const AtomicString& name,
CSSPropertyValueSet* properties)
: StyleRuleBase(kCounterStyle),
name_(name),
system_(properties->GetPropertyCSSValue(CSSPropertyID::kSystem)),
negative_(properties->GetPropertyCSSValue(CSSPropertyID::kNegative)),
prefix_(properties->GetPropertyCSSValue(CSSPropertyID::kPrefix)),
suffix_(properties->GetPropertyCSSValue(CSSPropertyID::kSuffix)),
range_(properties->GetPropertyCSSValue(CSSPropertyID::kRange)),
pad_(properties->GetPropertyCSSValue(CSSPropertyID::kPad)),
fallback_(properties->GetPropertyCSSValue(CSSPropertyID::kFallback)),
symbols_(properties->GetPropertyCSSValue(CSSPropertyID::kSymbols)),
additive_symbols_(
properties->GetPropertyCSSValue(CSSPropertyID::kAdditiveSymbols)),
speak_as_(properties->GetPropertyCSSValue(CSSPropertyID::kSpeakAs)) {
DCHECK(properties);
}
StyleRuleCounterStyle::StyleRuleCounterStyle(const StyleRuleCounterStyle&) =
default;
StyleRuleCounterStyle::~StyleRuleCounterStyle() = default;
void StyleRuleCounterStyle::TraceAfterDispatch(blink::Visitor* visitor) const {
visitor->Trace(system_);
visitor->Trace(negative_);
visitor->Trace(prefix_);
visitor->Trace(suffix_);
visitor->Trace(range_);
visitor->Trace(pad_);
visitor->Trace(fallback_);
visitor->Trace(symbols_);
visitor->Trace(additive_symbols_);
visitor->Trace(speak_as_);
StyleRuleBase::TraceAfterDispatch(visitor);
}
} // namespace blink } // namespace blink
...@@ -346,63 +346,6 @@ class StyleRuleCharset : public StyleRuleBase { ...@@ -346,63 +346,6 @@ class StyleRuleCharset : public StyleRuleBase {
private: private:
}; };
class CORE_EXPORT StyleRuleCounterStyle : public StyleRuleBase {
public:
StyleRuleCounterStyle(const AtomicString&, CSSPropertyValueSet*);
StyleRuleCounterStyle(const StyleRuleCounterStyle&);
~StyleRuleCounterStyle();
AtomicString GetName() const { return name_; }
const CSSValue* GetSystem() const { return system_; }
const CSSValue* GetNegative() const { return negative_; }
const CSSValue* GetPrefix() const { return prefix_; }
const CSSValue* GetSuffix() const { return suffix_; }
const CSSValue* GetRange() const { return range_; }
const CSSValue* GetPad() const { return pad_; }
const CSSValue* GetFallback() const { return fallback_; }
const CSSValue* GetSymbols() const { return symbols_; }
const CSSValue* GetAdditiveSymbols() const { return additive_symbols_; }
const CSSValue* GetSpeakAs() const { return speak_as_; }
void SetName(const AtomicString& name) { name_ = name; }
void SetSystem(const CSSValue* system) { system_ = system; }
void SetNegative(const CSSValue* negative) { negative_ = negative; }
void SetPrefix(const CSSValue* prefix) { prefix_ = prefix; }
void SetSuffix(const CSSValue* suffix) { suffix_ = suffix; }
void SetRange(const CSSValue* range) { range_ = range; }
void SetPad(const CSSValue* pad) { pad_ = pad; }
void SetFallback(const CSSValue* fallback) { fallback_ = fallback; }
void SetSymbols(const CSSValue* symbols) { symbols_ = symbols; }
void SetAdditiveSymbols(const CSSValue* additive_symbols) {
additive_symbols_ = additive_symbols;
}
void SetSpeakAs(const CSSValue* speak_as) { speak_as_ = speak_as; }
bool HasFailedOrCanceledSubresources() const {
// TODO(crbug.com/687225): Implement.
return false;
}
StyleRuleCounterStyle* Copy() const {
return MakeGarbageCollected<StyleRuleCounterStyle>(*this);
}
void TraceAfterDispatch(blink::Visitor*) const;
private:
AtomicString name_;
Member<const CSSValue> system_;
Member<const CSSValue> negative_;
Member<const CSSValue> prefix_;
Member<const CSSValue> suffix_;
Member<const CSSValue> range_;
Member<const CSSValue> pad_;
Member<const CSSValue> fallback_;
Member<const CSSValue> symbols_;
Member<const CSSValue> additive_symbols_;
Member<const CSSValue> speak_as_;
};
template <> template <>
struct DowncastTraits<StyleRule> { struct DowncastTraits<StyleRule> {
static bool AllowFrom(const StyleRuleBase& rule) { static bool AllowFrom(const StyleRuleBase& rule) {
...@@ -464,13 +407,6 @@ struct DowncastTraits<StyleRuleCharset> { ...@@ -464,13 +407,6 @@ struct DowncastTraits<StyleRuleCharset> {
} }
}; };
template <>
struct DowncastTraits<StyleRuleCounterStyle> {
static bool AllowFrom(const StyleRuleBase& rule) {
return rule.IsCounterStyleRule();
}
};
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_RULE_H_ #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_RULE_H_
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/css/style_rule_counter_style.h"
#include "third_party/blink/renderer/core/css/css_counter_style_rule.h"
#include "third_party/blink/renderer/core/css/css_value_list.h"
namespace blink {
StyleRuleCounterStyle::StyleRuleCounterStyle(const AtomicString& name,
CSSPropertyValueSet* properties)
: StyleRuleBase(kCounterStyle),
name_(name),
system_(properties->GetPropertyCSSValue(CSSPropertyID::kSystem)),
negative_(properties->GetPropertyCSSValue(CSSPropertyID::kNegative)),
prefix_(properties->GetPropertyCSSValue(CSSPropertyID::kPrefix)),
suffix_(properties->GetPropertyCSSValue(CSSPropertyID::kSuffix)),
range_(properties->GetPropertyCSSValue(CSSPropertyID::kRange)),
pad_(properties->GetPropertyCSSValue(CSSPropertyID::kPad)),
fallback_(properties->GetPropertyCSSValue(CSSPropertyID::kFallback)),
symbols_(properties->GetPropertyCSSValue(CSSPropertyID::kSymbols)),
additive_symbols_(
properties->GetPropertyCSSValue(CSSPropertyID::kAdditiveSymbols)),
speak_as_(properties->GetPropertyCSSValue(CSSPropertyID::kSpeakAs)) {
DCHECK(properties);
}
StyleRuleCounterStyle::StyleRuleCounterStyle(const StyleRuleCounterStyle&) =
default;
StyleRuleCounterStyle::~StyleRuleCounterStyle() = default;
void StyleRuleCounterStyle::TraceAfterDispatch(blink::Visitor* visitor) const {
visitor->Trace(system_);
visitor->Trace(negative_);
visitor->Trace(prefix_);
visitor->Trace(suffix_);
visitor->Trace(range_);
visitor->Trace(pad_);
visitor->Trace(fallback_);
visitor->Trace(symbols_);
visitor->Trace(additive_symbols_);
visitor->Trace(speak_as_);
StyleRuleBase::TraceAfterDispatch(visitor);
}
} // namespace blink
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_RULE_COUNTER_STYLE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_RULE_COUNTER_STYLE_H_
#include "third_party/blink/renderer/core/css/style_rule.h"
namespace blink {
class CORE_EXPORT StyleRuleCounterStyle : public StyleRuleBase {
public:
StyleRuleCounterStyle(const AtomicString&, CSSPropertyValueSet*);
StyleRuleCounterStyle(const StyleRuleCounterStyle&);
~StyleRuleCounterStyle();
AtomicString GetName() const { return name_; }
const CSSValue* GetSystem() const { return system_; }
const CSSValue* GetNegative() const { return negative_; }
const CSSValue* GetPrefix() const { return prefix_; }
const CSSValue* GetSuffix() const { return suffix_; }
const CSSValue* GetRange() const { return range_; }
const CSSValue* GetPad() const { return pad_; }
const CSSValue* GetFallback() const { return fallback_; }
const CSSValue* GetSymbols() const { return symbols_; }
const CSSValue* GetAdditiveSymbols() const { return additive_symbols_; }
const CSSValue* GetSpeakAs() const { return speak_as_; }
void SetName(const AtomicString& name) { name_ = name; }
void SetSystem(const CSSValue* system) { system_ = system; }
void SetNegative(const CSSValue* negative) { negative_ = negative; }
void SetPrefix(const CSSValue* prefix) { prefix_ = prefix; }
void SetSuffix(const CSSValue* suffix) { suffix_ = suffix; }
void SetRange(const CSSValue* range) { range_ = range; }
void SetPad(const CSSValue* pad) { pad_ = pad; }
void SetFallback(const CSSValue* fallback) { fallback_ = fallback; }
void SetSymbols(const CSSValue* symbols) { symbols_ = symbols; }
void SetAdditiveSymbols(const CSSValue* additive_symbols) {
additive_symbols_ = additive_symbols;
}
void SetSpeakAs(const CSSValue* speak_as) { speak_as_ = speak_as; }
bool HasFailedOrCanceledSubresources() const {
// TODO(crbug.com/687225): Implement.
return false;
}
StyleRuleCounterStyle* Copy() const {
return MakeGarbageCollected<StyleRuleCounterStyle>(*this);
}
void TraceAfterDispatch(blink::Visitor*) const;
private:
AtomicString name_;
Member<const CSSValue> system_;
Member<const CSSValue> negative_;
Member<const CSSValue> prefix_;
Member<const CSSValue> suffix_;
Member<const CSSValue> range_;
Member<const CSSValue> pad_;
Member<const CSSValue> fallback_;
Member<const CSSValue> symbols_;
Member<const CSSValue> additive_symbols_;
Member<const CSSValue> speak_as_;
};
template <>
struct DowncastTraits<StyleRuleCounterStyle> {
static bool AllowFrom(const StyleRuleBase& rule) {
return rule.IsCounterStyleRule();
}
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_RULE_COUNTER_STYLE_H_
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "third_party/blink/renderer/core/css/parser/css_parser.h" #include "third_party/blink/renderer/core/css/parser/css_parser.h"
#include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/css/style_rule.h" #include "third_party/blink/renderer/core/css/style_rule.h"
#include "third_party/blink/renderer/core/css/style_rule_counter_style.h"
#include "third_party/blink/renderer/core/css/style_rule_import.h" #include "third_party/blink/renderer/core/css/style_rule_import.h"
#include "third_party/blink/renderer/core/css/style_rule_namespace.h" #include "third_party/blink/renderer/core/css/style_rule_namespace.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment