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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2450093005: Support display: contents for elements, first-line and first-letter pseudos. (Closed)
Patch Set: Support display: contents for elements, first-line and first-letter pseudos. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 return parent->locateNamespacePrefix(namespaceToLocate); 1520 return parent->locateNamespacePrefix(namespaceToLocate);
1521 1521
1522 return nullAtom; 1522 return nullAtom;
1523 } 1523 }
1524 1524
1525 const AtomicString Element::imageSourceURL() const { 1525 const AtomicString Element::imageSourceURL() const {
1526 return getAttribute(srcAttr); 1526 return getAttribute(srcAttr);
1527 } 1527 }
1528 1528
1529 bool Element::layoutObjectIsNeeded(const ComputedStyle& style) { 1529 bool Element::layoutObjectIsNeeded(const ComputedStyle& style) {
1530 return style.display() != EDisplay::None; 1530 return style.display() != EDisplay::None &&
1531 style.display() != EDisplay::Contents;
1531 } 1532 }
1532 1533
1533 LayoutObject* Element::createLayoutObject(const ComputedStyle& style) { 1534 LayoutObject* Element::createLayoutObject(const ComputedStyle& style) {
1534 return LayoutObject::createObject(this, style); 1535 return LayoutObject::createObject(this, style);
1535 } 1536 }
1536 1537
1537 Node::InsertionNotificationRequest Element::insertedInto( 1538 Node::InsertionNotificationRequest Element::insertedInto(
1538 ContainerNode* insertionPoint) { 1539 ContainerNode* insertionPoint) {
1539 // need to do superclass processing first so isConnected() is true 1540 // need to do superclass processing first so isConnected() is true
1540 // by the time we reach updateId 1541 // by the time we reach updateId
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3126 3127
3127 RefPtr<ComputedStyle> result = 3128 RefPtr<ComputedStyle> result =
3128 document().ensureStyleResolver().pseudoStyleForElement( 3129 document().ensureStyleResolver().pseudoStyleForElement(
3129 this, PseudoStyleRequest(pseudoElementSpecifier, 3130 this, PseudoStyleRequest(pseudoElementSpecifier,
3130 PseudoStyleRequest::ForComputedStyle), 3131 PseudoStyleRequest::ForComputedStyle),
3131 elementStyle); 3132 elementStyle);
3132 DCHECK(result); 3133 DCHECK(result);
3133 return elementStyle->addCachedPseudoStyle(result.release()); 3134 return elementStyle->addCachedPseudoStyle(result.release());
3134 } 3135 }
3135 3136
3137 ComputedStyle* Element::displayContentsStyle() const {
3138 if (layoutObject() || !hasRareData())
3139 return 0;
jfernandez 2016/10/27 17:08:01 return nullptr
3140
3141 ComputedStyle* style = elementRareData()->computedStyle();
3142 if (!style || style->display() != EDisplay::Contents)
3143 return 0;
jfernandez 2016/10/27 17:08:01 return nullptr
3144
3145 return style;
3146 }
3147
3148 void Element::storeDisplayContentsStyle(ComputedStyle& style) {
3149 DCHECK_EQ(style.display(), EDisplay::Contents);
3150 ensureElementRareData().setComputedStyle(&style);
jfernandez 2016/10/27 17:08:01 The setComputedStyle argument is a PassRefPtr so I
3151 }
3152
3136 AtomicString Element::computeInheritedLanguage() const { 3153 AtomicString Element::computeInheritedLanguage() const {
3137 const Node* n = this; 3154 const Node* n = this;
3138 AtomicString value; 3155 AtomicString value;
3139 // The language property is inherited, so we iterate over the parents to find 3156 // The language property is inherited, so we iterate over the parents to find
3140 // the first language. 3157 // the first language.
3141 do { 3158 do {
3142 if (n->isElementNode()) { 3159 if (n->isElementNode()) {
3143 if (const ElementData* elementData = toElement(n)->elementData()) { 3160 if (const ElementData* elementData = toElement(n)->elementData()) {
3144 AttributeCollection attributes = elementData->attributes(); 3161 AttributeCollection attributes = elementData->attributes();
3145 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7 3162 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 } 4111 }
4095 4112
4096 DEFINE_TRACE_WRAPPERS(Element) { 4113 DEFINE_TRACE_WRAPPERS(Element) {
4097 if (hasRareData()) { 4114 if (hasRareData()) {
4098 visitor->traceWrappers(elementRareData()); 4115 visitor->traceWrappers(elementRareData());
4099 } 4116 }
4100 ContainerNode::traceWrappers(visitor); 4117 ContainerNode::traceWrappers(visitor);
4101 } 4118 }
4102 4119
4103 } // namespace blink 4120 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698