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,
}
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;
if (object.CanContainFixedPositionObjects()) {
SetIfHigher(layer_to_paint_overlay_scrollbars_after,
SetIfHigher(layer_to_paint_overlay_overflow_controls_after,
subtree_highest_layers->highest_fixed_position);
}
if (object.CanContainAbsolutePositionObjects()) {
SetIfHigher(layer_to_paint_overlay_scrollbars_after,
SetIfHigher(layer_to_paint_overlay_overflow_controls_after,
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_
.insert(layer_to_paint_overlay_scrollbars_after, PaintLayers())
.insert(layer_to_paint_overlay_overflow_controls_after, PaintLayers())
.stored_value->value.push_back(&paint_layer);
}
paint_layer.SetNeedsReorderOverlayOverflowControls(
!!layer_to_paint_overlay_scrollbars_after);
!!layer_to_paint_overlay_overflow_controls_after);
if (highest_layers)
highest_layers->Merge(*subtree_highest_layers);
......
......@@ -147,45 +147,45 @@ class CORE_EXPORT PaintLayerStackingNode {
// Holds descendants within our stacking context with negative z-indices.
PaintLayers neg_z_order_list_;
// Overlay scrollbars need to be painted above all scrollable contents, even
// if the contents are stacked in a stacking context which is an ancestor of
// the scrolling layer, for example:
// Overlay overflow controls(scrollbar or resizer) need to be painted above
// all child contents, even if the contents are stacked in a stacking context
// which is an ancestor of the scrolling or resizing layer, for example:
// <div id="stacking-context" style="opacity: 0.5">
// <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>
// </div>
// and
// <div id="stacking-context" style="opacity: 0.5">
// <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>
// </div>
//
// The paint order without reordering overlay scrollbars would be:
// The paint order without reordering overlay overflow controls would be:
// stacking-context
// / | \
// scroller child other
// target child other
// |
// overlay scrollbars
// where the overlay scrollbars would be painted incorrectly below |child|
// which is scrollable by |scroller|.
// overlay overflow controls
// where the overlay overflow controls would be painted incorrectly below
// |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:
// 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
// scrollbars which should paint after the given PaintLayer (the key of the
// map). The value of the map is a list of PaintLayers because there may be
// more than one scroller in the same stacking context with overlay
// scrollbars.
// overflow controls which should paint after the given PaintLayer (the key of
// the map). The value of the map is a list of PaintLayers because there may
// be more than one scrolling or resizing container in the same stacking
// context with overlay overflow controls.
HashMap<const PaintLayer*, PaintLayers>
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