Skip to content

Commit

Permalink
[RemoveLegacy] Remove unused functions in LayoutBox.
Browse files Browse the repository at this point in the history
As above - there should be no behaviour change.

Bug: 1229581
Change-Id: I5e54b153f734fc1f8e009b896cd87dac4970293f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4595496
Reviewed-by: David Grogan <dgrogan@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1153958}
  • Loading branch information
bfgeek authored and Chromium LUCI CQ committed Jun 6, 2023
1 parent c5ab860 commit dda829d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 155 deletions.
116 changes: 0 additions & 116 deletions third_party/blink/renderer/core/layout/layout_box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2781,37 +2781,6 @@ LayoutUnit LayoutBox::ContainingBlockLogicalHeightForContent(
return cb->AvailableLogicalHeight(height_type);
}

LayoutUnit LayoutBox::PerpendicularContainingBlockLogicalHeight() const {
NOT_DESTROYED();
if (HasOverrideContainingBlockContentLogicalHeight())
return OverrideContainingBlockContentLogicalHeight();

LayoutBlock* cb = ContainingBlock();
if (cb->HasOverrideLogicalHeight())
return cb->OverrideContentLogicalHeight();

const ComputedStyle& containing_block_style = cb->StyleRef();
const Length& logical_height_length = containing_block_style.LogicalHeight();

// FIXME: For now just support fixed heights. Eventually should support
// percentage heights as well.
if (!logical_height_length.IsFixed()) {
LayoutUnit fill_fallback_extent =
LayoutUnit(containing_block_style.IsHorizontalWritingMode()
? View()->GetFrameView()->Size().height()
: View()->GetFrameView()->Size().width());
LayoutUnit fill_available_extent =
ContainingBlock()->AvailableLogicalHeight(kExcludeMarginBorderPadding);
if (fill_available_extent == -1)
return fill_fallback_extent;
return std::min(fill_available_extent, fill_fallback_extent);
}

// Use the content box logical height as specified by the style.
return cb->AdjustContentBoxLogicalHeightForBoxSizing(
LayoutUnit(logical_height_length.Value()));
}

