Commit 1b298605 authored by shend's avatar shend Committed by Commit bot

Remove references to inherited_data_ in ComputedStyle.

To allow changes to where fields are stored, ComputedStyle code should
not refer directly to a group, as that code will break when we change
groups. This patch removes references to inherited_data_ in ComputedStyle,
replacing with generated or handwritten getters. This patch does not
remove references within diffing functions as those will soon be
generated.

BUG=710938

Review-Url: https://codereview.chromium.org/2886293004
Cr-Commit-Position: refs/heads/master@{#473433}
parent da7e1a15
...@@ -1407,10 +1407,10 @@ void ComputedStyle::SetListStyleImage(StyleImage* v) { ...@@ -1407,10 +1407,10 @@ void ComputedStyle::SetListStyleImage(StyleImage* v) {
} }
Color ComputedStyle::GetColor() const { Color ComputedStyle::GetColor() const {
return inherited_data_->color_; return ColorInternal();
} }
void ComputedStyle::SetColor(const Color& v) { void ComputedStyle::SetColor(const Color& v) {
SET_VAR(inherited_data_, color_, v); SetColorInternal(v);
} }
FloatRoundedRect ComputedStyle::GetRoundedBorderFor( FloatRoundedRect ComputedStyle::GetRoundedBorderFor(
...@@ -1657,10 +1657,10 @@ CSSTransitionData& ComputedStyle::AccessTransitions() { ...@@ -1657,10 +1657,10 @@ CSSTransitionData& ComputedStyle::AccessTransitions() {
} }
const Font& ComputedStyle::GetFont() const { const Font& ComputedStyle::GetFont() const {
return inherited_data_->font_; return FontInternal();
} }
const FontDescription& ComputedStyle::GetFontDescription() const { const FontDescription& ComputedStyle::GetFontDescription() const {
return inherited_data_->font_.GetFontDescription(); return FontInternal().GetFontDescription();
} }
float ComputedStyle::SpecifiedFontSize() const { float ComputedStyle::SpecifiedFontSize() const {
return GetFontDescription().SpecifiedSize(); return GetFontDescription().SpecifiedSize();
...@@ -1853,15 +1853,15 @@ float ComputedStyle::LetterSpacing() const { ...@@ -1853,15 +1853,15 @@ float ComputedStyle::LetterSpacing() const {
} }
bool ComputedStyle::SetFontDescription(const FontDescription& v) { bool ComputedStyle::SetFontDescription(const FontDescription& v) {
if (inherited_data_->font_.GetFontDescription() != v) { if (FontInternal().GetFontDescription() != v) {
inherited_data_.Access()->font_ = Font(v); SetFontInternal(Font(v));
return true; return true;
} }
return false; return false;
} }
void ComputedStyle::SetFont(const Font& font) { void ComputedStyle::SetFont(const Font& font) {
inherited_data_.Access()->font_ = font; SetFontInternal(font);
} }
bool ComputedStyle::HasIdenticalAscentDescentAndLineGap( bool ComputedStyle::HasIdenticalAscentDescentAndLineGap(
...@@ -1874,10 +1874,10 @@ bool ComputedStyle::HasIdenticalAscentDescentAndLineGap( ...@@ -1874,10 +1874,10 @@ bool ComputedStyle::HasIdenticalAscentDescentAndLineGap(
} }
const Length& ComputedStyle::SpecifiedLineHeight() const { const Length& ComputedStyle::SpecifiedLineHeight() const {
return inherited_data_->line_height_; return LineHeightInternal();
} }
Length ComputedStyle::LineHeight() const { Length ComputedStyle::LineHeight() const {
const Length& lh = inherited_data_->line_height_; const Length& lh = LineHeightInternal();
// Unlike getFontDescription().computedSize() and hence fontSize(), this is // Unlike getFontDescription().computedSize() and hence fontSize(), this is
// recalculated on demand as we only store the specified line height. // recalculated on demand as we only store the specified line height.
// FIXME: Should consider scaling the fixed part of any calc expressions // FIXME: Should consider scaling the fixed part of any calc expressions
...@@ -1893,7 +1893,7 @@ Length ComputedStyle::LineHeight() const { ...@@ -1893,7 +1893,7 @@ Length ComputedStyle::LineHeight() const {
} }
void ComputedStyle::SetLineHeight(const Length& specified_line_height) { void ComputedStyle::SetLineHeight(const Length& specified_line_height) {
SET_VAR(inherited_data_, line_height_, specified_line_height); SetLineHeightInternal(specified_line_height);
} }
int ComputedStyle::ComputedLineHeight() const { int ComputedStyle::ComputedLineHeight() const {
...@@ -1941,7 +1941,7 @@ void ComputedStyle::SetLetterSpacing(float letter_spacing) { ...@@ -1941,7 +1941,7 @@ void ComputedStyle::SetLetterSpacing(float letter_spacing) {
} }
void ComputedStyle::SetTextAutosizingMultiplier(float multiplier) { void ComputedStyle::SetTextAutosizingMultiplier(float multiplier) {
SET_VAR(inherited_data_, text_autosizing_multiplier_, multiplier); SetTextAutosizingMultiplierInternal(multiplier);
float size = SpecifiedFontSize(); float size = SpecifiedFontSize();
......
...@@ -2209,7 +2209,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>, ...@@ -2209,7 +2209,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
} }
float TextAutosizingMultiplier() const { float TextAutosizingMultiplier() const {
return inherited_data_->text_autosizing_multiplier_; return TextAutosizingMultiplierInternal();
} }
void SetTextAutosizingMultiplier(float); void SetTextAutosizingMultiplier(float);
......
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