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

Unified Diff: Source/core/dom/LayoutTreeBuilder.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
Index: Source/core/dom/LayoutTreeBuilder.cpp
diff --git a/Source/core/dom/LayoutTreeBuilder.cpp b/Source/core/dom/LayoutTreeBuilder.cpp
index f0ae0816d1b12be8a30ff49f074572ccca31b696..e0e2eb23aabd67ff2eca9174e8356ed16015ab65 100644
--- a/Source/core/dom/LayoutTreeBuilder.cpp
+++ b/Source/core/dom/LayoutTreeBuilder.cpp
@@ -31,6 +31,7 @@
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/FirstLetterPseudoElement.h"
#include "core/dom/Fullscreen.h"
+#include "core/dom/MarkerPseudoElement.h"
#include "core/dom/Node.h"
#include "core/dom/PseudoElement.h"
#include "core/dom/Text.h"
@@ -57,7 +58,7 @@ LayoutTreeBuilderForElement::LayoutTreeBuilderForElement(Element& element, Compu
}
}
-LayoutObject* LayoutTreeBuilderForElement::nextLayoutObject() const
+LayoutObject* LayoutTreeBuilderForElement::nextLayoutObject(LayoutObject* parentLayoutObject) const
{
ASSERT(m_layoutObjectParent);
@@ -67,6 +68,11 @@ LayoutObject* LayoutTreeBuilderForElement::nextLayoutObject() const
if (m_node->isFirstLetterPseudoElement())
return FirstLetterPseudoElement::firstLetterTextRenderer(*m_node);
+ if (m_node->isMarkerPseudoElement()) {
+ ASSERT(parentLayoutObject);
+ return MarkerPseudoElement::firstNonMarkerChild(parentLayoutObject);
+ }
+
return LayoutTreeBuilder::nextLayoutObject();
}
@@ -74,8 +80,14 @@ LayoutObject* LayoutTreeBuilderForElement::parentLayoutObject() const
{
LayoutObject* parentLayoutObject = LayoutTreeBuilder::parentLayoutObject();
+ if (m_node->isMarkerPseudoElement()) {
+ ASSERT(m_layoutObjectParent->isLayoutBlockFlow());
+ if (LayoutObject* markerLayoutObject = MarkerPseudoElement::parentOfFirstLineBox(toLayoutBlockFlow(m_layoutObjectParent), nullptr))
esprehn 2015/04/22 07:45:45 This needs to be encapsulated, this code shouldn't
dsinclair 2015/04/22 20:00:38 Done.
+ return markerLayoutObject;
+ }
+
if (parentLayoutObject) {
- // FIXME: Guarding this by parentLayoutObject isn't quite right as the spec for
+ // FIXME: Guarding this by parentRenderer isn't quite right as the spec for
// top layer only talks about display: none ancestors so putting a <dialog> inside an
// <optgroup> seems like it should still work even though this check will prevent it.
if (m_node->isInTopLayer())
@@ -105,6 +117,9 @@ bool LayoutTreeBuilderForElement::shouldCreateLayoutObject() const
if (!parentLayoutObject->canHaveChildren())
return false;
+ if (m_node->isMarkerPseudoElement() && m_layoutObjectParent->style()->display() == LIST_ITEM)
esprehn 2015/04/22 07:45:45 We should never even get here if the parent is the
dsinclair 2015/04/22 20:00:38 Done.
+ return true;
+
return m_node->layoutObjectIsNeeded(style());
}
@@ -134,7 +149,7 @@ void LayoutTreeBuilderForElement::createLayoutObject()
// for the first time. Otherwise code using inLayoutFlowThread() in the styleWillChange and styleDidChange will fail.
newLayoutObject->setFlowThreadState(parentLayoutObject->flowThreadState());
- LayoutObject* nextLayoutObject = this->nextLayoutObject();
+ LayoutObject* nextLayoutObject = this->nextLayoutObject(parentLayoutObject);
esprehn 2015/04/22 07:45:45 remove the argument, just call parentLayoutObject
dsinclair 2015/04/22 20:00:38 Done.
m_node->setLayoutObject(newLayoutObject);
newLayoutObject->setStyle(&style); // setStyle() can depend on layoutObject() already being set.

Powered by Google App Engine
This is Rietveld 408576698