Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: Source/core/layout/LayoutListMarker.cpp

Issue 778003003: List marker pseudo elements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutListMarker.h ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutListMarker.cpp
diff --git a/Source/core/layout/LayoutListMarker.cpp b/Source/core/layout/LayoutListMarker.cpp
index 01a02be83af6053ee2a2df3d0b530a56b31ed374..49c4ed37cadf568cb89d4b7c769f036ef2d50887 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::styleForListMarker(*m_listItem, style());
setStyle(newStyle.release());
}
« no previous file with comments | « Source/core/layout/LayoutListMarker.h ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698