Commit 9bd653e8 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Remove CachedUAStyle

This is no longer used.

Change-Id: I26e9127cad8ff18c4c2ea66a6d2424d8b1b06b16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321412
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793066}
parent af80e9be
...@@ -1629,33 +1629,6 @@ void StyleResolver::CascadeAndApplyMatchedProperties(StyleResolverState& state, ...@@ -1629,33 +1629,6 @@ void StyleResolver::CascadeAndApplyMatchedProperties(StyleResolverState& state,
DCHECK(!state.GetFontBuilder().FontDirty()); DCHECK(!state.GetFontBuilder().FontDirty());
} }
bool StyleResolver::HasAuthorBackground(const StyleResolverState& state) {
const CachedUAStyle* cached_ua_style = state.GetCachedUAStyle();
if (!cached_ua_style)
return false;
FillLayer old_fill = cached_ua_style->background_layers;
FillLayer new_fill = state.Style()->BackgroundLayers();
// Exclude background-repeat from comparison by resetting it.
old_fill.SetRepeatX(EFillRepeat::kNoRepeatFill);
old_fill.SetRepeatY(EFillRepeat::kNoRepeatFill);
new_fill.SetRepeatX(EFillRepeat::kNoRepeatFill);
new_fill.SetRepeatY(EFillRepeat::kNoRepeatFill);
return (old_fill != new_fill || cached_ua_style->background_color !=
state.Style()->BackgroundColor());
}
bool StyleResolver::HasAuthorBorder(const StyleResolverState& state) {
const CachedUAStyle* cached_ua_style = state.GetCachedUAStyle();
return cached_ua_style &&
(cached_ua_style->border_image != state.Style()->BorderImage() ||
!cached_ua_style->BorderColorEquals(*state.Style()) ||
!cached_ua_style->BorderWidthEquals(*state.Style()) ||
!cached_ua_style->BorderRadiiEquals(*state.Style()) ||
!cached_ua_style->BorderStyleEquals(*state.Style()));
}
void StyleResolver::ApplyCallbackSelectors(StyleResolverState& state) { void StyleResolver::ApplyCallbackSelectors(StyleResolverState& state) {
RuleSet* watched_selectors_rule_set = RuleSet* watched_selectors_rule_set =
GetDocument().GetStyleEngine().WatchedSelectorsRuleSet(); GetDocument().GetStyleEngine().WatchedSelectorsRuleSet();
......
...@@ -134,8 +134,6 @@ class CORE_EXPORT StyleResolver final : public GarbageCollected<StyleResolver> { ...@@ -134,8 +134,6 @@ class CORE_EXPORT StyleResolver final : public GarbageCollected<StyleResolver> {
void SetRuleUsageTracker(StyleRuleUsageTracker*); void SetRuleUsageTracker(StyleRuleUsageTracker*);
void UpdateMediaType(); void UpdateMediaType();
static bool HasAuthorBackground(const StyleResolverState&);
static bool CanReuseBaseComputedStyle(const StyleResolverState& state); static bool CanReuseBaseComputedStyle(const StyleResolverState& state);
scoped_refptr<ComputedStyle> StyleForInterpolations( scoped_refptr<ComputedStyle> StyleForInterpolations(
...@@ -242,7 +240,6 @@ class CORE_EXPORT StyleResolver final : public GarbageCollected<StyleResolver> { ...@@ -242,7 +240,6 @@ class CORE_EXPORT StyleResolver final : public GarbageCollected<StyleResolver> {
void ApplyCallbackSelectors(StyleResolverState&); void ApplyCallbackSelectors(StyleResolverState&);
bool HasAuthorBorder(const StyleResolverState&);
Document& GetDocument() const { return *document_; } Document& GetDocument() const { return *document_; }
bool WasViewportResized() const { return was_viewport_resized_; } bool WasViewportResized() const { return was_viewport_resized_; }
......
...@@ -147,15 +147,6 @@ void StyleResolverState::SetLayoutParentStyle( ...@@ -147,15 +147,6 @@ void StyleResolverState::SetLayoutParentStyle(
layout_parent_style_ = std::move(parent_style); layout_parent_style_ = std::move(parent_style);
} }
void StyleResolverState::CacheUserAgentBorderAndBackground() {
// LayoutTheme only needs the cached style if it has an appearance,
// and constructing it is expensive so we avoid it if possible.
if (!Style()->HasAppearance())
return;
cached_ua_style_ = std::make_unique<CachedUAStyle>(Style());
}
void StyleResolverState::LoadPendingResources() { void StyleResolverState::LoadPendingResources() {
if (pseudo_request_type_ == PseudoElementStyleRequest::kForComputedStyle || if (pseudo_request_type_ == PseudoElementStyleRequest::kForComputedStyle ||
(ParentStyle() && ParentStyle()->IsEnsuredInDisplayNone()) || (ParentStyle() && ParentStyle()->IsEnsuredInDisplayNone()) ||
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "third_party/blink/renderer/core/css/resolver/font_builder.h" #include "third_party/blink/renderer/core/css/resolver/font_builder.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/style/cached_ua_style.h"
namespace blink { namespace blink {
...@@ -136,12 +135,6 @@ class CORE_EXPORT StyleResolverState { ...@@ -136,12 +135,6 @@ class CORE_EXPORT StyleResolverState {
return layout_parent_style_.get(); return layout_parent_style_.get();
} }
void CacheUserAgentBorderAndBackground();
const CachedUAStyle* GetCachedUAStyle() const {
return cached_ua_style_.get();
}
ElementStyleResources& GetElementStyleResources() { ElementStyleResources& GetElementStyleResources() {
return element_style_resources_; return element_style_resources_;
} }
...@@ -269,8 +262,6 @@ class CORE_EXPORT StyleResolverState { ...@@ -269,8 +262,6 @@ class CORE_EXPORT StyleResolverState {
FontBuilder font_builder_; FontBuilder font_builder_;
std::unique_ptr<CachedUAStyle> cached_ua_style_;
ElementStyleResources element_style_resources_; ElementStyleResources element_style_resources_;
Element* pseudo_element_; Element* pseudo_element_;
AnimatingElementType animating_element_type_; AnimatingElementType animating_element_type_;
......
...@@ -19,8 +19,6 @@ blink_core_sources("rendering") { ...@@ -19,8 +19,6 @@ blink_core_sources("rendering") {
"border_image_length_box.h", "border_image_length_box.h",
"border_style.h", "border_style.h",
"border_value.h", "border_value.h",
"cached_ua_style.cc",
"cached_ua_style.h",
"clip_path_operation.h", "clip_path_operation.h",
"computed_style.cc", "computed_style.cc",
"computed_style.h", "computed_style.h",
......
// Copyright 2017 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/style/cached_ua_style.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
namespace blink {
bool CachedUAStyle::BorderColorEquals(const ComputedStyle& other) const {
return (border_left_color == other.BorderLeftColorInternal() &&
border_right_color == other.BorderRightColorInternal() &&
border_top_color == other.BorderTopColorInternal() &&
border_bottom_color == other.BorderBottomColorInternal());
}
bool CachedUAStyle::BorderWidthEquals(const ComputedStyle& other) const {
return (border_left_width == other.BorderLeftWidth() &&
border_right_width == other.BorderRightWidth() &&
border_top_width == other.BorderTopWidth() &&
border_bottom_width == other.BorderBottomWidth());
}
bool CachedUAStyle::BorderRadiiEquals(const ComputedStyle& other) const {
return top_left_ == other.BorderTopLeftRadius() &&
top_right_ == other.BorderTopRightRadius() &&
bottom_left_ == other.BorderBottomLeftRadius() &&
bottom_right_ == other.BorderBottomRightRadius();
}
bool CachedUAStyle::BorderStyleEquals(const ComputedStyle& other) const {
return (
border_left_style == static_cast<unsigned>(other.BorderLeftStyle()) &&
border_right_style == static_cast<unsigned>(other.BorderRightStyle()) &&
border_top_style == static_cast<unsigned>(other.BorderTopStyle()) &&
border_bottom_style == static_cast<unsigned>(other.BorderBottomStyle()));
}
CachedUAStyle::CachedUAStyle(const ComputedStyle* style)
: top_left_(style->BorderTopLeftRadius()),
top_right_(style->BorderTopRightRadius()),
bottom_left_(style->BorderBottomLeftRadius()),
bottom_right_(style->BorderBottomRightRadius()),
border_left_color(style->BorderLeftColorInternal()),
border_right_color(style->BorderRightColorInternal()),
border_top_color(style->BorderTopColorInternal()),
border_bottom_color(style->BorderBottomColorInternal()),
border_left_style(static_cast<unsigned>(style->BorderLeftStyle())),
border_right_style(static_cast<unsigned>(style->BorderRightStyle())),
border_top_style(static_cast<unsigned>(style->BorderTopStyle())),
border_bottom_style(static_cast<unsigned>(style->BorderBottomStyle())),
border_left_width(style->BorderLeftWidth()),
border_right_width(style->BorderRightWidth()),
border_top_width(style->BorderTopWidth()),
border_bottom_width(style->BorderBottomWidth()),
border_image(style->BorderImage()),
background_layers(style->BackgroundLayers()),
background_color(style->BackgroundColor()) {}
} // namespace blink
/*
* Copyright (C) 2013 Google, Inc.
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_CACHED_UA_STYLE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_CACHED_UA_STYLE_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "third_party/blink/renderer/core/css/style_color.h"
#include "third_party/blink/renderer/core/style/fill_layer.h"
#include "third_party/blink/renderer/core/style/nine_piece_image.h"
#include "third_party/blink/renderer/platform/geometry/length_size.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
namespace blink {
class ComputedStyle;
// LayoutTheme::AdjustStyle wants the background and borders
// as specified by the UA sheets, excluding any author rules.
// We use this class to cache those values during
// ApplyMatchedProperties for later use during AdjustComputedStyle.
class CachedUAStyle {
USING_FAST_MALLOC(CachedUAStyle);
friend class ComputedStyle;
public:
explicit CachedUAStyle(const ComputedStyle*);
bool BorderColorEquals(const ComputedStyle& other) const;
bool BorderWidthEquals(const ComputedStyle& other) const;
bool BorderRadiiEquals(const ComputedStyle& other) const;
bool BorderStyleEquals(const ComputedStyle& other) const;
LengthSize top_left_;
LengthSize top_right_;
LengthSize bottom_left_;
LengthSize bottom_right_;
StyleColor border_left_color;
StyleColor border_right_color;
StyleColor border_top_color;
StyleColor border_bottom_color;
unsigned border_left_style : 4; // EBorderStyle
unsigned border_right_style : 4; // EBorderStyle
unsigned border_top_style : 4; // EBorderStyle
unsigned border_bottom_style : 4; // EBorderStyle
float border_left_width;
float border_right_width;
float border_top_width;
float border_bottom_width;
NinePieceImage border_image;
FillLayer background_layers;
StyleColor background_color;
private:
DISALLOW_COPY_AND_ASSIGN(CachedUAStyle);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_CACHED_UA_STYLE_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