Commit bf42a117 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[CI] Use context painting_layer instead of object.PaintingLayer()

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I04bdf03c290f51cd349ffdc921e85d7996ed1759
Reviewed-on: https://chromium-review.googlesource.com/896027Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533598}
parent e68552a5
...@@ -308,6 +308,7 @@ class FragmentPaintPropertyTreeBuilder { ...@@ -308,6 +308,7 @@ class FragmentPaintPropertyTreeBuilder {
ALWAYS_INLINE void UpdatePaintOffset(); ALWAYS_INLINE void UpdatePaintOffset();
ALWAYS_INLINE void UpdateForPaintOffsetTranslation(Optional<IntPoint>&); ALWAYS_INLINE void UpdateForPaintOffsetTranslation(Optional<IntPoint>&);
ALWAYS_INLINE void UpdatePaintOffsetTranslation(const Optional<IntPoint>&); ALWAYS_INLINE void UpdatePaintOffsetTranslation(const Optional<IntPoint>&);
ALWAYS_INLINE void SetNeedsPaintPropertyUpdateIfNeeded();
ALWAYS_INLINE void UpdateForObjectLocationAndSize( ALWAYS_INLINE void UpdateForObjectLocationAndSize(
Optional<IntPoint>& paint_offset_translation); Optional<IntPoint>& paint_offset_translation);
ALWAYS_INLINE void UpdateTransform(); ALWAYS_INLINE void UpdateTransform();
...@@ -943,11 +944,6 @@ static bool NeedsInnerBorderRadiusClip(const LayoutObject& object) { ...@@ -943,11 +944,6 @@ static bool NeedsInnerBorderRadiusClip(const LayoutObject& object) {
return false; return false;
} }
static bool NeedsControlClipFragmentationAdjustment(const LayoutBox& box) {
return box.HasControlClip() && !box.Layer() &&
box.PaintingLayer()->EnclosingPaginationLayer();
}
static LayoutPoint VisualOffsetFromPaintOffsetRoot( static LayoutPoint VisualOffsetFromPaintOffsetRoot(
const PaintPropertyTreeBuilderFragmentContext& context, const PaintPropertyTreeBuilderFragmentContext& context,
const PaintLayer* child) { const PaintLayer* child) {
...@@ -1522,29 +1518,30 @@ void FragmentPaintPropertyTreeBuilder::UpdatePaintOffset() { ...@@ -1522,29 +1518,30 @@ void FragmentPaintPropertyTreeBuilder::UpdatePaintOffset() {
} }
} }
static void SetNeedsPaintPropertyUpdateIfNeeded(const LayoutObject& object) { void FragmentPaintPropertyTreeBuilder::SetNeedsPaintPropertyUpdateIfNeeded() {
if (!object.IsBoxModelObject()) if (!object_.IsBoxModelObject())
return; return;
const LayoutBoxModelObject& box_model_object = ToLayoutBoxModelObject(object); const auto& box_model_object = ToLayoutBoxModelObject(object_);
if (box_model_object.Layer() && if (box_model_object.Layer() &&
box_model_object.Layer()->ShouldFragmentCompositedBounds()) { box_model_object.Layer()->ShouldFragmentCompositedBounds()) {
// Always force-update properties for fragmented content. // Always force-update properties for fragmented content.
// TODO(chrishtr): find ways to optimize this in the future. // TODO(chrishtr): find ways to optimize this in the future.
// It may suffice to compare previous and current visual overflow, // It may suffice to compare previous and current visual overflow,
// but we do not currenly cache that on the LayoutObject or PaintLayer. // but we do not currenly cache that on the LayoutObject or PaintLayer.
object.GetMutableForPainting().SetNeedsPaintPropertyUpdate(); object_.GetMutableForPainting().SetNeedsPaintPropertyUpdate();
return; return;
} }
if (!object.IsBox()) if (!object_.IsBox())
return; return;
const LayoutBox& box = ToLayoutBox(object); const LayoutBox& box = ToLayoutBox(object_);
// Always force-update properties for fragmented content. Boxes with // Always force-update properties for fragmented content. Boxes with
// control clip have a fragment-aware offset. // control clip have a fragment-aware offset.
if (NeedsControlClipFragmentationAdjustment(box)) { if (box.HasControlClip() && !box.Layer() &&
full_context_.painting_layer->EnclosingPaginationLayer()) {
box.GetMutableForPainting().SetNeedsPaintPropertyUpdate(); box.GetMutableForPainting().SetNeedsPaintPropertyUpdate();
return; return;
} }
...@@ -1605,7 +1602,7 @@ void FragmentPaintPropertyTreeBuilder::UpdateForObjectLocationAndSize( ...@@ -1605,7 +1602,7 @@ void FragmentPaintPropertyTreeBuilder::UpdateForObjectLocationAndSize(
if (paint_offset_translation) if (paint_offset_translation)
context_.current.paint_offset_root = &ToLayoutBoxModelObject(object_); context_.current.paint_offset_root = &ToLayoutBoxModelObject(object_);
SetNeedsPaintPropertyUpdateIfNeeded(object_); SetNeedsPaintPropertyUpdateIfNeeded();
} }
void FragmentPaintPropertyTreeBuilder::UpdateForSelf() { void FragmentPaintPropertyTreeBuilder::UpdateForSelf() {
...@@ -2010,10 +2007,9 @@ void ObjectPaintPropertyTreeBuilder::UpdateFragments() { ...@@ -2010,10 +2007,9 @@ void ObjectPaintPropertyTreeBuilder::UpdateFragments() {
UpdateRepeatingPaintOffsetAdjustment(); UpdateRepeatingPaintOffsetAdjustment();
} }
static inline bool ObjectTypeMightNeedPaintProperties( bool ObjectPaintPropertyTreeBuilder::ObjectTypeMightNeedPaintProperties() {
const LayoutObject& object) { return object_.IsBoxModelObject() || object_.IsSVG() ||
return object.IsBoxModelObject() || object.IsSVG() || context_.painting_layer->EnclosingPaginationLayer();
object.PaintingLayer()->EnclosingPaginationLayer();
} }
void ObjectPaintPropertyTreeBuilder::UpdatePaintingLayer() { void ObjectPaintPropertyTreeBuilder::UpdatePaintingLayer() {
...@@ -2035,7 +2031,7 @@ void ObjectPaintPropertyTreeBuilder::UpdatePaintingLayer() { ...@@ -2035,7 +2031,7 @@ void ObjectPaintPropertyTreeBuilder::UpdatePaintingLayer() {
void ObjectPaintPropertyTreeBuilder::UpdateForSelf() { void ObjectPaintPropertyTreeBuilder::UpdateForSelf() {
UpdatePaintingLayer(); UpdatePaintingLayer();
if (ObjectTypeMightNeedPaintProperties(object_)) if (ObjectTypeMightNeedPaintProperties())
UpdateFragments(); UpdateFragments();
else else
object_.GetMutableForPainting().FirstFragment().ClearNextFragment(); object_.GetMutableForPainting().FirstFragment().ClearNextFragment();
...@@ -2057,7 +2053,7 @@ void ObjectPaintPropertyTreeBuilder::UpdateForSelf() { ...@@ -2057,7 +2053,7 @@ void ObjectPaintPropertyTreeBuilder::UpdateForSelf() {
} }
void ObjectPaintPropertyTreeBuilder::UpdateForChildren() { void ObjectPaintPropertyTreeBuilder::UpdateForChildren() {
if (!ObjectTypeMightNeedPaintProperties(object_)) if (!ObjectTypeMightNeedPaintProperties())
return; return;
bool property_added_or_removed = false; bool property_added_or_removed = false;
......
...@@ -182,6 +182,7 @@ class ObjectPaintPropertyTreeBuilder { ...@@ -182,6 +182,7 @@ class ObjectPaintPropertyTreeBuilder {
ALWAYS_INLINE void InitFragmentPaintProperties(FragmentData&, ALWAYS_INLINE void InitFragmentPaintProperties(FragmentData&,
bool needs_paint_properties); bool needs_paint_properties);
ALWAYS_INLINE void InitSingleFragmentFromParent(bool needs_paint_properties); ALWAYS_INLINE void InitSingleFragmentFromParent(bool needs_paint_properties);
ALWAYS_INLINE bool ObjectTypeMightNeedPaintProperties();
ALWAYS_INLINE void UpdateCompositedLayerPaginationOffset(); ALWAYS_INLINE void UpdateCompositedLayerPaginationOffset();
ALWAYS_INLINE void UpdateFragments(); ALWAYS_INLINE void UpdateFragments();
ALWAYS_INLINE void UpdatePaintingLayer(); ALWAYS_INLINE void UpdatePaintingLayer();
......
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