Skip to content
Permalink
Browse files
Unreviewed, rolling out r190168.
https://bugs.webkit.org/show_bug.cgi?id=149502

it broke debug builds. (Requested by zalan on #webkit).

Reverted changeset:

"HTMLOutputElement.htmlFor should be settable"
https://bugs.webkit.org/show_bug.cgi?id=149418
http://trac.webkit.org/changeset/190168

Canonical link: https://commits.webkit.org/167598@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Sep 23, 2015
1 parent 65ea971 commit 1becb946a2e5ad865fbe4589a2023eb1ab2532e2
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 84 deletions.
@@ -1,3 +1,16 @@
2015-09-23 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r190168.
https://bugs.webkit.org/show_bug.cgi?id=149502

it broke debug builds. (Requested by zalan on #webkit).

Reverted changeset:

"HTMLOutputElement.htmlFor should be settable"
https://bugs.webkit.org/show_bug.cgi?id=149418
http://trac.webkit.org/changeset/190168

2015-09-23 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r190160.

This file was deleted.

This file was deleted.

@@ -4,10 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE


- Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/
PASS element.htmlFor.__proto__ is DOMSettableTokenList.prototype
PASS String(element.htmlFor) is "y z"
PASS element.getAttribute("for") is "y z"
PASS String(element.htmlFor) is "r s t"
PASS String(element.htmlFor) is "x"
PASS element.htmlFor.length is 0
PASS element.htmlFor.length is 1
PASS element.htmlFor.length is 1
@@ -14,14 +14,10 @@ function createElement(tokenList)

debug('- Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/');

// HTMLOutputElement::htmlFor should be settable.
// HTMLOutputElement::htmlFor is readonly attribute.
createElement('x');
shouldBe('element.htmlFor.__proto__', 'DOMSettableTokenList.prototype');
element.htmlFor = 'y z';
shouldBeEqualToString('String(element.htmlFor)', 'y z');
shouldBeEqualToString('element.getAttribute("for")', 'y z');
element.setAttribute('for', 'r s t');
shouldBeEqualToString('String(element.htmlFor)', 'r s t');
element.htmlFor = 'y';
shouldBeEqualToString('String(element.htmlFor)', 'x');

// http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/001.htm
createElement('');
@@ -1,3 +1,16 @@
2015-09-23 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r190168.
https://bugs.webkit.org/show_bug.cgi?id=149502

it broke debug builds. (Requested by zalan on #webkit).

Reverted changeset:

"HTMLOutputElement.htmlFor should be settable"
https://bugs.webkit.org/show_bug.cgi?id=149418
http://trac.webkit.org/changeset/190168

2015-09-23 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r190160.
@@ -34,7 +34,7 @@ AttributeDOMTokenList::AttributeDOMTokenList(Element& element, const QualifiedNa
: m_element(element)
, m_attributeName(attributeName)
{
setValueInternal(m_element.getAttribute(m_attributeName));
setValue(m_element.getAttribute(m_attributeName));
}

void AttributeDOMTokenList::attributeValueChanged(const AtomicString& newValue)
@@ -43,7 +43,7 @@ void AttributeDOMTokenList::attributeValueChanged(const AtomicString& newValue)
if (m_isUpdatingAttributeValue)
return;

setValueInternal(newValue);
DOMTokenList::setValue(newValue);
}

void AttributeDOMTokenList::updateAfterTokenChange()
@@ -26,13 +26,12 @@
#ifndef AttributeDOMTokenList_h
#define AttributeDOMTokenList_h

#include "DOMSettableTokenList.h"
#include "DOMTokenList.h"
#include "Element.h"

namespace WebCore {

class AttributeDOMTokenList final : public DOMSettableTokenList {
WTF_MAKE_FAST_ALLOCATED;
class AttributeDOMTokenList final : public DOMTokenList {
public:
AttributeDOMTokenList(Element&, const QualifiedName& attributeName);
void attributeValueChanged(const AtomicString&);
@@ -28,10 +28,14 @@

namespace WebCore {

void DOMSettableTokenList::setValue(const String& value)
void DOMSettableTokenList::ref()
{
setValueInternal(value);
updateAfterTokenChange();
RefCounted<DOMSettableTokenList>::ref();
}

void DOMSettableTokenList::deref()
{
RefCounted<DOMSettableTokenList>::deref();
}

} // namespace WebCore
@@ -28,19 +28,24 @@

#include "DOMTokenList.h"
#include "SpaceSplitString.h"
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>

namespace WebCore {

typedef int ExceptionCode;

class DOMSettableTokenList : public DOMTokenList {
class DOMSettableTokenList final : public DOMTokenList, public RefCounted<DOMSettableTokenList> {
WTF_MAKE_FAST_ALLOCATED;
public:
void setValue(const String&);
static Ref<DOMSettableTokenList> create()
{
return adoptRef(*new DOMSettableTokenList);
}

// Make public.
using DOMTokenList::value;
using DOMTokenList::setValue;

virtual void ref() override;
virtual void deref() override;
@@ -158,7 +158,7 @@ const AtomicString& DOMTokenList::value() const
return m_cachedValue;
}

void DOMTokenList::setValueInternal(const WTF::String& value)
void DOMTokenList::setValue(const String& value)
{
// Clear tokens but not capacity.
m_tokens.shrink(0);
@@ -61,7 +61,7 @@ class DOMTokenList {
protected:
DOMTokenList() = default;
const AtomicString& value() const;
void setValueInternal(const String&);
void setValue(const String&);

virtual void updateAfterTokenChange() { m_cachedValue = nullAtom; }

@@ -69,6 +69,7 @@ static LinkEventSender& linkLoadEventSender()
inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document& document, bool createdByParser)
: HTMLElement(tagName, document)
, m_linkLoader(*this)
, m_sizes(DOMSettableTokenList::create())
, m_disabledState(Unset)
, m_loading(false)
, m_createdByParser(createdByParser)
@@ -158,8 +159,7 @@ void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri
return;
}
if (name == sizesAttr) {
if (m_sizes)
m_sizes->attributeValueChanged(value);
m_sizes->setValue(value);
process();
return;
}
@@ -367,13 +367,6 @@ bool HTMLLinkElement::styleSheetIsLoading() const
return m_sheet->contents().isLoading();
}

DOMSettableTokenList& HTMLLinkElement::sizes()
{
if (!m_sizes)
m_sizes = std::make_unique<AttributeDOMTokenList>(*this, sizesAttr);
return *m_sizes;
}

void HTMLLinkElement::linkLoaded()
{
dispatchEvent(Event::create(eventNames().loadEvent, false, false));
@@ -482,9 +475,9 @@ IconType HTMLLinkElement::iconType() const
return m_relAttribute.iconType;
}

String HTMLLinkElement::iconSizes()
String HTMLLinkElement::iconSizes() const
{
return sizes().toString();
return m_sizes->toString();
}

void HTMLLinkElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
@@ -24,10 +24,10 @@
#ifndef HTMLLinkElement_h
#define HTMLLinkElement_h

#include "AttributeDOMTokenList.h"
#include "CSSStyleSheet.h"
#include "CachedStyleSheetClient.h"
#include "CachedResourceHandle.h"
#include "DOMSettableTokenList.h"
#include "HTMLElement.h"
#include "LinkLoader.h"
#include "LinkLoaderClient.h"
@@ -57,15 +57,15 @@ class HTMLLinkElement final : public HTMLElement, public CachedStyleSheetClient,
IconType iconType() const;

// the icon size string as parsed from the HTML attribute
String iconSizes();
String iconSizes() const;

CSSStyleSheet* sheet() const { return m_sheet.get(); }

bool styleSheetIsLoading() const;

bool isDisabled() const { return m_disabledState == Disabled; }
bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; }
DOMSettableTokenList& sizes();
DOMSettableTokenList& sizes() { return m_sizes.get(); }

void dispatchPendingEvent(LinkEventSender*);
static void dispatchPendingLoadEvents();
@@ -128,7 +128,7 @@ class HTMLLinkElement final : public HTMLElement, public CachedStyleSheetClient,

String m_type;
String m_media;
std::unique_ptr<AttributeDOMTokenList> m_sizes;
Ref<DOMSettableTokenList> m_sizes;
DisabledState m_disabledState;
LinkRelAttribute m_relAttribute;
bool m_loading;
@@ -37,13 +37,12 @@

namespace WebCore {

using namespace HTMLNames;

inline HTMLOutputElement::HTMLOutputElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form)
: HTMLFormControlElement(tagName, document, form)
, m_isDefaultValueMode(true)
, m_isSetTextContentInProgress(false)
, m_defaultValue("")
, m_tokens(DOMSettableTokenList::create())
{
}

@@ -65,13 +64,17 @@ bool HTMLOutputElement::supportsFocus() const

void HTMLOutputElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == forAttr) {
if (m_tokens)
m_tokens->attributeValueChanged(value);
} else
if (name == HTMLNames::forAttr)
setFor(value);
else
HTMLFormControlElement::parseAttribute(name, value);
}

void HTMLOutputElement::setFor(const String& value)
{
m_tokens->setValue(value);
}

void HTMLOutputElement::childrenChanged(const ChildChange& change)
{
HTMLFormControlElement::childrenChanged(change);
@@ -126,13 +129,6 @@ void HTMLOutputElement::setDefaultValue(const String& value)
setTextContentInternal(value);
}

DOMSettableTokenList& HTMLOutputElement::htmlFor()
{
if (!m_tokens)
m_tokens = std::make_unique<AttributeDOMTokenList>(*this, forAttr);
return *m_tokens;
}

void HTMLOutputElement::setTextContentInternal(const String& value)
{
ASSERT(!m_isSetTextContentInProgress);
@@ -31,7 +31,7 @@
#ifndef HTMLOutputElement_h
#define HTMLOutputElement_h

#include "AttributeDOMTokenList.h"
#include "DOMSettableTokenList.h"
#include "HTMLFormControlElement.h"

namespace WebCore {
@@ -44,7 +44,8 @@ class HTMLOutputElement final : public HTMLFormControlElement {
void setValue(const String&);
String defaultValue() const;
void setDefaultValue(const String&);
DOMSettableTokenList& htmlFor();
void setFor(const String&);
DOMSettableTokenList& htmlFor() { return m_tokens.get(); }

virtual bool canContainRangeEndPoint() const override { return false; }

@@ -65,7 +66,7 @@ class HTMLOutputElement final : public HTMLFormControlElement {
bool m_isDefaultValueMode;
bool m_isSetTextContentInProgress;
String m_defaultValue;
std::unique_ptr<AttributeDOMTokenList> m_tokens;
Ref<DOMSettableTokenList> m_tokens;
};

} // namespace
@@ -23,7 +23,9 @@
*/

interface HTMLOutputElement : HTMLElement {
[PutForwards=value] readonly attribute DOMSettableTokenList htmlFor;
// FIXME: This is supposed to be:
// [PutForwards=value] readonly attribute DOMSettableTokenList htmlFor;
readonly attribute DOMSettableTokenList htmlFor;

readonly attribute HTMLFormElement form;
[Reflect] attribute DOMString name;

0 comments on commit 1becb94

Please sign in to comment.