Commit 370da7c8 authored by cathiechen's avatar cathiechen Committed by Commit Bot

[LayoutNG] Make li without ul/ol layout as list-style-position: inside

Like the legacy layout, make single li as list-style-position: inside.
We consider li is with ul/ol by default. If not, use not_in_list_changed_
to indict that we should UpdateMarker().

Bug: 725277
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I5a245fd12c204f5dd4d68c6ce7aacd4582cedb78
Reviewed-on: https://chromium-review.googlesource.com/1141745
Commit-Queue: cathie chen <cathiechen@tencent.com>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576474}
parent b168f860
...@@ -572,7 +572,6 @@ crbug.com/591099 fast/inline/inline-with-empty-inline-children.html [ Failure ] ...@@ -572,7 +572,6 @@ crbug.com/591099 fast/inline/inline-with-empty-inline-children.html [ Failure ]
crbug.com/591099 fast/inline/nested-text-descendants.html [ Failure ] crbug.com/591099 fast/inline/nested-text-descendants.html [ Failure ]
crbug.com/591099 fast/inline/outline-continuations.html [ Failure ] crbug.com/591099 fast/inline/outline-continuations.html [ Failure ]
crbug.com/714962 fast/inline/outline-offset.html [ Failure ] crbug.com/714962 fast/inline/outline-offset.html [ Failure ]
crbug.com/591099 fast/lists/004.html [ Failure ]
crbug.com/860415 fast/multicol/out-of-flow/abspos-auto-position-on-line-rtl.html [ Failure ] crbug.com/860415 fast/multicol/out-of-flow/abspos-auto-position-on-line-rtl.html [ Failure ]
crbug.com/591099 fast/overflow/overflow-update-transform.html [ Failure ] crbug.com/591099 fast/overflow/overflow-update-transform.html [ Failure ]
crbug.com/591099 fast/overflow/recompute-overflow-of-layout-root-container.html [ Failure ] crbug.com/591099 fast/overflow/recompute-overflow-of-layout-root-container.html [ Failure ]
......
...@@ -111,7 +111,7 @@ void HTMLLIElement::AttachLayoutTree(AttachContext& context) { ...@@ -111,7 +111,7 @@ void HTMLLIElement::AttachLayoutTree(AttachContext& context) {
// inside. We don't want to change our style to say "inside" since that // inside. We don't want to change our style to say "inside" since that
// would affect nested nodes. // would affect nested nodes.
if (!list_node) if (!list_node)
ordinal->SetNotInList(true); ordinal->SetNotInList(true, *this);
ParseValue(FastGetAttribute(valueAttr), ordinal); ParseValue(FastGetAttribute(valueAttr), ordinal);
} }
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
namespace blink { namespace blink {
ListItemOrdinal::ListItemOrdinal() : type_(kNeedsUpdate), not_in_list_(false) {} ListItemOrdinal::ListItemOrdinal()
: type_(kNeedsUpdate), not_in_list_(false), not_in_list_changed_(false) {}
bool ListItemOrdinal::IsList(const Node& node) { bool ListItemOrdinal::IsList(const Node& node) {
return IsHTMLUListElement(node) || IsHTMLOListElement(node); return IsHTMLUListElement(node) || IsHTMLOListElement(node);
...@@ -240,8 +241,19 @@ void ListItemOrdinal::ClearExplicitValue(const Node& item_node) { ...@@ -240,8 +241,19 @@ void ListItemOrdinal::ClearExplicitValue(const Node& item_node) {
InvalidateAfter(EnclosingList(&item_node), &item_node); InvalidateAfter(EnclosingList(&item_node), &item_node);
} }
void ListItemOrdinal::SetNotInList(bool not_in_list) { void ListItemOrdinal::SetNotInList(bool not_in_list, const Node& item_node) {
if (not_in_list_ == not_in_list)
return;
not_in_list_ = not_in_list; not_in_list_ = not_in_list;
SetNotInListChanged(true);
LayoutObject* layout_object = item_node.GetLayoutObject();
if (layout_object->IsLayoutNGListItem())
layout_object->NotifyOfSubtreeChange();
}
void ListItemOrdinal::SetNotInListChanged(bool changed) {
not_in_list_changed_ = changed;
} }
unsigned ListItemOrdinal::ItemCountForOrderedList( unsigned ListItemOrdinal::ItemCountForOrderedList(
......
...@@ -63,7 +63,9 @@ class CORE_EXPORT ListItemOrdinal { ...@@ -63,7 +63,9 @@ class CORE_EXPORT ListItemOrdinal {
// Get/set whether this item is in a list or not. // Get/set whether this item is in a list or not.
bool NotInList() const { return not_in_list_; } bool NotInList() const { return not_in_list_; }
void SetNotInList(bool); void SetNotInList(bool, const Node&);
bool NotInListChanged() const { return not_in_list_changed_; }
void SetNotInListChanged(bool);
static bool IsList(const Node&); static bool IsList(const Node&);
static bool IsListItem(const Node&); static bool IsListItem(const Node&);
...@@ -110,6 +112,7 @@ class CORE_EXPORT ListItemOrdinal { ...@@ -110,6 +112,7 @@ class CORE_EXPORT ListItemOrdinal {
mutable int value_ = 0; mutable int value_ = 0;
mutable unsigned type_ : 2; // ValueType mutable unsigned type_ : 2; // ValueType
unsigned not_in_list_ : 1; unsigned not_in_list_ : 1;
unsigned not_in_list_changed_ : 1;
}; };
} // namespace blink } // namespace blink
......
...@@ -66,6 +66,12 @@ void LayoutNGListItem::SubtreeDidChange() { ...@@ -66,6 +66,12 @@ void LayoutNGListItem::SubtreeDidChange() {
if (!marker_) if (!marker_)
return; return;
if (ordinal_.NotInListChanged()) {
UpdateMarker();
ordinal_.SetNotInListChanged(false);
return;
}
// Make sure outside marker is the direct child of ListItem. // Make sure outside marker is the direct child of ListItem.
if (!IsInside() && marker_->Parent() != this) { if (!IsInside() && marker_->Parent() != this) {
marker_->Remove(); marker_->Remove();
......
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