Index: Source/core/layout/LayoutListMarker.cpp |
diff --git a/Source/core/layout/LayoutListMarker.cpp b/Source/core/layout/LayoutListMarker.cpp |
index 01a02be83af6053ee2a2df3d0b530a56b31ed374..a8652a393cd31274b4dbadb548d17786f84bd102 100644 |
--- a/Source/core/layout/LayoutListMarker.cpp |
+++ b/Source/core/layout/LayoutListMarker.cpp |
@@ -25,6 +25,7 @@ |
#include "config.h" |
#include "core/layout/LayoutListMarker.h" |
+#include "core/dom/MarkerPseudoElement.h" |
#include "core/fetch/ImageResource.h" |
#include "core/layout/LayoutAnalyzer.h" |
#include "core/layout/LayoutListItem.h" |
@@ -1048,6 +1049,15 @@ String listMarkerText(EListStyleType type, int value) |
return ""; |
} |
+LayoutListMarker::LayoutListMarker(Element* node, LayoutListItem* item) |
+ : LayoutBox(node) |
+ , m_listItem(item) |
+{ |
+ // init LayoutObject attributes |
+ setInline(true); // our object is Inline |
+ setReplaced(true); // pretend to be replaced |
+} |
+ |
LayoutListMarker::LayoutListMarker(LayoutListItem* item) |
: LayoutBox(0) |
, m_listItem(item) |
@@ -1071,9 +1081,9 @@ void LayoutListMarker::destroy() |
LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) |
{ |
Document& document = item->document(); |
- LayoutListMarker* renderer = new LayoutListMarker(item); |
- renderer->setDocumentForAnonymous(&document); |
- return renderer; |
+ LayoutListMarker* layoutObject = new LayoutListMarker(item); |
+ layoutObject->setDocumentForAnonymous(&document); |
+ return layoutObject; |
} |
void LayoutListMarker::styleWillChange(StyleDifference diff, const ComputedStyle& newStyle) |
@@ -1088,6 +1098,9 @@ void LayoutListMarker::styleDidChange(StyleDifference diff, const ComputedStyle* |
{ |
LayoutBox::styleDidChange(diff, oldStyle); |
+ if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()) |
+ updateMarginsAndContent(); |
+ |
if (m_image != style()->listStyleImage()) { |
if (m_image) |
m_image->removeClient(this); |
@@ -1636,16 +1649,8 @@ LayoutRect LayoutListMarker::selectionRectForPaintInvalidation(const LayoutBoxMo |
void LayoutListMarker::listItemStyleDidChange() |
{ |
- RefPtr<ComputedStyle> newStyle = ComputedStyle::create(); |
- // The marker always inherits from the list item, regardless of where it might end |
- // up (e.g., in some deeply nested line box). See CSS3 spec. |
- newStyle->inheritFrom(m_listItem->styleRef()); |
- if (style()) { |
- // Reuse the current margins. Otherwise resetting the margins to initial values |
- // would trigger unnecessary layout. |
- newStyle->setMarginStart(style()->marginStart()); |
- newStyle->setMarginEnd(style()->marginRight()); |
- } |
+ ASSERT(!RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()); |
+ RefPtr<ComputedStyle> newStyle = MarkerPseudoElement::styleForListMarkerLayoutObject(*m_listItem, style()); |
setStyle(newStyle.release()); |
} |