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

Unified Diff: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h

Issue 2539693002: Early-out from the prepaint tree walk (Closed)
Patch Set: Do not force subtree updates for all paint invalidation reasons, add todo to track paint offset cha… Created 4 years 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
Index: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
index cd4e15aebdc9120826e7be08d13577e73a36377e..2c765ba5c5502747a15b40e0b48fb9e75c4bbd17 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
@@ -20,6 +20,16 @@
namespace blink {
+enum PropertyWasCreated {
+ DidNotCreateProperty = false,
+ CreatedProperty = true
+};
+
+enum ExistingPropertyWasCleared {
+ DidNotClearExistingProperty = false,
+ ClearedExistingProperty = true
+};
+
// This class stores property tree related information associated with a
// LayoutObject.
// Currently there are two groups of information:
@@ -128,6 +138,7 @@ class CORE_EXPORT ObjectPaintProperties {
std::unique_ptr<PropertyTreeStateWithOffset> properties) {
m_localBorderBoxProperties = std::move(properties);
}
+ void clearLocalBorderBoxProperties() { m_localBorderBoxProperties = nullptr; }
// This is the complete set of property nodes and paint offset that can be
// used to paint the contents of this object. It is similar to
@@ -136,75 +147,86 @@ class CORE_EXPORT ObjectPaintProperties {
// invalidation.
ObjectPaintProperties::PropertyTreeStateWithOffset contentsProperties() const;
- void clearPaintOffsetTranslation() { m_paintOffsetTranslation = nullptr; }
- void clearTransform() { m_transform = nullptr; }
- void clearEffect() { m_effect = nullptr; }
- void clearCssClip() { m_cssClip = nullptr; }
- void clearCssClipFixedPosition() { m_cssClipFixedPosition = nullptr; }
- void clearInnerBorderRadiusClip() { m_innerBorderRadiusClip = nullptr; }
- void clearOverflowClip() { m_overflowClip = nullptr; }
- void clearLocalBorderBoxProperties() { m_localBorderBoxProperties = nullptr; }
- void clearPerspective() { m_perspective = nullptr; }
- void clearSvgLocalToBorderBoxTransform() {
- m_svgLocalToBorderBoxTransform = nullptr;
+ ExistingPropertyWasCleared clearPaintOffsetTranslation() {
+ return clear(m_paintOffsetTranslation);
+ }
+ ExistingPropertyWasCleared clearTransform() { return clear(m_transform); }
+ ExistingPropertyWasCleared clearEffect() { return clear(m_effect); }
+ ExistingPropertyWasCleared clearCssClip() { return clear(m_cssClip); }
+ ExistingPropertyWasCleared clearCssClipFixedPosition() {
+ return clear(m_cssClipFixedPosition);
+ }
+ ExistingPropertyWasCleared clearInnerBorderRadiusClip() {
+ return clear(m_innerBorderRadiusClip);
}
- void clearScrollTranslation() { m_scrollTranslation = nullptr; }
- void clearScrollbarPaintOffset() { m_scrollbarPaintOffset = nullptr; }
- void clearScroll() { m_scroll = nullptr; }
+ ExistingPropertyWasCleared clearOverflowClip() {
+ return clear(m_overflowClip);
+ }
+ ExistingPropertyWasCleared clearPerspective() { return clear(m_perspective); }
+ ExistingPropertyWasCleared clearSvgLocalToBorderBoxTransform() {
+ return clear(m_svgLocalToBorderBoxTransform);
+ }
+ ExistingPropertyWasCleared clearScrollTranslation() {
+ return clear(m_scrollTranslation);
+ }
+ ExistingPropertyWasCleared clearScrollbarPaintOffset() {
+ return clear(m_scrollbarPaintOffset);
+ }
+ ExistingPropertyWasCleared clearScroll() { return clear(m_scroll); }
template <typename... Args>
- void updatePaintOffsetTranslation(Args&&... args) {
- updateProperty(m_paintOffsetTranslation, std::forward<Args>(args)...);
+ PropertyWasCreated updatePaintOffsetTranslation(Args&&... args) {
+ return update(m_paintOffsetTranslation, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateTransform(Args&&... args) {
- updateProperty(m_transform, std::forward<Args>(args)...);
+ PropertyWasCreated updateTransform(Args&&... args) {
+ return update(m_transform, std::forward<Args>(args)...);
}
template <typename... Args>
- void updatePerspective(Args&&... args) {
- updateProperty(m_perspective, std::forward<Args>(args)...);
+ PropertyWasCreated updatePerspective(Args&&... args) {
+ return update(m_perspective, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateSvgLocalToBorderBoxTransform(Args&&... args) {
+ PropertyWasCreated updateSvgLocalToBorderBoxTransform(Args&&... args) {
DCHECK(!scrollTranslation()) << "SVG elements cannot scroll so there "
"should never be both a scroll translation "
"and an SVG local to border box transform.";
- updateProperty(m_svgLocalToBorderBoxTransform, std::forward<Args>(args)...);
+ return update(m_svgLocalToBorderBoxTransform, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateScrollTranslation(Args&&... args) {
+ PropertyWasCreated updateScrollTranslation(Args&&... args) {
DCHECK(!svgLocalToBorderBoxTransform())
<< "SVG elements cannot scroll so there should never be both a scroll "
"translation and an SVG local to border box transform.";
- updateProperty(m_scrollTranslation, std::forward<Args>(args)...);
+ return update(m_scrollTranslation, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateScrollbarPaintOffset(Args&&... args) {
- updateProperty(m_scrollbarPaintOffset, std::forward<Args>(args)...);
+ PropertyWasCreated updateScrollbarPaintOffset(Args&&... args) {
+ return update(m_scrollbarPaintOffset, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateScroll(Args&&... args) {
- updateProperty(m_scroll, std::forward<Args>(args)...);
+ PropertyWasCreated updateScroll(Args&&... args) {
+ return update(m_scroll, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateEffect(Args&&... args) {
- updateProperty(m_effect, std::forward<Args>(args)...);
+ PropertyWasCreated updateEffect(Args&&... args) {
+ return update(m_effect, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateCssClip(Args&&... args) {
- updateProperty(m_cssClip, std::forward<Args>(args)...);
+ PropertyWasCreated updateCssClip(Args&&... args) {
+ return update(m_cssClip, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateCssClipFixedPosition(Args&&... args) {
- updateProperty(m_cssClipFixedPosition, std::forward<Args>(args)...);
+ PropertyWasCreated updateCssClipFixedPosition(Args&&... args) {
+ return update(m_cssClipFixedPosition, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateInnerBorderRadiusClip(Args&&... args) {
- updateProperty(m_innerBorderRadiusClip, std::forward<Args>(args)...);
+ PropertyWasCreated updateInnerBorderRadiusClip(Args&&... args) {
+ return update(m_innerBorderRadiusClip, std::forward<Args>(args)...);
}
template <typename... Args>
- void updateOverflowClip(Args&&... args) {
- updateProperty(m_overflowClip, std::forward<Args>(args)...);
+ PropertyWasCreated updateOverflowClip(Args&&... args) {
+ return update(m_overflowClip, std::forward<Args>(args)...);
}
#if DCHECK_IS_ON()
@@ -253,11 +275,22 @@ class CORE_EXPORT ObjectPaintProperties {
ObjectPaintProperties() {}
template <typename PaintPropertyNode, typename... Args>
- void updateProperty(RefPtr<PaintPropertyNode>& field, Args&&... args) {
- if (field)
+ PropertyWasCreated update(RefPtr<PaintPropertyNode>& field, Args&&... args) {
+ if (field) {
field->update(std::forward<Args>(args)...);
- else
- field = PaintPropertyNode::create(std::forward<Args>(args)...);
+ return DidNotCreateProperty;
+ }
+ field = PaintPropertyNode::create(std::forward<Args>(args)...);
+ return CreatedProperty;
+ }
+
+ template <typename PaintPropertyNode>
+ ExistingPropertyWasCleared clear(RefPtr<PaintPropertyNode>& field) {
+ if (field) {
+ field = nullptr;
+ return ClearedExistingProperty;
+ }
+ return DidNotClearExistingProperty;
}
RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;

Powered by Google App Engine
This is Rietveld 408576698