Index: third_party/WebKit/Source/core/layout/LayoutListItem.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutListItem.cpp b/third_party/WebKit/Source/core/layout/LayoutListItem.cpp |
index badb3a06f52091495cb3760cd7c472f975a045fc..6c6c9f320e1e03a2107b59d0cfb4a24107d859fe 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutListItem.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutListItem.cpp |
@@ -23,7 +23,6 @@ |
#include "core/layout/LayoutListItem.h" |
-#include "core/HTMLNames.h" |
#include "core/dom/shadow/FlatTreeTraversal.h" |
#include "core/html/HTMLOListElement.h" |
#include "core/layout/LayoutListMarker.h" |
@@ -33,7 +32,39 @@ |
namespace blink { |
-using namespace HTMLNames; |
+namespace { |
+LayoutObject* getParentOfFirstLineBox(LayoutBlockFlow* curr, LayoutListMarker* marker) |
eae
2016/09/09 08:55:56
Why not make it a static inline instead?
Gleb Lanbin
2016/09/09 16:06:53
'inline' is recommended for function that are smal
|
+{ |
+ LayoutObject* firstChild = curr->firstChild(); |
+ if (!firstChild) |
+ return nullptr; |
+ |
+ bool inQuirksMode = curr->document().inQuirksMode(); |
+ for (LayoutObject* currChild = firstChild; currChild; currChild = currChild->nextSibling()) { |
+ if (currChild == marker) |
+ continue; |
+ |
+ if (currChild->isInline() && (!currChild->isLayoutInline() || curr->generatesLineBoxesForInlineChild(currChild))) |
+ return curr; |
+ |
+ if (currChild->isFloating() || currChild->isOutOfFlowPositioned()) |
+ continue; |
+ |
+ if (!currChild->isLayoutBlockFlow() || (currChild->isBox() && toLayoutBox(currChild)->isWritingModeRoot())) |
+ break; |
+ |
+ if (curr->isListItem() && inQuirksMode && currChild->node() |
+ && (isHTMLUListElement(*currChild->node()) || isHTMLOListElement(*currChild->node()))) |
+ break; |
+ |
+ LayoutObject* lineBox = getParentOfFirstLineBox(toLayoutBlockFlow(currChild), marker); |
+ if (lineBox) |
+ return lineBox; |
+ } |
+ |
+ return nullptr; |
+} |
+} // namespace |
LayoutListItem::LayoutListItem(Element* element) |
: LayoutBlockFlow(element) |
@@ -245,38 +276,6 @@ bool LayoutListItem::isEmpty() const |
return lastChild() == m_marker; |
} |
-static LayoutObject* getParentOfFirstLineBox(LayoutBlockFlow* curr, LayoutObject* marker) |
-{ |
- LayoutObject* firstChild = curr->firstChild(); |
- if (!firstChild) |
- return nullptr; |
- |
- bool inQuirksMode = curr->document().inQuirksMode(); |
- for (LayoutObject* currChild = firstChild; currChild; currChild = currChild->nextSibling()) { |
- if (currChild == marker) |
- continue; |
- |
- if (currChild->isInline() && (!currChild->isLayoutInline() || curr->generatesLineBoxesForInlineChild(currChild))) |
- return curr; |
- |
- if (currChild->isFloating() || currChild->isOutOfFlowPositioned()) |
- continue; |
- |
- if (!currChild->isLayoutBlockFlow() || (currChild->isBox() && toLayoutBox(currChild)->isWritingModeRoot())) |
- break; |
- |
- if (curr->isListItem() && inQuirksMode && currChild->node() |
- && (isHTMLUListElement(*currChild->node()) || isHTMLOListElement(*currChild->node()))) |
- break; |
- |
- LayoutObject* lineBox = getParentOfFirstLineBox(toLayoutBlockFlow(currChild), marker); |
- if (lineBox) |
- return lineBox; |
- } |
- |
- return nullptr; |
-} |
- |
void LayoutListItem::updateValue() |
{ |
if (!m_hasExplicitValue) { |
@@ -299,7 +298,8 @@ bool LayoutListItem::updateMarkerLocation() |
ASSERT(m_marker); |
LayoutObject* markerParent = m_marker->parent(); |
- LayoutObject* lineBoxParent = getParentOfFirstLineBox(this, m_marker); |
+ // list-style-position:inside makes the ::marker pseudo an ordinary position:static element that should be attached to LayoutListItem block. |
+ LayoutObject* lineBoxParent = m_marker->isInside() ? this : getParentOfFirstLineBox(this, m_marker); |
if (!lineBoxParent) { |
// If the marker is currently contained inside an anonymous box, then we |
// are the only item in that anonymous box (since no line box parent was |