Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Unified Diff: third_party/WebKit/Source/core/paint/RarePaintData.cpp

Issue 2812593003: Remove caching of contents paint properties (Closed)
Patch Set: Address reviewer comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/RarePaintData.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/RarePaintData.cpp
diff --git a/third_party/WebKit/Source/core/paint/RarePaintData.cpp b/third_party/WebKit/Source/core/paint/RarePaintData.cpp
index c22a5be3de67a9f18b5fd5d3386eaf4f906c9d96..d3591ae2e6577bdb404f54ad1d6b6ed8cbdb4a45 100644
--- a/third_party/WebKit/Source/core/paint/RarePaintData.cpp
+++ b/third_party/WebKit/Source/core/paint/RarePaintData.cpp
@@ -20,10 +20,6 @@ ObjectPaintProperties& RarePaintData::EnsurePaintProperties() {
void RarePaintData::ClearLocalBorderBoxProperties() {
local_border_box_properties_ = nullptr;
-
- // The contents properties are based on the border box so we need to clear
- // the cached value.
- contents_properties_ = nullptr;
}
void RarePaintData::SetLocalBorderBoxProperties(PropertyTreeState& state) {
@@ -31,28 +27,18 @@ void RarePaintData::SetLocalBorderBoxProperties(PropertyTreeState& state) {
local_border_box_properties_ = WTF::MakeUnique<PropertyTreeState>(state);
else
*local_border_box_properties_ = state;
-
- // The contents properties are based on the border box so we need to clear
- // the cached value.
- contents_properties_ = nullptr;
}
-static std::unique_ptr<PropertyTreeState> ComputeContentsProperties(
- PropertyTreeState* local_border_box_properties,
- ObjectPaintProperties* paint_properties) {
- if (!local_border_box_properties)
- return nullptr;
-
- std::unique_ptr<PropertyTreeState> contents =
- WTF::MakeUnique<PropertyTreeState>(*local_border_box_properties);
-
- if (paint_properties) {
- if (paint_properties->ScrollTranslation())
- contents->SetTransform(paint_properties->ScrollTranslation());
- if (paint_properties->OverflowClip())
- contents->SetClip(paint_properties->OverflowClip());
- else if (paint_properties->CssClip())
- contents->SetClip(paint_properties->CssClip());
+PropertyTreeState RarePaintData::ContentsProperties() const {
+ DCHECK(local_border_box_properties_);
+ PropertyTreeState contents(*local_border_box_properties_);
+ if (paint_properties_) {
+ if (paint_properties_->ScrollTranslation())
+ contents.SetTransform(paint_properties_->ScrollTranslation());
+ if (paint_properties_->OverflowClip())
+ contents.SetClip(paint_properties_->OverflowClip());
+ else if (paint_properties_->CssClip())
+ contents.SetClip(paint_properties_->CssClip());
}
// TODO(chrishtr): cssClipFixedPosition needs to be handled somehow.
@@ -60,25 +46,4 @@ static std::unique_ptr<PropertyTreeState> ComputeContentsProperties(
return contents;
}
-const PropertyTreeState* RarePaintData::ContentsProperties() const {
- if (!contents_properties_) {
- if (local_border_box_properties_) {
- contents_properties_ = ComputeContentsProperties(
- local_border_box_properties_.get(), paint_properties_.get());
- }
- } else {
-#if DCHECK_IS_ON()
- // Check that the cached contents properties are valid by checking that they
- // do not change if recalculated.
- DCHECK(local_border_box_properties_);
- std::unique_ptr<PropertyTreeState> old_properties =
- std::move(contents_properties_);
- contents_properties_ = ComputeContentsProperties(
- local_border_box_properties_.get(), paint_properties_.get());
- DCHECK(*contents_properties_ == *old_properties);
-#endif
- }
- return contents_properties_.get();
-}
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/RarePaintData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698