From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/html/HTMLOptGroupElement.cpp | 70 +++++++++-------------------- 1 file changed, 20 insertions(+), 50 deletions(-) (limited to 'Source/WebCore/html/HTMLOptGroupElement.cpp') diff --git a/Source/WebCore/html/HTMLOptGroupElement.cpp b/Source/WebCore/html/HTMLOptGroupElement.cpp index 2927adac5..afb782108 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.cpp +++ b/Source/WebCore/html/HTMLOptGroupElement.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2004-2016 Apple Inc. All rights reserved. * (C) 2006 Alexey Proskuryakov (ap@nypop.com) * * This library is free software; you can redistribute it and/or @@ -26,6 +26,7 @@ #include "HTMLOptGroupElement.h" #include "Document.h" +#include "ElementAncestorIterator.h" #include "HTMLNames.h" #include "HTMLSelectElement.h" #include "RenderMenuList.h" @@ -41,28 +42,30 @@ inline HTMLOptGroupElement::HTMLOptGroupElement(const QualifiedName& tagName, Do : HTMLElement(tagName, document) { ASSERT(hasTagName(optgroupTag)); - setHasCustomStyleResolveCallbacks(); } -PassRefPtr HTMLOptGroupElement::create(const QualifiedName& tagName, Document& document) +Ref HTMLOptGroupElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new HTMLOptGroupElement(tagName, document)); + return adoptRef(*new HTMLOptGroupElement(tagName, document)); } bool HTMLOptGroupElement::isDisabledFormControl() const { - return fastHasAttribute(disabledAttr); + return hasAttributeWithoutSynchronization(disabledAttr); } bool HTMLOptGroupElement::isFocusable() const { - // Optgroup elements do not have a renderer so we check the renderStyle instead. - return supportsFocus() && renderStyle() && renderStyle()->display() != NONE; + if (!supportsFocus()) + return false; + // Optgroup elements do not have a renderer. + auto* style = const_cast(*this).computedStyle(); + return style && style->display() != NONE; } const AtomicString& HTMLOptGroupElement::formControlType() const { - DEFINE_STATIC_LOCAL(const AtomicString, optgroup, ("optgroup", AtomicString::ConstructFromLiteral)); + static NeverDestroyed optgroup("optgroup", AtomicString::ConstructFromLiteral); return optgroup; } @@ -78,53 +81,20 @@ void HTMLOptGroupElement::parseAttribute(const QualifiedName& name, const Atomic recalcSelectOptions(); if (name == disabledAttr) - didAffectSelector(AffectedSelectorDisabled | AffectedSelectorEnabled); + invalidateStyleForSubtree(); } void HTMLOptGroupElement::recalcSelectOptions() { - ContainerNode* select = parentNode(); - while (select && !select->hasTagName(selectTag)) - select = select->parentNode(); - if (select) - toHTMLSelectElement(select)->setRecalcListItems(); -} - -void HTMLOptGroupElement::didAttachRenderers() -{ - // If after attaching nothing called styleForRenderer() on this node we - // manually cache the value. This happens if our parent doesn't have a - // renderer like or if it doesn't allow children like