Commit 765db872 authored by Jinfeng Ma's avatar Jinfeng Ma Committed by Commit Bot

Clean up PaintLayerStackingNode::layer_to_overlay_overflow_controls_painting_after_.

1. Update related comments.
2. Rename the local variable which may assign to this Vector.

Bug: 1006173
Change-Id: I5ff5c6b3c9e6b10504fe988480df879209be5f04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1921927Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716365}
parent 814b46a3
...@@ -230,23 +230,23 @@ void PaintLayerStackingNode::CollectLayers(PaintLayer& paint_layer, ...@@ -230,23 +230,23 @@ void PaintLayerStackingNode::CollectLayers(PaintLayer& paint_layer,
} }
if (has_overlay_overflow_controls) { if (has_overlay_overflow_controls) {
const PaintLayer* layer_to_paint_overlay_scrollbars_after = const PaintLayer* layer_to_paint_overlay_overflow_controls_after =
subtree_highest_layers->highest_in_flow_stacked; subtree_highest_layers->highest_in_flow_stacked;
if (object.CanContainFixedPositionObjects()) { if (object.CanContainFixedPositionObjects()) {
SetIfHigher(layer_to_paint_overlay_scrollbars_after, SetIfHigher(layer_to_paint_overlay_overflow_controls_after,
subtree_highest_layers->highest_fixed_position); subtree_highest_layers->highest_fixed_position);
} }
if (object.CanContainAbsolutePositionObjects()) { if (object.CanContainAbsolutePositionObjects()) {
SetIfHigher(layer_to_paint_overlay_scrollbars_after, SetIfHigher(layer_to_paint_overlay_overflow_controls_after,
subtree_highest_layers->highest_absolute_position); subtree_highest_layers->highest_absolute_position);
} }
if (layer_to_paint_overlay_scrollbars_after) { if (layer_to_paint_overlay_overflow_controls_after) {
layer_to_overlay_overflow_controls_painting_after_ layer_to_overlay_overflow_controls_painting_after_
.insert(layer_to_paint_overlay_scrollbars_after, PaintLayers()) .insert(layer_to_paint_overlay_overflow_controls_after, PaintLayers())
.stored_value->value.push_back(&paint_layer); .stored_value->value.push_back(&paint_layer);
} }
paint_layer.SetNeedsReorderOverlayOverflowControls( paint_layer.SetNeedsReorderOverlayOverflowControls(
!!layer_to_paint_overlay_scrollbars_after); !!layer_to_paint_overlay_overflow_controls_after);
if (highest_layers) if (highest_layers)
highest_layers->Merge(*subtree_highest_layers); highest_layers->Merge(*subtree_highest_layers);
......
...@@ -147,45 +147,45 @@ class CORE_EXPORT PaintLayerStackingNode { ...@@ -147,45 +147,45 @@ class CORE_EXPORT PaintLayerStackingNode {
// Holds descendants within our stacking context with negative z-indices. // Holds descendants within our stacking context with negative z-indices.
PaintLayers neg_z_order_list_; PaintLayers neg_z_order_list_;
// Overlay scrollbars need to be painted above all scrollable contents, even // Overlay overflow controls(scrollbar or resizer) need to be painted above
// if the contents are stacked in a stacking context which is an ancestor of // all child contents, even if the contents are stacked in a stacking context
// the scrolling layer, for example: // which is an ancestor of the scrolling or resizing layer, for example:
// <div id="stacking-context" style="opacity: 0.5"> // <div id="stacking-context" style="opacity: 0.5">
// <div id="other" style="position: relative; z-index: 10></div> // <div id="other" style="position: relative; z-index: 10></div>
// <div id="scroller" style="overflow: scroll"> // <div id="target" style="overflow: scroll; resize: both">
// <div id="child" style="position: relative">CHILD</div> // <div id="child" style="position: relative">CHILD</div>
// </div> // </div>
// </div> // </div>
// and // and
// <div id="stacking-context" style="opacity: 0.5"> // <div id="stacking-context" style="opacity: 0.5">
// <div id="other" style="position: relative; z-index: 10></div> // <div id="other" style="position: relative; z-index: 10></div>
// <div id="scroller" style="overflow: scroll; position: relative"> // <div id="target" style="overflow: scroll; position: relative">
// <div id="child" style="position: absolute; z-index: 5">CHILD</div> // <div id="child" style="position: absolute; z-index: 5">CHILD</div>
// </div> // </div>
// </div> // </div>
// //
// The paint order without reordering overlay scrollbars would be: // The paint order without reordering overlay overflow controls would be:
// stacking-context // stacking-context
// / | \ // / | \
// scroller child other // target child other
// | // |
// overlay scrollbars // overlay overflow controls
// where the overlay scrollbars would be painted incorrectly below |child| // where the overlay overflow controls would be painted incorrectly below
// which is scrollable by |scroller|. // |child| which is the sub content of |target|.
// //
// To paint the overlay scrollbars above all scrollable contents, we need to // To paint the overlay overflow controls above all child contents, we need to
// reorder the z-order of overlay scrollbars in the stacking context: // reorder the z-order of overlay scrollbars in the stacking context:
// stacking-context // stacking-context
// / | | \ // / | | \
// scroller child | other // target child | other
// | // |
// overlay scrollbars // overlay overflow controls
// //
// This map records which PaintLayers (the values of the map) have overlay // This map records which PaintLayers (the values of the map) have overlay
// scrollbars which should paint after the given PaintLayer (the key of the // overflow controls which should paint after the given PaintLayer (the key of
// map). The value of the map is a list of PaintLayers because there may be // the map). The value of the map is a list of PaintLayers because there may
// more than one scroller in the same stacking context with overlay // be more than one scrolling or resizing container in the same stacking
// scrollbars. // context with overlay overflow controls.
HashMap<const PaintLayer*, PaintLayers> HashMap<const PaintLayer*, PaintLayers>
layer_to_overlay_overflow_controls_painting_after_; layer_to_overlay_overflow_controls_painting_after_;
......
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