Commit f1b06666 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

[Squad] style_ in StyleResolverState is always mutable.

The style_ member of StyleResolverState is a ComputedStyle which is
being built. There's no reason to have a separate Mutable* method to
access it, we can always return it non-const.

Bug: 813068
Change-Id: I7282441f2cac2e37ace98d0ee0709baf1ec656ea
Reviewed-on: https://chromium-review.googlesource.com/1026682Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553517}
parent 89e8a790
......@@ -517,7 +517,7 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state,
Element* element) {
DCHECK(state.LayoutParentStyle());
DCHECK(state.ParentStyle());
ComputedStyle& style = state.MutableStyleRef();
ComputedStyle& style = state.StyleRef();
const ComputedStyle& parent_style = *state.ParentStyle();
const ComputedStyle& layout_parent_style = *state.LayoutParentStyle();
......
......@@ -780,7 +780,7 @@ scoped_refptr<AnimatableValue> StyleResolver::CreateAnimatableValueSnapshot(
StyleBuilder::ApplyProperty(property, state, *value);
state.GetFontBuilder().CreateFont(
state.GetDocument().GetStyleEngine().GetFontSelector(),
state.MutableStyleRef());
state.StyleRef());
}
return CSSAnimatableValueFactory::Create(property, *state.Style());
}
......@@ -1041,8 +1041,7 @@ scoped_refptr<ComputedStyle> StyleResolver::StyleForText(Text* text_node) {
void StyleResolver::UpdateFont(StyleResolverState& state) {
state.GetFontBuilder().CreateFont(
GetDocument().GetStyleEngine().GetFontSelector(),
state.MutableStyleRef());
GetDocument().GetStyleEngine().GetFontSelector(), state.StyleRef());
state.SetConversionFontSizes(CSSToLengthConversionData::FontSizes(
state.Style(), state.RootElementStyle()));
state.SetConversionZoom(state.Style()->EffectiveZoom());
......
......@@ -87,11 +87,12 @@ class CORE_EXPORT StyleResolverState {
void SetStyle(scoped_refptr<ComputedStyle>);
const ComputedStyle* Style() const { return style_.get(); }
ComputedStyle* Style() { return style_.get(); }
ComputedStyle& StyleRef() {
DCHECK(style_);
return *style_;
}
scoped_refptr<ComputedStyle> TakeStyle();
ComputedStyle& MutableStyleRef() const { return *style_; }
const ComputedStyle& StyleRef() const { return MutableStyleRef(); }
const CSSToLengthConversionData& CssToLengthConversionData() const {
return css_to_length_conversion_data_;
}
......
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