summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/layout_box_model_object.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/layout_box_model_object.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/layout/layout_box_model_object.cc59
1 files changed, 34 insertions, 25 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/layout_box_model_object.cc b/chromium/third_party/blink/renderer/core/layout/layout_box_model_object.cc
index 21782639cd2..e3b20800d32 100644
--- a/chromium/third_party/blink/renderer/core/layout/layout_box_model_object.cc
+++ b/chromium/third_party/blink/renderer/core/layout/layout_box_model_object.cc
@@ -29,6 +29,7 @@
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
+#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/html_body_element.h"
#include "third_party/blink/renderer/core/layout/geometry/transform_state.h"
#include "third_party/blink/renderer/core/layout/layout_block.h"
@@ -36,6 +37,8 @@
#include "third_party/blink/renderer/core/layout/layout_geometry_map.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
+#include "third_party/blink/renderer/core/layout/ng/ng_constraint_space.h"
+#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h"
#include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h"
#include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h"
#include "third_party/blink/renderer/core/paint/object_paint_invalidator.h"
@@ -85,10 +88,6 @@ void LayoutBoxModelObject::ContentChanged(ContentChangeType change_type) {
Layer()->ContentChanged(change_type);
}
-bool LayoutBoxModelObject::HasAcceleratedCompositing() const {
- return View()->Compositor()->HasAcceleratedCompositing();
-}
-
LayoutBoxModelObject::LayoutBoxModelObject(ContainerNode* node)
: LayoutObject(node) {}
@@ -97,9 +96,10 @@ bool LayoutBoxModelObject::UsesCompositedScrolling() const {
Layer()->GetScrollableArea()->UsesCompositedScrolling();
}
-BackgroundPaintLocation LayoutBoxModelObject::GetBackgroundPaintLocation(
+BackgroundPaintLocation
+LayoutBoxModelObject::ComputeBackgroundPaintLocationIfComposited(
uint32_t* main_thread_scrolling_reasons) const {
- bool may_have_scrolling_layers_without_scrolling = IsLayoutView();
+ bool may_have_scrolling_layers_without_scrolling = IsA<LayoutView>(this);
const auto* scrollable_area = GetScrollableArea();
bool scrolls_overflow = scrollable_area && scrollable_area->ScrollsOverflow();
if (!scrolls_overflow && !may_have_scrolling_layers_without_scrolling)
@@ -108,9 +108,8 @@ BackgroundPaintLocation LayoutBoxModelObject::GetBackgroundPaintLocation(
// If we care about LCD text, paint root backgrounds into scrolling contents
// layer even if style suggests otherwise. (For non-root scrollers, we just
// avoid compositing - see PLSA::ComputeNeedsCompositedScrolling.)
- if (IsLayoutView()) {
- DCHECK(Layer()->Compositor());
- if (!Layer()->Compositor()->PreferCompositingToLCDTextEnabled())
+ if (IsA<LayoutView>(this)) {
+ if (!GetDocument().GetSettings()->GetPreferCompositingToLCDTextEnabled())
return kBackgroundPaintInScrollingContents;
}
@@ -283,13 +282,9 @@ void LayoutBoxModelObject::StyleDidChange(StyleDifference diff,
// block/inline position.
// Position changes and other types of display changes are handled elsewhere.
if (old_style && IsOutOfFlowPositioned() && Parent() &&
- (Parent() != ContainingBlock()) &&
(StyleRef().GetPosition() == old_style->GetPosition()) &&
- (StyleRef().OriginalDisplay() != old_style->OriginalDisplay()) &&
- ((StyleRef().OriginalDisplay() == EDisplay::kBlock) ||
- (StyleRef().OriginalDisplay() == EDisplay::kInlineBlock)) &&
- ((old_style->OriginalDisplay() == EDisplay::kBlock) ||
- (old_style->OriginalDisplay() == EDisplay::kInlineBlock)))
+ (StyleRef().IsOriginalDisplayInlineType() !=
+ old_style->IsOriginalDisplayInlineType()))
Parent()->SetNeedsLayout(layout_invalidation_reason::kChildChanged,
kMarkContainerChain);
@@ -320,7 +315,7 @@ void LayoutBoxModelObject::StyleDidChange(StyleDifference diff,
if (EverHadLayout())
SetChildNeedsLayout();
if (had_transform_related_property) {
- SetNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
+ SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation(
layout_invalidation_reason::kStyleChange);
}
if (!NeedsLayout()) {
@@ -444,7 +439,6 @@ void LayoutBoxModelObject::StyleDidChange(StyleDifference diff,
// Remove sticky constraints for this layer.
if (Layer()) {
- DisableCompositingQueryAsserts disabler;
if (const PaintLayer* ancestor_overflow_layer =
Layer()->AncestorOverflowLayer()) {
if (PaintLayerScrollableArea* scrollable_area =
@@ -519,7 +513,6 @@ void LayoutBoxModelObject::InvalidateStickyConstraints() {
// This intentionally uses the stale ancestor overflow layer compositing input
// as if we have saved constraints for this layer they were saved in the
// previous frame.
- DisableCompositingQueryAsserts disabler;
if (const PaintLayer* ancestor_overflow_layer =
enclosing->AncestorOverflowLayer()) {
if (PaintLayerScrollableArea* ancestor_scrollable_area =
@@ -537,6 +530,8 @@ void LayoutBoxModelObject::CreateLayerAfterStyleChange() {
// Creating a layer may affect existence of the LocalBorderBoxProperties, so
// we need to ensure that we update paint properties.
SetNeedsPaintPropertyUpdate();
+ if (GetScrollableArea())
+ GetScrollableArea()->InvalidateScrollTimeline();
}
void LayoutBoxModelObject::DestroyLayer() {
@@ -546,6 +541,7 @@ void LayoutBoxModelObject::DestroyLayer() {
// Removing a layer may affect existence of the LocalBorderBoxProperties, so
// we need to ensure that we update paint properties.
SetNeedsPaintPropertyUpdate();
+ SetBackgroundPaintLocation(kBackgroundPaintInGraphicsLayer);
}
bool LayoutBoxModelObject::HasSelfPaintingLayer() const {
@@ -679,7 +675,7 @@ LayoutBlock* LayoutBoxModelObject::ContainingBlockForAutoHeightDetection(
// Match LayoutBox::availableLogicalHeightUsing by special casing the layout
// view. The available height is taken from the frame.
- if (cb->IsLayoutView())
+ if (IsA<LayoutView>(cb))
return nullptr;
if (IsOutOfFlowPositionedWithImplicitHeight(cb))
@@ -700,10 +696,17 @@ bool LayoutBoxModelObject::HasAutoHeightOrContainingBlockWithAutoHeight(
logical_height_length.IsPercentOrCalc() && cb && IsBox()) {
cb->AddPercentHeightDescendant(const_cast<LayoutBox*>(ToLayoutBox(this)));
}
- if (this_box && this_box->IsFlexItem()) {
- const LayoutFlexibleBox& flex_box = ToLayoutFlexibleBox(*Parent());
- if (flex_box.UseOverrideLogicalHeightForPerentageResolution(*this_box))
- return false;
+ if (this_box && this_box->IsFlexItemIncludingNG()) {
+ if (this_box->IsFlexItem()) {
+ const LayoutFlexibleBox& flex_box = ToLayoutFlexibleBox(*Parent());
+ if (flex_box.UseOverrideLogicalHeightForPerentageResolution(*this_box))
+ return false;
+ } else if (this_box->GetCachedLayoutResult()) {
+ const NGConstraintSpace& space =
+ this_box->GetCachedLayoutResult()->GetConstraintSpaceForCaching();
+ if (space.IsFixedBlockSize() && !space.IsFixedBlockSizeIndefinite())
+ return false;
+ }
}
if (this_box && this_box->IsGridItem() &&
this_box->HasOverrideContainingBlockContentLogicalHeight())
@@ -722,8 +725,14 @@ bool LayoutBoxModelObject::HasAutoHeightOrContainingBlockWithAutoHeight(
// resolve the block-size of the descendant, except when in quirks mode.
// Flexboxes follow strict behavior even in quirks mode, though.
if (!GetDocument().InQuirksMode() ||
- cb->IsFlexibleBoxIncludingDeprecatedAndNG())
+ cb->IsFlexibleBoxIncludingDeprecatedAndNG()) {
+ if (this_box &&
+ this_box->HasOverrideContainingBlockContentLogicalHeight()) {
+ return this_box->OverrideContainingBlockContentLogicalHeight() ==
+ LayoutUnit(-1);
+ }
return !cb->HasDefiniteLogicalHeight();
+ }
}
return false;
@@ -881,7 +890,7 @@ void LayoutBoxModelObject::UpdateStickyPositionConstraints() const {
ToLayoutBox(Layer()->AncestorOverflowLayer()->GetLayoutObject());
LayoutUnit max_container_width =
- containing_block->IsLayoutView()
+ IsA<LayoutView>(containing_block)
? containing_block->LogicalWidth()
: containing_block->ContainingBlockLogicalWidthForContent();
// Sticky positioned element ignore any override logical width on the