| Index: third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
|
| index 784c1c9e5207f890edf12808f581965118dcdb06..ca729c1ebef9a5cae91c4205ddaac8f683b71e52 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
|
| @@ -49,7 +49,6 @@ using namespace HTMLNames;
|
|
|
| HTMLOptionElement::HTMLOptionElement(Document& document)
|
| : HTMLElement(optionTag, document), m_isSelected(false) {
|
| - setHasCustomStyleCallbacks();
|
| }
|
|
|
| // An explicit empty destructor should be in HTMLOptionElement.cpp, because
|
| @@ -90,18 +89,17 @@ HTMLOptionElement* HTMLOptionElement::createForJSConstructor(
|
|
|
| void HTMLOptionElement::attachLayoutTree(const AttachContext& context) {
|
| AttachContext optionContext(context);
|
| - if (context.resolvedStyle) {
|
| - DCHECK(!m_style || m_style == context.resolvedStyle);
|
| - m_style = context.resolvedStyle;
|
| - } else if (parentComputedStyle()) {
|
| - updateNonComputedStyle();
|
| - optionContext.resolvedStyle = m_style.get();
|
| + RefPtr<ComputedStyle> resolvedStyle;
|
| + if (!context.resolvedStyle && parentComputedStyle()) {
|
| + if (HTMLSelectElement* select = ownerSelectElement())
|
| + select->updateListOnLayoutObject();
|
| + resolvedStyle = originalStyleForLayoutObject();
|
| + optionContext.resolvedStyle = resolvedStyle.get();
|
| }
|
| HTMLElement::attachLayoutTree(optionContext);
|
| }
|
|
|
| void HTMLOptionElement::detachLayoutTree(const AttachContext& context) {
|
| - m_style.clear();
|
| HTMLElement::detachLayoutTree(context);
|
| }
|
|
|
| @@ -330,21 +328,6 @@ void HTMLOptionElement::setLabel(const AtomicString& label) {
|
| setAttribute(labelAttr, label);
|
| }
|
|
|
| -void HTMLOptionElement::updateNonComputedStyle() {
|
| - m_style = originalStyleForLayoutObject();
|
| - if (HTMLSelectElement* select = ownerSelectElement())
|
| - select->updateListOnLayoutObject();
|
| -}
|
| -
|
| -ComputedStyle* HTMLOptionElement::nonLayoutObjectComputedStyle() const {
|
| - return m_style.get();
|
| -}
|
| -
|
| -PassRefPtr<ComputedStyle> HTMLOptionElement::customStyleForLayoutObject() {
|
| - updateNonComputedStyle();
|
| - return m_style;
|
| -}
|
| -
|
| String HTMLOptionElement::textIndentedToRespectGroupLabel() const {
|
| ContainerNode* parent = parentNode();
|
| if (parent && isHTMLOptGroupElement(*parent))
|
| @@ -431,12 +414,13 @@ bool HTMLOptionElement::spatialNavigationFocused() const {
|
| }
|
|
|
| bool HTMLOptionElement::isDisplayNone() const {
|
| - // If m_style is not set, then the node is still unattached.
|
| + // If the style is not set, then the node is still unattached.
|
| // We have to wait till it gets attached to read the display property.
|
| - if (!m_style)
|
| + const ComputedStyle* style = nonLayoutObjectComputedStyle();
|
| + if (!style)
|
| return false;
|
|
|
| - if (m_style->display() != EDisplay::None) {
|
| + if (style->display() != EDisplay::None) {
|
| // We need to check the parent's display property. Parent's
|
| // display:none doesn't override children's display properties in
|
| // ComputedStyle.
|
| @@ -449,7 +433,7 @@ bool HTMLOptionElement::isDisplayNone() const {
|
| return !parentStyle || parentStyle->display() == EDisplay::None;
|
| }
|
| }
|
| - return m_style->display() == EDisplay::None;
|
| + return style->display() == EDisplay::None;
|
| }
|
|
|
| String HTMLOptionElement::innerText() {
|
|
|