Commit 77f4abc4 authored by Oriol Brufau's avatar Oriol Brufau Committed by Commit Bot

[css-pseudo] Rename some LayoutListMarker members

The UpdateMarginsAndContent() member function was misleading because it
only updates margins, without changing any content. So renaming it to
UpdateMargins().

LineOffset() and line_offset_ are renamed to ListItemInlineStartOffset()
and list_item_inline_start_offset_ for extra clarity.

Bug: 457718
Change-Id: I67b6b5fbac70fce180ff8b5e0e7718b942185e7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285969Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#786397}
parent c5746a41
...@@ -240,7 +240,7 @@ bool LayoutListItem::PrepareForBlockDirectionAlign( ...@@ -240,7 +240,7 @@ bool LayoutListItem::PrepareForBlockDirectionAlign(
} }
if (marker->IsListMarkerForNormalContent()) if (marker->IsListMarkerForNormalContent())
ToLayoutListMarker(marker)->UpdateMarginsAndContent(); ToLayoutListMarker(marker)->UpdateMargins();
else if (marker->IsOutsideListMarkerForCustomContent()) else if (marker->IsOutsideListMarkerForCustomContent())
ToLayoutOutsideListMarker(marker)->UpdateMargins(); ToLayoutOutsideListMarker(marker)->UpdateMargins();
return true; return true;
...@@ -314,7 +314,7 @@ bool LayoutListItem::UpdateMarkerLocation() { ...@@ -314,7 +314,7 @@ bool LayoutListItem::UpdateMarkerLocation() {
// of referencing them delete marker_parent if it is an empty anonymous // of referencing them delete marker_parent if it is an empty anonymous
// block. // block.
if (marker->IsListMarkerForNormalContent()) if (marker->IsListMarkerForNormalContent())
ToLayoutListMarker(marker)->UpdateMarginsAndContent(); ToLayoutListMarker(marker)->UpdateMargins();
else if (marker->IsOutsideListMarkerForCustomContent()) else if (marker->IsOutsideListMarkerForCustomContent())
ToLayoutOutsideListMarker(marker)->UpdateMargins(); ToLayoutOutsideListMarker(marker)->UpdateMargins();
return true; return true;
...@@ -472,7 +472,7 @@ void LayoutListItem::UpdateOverflow() { ...@@ -472,7 +472,7 @@ void LayoutListItem::UpdateOverflow() {
// FIXME: Need to account for relative positioning in the layout overflow. // FIXME: Need to account for relative positioning in the layout overflow.
LayoutUnit marker_line_offset = LayoutUnit marker_line_offset =
marker->IsListMarkerForNormalContent() marker->IsListMarkerForNormalContent()
? ToLayoutListMarker(marker)->LineOffset() ? ToLayoutListMarker(marker)->ListItemInlineStartOffset()
: ToLayoutOutsideListMarker(marker)->ListItemInlineStartOffset(); : ToLayoutOutsideListMarker(marker)->ListItemInlineStartOffset();
if (StyleRef().IsLeftToRightDirection()) { if (StyleRef().IsLeftToRightDirection()) {
marker_line_offset = marker_line_offset =
......
...@@ -116,14 +116,14 @@ void LayoutListMarker::UpdateLayout() { ...@@ -116,14 +116,14 @@ void LayoutListMarker::UpdateLayout() {
block_offset += o->LogicalTop(); block_offset += o->LogicalTop();
} }
if (list_item->StyleRef().IsLeftToRightDirection()) { if (list_item->StyleRef().IsLeftToRightDirection()) {
line_offset_ = list_item->LogicalLeftOffsetForLine( list_item_inline_start_offset_ = list_item->LogicalLeftOffsetForLine(
block_offset, kDoNotIndentText, LayoutUnit()); block_offset, kDoNotIndentText, LayoutUnit());
} else { } else {
line_offset_ = list_item->LogicalRightOffsetForLine( list_item_inline_start_offset_ = list_item->LogicalRightOffsetForLine(
block_offset, kDoNotIndentText, LayoutUnit()); block_offset, kDoNotIndentText, LayoutUnit());
} }
if (IsImage()) { if (IsImage()) {
UpdateMarginsAndContent(); UpdateMargins();
LayoutSize image_size(ImageBulletSize()); LayoutSize image_size(ImageBulletSize());
SetWidth(image_size.Width()); SetWidth(image_size.Width());
SetHeight(image_size.Height()); SetHeight(image_size.Height());
...@@ -153,10 +153,6 @@ void LayoutListMarker::ImageChanged(WrappedImagePtr o, CanDeferInvalidation) { ...@@ -153,10 +153,6 @@ void LayoutListMarker::ImageChanged(WrappedImagePtr o, CanDeferInvalidation) {
} }
} }
void LayoutListMarker::UpdateMarginsAndContent() {
UpdateMargins(PreferredLogicalWidths().min_size);
}
void LayoutListMarker::UpdateContent() { void LayoutListMarker::UpdateContent() {
DCHECK(IntrinsicLogicalWidthsDirty()); DCHECK(IntrinsicLogicalWidthsDirty());
...@@ -262,6 +258,10 @@ void LayoutListMarker::UpdateMargins(LayoutUnit marker_inline_size) { ...@@ -262,6 +258,10 @@ void LayoutListMarker::UpdateMargins(LayoutUnit marker_inline_size) {
SetMarginEnd(margin_end); SetMarginEnd(margin_end);
} }
void LayoutListMarker::UpdateMargins() {
UpdateMargins(PreferredLogicalWidths().min_size);
}
LayoutUnit LayoutListMarker::LineHeight( LayoutUnit LayoutListMarker::LineHeight(
bool first_line, bool first_line,
LineDirectionMode direction, LineDirectionMode direction,
......
...@@ -51,8 +51,6 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox { ...@@ -51,8 +51,6 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox {
bool IsInside() const; bool IsInside() const;
void UpdateMarginsAndContent();
LayoutRect GetRelativeMarkerRect() const; LayoutRect GetRelativeMarkerRect() const;
bool IsImage() const override; bool IsImage() const override;
...@@ -62,7 +60,9 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox { ...@@ -62,7 +60,9 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox {
const char* GetName() const override { return "LayoutListMarker"; } const char* GetName() const override { return "LayoutListMarker"; }
LayoutUnit LineOffset() const { return line_offset_; } LayoutUnit ListItemInlineStartOffset() const {
return list_item_inline_start_offset_;
}
protected: protected:
void WillBeDestroyed() override; void WillBeDestroyed() override;
...@@ -97,6 +97,7 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox { ...@@ -97,6 +97,7 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox {
LayoutUnit GetWidthOfText(ListMarker::ListStyleCategory) const; LayoutUnit GetWidthOfText(ListMarker::ListStyleCategory) const;
void UpdateMargins(LayoutUnit marker_inline_size); void UpdateMargins(LayoutUnit marker_inline_size);
void UpdateMargins();
void UpdateContent(); void UpdateContent();
void UpdateMarkerImageIfNeeded(StyleImage* image); void UpdateMarkerImageIfNeeded(StyleImage* image);
...@@ -104,7 +105,7 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox { ...@@ -104,7 +105,7 @@ class CORE_EXPORT LayoutListMarker final : public LayoutBox {
String text_; String text_;
Persistent<StyleImage> image_; Persistent<StyleImage> image_;
LayoutUnit line_offset_; LayoutUnit list_item_inline_start_offset_;
}; };
DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutListMarker, DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutListMarker,
......
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