PhysicalOffset LayoutBox::OffsetFromContainerInternal(
const LayoutObject* o,
bool ignore_scroll_offset) const {
Expand Down Expand Up @@ -4157,91 +4126,6 @@ LayoutUnit LayoutBox::ContainingBlockLogicalHeightForPositioned(
return height_result;
}

static LayoutUnit AccumulateStaticOffsetForFlowThread(
LayoutBox& layout_box,
LayoutUnit inline_position,
LayoutUnit& block_position) {
block_position += layout_box.LogicalTop();
if (!layout_box.IsLayoutFlowThread())
return LayoutUnit();
LayoutUnit previous_inline_position = inline_position;
// We're walking out of a flowthread here. This flow thread is not in the
// containing block chain, so we need to convert the position from the
// coordinate space of this flowthread to the containing coordinate space.
To<LayoutFlowThread>(layout_box)
.FlowThreadToContainingCoordinateSpace(block_position, inline_position);
return inline_position - previous_inline_position;
}

void LayoutBox::ComputeInlineStaticDistance(
Length& logical_left,
Length& logical_right,
const LayoutBox* child,
const LayoutBoxModelObject* container_block,
LayoutUnit container_logical_width,
const NGBoxFragmentBuilder* fragment_builder) {
if (!logical_left.IsAuto() || !logical_right.IsAuto())
return;

LayoutObject* parent = child->Parent();
TextDirection parent_direction = parent->StyleRef().Direction();

// For multicol we also need to keep track of the block position, since that
// determines which column we're in and thus affects the inline position.
LayoutUnit static_block_position = child->Layer()->StaticBlockPosition();

// FIXME: The static distance computation has not been patched for mixed
// writing modes yet.
if (parent_direction == TextDirection::kLtr) {
LayoutUnit static_position = child->Layer()->StaticInlinePosition() -
container_block->BorderLogicalLeft();
for (LayoutObject* curr = child->Parent(); curr && curr != container_block;
curr = curr->Container()) {
if (auto* box = DynamicTo<LayoutBox>(curr)) {
static_position +=
(fragment_builder &&
fragment_builder->GetLayoutObject() == curr->Parent())
? fragment_builder->GetChildOffset(curr).inline_offset
: box->LogicalLeft();
if (curr->IsInsideFlowThread()) {
static_position += AccumulateStaticOffsetForFlowThread(
*box, static_position, static_block_position);
}
}
}
logical_left = Length::Fixed(static_position);
} else {
LayoutBox* enclosing_box = child->Parent()->EnclosingBox();
LayoutUnit static_position = child->Layer()->StaticInlinePosition() +
container_logical_width +
container_block->BorderLogicalLeft();
if (container_block->IsBox()) {
static_position +=
To<LayoutBox>(container_block)->LogicalLeftScrollbarWidth();
}
for (LayoutObject* curr = child->Parent(); curr; curr = curr->Container()) {
if (auto* box = DynamicTo<LayoutBox>(curr)) {
if (curr == enclosing_box)
static_position -= enclosing_box->LogicalWidth();
if (curr != container_block) {
static_position -=
(fragment_builder &&
fragment_builder->GetLayoutObject() == curr->Parent())
? fragment_builder->GetChildOffset(curr).inline_offset
: box->LogicalLeft();
if (curr->IsInsideFlowThread()) {
static_position -= AccumulateStaticOffsetForFlowThread(
*box, static_position, static_block_position);
}
}
}
if (curr == container_block)
break;
}
logical_right = Length::Fixed(static_position);
}
}

void LayoutBox::ComputeBlockStaticDistance(
Length& logical_top,
Length& logical_bottom,
Expand Down
35 changes: 0 additions & 35 deletions third_party/blink/renderer/core/layout/layout_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,16 +699,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {

bool UsesOverlayScrollbars() const;

// Clamps the left scrollbar size so it is not wider than the content box.
DISABLE_CFI_PERF LayoutUnit LogicalLeftScrollbarWidth() const {
NOT_DESTROYED();
if (CanSkipComputeScrollbars())
return LayoutUnit();
else if (StyleRef().IsHorizontalWritingMode())
return ComputeScrollbarsInternal(kClampToContentBox).left;
else
return ComputeScrollbarsInternal(kClampToContentBox).top;
}
DISABLE_CFI_PERF LayoutUnit LogicalTopScrollbarHeight() const {
NOT_DESTROYED();
if (CanSkipComputeScrollbars())
Expand Down Expand Up @@ -753,10 +743,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
NOT_DESTROYED();
return IsHorizontalWritingMode() ? ClientHeight() : ClientWidth();
}
DISABLE_CFI_PERF LayoutUnit ClientLogicalBottom() const {
NOT_DESTROYED();
return BorderBefore() + LogicalTopScrollbarHeight() + ClientLogicalHeight();
}

// TODO(crbug.com/962299): This is incorrect in some cases.
int PixelSnappedClientWidth() const;
Expand Down Expand Up @@ -1120,8 +1106,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
LayoutUnit ContainingBlockLogicalHeightForContent(
AvailableLogicalHeightType) const;

LayoutUnit PerpendicularContainingBlockLogicalHeight() const;

virtual void ComputeLogicalHeight(LayoutUnit logical_height,
LayoutUnit logical_top,
LogicalExtentComputedValues&) const;
Expand Down Expand Up @@ -1781,13 +1765,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
const LayoutBox* child,
const LayoutBoxModelObject* container_block,
const NGBoxFragmentBuilder* = nullptr);
static void ComputeInlineStaticDistance(
Length& logical_left,
Length& logical_right,
const LayoutBox* child,
const LayoutBoxModelObject* container_block,
LayoutUnit container_logical_width,
const NGBoxFragmentBuilder* = nullptr);
static void ComputeLogicalTopPositionedOffset(
LayoutUnit& logical_top_pos,
const LayoutBox* child,
Expand Down Expand Up @@ -1848,18 +1825,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {

virtual void ComputePositionedLogicalHeight(
LogicalExtentComputedValues&) const;
void ComputePositionedLogicalWidthUsing(
SizeType,
const Length& logical_width,
const LayoutBoxModelObject* container_block,
TextDirection container_direction,
LayoutUnit container_logical_width,
LayoutUnit borders_plus_padding,
const Length& logical_left,
const Length& logical_right,
const Length& margin_logical_left,
const Length& margin_logical_right,
LogicalExtentComputedValues&) const;
void ComputePositionedLogicalHeightUsing(
SizeType,
Length logical_height_length,
Expand Down
4 changes: 0 additions & 4 deletions third_party/blink/renderer/core/paint/paint_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,8 @@ class CORE_EXPORT PaintLayer : public GarbageCollected<PaintLayer>,
const PhysicalRect& hit_test_area);

// Static position is set in parent's coordinate space.
LayoutUnit StaticInlinePosition() const { return static_inline_position_; }
LayoutUnit StaticBlockPosition() const { return static_block_position_; }

void SetStaticInlinePosition(LayoutUnit position) {
static_inline_position_ = position;
}
void SetStaticBlockPosition(LayoutUnit position) {
static_block_position_ = position;
}
Expand Down

0 comments on commit dda829d

Please sign in to comment.