diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
commit | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch) | |
tree | 52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/WebCore/html | |
parent | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff) | |
download | qtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz |
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/WebCore/html')
216 files changed, 1587 insertions, 1811 deletions
diff --git a/Source/WebCore/html/CheckboxInputType.cpp b/Source/WebCore/html/CheckboxInputType.cpp index ed83517b9..4e9663443 100644 --- a/Source/WebCore/html/CheckboxInputType.cpp +++ b/Source/WebCore/html/CheckboxInputType.cpp @@ -101,4 +101,9 @@ bool CheckboxInputType::isCheckbox() const return true; } +bool CheckboxInputType::supportsIndeterminateAppearance() const +{ + return true; +} + } // namespace WebCore diff --git a/Source/WebCore/html/CheckboxInputType.h b/Source/WebCore/html/CheckboxInputType.h index 160c39124..c4c009a39 100644 --- a/Source/WebCore/html/CheckboxInputType.h +++ b/Source/WebCore/html/CheckboxInputType.h @@ -48,6 +48,7 @@ private: virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE; virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE; virtual bool isCheckbox() const OVERRIDE; + virtual bool supportsIndeterminateAppearance() const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/ColorInputType.cpp b/Source/WebCore/html/ColorInputType.cpp index d7bd81f4c..071cc3416 100644 --- a/Source/WebCore/html/ColorInputType.cpp +++ b/Source/WebCore/html/ColorInputType.cpp @@ -178,7 +178,7 @@ void ColorInputType::updateColorSwatch() if (!colorSwatch) return; - colorSwatch->style()->setProperty(CSSPropertyBackgroundColor, element()->value(), false, ASSERT_NO_EXCEPTION); + colorSwatch->ensureInlineStyleDecl()->setProperty(CSSPropertyBackgroundColor, element()->value(), false); } HTMLElement* ColorInputType::shadowColorSwatch() const diff --git a/Source/WebCore/html/ColorInputType.h b/Source/WebCore/html/ColorInputType.h index d51deaa7d..3e064bd44 100644 --- a/Source/WebCore/html/ColorInputType.h +++ b/Source/WebCore/html/ColorInputType.h @@ -54,12 +54,12 @@ private: virtual bool supportsRequired() const OVERRIDE; virtual String fallbackValue() const OVERRIDE; virtual String sanitizeValue(const String&) const OVERRIDE; - virtual Color valueAsColor() const OVERRIDE; virtual void createShadowSubtree() OVERRIDE; virtual void setValue(const String&, bool valueChanged, bool sendChangeEvent) OVERRIDE; virtual void handleDOMActivateEvent(Event*) OVERRIDE; virtual void detach() OVERRIDE; + Color valueAsColor() const; void endColorChooser(); void updateColorSwatch(); HTMLElement* shadowColorSwatch() const; diff --git a/Source/WebCore/html/DOMFormData.idl b/Source/WebCore/html/DOMFormData.idl index 992f04766..73ac211e1 100644 --- a/Source/WebCore/html/DOMFormData.idl +++ b/Source/WebCore/html/DOMFormData.idl @@ -32,8 +32,8 @@ module html { interface [ CustomConstructor, - GenerateNativeConverter, - GenerateToJS + JSGenerateToNativeObject, + JSGenerateToJS ] DOMFormData { // void append(DOMString name, DOMString value); // void append(DOMString name, Blob value, optional DOMString filename); diff --git a/Source/WebCore/html/DOMSettableTokenList.idl b/Source/WebCore/html/DOMSettableTokenList.idl index 02c6500b0..f0646e5a0 100644 --- a/Source/WebCore/html/DOMSettableTokenList.idl +++ b/Source/WebCore/html/DOMSettableTokenList.idl @@ -25,8 +25,8 @@ module core { interface [ - HasIndexGetter, - GenerateToJS + IndexedGetter, + JSGenerateToJS ] DOMSettableTokenList : DOMTokenList { attribute DOMString value; }; diff --git a/Source/WebCore/html/DOMTokenList.idl b/Source/WebCore/html/DOMTokenList.idl index 0bcc4889f..88169acb9 100644 --- a/Source/WebCore/html/DOMTokenList.idl +++ b/Source/WebCore/html/DOMTokenList.idl @@ -25,8 +25,8 @@ module core { interface [ - GenerateIsReachable=ImplElementRoot, - HasIndexGetter + JSGenerateIsReachable=ImplElementRoot, + IndexedGetter ] DOMTokenList { readonly attribute unsigned long length; [ConvertNullStringTo=Null] DOMString item(in unsigned long index); @@ -36,7 +36,7 @@ module core { boolean toggle(in DOMString token) raises(DOMException); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif }; diff --git a/Source/WebCore/html/DOMURL.cpp b/Source/WebCore/html/DOMURL.cpp index e42060d48..086bf778c 100644 --- a/Source/WebCore/html/DOMURL.cpp +++ b/Source/WebCore/html/DOMURL.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Motorola Mobility Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,11 +30,15 @@ #include "DOMURL.h" +#include "ActiveDOMObject.h" #include "Blob.h" #include "BlobURL.h" #include "KURL.h" +#include "PublicURLManager.h" #include "ScriptExecutionContext.h" +#include "SecurityOrigin.h" #include "ThreadableBlobRegistry.h" +#include <wtf/PassOwnPtr.h> #include <wtf/MainThread.h> #if ENABLE(MEDIA_STREAM) @@ -43,37 +48,13 @@ namespace WebCore { -DOMURL::DOMURL(ScriptExecutionContext* scriptExecutionContext) - : ContextDestructionObserver(scriptExecutionContext) -{ -} - -DOMURL::~DOMURL() -{ -} - -void DOMURL::contextDestroyed() -{ - ContextDestructionObserver::contextDestroyed(); - - HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end(); - for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publicBlobURLsEnd; ++iter) - ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter)); - -#if ENABLE(MEDIA_STREAM) - HashSet<String>::iterator publicStreamURLsEnd = m_publicStreamURLs.end(); - for (HashSet<String>::iterator iter = m_publicStreamURLs.begin(); iter != publicStreamURLsEnd; ++iter) - MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter)); -#endif -} - #if ENABLE(MEDIA_STREAM) -String DOMURL::createObjectURL(MediaStream* stream) +String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaStream* stream) { - if (!m_scriptExecutionContext || !stream) + if (!scriptExecutionContext || !stream) return String(); - KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin()); + KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin()); if (publicURL.isEmpty()) return String(); @@ -81,46 +62,48 @@ String DOMURL::createObjectURL(MediaStream* stream) ASSERT(isMainThread()); MediaStreamRegistry::registry().registerMediaStreamURL(publicURL, stream); - m_publicStreamURLs.add(publicURL.string()); + scriptExecutionContext->publicURLManager().streamURLs().add(publicURL.string()); return publicURL.string(); } #endif -String DOMURL::createObjectURL(Blob* blob) +String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob) { - if (!m_scriptExecutionContext || !blob) + if (!scriptExecutionContext || !blob) return String(); - KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin()); + KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin()); if (publicURL.isEmpty()) return String(); ThreadableBlobRegistry::registerBlobURL(publicURL, blob->url()); - m_publicBlobURLs.add(publicURL.string()); + scriptExecutionContext->publicURLManager().blobURLs().add(publicURL.string()); return publicURL.string(); } -void DOMURL::revokeObjectURL(const String& urlString) +void DOMURL::revokeObjectURL(ScriptExecutionContext* scriptExecutionContext, const String& urlString) { - if (!m_scriptExecutionContext) + if (!scriptExecutionContext) return; KURL url(KURL(), urlString); - if (m_publicBlobURLs.contains(url.string())) { + HashSet<String>& blobURLs = scriptExecutionContext->publicURLManager().blobURLs(); + if (blobURLs.contains(url.string())) { ThreadableBlobRegistry::unregisterBlobURL(url); - m_publicBlobURLs.remove(url.string()); + blobURLs.remove(url.string()); } #if ENABLE(MEDIA_STREAM) - if (m_publicStreamURLs.contains(url.string())) { + HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().streamURLs(); + if (streamURLs.contains(url.string())) { // FIXME: make sure of this assertion below. Raise a spec question if required. // Since WebWorkers cannot obtain Stream objects, we should be on the main thread. ASSERT(isMainThread()); MediaStreamRegistry::registry().unregisterMediaStreamURL(url); - m_publicStreamURLs.remove(url.string()); + streamURLs.remove(url.string()); } #endif } diff --git a/Source/WebCore/html/DOMURL.h b/Source/WebCore/html/DOMURL.h index d02fe887c..25ae013eb 100644 --- a/Source/WebCore/html/DOMURL.h +++ b/Source/WebCore/html/DOMURL.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Motorola Mobility Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,9 +27,7 @@ #ifndef DOMURL_h #define DOMURL_h -#if ENABLE(BLOB) - -#include "ActiveDOMObject.h" +#include "KURL.h" #include "PlatformString.h" #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> @@ -40,30 +39,22 @@ class Blob; class MediaStream; class ScriptExecutionContext; -class DOMURL : public RefCounted<DOMURL>, public ContextDestructionObserver { -public: - static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); } - ~DOMURL(); - -#if ENABLE(MEDIA_STREAM) - String createObjectURL(MediaStream*); -#endif - String createObjectURL(Blob*); - void revokeObjectURL(const String&); +class DOMURL : public RefCounted<DOMURL> { -private: - explicit DOMURL(ScriptExecutionContext*); +public: + static PassRefPtr<DOMURL> create() { return adoptRef(new DOMURL); } - virtual void contextDestroyed(); +#if ENABLE(BLOB) + static void contextDestroyed(ScriptExecutionContext*); - HashSet<String> m_publicBlobURLs; + static String createObjectURL(ScriptExecutionContext*, Blob*); + static void revokeObjectURL(ScriptExecutionContext*, const String&); #if ENABLE(MEDIA_STREAM) - HashSet<String> m_publicStreamURLs; + static String createObjectURL(ScriptExecutionContext*, MediaStream*); +#endif #endif }; } // namespace WebCore -#endif // ENABLE(BLOB) - #endif // DOMURL_h diff --git a/Source/WebCore/html/DOMURL.idl b/Source/WebCore/html/DOMURL.idl index d6d55790f..4f9722df3 100644 --- a/Source/WebCore/html/DOMURL.idl +++ b/Source/WebCore/html/DOMURL.idl @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Motorola Mobility Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,15 +27,15 @@ module html { interface [ Conditional=BLOB, - OmitConstructor, - GenerateNativeConverter, - GenerateToJS, - NoStaticTables + Constructor, + JSGenerateToNativeObject, + JSGenerateToJS, + JSNoStaticTables ] DOMURL { #if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM - [ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream); + static [CallWith=ScriptExecutionContext,ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream); #endif - [ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob); - void revokeObjectURL(in DOMString url); + static [CallWith=ScriptExecutionContext,ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob); + static [CallWith=ScriptExecutionContext] void revokeObjectURL(in DOMString url); }; } diff --git a/Source/WebCore/html/HTMLAllCollection.idl b/Source/WebCore/html/HTMLAllCollection.idl index 33e459b6a..3068e40fd 100644 --- a/Source/WebCore/html/HTMLAllCollection.idl +++ b/Source/WebCore/html/HTMLAllCollection.idl @@ -26,11 +26,11 @@ module html { interface [ - HasIndexGetter, - HasNameGetter, + IndexedGetter, + NamedGetter, CustomCall, MasqueradesAsUndefined, - GenerateIsReachable + JSGenerateIsReachable ] HTMLAllCollection { readonly attribute unsigned long length; [Custom] Node item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp index 6cfce16df..8b932b4fa 100644 --- a/Source/WebCore/html/HTMLAnchorElement.cpp +++ b/Source/WebCore/html/HTMLAnchorElement.cpp @@ -210,7 +210,7 @@ void HTMLAnchorElement::setActive(bool down, bool pause) ContainerNode::setActive(down, pause); } -void HTMLAnchorElement::parseMappedAttribute(Attribute* attr) +void HTMLAnchorElement::parseAttribute(Attribute* attr) { if (attr->name() == hrefAttr) { bool wasLink = isLink(); @@ -234,7 +234,7 @@ void HTMLAnchorElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == relAttr) setRel(attr->value()); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLAnchorElement::accessKeyAction(bool sendMouseEvents) diff --git a/Source/WebCore/html/HTMLAnchorElement.h b/Source/WebCore/html/HTMLAnchorElement.h index 99a6332ce..1fec65864 100644 --- a/Source/WebCore/html/HTMLAnchorElement.h +++ b/Source/WebCore/html/HTMLAnchorElement.h @@ -103,7 +103,7 @@ public: protected: HTMLAnchorElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; private: virtual bool supportsFocus() const; diff --git a/Source/WebCore/html/HTMLAnchorElement.idl b/Source/WebCore/html/HTMLAnchorElement.idl index 898f9eab7..3c40b73b6 100644 --- a/Source/WebCore/html/HTMLAnchorElement.idl +++ b/Source/WebCore/html/HTMLAnchorElement.idl @@ -43,21 +43,21 @@ module html { readonly attribute DOMString protocol; readonly attribute DOMString search; #else - attribute [TreatNullAs=EmptyString] DOMString hash; - attribute [TreatNullAs=EmptyString] DOMString host; - attribute [TreatNullAs=EmptyString] DOMString hostname; - attribute [TreatNullAs=EmptyString] DOMString pathname; - attribute [TreatNullAs=EmptyString] DOMString port; - attribute [TreatNullAs=EmptyString] DOMString protocol; - attribute [TreatNullAs=EmptyString] DOMString search; + attribute [TreatNullAs=NullString] DOMString hash; + attribute [TreatNullAs=NullString] DOMString host; + attribute [TreatNullAs=NullString] DOMString hostname; + attribute [TreatNullAs=NullString] DOMString pathname; + attribute [TreatNullAs=NullString] DOMString port; + attribute [TreatNullAs=NullString] DOMString protocol; + attribute [TreatNullAs=NullString] DOMString search; - readonly attribute [TreatNullAs=EmptyString] DOMString origin; + readonly attribute [TreatNullAs=NullString] DOMString origin; #endif readonly attribute DOMString text; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C diff --git a/Source/WebCore/html/HTMLAppletElement.cpp b/Source/WebCore/html/HTMLAppletElement.cpp index 14ba11feb..df55cd901 100644 --- a/Source/WebCore/html/HTMLAppletElement.cpp +++ b/Source/WebCore/html/HTMLAppletElement.cpp @@ -47,7 +47,7 @@ PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tag return adoptRef(new HTMLAppletElement(tagName, document)); } -void HTMLAppletElement::parseMappedAttribute(Attribute* attr) +void HTMLAppletElement::parseAttribute(Attribute* attr) { if (attr->name() == altAttr || attr->name() == archiveAttr || @@ -57,7 +57,7 @@ void HTMLAppletElement::parseMappedAttribute(Attribute* attr) attr->name() == objectAttr) { // Do nothing. } else - HTMLPlugInElement::parseMappedAttribute(attr); + HTMLPlugInElement::parseAttribute(attr); } bool HTMLAppletElement::rendererIsNeeded(const NodeRenderingContext& context) diff --git a/Source/WebCore/html/HTMLAppletElement.h b/Source/WebCore/html/HTMLAppletElement.h index e5387d99a..49e29b5e0 100644 --- a/Source/WebCore/html/HTMLAppletElement.h +++ b/Source/WebCore/html/HTMLAppletElement.h @@ -34,7 +34,7 @@ public: private: HTMLAppletElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/html/HTMLAppletElement.idl b/Source/WebCore/html/HTMLAppletElement.idl index 388b5cb23..6a683d7fc 100644 --- a/Source/WebCore/html/HTMLAppletElement.idl +++ b/Source/WebCore/html/HTMLAppletElement.idl @@ -21,8 +21,8 @@ module html { interface [ - DelegatingPutFunction, - DelegatingGetOwnPropertySlot, + CustomNamedSetter, + JSCustomGetOwnPropertySlotDelegate, CustomCall ] HTMLAppletElement : HTMLElement { attribute [Reflect] DOMString align; diff --git a/Source/WebCore/html/HTMLAreaElement.cpp b/Source/WebCore/html/HTMLAreaElement.cpp index b00471678..57b5f768d 100644 --- a/Source/WebCore/html/HTMLAreaElement.cpp +++ b/Source/WebCore/html/HTMLAreaElement.cpp @@ -52,7 +52,7 @@ PassRefPtr<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName return adoptRef(new HTMLAreaElement(tagName, document)); } -void HTMLAreaElement::parseMappedAttribute(Attribute* attr) +void HTMLAreaElement::parseAttribute(Attribute* attr) { if (attr->name() == shapeAttr) { if (equalIgnoringCase(attr->value(), "default")) @@ -70,7 +70,7 @@ void HTMLAreaElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) { // Do nothing. } else - HTMLAnchorElement::parseMappedAttribute(attr); + HTMLAnchorElement::parseAttribute(attr); } void HTMLAreaElement::invalidateCachedRegion() diff --git a/Source/WebCore/html/HTMLAreaElement.h b/Source/WebCore/html/HTMLAreaElement.h index 817391861..0970af8cd 100644 --- a/Source/WebCore/html/HTMLAreaElement.h +++ b/Source/WebCore/html/HTMLAreaElement.h @@ -50,7 +50,7 @@ public: private: HTMLAreaElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool supportsFocus() const; virtual String target() const; virtual bool isKeyboardFocusable(KeyboardEvent*) const; diff --git a/Source/WebCore/html/HTMLBRElement.cpp b/Source/WebCore/html/HTMLBRElement.cpp index 263906010..5efe6379a 100644 --- a/Source/WebCore/html/HTMLBRElement.cpp +++ b/Source/WebCore/html/HTMLBRElement.cpp @@ -48,30 +48,21 @@ PassRefPtr<HTMLBRElement> HTMLBRElement::create(const QualifiedName& tagName, Do return adoptRef(new HTMLBRElement(tagName, document)); } -bool HTMLBRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == clearAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLBRElement::parseMappedAttribute(Attribute* attr) +void HTMLBRElement::parseAttribute(Attribute* attr) { if (attr->name() == clearAttr) { // If the string is empty, then don't add the clear property. // <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh - const AtomicString& str = attr->value(); - if (!str.isEmpty()) { - if (equalIgnoringCase(str, "all")) - addCSSProperty(attr, CSSPropertyClear, "both"); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyClear); + else if (!attr->value().isEmpty()) { + if (equalIgnoringCase(attr->value(), "all")) + addCSSProperty(CSSPropertyClear, "both"); else - addCSSProperty(attr, CSSPropertyClear, str); + addCSSProperty(CSSPropertyClear, attr->value()); } } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } RenderObject* HTMLBRElement::createRenderer(RenderArena* arena, RenderStyle* style) diff --git a/Source/WebCore/html/HTMLBRElement.h b/Source/WebCore/html/HTMLBRElement.h index 3857a9ba6..10a6432c7 100644 --- a/Source/WebCore/html/HTMLBRElement.h +++ b/Source/WebCore/html/HTMLBRElement.h @@ -38,8 +38,7 @@ public: private: HTMLBRElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); }; diff --git a/Source/WebCore/html/HTMLBaseElement.cpp b/Source/WebCore/html/HTMLBaseElement.cpp index 9df2ad758..b3da89a16 100644 --- a/Source/WebCore/html/HTMLBaseElement.cpp +++ b/Source/WebCore/html/HTMLBaseElement.cpp @@ -42,12 +42,12 @@ PassRefPtr<HTMLBaseElement> HTMLBaseElement::create(const QualifiedName& tagName return adoptRef(new HTMLBaseElement(tagName, document)); } -void HTMLBaseElement::parseMappedAttribute(Attribute* attribute) +void HTMLBaseElement::parseAttribute(Attribute* attribute) { if (attribute->name() == hrefAttr || attribute->name() == targetAttr) document()->processBaseElement(); else - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } void HTMLBaseElement::insertedIntoDocument() diff --git a/Source/WebCore/html/HTMLBaseElement.h b/Source/WebCore/html/HTMLBaseElement.h index fd3cef616..5f526a606 100644 --- a/Source/WebCore/html/HTMLBaseElement.h +++ b/Source/WebCore/html/HTMLBaseElement.h @@ -36,7 +36,7 @@ private: virtual String target() const; virtual bool isURLAttribute(Attribute*) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); }; diff --git a/Source/WebCore/html/HTMLBodyElement.cpp b/Source/WebCore/html/HTMLBodyElement.cpp index 6558d46d6..a769a2c21 100644 --- a/Source/WebCore/html/HTMLBodyElement.cpp +++ b/Source/WebCore/html/HTMLBodyElement.cpp @@ -60,46 +60,43 @@ HTMLBodyElement::~HTMLBodyElement() { } -bool HTMLBodyElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == backgroundAttr) { - result = (MappedAttributeEntry)(eLastEntry + document()->docID()); - return false; - } - - if (attrName == bgcolorAttr || - attrName == textAttr || - attrName == marginwidthAttr || - attrName == leftmarginAttr || - attrName == marginheightAttr || - attrName == topmarginAttr || - attrName == bgpropertiesAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLBodyElement::parseMappedAttribute(Attribute* attr) +void HTMLBodyElement::parseAttribute(Attribute* attr) { if (attr->name() == backgroundAttr) { String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (!url.isEmpty()) - addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); + addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); + else + removeCSSProperty(CSSPropertyBackgroundImage); } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) { - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginRight, CSSPropertyMarginLeft); + else { + addCSSLength(CSSPropertyMarginRight, attr->value()); + addCSSLength(CSSPropertyMarginLeft, attr->value()); + } } else if (attr->name() == marginheightAttr || attr->name() == topmarginAttr) { - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginBottom, CSSPropertyMarginTop); + else { + addCSSLength(CSSPropertyMarginBottom, attr->value()); + addCSSLength(CSSPropertyMarginTop, attr->value()); + } } else if (attr->name() == bgcolorAttr) { - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyBackgroundColor); + else + addCSSColor(CSSPropertyBackgroundColor, attr->value()); } else if (attr->name() == textAttr) { - addCSSColor(attr, CSSPropertyColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyColor); + else + addCSSColor(CSSPropertyColor, attr->value()); } else if (attr->name() == bgpropertiesAttr) { if (equalIgnoringCase(attr->value(), "fixed")) - addCSSProperty(attr, CSSPropertyBackgroundAttachment, CSSValueFixed); + addCSSProperty(CSSPropertyBackgroundAttachment, CSSValueFixed); + else + removeCSSProperty(CSSPropertyBackgroundAttachment); } else if (attr->name() == vlinkAttr || attr->name() == alinkAttr || attr->name() == linkAttr) { @@ -159,13 +156,15 @@ void HTMLBodyElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onofflineAttr) document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLBodyElement::insertedIntoDocument() { HTMLElement::insertedIntoDocument(); + ASSERT(document()); + // FIXME: Perhaps this code should be in attach() instead of here. Element* ownerElement = document()->ownerElement(); if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) { @@ -183,8 +182,7 @@ void HTMLBodyElement::insertedIntoDocument() if (FrameView* view = document()->view()) view->scheduleRelayout(); - if (document() && document()->page()) - document()->page()->updateViewportArguments(); + document()->updateViewportArguments(); } bool HTMLBodyElement::isURLAttribute(Attribute *attr) const diff --git a/Source/WebCore/html/HTMLBodyElement.h b/Source/WebCore/html/HTMLBodyElement.h index 5c632649c..8004b10da 100644 --- a/Source/WebCore/html/HTMLBodyElement.h +++ b/Source/WebCore/html/HTMLBodyElement.h @@ -70,8 +70,7 @@ public: private: HTMLBodyElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); diff --git a/Source/WebCore/html/HTMLBodyElement.idl b/Source/WebCore/html/HTMLBodyElement.idl index d6851d49b..a6b7f567d 100644 --- a/Source/WebCore/html/HTMLBodyElement.idl +++ b/Source/WebCore/html/HTMLBodyElement.idl @@ -30,29 +30,29 @@ module html { #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler attributes - attribute [DontEnum, WindowEventListener] EventListener onbeforeunload; - attribute [DontEnum, WindowEventListener] EventListener onhashchange; - attribute [DontEnum, WindowEventListener] EventListener onmessage; - attribute [DontEnum, WindowEventListener] EventListener onoffline; - attribute [DontEnum, WindowEventListener] EventListener ononline; - attribute [DontEnum, WindowEventListener] EventListener onpopstate; - attribute [DontEnum, WindowEventListener] EventListener onresize; - attribute [DontEnum, WindowEventListener] EventListener onstorage; - attribute [DontEnum, WindowEventListener] EventListener onunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onhashchange; + attribute [NotEnumerable, JSWindowEventListener] EventListener onmessage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onoffline; + attribute [NotEnumerable, JSWindowEventListener] EventListener ononline; + attribute [NotEnumerable, JSWindowEventListener] EventListener onpopstate; + attribute [NotEnumerable, JSWindowEventListener] EventListener onresize; + attribute [NotEnumerable, JSWindowEventListener] EventListener onstorage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onunload; - attribute [Conditional=ORIENTATION_EVENTS, DontEnum, WindowEventListener] EventListener onorientationchange; + attribute [Conditional=ORIENTATION_EVENTS, NotEnumerable, JSWindowEventListener] EventListener onorientationchange; // Overrides of Element attributes (with different implementation in bindings). - attribute [DontEnum, WindowEventListener] EventListener onblur; - attribute [DontEnum, WindowEventListener] EventListener onerror; - attribute [DontEnum, WindowEventListener] EventListener onfocus; - attribute [DontEnum, WindowEventListener] EventListener onload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onblur; + attribute [NotEnumerable, JSWindowEventListener] EventListener onerror; + attribute [NotEnumerable, JSWindowEventListener] EventListener onfocus; + attribute [NotEnumerable, JSWindowEventListener] EventListener onload; // Not implemented yet. - // attribute [DontEnum, WindowEventListener] EventListener onafterprint; - // attribute [DontEnum, WindowEventListener] EventListener onbeforeprint; - // attribute [DontEnum, WindowEventListener] EventListener onredo; - // attribute [DontEnum, WindowEventListener] EventListener onundo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; #endif }; diff --git a/Source/WebCore/html/HTMLButtonElement.cpp b/Source/WebCore/html/HTMLButtonElement.cpp index 54c907dc0..1468248b9 100644 --- a/Source/WebCore/html/HTMLButtonElement.cpp +++ b/Source/WebCore/html/HTMLButtonElement.cpp @@ -79,7 +79,7 @@ const AtomicString& HTMLButtonElement::formControlType() const return emptyAtom; } -void HTMLButtonElement::parseMappedAttribute(Attribute* attr) +void HTMLButtonElement::parseAttribute(Attribute* attr) { if (attr->name() == typeAttr) { if (equalIgnoringCase(attr->value(), "reset")) @@ -93,7 +93,7 @@ void HTMLButtonElement::parseMappedAttribute(Attribute* attr) // Don't map 'align' attribute. This matches what Firefox and IE do, but not Opera. // See http://bugs.webkit.org/show_bug.cgi?id=12071 } else - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } void HTMLButtonElement::defaultEventHandler(Event* event) diff --git a/Source/WebCore/html/HTMLButtonElement.h b/Source/WebCore/html/HTMLButtonElement.h index 374eb3e97..9699bef0e 100644 --- a/Source/WebCore/html/HTMLButtonElement.h +++ b/Source/WebCore/html/HTMLButtonElement.h @@ -43,7 +43,7 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void defaultEventHandler(Event*); virtual bool appendFormData(FormDataList&, bool); diff --git a/Source/WebCore/html/HTMLButtonElement.idl b/Source/WebCore/html/HTMLButtonElement.idl index c91947bb3..b8b8621f9 100644 --- a/Source/WebCore/html/HTMLButtonElement.idl +++ b/Source/WebCore/html/HTMLButtonElement.idl @@ -24,8 +24,8 @@ module html { readonly attribute HTMLFormElement form; attribute [Reflect, URL] DOMString formAction; - attribute [TreatNullAs=EmptyString] DOMString formEnctype; - attribute [TreatNullAs=EmptyString] DOMString formMethod; + attribute [TreatNullAs=NullString] DOMString formEnctype; + attribute [TreatNullAs=NullString] DOMString formMethod; attribute [Reflect] boolean formNoValidate; attribute [Reflect] DOMString formTarget; readonly attribute ValidityState validity; @@ -39,7 +39,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); void click(); diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp index 143d33475..9cf78d403 100644 --- a/Source/WebCore/html/HTMLCanvasElement.cpp +++ b/Source/WebCore/html/HTMLCanvasElement.cpp @@ -105,12 +105,12 @@ HTMLCanvasElement::~HTMLCanvasElement() m_context.clear(); // Ensure this goes away before the ImageBuffer. } -void HTMLCanvasElement::parseMappedAttribute(Attribute* attr) +void HTMLCanvasElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); if (attrName == widthAttr || attrName == heightAttr) reset(); - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } RenderObject* HTMLCanvasElement::createRenderer(RenderArena* arena, RenderStyle* style) @@ -177,7 +177,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas #if ENABLE(WEBGL) Settings* settings = document()->settings(); if (settings && settings->webGLEnabled() -#if !PLATFORM(CHROMIUM) && !PLATFORM(GTK) +#if !PLATFORM(CHROMIUM) && !PLATFORM(GTK) && !PLATFORM(EFL) && settings->acceleratedCompositingEnabled() #endif ) { diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h index 0493902b2..967444d0c 100644 --- a/Source/WebCore/html/HTMLCanvasElement.h +++ b/Source/WebCore/html/HTMLCanvasElement.h @@ -137,7 +137,7 @@ public: private: HTMLCanvasElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); void reset(); diff --git a/Source/WebCore/html/HTMLCanvasElement.idl b/Source/WebCore/html/HTMLCanvasElement.idl index 50d4ae461..35a806c65 100644 --- a/Source/WebCore/html/HTMLCanvasElement.idl +++ b/Source/WebCore/html/HTMLCanvasElement.idl @@ -27,13 +27,13 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLCanvasElement : HTMLElement { attribute long width; attribute long height; - [Custom] DOMString toDataURL(in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString type) + [Custom] DOMString toDataURL(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString type) raises(DOMException); #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP diff --git a/Source/WebCore/html/HTMLCollection.idl b/Source/WebCore/html/HTMLCollection.idl index 8fa2309cc..a4d172d1a 100644 --- a/Source/WebCore/html/HTMLCollection.idl +++ b/Source/WebCore/html/HTMLCollection.idl @@ -21,11 +21,11 @@ module html { interface [ - HasIndexGetter, - HasNameGetter, - CustomToJS, - GenerateIsReachable, - Polymorphic + IndexedGetter, + NamedGetter, + JSCustomToJS, + JSGenerateIsReachable, + ObjCPolymorphic ] HTMLCollection { readonly attribute unsigned long length; Node item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/html/HTMLDetailsElement.cpp b/Source/WebCore/html/HTMLDetailsElement.cpp index ddec73876..015cf61ce 100644 --- a/Source/WebCore/html/HTMLDetailsElement.cpp +++ b/Source/WebCore/html/HTMLDetailsElement.cpp @@ -62,6 +62,12 @@ class DetailsSummaryElement : public HTMLContentElement { public: static PassRefPtr<DetailsSummaryElement> create(Document*); + Element* fallbackSummary() + { + ASSERT(firstChild() && firstChild()->hasTagName(summaryTag)); + return toElement(firstChild()); + } + private: DetailsSummaryElement(Document* document) : HTMLContentElement(HTMLNames::divTag, document) @@ -72,20 +78,24 @@ private: PassRefPtr<DetailsSummaryElement> DetailsSummaryElement::create(Document* document) { - return adoptRef(new DetailsSummaryElement(document)); + RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document); + defaultSummary->appendChild(Text::create(document, defaultDetailsSummaryText()), ASSERT_NO_EXCEPTION); + + RefPtr<DetailsSummaryElement> elem = adoptRef(new DetailsSummaryElement(document)); + elem->appendChild(defaultSummary); + return elem.release(); } PassRefPtr<HTMLDetailsElement> HTMLDetailsElement::create(const QualifiedName& tagName, Document* document) { - RefPtr<HTMLDetailsElement> result = adoptRef(new HTMLDetailsElement(tagName, document)); - result->ensureShadowSubtreeOf(ForwardingSummary); - return result; + RefPtr<HTMLDetailsElement> elem = adoptRef(new HTMLDetailsElement(tagName, document)); + elem->createShadowSubtree(); + + return elem.release(); } HTMLDetailsElement::HTMLDetailsElement(const QualifiedName& tagName, Document* document) : HTMLElement(tagName, document) - , m_summaryType(NoSummary) - , m_mainSummary(0) , m_isOpen(false) { ASSERT(hasTagName(detailsTag)); @@ -96,86 +106,26 @@ RenderObject* HTMLDetailsElement::createRenderer(RenderArena* arena, RenderStyle return new (arena) RenderDetails(this); } -void HTMLDetailsElement::ensureShadowSubtreeOf(SummaryType type) -{ - if (type == m_summaryType) - return; - m_summaryType = type; - removeShadowRoot(); - createShadowSubtree(); -} - -static Node* findSummaryFor(PassRefPtr<ContainerNode> container) -{ - for (Node* child = container->firstChild(); child; child = child->nextSibling()) { - if (child->hasTagName(summaryTag)) - return child; - } - - return 0; -} - -Node* HTMLDetailsElement::ensureMainSummary() -{ - Node* summary = findSummaryFor(this); - if (summary) { - ensureShadowSubtreeOf(ForwardingSummary); - return summary; - } - - ensureShadowSubtreeOf(DefaultSummary); - return findSummaryFor(shadowRoot()); -} - -void HTMLDetailsElement::refreshMainSummary(RefreshRenderer refreshRenderer) -{ - RefPtr<Node> oldSummary = m_mainSummary; - m_mainSummary = ensureMainSummary(); - - if (oldSummary == m_mainSummary || !attached()) - return; - - if (oldSummary && oldSummary->parentNodeForRenderingAndStyle()) - oldSummary->reattach(); - if (m_mainSummary && refreshRenderer == RefreshRendererAllowed) - m_mainSummary->reattach(); -} - void HTMLDetailsElement::createShadowSubtree() { ASSERT(!shadowRoot()); - ExceptionCode ec = 0; - if (m_summaryType == DefaultSummary) { - RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document()); - defaultSummary->appendChild(Text::create(document(), defaultDetailsSummaryText()), ec); - ensureShadowRoot()->appendChild(defaultSummary, ec, true); - ensureShadowRoot()->appendChild(DetailsContentElement::create(document()), ec, true); - } else { - ASSERT(m_summaryType == ForwardingSummary); - ensureShadowRoot()->appendChild(DetailsSummaryElement::create(document()), ec, true); - ensureShadowRoot()->appendChild(DetailsContentElement::create(document()), ec, true); - } -} - -void HTMLDetailsElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) -{ - HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - // If childCountDelta is less then zero and the main summary has changed it must be because previous main - // summary was removed. The new main summary was then inside the unrevealed content and needs to be - // reattached to create its renderer. If childCountDelta is not less then zero then a new <summary> element - // has been added and it will be attached without our help. - if (!changedByParser) - refreshMainSummary(childCountDelta < 0 ? RefreshRendererAllowed : RefreshRendererSupressed); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(DetailsSummaryElement::create(document()), ASSERT_NO_EXCEPTION, true); + root->appendChild(DetailsContentElement::create(document()), ASSERT_NO_EXCEPTION, true); } -void HTMLDetailsElement::finishParsingChildren() +Element* HTMLDetailsElement::findMainSummary() const { - HTMLElement::finishParsingChildren(); - refreshMainSummary(RefreshRendererAllowed); + for (Node* child = firstChild(); child; child = child->nextSibling()) { + if (child->hasTagName(summaryTag)) + return toElement(child); + } + + return static_cast<DetailsSummaryElement*>(shadowRoot()->firstChild())->fallbackSummary(); } -void HTMLDetailsElement::parseMappedAttribute(Attribute* attr) +void HTMLDetailsElement::parseAttribute(Attribute* attr) { if (attr->name() == openAttr) { bool oldValue = m_isOpen; @@ -183,12 +133,18 @@ void HTMLDetailsElement::parseMappedAttribute(Attribute* attr) if (oldValue != m_isOpen) reattachIfAttached(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } bool HTMLDetailsElement::childShouldCreateRenderer(Node* child) const { - return m_isOpen || child == m_mainSummary; + if (m_isOpen) + return true; + + if (!child->hasTagName(summaryTag)) + return false; + + return child == findMainSummary(); } void HTMLDetailsElement::toggleOpen() diff --git a/Source/WebCore/html/HTMLDetailsElement.h b/Source/WebCore/html/HTMLDetailsElement.h index 0d8dda710..a86a365c6 100644 --- a/Source/WebCore/html/HTMLDetailsElement.h +++ b/Source/WebCore/html/HTMLDetailsElement.h @@ -28,37 +28,20 @@ namespace WebCore { class HTMLDetailsElement : public HTMLElement { public: static PassRefPtr<HTMLDetailsElement> create(const QualifiedName& tagName, Document* document); - Node* mainSummary() const { return m_mainSummary; } void toggleOpen(); -private: - enum RefreshRenderer { - RefreshRendererAllowed, - RefreshRendererSupressed, - }; - - enum SummaryType { - NoSummary, - DefaultSummary, - ForwardingSummary - }; + Element* findMainSummary() const; +private: HTMLDetailsElement(const QualifiedName&, Document*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta); - virtual void finishParsingChildren(); - void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; bool childShouldCreateRenderer(Node*) const; - Node* ensureMainSummary(); - void refreshMainSummary(RefreshRenderer); - void ensureShadowSubtreeOf(SummaryType); void createShadowSubtree(); - SummaryType m_summaryType; - Node* m_mainSummary; bool m_isOpen; }; diff --git a/Source/WebCore/html/HTMLDivElement.cpp b/Source/WebCore/html/HTMLDivElement.cpp index 23e6585fb..da2785c1f 100644 --- a/Source/WebCore/html/HTMLDivElement.cpp +++ b/Source/WebCore/html/HTMLDivElement.cpp @@ -48,28 +48,21 @@ PassRefPtr<HTMLDivElement> HTMLDivElement::create(const QualifiedName& tagName, return adoptRef(new HTMLDivElement(tagName, document)); } -bool HTMLDivElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr) { - result = eBlock; - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLDivElement::parseMappedAttribute(Attribute* attr) +void HTMLDivElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyTextAlign); if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); else if (equalIgnoringCase(attr->value(), "left")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitLeft); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); else if (equalIgnoringCase(attr->value(), "right")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitRight); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); else - addCSSProperty(attr, CSSPropertyTextAlign, attr->value()); + addCSSProperty(CSSPropertyTextAlign, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLDivElement.h b/Source/WebCore/html/HTMLDivElement.h index 2e2b41710..cd90d8728 100644 --- a/Source/WebCore/html/HTMLDivElement.h +++ b/Source/WebCore/html/HTMLDivElement.h @@ -36,8 +36,7 @@ protected: HTMLDivElement(const QualifiedName&, Document*); private: - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLDocument.idl b/Source/WebCore/html/HTMLDocument.idl index a7a6bcda6..dd020e2c5 100644 --- a/Source/WebCore/html/HTMLDocument.idl +++ b/Source/WebCore/html/HTMLDocument.idl @@ -21,9 +21,9 @@ module html { interface [ - HasOverridingNameGetter + CustomNamedGetter ] HTMLDocument : Document { - [Custom, NoCPPCustom] void open(); + [JSCustom, V8Custom] void open(); void close(); [Custom] void write(in [Optional=CallWithDefaultValue] DOMString text); [Custom] void writeln(in [Optional=CallWithDefaultValue] DOMString text); @@ -48,19 +48,19 @@ module html { readonly attribute long width; readonly attribute long height; #endif - attribute [TreatNullAs=EmptyString] DOMString dir; - attribute [TreatNullAs=EmptyString] DOMString designMode; + attribute [TreatNullAs=NullString] DOMString dir; + attribute [TreatNullAs=NullString] DOMString designMode; readonly attribute DOMString compatMode; readonly attribute Element activeElement; boolean hasFocus(); // Deprecated attributes - attribute [TreatNullAs=EmptyString] DOMString bgColor; - attribute [TreatNullAs=EmptyString] DOMString fgColor; - attribute [TreatNullAs=EmptyString] DOMString alinkColor; - attribute [TreatNullAs=EmptyString] DOMString linkColor; - attribute [TreatNullAs=EmptyString] DOMString vlinkColor; + attribute [TreatNullAs=NullString] DOMString bgColor; + attribute [TreatNullAs=NullString] DOMString fgColor; + attribute [TreatNullAs=NullString] DOMString alinkColor; + attribute [TreatNullAs=NullString] DOMString linkColor; + attribute [TreatNullAs=NullString] DOMString vlinkColor; }; } diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index 680c23b5d..a018fe23b 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -120,27 +120,6 @@ bool HTMLElement::ieForbidsInsertHTML() const return false; } -bool HTMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr - || attrName == contenteditableAttr - || attrName == hiddenAttr) { - result = eUniversal; - return false; - } - if (attrName == dirAttr) { - if (hasLocalName(bdoTag)) - result = eBDO; - else if (hasLocalName(bdiTag)) - result = eBDI; - else - result = eUniversal; - return true; - } - - return StyledElement::mapToEntry(attrName, result); -} - static inline int unicodeBidiAttributeForDirAuto(HTMLElement* element) { if (element->hasLocalName(preTag) || element->hasLocalName(textareaTag)) @@ -163,48 +142,53 @@ static unsigned parseBorderWidthAttribute(Attribute* attr) void HTMLElement::applyBorderAttribute(Attribute* attr) { - addCSSLength(attr, CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr))); - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSLength(CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr))); + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); } void HTMLElement::mapLanguageAttributeToLocale(Attribute* attribute) { ASSERT(attribute && (attribute->name() == langAttr || attribute->name().matches(XMLNames::langAttr))); const AtomicString& value = attribute->value(); - if (!value.isEmpty()) { + if (value.isNull()) + removeCSSProperty(CSSPropertyWebkitLocale); + else if (!value.isEmpty()) { // Have to quote so the locale id is treated as a string instead of as a CSS keyword. - addCSSProperty(attribute, CSSPropertyWebkitLocale, quoteCSSString(value)); + addCSSProperty(CSSPropertyWebkitLocale, quoteCSSString(value)); } else { // The empty string means the language is explicitly unknown. - addCSSProperty(attribute, CSSPropertyWebkitLocale, CSSValueAuto); + addCSSProperty(CSSPropertyWebkitLocale, CSSValueAuto); } setNeedsStyleRecalc(); } -void HTMLElement::parseMappedAttribute(Attribute* attr) +void HTMLElement::parseAttribute(Attribute* attr) { if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr) - return StyledElement::parseMappedAttribute(attr); + return StyledElement::parseAttribute(attr); - String indexstring; if (attr->name() == alignAttr) { - if (equalIgnoringCase(attr->value(), "middle")) - addCSSProperty(attr, CSSPropertyTextAlign, "center"); + if (attr->isNull()) + removeCSSProperty(CSSPropertyTextAlign); + else if (equalIgnoringCase(attr->value(), "middle")) + addCSSProperty(CSSPropertyTextAlign, "center"); else - addCSSProperty(attr, CSSPropertyTextAlign, attr->value()); + addCSSProperty(CSSPropertyTextAlign, attr->value()); } else if (attr->name() == contenteditableAttr) { setContentEditable(attr); } else if (attr->name() == hiddenAttr) { - addCSSProperty(attr, CSSPropertyDisplay, CSSValueNone); + if (attr->isNull()) + removeCSSProperty(CSSPropertyDisplay); + else + addCSSProperty(CSSPropertyDisplay, CSSValueNone); } else if (attr->name() == tabindexAttr) { - indexstring = getAttribute(tabindexAttr); int tabindex = 0; - if (!indexstring.length()) { + if (attr->isEmpty()) clearTabIndexExplicitly(); - } else if (parseHTMLInteger(indexstring, tabindex)) { + else if (parseHTMLInteger(attr->value(), tabindex)) { // Clamp tabindex to the range of 'short' to match Firefox's behavior. setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } @@ -215,21 +199,33 @@ void HTMLElement::parseMappedAttribute(Attribute* attr) if (!fastHasAttribute(XMLNames::langAttr)) mapLanguageAttributeToLocale(attr); } else if (attr->name() == dirAttr) { - bool dirIsAuto = equalIgnoringCase(attr->value(), "auto"); - if (!dirIsAuto) - addCSSProperty(attr, CSSPropertyDirection, attr->value()); - dirAttributeChanged(attr); - if (dirIsAuto) - addCSSProperty(attr, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); - else if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) - addCSSProperty(attr, CSSPropertyUnicodeBidi, CSSValueEmbed); + if (attr->isNull()) + removeCSSProperties(CSSPropertyDirection, CSSPropertyUnicodeBidi); + else { + bool dirIsAuto = equalIgnoringCase(attr->value(), "auto"); + if (!dirIsAuto) + addCSSProperty(CSSPropertyDirection, attr->value()); + else + removeCSSProperty(CSSPropertyDirection); + + dirAttributeChanged(attr); + if (dirIsAuto) + addCSSProperty(CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); + else if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) + addCSSProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); + else + removeCSSProperty(CSSPropertyUnicodeBidi); + } } else if (attr->name() == draggableAttr) { const AtomicString& value = attr->value(); if (equalIgnoringCase(value, "true")) { - addCSSProperty(attr, CSSPropertyWebkitUserDrag, CSSValueElement); - addCSSProperty(attr, CSSPropertyWebkitUserSelect, CSSValueNone); - } else if (equalIgnoringCase(value, "false")) - addCSSProperty(attr, CSSPropertyWebkitUserDrag, CSSValueNone); + addCSSProperty(CSSPropertyWebkitUserDrag, CSSValueElement); + addCSSProperty(CSSPropertyWebkitUserSelect, CSSValueNone); + } else if (equalIgnoringCase(value, "false")) { + addCSSProperty(CSSPropertyWebkitUserDrag, CSSValueNone); + removeCSSProperty(CSSPropertyWebkitUserSelect); + } else + removeCSSProperties(CSSPropertyWebkitUserDrag, CSSPropertyWebkitUserSelect); #if ENABLE(MICRODATA) } else if (attr->name() == itempropAttr) { setItemProp(attr->value()); @@ -687,6 +683,11 @@ void HTMLElement::addHTMLAlignment(Attribute* attr) addHTMLAlignmentToStyledElement(this, attr); } +void HTMLElement::removeHTMLAlignment() +{ + removeCSSProperties(CSSPropertyFloat, CSSPropertyVerticalAlign); +} + void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, Attribute* attr) { // Vertical alignment with respect to the current baseline of the text @@ -717,10 +718,14 @@ void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, Attrib verticalAlignValue = CSSValueTextTop; if (floatValue != CSSValueInvalid) - element->addCSSProperty(attr, CSSPropertyFloat, floatValue); + element->addCSSProperty(CSSPropertyFloat, floatValue); + else + element->removeCSSProperty(CSSPropertyFloat); if (verticalAlignValue != CSSValueInvalid) - element->addCSSProperty(attr, CSSPropertyVerticalAlign, verticalAlignValue); + element->addCSSProperty(CSSPropertyVerticalAlign, verticalAlignValue); + else + element->removeCSSProperty(CSSPropertyVerticalAlign); } bool HTMLElement::supportsFocus() const @@ -747,21 +752,21 @@ String HTMLElement::contentEditable() const void HTMLElement::setContentEditable(Attribute* attr) { const AtomicString& enabled = attr->value(); - if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) { - addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadWrite); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord); - addCSSProperty(attr, CSSPropertyWebkitNbspMode, CSSValueSpace); - addCSSProperty(attr, CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); + if (enabled.isNull()) + removeCSSProperties(CSSPropertyWebkitUserModify, CSSPropertyWordWrap, CSSPropertyWebkitNbspMode, CSSPropertyWebkitLineBreak); + else if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) { + addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadWrite); + addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); + addCSSProperty(CSSPropertyWebkitNbspMode, CSSValueSpace); + addCSSProperty(CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); } else if (equalIgnoringCase(enabled, "false")) { - addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadOnly); - removeCSSProperty(attr, CSSPropertyWordWrap); - removeCSSProperty(attr, CSSPropertyWebkitNbspMode); - removeCSSProperty(attr, CSSPropertyWebkitLineBreak); + addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadOnly); + removeCSSProperties(CSSPropertyWordWrap, CSSPropertyWebkitNbspMode, CSSPropertyWebkitLineBreak); } else if (equalIgnoringCase(enabled, "plaintext-only")) { - addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord); - addCSSProperty(attr, CSSPropertyWebkitNbspMode, CSSValueSpace); - addCSSProperty(attr, CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); + addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly); + addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); + addCSSProperty(CSSPropertyWebkitNbspMode, CSSValueSpace); + addCSSProperty(CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); } } diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h index a86b2b917..47197261a 100644 --- a/Source/WebCore/html/HTMLElement.h +++ b/Source/WebCore/html/HTMLElement.h @@ -94,9 +94,9 @@ protected: HTMLElement(const QualifiedName& tagName, Document*); void addHTMLAlignment(Attribute*); + void removeHTMLAlignment(); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; void applyBorderAttribute(Attribute*); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/html/HTMLElement.idl b/Source/WebCore/html/HTMLElement.idl index 068cb8d74..308010f40 100644 --- a/Source/WebCore/html/HTMLElement.idl +++ b/Source/WebCore/html/HTMLElement.idl @@ -21,8 +21,8 @@ module html { interface [ - GenerateNativeConverter, - CustomPushEventHandlerScope + JSGenerateToNativeObject, + JSCustomPushEventHandlerScope ] HTMLElement : Element { // iht.com relies on id returning the empty string when no id is present. // Other browsers do this as well. So we don't convert null to JS null. @@ -40,13 +40,13 @@ module html { attribute [Reflect] DOMString accessKey; // Extensions - attribute [TreatNullAs=EmptyString] DOMString innerHTML + attribute [TreatNullAs=NullString] DOMString innerHTML setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString innerText + attribute [TreatNullAs=NullString] DOMString innerText setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString outerHTML + attribute [TreatNullAs=NullString] DOMString outerHTML setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString outerText + attribute [TreatNullAs=NullString] DOMString outerText setter raises(DOMException); Element insertAdjacentElement(in [Optional=CallWithDefaultValue] DOMString where, @@ -61,7 +61,7 @@ module html { readonly attribute HTMLCollection children; - attribute [TreatNullAs=EmptyString] DOMString contentEditable + attribute [TreatNullAs=NullString] DOMString contentEditable setter raises(DOMException); readonly attribute boolean isContentEditable; diff --git a/Source/WebCore/html/HTMLElementsAllInOne.cpp b/Source/WebCore/html/HTMLElementsAllInOne.cpp index ba4b99aba..3fe0da498 100644 --- a/Source/WebCore/html/HTMLElementsAllInOne.cpp +++ b/Source/WebCore/html/HTMLElementsAllInOne.cpp @@ -90,6 +90,7 @@ #include "HTMLQuoteElement.cpp" #include "HTMLScriptElement.cpp" #include "HTMLSelectElement.cpp" +#include "HTMLShadowElement.cpp" #include "HTMLSourceElement.cpp" #include "HTMLSpanElement.cpp" #include "HTMLStyleElement.cpp" diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp index 309aafe05..1d64ecaae 100644 --- a/Source/WebCore/html/HTMLEmbedElement.cpp +++ b/Source/WebCore/html/HTMLEmbedElement.cpp @@ -74,17 +74,7 @@ RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() return findWidgetRenderer(this); } -bool HTMLEmbedElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == hiddenAttr) { - result = eUniversal; - return false; - } - - return HTMLPlugInImageElement::mapToEntry(attrName, result); -} - -void HTMLEmbedElement::parseMappedAttribute(Attribute* attr) +void HTMLEmbedElement::parseAttribute(Attribute* attr) { const AtomicString& value = attr->value(); @@ -108,21 +98,21 @@ void HTMLEmbedElement::parseMappedAttribute(Attribute* attr) if (equalIgnoringCase(value.string(), "yes") || equalIgnoringCase(value.string(), "true")) { // FIXME: Not dynamic, since we add this but don't remove it, but it may be OK for now // that this rarely-used attribute won't work properly if you remove it. - addCSSLength(attr, CSSPropertyWidth, "0"); - addCSSLength(attr, CSSPropertyHeight, "0"); - } + addCSSLength(CSSPropertyWidth, "0"); + addCSSLength(CSSPropertyHeight, "0"); + } else + removeCSSProperties(CSSPropertyWidth, CSSPropertyHeight); } else - HTMLPlugInImageElement::parseMappedAttribute(attr); + HTMLPlugInImageElement::parseAttribute(attr); } void HTMLEmbedElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues) { - NamedNodeMap* attributes = updatedAttributes(); - if (!attributes) + if (!hasAttributes()) return; - for (unsigned i = 0; i < attributes->length(); ++i) { - Attribute* it = attributes->attributeItem(i); + for (unsigned i = 0; i < attributeCount(); ++i) { + Attribute* it = attributeItem(i); paramNames.append(it->localName().string()); paramValues.append(it->value().string()); } @@ -143,11 +133,15 @@ void HTMLEmbedElement::updateWidget(PluginCreationOption pluginCreationOption) // <object> which modifies url and serviceType before calling these. if (!allowedToLoadFrameURL(m_url)) return; + // FIXME: It's sadness that we have this special case here. // See http://trac.webkit.org/changeset/25128 and // plugins/netscape-plugin-setwindow-size.html - if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(m_url, m_serviceType)) + if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(m_url, m_serviceType)) { + // Ensure updateWidget() is called again during layout to create the Netscape plug-in. + setNeedsWidgetUpdate(true); return; + } // FIXME: These should be joined into a PluginParameters class. Vector<String> paramNames; diff --git a/Source/WebCore/html/HTMLEmbedElement.h b/Source/WebCore/html/HTMLEmbedElement.h index 12ce2714b..f37760361 100644 --- a/Source/WebCore/html/HTMLEmbedElement.h +++ b/Source/WebCore/html/HTMLEmbedElement.h @@ -34,8 +34,7 @@ public: private: HTMLEmbedElement(const QualifiedName&, Document*, bool createdByParser); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual void insertedIntoDocument(); diff --git a/Source/WebCore/html/HTMLEmbedElement.idl b/Source/WebCore/html/HTMLEmbedElement.idl index 0ef638450..8ccc38830 100644 --- a/Source/WebCore/html/HTMLEmbedElement.idl +++ b/Source/WebCore/html/HTMLEmbedElement.idl @@ -21,8 +21,8 @@ module html { interface [ - DelegatingPutFunction, - DelegatingGetOwnPropertySlot, + CustomNamedSetter, + JSCustomGetOwnPropertySlotDelegate, CustomCall ] HTMLEmbedElement : HTMLElement { attribute [Reflect] DOMString align; diff --git a/Source/WebCore/html/HTMLFieldSetElement.idl b/Source/WebCore/html/HTMLFieldSetElement.idl index 8cffe3db0..dd699c0e8 100644 --- a/Source/WebCore/html/HTMLFieldSetElement.idl +++ b/Source/WebCore/html/HTMLFieldSetElement.idl @@ -25,7 +25,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); }; } diff --git a/Source/WebCore/html/HTMLFontElement.cpp b/Source/WebCore/html/HTMLFontElement.cpp index d0ade290b..86f52984a 100644 --- a/Source/WebCore/html/HTMLFontElement.cpp +++ b/Source/WebCore/html/HTMLFontElement.cpp @@ -123,18 +123,6 @@ static bool parseFontSize(const String& input, int& size) return true; } -bool HTMLFontElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == sizeAttr || - attrName == colorAttr || - attrName == faceAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - bool HTMLFontElement::cssValueFromFontSizeNumber(const String& s, int& size) { int num = 0; @@ -170,18 +158,26 @@ bool HTMLFontElement::cssValueFromFontSizeNumber(const String& s, int& size) return true; } -void HTMLFontElement::parseMappedAttribute(Attribute* attr) +void HTMLFontElement::parseAttribute(Attribute* attr) { if (attr->name() == sizeAttr) { int size = 0; if (cssValueFromFontSizeNumber(attr->value(), size)) - addCSSProperty(attr, CSSPropertyFontSize, size); + addCSSProperty(CSSPropertyFontSize, size); + else + removeCSSProperty(CSSPropertyFontSize); } else if (attr->name() == colorAttr) { - addCSSColor(attr, CSSPropertyColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyColor); + else + addCSSColor(CSSPropertyColor, attr->value()); } else if (attr->name() == faceAttr) { - addCSSProperty(attr, CSSPropertyFontFamily, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyFontFamily); + else + addCSSProperty(CSSPropertyFontFamily, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLFontElement.h b/Source/WebCore/html/HTMLFontElement.h index f97ab080a..eea8b44fb 100644 --- a/Source/WebCore/html/HTMLFontElement.h +++ b/Source/WebCore/html/HTMLFontElement.h @@ -37,8 +37,7 @@ public: private: HTMLFontElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index 2b06f3d04..c092f617a 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -99,7 +99,7 @@ bool HTMLFormControlElement::formNoValidate() const return fastHasAttribute(formnovalidateAttr); } -void HTMLFormControlElement::parseMappedAttribute(Attribute* attr) +void HTMLFormControlElement::parseAttribute(Attribute* attr) { if (attr->name() == formAttr) formAttributeChanged(); @@ -125,7 +125,7 @@ void HTMLFormControlElement::parseMappedAttribute(Attribute* attr) if (oldRequired != m_required) requiredAttributeChanged(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); setNeedsWillValidateCheck(); } diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h index edc406f51..1bd485965 100644 --- a/Source/WebCore/html/HTMLFormControlElement.h +++ b/Source/WebCore/html/HTMLFormControlElement.h @@ -114,7 +114,7 @@ public: protected: HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void requiredAttributeChanged(); virtual void attach(); virtual void insertedIntoTree(bool deep); diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index 695a39b10..89f1e7b9b 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -357,7 +357,7 @@ void HTMLFormElement::reset() m_isInResetFunction = false; } -void HTMLFormElement::parseMappedAttribute(Attribute* attr) +void HTMLFormElement::parseAttribute(Attribute* attr) { if (attr->name() == actionAttr) m_attributes.parseAction(attr->value()); @@ -379,7 +379,7 @@ void HTMLFormElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onresetAttr) setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } template<class T, size_t n> static void removeFromVector(Vector<T*, n> & vec, T* item) diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h index 08c114119..98d3d8af7 100644 --- a/Source/WebCore/html/HTMLFormElement.h +++ b/Source/WebCore/html/HTMLFormElement.h @@ -120,7 +120,7 @@ private: virtual void handleLocalEvents(Event*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLFormElement.idl b/Source/WebCore/html/HTMLFormElement.idl index d1884efe8..25386f5d9 100644 --- a/Source/WebCore/html/HTMLFormElement.idl +++ b/Source/WebCore/html/HTMLFormElement.idl @@ -21,8 +21,8 @@ module html { interface [ - HasIndexGetter, - HasOverridingNameGetter + IndexedGetter, + CustomNamedGetter ] HTMLFormElement : HTMLElement { readonly attribute HTMLCollection elements; readonly attribute long length; @@ -31,14 +31,14 @@ module html { attribute [Reflect] boolean noValidate; attribute [Reflect=accept_charset] DOMString acceptCharset; attribute [Reflect, URL] DOMString action; - attribute [TreatNullAs=EmptyString] DOMString encoding; - attribute [TreatNullAs=EmptyString] DOMString enctype; - attribute [TreatNullAs=EmptyString] DOMString method; + attribute [TreatNullAs=NullString] DOMString encoding; + attribute [TreatNullAs=NullString] DOMString enctype; + attribute [TreatNullAs=NullString] DOMString method; attribute [Reflect] DOMString target; attribute [Reflect] DOMString autocomplete; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [ImplementationFunction=submitFromJavaScript] void submit(); + [ImplementedAs=submitFromJavaScript] void submit(); #else void submit(); #endif diff --git a/Source/WebCore/html/HTMLFrameElement.cpp b/Source/WebCore/html/HTMLFrameElement.cpp index 34ede8df8..b346494c4 100644 --- a/Source/WebCore/html/HTMLFrameElement.cpp +++ b/Source/WebCore/html/HTMLFrameElement.cpp @@ -82,7 +82,7 @@ void HTMLFrameElement::attach() } } -void HTMLFrameElement::parseMappedAttribute(Attribute* attr) +void HTMLFrameElement::parseAttribute(Attribute* attr) { if (attr->name() == frameborderAttr) { m_frameBorder = attr->value().toInt(); @@ -92,7 +92,7 @@ void HTMLFrameElement::parseMappedAttribute(Attribute* attr) if (renderer()) renderer()->updateFromElement(); } else - HTMLFrameElementBase::parseMappedAttribute(attr); + HTMLFrameElementBase::parseAttribute(attr); } } // namespace WebCore diff --git a/Source/WebCore/html/HTMLFrameElement.h b/Source/WebCore/html/HTMLFrameElement.h index 3b0761a7a..f43ea8c8a 100644 --- a/Source/WebCore/html/HTMLFrameElement.h +++ b/Source/WebCore/html/HTMLFrameElement.h @@ -44,7 +44,7 @@ private: virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; #if ENABLE(FULLSCREEN_API) virtual bool allowFullScreen() const { return false; } diff --git a/Source/WebCore/html/HTMLFrameElement.idl b/Source/WebCore/html/HTMLFrameElement.idl index 1c6851b8a..51a471621 100644 --- a/Source/WebCore/html/HTMLFrameElement.idl +++ b/Source/WebCore/html/HTMLFrameElement.idl @@ -44,7 +44,7 @@ module html { #endif #endif - attribute [TreatNullAs=EmptyString, CustomSetter] DOMString location; + attribute [TreatNullAs=NullString, CustomSetter] DOMString location; readonly attribute long width; readonly attribute long height; diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp index fddec7f92..727173bb9 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.cpp +++ b/Source/WebCore/html/HTMLFrameElementBase.cpp @@ -131,13 +131,13 @@ void HTMLFrameElementBase::openURL(bool lockHistory, bool lockBackForwardList) contentFrame()->setInViewSourceMode(viewSourceMode()); } -void HTMLFrameElementBase::parseMappedAttribute(Attribute* attr) +void HTMLFrameElementBase::parseAttribute(Attribute* attr) { if (attr->name() == srcAttr) setLocation(stripLeadingAndTrailingHTMLSpaces(attr->value())); else if (isIdAttributeName(attr->name())) { // Important to call through to base for the id attribute so the hasID bit gets set. - HTMLFrameOwnerElement::parseMappedAttribute(attr); + HTMLFrameOwnerElement::parseAttribute(attr); m_frameName = attr->value(); } else if (attr->name() == nameAttr) { m_frameName = attr->value(); @@ -169,7 +169,7 @@ void HTMLFrameElementBase::parseMappedAttribute(Attribute* attr) // FIXME: should <frame> elements have beforeunload handlers? setAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(this, attr)); } else - HTMLFrameOwnerElement::parseMappedAttribute(attr); + HTMLFrameOwnerElement::parseAttribute(attr); } void HTMLFrameElementBase::setNameAndOpenURL() diff --git a/Source/WebCore/html/HTMLFrameElementBase.h b/Source/WebCore/html/HTMLFrameElementBase.h index 0f587c9c8..41ee2eae2 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.h +++ b/Source/WebCore/html/HTMLFrameElementBase.h @@ -55,7 +55,7 @@ protected: bool isURLAllowed() const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void attach(); diff --git a/Source/WebCore/html/HTMLFrameSetElement.cpp b/Source/WebCore/html/HTMLFrameSetElement.cpp index 978a72d7a..4af6342bd 100644 --- a/Source/WebCore/html/HTMLFrameSetElement.cpp +++ b/Source/WebCore/html/HTMLFrameSetElement.cpp @@ -64,17 +64,7 @@ PassRefPtr<HTMLFrameSetElement> HTMLFrameSetElement::create(const QualifiedName& return adoptRef(new HTMLFrameSetElement(tagName, document)); } -bool HTMLFrameSetElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == bordercolorAttr) { - result = eUniversal; - return true; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr) +void HTMLFrameSetElement::parseAttribute(Attribute* attr) { if (attr->name() == rowsAttr) { if (!attr->isNull()) { @@ -109,11 +99,11 @@ void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr) } else m_borderSet = false; } else if (attr->name() == bordercolorAttr) { - m_borderColorSet = attr->decl(); - if (!attr->decl() && !attr->isEmpty()) { - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - m_borderColorSet = true; - } + m_borderColorSet = !attr->isEmpty(); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyBorderColor); + else + addCSSColor(CSSPropertyBorderColor, attr->value()); } else if (attr->name() == onloadAttr) document()->setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onbeforeunloadAttr) @@ -147,7 +137,7 @@ void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onpopstateAttr) document()->setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document()->frame(), attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } bool HTMLFrameSetElement::rendererIsNeeded(const NodeRenderingContext& context) diff --git a/Source/WebCore/html/HTMLFrameSetElement.h b/Source/WebCore/html/HTMLFrameSetElement.h index 698897408..187902396 100644 --- a/Source/WebCore/html/HTMLFrameSetElement.h +++ b/Source/WebCore/html/HTMLFrameSetElement.h @@ -67,8 +67,7 @@ public: private: HTMLFrameSetElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); virtual bool rendererIsNeeded(const NodeRenderingContext&); diff --git a/Source/WebCore/html/HTMLFrameSetElement.idl b/Source/WebCore/html/HTMLFrameSetElement.idl index db26410b8..552841208 100644 --- a/Source/WebCore/html/HTMLFrameSetElement.idl +++ b/Source/WebCore/html/HTMLFrameSetElement.idl @@ -21,36 +21,36 @@ module html { interface [ - HasOverridingNameGetter + CustomNamedGetter ] HTMLFrameSetElement : HTMLElement { attribute [Reflect] DOMString cols; attribute [Reflect] DOMString rows; #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler attributes - attribute [DontEnum, WindowEventListener] EventListener onbeforeunload; - attribute [DontEnum, WindowEventListener] EventListener onhashchange; - attribute [DontEnum, WindowEventListener] EventListener onmessage; - attribute [DontEnum, WindowEventListener] EventListener onoffline; - attribute [DontEnum, WindowEventListener] EventListener ononline; - attribute [DontEnum, WindowEventListener] EventListener onpopstate; - attribute [DontEnum, WindowEventListener] EventListener onresize; - attribute [DontEnum, WindowEventListener] EventListener onstorage; - attribute [DontEnum, WindowEventListener] EventListener onunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onhashchange; + attribute [NotEnumerable, JSWindowEventListener] EventListener onmessage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onoffline; + attribute [NotEnumerable, JSWindowEventListener] EventListener ononline; + attribute [NotEnumerable, JSWindowEventListener] EventListener onpopstate; + attribute [NotEnumerable, JSWindowEventListener] EventListener onresize; + attribute [NotEnumerable, JSWindowEventListener] EventListener onstorage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onunload; - attribute [Conditional=ORIENTATION_EVENTS, DontEnum] EventListener onorientationchange; + attribute [Conditional=ORIENTATION_EVENTS, NotEnumerable] EventListener onorientationchange; // Overrides of Element attributes (with different implementation in bindings). - attribute [DontEnum, WindowEventListener] EventListener onblur; - attribute [DontEnum, WindowEventListener] EventListener onerror; - attribute [DontEnum, WindowEventListener] EventListener onfocus; - attribute [DontEnum, WindowEventListener] EventListener onload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onblur; + attribute [NotEnumerable, JSWindowEventListener] EventListener onerror; + attribute [NotEnumerable, JSWindowEventListener] EventListener onfocus; + attribute [NotEnumerable, JSWindowEventListener] EventListener onload; // Not implemented yet. - // attribute [DontEnum, WindowEventListener] EventListener onafterprint; - // attribute [DontEnum, WindowEventListener] EventListener onbeforeprint; - // attribute [DontEnum, WindowEventListener] EventListener onredo; - // attribute [DontEnum, WindowEventListener] EventListener onundo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; #endif }; diff --git a/Source/WebCore/html/HTMLHRElement.cpp b/Source/WebCore/html/HTMLHRElement.cpp index 44aa05266..5534b929f 100644 --- a/Source/WebCore/html/HTMLHRElement.cpp +++ b/Source/WebCore/html/HTMLHRElement.cpp @@ -48,62 +48,70 @@ PassRefPtr<HTMLHRElement> HTMLHRElement::create(const QualifiedName& tagName, Do return adoptRef(new HTMLHRElement(tagName, document)); } -bool HTMLHRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr || - attrName == widthAttr || - attrName == colorAttr || - attrName == sizeAttr || - attrName == noshadeAttr) { - result = eHR; - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLHRElement::parseMappedAttribute(Attribute* attr) +void HTMLHRElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { - if (equalIgnoringCase(attr->value(), "left")) { - addCSSProperty(attr, CSSPropertyMarginLeft, "0"); - addCSSProperty(attr, CSSPropertyMarginRight, CSSValueAuto); + if (attr->value().isNull()) { + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + } else if (equalIgnoringCase(attr->value(), "left")) { + addCSSProperty(CSSPropertyMarginLeft, "0"); + addCSSProperty(CSSPropertyMarginRight, CSSValueAuto); } else if (equalIgnoringCase(attr->value(), "right")) { - addCSSProperty(attr, CSSPropertyMarginLeft, CSSValueAuto); - addCSSProperty(attr, CSSPropertyMarginRight, "0"); + addCSSProperty(CSSPropertyMarginLeft, CSSValueAuto); + addCSSProperty(CSSPropertyMarginRight, "0"); } else { - addCSSProperty(attr, CSSPropertyMarginLeft, CSSValueAuto); - addCSSProperty(attr, CSSPropertyMarginRight, CSSValueAuto); + addCSSProperty(CSSPropertyMarginLeft, CSSValueAuto); + addCSSProperty(CSSPropertyMarginRight, CSSValueAuto); } } else if (attr->name() == widthAttr) { - bool ok; - int v = attr->value().toInt(&ok); - if (ok && !v) - addCSSLength(attr, CSSPropertyWidth, "1"); - else - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWidth); + else { + bool ok; + int v = attr->value().toInt(&ok); + if (ok && !v) + addCSSLength(CSSPropertyWidth, "1"); + else + addCSSLength(CSSPropertyWidth, attr->value()); + } } else if (attr->name() == colorAttr) { - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderColor, CSSPropertyBackgroundColor); + else { + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSColor(CSSPropertyBorderColor, attr->value()); + addCSSColor(CSSPropertyBackgroundColor, attr->value()); + } } else if (attr->name() == noshadeAttr) { - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); - addCSSColor(attr, CSSPropertyBorderColor, String("grey")); - addCSSColor(attr, CSSPropertyBackgroundColor, String("grey")); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderColor, CSSPropertyBackgroundColor); + else { + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSColor(CSSPropertyBorderColor, String("grey")); + addCSSColor(CSSPropertyBackgroundColor, String("grey")); + } } else if (attr->name() == sizeAttr) { - StringImpl* si = attr->value().impl(); - int size = si->toInt(); - if (size <= 1) - addCSSProperty(attr, CSSPropertyBorderBottomWidth, String("0")); - else - addCSSLength(attr, CSSPropertyHeight, String::number(size-2)); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyBorderBottomWidth, CSSPropertyHeight); + else { + StringImpl* si = attr->value().impl(); + int size = si->toInt(); + if (size <= 1) { + addCSSProperty(CSSPropertyBorderBottomWidth, String("0")); + removeCSSProperty(CSSPropertyHeight); + } else { + addCSSLength(CSSPropertyHeight, String::number(size-2)); + removeCSSProperty(CSSPropertyBorderBottomWidth); + } + } } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLHRElement.h b/Source/WebCore/html/HTMLHRElement.h index 37c1190f9..f05085b29 100644 --- a/Source/WebCore/html/HTMLHRElement.h +++ b/Source/WebCore/html/HTMLHRElement.h @@ -36,9 +36,8 @@ public: private: HTMLHRElement(const QualifiedName&, Document*); - - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLIFrameElement.cpp b/Source/WebCore/html/HTMLIFrameElement.cpp index 817b5d749..5cba88842 100644 --- a/Source/WebCore/html/HTMLIFrameElement.cpp +++ b/Source/WebCore/html/HTMLIFrameElement.cpp @@ -48,32 +48,12 @@ PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(const QualifiedName& tag return adoptRef(new HTMLIFrameElement(tagName, document)); } -bool HTMLIFrameElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || attrName == heightAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr) { - result = eReplaced; // Share with <img> since the alignment behavior is the same. - return false; - } - - if (attrName == frameborderAttr) { - result = eReplaced; - return false; - } - - return HTMLFrameElementBase::mapToEntry(attrName, result); -} - -void HTMLIFrameElement::parseMappedAttribute(Attribute* attr) +void HTMLIFrameElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); else if (attr->name() == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); else if (attr->name() == alignAttr) addHTMLAlignment(attr); else if (attr->name() == nameAttr) { @@ -87,13 +67,15 @@ void HTMLIFrameElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == frameborderAttr) { // Frame border doesn't really match the HTML4 spec definition for iframes. It simply adds // a presentational hint that the border should be off if set to zero. - if (!attr->isNull() && !attr->value().toInt()) + if (!attr->isNull() && !attr->value().toInt()) { // Add a rule that nulls out our border width. - addCSSLength(attr, CSSPropertyBorderWidth, "0"); + addCSSLength(CSSPropertyBorderWidth, "0"); + } else + removeCSSProperty(CSSPropertyBorderWidth); } else if (attr->name() == sandboxAttr) setSandboxFlags(attr->isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(attr->value())); else - HTMLFrameElementBase::parseMappedAttribute(attr); + HTMLFrameElementBase::parseAttribute(attr); } bool HTMLIFrameElement::rendererIsNeeded(const NodeRenderingContext& context) diff --git a/Source/WebCore/html/HTMLIFrameElement.h b/Source/WebCore/html/HTMLIFrameElement.h index a7aecf81d..bcba2a257 100644 --- a/Source/WebCore/html/HTMLIFrameElement.h +++ b/Source/WebCore/html/HTMLIFrameElement.h @@ -35,8 +35,7 @@ public: private: HTMLIFrameElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp index b5c513de7..6c22edc12 100644 --- a/Source/WebCore/html/HTMLImageElement.cpp +++ b/Source/WebCore/html/HTMLImageElement.cpp @@ -78,26 +78,7 @@ PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document* return image.release(); } -bool HTMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || - attrName == heightAttr || - attrName == vspaceAttr || - attrName == hspaceAttr || - attrName == valignAttr) { - result = eUniversal; - return false; - } - - if (attrName == borderAttr || attrName == alignAttr) { - result = eReplaced; // Shared with embed and iframe elements. - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLImageElement::parseMappedAttribute(Attribute* attr) +void HTMLImageElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); if (attrName == altAttr) { @@ -106,22 +87,39 @@ void HTMLImageElement::parseMappedAttribute(Attribute* attr) } else if (attrName == srcAttr) m_imageLoader.updateFromElementIgnoringPreviousError(); else if (attrName == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attrName == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else if (attrName == borderAttr) { // border="noborder" -> border="0" applyBorderAttribute(attr); } else if (attrName == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); + else { + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } } else if (attrName == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + else { + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } } else if (attrName == alignAttr) addHTMLAlignment(attr); else if (attrName == valignAttr) - addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyVerticalAlign); + else + addCSSProperty(CSSPropertyVerticalAlign, attr->value()); else if (attrName == usemapAttr) setIsLink(!attr->isNull()); else if (attrName == onabortAttr) @@ -134,7 +132,7 @@ void HTMLImageElement::parseMappedAttribute(Attribute* attr) if (!parseCompositeOperator(attr->value(), m_compositeOperator)) m_compositeOperator = CompositeSourceOver; } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } String HTMLImageElement::altText() const diff --git a/Source/WebCore/html/HTMLImageElement.h b/Source/WebCore/html/HTMLImageElement.h index 8cb3ee901..b24d348bb 100644 --- a/Source/WebCore/html/HTMLImageElement.h +++ b/Source/WebCore/html/HTMLImageElement.h @@ -83,8 +83,7 @@ protected: virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; private: - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/html/HTMLImageElement.idl b/Source/WebCore/html/HTMLImageElement.idl index c6a88ea9d..d893b6c0c 100644 --- a/Source/WebCore/html/HTMLImageElement.idl +++ b/Source/WebCore/html/HTMLImageElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLImageElement : HTMLElement { attribute [Reflect] DOMString name; attribute [Reflect] DOMString align; diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 413c1277c..960040fdd 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -502,7 +502,7 @@ void HTMLInputElement::updateType() if (hadType && !newType->canChangeFromAnotherType()) { // Set the attribute back to the old value. - // Useful in case we were called from inside parseMappedAttribute. + // Useful in case we were called from inside parseAttribute. setAttribute(typeAttr, type()); return; } @@ -545,14 +545,13 @@ void HTMLInputElement::updateType() registerForSuspensionCallbackIfNeeded(); if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttributes()) { - NamedNodeMap* map = attributeMap(); - ASSERT(map); - if (Attribute* height = map->getAttributeItem(heightAttr)) - attributeChanged(height, false); - if (Attribute* width = map->getAttributeItem(widthAttr)) - attributeChanged(width, false); - if (Attribute* align = map->getAttributeItem(alignAttr)) - attributeChanged(align, false); + ASSERT(attributeMap()); + if (Attribute* height = getAttributeItem(heightAttr)) + attributeChanged(height); + if (Attribute* width = getAttributeItem(widthAttr)) + attributeChanged(width); + if (Attribute* align = getAttributeItem(alignAttr)) + attributeChanged(align); } if (wasAttached) { @@ -659,31 +658,13 @@ void HTMLInputElement::accessKeyAction(bool sendMouseEvents) m_inputType->accessKeyAction(sendMouseEvents); } -bool HTMLInputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (((attrName == heightAttr || attrName == widthAttr) && m_inputType->shouldRespectHeightAndWidthAttributes()) - || attrName == vspaceAttr - || attrName == hspaceAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr && m_inputType->shouldRespectAlignAttribute()) { - // Share with <img> since the alignment behavior is the same. - result = eReplaced; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLInputElement::parseMappedAttribute(Attribute* attr) +void HTMLInputElement::parseAttribute(Attribute* attr) { if (attr->name() == nameAttr) { checkedRadioButtons().removeButton(this); m_name = attr->value(); checkedRadioButtons().addButton(this); - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } else if (attr->name() == autocompleteAttr) { if (equalIgnoringCase(attr->value(), "off")) { m_autocomplete = Off; @@ -733,20 +714,26 @@ void HTMLInputElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == usemapAttr || attr->name() == accesskeyAttr) { // FIXME: ignore for the moment } else if (attr->name() == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); } else if (attr->name() == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); } else if (attr->name() == alignAttr) { if (m_inputType->shouldRespectAlignAttribute()) addHTMLAlignment(attr); + else + removeHTMLAlignment(); } else if (attr->name() == widthAttr) { if (m_inputType->shouldRespectHeightAndWidthAttributes()) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); + else + removeCSSProperty(CSSPropertyWidth); } else if (attr->name() == heightAttr) { if (m_inputType->shouldRespectHeightAndWidthAttributes()) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); + else + removeCSSProperty(CSSPropertyHeight); } else if (attr->name() == borderAttr && isImageButton()) { applyBorderAttribute(attr); } else if (attr->name() == onsearchAttr) { @@ -775,10 +762,10 @@ void HTMLInputElement::parseMappedAttribute(Attribute* attr) setNeedsValidityCheck(); else if (attr->name() == disabledAttr) { m_inputType->disabledAttributeChanged(); - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } else if (attr->name() == readonlyAttr) { m_inputType->readonlyAttributeChanged(); - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } #if ENABLE(DATALIST) else if (attr->name() == listAttr) @@ -805,7 +792,7 @@ void HTMLInputElement::parseMappedAttribute(Attribute* attr) setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAttributeEventListener(this, attr)); #endif else - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); updateInnerTextValue(); } @@ -946,7 +933,7 @@ void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) void HTMLInputElement::setIndeterminate(bool newValue) { - if (!m_inputType->isCheckable() || indeterminate() == newValue) + if (indeterminate() == newValue) return; m_isIndeterminate = newValue; @@ -1256,13 +1243,6 @@ void HTMLInputElement::setDefaultValue(const String &value) setAttribute(valueAttr, value); } -void HTMLInputElement::setInitialName(const AtomicString& name) -{ - ASSERT(hasTagName(isindexTag)); - ASSERT(m_name.isNull()); - m_name = name; -} - static inline bool isRFC2616TokenCharacter(UChar ch) { return isASCII(ch) && ch > ' ' && ch != '"' && ch != '(' && ch != ')' && ch != ',' && ch != '/' && (ch < ':' || ch > '@') && (ch < '[' || ch > ']') && ch != '{' && ch != '}' && ch != 0x7f; @@ -1829,4 +1809,9 @@ String HTMLInputElement::defaultToolTip() const return m_inputType->defaultToolTip(); } +bool HTMLInputElement::isIndeterminate() const +{ + return m_inputType->supportsIndeterminateAppearance() && indeterminate(); +} + } // namespace diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 47ac4d326..b6fa0f623 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -128,7 +128,7 @@ public: void setIndeterminate(bool); // shouldAppearChecked is used by the rendering tree/CSS while checked() is used by JS to determine checked state bool shouldAppearChecked() const; - virtual bool isIndeterminate() const { return indeterminate(); } + virtual bool isIndeterminate() const; int size() const; bool sizeShouldIncludeDecoration(int& preferredSize) const; @@ -241,7 +241,6 @@ public: protected: HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser); void createShadowSubtree(); - void setInitialName(const AtomicString&); virtual void defaultEventHandler(Event*); private: @@ -276,8 +275,7 @@ private: virtual void accessKeyAction(bool sendMouseEvents); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void finishParsingChildren(); virtual void copyNonAttributeProperties(const Element* source); diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index bedeb9ae4..4e218b96c 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -21,13 +21,13 @@ module html { interface HTMLInputElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString defaultValue; + attribute [TreatNullAs=NullString] DOMString defaultValue; attribute [Reflect=checked] boolean defaultChecked; attribute [Reflect] DOMString dirName; readonly attribute HTMLFormElement form; attribute [Reflect, URL] DOMString formAction; - attribute [TreatNullAs=EmptyString] DOMString formEnctype; - attribute [TreatNullAs=EmptyString] DOMString formMethod; + attribute [TreatNullAs=NullString] DOMString formEnctype; + attribute [TreatNullAs=NullString] DOMString formMethod; attribute [Reflect] boolean formNoValidate; attribute [Reflect] DOMString formTarget; readonly attribute ValidityState validity; @@ -50,16 +50,15 @@ module html { attribute [Reflect] boolean readOnly; attribute [Reflect] boolean required; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [ConvertToString] DOMString size; // DOM level 2 changed this to a long, but our existing API is a string + attribute [ObjCImplementedAsUnsignedLong] DOMString size; // DOM level 2 changed this to a long, but ObjC API is a string #else - // FIXME: The spec says this should be a long, not an unsigned long. - attribute unsigned long size; // Changed string -> long as part of DOM level 2 + attribute unsigned long size; // Changed string -> long -> unsigned long #endif attribute [Reflect, URL] DOMString src; attribute [Reflect] DOMString step; - attribute [TreatNullAs=EmptyString] DOMString type; // readonly dropped as part of DOM level 2 + attribute [TreatNullAs=NullString] DOMString type; // readonly dropped as part of DOM level 2 attribute [Reflect] DOMString useMap; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString value; #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP attribute Date valueAsDate setter raises(DOMException); #endif @@ -73,12 +72,12 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); void select(); void click(); #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - void setValueForUser(in [TreatNullAs=EmptyString] DOMString value); + void setValueForUser(in [TreatNullAs=NullString] DOMString value); #endif // WinIE extension: @@ -105,9 +104,9 @@ module html { readonly attribute FileList files; readonly attribute NodeList labels; - attribute [Conditional=INPUT_SPEECH, Reflect, EnabledAtRuntime] boolean webkitSpeech; - attribute [Conditional=INPUT_SPEECH, Reflect, EnabledAtRuntime] boolean webkitGrammar; - attribute [Conditional=INPUT_SPEECH, DontEnum] EventListener onwebkitspeechchange; + attribute [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] boolean webkitSpeech; + attribute [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] boolean webkitGrammar; + attribute [Conditional=INPUT_SPEECH, NotEnumerable] EventListener onwebkitspeechchange; }; } diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index 11b7e92ef..85252819a 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -85,7 +85,9 @@ inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume option->appendChild(Text::create(document, keys[i]), ec); } - ensureShadowRoot()->appendChild(select, ec); + ASSERT(!shadowRoot()); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(select, ec); } PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) @@ -93,13 +95,13 @@ PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tag return adoptRef(new HTMLKeygenElement(tagName, document, form)); } -void HTMLKeygenElement::parseMappedAttribute(Attribute* attr) +void HTMLKeygenElement::parseAttribute(Attribute* attr) { // Reflect disabled attribute on the shadow select element if (attr->name() == disabledAttr) shadowSelect()->setAttribute(attr->name(), attr->value()); - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } bool HTMLKeygenElement::appendFormData(FormDataList& encoded_values, bool) diff --git a/Source/WebCore/html/HTMLKeygenElement.h b/Source/WebCore/html/HTMLKeygenElement.h index cc477d692..c793cb120 100644 --- a/Source/WebCore/html/HTMLKeygenElement.h +++ b/Source/WebCore/html/HTMLKeygenElement.h @@ -41,7 +41,7 @@ private: virtual bool canStartSelection() const { return false; } - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool appendFormData(FormDataList&, bool); virtual const AtomicString& formControlType() const; diff --git a/Source/WebCore/html/HTMLKeygenElement.idl b/Source/WebCore/html/HTMLKeygenElement.idl index c34a92582..914fb99b0 100644 --- a/Source/WebCore/html/HTMLKeygenElement.idl +++ b/Source/WebCore/html/HTMLKeygenElement.idl @@ -44,7 +44,7 @@ module html { readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); readonly attribute NodeList labels; }; diff --git a/Source/WebCore/html/HTMLLIElement.cpp b/Source/WebCore/html/HTMLLIElement.cpp index 32886cbe9..f789d32fe 100644 --- a/Source/WebCore/html/HTMLLIElement.cpp +++ b/Source/WebCore/html/HTMLLIElement.cpp @@ -49,36 +49,28 @@ PassRefPtr<HTMLLIElement> HTMLLIElement::create(const QualifiedName& tagName, Do return adoptRef(new HTMLLIElement(tagName, document)); } -bool HTMLLIElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == typeAttr) { - result = eListItem; // Share with <ol> since all the values are the same - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLLIElement::parseMappedAttribute(Attribute* attr) +void HTMLLIElement::parseAttribute(Attribute* attr) { if (attr->name() == valueAttr) { if (renderer() && renderer()->isListItem()) parseValue(attr->value()); } else if (attr->name() == typeAttr) { - if (attr->value() == "a") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerAlpha); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyListStyleType); + else if (attr->value() == "a") + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerAlpha); else if (attr->value() == "A") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperAlpha); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperAlpha); else if (attr->value() == "i") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerRoman); else if (attr->value() == "I") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperRoman); else if (attr->value() == "1") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueDecimal); + addCSSProperty(CSSPropertyListStyleType, CSSValueDecimal); else - addCSSProperty(attr, CSSPropertyListStyleType, attr->value()); + addCSSProperty(CSSPropertyListStyleType, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLLIElement::attach() diff --git a/Source/WebCore/html/HTMLLIElement.h b/Source/WebCore/html/HTMLLIElement.h index 7e6a95370..77a90e801 100644 --- a/Source/WebCore/html/HTMLLIElement.h +++ b/Source/WebCore/html/HTMLLIElement.h @@ -35,8 +35,7 @@ public: private: HTMLLIElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); diff --git a/Source/WebCore/html/HTMLLabelElement.cpp b/Source/WebCore/html/HTMLLabelElement.cpp index 318fe88da..b4748d626 100644 --- a/Source/WebCore/html/HTMLLabelElement.cpp +++ b/Source/WebCore/html/HTMLLabelElement.cpp @@ -154,7 +154,7 @@ void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) HTMLElement::accessKeyAction(sendMouseEvents); } -void HTMLLabelElement::parseMappedAttribute(Attribute* attribute) +void HTMLLabelElement::parseAttribute(Attribute* attribute) { if (attribute->name() == forAttr) { // htmlFor attribute change affects other nodes than this. @@ -162,7 +162,7 @@ void HTMLLabelElement::parseMappedAttribute(Attribute* attribute) if (document()) document()->notifyLocalNodeListsLabelChanged(); } else - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } } // namespace diff --git a/Source/WebCore/html/HTMLLabelElement.h b/Source/WebCore/html/HTMLLabelElement.h index 2f8497839..526379cd0 100644 --- a/Source/WebCore/html/HTMLLabelElement.h +++ b/Source/WebCore/html/HTMLLabelElement.h @@ -51,7 +51,7 @@ private: void focus(bool restorePreviousSelection = true); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp index fa54279ca..1d6536fc5 100644 --- a/Source/WebCore/html/HTMLLinkElement.cpp +++ b/Source/WebCore/html/HTMLLinkElement.cpp @@ -119,7 +119,7 @@ void HTMLLinkElement::setDisabledState(bool disabled) } } -void HTMLLinkElement::parseMappedAttribute(Attribute* attr) +void HTMLLinkElement::parseAttribute(Attribute* attr) { if (attr->name() == relAttr) { m_relAttribute = LinkRelAttribute(attr->value()); @@ -150,7 +150,7 @@ void HTMLLinkElement::parseMappedAttribute(Attribute* attr) else { if (attr->name() == titleAttr && m_sheet) m_sheet->setTitle(attr->value()); - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLLinkElement.h b/Source/WebCore/html/HTMLLinkElement.h index d67a0774f..b99b62949 100644 --- a/Source/WebCore/html/HTMLLinkElement.h +++ b/Source/WebCore/html/HTMLLinkElement.h @@ -61,7 +61,7 @@ public: DOMSettableTokenList* sizes() const; private: - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool shouldLoadLink(); void process(); diff --git a/Source/WebCore/html/HTMLMapElement.cpp b/Source/WebCore/html/HTMLMapElement.cpp index bf4a3b333..2e467137a 100644 --- a/Source/WebCore/html/HTMLMapElement.cpp +++ b/Source/WebCore/html/HTMLMapElement.cpp @@ -98,7 +98,7 @@ HTMLImageElement* HTMLMapElement::imageElement() return 0; } -void HTMLMapElement::parseMappedAttribute(Attribute* attribute) +void HTMLMapElement::parseAttribute(Attribute* attribute) { // FIXME: This logic seems wrong for XML documents. // Either the id or name will be used depending on the order the attributes are parsed. @@ -107,7 +107,7 @@ void HTMLMapElement::parseMappedAttribute(Attribute* attribute) if (isIdAttributeName(attrName) || attrName == nameAttr) { if (isIdAttributeName(attrName)) { // Call base class so that hasID bit gets set. - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); if (document()->isHTMLDocument()) return; } @@ -123,7 +123,7 @@ void HTMLMapElement::parseMappedAttribute(Attribute* attribute) return; } - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } HTMLCollection* HTMLMapElement::areas() diff --git a/Source/WebCore/html/HTMLMapElement.h b/Source/WebCore/html/HTMLMapElement.h index 925895cab..8aad96fa0 100644 --- a/Source/WebCore/html/HTMLMapElement.h +++ b/Source/WebCore/html/HTMLMapElement.h @@ -46,7 +46,7 @@ public: private: HTMLMapElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); diff --git a/Source/WebCore/html/HTMLMarqueeElement.cpp b/Source/WebCore/html/HTMLMarqueeElement.cpp index 053ffa892..1d883b409 100644 --- a/Source/WebCore/html/HTMLMarqueeElement.cpp +++ b/Source/WebCore/html/HTMLMarqueeElement.cpp @@ -51,69 +51,67 @@ PassRefPtr<HTMLMarqueeElement> HTMLMarqueeElement::create(const QualifiedName& t return adoptRef(new HTMLMarqueeElement(tagName, document)); } -bool HTMLMarqueeElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || - attrName == heightAttr || - attrName == bgcolorAttr || - attrName == vspaceAttr || - attrName == hspaceAttr || - attrName == scrollamountAttr || - attrName == scrolldelayAttr || - attrName == loopAttr || - attrName == behaviorAttr || - attrName == directionAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLMarqueeElement::parseMappedAttribute(Attribute* attr) +void HTMLMarqueeElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); + else + removeCSSProperty(CSSPropertyWidth); } else if (attr->name() == heightAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); + else + removeCSSProperty(CSSPropertyHeight); } else if (attr->name() == bgcolorAttr) { if (!attr->value().isEmpty()) - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + addCSSColor(CSSPropertyBackgroundColor, attr->value()); + else + removeCSSProperty(CSSPropertyBackgroundColor); } else if (attr->name() == vspaceAttr) { if (!attr->value().isEmpty()) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); - } + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } else + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); } else if (attr->name() == hspaceAttr) { if (!attr->value().isEmpty()) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); - } + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } else + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); } else if (attr->name() == scrollamountAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyWebkitMarqueeIncrement, attr->value()); + addCSSLength(CSSPropertyWebkitMarqueeIncrement, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeIncrement); } else if (attr->name() == scrolldelayAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyWebkitMarqueeSpeed, attr->value()); + addCSSLength(CSSPropertyWebkitMarqueeSpeed, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeSpeed); } else if (attr->name() == loopAttr) { if (!attr->value().isEmpty()) { if (attr->value() == "-1" || equalIgnoringCase(attr->value(), "infinite")) - addCSSProperty(attr, CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite); + addCSSProperty(CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite); else - addCSSLength(attr, CSSPropertyWebkitMarqueeRepetition, attr->value()); - } + addCSSLength(CSSPropertyWebkitMarqueeRepetition, attr->value()); + } else + removeCSSProperty(CSSPropertyWebkitMarqueeRepetition); } else if (attr->name() == behaviorAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyWebkitMarqueeStyle, attr->value()); + addCSSProperty(CSSPropertyWebkitMarqueeStyle, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeStyle); } else if (attr->name() == directionAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyWebkitMarqueeDirection, attr->value()); + addCSSProperty(CSSPropertyWebkitMarqueeDirection, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeDirection); } else if (attr->name() == truespeedAttr) m_minimumDelay = !attr->isEmpty() ? 0 : defaultMinimumDelay; else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLMarqueeElement::start() diff --git a/Source/WebCore/html/HTMLMarqueeElement.h b/Source/WebCore/html/HTMLMarqueeElement.h index 586aa6fde..d1e3070d2 100644 --- a/Source/WebCore/html/HTMLMarqueeElement.h +++ b/Source/WebCore/html/HTMLMarqueeElement.h @@ -53,8 +53,7 @@ public: private: HTMLMarqueeElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; // ActiveDOMObject virtual bool canSuspend() const; diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index e8bb788d6..7e664840b 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -315,9 +315,14 @@ bool HTMLMediaElement::supportsFocus() const return controls() || HTMLElement::supportsFocus(); } -void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls) +bool HTMLMediaElement::isMouseFocusable() const { - HTMLElement::attributeChanged(attr, preserveDecls); + return false; +} + +void HTMLMediaElement::attributeChanged(Attribute* attr) +{ + HTMLElement::attributeChanged(attr); const QualifiedName& attrName = attr->name(); if (attrName == srcAttr) { @@ -332,7 +337,7 @@ void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls) #endif } -void HTMLMediaElement::parseMappedAttribute(Attribute* attr) +void HTMLMediaElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); @@ -406,7 +411,7 @@ void HTMLMediaElement::parseMappedAttribute(Attribute* attr) else if (attrName == onwebkitendfullscreenAttr) setAttributeEventListener(eventNames().webkitendfullscreenEvent, createAttributeEventListener(this, attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLMediaElement::finishParsingChildren() diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index 98fdf5a0f..76c24cbab 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -301,7 +301,7 @@ protected: HTMLMediaElement(const QualifiedName&, Document*, bool); virtual ~HTMLMediaElement(); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void finishParsingChildren(); virtual bool isURLAttribute(Attribute*) const; virtual void attach(); @@ -336,7 +336,8 @@ private: void createMediaPlayer(); virtual bool supportsFocus() const; - virtual void attributeChanged(Attribute*, bool preserveDecls); + virtual bool isMouseFocusable() const; + virtual void attributeChanged(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void insertedIntoDocument(); diff --git a/Source/WebCore/html/HTMLMediaElement.idl b/Source/WebCore/html/HTMLMediaElement.idl index 484d574e8..4260c2025 100644 --- a/Source/WebCore/html/HTMLMediaElement.idl +++ b/Source/WebCore/html/HTMLMediaElement.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=VIDEO, - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLMediaElement : HTMLElement { // error state @@ -93,31 +93,31 @@ module html { #if defined(ENABLE_MEDIA_SOURCE) && ENABLE_MEDIA_SOURCE // URL passed to src attribute to enable the media source logic. - readonly attribute [EnabledAtRuntime=webkitMediaSource, URL] DOMString webkitMediaSourceURL; + readonly attribute [V8EnabledAtRuntime=webkitMediaSource, URL] DOMString webkitMediaSourceURL; // Appends media to to the source. - [EnabledAtRuntime=webkitMediaSource] void webkitSourceAppend(in Uint8Array data) raises (DOMException); + [V8EnabledAtRuntime=webkitMediaSource] void webkitSourceAppend(in Uint8Array data) raises (DOMException); // Signals the end of stream. - const [EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NO_ERROR = 0; // End of stream reached w/o error. - const [EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NETWORK_ERR = 1; // A network error triggered end of stream. - const [EnabledAtRuntime=webkitMediaSource] unsigned short EOS_DECODE_ERR = 2; // A decode error triggered end of stream. - [EnabledAtRuntime=webkitMediaSource] void webkitSourceEndOfStream(in unsigned short status) raises (DOMException); + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NO_ERROR = 0; // End of stream reached w/o error. + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NETWORK_ERR = 1; // A network error triggered end of stream. + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short EOS_DECODE_ERR = 2; // A decode error triggered end of stream. + [V8EnabledAtRuntime=webkitMediaSource] void webkitSourceEndOfStream(in unsigned short status) raises (DOMException); // Indicates the current state of the media source. - const [EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_CLOSED = 0; - const [EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_OPEN = 1; - const [EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_ENDED = 2; - readonly attribute [EnabledAtRuntime=webkitMediaSource] unsigned short webkitSourceState; + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_CLOSED = 0; + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_OPEN = 1; + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_ENDED = 2; + readonly attribute [V8EnabledAtRuntime=webkitMediaSource] unsigned short webkitSourceState; #endif #if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK - [EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language) + [V8EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language) raises (DOMException); - readonly attribute [EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; + readonly attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; #endif - attribute [Reflect, TreatNullAs=EmptyString, ConvertNullStringToNull] DOMString mediaGroup; + attribute [Reflect, TreatNullAs=NullString, ConvertNullStringToNull] DOMString mediaGroup; attribute [CustomSetter] MediaController controller; }; } diff --git a/Source/WebCore/html/HTMLMetaElement.cpp b/Source/WebCore/html/HTMLMetaElement.cpp index 213ae15b1..fd1f40392 100644 --- a/Source/WebCore/html/HTMLMetaElement.cpp +++ b/Source/WebCore/html/HTMLMetaElement.cpp @@ -42,7 +42,7 @@ PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName return adoptRef(new HTMLMetaElement(tagName, document)); } -void HTMLMetaElement::parseMappedAttribute(Attribute* attr) +void HTMLMetaElement::parseAttribute(Attribute* attr) { if (attr->name() == http_equivAttr) process(); @@ -51,7 +51,7 @@ void HTMLMetaElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == nameAttr) { // Do nothing } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLMetaElement::insertedIntoDocument() diff --git a/Source/WebCore/html/HTMLMetaElement.h b/Source/WebCore/html/HTMLMetaElement.h index df4d7e1f9..7fe03efa3 100644 --- a/Source/WebCore/html/HTMLMetaElement.h +++ b/Source/WebCore/html/HTMLMetaElement.h @@ -38,7 +38,7 @@ public: private: HTMLMetaElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); void process(); diff --git a/Source/WebCore/html/HTMLMeterElement.cpp b/Source/WebCore/html/HTMLMeterElement.cpp index 011a669e0..a1fdaf6c7 100644 --- a/Source/WebCore/html/HTMLMeterElement.cpp +++ b/Source/WebCore/html/HTMLMeterElement.cpp @@ -71,12 +71,12 @@ bool HTMLMeterElement::supportsFocus() const return Node::supportsFocus() && !disabled(); } -void HTMLMeterElement::parseMappedAttribute(Attribute* attribute) +void HTMLMeterElement::parseAttribute(Attribute* attribute) { if (attribute->name() == valueAttr || attribute->name() == minAttr || attribute->name() == maxAttr || attribute->name() == lowAttr || attribute->name() == highAttr || attribute->name() == optimumAttr) didElementStateChange(); else - HTMLFormControlElement::parseMappedAttribute(attribute); + HTMLFormControlElement::parseAttribute(attribute); } void HTMLMeterElement::attach() @@ -234,11 +234,15 @@ void HTMLMeterElement::didElementStateChange() void HTMLMeterElement::createShadowSubtree() { + ASSERT(!shadowRoot()); + RefPtr<MeterBarElement> bar = MeterBarElement::create(document()); m_value = MeterValueElement::create(document()); ExceptionCode ec = 0; bar->appendChild(m_value, ec); - ensureShadowRoot()->appendChild(bar, ec); + + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(bar, ec); } } // namespace diff --git a/Source/WebCore/html/HTMLMeterElement.h b/Source/WebCore/html/HTMLMeterElement.h index c1c02cd49..fb71bc922 100644 --- a/Source/WebCore/html/HTMLMeterElement.h +++ b/Source/WebCore/html/HTMLMeterElement.h @@ -70,7 +70,7 @@ private: virtual bool recalcWillValidate() const { return false; } virtual const AtomicString& formControlType() const; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); void didElementStateChange(); diff --git a/Source/WebCore/html/HTMLOListElement.cpp b/Source/WebCore/html/HTMLOListElement.cpp index d90a2f772..2bfa2ff43 100644 --- a/Source/WebCore/html/HTMLOListElement.cpp +++ b/Source/WebCore/html/HTMLOListElement.cpp @@ -54,29 +54,21 @@ PassRefPtr<HTMLOListElement> HTMLOListElement::create(const QualifiedName& tagNa return adoptRef(new HTMLOListElement(tagName, document)); } -bool HTMLOListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == typeAttr) { - result = eListItem; // Share with <li> - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLOListElement::parseMappedAttribute(Attribute* attr) +void HTMLOListElement::parseAttribute(Attribute* attr) { if (attr->name() == typeAttr) { if (attr->value() == "a") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerAlpha); + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerAlpha); else if (attr->value() == "A") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperAlpha); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperAlpha); else if (attr->value() == "i") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerRoman); else if (attr->value() == "I") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperRoman); else if (attr->value() == "1") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueDecimal); + addCSSProperty(CSSPropertyListStyleType, CSSValueDecimal); + else + removeCSSProperty(CSSPropertyListStyleType); } else if (attr->name() == startAttr) { int oldStart = start(); bool canParse; @@ -93,7 +85,7 @@ void HTMLOListElement::parseMappedAttribute(Attribute* attr) m_isReversed = reversed; updateItemValues(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLOListElement::setStart(int start) diff --git a/Source/WebCore/html/HTMLOListElement.h b/Source/WebCore/html/HTMLOListElement.h index 8000b28bc..0731fb007 100644 --- a/Source/WebCore/html/HTMLOListElement.h +++ b/Source/WebCore/html/HTMLOListElement.h @@ -53,8 +53,7 @@ private: void recalculateItemCount(); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; int m_start; unsigned m_itemCount; diff --git a/Source/WebCore/html/HTMLObjectElement.cpp b/Source/WebCore/html/HTMLObjectElement.cpp index 590d69b98..e2bef0157 100644 --- a/Source/WebCore/html/HTMLObjectElement.cpp +++ b/Source/WebCore/html/HTMLObjectElement.cpp @@ -77,7 +77,7 @@ RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() return renderPart(); // This will return 0 if the renderer is not a RenderPart. } -void HTMLObjectElement::parseMappedAttribute(Attribute* attr) +void HTMLObjectElement::parseAttribute(Attribute* attr) { if (attr->name() == formAttr) formAttributeChanged(); @@ -111,7 +111,7 @@ void HTMLObjectElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == borderAttr) applyBorderAttribute(attr); else - HTMLPlugInImageElement::parseMappedAttribute(attr); + HTMLPlugInImageElement::parseAttribute(attr); } static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues) @@ -177,10 +177,9 @@ void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S } // Turn the attributes of the <object> element into arrays, but don't override <param> values. - NamedNodeMap* attributes = updatedAttributes(); - if (attributes) { - for (unsigned i = 0; i < attributes->length(); ++i) { - Attribute* it = attributes->attributeItem(i); + if (hasAttributes()) { + for (unsigned i = 0; i < attributeCount(); ++i) { + Attribute* it = attributeItem(i); const AtomicString& name = it->name().localName(); if (!uniqueParamNames.contains(name.impl())) { paramNames.append(name.string()); @@ -286,8 +285,14 @@ void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption) bool fallbackContent = hasFallbackContent(); renderEmbeddedObject()->setHasFallbackContent(fallbackContent); - if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) + // FIXME: It's sadness that we have this special case here. + // See http://trac.webkit.org/changeset/25128 and + // plugins/netscape-plugin-setwindow-size.html + if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) { + // Ensure updateWidget() is called again during layout to create the Netscape plug-in. + setNeedsWidgetUpdate(true); return; + } RefPtr<HTMLObjectElement> protect(this); // beforeload and plugin loading can make arbitrary DOM mutations. bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url); diff --git a/Source/WebCore/html/HTMLObjectElement.h b/Source/WebCore/html/HTMLObjectElement.h index 2878039fe..85bf16f8b 100644 --- a/Source/WebCore/html/HTMLObjectElement.h +++ b/Source/WebCore/html/HTMLObjectElement.h @@ -66,7 +66,7 @@ public: private: HTMLObjectElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoTree(bool deep); virtual void removedFromTree(bool deep); diff --git a/Source/WebCore/html/HTMLObjectElement.idl b/Source/WebCore/html/HTMLObjectElement.idl index 27e998a1b..4553fbc06 100644 --- a/Source/WebCore/html/HTMLObjectElement.idl +++ b/Source/WebCore/html/HTMLObjectElement.idl @@ -21,8 +21,8 @@ module html { interface [ - DelegatingPutFunction, - DelegatingGetOwnPropertySlot, + CustomNamedSetter, + JSCustomGetOwnPropertySlotDelegate, CustomCall ] HTMLObjectElement : HTMLElement { readonly attribute HTMLFormElement form; @@ -46,7 +46,7 @@ module html { readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); // Introduced in DOM Level 2: readonly attribute [CheckAccessToNode] Document contentDocument; diff --git a/Source/WebCore/html/HTMLOptGroupElement.cpp b/Source/WebCore/html/HTMLOptGroupElement.cpp index dfc6d8d19..3213842f0 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.cpp +++ b/Source/WebCore/html/HTMLOptGroupElement.cpp @@ -72,9 +72,9 @@ void HTMLOptGroupElement::childrenChanged(bool changedByParser, Node* beforeChan HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } -void HTMLOptGroupElement::parseMappedAttribute(Attribute* attr) +void HTMLOptGroupElement::parseAttribute(Attribute* attr) { - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); recalcSelectOptions(); } diff --git a/Source/WebCore/html/HTMLOptGroupElement.h b/Source/WebCore/html/HTMLOptGroupElement.h index 3d8dd1753..85d531e43 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.h +++ b/Source/WebCore/html/HTMLOptGroupElement.h @@ -44,7 +44,7 @@ private: virtual const AtomicString& formControlType() const; virtual bool supportsFocus() const; virtual bool isFocusable() const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } virtual void attach(); virtual void detach(); diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index 9654d674b..73f6ffa91 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -187,7 +187,7 @@ int HTMLOptionElement::index() const return 0; } -void HTMLOptionElement::parseMappedAttribute(Attribute* attr) +void HTMLOptionElement::parseAttribute(Attribute* attr) { if (attr->name() == selectedAttr) { // FIXME: This doesn't match what the HTML specification says. @@ -198,7 +198,7 @@ void HTMLOptionElement::parseMappedAttribute(Attribute* attr) // case; we'd need to do the other work from the setSelected function. m_isSelected = !attr->isNull(); } else - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } String HTMLOptionElement::value() const diff --git a/Source/WebCore/html/HTMLOptionElement.h b/Source/WebCore/html/HTMLOptionElement.h index 19a8abd76..2eedadf1f 100644 --- a/Source/WebCore/html/HTMLOptionElement.h +++ b/Source/WebCore/html/HTMLOptionElement.h @@ -74,7 +74,7 @@ private: virtual const AtomicString& formControlType() const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoTree(bool); virtual void accessKeyAction(bool); diff --git a/Source/WebCore/html/HTMLOptionElement.idl b/Source/WebCore/html/HTMLOptionElement.idl index fb84a8ec8..73e9c3bdf 100644 --- a/Source/WebCore/html/HTMLOptionElement.idl +++ b/Source/WebCore/html/HTMLOptionElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter, + JSGenerateToNativeObject, NamedConstructor=Option(in [Optional=CallWithNullValue] DOMString data, in [Optional=CallWithNullValue] DOMString value, in [Optional=CallWithDefaultValue] boolean defaultSelected, in [Optional=CallWithDefaultValue] boolean selected), ConstructorRaisesException ] HTMLOptionElement : HTMLElement { diff --git a/Source/WebCore/html/HTMLOptionsCollection.idl b/Source/WebCore/html/HTMLOptionsCollection.idl index 7d1f27458..b28643994 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.idl +++ b/Source/WebCore/html/HTMLOptionsCollection.idl @@ -21,8 +21,8 @@ module html { interface [ - GenerateNativeConverter, - HasCustomIndexSetter + JSGenerateToNativeObject, + CustomIndexedSetter ] HTMLOptionsCollection : HTMLCollection { attribute long selectedIndex; attribute [Custom] unsigned long length diff --git a/Source/WebCore/html/HTMLOutputElement.cpp b/Source/WebCore/html/HTMLOutputElement.cpp index ee3c0d852..ccad10741 100644 --- a/Source/WebCore/html/HTMLOutputElement.cpp +++ b/Source/WebCore/html/HTMLOutputElement.cpp @@ -61,22 +61,12 @@ bool HTMLOutputElement::supportsFocus() const return Node::supportsFocus() && !disabled(); } -bool HTMLOutputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == HTMLNames::dirAttr) { - result = eBDI; - return true; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLOutputElement::parseMappedAttribute(Attribute* attr) +void HTMLOutputElement::parseAttribute(Attribute* attr) { if (attr->name() == HTMLNames::forAttr) setFor(attr->value()); else - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } DOMSettableTokenList* HTMLOutputElement::htmlFor() const diff --git a/Source/WebCore/html/HTMLOutputElement.h b/Source/WebCore/html/HTMLOutputElement.h index 83df7fae7..4a94e4e3d 100644 --- a/Source/WebCore/html/HTMLOutputElement.h +++ b/Source/WebCore/html/HTMLOutputElement.h @@ -55,8 +55,7 @@ public: private: HTMLOutputElement(const QualifiedName&, Document*, HTMLFormElement*); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const OVERRIDE; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual const AtomicString& formControlType() const; virtual bool isEnumeratable() const { return true; } virtual bool supportsFocus() const; diff --git a/Source/WebCore/html/HTMLOutputElement.idl b/Source/WebCore/html/HTMLOutputElement.idl index 378ae53de..35761c335 100644 --- a/Source/WebCore/html/HTMLOutputElement.idl +++ b/Source/WebCore/html/HTMLOutputElement.idl @@ -29,14 +29,14 @@ module html { attribute [Reflect] DOMString name; readonly attribute DOMString type; - attribute [TreatNullAs=EmptyString] DOMString defaultValue; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString defaultValue; + attribute [TreatNullAs=NullString] DOMString value; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); readonly attribute NodeList labels; }; diff --git a/Source/WebCore/html/HTMLParagraphElement.cpp b/Source/WebCore/html/HTMLParagraphElement.cpp index e8a5aa70f..6cc9f51b8 100644 --- a/Source/WebCore/html/HTMLParagraphElement.cpp +++ b/Source/WebCore/html/HTMLParagraphElement.cpp @@ -44,28 +44,21 @@ PassRefPtr<HTMLParagraphElement> HTMLParagraphElement::create(const QualifiedNam return adoptRef(new HTMLParagraphElement(tagName, document)); } -bool HTMLParagraphElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr) { - result = eBlock; // We can share with DIV here. - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLParagraphElement::parseMappedAttribute(Attribute* attr) +void HTMLParagraphElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { - if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyTextAlign); + else if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); else if (equalIgnoringCase(attr->value(), "left")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitLeft); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); else if (equalIgnoringCase(attr->value(), "right")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitRight); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); else - addCSSProperty(attr, CSSPropertyTextAlign, attr->value()); + addCSSProperty(CSSPropertyTextAlign, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLParagraphElement.h b/Source/WebCore/html/HTMLParagraphElement.h index 6dbf07110..0c8c290bb 100644 --- a/Source/WebCore/html/HTMLParagraphElement.h +++ b/Source/WebCore/html/HTMLParagraphElement.h @@ -34,8 +34,7 @@ public: private: HTMLParagraphElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLParamElement.cpp b/Source/WebCore/html/HTMLParamElement.cpp index aa228bc31..c0f919951 100644 --- a/Source/WebCore/html/HTMLParamElement.cpp +++ b/Source/WebCore/html/HTMLParamElement.cpp @@ -47,11 +47,11 @@ bool HTMLParamElement::isURLParameter(const String& name) return equalIgnoringCase(name, "data") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "src"); } -void HTMLParamElement::parseMappedAttribute(Attribute* attr) +void HTMLParamElement::parseAttribute(Attribute* attr) { if (isIdAttributeName(attr->name())) { // Must call base class so that hasID bit gets set. - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); if (document()->isHTMLDocument()) return; m_name = attr->value(); @@ -60,13 +60,13 @@ void HTMLParamElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == valueAttr) { m_value = attr->value(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } bool HTMLParamElement::isURLAttribute(Attribute* attr) const { if (attr->name() == valueAttr && hasAttributes()) { - Attribute* nameAttribute = attributeMap()->getAttributeItem(nameAttr); + Attribute* nameAttribute = getAttributeItem(nameAttr); if (nameAttribute) { const AtomicString& value = nameAttribute->value(); if (isURLParameter(value)) diff --git a/Source/WebCore/html/HTMLParamElement.h b/Source/WebCore/html/HTMLParamElement.h index f448547cb..eadec5440 100644 --- a/Source/WebCore/html/HTMLParamElement.h +++ b/Source/WebCore/html/HTMLParamElement.h @@ -39,7 +39,7 @@ public: private: HTMLParamElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLPlugInElement.cpp b/Source/WebCore/html/HTMLPlugInElement.cpp index 6229d2e03..66d60922c 100644 --- a/Source/WebCore/html/HTMLPlugInElement.cpp +++ b/Source/WebCore/html/HTMLPlugInElement.cpp @@ -112,7 +112,11 @@ PassScriptInstance HTMLPlugInElement::getInstance() bool HTMLPlugInElement::guardedDispatchBeforeLoadEvent(const String& sourceURL) { - ASSERT(!m_inBeforeLoadEventHandler); + // FIXME: Our current plug-in loading design can't guarantee the following + // assertion is true, since plug-in loading can be initiated during layout, + // and synchronous layout can be initiated in a beforeload event handler! + // See <http://webkit.org/b/71264>. + // ASSERT(!m_inBeforeLoadEventHandler); m_inBeforeLoadEventHandler = true; // static_cast is used to avoid a compile error since dispatchBeforeLoadEvent // is intentionally undefined on this class. @@ -136,40 +140,36 @@ Widget* HTMLPlugInElement::pluginWidget() return renderWidget->widget(); } -bool HTMLPlugInElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || - attrName == heightAttr || - attrName == vspaceAttr || - attrName == hspaceAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr) { - result = eReplaced; // Share with <img> since the alignment behavior is the same. - return false; - } - - return HTMLFrameOwnerElement::mapToEntry(attrName, result); -} - -void HTMLPlugInElement::parseMappedAttribute(Attribute* attr) +void HTMLPlugInElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attr->name() == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else if (attr->name() == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); + else { + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } } else if (attr->name() == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + else { + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } } else if (attr->name() == alignAttr) addHTMLAlignment(attr); else - HTMLFrameOwnerElement::parseMappedAttribute(attr); + HTMLFrameOwnerElement::parseAttribute(attr); } void HTMLPlugInElement::defaultEventHandler(Event* event) diff --git a/Source/WebCore/html/HTMLPlugInElement.h b/Source/WebCore/html/HTMLPlugInElement.h index a10af6141..8c2214167 100644 --- a/Source/WebCore/html/HTMLPlugInElement.h +++ b/Source/WebCore/html/HTMLPlugInElement.h @@ -58,8 +58,7 @@ protected: virtual void detach(); virtual void removedFromDocument(); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; bool m_inBeforeLoadEventHandler; // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly. diff --git a/Source/WebCore/html/HTMLPreElement.cpp b/Source/WebCore/html/HTMLPreElement.cpp index fc67aca7f..7ed85fccd 100644 --- a/Source/WebCore/html/HTMLPreElement.cpp +++ b/Source/WebCore/html/HTMLPreElement.cpp @@ -42,16 +42,7 @@ PassRefPtr<HTMLPreElement> HTMLPreElement::create(const QualifiedName& tagName, return adoptRef(new HTMLPreElement(tagName, document)); } -bool HTMLPreElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || attrName == wrapAttr) { - result = ePre; - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLPreElement::parseMappedAttribute(Attribute* attr) +void HTMLPreElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) { // FIXME: Implement this some day. Width on a <pre> is the # of characters that @@ -59,10 +50,12 @@ void HTMLPreElement::parseMappedAttribute(Attribute* attr) // multiply by the value of the attribute and then set that as the width CSS // property. } else if (attr->name() == wrapAttr) { - if (!attr->value().isNull()) - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePreWrap); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWhiteSpace); + else + addCSSProperty(CSSPropertyWhiteSpace, CSSValuePreWrap); } else - return HTMLElement::parseMappedAttribute(attr); + return HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLPreElement.h b/Source/WebCore/html/HTMLPreElement.h index 3ccdb8603..3ad3152f1 100644 --- a/Source/WebCore/html/HTMLPreElement.h +++ b/Source/WebCore/html/HTMLPreElement.h @@ -34,8 +34,7 @@ public: private: HTMLPreElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp index 960f15782..0c2372581 100644 --- a/Source/WebCore/html/HTMLProgressElement.cpp +++ b/Source/WebCore/html/HTMLProgressElement.cpp @@ -75,14 +75,14 @@ const AtomicString& HTMLProgressElement::formControlType() const return progress; } -void HTMLProgressElement::parseMappedAttribute(Attribute* attribute) +void HTMLProgressElement::parseAttribute(Attribute* attribute) { if (attribute->name() == valueAttr) didElementStateChange(); else if (attribute->name() == maxAttr) didElementStateChange(); else - HTMLFormControlElement::parseMappedAttribute(attribute); + HTMLFormControlElement::parseAttribute(attribute); } void HTMLProgressElement::attach() @@ -153,11 +153,14 @@ void HTMLProgressElement::didElementStateChange() void HTMLProgressElement::createShadowSubtree() { + ASSERT(!shadowRoot()); + RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document()); m_value = ProgressValueElement::create(document()); - ExceptionCode ec = 0; - bar->appendChild(m_value, ec); - ensureShadowRoot()->appendChild(bar, ec); + bar->appendChild(m_value, ASSERT_NO_EXCEPTION); + + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot, ASSERT_NO_EXCEPTION); + root->appendChild(bar, ASSERT_NO_EXCEPTION); } } // namespace diff --git a/Source/WebCore/html/HTMLProgressElement.h b/Source/WebCore/html/HTMLProgressElement.h index 2ee4c6ba8..731f80b4a 100644 --- a/Source/WebCore/html/HTMLProgressElement.h +++ b/Source/WebCore/html/HTMLProgressElement.h @@ -59,7 +59,7 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); diff --git a/Source/WebCore/html/HTMLPropertiesCollection.idl b/Source/WebCore/html/HTMLPropertiesCollection.idl index 1697ea904..470ab2eec 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.idl +++ b/Source/WebCore/html/HTMLPropertiesCollection.idl @@ -32,7 +32,7 @@ module html { interface [ Conditional=MICRODATA, - HasIndexGetter + IndexedGetter ] HTMLPropertiesCollection : HTMLCollection { readonly attribute unsigned long length; Node item(in unsigned long index); diff --git a/Source/WebCore/html/HTMLScriptElement.cpp b/Source/WebCore/html/HTMLScriptElement.cpp index a4c5586dc..1df19a63b 100644 --- a/Source/WebCore/html/HTMLScriptElement.cpp +++ b/Source/WebCore/html/HTMLScriptElement.cpp @@ -58,14 +58,14 @@ void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } -void HTMLScriptElement::attributeChanged(Attribute* attr, bool preserveDecls) +void HTMLScriptElement::attributeChanged(Attribute* attr) { if (attr->name() == asyncAttr) handleAsyncAttribute(); - HTMLElement::attributeChanged(attr, preserveDecls); + HTMLElement::attributeChanged(attr); } -void HTMLScriptElement::parseMappedAttribute(Attribute* attr) +void HTMLScriptElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); @@ -76,7 +76,7 @@ void HTMLScriptElement::parseMappedAttribute(Attribute* attr) else if (attrName == onbeforeloadAttr) setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLScriptElement::insertedIntoDocument() diff --git a/Source/WebCore/html/HTMLScriptElement.h b/Source/WebCore/html/HTMLScriptElement.h index a5fe048a1..61d9de094 100644 --- a/Source/WebCore/html/HTMLScriptElement.h +++ b/Source/WebCore/html/HTMLScriptElement.h @@ -44,10 +44,10 @@ public: private: HTMLScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void attributeChanged(Attribute*, bool preserveDecls = false); + virtual void attributeChanged(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLScriptElement.idl b/Source/WebCore/html/HTMLScriptElement.idl index 03b5ac816..1e5c21e74 100644 --- a/Source/WebCore/html/HTMLScriptElement.idl +++ b/Source/WebCore/html/HTMLScriptElement.idl @@ -20,7 +20,7 @@ module html { interface HTMLScriptElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString text; + attribute [TreatNullAs=NullString] DOMString text; attribute [Reflect=for] DOMString htmlFor; attribute [Reflect] DOMString event; attribute [Reflect] DOMString charset; diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp index 4bd10b800..1b96d226f 100644 --- a/Source/WebCore/html/HTMLSelectElement.cpp +++ b/Source/WebCore/html/HTMLSelectElement.cpp @@ -256,7 +256,7 @@ void HTMLSelectElement::setValue(const String &value) setSelectedIndex(-1); } -void HTMLSelectElement::parseMappedAttribute(Attribute* attr) +void HTMLSelectElement::parseAttribute(Attribute* attr) { if (attr->name() == sizeAttr) { int oldSize = m_size; @@ -288,7 +288,7 @@ void HTMLSelectElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == onchangeAttr) setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attr)); else - HTMLFormControlElementWithState::parseMappedAttribute(attr); + HTMLFormControlElementWithState::parseAttribute(attr); } bool HTMLSelectElement::isKeyboardFocusable(KeyboardEvent* event) const diff --git a/Source/WebCore/html/HTMLSelectElement.h b/Source/WebCore/html/HTMLSelectElement.h index cd0ebb4e4..8d9b738a4 100644 --- a/Source/WebCore/html/HTMLSelectElement.h +++ b/Source/WebCore/html/HTMLSelectElement.h @@ -121,7 +121,7 @@ private: virtual bool saveFormControlState(String& value) const; virtual void restoreFormControlState(const String&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle *); virtual bool appendFormData(FormDataList&, bool); diff --git a/Source/WebCore/html/HTMLSelectElement.idl b/Source/WebCore/html/HTMLSelectElement.idl index 9749780c1..5d60ef4f8 100644 --- a/Source/WebCore/html/HTMLSelectElement.idl +++ b/Source/WebCore/html/HTMLSelectElement.idl @@ -21,12 +21,12 @@ module html { interface [ - HasIndexGetter, - HasCustomIndexSetter + IndexedGetter, + CustomIndexedSetter ] HTMLSelectElement : HTMLElement { readonly attribute DOMString type; attribute long selectedIndex; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString value; // Modified in DOM Level 2: #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C @@ -40,7 +40,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); // Modified in DOM Level 2: readonly attribute HTMLOptionsCollection options; @@ -48,11 +48,11 @@ module html { attribute [Reflect] boolean disabled; attribute [Reflect] boolean autofocus; attribute boolean multiple; - attribute [TreatNullAs=EmptyString] DOMString name; + attribute [TreatNullAs=NullString] DOMString name; attribute [Reflect] boolean required; attribute long size; - [OldStyleObjC] void add(in [Optional=CallWithDefaultValue] HTMLElement element, + [ObjCLegacyUnnamedParameters] void add(in [Optional=CallWithDefaultValue] HTMLElement element, in [Optional=CallWithDefaultValue] HTMLElement before) raises(DOMException); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT diff --git a/Source/WebCore/html/HTMLStyleElement.cpp b/Source/WebCore/html/HTMLStyleElement.cpp index cc1fa2300..4156ce5f1 100644 --- a/Source/WebCore/html/HTMLStyleElement.cpp +++ b/Source/WebCore/html/HTMLStyleElement.cpp @@ -57,7 +57,7 @@ PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagNa return adoptRef(new HTMLStyleElement(tagName, document, createdByParser)); } -void HTMLStyleElement::parseMappedAttribute(Attribute* attr) +void HTMLStyleElement::parseAttribute(Attribute* attr) { if (attr->name() == titleAttr && m_sheet) m_sheet->setTitle(attr->value()); @@ -71,7 +71,7 @@ void HTMLStyleElement::parseMappedAttribute(Attribute* attr) } #endif else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLStyleElement::finishParsingChildren() diff --git a/Source/WebCore/html/HTMLStyleElement.h b/Source/WebCore/html/HTMLStyleElement.h index d56d46d6d..9c50ee240 100644 --- a/Source/WebCore/html/HTMLStyleElement.h +++ b/Source/WebCore/html/HTMLStyleElement.h @@ -52,7 +52,7 @@ private: HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser); // overload from HTMLElement - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); #if ENABLE(STYLE_SCOPED) diff --git a/Source/WebCore/html/HTMLSummaryElement.cpp b/Source/WebCore/html/HTMLSummaryElement.cpp index 9925627fe..f57a5db23 100644 --- a/Source/WebCore/html/HTMLSummaryElement.cpp +++ b/Source/WebCore/html/HTMLSummaryElement.cpp @@ -73,9 +73,10 @@ RenderObject* HTMLSummaryElement::createRenderer(RenderArena* arena, RenderStyle void HTMLSummaryElement::createShadowSubtree() { - ExceptionCode ec = 0; - ensureShadowRoot()->appendChild(DetailsMarkerControl::create(document()), ec, true); - ensureShadowRoot()->appendChild(SummaryContentElement::create(document()), ec, true); + ASSERT(!shadowRoot()); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(DetailsMarkerControl::create(document()), ASSERT_NO_EXCEPTION, true); + root->appendChild(SummaryContentElement::create(document()), ASSERT_NO_EXCEPTION, true); } HTMLDetailsElement* HTMLSummaryElement::detailsElement() const @@ -89,8 +90,9 @@ HTMLDetailsElement* HTMLSummaryElement::detailsElement() const bool HTMLSummaryElement::isMainSummary() const { if (HTMLDetailsElement* details = detailsElement()) - return details->mainSummary() == this; - return 0; + return details->findMainSummary() == this; + + return false; } static bool isClickableControl(Node* node) diff --git a/Source/WebCore/html/HTMLTableCaptionElement.cpp b/Source/WebCore/html/HTMLTableCaptionElement.cpp index b726df62c..88450d43a 100644 --- a/Source/WebCore/html/HTMLTableCaptionElement.cpp +++ b/Source/WebCore/html/HTMLTableCaptionElement.cpp @@ -44,23 +44,15 @@ PassRefPtr<HTMLTableCaptionElement> HTMLTableCaptionElement::create(const Qualif return adoptRef(new HTMLTableCaptionElement(tagName, document)); } -bool HTMLTableCaptionElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr) { - result = eCaption; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLTableCaptionElement::parseMappedAttribute(Attribute* attr) +void HTMLTableCaptionElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyCaptionSide, attr->value()); + addCSSProperty(CSSPropertyCaptionSide, attr->value()); + else + removeCSSProperty(CSSPropertyCaptionSide); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLTableCaptionElement.h b/Source/WebCore/html/HTMLTableCaptionElement.h index a2dd2faae..da40e821d 100644 --- a/Source/WebCore/html/HTMLTableCaptionElement.h +++ b/Source/WebCore/html/HTMLTableCaptionElement.h @@ -36,9 +36,8 @@ public: private: HTMLTableCaptionElement(const QualifiedName&, Document*); - - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLTableCaptionElement.idl b/Source/WebCore/html/HTMLTableCaptionElement.idl index c56c45600..075953978 100644 --- a/Source/WebCore/html/HTMLTableCaptionElement.idl +++ b/Source/WebCore/html/HTMLTableCaptionElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLTableCaptionElement : HTMLElement { attribute [Reflect] DOMString align; }; diff --git a/Source/WebCore/html/HTMLTableCellElement.cpp b/Source/WebCore/html/HTMLTableCellElement.cpp index 9a96a3607..84a1c9654 100644 --- a/Source/WebCore/html/HTMLTableCellElement.cpp +++ b/Source/WebCore/html/HTMLTableCellElement.cpp @@ -75,23 +75,7 @@ int HTMLTableCellElement::cellIndex() const return index; } -bool HTMLTableCellElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == nowrapAttr) { - result = eUniversal; - return false; - } - - if (attrName == widthAttr || - attrName == heightAttr) { - result = eCell; // Because of the quirky behavior of ignoring 0 values, cells are special. - return false; - } - - return HTMLTablePartElement::mapToEntry(attrName, result); -} - -void HTMLTableCellElement::parseMappedAttribute(Attribute* attr) +void HTMLTableCellElement::parseAttribute(Attribute* attr) { if (attr->name() == rowspanAttr) { if (renderer() && renderer()->isTableCell()) @@ -100,25 +84,30 @@ void HTMLTableCellElement::parseMappedAttribute(Attribute* attr) if (renderer() && renderer()->isTableCell()) toRenderTableCell(renderer())->colSpanOrRowSpanChanged(); } else if (attr->name() == nowrapAttr) { - if (!attr->isNull()) - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueWebkitNowrap); + if (attr->isNull()) + removeCSSProperty(CSSPropertyWhiteSpace); + else + addCSSProperty(CSSPropertyWhiteSpace, CSSValueWebkitNowrap); + } else if (attr->name() == widthAttr) { if (!attr->value().isEmpty()) { int widthInt = attr->value().toInt(); if (widthInt > 0) // width="0" is ignored for compatibility with WinIE. - addCSSLength(attr, CSSPropertyWidth, attr->value()); - } + addCSSLength(CSSPropertyWidth, attr->value()); + } else + removeCSSProperty(CSSPropertyWidth); } else if (attr->name() == heightAttr) { if (!attr->value().isEmpty()) { int heightInt = attr->value().toInt(); if (heightInt > 0) // height="0" is ignored for compatibility with WinIE. - addCSSLength(attr, CSSPropertyHeight, attr->value()); - } + addCSSLength(CSSPropertyHeight, attr->value()); + } else + removeCSSProperty(CSSPropertyHeight); } else - HTMLTablePartElement::parseMappedAttribute(attr); + HTMLTablePartElement::parseAttribute(attr); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableCellElement::additionalAttributeStyle() +StylePropertySet* HTMLTableCellElement::additionalAttributeStyle() { ContainerNode* p = parentNode(); while (p && !p->hasTagName(tableTag)) diff --git a/Source/WebCore/html/HTMLTableCellElement.h b/Source/WebCore/html/HTMLTableCellElement.h index d7ddc8692..5c32d6a9d 100644 --- a/Source/WebCore/html/HTMLTableCellElement.h +++ b/Source/WebCore/html/HTMLTableCellElement.h @@ -53,10 +53,9 @@ public: private: HTMLTableCellElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLTableColElement.cpp b/Source/WebCore/html/HTMLTableColElement.cpp index 10657e682..0c83e781c 100644 --- a/Source/WebCore/html/HTMLTableColElement.cpp +++ b/Source/WebCore/html/HTMLTableColElement.cpp @@ -47,17 +47,7 @@ PassRefPtr<HTMLTableColElement> HTMLTableColElement::create(const QualifiedName& return adoptRef(new HTMLTableColElement(tagName, document)); } -bool HTMLTableColElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr) { - result = eUniversal; - return false; - } - - return HTMLTablePartElement::mapToEntry(attrName, result); -} - -void HTMLTableColElement::parseMappedAttribute(Attribute* attr) +void HTMLTableColElement::parseAttribute(Attribute* attr) { if (attr->name() == spanAttr) { m_span = !attr->isNull() ? attr->value().toInt() : 1; @@ -65,19 +55,20 @@ void HTMLTableColElement::parseMappedAttribute(Attribute* attr) renderer()->updateFromElement(); } else if (attr->name() == widthAttr) { if (!attr->value().isEmpty()) { - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); if (renderer() && renderer()->isTableCol()) { RenderTableCol* col = toRenderTableCol(renderer()); int newWidth = width().toInt(); if (newWidth != col->width()) col->setNeedsLayoutAndPrefWidthsRecalc(); } - } + } else + removeCSSProperty(CSSPropertyWidth); } else - HTMLTablePartElement::parseMappedAttribute(attr); + HTMLTablePartElement::parseAttribute(attr); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableColElement::additionalAttributeStyle() +StylePropertySet* HTMLTableColElement::additionalAttributeStyle() { if (!hasLocalName(colgroupTag)) return 0; diff --git a/Source/WebCore/html/HTMLTableColElement.h b/Source/WebCore/html/HTMLTableColElement.h index 36180c773..01cea8e1b 100644 --- a/Source/WebCore/html/HTMLTableColElement.h +++ b/Source/WebCore/html/HTMLTableColElement.h @@ -42,9 +42,8 @@ public: private: HTMLTableColElement(const QualifiedName& tagName, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual void parseAttribute(Attribute*) OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; int m_span; }; diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp index cac8b4d61..be3aaa2ce 100644 --- a/Source/WebCore/html/HTMLTableElement.cpp +++ b/Source/WebCore/html/HTMLTableElement.cpp @@ -241,42 +241,6 @@ void HTMLTableElement::deleteRow(int index, ExceptionCode& ec) row->remove(ec); } -bool HTMLTableElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == backgroundAttr) { - result = (MappedAttributeEntry)(eLastEntry + document()->docID()); - return false; - } - - if (attrName == widthAttr || - attrName == heightAttr || - attrName == bgcolorAttr || - attrName == cellspacingAttr || - attrName == vspaceAttr || - attrName == hspaceAttr || - attrName == valignAttr) { - result = eUniversal; - return false; - } - - if (attrName == bordercolorAttr || attrName == frameAttr || attrName == rulesAttr) { - result = eUniversal; - return true; - } - - if (attrName == borderAttr) { - result = eTable; - return true; - } - - if (attrName == alignAttr) { - result = eTable; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - static inline bool isTableCellAncestor(Node* n) { return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) || @@ -302,44 +266,52 @@ static bool setTableCellsChanged(Node* n) return cellChanged; } -void HTMLTableElement::parseMappedAttribute(Attribute* attr) +void HTMLTableElement::parseAttribute(Attribute* attr) { CellBorders bordersBefore = cellBorders(); unsigned short oldPadding = m_padding; if (attr->name() == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attr->name() == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else if (attr->name() == borderAttr) { m_borderAttr = true; - if (attr->decl()) { - RefPtr<CSSValue> val = attr->decl()->getPropertyCSSValue(CSSPropertyBorderLeftWidth); - if (val && val->isPrimitiveValue()) { - CSSPrimitiveValue* primVal = static_cast<CSSPrimitiveValue*>(val.get()); - m_borderAttr = primVal->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER); - } - } else if (!attr->isNull()) { + + if (attr->isNull()) + removeCSSProperty(CSSPropertyBorderWidth); + else { int border = 0; if (attr->isEmpty()) border = 1; else border = attr->value().toInt(); m_borderAttr = border; - addCSSLength(attr, CSSPropertyBorderWidth, String::number(border)); + addCSSLength(CSSPropertyBorderWidth, String::number(border)); } } else if (attr->name() == bgcolorAttr) - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyBackgroundColor); + else + addCSSColor(CSSPropertyBackgroundColor, attr->value()); else if (attr->name() == bordercolorAttr) { - m_borderColorAttr = attr->decl(); - if (!attr->decl() && !attr->isEmpty()) { - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - m_borderColorAttr = true; - } + m_borderColorAttr = !attr->isEmpty(); + if (!attr->isEmpty()) + addCSSColor(CSSPropertyBorderColor, attr->value()); + else + removeCSSProperty(CSSPropertyBorderColor); } else if (attr->name() == backgroundAttr) { String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (!url.isEmpty()) - addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); + addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); + else + removeCSSProperty(CSSPropertyBackgroundImage); } else if (attr->name() == frameAttr) { // Cache the value of "frame" so that the table can examine it later. m_frameAttr = false; @@ -380,15 +352,16 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) // Now map in the border styles of solid and hidden respectively. if (m_frameAttr) { - addCSSProperty(attr, CSSPropertyBorderTopWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderBottomWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderLeftWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderRightWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderTopStyle, borders[cTop] ? CSSValueSolid : CSSValueHidden); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, borders[cBottom] ? CSSValueSolid : CSSValueHidden); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, borders[cLeft] ? CSSValueSolid : CSSValueHidden); - addCSSProperty(attr, CSSPropertyBorderRightStyle, borders[cRight] ? CSSValueSolid : CSSValueHidden); - } + addCSSProperty(CSSPropertyBorderTopWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderBottomWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderLeftWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderRightWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderTopStyle, borders[cTop] ? CSSValueSolid : CSSValueHidden); + addCSSProperty(CSSPropertyBorderBottomStyle, borders[cBottom] ? CSSValueSolid : CSSValueHidden); + addCSSProperty(CSSPropertyBorderLeftStyle, borders[cLeft] ? CSSValueSolid : CSSValueHidden); + addCSSProperty(CSSPropertyBorderRightStyle, borders[cRight] ? CSSValueSolid : CSSValueHidden); + } else + removeCSSProperties(CSSPropertyBorderTopWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderTopStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderRightStyle); } else if (attr->name() == rulesAttr) { m_rulesAttr = UnsetRules; if (equalIgnoringCase(attr->value(), "none")) @@ -404,10 +377,14 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) // The presence of a valid rules attribute causes border collapsing to be enabled. if (m_rulesAttr != UnsetRules) - addCSSProperty(attr, CSSPropertyBorderCollapse, CSSValueCollapse); + addCSSProperty(CSSPropertyBorderCollapse, CSSValueCollapse); + else + removeCSSProperty(CSSPropertyBorderCollapse); } else if (attr->name() == cellspacingAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyBorderSpacing, attr->value()); + addCSSLength(CSSPropertyBorderSpacing, attr->value()); + else + removeCSSProperty(CSSPropertyBorderSpacing); } else if (attr->name() == cellpaddingAttr) { if (!attr->value().isEmpty()) m_padding = max(0, attr->value().toInt()); @@ -416,24 +393,35 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == colsAttr) { // ### } else if (attr->name() == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); + else { + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } } else if (attr->name() == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + else { + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } } else if (attr->name() == alignAttr) { if (!attr->value().isEmpty()) { if (equalIgnoringCase(attr->value(), "center")) { - addCSSProperty(attr, CSSPropertyWebkitMarginStart, CSSValueAuto); - addCSSProperty(attr, CSSPropertyWebkitMarginEnd, CSSValueAuto); + addCSSProperty(CSSPropertyWebkitMarginStart, CSSValueAuto); + addCSSProperty(CSSPropertyWebkitMarginEnd, CSSValueAuto); } else - addCSSProperty(attr, CSSPropertyFloat, attr->value()); - } + addCSSProperty(CSSPropertyFloat, attr->value()); + } else + removeCSSProperties(CSSPropertyWebkitMarginStart, CSSPropertyWebkitMarginEnd, CSSPropertyFloat); } else if (attr->name() == valignAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); + addCSSProperty(CSSPropertyVerticalAlign, attr->value()); + else + removeCSSProperty(CSSPropertyVerticalAlign); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); if (bordersBefore != cellBorders() || oldPadding != m_padding) { m_sharedCellStyle = 0; @@ -445,9 +433,9 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) } } -static CSSMutableStyleDeclaration* leakBorderStyle(int value) +static StylePropertySet* leakBorderStyle(int value) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(CSSPropertyBorderTopStyle, value); style->setProperty(CSSPropertyBorderBottomStyle, value); style->setProperty(CSSPropertyBorderLeftStyle, value); @@ -455,16 +443,16 @@ static CSSMutableStyleDeclaration* leakBorderStyle(int value) return style.release().leakRef(); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalAttributeStyle() +StylePropertySet* HTMLTableElement::additionalAttributeStyle() { if ((!m_borderAttr && !m_borderColorAttr) || m_frameAttr) return 0; if (m_borderColorAttr) { - static CSSMutableStyleDeclaration* solidBorderStyle = leakBorderStyle(CSSValueSolid); + static StylePropertySet* solidBorderStyle = leakBorderStyle(CSSValueSolid); return solidBorderStyle; } - static CSSMutableStyleDeclaration* outsetBorderStyle = leakBorderStyle(CSSValueOutset); + static StylePropertySet* outsetBorderStyle = leakBorderStyle(CSSValueOutset); return outsetBorderStyle; } @@ -491,9 +479,9 @@ HTMLTableElement::CellBorders HTMLTableElement::cellBorders() const return NoBorders; } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::createSharedCellStyle() +PassRefPtr<StylePropertySet> HTMLTableElement::createSharedCellStyle() { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); switch (cellBorders()) { case SolidBordersColsOnly: @@ -542,16 +530,16 @@ PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::createSharedCellStyle() return style.release(); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalCellStyle() +StylePropertySet* HTMLTableElement::additionalCellStyle() { if (!m_sharedCellStyle) m_sharedCellStyle = createSharedCellStyle(); - return m_sharedCellStyle; + return m_sharedCellStyle.get(); } -static CSSMutableStyleDeclaration* leakGroupBorderStyle(int rows) +static StylePropertySet* leakGroupBorderStyle(int rows) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); if (rows) { style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin); style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin); @@ -566,16 +554,16 @@ static CSSMutableStyleDeclaration* leakGroupBorderStyle(int rows) return style.release().leakRef(); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalGroupStyle(bool rows) +StylePropertySet* HTMLTableElement::additionalGroupStyle(bool rows) { if (m_rulesAttr != GroupsRules) return 0; if (rows) { - static CSSMutableStyleDeclaration* rowBorderStyle = leakGroupBorderStyle(true); + static StylePropertySet* rowBorderStyle = leakGroupBorderStyle(true); return rowBorderStyle; } - static CSSMutableStyleDeclaration* columnBorderStyle = leakGroupBorderStyle(false); + static StylePropertySet* columnBorderStyle = leakGroupBorderStyle(false); return columnBorderStyle; } diff --git a/Source/WebCore/html/HTMLTableElement.h b/Source/WebCore/html/HTMLTableElement.h index cfde1df95..ef8ccde6e 100644 --- a/Source/WebCore/html/HTMLTableElement.h +++ b/Source/WebCore/html/HTMLTableElement.h @@ -66,18 +66,17 @@ public: virtual void attach(); - PassRefPtr<CSSMutableStyleDeclaration> additionalCellStyle(); - PassRefPtr<CSSMutableStyleDeclaration> additionalGroupStyle(bool rows); + StylePropertySet* additionalCellStyle(); + StylePropertySet* additionalGroupStyle(bool rows); private: HTMLTableElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; // Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes. - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; @@ -86,7 +85,7 @@ private: CellBorders cellBorders() const; - PassRefPtr<CSSMutableStyleDeclaration> createSharedCellStyle(); + PassRefPtr<StylePropertySet> createSharedCellStyle(); HTMLTableSectionElement* lastBody() const; @@ -98,7 +97,7 @@ private: unsigned short m_padding; OwnPtr<HTMLTableRowsCollection> m_rowsCollection; - RefPtr<CSSMutableStyleDeclaration> m_sharedCellStyle; + RefPtr<StylePropertySet> m_sharedCellStyle; }; } //namespace diff --git a/Source/WebCore/html/HTMLTablePartElement.cpp b/Source/WebCore/html/HTMLTablePartElement.cpp index dfaecca9a..8fd747bd8 100644 --- a/Source/WebCore/html/HTMLTablePartElement.cpp +++ b/Source/WebCore/html/HTMLTablePartElement.cpp @@ -36,65 +36,54 @@ namespace WebCore { using namespace HTMLNames; -bool HTMLTablePartElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == backgroundAttr) { - result = (MappedAttributeEntry)(eLastEntry + document()->docID()); - return false; - } - - if (attrName == bgcolorAttr || - attrName == bordercolorAttr || - attrName == valignAttr || - attrName == heightAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr) { - result = eCell; // All table parts will just share in the TD space. - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLTablePartElement::parseMappedAttribute(Attribute* attr) +void HTMLTablePartElement::parseAttribute(Attribute* attr) { if (attr->name() == bgcolorAttr) - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyBackgroundColor); + else + addCSSColor(CSSPropertyBackgroundColor, attr->value()); else if (attr->name() == backgroundAttr) { String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (!url.isEmpty()) - addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); + addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); + else + removeCSSProperty(CSSPropertyBackgroundImage); } else if (attr->name() == bordercolorAttr) { if (!attr->value().isEmpty()) { - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - } + addCSSColor(CSSPropertyBorderColor, attr->value()); + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + } else + removeCSSProperties(CSSPropertyBorderColor, CSSPropertyBorderTopStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderRightStyle); } else if (attr->name() == valignAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); + addCSSProperty(CSSPropertyVerticalAlign, attr->value()); + else + removeCSSProperty(CSSPropertyVerticalAlign); } else if (attr->name() == alignAttr) { const AtomicString& v = attr->value(); - if (equalIgnoringCase(v, "middle") || equalIgnoringCase(v, "center")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); + if (v.isNull()) + removeCSSProperty(CSSPropertyTextAlign); + else if (equalIgnoringCase(v, "middle") || equalIgnoringCase(v, "center")) + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); else if (equalIgnoringCase(v, "absmiddle")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueCenter); + addCSSProperty(CSSPropertyTextAlign, CSSValueCenter); else if (equalIgnoringCase(v, "left")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitLeft); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); else if (equalIgnoringCase(v, "right")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitRight); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); else - addCSSProperty(attr, CSSPropertyTextAlign, v); + addCSSProperty(CSSPropertyTextAlign, v); } else if (attr->name() == heightAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); + else + removeCSSProperty(CSSPropertyHeight); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLTablePartElement.h b/Source/WebCore/html/HTMLTablePartElement.h index 9df2f919d..c139bbe3c 100644 --- a/Source/WebCore/html/HTMLTablePartElement.h +++ b/Source/WebCore/html/HTMLTablePartElement.h @@ -37,8 +37,7 @@ protected: { } - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLTableSectionElement.cpp b/Source/WebCore/html/HTMLTableSectionElement.cpp index ef6e9f23e..0e7872d12 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.cpp +++ b/Source/WebCore/html/HTMLTableSectionElement.cpp @@ -47,7 +47,7 @@ PassRefPtr<HTMLTableSectionElement> HTMLTableSectionElement::create(const Qualif return adoptRef(new HTMLTableSectionElement(tagName, document)); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableSectionElement::additionalAttributeStyle() +StylePropertySet* HTMLTableSectionElement::additionalAttributeStyle() { ContainerNode* p = parentNode(); while (p && !p->hasTagName(tableTag)) diff --git a/Source/WebCore/html/HTMLTableSectionElement.h b/Source/WebCore/html/HTMLTableSectionElement.h index b1680c42e..93b5f6953 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.h +++ b/Source/WebCore/html/HTMLTableSectionElement.h @@ -56,7 +56,7 @@ public: private: HTMLTableSectionElement(const QualifiedName& tagName, Document*); - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLTableSectionElement.idl b/Source/WebCore/html/HTMLTableSectionElement.idl index 9c0e53b86..1553b5ea1 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.idl +++ b/Source/WebCore/html/HTMLTableSectionElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLTableSectionElement : HTMLElement { attribute [Reflect] DOMString align; attribute [Reflect=char] DOMString ch; diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in index 4c302edd4..62ba50100 100644 --- a/Source/WebCore/html/HTMLTagNames.in +++ b/Source/WebCore/html/HTMLTagNames.in @@ -93,6 +93,7 @@ ol interfaceName=HTMLOListElement optgroup interfaceName=HTMLOptGroupElement, constructorNeedsFormElement option constructorNeedsFormElement output constructorNeedsFormElement +shadow interfaceName=HTMLShadowElement, conditional=SHADOW_DOM p interfaceName=HTMLParagraphElement param plaintext interfaceName=HTMLElement diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index b5ac63390..bff7574be 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -84,8 +84,9 @@ PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName& void HTMLTextAreaElement::createShadowSubtree() { - ExceptionCode ec = 0; - ensureShadowRoot()->appendChild(TextControlInnerTextElement::create(document()), ec); + ASSERT(!shadowRoot()); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO_EXCEPTION); } const AtomicString& HTMLTextAreaElement::formControlType() const @@ -117,7 +118,7 @@ void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChan HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } -void HTMLTextAreaElement::parseMappedAttribute(Attribute* attr) +void HTMLTextAreaElement::parseAttribute(Attribute* attr) { if (attr->name() == rowsAttr) { int rows = attr->value().toInt(); @@ -151,11 +152,11 @@ void HTMLTextAreaElement::parseMappedAttribute(Attribute* attr) m_wrap = wrap; if (shouldWrapText()) { - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePreWrap); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord); + addCSSProperty(CSSPropertyWhiteSpace, CSSValuePreWrap); + addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); } else { - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePre); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueNormal); + addCSSProperty(CSSPropertyWhiteSpace, CSSValuePre); + addCSSProperty(CSSPropertyWordWrap, CSSValueNormal); } if (renderer()) @@ -169,7 +170,7 @@ void HTMLTextAreaElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == maxlengthAttr) setNeedsValidityCheck(); else - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } RenderObject* HTMLTextAreaElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/Source/WebCore/html/HTMLTextAreaElement.h b/Source/WebCore/html/HTMLTextAreaElement.h index f455da7fd..c2bbc718c 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.h +++ b/Source/WebCore/html/HTMLTextAreaElement.h @@ -93,7 +93,7 @@ private: virtual bool isTextFormControl() const { return true; } virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual bool appendFormData(FormDataList&, bool); virtual void reset(); diff --git a/Source/WebCore/html/HTMLTextAreaElement.idl b/Source/WebCore/html/HTMLTextAreaElement.idl index b34142350..3b76115e5 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.idl +++ b/Source/WebCore/html/HTMLTextAreaElement.idl @@ -22,7 +22,7 @@ module html { interface HTMLTextAreaElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString defaultValue; + attribute [TreatNullAs=NullString] DOMString defaultValue; readonly attribute HTMLFormElement form; readonly attribute ValidityState validity; attribute long cols; @@ -30,14 +30,14 @@ module html { attribute [Reflect] boolean disabled; attribute [Reflect] boolean autofocus; attribute long maxLength setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString name; + attribute [TreatNullAs=NullString] DOMString name; attribute [Reflect] DOMString placeholder; attribute [Reflect] boolean readOnly; attribute [Reflect] boolean required; attribute long rows; attribute [Reflect] DOMString wrap; readonly attribute DOMString type; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString value; readonly attribute unsigned long textLength; void select(); @@ -45,7 +45,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); // WinIE & FireFox extension: attribute long selectionStart; diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp index 04c926c88..c7f64903f 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.cpp +++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp @@ -421,7 +421,7 @@ void HTMLTextFormControlElement::selectionChanged(bool userTriggered) } } -void HTMLTextFormControlElement::parseMappedAttribute(Attribute* attr) +void HTMLTextFormControlElement::parseAttribute(Attribute* attr) { if (attr->name() == placeholderAttr) updatePlaceholderVisibility(true); @@ -430,7 +430,7 @@ void HTMLTextFormControlElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onchangeAttr) setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attr)); else - HTMLFormControlElementWithState::parseMappedAttribute(attr); + HTMLFormControlElementWithState::parseAttribute(attr); } void HTMLTextFormControlElement::notifyFormStateChanged() diff --git a/Source/WebCore/html/HTMLTextFormControlElement.h b/Source/WebCore/html/HTMLTextFormControlElement.h index c13440cbf..8aff29093 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.h +++ b/Source/WebCore/html/HTMLTextFormControlElement.h @@ -85,7 +85,7 @@ protected: HTMLTextFormControlElement(const QualifiedName&, Document*, HTMLFormElement*); virtual void updatePlaceholderText() = 0; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; void setTextAsOfLastFormControlChangeEvent(const String& text) { m_textAsOfLastFormControlChangeEvent = text; } diff --git a/Source/WebCore/html/HTMLTitleElement.idl b/Source/WebCore/html/HTMLTitleElement.idl index 3692c39de..e691f7b13 100644 --- a/Source/WebCore/html/HTMLTitleElement.idl +++ b/Source/WebCore/html/HTMLTitleElement.idl @@ -20,7 +20,7 @@ module html { interface HTMLTitleElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString text; + attribute [TreatNullAs=NullString] DOMString text; }; } diff --git a/Source/WebCore/html/HTMLTrackElement.cpp b/Source/WebCore/html/HTMLTrackElement.cpp index e723c5d08..ea2ad05c7 100644 --- a/Source/WebCore/html/HTMLTrackElement.cpp +++ b/Source/WebCore/html/HTMLTrackElement.cpp @@ -88,7 +88,7 @@ void HTMLTrackElement::removedFromDocument() HTMLElement::removedFromDocument(); } -void HTMLTrackElement::parseMappedAttribute(Attribute* attribute) +void HTMLTrackElement::parseAttribute(Attribute* attribute) { const QualifiedName& attrName = attribute->name(); @@ -97,12 +97,12 @@ void HTMLTrackElement::parseMappedAttribute(Attribute* attribute) else if (attrName == onerrorAttr) setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute)); else - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } -void HTMLTrackElement::attributeChanged(Attribute* attr, bool preserveDecls) +void HTMLTrackElement::attributeChanged(Attribute* attr) { - HTMLElement::attributeChanged(attr, preserveDecls); + HTMLElement::attributeChanged(attr); if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled()) return; diff --git a/Source/WebCore/html/HTMLTrackElement.h b/Source/WebCore/html/HTMLTrackElement.h index 965e39631..d3a05544a 100644 --- a/Source/WebCore/html/HTMLTrackElement.h +++ b/Source/WebCore/html/HTMLTrackElement.h @@ -75,8 +75,8 @@ private: HTMLTrackElement(const QualifiedName&, Document*); virtual ~HTMLTrackElement(); - virtual void parseMappedAttribute(Attribute*); - virtual void attributeChanged(Attribute*, bool preserveDecls); + virtual void parseAttribute(Attribute*) OVERRIDE; + virtual void attributeChanged(Attribute*) OVERRIDE; virtual void insertedIntoDocument() OVERRIDE; virtual void removedFromDocument() OVERRIDE; diff --git a/Source/WebCore/html/HTMLTrackElement.idl b/Source/WebCore/html/HTMLTrackElement.idl index 839711e80..cee39d3b8 100644 --- a/Source/WebCore/html/HTMLTrackElement.idl +++ b/Source/WebCore/html/HTMLTrackElement.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack + V8EnabledAtRuntime=webkitVideoTrack ] HTMLTrackElement : HTMLElement { attribute [Reflect, URL] DOMString src; attribute DOMString kind; diff --git a/Source/WebCore/html/HTMLUListElement.cpp b/Source/WebCore/html/HTMLUListElement.cpp index 4b121aa58..cc3c06999 100644 --- a/Source/WebCore/html/HTMLUListElement.cpp +++ b/Source/WebCore/html/HTMLUListElement.cpp @@ -47,22 +47,15 @@ PassRefPtr<HTMLUListElement> HTMLUListElement::create(const QualifiedName& tagNa return adoptRef(new HTMLUListElement(tagName, document)); } -bool HTMLUListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == typeAttr) { - result = eUnorderedList; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLUListElement::parseMappedAttribute(Attribute* attr) +void HTMLUListElement::parseAttribute(Attribute* attr) { if (attr->name() == typeAttr) - addCSSProperty(attr, CSSPropertyListStyleType, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyListStyleType); + else + addCSSProperty(CSSPropertyListStyleType, attr->value()); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLUListElement.h b/Source/WebCore/html/HTMLUListElement.h index f91bf1c3b..c7867469f 100644 --- a/Source/WebCore/html/HTMLUListElement.h +++ b/Source/WebCore/html/HTMLUListElement.h @@ -35,8 +35,7 @@ public: private: HTMLUListElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLVideoElement.cpp b/Source/WebCore/html/HTMLVideoElement.cpp index fed2fa435..c59f995e4 100644 --- a/Source/WebCore/html/HTMLVideoElement.cpp +++ b/Source/WebCore/html/HTMLVideoElement.cpp @@ -93,7 +93,7 @@ void HTMLVideoElement::detach() m_imageLoader.clear(); } -void HTMLVideoElement::parseMappedAttribute(Attribute* attr) +void HTMLVideoElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); @@ -114,11 +114,17 @@ void HTMLVideoElement::parseMappedAttribute(Attribute* attr) } #endif } else if (attrName == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attrName == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else - HTMLMediaElement::parseMappedAttribute(attr); + HTMLMediaElement::parseAttribute(attr); } bool HTMLVideoElement::supportsFullscreen() const diff --git a/Source/WebCore/html/HTMLVideoElement.h b/Source/WebCore/html/HTMLVideoElement.h index af5acbda6..e8f6331ef 100644 --- a/Source/WebCore/html/HTMLVideoElement.h +++ b/Source/WebCore/html/HTMLVideoElement.h @@ -75,7 +75,7 @@ private: #endif virtual void attach(); virtual void detach(); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isVideo() const { return true; } virtual bool hasVideo() const { return player() && player()->hasVideo(); } virtual bool supportsFullscreen() const; diff --git a/Source/WebCore/html/HTMLVideoElement.idl b/Source/WebCore/html/HTMLVideoElement.idl index 1099681a5..97a17796e 100644 --- a/Source/WebCore/html/HTMLVideoElement.idl +++ b/Source/WebCore/html/HTMLVideoElement.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=VIDEO, - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLVideoElement : HTMLMediaElement { attribute [Reflect] unsigned long width; attribute [Reflect] unsigned long height; diff --git a/Source/WebCore/html/ImageData.idl b/Source/WebCore/html/ImageData.idl index 605020577..bbfa460a3 100644 --- a/Source/WebCore/html/ImageData.idl +++ b/Source/WebCore/html/ImageData.idl @@ -29,7 +29,7 @@ module html { interface [ - CustomToJS + JSCustomToJS ] ImageData { readonly attribute long width; readonly attribute long height; diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 551f095ca..f34e6eb32 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -43,7 +43,6 @@ #include "HTMLInputElement.h" #include "HiddenInputType.h" #include "ImageInputType.h" -#include "IsIndexInputType.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" #include "MonthInputType.h" @@ -96,7 +95,6 @@ static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap() map->add(InputTypeNames::file(), FileInputType::create); map->add(InputTypeNames::hidden(), HiddenInputType::create); map->add(InputTypeNames::image(), ImageInputType::create); - map->add(InputTypeNames::isindex(), IsIndexInputType::create); #if ENABLE(INPUT_TYPE_MONTH) map->add(InputTypeNames::month(), MonthInputType::create); #endif @@ -731,6 +729,11 @@ String InputType::defaultToolTip() const return String(); } +bool InputType::supportsIndeterminateAppearance() const +{ + return false; +} + namespace InputTypeNames { // The type names must be lowercased because they will be the return values of @@ -798,12 +801,6 @@ const AtomicString& image() return name; } -const AtomicString& isindex() -{ - DEFINE_STATIC_LOCAL(AtomicString, name, ("khtml_isindex")); - return name; -} - const AtomicString& month() { DEFINE_STATIC_LOCAL(AtomicString, name, ("month")); diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 93e600e8f..c76aacc8f 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -263,6 +263,8 @@ public: // string. This should not be called for types without valueAsNumber. virtual String serialize(double) const; + virtual bool supportsIndeterminateAppearance() const; + protected: InputType(HTMLInputElement* element) : m_element(element) { } HTMLInputElement* element() const { return m_element; } @@ -290,7 +292,6 @@ const AtomicString& email(); const AtomicString& file(); const AtomicString& hidden(); const AtomicString& image(); -const AtomicString& isindex(); const AtomicString& month(); const AtomicString& number(); const AtomicString& password(); diff --git a/Source/WebCore/html/MediaController.idl b/Source/WebCore/html/MediaController.idl index f7b9fb224..1899dc3d8 100644 --- a/Source/WebCore/html/MediaController.idl +++ b/Source/WebCore/html/MediaController.idl @@ -28,7 +28,7 @@ module html { Conditional=VIDEO, Constructor, CallWith=ScriptExecutionContext, - GenerateToJS, + JSGenerateToJS, EventTarget ] MediaController { readonly attribute TimeRanges buffered; diff --git a/Source/WebCore/html/NumberInputType.cpp b/Source/WebCore/html/NumberInputType.cpp index 44fb35a73..3a4d420cd 100644 --- a/Source/WebCore/html/NumberInputType.cpp +++ b/Source/WebCore/html/NumberInputType.cpp @@ -283,11 +283,19 @@ void NumberInputType::handleBlurEvent() element()->updateInnerTextValue(); } +static bool isE(UChar ch) +{ + return ch == 'e' || ch == 'E'; +} + String NumberInputType::visibleValue() const { String currentValue = element()->value(); if (currentValue.isEmpty()) return currentValue; + // We don't localize scientific notations. + if (currentValue.find(isE) != notFound) + return currentValue; // FIXME: The following three lines should be removed when we // remove the second argument of convertToLocalizedNumber(). double doubleValue = numeric_limits<double>::quiet_NaN(); @@ -300,12 +308,16 @@ String NumberInputType::convertFromVisibleValue(const String& visibleValue) cons { if (visibleValue.isEmpty()) return visibleValue; + // We don't localize scientific notations. + if (visibleValue.find(isE) != notFound) + return visibleValue; return convertFromLocalizedNumber(visibleValue); } bool NumberInputType::isAcceptableValue(const String& proposedValue) { - return proposedValue.isEmpty() || parseToDoubleForNumberType(convertFromLocalizedNumber(proposedValue), 0) || parseToDoubleForNumberType(proposedValue, 0); + String standardValue = convertFromVisibleValue(proposedValue); + return standardValue.isEmpty() || parseToDoubleForNumberType(standardValue, 0); } String NumberInputType::sanitizeValue(const String& proposedValue) const diff --git a/Source/WebCore/html/PublicURLManager.h b/Source/WebCore/html/PublicURLManager.h new file mode 100644 index 000000000..258ac067a --- /dev/null +++ b/Source/WebCore/html/PublicURLManager.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2012 Motorola Mobility Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PublicURLManager_h +#define PublicURLManager_h + +#if ENABLE(BLOB) +#include "PlatformString.h" +#include "ScriptExecutionContext.h" +#include "ThreadableBlobRegistry.h" +#include <wtf/HashSet.h> + +#if ENABLE(MEDIA_STREAM) +#include "MediaStream.h" +#include "MediaStreamRegistry.h" +#endif + +namespace WebCore { + +class ScriptExecutionContext; + +class PublicURLManager { + +public: + static PassOwnPtr<PublicURLManager> create() { return adoptPtr(new PublicURLManager); } + void contextDestroyed() + { + HashSet<String>::iterator blobURLsEnd = m_blobURLs.end(); + for (HashSet<String>::iterator iter = m_blobURLs.begin(); iter != blobURLsEnd; ++iter) + ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter)); + +#if ENABLE(MEDIA_STREAM) + HashSet<String>::iterator streamURLsEnd = m_streamURLs.end(); + for (HashSet<String>::iterator iter = m_streamURLs.begin(); iter != streamURLsEnd; ++iter) + MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter)); +#endif + } + + HashSet<String>& blobURLs() { return m_blobURLs; } +#if ENABLE(MEDIA_STREAM) + HashSet<String>& streamURLs() { return m_streamURLs; } +#endif + +private: + HashSet<String> m_blobURLs; +#if ENABLE(MEDIA_STREAM) + HashSet<String> m_streamURLs; +#endif +}; + +} // namespace WebCore + +#endif // BLOB +#endif // PUBLICURLMANAGER_h diff --git a/Source/WebCore/html/RadioInputType.cpp b/Source/WebCore/html/RadioInputType.cpp index baec9e861..d31cc2daf 100644 --- a/Source/WebCore/html/RadioInputType.cpp +++ b/Source/WebCore/html/RadioInputType.cpp @@ -152,11 +152,15 @@ PassOwnPtr<ClickHandlingState> RadioInputType::willDispatchClick() OwnPtr<ClickHandlingState> state = adoptPtr(new ClickHandlingState); state->checked = element()->checked(); - state->indeterminate = element()->indeterminate(); state->checkedRadioButton = element()->checkedRadioButtons().checkedButtonForGroup(element()->name()); +#if PLATFORM(IOS) + state->indeterminate = element()->indeterminate(); + if (element()->indeterminate()) element()->setIndeterminate(false); +#endif + element()->setChecked(true, true); return state.release(); @@ -174,7 +178,11 @@ void RadioInputType::didDispatchClick(Event* event, const ClickHandlingState& st && checkedRadioButton->name() == element()->name()) { checkedRadioButton->setChecked(true); } + +#if PLATFORM(IOS) element()->setIndeterminate(state.indeterminate); +#endif + } // The work we did in willDispatchClick was default handling. @@ -186,4 +194,13 @@ bool RadioInputType::isRadioButton() const return true; } +bool RadioInputType::supportsIndeterminateAppearance() const +{ +#if PLATFORM(IOS) + return true; +#else + return false; +#endif +} + } // namespace WebCore diff --git a/Source/WebCore/html/RadioInputType.h b/Source/WebCore/html/RadioInputType.h index 9cefe516b..7790b504c 100644 --- a/Source/WebCore/html/RadioInputType.h +++ b/Source/WebCore/html/RadioInputType.h @@ -52,6 +52,7 @@ private: virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE; virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE; virtual bool isRadioButton() const OVERRIDE; + virtual bool supportsIndeterminateAppearance() const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/TextTrack.idl b/Source/WebCore/html/TextTrack.idl index 0ac01b438..845a80c01 100644 --- a/Source/WebCore/html/TextTrack.idl +++ b/Source/WebCore/html/TextTrack.idl @@ -27,10 +27,10 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, + V8EnabledAtRuntime=webkitVideoTrack, EventTarget, - CustomMarkFunction, - CustomIsReachable + JSCustomMarkFunction, + JSCustomIsReachable ] TextTrack { readonly attribute DOMString kind; readonly attribute DOMString label; diff --git a/Source/WebCore/html/TextTrackCue.idl b/Source/WebCore/html/TextTrackCue.idl index 913a9bd44..4f7a40bae 100644 --- a/Source/WebCore/html/TextTrackCue.idl +++ b/Source/WebCore/html/TextTrackCue.idl @@ -27,13 +27,13 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, - GenerateNativeConverter, + V8EnabledAtRuntime=webkitVideoTrack, + JSGenerateToNativeObject, Constructor(in DOMString id, in double startTime, in double endTime, in DOMString text, in [Optional=CallWithDefaultValue] DOMString settings, in [Optional=CallWithDefaultValue] boolean pauseOnExit), CallWith=ScriptExecutionContext, EventTarget, - CustomMarkFunction, - CustomIsReachable + JSCustomMarkFunction, + JSCustomIsReachable ] TextTrackCue { readonly attribute TextTrack track; diff --git a/Source/WebCore/html/TextTrackCueList.idl b/Source/WebCore/html/TextTrackCueList.idl index c1b700d04..551840fe9 100644 --- a/Source/WebCore/html/TextTrackCueList.idl +++ b/Source/WebCore/html/TextTrackCueList.idl @@ -27,8 +27,8 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, - HasIndexGetter + V8EnabledAtRuntime=webkitVideoTrack, + IndexedGetter ] TextTrackCueList { readonly attribute unsigned long length; TextTrackCue item(in unsigned long index); diff --git a/Source/WebCore/html/ValidationMessage.cpp b/Source/WebCore/html/ValidationMessage.cpp index 604e54a13..bc3c45489 100644 --- a/Source/WebCore/html/ValidationMessage.cpp +++ b/Source/WebCore/html/ValidationMessage.cpp @@ -119,7 +119,7 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble hostY -= containerLocation.y() + container->borderTop(); } - CSSMutableStyleDeclaration* style = bubble->ensureInlineStyleDecl(); + StylePropertySet* style = bubble->ensureInlineStyleDecl(); style->setProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX); // The 'left' value of ::-webkit-validation-bubble-arrow. const int bubbleArrowTopOffset = 32; diff --git a/Source/WebCore/html/VoidCallback.idl b/Source/WebCore/html/VoidCallback.idl index 2a199751e..d0f159b83 100644 --- a/Source/WebCore/html/VoidCallback.idl +++ b/Source/WebCore/html/VoidCallback.idl @@ -25,7 +25,7 @@ module html { interface [ - CustomNativeConverter, + JSCustomToNativeObject, OmitConstructor ] VoidCallback { void handleEvent(); diff --git a/Source/WebCore/html/canvas/ArrayBuffer.idl b/Source/WebCore/html/canvas/ArrayBuffer.idl index 9ba85ca2e..a631b138c 100644 --- a/Source/WebCore/html/canvas/ArrayBuffer.idl +++ b/Source/WebCore/html/canvas/ArrayBuffer.idl @@ -26,9 +26,9 @@ module html { interface [ - GenerateIsReachable=Impl, + JSGenerateIsReachable=Impl, CustomConstructor, - NoStaticTables + JSNoStaticTables ] ArrayBuffer { readonly attribute int byteLength; ArrayBuffer slice(in long begin, in [Optional] long end); diff --git a/Source/WebCore/html/canvas/ArrayBufferView.idl b/Source/WebCore/html/canvas/ArrayBufferView.idl index 0e3d76540..ed158bfae 100644 --- a/Source/WebCore/html/canvas/ArrayBufferView.idl +++ b/Source/WebCore/html/canvas/ArrayBufferView.idl @@ -25,8 +25,8 @@ module html { interface [ - CustomToJS, - NoStaticTables, + JSCustomToJS, + JSNoStaticTables, OmitConstructor ] ArrayBufferView { readonly attribute ArrayBuffer buffer; diff --git a/Source/WebCore/html/canvas/CanvasPixelArray.idl b/Source/WebCore/html/canvas/CanvasPixelArray.idl index 8b7edbd5d..a12c8ce9b 100644 --- a/Source/WebCore/html/canvas/CanvasPixelArray.idl +++ b/Source/WebCore/html/canvas/CanvasPixelArray.idl @@ -30,9 +30,8 @@ module html { #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT || defined(V8_BINDING) && V8_BINDING interface [ OmitConstructor, - CustomHeader, - HasNumericIndexGetter, - HasCustomIndexSetter + NumericIndexedGetter, + CustomIndexedSetter ] CanvasPixelArray { #if !defined(V8_BINDING) || !V8_BINDING readonly attribute long length; diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext.idl b/Source/WebCore/html/canvas/CanvasRenderingContext.idl index d8657cc8f..acdd0b75c 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext.idl @@ -26,9 +26,9 @@ module html { interface [ - CustomMarkFunction, - GenerateIsReachable, - CustomToJS + JSCustomMarkFunction, + JSGenerateIsReachable, + JSCustomToJS ] CanvasRenderingContext { readonly attribute HTMLCanvasElement canvas; diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp index a24cd692a..b0e053ff3 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -33,7 +33,6 @@ #include "AffineTransform.h" #include "CSSFontSelector.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSPropertyNames.h" #include "CSSStyleSelector.h" @@ -60,6 +59,7 @@ #include "SecurityOrigin.h" #include "Settings.h" #include "StrokeStyleApplier.h" +#include "StylePropertySet.h" #include "TextMetrics.h" #include "TextRun.h" @@ -496,7 +496,6 @@ void CanvasRenderingContext2D::setShadowColor(const String& color) { if (!parseColorOrCurrentColor(state().m_shadowColor, color, canvas())) return; - applyShadow(); } @@ -1102,26 +1101,6 @@ void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h didDraw(boundingRect); } -#if USE(CG) -static inline CGSize adjustedShadowSize(CGFloat width, CGFloat height) -{ - // Work around <rdar://problem/5539388> by ensuring that shadow offsets will get truncated - // to the desired integer. - static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128); - if (width > 0) - width += extraShadowOffset; - else if (width < 0) - width -= extraShadowOffset; - - if (height > 0) - height += extraShadowOffset; - else if (height < 0) - height -= extraShadowOffset; - - return CGSizeMake(width, height); -} -#endif - void CanvasRenderingContext2D::setShadow(float width, float height, float blur) { state().m_shadowOffset = FloatSize(width, height); @@ -1145,11 +1124,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f); - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1163,11 +1137,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowColor = colorWithOverrideAlpha(rgba, alpha); state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1176,11 +1145,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha); - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1189,11 +1153,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBA32FromFloats(r, g, b, a); - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1202,20 +1161,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBAFromCMYKA(c, m, y, k, a); - - GraphicsContext* dc = drawingContext(); - if (!dc) - return; -#if USE(CG) - const CGFloat components[5] = { c, m, y, k, a }; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceCMYK(); - CGColorRef shadowColor = CGColorCreate(colorSpace, components); - CGColorSpaceRelease(colorSpace); - CGContextSetShadowWithColor(dc->platformContext(), adjustedShadowSize(width, -height), blur, shadowColor); - CGColorRelease(shadowColor); -#else applyShadow(); -#endif } void CanvasRenderingContext2D::clearShadow() @@ -1294,10 +1240,6 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode& ec) { - if (!image) { - ec = TYPE_MISMATCH_ERR; - return; - } drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec); } @@ -1364,38 +1306,22 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec } } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, float x, float y, ExceptionCode& ec) +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, ExceptionCode& ec) { - if (!canvas) { - ec = TYPE_MISMATCH_ERR; - return; - } - - // In order to emulate drawing the result of toDataURL() into the canvas, we - // need to deflate the size of the source rectangle by the source canvas's - // backing store scale factor. - // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=15041 for motivation. - - FloatSize logicalSize = canvas->convertDeviceToLogical(canvas->size()); - - drawImage(canvas, 0, 0, logicalSize.width(), logicalSize.height(), x, y, canvas->width(), canvas->height(), ec); + drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(), x, y, sourceCanvas->width(), sourceCanvas->height(), ec); } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, float width, float height, ExceptionCode& ec) { - if (!canvas) { - ec = TYPE_MISMATCH_ERR; - return; - } - drawImage(canvas, FloatRect(0, 0, canvas->width(), canvas->height()), FloatRect(x, y, width, height), ec); + drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas->height()), FloatRect(x, y, width, height), ec); } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode& ec) { - drawImage(canvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec); + drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec); } void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const FloatRect& srcRect, @@ -1978,7 +1904,7 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, IntRect sourceRect(destRect); sourceRect.move(-destOffset); - buffer->putUnmultipliedImageData(data->data()->data(), IntSize(data->width(), data->height()), sourceRect, IntPoint(destOffset)); + buffer->putByteArray(Unmultiplied, data->data()->data(), IntSize(data->width(), data->height()), sourceRect, IntPoint(destOffset)); didDraw(destRect, CanvasDidDrawApplyNone); // ignore transform, shadow and clip } @@ -1989,7 +1915,7 @@ String CanvasRenderingContext2D::font() const void CanvasRenderingContext2D::setFont(const String& newFont) { - RefPtr<CSSMutableStyleDeclaration> tempDecl = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> tempDecl = StylePropertySet::create(); CSSParser parser(!m_usesCSSCompatibilityParseMode); String declarationText("font: "); diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl index d7efe1328..d4560f7a0 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -49,7 +49,7 @@ module html { in [Optional=CallWithDefaultValue] float dy); attribute float globalAlpha; - attribute [TreatNullAs=EmptyString] DOMString globalCompositeOperation; + attribute [TreatNullAs=NullString] DOMString globalCompositeOperation; CanvasGradient createLinearGradient(in [Optional=CallWithDefaultValue] float x0, in [Optional=CallWithDefaultValue] float y0, @@ -65,14 +65,14 @@ module html { raises (DOMException); attribute float lineWidth; - attribute [TreatNullAs=EmptyString] DOMString lineCap; - attribute [TreatNullAs=EmptyString] DOMString lineJoin; + attribute [TreatNullAs=NullString] DOMString lineCap; + attribute [TreatNullAs=NullString] DOMString lineJoin; attribute float miterLimit; attribute float shadowOffsetX; attribute float shadowOffsetY; attribute float shadowBlur; - attribute [TreatNullAs=EmptyString] DOMString shadowColor; + attribute [TreatNullAs=NullString] DOMString shadowColor; // FIXME: These attributes should also be implemented for V8. #if !(defined(V8_BINDING) && V8_BINDING) @@ -204,9 +204,9 @@ module html { void putImageData(in ImageData imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) raises(DOMException); - CanvasPattern createPattern(in HTMLCanvasElement canvas, in [TreatNullAs=EmptyString] DOMString repetitionType) + CanvasPattern createPattern(in HTMLCanvasElement canvas, in [TreatNullAs=NullString] DOMString repetitionType) raises (DOMException); - CanvasPattern createPattern(in HTMLImageElement image, in [TreatNullAs=EmptyString] DOMString repetitionType) + CanvasPattern createPattern(in HTMLImageElement image, in [TreatNullAs=NullString] DOMString repetitionType) raises (DOMException); ImageData createImageData(in ImageData imagedata) raises (DOMException); diff --git a/Source/WebCore/html/canvas/DataView.idl b/Source/WebCore/html/canvas/DataView.idl index bba13c93a..9530220dc 100755 --- a/Source/WebCore/html/canvas/DataView.idl +++ b/Source/WebCore/html/canvas/DataView.idl @@ -27,8 +27,8 @@ module html { interface [ CustomConstructor, - CustomToJS, - NoStaticTables + JSCustomToJS, + JSNoStaticTables ] DataView : ArrayBufferView { // All these methods raise an exception if they would read or write beyond the end of the view. @@ -50,9 +50,9 @@ module html { raises (DOMException); // Use custom code to handle NaN case for JSC. - [JSCCustom, StrictTypeChecking] float getFloat32(in unsigned long byteOffset, in [Optional] boolean littleEndian) + [JSCustom, StrictTypeChecking] float getFloat32(in unsigned long byteOffset, in [Optional] boolean littleEndian) raises (DOMException); - [JSCCustom, StrictTypeChecking] double getFloat64(in unsigned long byteOffset, in [Optional] boolean littleEndian) + [JSCustom, StrictTypeChecking] double getFloat64(in unsigned long byteOffset, in [Optional] boolean littleEndian) raises (DOMException); // We have to use custom code because our code generator does not support uint8_t type. diff --git a/Source/WebCore/html/canvas/Float32Array.idl b/Source/WebCore/html/canvas/Float32Array.idl index ef6c956b7..785ed819c 100644 --- a/Source/WebCore/html/canvas/Float32Array.idl +++ b/Source/WebCore/html/canvas/Float32Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Float32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/Source/WebCore/html/canvas/Float64Array.idl b/Source/WebCore/html/canvas/Float64Array.idl index 01495350b..7180811fa 100644 --- a/Source/WebCore/html/canvas/Float64Array.idl +++ b/Source/WebCore/html/canvas/Float64Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Float64Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 8; diff --git a/Source/WebCore/html/canvas/Int16Array.idl b/Source/WebCore/html/canvas/Int16Array.idl index b1a547180..40e18d530 100644 --- a/Source/WebCore/html/canvas/Int16Array.idl +++ b/Source/WebCore/html/canvas/Int16Array.idl @@ -26,12 +26,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Int16Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 2; diff --git a/Source/WebCore/html/canvas/Int32Array.idl b/Source/WebCore/html/canvas/Int32Array.idl index bad745d6e..0f5320ac4 100644 --- a/Source/WebCore/html/canvas/Int32Array.idl +++ b/Source/WebCore/html/canvas/Int32Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Int32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/Source/WebCore/html/canvas/Int8Array.idl b/Source/WebCore/html/canvas/Int8Array.idl index 4ae2eace6..9984ada66 100644 --- a/Source/WebCore/html/canvas/Int8Array.idl +++ b/Source/WebCore/html/canvas/Int8Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Int8Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.idl b/Source/WebCore/html/canvas/OESStandardDerivatives.idl index f1d4740b2..93f0a01d8 100644 --- a/Source/WebCore/html/canvas/OESStandardDerivatives.idl +++ b/Source/WebCore/html/canvas/OESStandardDerivatives.idl @@ -26,9 +26,9 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums + DoNotCheckConstants ] OESStandardDerivatives { const unsigned int FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; }; diff --git a/Source/WebCore/html/canvas/OESTextureFloat.idl b/Source/WebCore/html/canvas/OESTextureFloat.idl index 950c355c3..6537f4707 100644 --- a/Source/WebCore/html/canvas/OESTextureFloat.idl +++ b/Source/WebCore/html/canvas/OESTextureFloat.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor ] OESTextureFloat { }; diff --git a/Source/WebCore/html/canvas/OESVertexArrayObject.idl b/Source/WebCore/html/canvas/OESVertexArrayObject.idl index cfb6506bb..c4adf99d8 100644 --- a/Source/WebCore/html/canvas/OESVertexArrayObject.idl +++ b/Source/WebCore/html/canvas/OESVertexArrayObject.idl @@ -26,9 +26,9 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums + DoNotCheckConstants ] OESVertexArrayObject { const unsigned int VERTEX_ARRAY_BINDING_OES = 0x85B5; diff --git a/Source/WebCore/html/canvas/Uint16Array.idl b/Source/WebCore/html/canvas/Uint16Array.idl index bb08a4f01..83877b582 100644 --- a/Source/WebCore/html/canvas/Uint16Array.idl +++ b/Source/WebCore/html/canvas/Uint16Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint16Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 2; diff --git a/Source/WebCore/html/canvas/Uint32Array.idl b/Source/WebCore/html/canvas/Uint32Array.idl index 2a87885a7..2726473cb 100644 --- a/Source/WebCore/html/canvas/Uint32Array.idl +++ b/Source/WebCore/html/canvas/Uint32Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/Source/WebCore/html/canvas/Uint8Array.idl b/Source/WebCore/html/canvas/Uint8Array.idl index 1a6f5889f..4892da8a8 100644 --- a/Source/WebCore/html/canvas/Uint8Array.idl +++ b/Source/WebCore/html/canvas/Uint8Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint8Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/Source/WebCore/html/canvas/Uint8ClampedArray.idl b/Source/WebCore/html/canvas/Uint8ClampedArray.idl index 31b8247de..a9a49f362 100644 --- a/Source/WebCore/html/canvas/Uint8ClampedArray.idl +++ b/Source/WebCore/html/canvas/Uint8ClampedArray.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint8ClampedArray : Uint8Array { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp new file mode 100644 index 000000000..02357ef35 --- /dev/null +++ b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEBGL) + +#include "WebGLCompressedTextureS3TC.h" + +#include "Extensions3D.h" +#include "WebGLRenderingContext.h" + +#include <wtf/Int32Array.h> +#include <wtf/OwnArrayPtr.h> + +namespace WebCore { + +WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC(WebGLRenderingContext* context) + : WebGLExtension(context) +{ + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT); + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT); + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT); + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT); +} + +WebGLCompressedTextureS3TC::~WebGLCompressedTextureS3TC() +{ +} + +WebGLExtension::ExtensionName WebGLCompressedTextureS3TC::getName() const +{ + return WebKitWebGLCompressedTextureS3TCName; +} + +PassOwnPtr<WebGLCompressedTextureS3TC> WebGLCompressedTextureS3TC::create(WebGLRenderingContext* context) +{ + return adoptPtr(new WebGLCompressedTextureS3TC(context)); +} + +bool WebGLCompressedTextureS3TC::supported(WebGLRenderingContext* context) +{ + Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); + return extensions->supports("GL_EXT_texture_compression_s3tc") + || (extensions->supports("GL_EXT_texture_compression_dxt1") + && extensions->supports("GL_CHROMIUM_texture_compression_dxt3") + && extensions->supports("GL_CHROMIUM_texture_compression_dxt5")); +} + +} // namespace WebCore + +#endif // ENABLE(WEBGL) diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextures.h b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.h index 52b71c213..93242cb83 100644 --- a/Source/WebCore/html/canvas/WebGLCompressedTextures.h +++ b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,54 +23,30 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebGLCompressedTextures_h -#define WebGLCompressedTextures_h +#ifndef WebGLCompressedTextureS3TC_h +#define WebGLCompressedTextureS3TC_h #include "ExceptionCode.h" #include "WebGLExtension.h" -#include <wtf/ArrayBufferView.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class WebGLTexture; -class WebGLCompressedTextures : public WebGLExtension { +class WebGLCompressedTextureS3TC : public WebGLExtension { public: - static PassOwnPtr<WebGLCompressedTextures> create(WebGLRenderingContext*); + static PassOwnPtr<WebGLCompressedTextureS3TC> create(WebGLRenderingContext*); static bool supported(WebGLRenderingContext*); - virtual ~WebGLCompressedTextures(); + virtual ~WebGLCompressedTextureS3TC(); virtual ExtensionName getName() const; - void compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, - GC3Dsizei height, GC3Dint border, ArrayBufferView* data); - void compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data); - - WebGLGetInfo getCompressedTextureFormats(); - private: - WebGLCompressedTextures(WebGLRenderingContext*); - - bool validateCompressedTexFuncData(const char* functionName, - GC3Dsizei width, GC3Dsizei height, - GC3Denum format, ArrayBufferView* pixels); - - bool validateCompressedTexFormat(GC3Denum format); - - bool validateCompressedTexSubDimensions(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture*); - - bool m_supportsDxt1; - bool m_supportsDxt5; - bool m_supportsEtc1; - bool m_supportsPvrtc; - - Vector<int> m_formats; + WebGLCompressedTextureS3TC(WebGLRenderingContext*); }; } // namespace WebCore -#endif // WebGLCompressedTextures_h +#endif // WebGLCompressedTextureS3TC_h diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextures.idl b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl index bbd9a256c..7fde5bba9 100644 --- a/Source/WebCore/html/canvas/WebGLCompressedTextures.idl +++ b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,21 +26,14 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums - ] WebGLCompressedTextures { + DoNotCheckConstants + ] WebGLCompressedTextureS3TC { /* Compressed Texture Formats */ const unsigned int COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; const unsigned int COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; + const unsigned int COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; const unsigned int COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; - const unsigned int ETC1_RGB8_OES = 0x8D64; - const unsigned int COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00; - const unsigned int COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02; - - [StrictTypeChecking] void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in long width, in long height, in long border, in ArrayBufferView data); - [StrictTypeChecking] void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in long width, in long height, in unsigned long format, in ArrayBufferView data); }; } diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextures.cpp b/Source/WebCore/html/canvas/WebGLCompressedTextures.cpp deleted file mode 100644 index 151980caa..000000000 --- a/Source/WebCore/html/canvas/WebGLCompressedTextures.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WEBGL) - -#include "WebGLCompressedTextures.h" - -#include "Extensions3D.h" -#include "WebGLRenderingContext.h" - -#include <wtf/Int32Array.h> -#include <wtf/OwnArrayPtr.h> - -namespace WebCore { - -WebGLCompressedTextures::WebGLCompressedTextures(WebGLRenderingContext* context) - : WebGLExtension(context) - , m_supportsDxt1(false) - , m_supportsDxt5(false) - , m_supportsEtc1(false) - , m_supportsPvrtc(false) -{ - Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); - if (extensions->supports("GL_EXT_texture_compression_dxt1")) { - extensions->ensureEnabled("GL_EXT_texture_compression_dxt1"); - m_supportsDxt1 = true; - } - if (extensions->supports("GL_EXT_texture_compression_s3tc")) { - extensions->ensureEnabled("GL_EXT_texture_compression_s3tc"); - m_supportsDxt1 = true; - m_supportsDxt5 = true; - } - if (extensions->supports("GL_CHROMIUM_texture_compression_dxt5")) { - extensions->ensureEnabled("GL_CHROMIUM_texture_compression_dxt5"); - m_supportsDxt5 = true; - } - if (extensions->supports("GL_OES_compressed_ETC1_RGB8_texture")) { - extensions->ensureEnabled("GL_OES_compressed_ETC1_RGB8_texture"); - m_supportsEtc1 = true; - } - if (extensions->supports("GL_IMG_texture_compression_pvrtc")) { - extensions->ensureEnabled("GL_IMG_texture_compression_pvrtc"); - m_supportsPvrtc = true; - } - - if (m_supportsDxt1) { - m_formats.append(Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT); - m_formats.append(Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT); - } - - if (m_supportsDxt5) - m_formats.append(Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT); - - if (m_supportsEtc1) - m_formats.append(Extensions3D::ETC1_RGB8_OES); - - if (m_supportsPvrtc) { - m_formats.append(Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG); - m_formats.append(Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG); - } -} - -WebGLCompressedTextures::~WebGLCompressedTextures() -{ -} - -WebGLExtension::ExtensionName WebGLCompressedTextures::getName() const -{ - return WebKitWebGLCompressedTexturesName; -} - -PassOwnPtr<WebGLCompressedTextures> WebGLCompressedTextures::create(WebGLRenderingContext* context) -{ - return adoptPtr(new WebGLCompressedTextures(context)); -} - -bool WebGLCompressedTextures::supported(WebGLRenderingContext* context) -{ - Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); - return extensions->supports("GL_EXT_texture_compression_dxt1") - || extensions->supports("GL_EXT_texture_compression_s3tc") - || extensions->supports("GL_CHROMIUM_texture_compression_dxt5") - || extensions->supports("GL_OES_compressed_ETC1_RGB8_texture") - || extensions->supports("GL_IMG_texture_compression_pvrtc"); -} - -bool WebGLCompressedTextures::validateCompressedTexFormat(GC3Denum format) -{ - switch (format) { - case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: - return m_supportsDxt1; - case Extensions3D::ETC1_RGB8_OES: - return m_supportsEtc1; - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: - return m_supportsDxt5; - case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG: - case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: - return m_supportsPvrtc; - } - return false; -} - -bool WebGLCompressedTextures::validateCompressedTexFuncData(const char* functionName, - GC3Dsizei width, GC3Dsizei height, - GC3Denum format, ArrayBufferView* pixels) -{ - if (!pixels) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels"); - return false; - } - if (width < 0 || height < 0) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0"); - return false; - } - - unsigned int bytesRequired = 0; - - switch (format) { - case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: - case Extensions3D::ETC1_RGB8_OES: - { - const int kBlockWidth = 4; - const int kBlockHeight = 4; - const int kBlockSize = 8; - int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; - int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; - int numBlocks = numBlocksAcross * numBlocksDown; - bytesRequired = numBlocks * kBlockSize; - } - break; - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: - { - const int kBlockWidth = 4; - const int kBlockHeight = 4; - const int kBlockSize = 16; - int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; - int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; - int numBlocks = numBlocksAcross * numBlocksDown; - bytesRequired = numBlocks * kBlockSize; - } - break; - case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG: - case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: - { - bytesRequired = (std::max(width, 8) * std::max(height, 8) + 7) / 8; - } - break; - default: - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format"); - return false; - } - - if (pixels->byteLength() != bytesRequired) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "length of ArrayBufferView is not correct for dimensions"); - return false; - } - - return true; -} - -bool WebGLCompressedTextures::validateCompressedTexSubDimensions(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex) -{ - switch (format) { - case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: - case Extensions3D::ETC1_RGB8_OES: - { - const int kBlockWidth = 4; - const int kBlockHeight = 4; - if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) - return false; - if (!xoffset) { - if (width != tex->getWidth(target, level)) - return false; - } else { - if (width % kBlockWidth) - return false; - } - if (!yoffset) { - if (height != tex->getHeight(target, level)) - return false; - } else { - if (height % kBlockHeight) - return false; - } - return true; - } - case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG: - case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: - { - if (xoffset || yoffset - || width != tex->getWidth(target, level) || height != tex->getHeight(target, level)) { - return false; - } - return true; - } - } - return false; -} - -void WebGLCompressedTextures::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, - GC3Dsizei height, GC3Dint border, ArrayBufferView* data) -{ - if (m_context->isContextLost()) - return; - if (!validateCompressedTexFormat(internalformat)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat"); - return; - } - if (border) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0"); - return; - } - if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data)) - return; - WebGLTexture* tex = m_context->validateTextureBinding("compressedTexImage2D", target, true); - if (!tex) - return; - if (!m_context->isGLES2NPOTStrict()) { - if (level && WebGLTexture::isNPOT(width, height)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "level > 0 not power of 2"); - return; - } - } - m_context->graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height, - border, data->byteLength(), data->baseAddress()); - tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE); - m_context->cleanupAfterGraphicsCall(false); -} - -void WebGLCompressedTextures::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data) -{ - if (m_context->isContextLost()) - return; - if (!validateCompressedTexFormat(format)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format"); - return; - } - if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data)) - return; - - WebGLTexture* tex = m_context->validateTextureBinding("compressedTexSubImage2D", target, true); - if (!tex) - return; - - if (format != tex->getInternalFormat(target, level)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexSubImage2D", "format does not match texture format"); - return; - } - - if (!validateCompressedTexSubDimensions(target, level, xoffset, yoffset, width, height, format, tex)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "compressedTexSubImage2D", "dimensions invalid for format"); - return; - } - - m_context->graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset, - width, height, format, data->byteLength(), data->baseAddress()); - m_context->cleanupAfterGraphicsCall(false); -} - -WebGLGetInfo WebGLCompressedTextures::getCompressedTextureFormats() -{ - return WebGLGetInfo(Int32Array::create(&m_formats[0], m_formats.size())); -} - -} // namespace WebCore - -#endif // ENABLE(WEBGL) diff --git a/Source/WebCore/html/canvas/WebGLContextEvent.idl b/Source/WebCore/html/canvas/WebGLContextEvent.idl index 8b4bbddbc..3735f1245 100644 --- a/Source/WebCore/html/canvas/WebGLContextEvent.idl +++ b/Source/WebCore/html/canvas/WebGLContextEvent.idl @@ -29,7 +29,7 @@ module html { Conditional=WEBGL, ConstructorTemplate=Event ] WebGLContextEvent : Event { - readonly attribute [InitializedByConstructor] DOMString statusMessage; + readonly attribute [InitializedByEventConstructor] DOMString statusMessage; }; } diff --git a/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl b/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl index da2082a2c..b307a1498 100644 --- a/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl +++ b/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl @@ -26,9 +26,9 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums + DoNotCheckConstants ] WebGLDebugRendererInfo { const unsigned int UNMASKED_VENDOR_WEBGL = 0x9245; const unsigned int UNMASKED_RENDERER_WEBGL = 0x9246; diff --git a/Source/WebCore/html/canvas/WebGLDebugShaders.idl b/Source/WebCore/html/canvas/WebGLDebugShaders.idl index ce120327d..82d047550 100644 --- a/Source/WebCore/html/canvas/WebGLDebugShaders.idl +++ b/Source/WebCore/html/canvas/WebGLDebugShaders.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor ] WebGLDebugShaders { [StrictTypeChecking, ConvertNullStringTo=Null] DOMString getTranslatedShaderSource(in WebGLShader shader) raises(DOMException); diff --git a/Source/WebCore/html/canvas/WebGLExtension.h b/Source/WebCore/html/canvas/WebGLExtension.h index 4ff969086..ff482facd 100644 --- a/Source/WebCore/html/canvas/WebGLExtension.h +++ b/Source/WebCore/html/canvas/WebGLExtension.h @@ -40,7 +40,7 @@ public: OESVertexArrayObjectName, WebGLDebugRendererInfoName, WebGLDebugShadersName, - WebKitWebGLCompressedTexturesName, // WEBKIT_ prefix until extension is official + WebKitWebGLCompressedTextureS3TCName, // WEBKIT_ prefix until extension is official }; void ref() { m_context->ref(); } diff --git a/Source/WebCore/html/canvas/WebGLGetInfo.cpp b/Source/WebCore/html/canvas/WebGLGetInfo.cpp index 87bec7919..f7166c419 100644 --- a/Source/WebCore/html/canvas/WebGLGetInfo.cpp +++ b/Source/WebCore/html/canvas/WebGLGetInfo.cpp @@ -38,6 +38,7 @@ #include "WebGLVertexArrayObjectOES.h" #include <wtf/Float32Array.h> #include <wtf/Int32Array.h> +#include <wtf/Uint32Array.h> #include <wtf/Uint8Array.h> namespace WebCore { @@ -191,6 +192,16 @@ WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint8Array> value) { } +WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint32Array> value) + : m_type(kTypeWebGLUnsignedIntArray) + , m_bool(false) + , m_float(0) + , m_int(0) + , m_unsignedInt(0) + , m_webglUnsignedIntArray(value) +{ +} + WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value) : m_type(kTypeWebGLVertexArrayObjectOES) , m_bool(false) @@ -294,6 +305,12 @@ PassRefPtr<Uint8Array> WebGLGetInfo::getWebGLUnsignedByteArray() const return m_webglUnsignedByteArray; } +PassRefPtr<Uint32Array> WebGLGetInfo::getWebGLUnsignedIntArray() const +{ + ASSERT(getType() == kTypeWebGLUnsignedIntArray); + return m_webglUnsignedIntArray; +} + PassRefPtr<WebGLVertexArrayObjectOES> WebGLGetInfo::getWebGLVertexArrayObjectOES() const { ASSERT(getType() == kTypeWebGLVertexArrayObjectOES); diff --git a/Source/WebCore/html/canvas/WebGLGetInfo.h b/Source/WebCore/html/canvas/WebGLGetInfo.h index f747a0902..d1f73a656 100644 --- a/Source/WebCore/html/canvas/WebGLGetInfo.h +++ b/Source/WebCore/html/canvas/WebGLGetInfo.h @@ -39,6 +39,7 @@ #include <wtf/Int32Array.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> +#include <wtf/Uint32Array.h> #include <wtf/Uint8Array.h> namespace WebCore { @@ -67,6 +68,7 @@ public: kTypeWebGLRenderbuffer, kTypeWebGLTexture, kTypeWebGLUnsignedByteArray, + kTypeWebGLUnsignedIntArray, kTypeWebGLVertexArrayObjectOES, }; @@ -88,6 +90,7 @@ public: explicit WebGLGetInfo(PassRefPtr<WebGLRenderbuffer> value); explicit WebGLGetInfo(PassRefPtr<WebGLTexture> value); explicit WebGLGetInfo(PassRefPtr<Uint8Array> value); + explicit WebGLGetInfo(PassRefPtr<Uint32Array> value); explicit WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value); virtual ~WebGLGetInfo(); @@ -110,6 +113,7 @@ public: PassRefPtr<WebGLRenderbuffer> getWebGLRenderbuffer() const; PassRefPtr<WebGLTexture> getWebGLTexture() const; PassRefPtr<Uint8Array> getWebGLUnsignedByteArray() const; + PassRefPtr<Uint32Array> getWebGLUnsignedIntArray() const; PassRefPtr<WebGLVertexArrayObjectOES> getWebGLVertexArrayObjectOES() const; private: @@ -130,6 +134,7 @@ private: RefPtr<WebGLRenderbuffer> m_webglRenderbuffer; RefPtr<WebGLTexture> m_webglTexture; RefPtr<Uint8Array> m_webglUnsignedByteArray; + RefPtr<Uint32Array> m_webglUnsignedIntArray; RefPtr<WebGLVertexArrayObjectOES> m_webglVertexArrayObject; }; diff --git a/Source/WebCore/html/canvas/WebGLLoseContext.idl b/Source/WebCore/html/canvas/WebGLLoseContext.idl index 50955cbb6..390da2638 100644 --- a/Source/WebCore/html/canvas/WebGLLoseContext.idl +++ b/Source/WebCore/html/canvas/WebGLLoseContext.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor ] WebGLLoseContext { [StrictTypeChecking] void loseContext(); diff --git a/Source/WebCore/html/canvas/WebGLObject.cpp b/Source/WebCore/html/canvas/WebGLObject.cpp index 192852c75..6d7b9d8cf 100644 --- a/Source/WebCore/html/canvas/WebGLObject.cpp +++ b/Source/WebCore/html/canvas/WebGLObject.cpp @@ -32,7 +32,7 @@ #include "OESStandardDerivatives.h" #include "OESTextureFloat.h" #include "OESVertexArrayObject.h" -#include "WebGLCompressedTextures.h" +#include "WebGLCompressedTextureS3TC.h" #include "WebGLContextGroup.h" #include "WebGLDebugRendererInfo.h" #include "WebGLDebugShaders.h" diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp index 945c17e74..9a5a295b5 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -54,7 +54,7 @@ #include "Settings.h" #include "WebGLActiveInfo.h" #include "WebGLBuffer.h" -#include "WebGLCompressedTextures.h" +#include "WebGLCompressedTextureS3TC.h" #include "WebGLContextAttributes.h" #include "WebGLContextEvent.h" #include "WebGLContextGroup.h" @@ -72,6 +72,7 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnArrayPtr.h> #include <wtf/Uint16Array.h> +#include <wtf/Uint32Array.h> #include <wtf/text/StringBuilder.h> #if PLATFORM(QT) @@ -404,7 +405,7 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes, hostWindow)); - if (!context) { + if (!context || !context->makeContextCurrent()) { canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context.")); return nullptr; } @@ -517,6 +518,10 @@ void WebGLRenderingContext::setupFlags() { ASSERT(m_context); + Page* p = canvas()->document()->page(); + if (p && p->settings()->webGLErrorsToConsoleEnabled()) + m_synthesizedErrorsToConsole = true; + m_isGLES2Compliant = m_context->isGLES2Compliant(); m_isErrorGeneratedOnOutOfBoundsAccesses = m_context->getExtensions()->isEnabled("GL_CHROMIUM_strict_attribs"); m_isResourceSafe = m_context->getExtensions()->isEnabled("GL_CHROMIUM_resource_safe"); @@ -537,6 +542,12 @@ bool WebGLRenderingContext::allowPrivilegedExtensions() const return false; } +void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format) +{ + if (!m_compressedTextureFormats.contains(format)) + m_compressedTextureFormats.append(format); +} + WebGLRenderingContext::~WebGLRenderingContext() { // Remove all references to WebGLObjects so if they are the last reference @@ -1208,24 +1219,71 @@ void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionCode& ec cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::compressedTexImage2D(GC3Denum /*target*/, GC3Dint /*level*/, GC3Denum /*internalformat*/, GC3Dsizei /*width*/, - GC3Dsizei /*height*/, GC3Dint /*border*/, ArrayBufferView* /*data*/) +void WebGLRenderingContext::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, + GC3Dsizei height, GC3Dint border, ArrayBufferView* data) { if (isContextLost()) return; + if (!validateTexFuncLevel("compressedTexImage2D", target, level)) + return; + + if (!validateCompressedTexFormat(internalformat)) { + synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat"); + return; + } + if (border) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0"); + return; + } + if (!validateCompressedTexDimensions("compressedTexImage2D", level, width, height, internalformat)) + return; + if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data)) + return; - // FIXME: implement this. - synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat"); + WebGLTexture* tex = validateTextureBinding("compressedTexImage2D", target, true); + if (!tex) + return; + if (!isGLES2NPOTStrict()) { + if (level && WebGLTexture::isNPOT(width, height)) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "level > 0 not power of 2"); + return; + } + } + graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height, + border, data->byteLength(), data->baseAddress()); + tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE); + cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum /*target*/, GC3Dint /*level*/, GC3Dint /*xoffset*/, GC3Dint /*yoffset*/, - GC3Dsizei /*width*/, GC3Dsizei /*height*/, GC3Denum /*format*/, ArrayBufferView* /*data*/) +void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, + GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data) { if (isContextLost()) return; + if (!validateTexFuncLevel("compressedTexSubImage2D", target, level)) + return; + if (!validateCompressedTexFormat(format)) { + synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format"); + return; + } + if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data)) + return; + + WebGLTexture* tex = validateTextureBinding("compressedTexSubImage2D", target, true); + if (!tex) + return; + + if (format != tex->getInternalFormat(target, level)) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "compressedTexSubImage2D", "format does not match texture format"); + return; + } + + if (!validateCompressedTexSubDimensions("compressedTexSubImage2D", target, level, xoffset, yoffset, width, height, format, tex)) + return; - // FIXME: implement this. - synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format"); + graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset, + width, height, format, data->byteLength(), data->baseAddress()); + cleanupAfterGraphicsCall(false); } void WebGLRenderingContext::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border) @@ -2186,11 +2244,11 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name) m_webglLoseContext = WebGLLoseContext::create(this); return m_webglLoseContext.get(); } - if (equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_textures")) { + if (equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_texture_s3tc")) { // Use WEBKIT_ prefix until extension is official. - if (!m_webglCompressedTextures) - m_webglCompressedTextures = WebGLCompressedTextures::create(this); - return m_webglCompressedTextures.get(); + if (!m_webglCompressedTextureS3TC) + m_webglCompressedTextureS3TC = WebGLCompressedTextureS3TC::create(this); + return m_webglCompressedTextureS3TC.get(); } if (allowPrivilegedExtensions()) { @@ -2303,10 +2361,7 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& case GraphicsContext3D::COLOR_WRITEMASK: return getBooleanArrayParameter(pname); case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS: - if (m_webglCompressedTextures) - return m_webglCompressedTextures->getCompressedTextureFormats(); - // Defined as null in the spec - return WebGLGetInfo(); + return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size())); case GraphicsContext3D::CULL_FACE: return getBooleanParameter(pname); case GraphicsContext3D::CULL_FACE_MODE: @@ -2361,9 +2416,6 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& return getIntParameter(pname); case GraphicsContext3D::MAX_VIEWPORT_DIMS: return getWebGLIntArrayParameter(pname); - case GraphicsContext3D::NUM_COMPRESSED_TEXTURE_FORMATS: - // WebGL 1.0 specifies that there are no compressed texture formats. - return WebGLGetInfo(static_cast<int>(0)); case GraphicsContext3D::NUM_SHADER_BINARY_FORMATS: // FIXME: should we always return 0 for this? return getIntParameter(pname); @@ -2513,7 +2565,7 @@ String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, Exception if (!validateWebGLObject("getProgramInfoLog", program)) return ""; WebGLStateRestorer(this, false); - return m_context->getProgramInfoLog(objectOrZero(program)); + return ensureNotNull(m_context->getProgramInfoLog(objectOrZero(program))); } WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec) @@ -2613,7 +2665,7 @@ String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCod if (!validateWebGLObject("getShaderInfoLog", shader)) return ""; WebGLStateRestorer(this, false); - return m_context->getShaderInfoLog(objectOrZero(shader)); + return ensureNotNull(m_context->getShaderInfoLog(objectOrZero(shader))); } String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec) @@ -2623,7 +2675,7 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode return String(); if (!validateWebGLObject("getShaderSource", shader)) return ""; - return shader->getSource(); + return ensureNotNull(shader->getSource()); } Vector<String> WebGLRenderingContext::getSupportedExtensions() @@ -2636,8 +2688,8 @@ Vector<String> WebGLRenderingContext::getSupportedExtensions() if (m_context->getExtensions()->supports("GL_OES_vertex_array_object")) result.append("OES_vertex_array_object"); result.append("WEBKIT_WEBGL_lose_context"); - if (WebGLCompressedTextures::supported(this)) - result.append("WEBKIT_WEBGL_compressed_textures"); + if (WebGLCompressedTextureS3TC::supported(this)) + result.append("WEBKIT_WEBGL_compressed_texture_s3tc"); if (allowPrivilegedExtensions()) { if (m_context->getExtensions()->supports("GL_ANGLE_translated_shader_source")) @@ -4681,6 +4733,117 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, return true; } +bool WebGLRenderingContext::validateCompressedTexFormat(GC3Denum format) +{ + return m_compressedTextureFormats.contains(format); +} + +bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionName, + GC3Dsizei width, GC3Dsizei height, + GC3Denum format, ArrayBufferView* pixels) +{ + if (!pixels) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels"); + return false; + } + if (width < 0 || height < 0) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0"); + return false; + } + + unsigned int bytesRequired = 0; + + switch (format) { + case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: + { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + const int kBlockSize = 8; + int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; + int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; + int numBlocks = numBlocksAcross * numBlocksDown; + bytesRequired = numBlocks * kBlockSize; + } + break; + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: + { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + const int kBlockSize = 16; + int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; + int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; + int numBlocks = numBlocksAcross * numBlocksDown; + bytesRequired = numBlocks * kBlockSize; + } + break; + default: + synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format"); + return false; + } + + if (pixels->byteLength() != bytesRequired) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "length of ArrayBufferView is not correct for dimensions"); + return false; + } + + return true; +} + +bool WebGLRenderingContext::validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format) +{ + switch (format) { + case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + bool widthValid = (level && width == 1) || (level && width == 2) || !(width % kBlockWidth); + bool heightValid = (level && height == 1) || (level && height == 2) || !(height % kBlockHeight); + if (!widthValid || !heightValid) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "width or height invalid for level"); + return false; + } + return true; + } + default: + return false; + } +} + +bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, + GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex) +{ + if (xoffset < 0 || yoffset < 0) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "xoffset or yoffset < 0"); + return false; + } + + switch (format) { + case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "xoffset or yoffset not multiple of 4"); + return false; + } + if (width - xoffset > tex->getWidth(target, level) + || height - yoffset > tex->getHeight(target, level)) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "dimensions out of range"); + return false; + } + return validateCompressedTexDimensions(functionName, level, width, height, format); + } + default: + return false; + } +} + bool WebGLRenderingContext::validateDrawMode(const char* functionName, GC3Denum mode) { switch (mode) { @@ -5123,6 +5286,13 @@ void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*) canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, "")); } +String WebGLRenderingContext::ensureNotNull(const String& text) const +{ + if (text.isNull()) + return WTF::emptyString(); + return text; +} + WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity) : m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity])) , m_capacity(capacity) diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h index 620b4d4e6..0449eade1 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.h +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h @@ -52,7 +52,7 @@ class WebGLActiveInfo; class WebGLBuffer; class WebGLContextGroup; class WebGLContextObject; -class WebGLCompressedTextures; +class WebGLCompressedTextureS3TC; class WebGLContextAttributes; class WebGLDebugRendererInfo; class WebGLDebugShaders; @@ -321,7 +321,7 @@ public: friend class WebGLObject; friend class OESVertexArrayObject; friend class WebGLDebugShaders; - friend class WebGLCompressedTextures; + friend class WebGLCompressedTextureS3TC; friend class WebGLRenderingContextErrorMessageCallback; WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes); @@ -367,6 +367,9 @@ public: bool validateWebGLObject(const char*, WebGLObject*); + // Adds a compressed texture format. + void addCompressedTextureFormat(GC3Denum); + #if ENABLE(VIDEO) PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, ExceptionCode&); #endif @@ -443,6 +446,8 @@ public: RefPtr<WebGLTexture> m_blackTexture2D; RefPtr<WebGLTexture> m_blackTextureCubeMap; + Vector<GC3Denum> m_compressedTextureFormats; + // Fixed-size cache of reusable image buffers for video texImage2D calls. class LRUImageBufferCache { public: @@ -500,7 +505,7 @@ public: OwnPtr<WebGLLoseContext> m_webglLoseContext; OwnPtr<WebGLDebugRendererInfo> m_webglDebugRendererInfo; OwnPtr<WebGLDebugShaders> m_webglDebugShaders; - OwnPtr<WebGLCompressedTextures> m_webglCompressedTextures; + OwnPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; // Helpers for getParameter and others WebGLGetInfo getBooleanParameter(GC3Denum); @@ -588,6 +593,24 @@ public: GC3Denum format, GC3Denum type, ArrayBufferView* pixels); + // Helper function to validate compressed texture data is correct size + // for the given format and dimensions. + bool validateCompressedTexFuncData(const char* functionName, + GC3Dsizei width, GC3Dsizei height, + GC3Denum format, ArrayBufferView* pixels); + + // Helper function for validating compressed texture formats. + bool validateCompressedTexFormat(GC3Denum format); + + // Helper function to validate compressed texture dimensions are valid for + // the given format. + bool validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format); + + // Helper function to validate compressed texture dimensions are valid for + // the given format. + bool validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, + GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture*); + // Helper function to validate mode for draw{Arrays/Elements}. bool validateDrawMode(const char* functionName, GC3Denum); @@ -662,6 +685,8 @@ public: // to the JavaScript console. void synthesizeGLError(GC3Denum, const char* functionName, const char* description); + String ensureNotNull(const String&) const; + friend class WebGLStateRestorer; }; diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.idl b/Source/WebCore/html/canvas/WebGLRenderingContext.idl index 16aae17b0..6db811dd8 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.idl @@ -27,8 +27,8 @@ module html { interface [ Conditional=WEBGL, - CustomMarkFunction, - DontCheckEnums + JSCustomMarkFunction, + DoNotCheckConstants ] WebGLRenderingContext : CanvasRenderingContext { /* ClearBufferMask */ @@ -206,7 +206,6 @@ module html { /* TEXTURE_WRAP_S */ /* TEXTURE_WRAP_T */ - const unsigned int NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; const unsigned int COMPRESSED_TEXTURE_FORMATS = 0x86A3; /* HintMode */ diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp index 0ee89f152..e551c2ff5 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp +++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp @@ -432,7 +432,7 @@ inline PassOwnPtr<NamedNodeMap> cloneAttributes(Element* element) OwnPtr<NamedNodeMap> newAttributes = NamedNodeMap::create(); for (size_t i = 0; i < attributes->length(); ++i) { Attribute* attribute = attributes->attributeItem(i); - RefPtr<Attribute> clone = Attribute::createMapped(attribute->name(), attribute->value()); + RefPtr<Attribute> clone = Attribute::create(attribute->name(), attribute->value()); newAttributes->addAttribute(clone); } return newAttributes.release(); diff --git a/Source/WebCore/html/parser/HTMLFormattingElementList.cpp b/Source/WebCore/html/parser/HTMLFormattingElementList.cpp index f331af7e7..0145de0e6 100644 --- a/Source/WebCore/html/parser/HTMLFormattingElementList.cpp +++ b/Source/WebCore/html/parser/HTMLFormattingElementList.cpp @@ -40,9 +40,9 @@ namespace WebCore { // Noah's Ark of Formatting Elements can fit three of each element. static const size_t kNoahsArkCapacity = 3; -static inline size_t attributeCount(Element* element) +static inline size_t attributeCountWithoutUpdate(Element* element) { - return element->attributeMap() ? element->attributeMap()->length() : 0; + return element->hasAttributesWithoutUpdate() ? element->attributeCount() : 0; } HTMLFormattingElementList::HTMLFormattingElementList() @@ -142,7 +142,7 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* new // of a quickly ensuring the condition. Vector<Element*, 10> candidates; - size_t newElementAttributeCount = attributeCount(newElement); + size_t newElementAttributeCount = attributeCountWithoutUpdate(newElement); for (size_t i = m_entries.size(); i; ) { --i; @@ -154,7 +154,7 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* new Element* candidate = entry.element(); if (newElement->tagQName() != candidate->tagQName()) continue; - if (attributeCount(candidate) != newElementAttributeCount) + if (attributeCountWithoutUpdate(candidate) != newElementAttributeCount) continue; candidates.append(candidate); @@ -178,18 +178,16 @@ void HTMLFormattingElementList::ensureNoahsArkCondition(Element* newElement) Vector<Element*> remainingCandidates; remainingCandidates.reserveInitialCapacity(candidates.size()); - NamedNodeMap* attributeMap = newElement->attributeMap(); - size_t newElementAttributeCount = attributeCount(newElement); + size_t newElementAttributeCount = attributeCountWithoutUpdate(newElement); for (size_t i = 0; i < newElementAttributeCount; ++i) { - QualifiedName attributeName = attributeMap->attributeItem(i)->name(); - AtomicString attributeValue = newElement->fastGetAttribute(attributeName); + Attribute* attribute = newElement->attributeItem(i); for (size_t j = 0; j < candidates.size(); ++j) { Element* candidate = candidates[j]; // These properties should already have been checked by tryToEnsureNoahsArkConditionQuickly. - ASSERT(newElement->attributeMap()->length() == candidate->attributeMap()->length()); + ASSERT(newElement->attributeCount() == candidate->attributeCount()); ASSERT(newElement->tagQName() == candidate->tagQName()); // FIXME: Technically we shouldn't read this information back from @@ -199,7 +197,7 @@ void HTMLFormattingElementList::ensureNoahsArkCondition(Element* newElement) // that implementations can run off the main thread. If JavaScript // changes the attributes values, we could get a slightly wrong // output here. - if (candidate->fastGetAttribute(attributeName) == attributeValue) + if (candidate->fastGetAttribute(attribute->name()) == attribute->value()) remainingCandidates.append(candidate); } diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 09e0a8e10..9d839120d 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -452,7 +452,7 @@ void HTMLTreeBuilder::constructTreeFromToken(HTMLToken& rawToken) // // FIXME: Stop clearing the rawToken once we start running the parser off // the main thread or once we stop allowing synchronous JavaScript - // execution from parseMappedAttribute. + // execution from parseAttribute. if (rawToken.type() != HTMLTokenTypes::Character) rawToken.clear(); @@ -571,7 +571,7 @@ PassOwnPtr<NamedNodeMap> HTMLTreeBuilder::attributesForIsindexInput(AtomicHTMLTo attributes->removeAttribute(promptAttr); } - RefPtr<Attribute> mappedAttribute = Attribute::createMapped(nameAttr, isindexTag.localName()); + RefPtr<Attribute> mappedAttribute = Attribute::create(nameAttr, isindexTag.localName()); attributes->insertAttribute(mappedAttribute.release(), false); return attributes.release(); } diff --git a/Source/WebCore/html/parser/TextDocumentParser.cpp b/Source/WebCore/html/parser/TextDocumentParser.cpp index 1c55fc254..f4601de6a 100644 --- a/Source/WebCore/html/parser/TextDocumentParser.cpp +++ b/Source/WebCore/html/parser/TextDocumentParser.cpp @@ -60,7 +60,7 @@ void TextDocumentParser::insertFakePreElement() // sending fake bytes through the front-end of the parser to avoid // distrubing the line/column number calculations. - RefPtr<Attribute> styleAttribute = Attribute::createMapped("style", "word-wrap: break-word; white-space: pre-wrap;"); + RefPtr<Attribute> styleAttribute = Attribute::create("style", "word-wrap: break-word; white-space: pre-wrap;"); OwnPtr<NamedNodeMap> attributes = NamedNodeMap::create(); attributes->insertAttribute(styleAttribute.release(), false); AtomicHTMLToken fakePre(HTMLTokenTypes::StartTag, preTag.localName(), attributes.release()); diff --git a/Source/WebCore/html/shadow/HTMLContentElement.cpp b/Source/WebCore/html/shadow/HTMLContentElement.cpp index c1a1ef083..961dd1d30 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.cpp +++ b/Source/WebCore/html/shadow/HTMLContentElement.cpp @@ -118,13 +118,13 @@ void HTMLContentElement::setSelect(const AtomicString& selectValue) setAttribute(selectAttr, selectValue); } -void HTMLContentElement::parseMappedAttribute(Attribute* attr) +void HTMLContentElement::parseAttribute(Attribute* attr) { if (attr->name() == selectAttr) { if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) root->setNeedsReattachHostChildrenAndShadow(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/shadow/HTMLContentElement.h b/Source/WebCore/html/shadow/HTMLContentElement.h index 7845e0937..6e1816c78 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.h +++ b/Source/WebCore/html/shadow/HTMLContentElement.h @@ -73,7 +73,7 @@ private: virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) { return 0; } - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; OwnPtr<ShadowInclusionList> m_inclusions; }; diff --git a/Source/WebCore/html/shadow/HTMLContentElement.idl b/Source/WebCore/html/shadow/HTMLContentElement.idl index 0febfa26b..c928d4494 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.idl +++ b/Source/WebCore/html/shadow/HTMLContentElement.idl @@ -27,7 +27,7 @@ module html { interface [ Conditional=SHADOW_DOM, - EnabledAtRuntime=shadowDOM + V8EnabledAtRuntime=shadowDOM ] HTMLContentElement : HTMLElement { attribute [Reflect] DOMString select; }; diff --git a/Source/WebCore/html/IsIndexInputType.cpp b/Source/WebCore/html/shadow/HTMLShadowElement.cpp index a275f28eb..cb01cd21f 100644 --- a/Source/WebCore/html/IsIndexInputType.cpp +++ b/Source/WebCore/html/shadow/HTMLShadowElement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,51 +29,32 @@ */ #include "config.h" -#include "IsIndexInputType.h" -#include "Document.h" -#include "HTMLFormElement.h" -#include "HTMLInputElement.h" -#include <wtf/PassOwnPtr.h> +#if ENABLE(SHADOW_DOM) -namespace WebCore { +#include "HTMLShadowElement.h" -PassOwnPtr<InputType> IsIndexInputType::create(HTMLInputElement* element) -{ - return adoptPtr(new IsIndexInputType(element)); -} +#include "HTMLNames.h" -const AtomicString& IsIndexInputType::formControlType() const -{ - return emptyAtom; -} +namespace WebCore { -bool IsIndexInputType::supportsRequired() const +class Document; + +inline HTMLShadowElement::HTMLShadowElement(const QualifiedName& tagName, Document* document) + : HTMLElement(tagName, document) { - return false; + ASSERT(hasTagName(HTMLNames::shadowTag)); } -PassRefPtr<HTMLFormElement> IsIndexInputType::formForSubmission() const +PassRefPtr<HTMLShadowElement> HTMLShadowElement::create(const QualifiedName& tagName, Document* document) { - RefPtr<HTMLFormElement> form = InputType::formForSubmission(); - if (form) - return form.release(); - // If there is no form, then create a temporary form just to be used for submission. - Document* document = element()->document(); - form = HTMLFormElement::create(document); - form->registerFormElement(element()); - form->setMethod("GET"); - if (!document->baseURL().isEmpty()) { - // We treat the href property of the <base> element as the form action, as per section 7.5 - // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>. - form->setAction(document->baseURL().string()); - } - return form.release(); + return adoptRef(new HTMLShadowElement(tagName, document)); } -bool IsIndexInputType::shouldRespectListAttribute() +HTMLShadowElement::~HTMLShadowElement() { - return false; } } // namespace WebCore + +#endif // ENABLE(SHADOW_DOM) diff --git a/Source/WebCore/html/IsIndexInputType.h b/Source/WebCore/html/shadow/HTMLShadowElement.h index 2cf702f85..bfc85e2fb 100644 --- a/Source/WebCore/html/IsIndexInputType.h +++ b/Source/WebCore/html/shadow/HTMLShadowElement.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,26 +28,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IsIndexInputType_h -#define IsIndexInputType_h +#ifndef HTMLShadowElement_h +#define HTMLShadowElement_h -#include "TextFieldInputType.h" -#include <wtf/text/AtomicString.h> +#if ENABLE(SHADOW_DOM) + +#include "HTMLElement.h" namespace WebCore { -class IsIndexInputType : public TextFieldInputType { +class HTMLShadowElement : public HTMLElement { public: - static PassOwnPtr<InputType> create(HTMLInputElement*); + static PassRefPtr<HTMLShadowElement> create(const QualifiedName&, Document*); + + virtual ~HTMLShadowElement(); private: - IsIndexInputType(HTMLInputElement* element) : TextFieldInputType(element) { }; - virtual const AtomicString& formControlType() const OVERRIDE; - virtual bool supportsRequired() const OVERRIDE; - virtual PassRefPtr<HTMLFormElement> formForSubmission() const OVERRIDE; - virtual bool shouldRespectListAttribute() OVERRIDE; + HTMLShadowElement(const QualifiedName&, Document*); }; } // namespace WebCore -#endif // IsIndexInputType_h +#endif // ENABLE(SHADOW_DOM) + +#endif // HTMLShadowElement_h diff --git a/Source/WebCore/html/shadow/HTMLShadowElement.idl b/Source/WebCore/html/shadow/HTMLShadowElement.idl new file mode 100644 index 000000000..1310a1482 --- /dev/null +++ b/Source/WebCore/html/shadow/HTMLShadowElement.idl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + Conditional=SHADOW_DOM, + EnabledAtRuntime=shadowDOM + ] HTMLShadowElement : HTMLElement { + }; + +} diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp index c75b2b78c..e932e73d3 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -175,7 +175,7 @@ void MediaControlPanelElement::endDrag() void MediaControlPanelElement::setPosition(const LayoutPoint& position) { - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); double left = position.x(); double top = position.y(); @@ -193,7 +193,7 @@ void MediaControlPanelElement::setPosition(const LayoutPoint& position) void MediaControlPanelElement::resetPosition() { - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); style->removeProperty(CSSPropertyLeft); style->removeProperty(CSSPropertyTop); @@ -211,7 +211,7 @@ void MediaControlPanelElement::makeOpaque() double duration = document()->page() ? document()->page()->theme()->mediaControlsFadeInDuration() : 0; - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity); style->setProperty(CSSPropertyWebkitTransitionDuration, duration, CSSPrimitiveValue::CSS_S); style->setProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBER); @@ -224,7 +224,7 @@ void MediaControlPanelElement::makeTransparent() if (!m_opaque) return; - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity); style->setProperty(CSSPropertyWebkitTransitionDuration, document()->page()->theme()->mediaControlsFadeOutDuration(), CSSPrimitiveValue::CSS_S); style->setProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBER); diff --git a/Source/WebCore/html/shadow/MeterShadowElement.cpp b/Source/WebCore/html/shadow/MeterShadowElement.cpp index be1041f71..410535414 100644 --- a/Source/WebCore/html/shadow/MeterShadowElement.cpp +++ b/Source/WebCore/html/shadow/MeterShadowElement.cpp @@ -32,12 +32,12 @@ #if ENABLE(METER_TAG) #include "MeterShadowElement.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "HTMLMeterElement.h" #include "HTMLNames.h" #include "RenderMeter.h" #include "RenderTheme.h" +#include "StylePropertySet.h" namespace WebCore { diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index 60b9e3527..319a11e80 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -334,7 +334,7 @@ PassRefPtr<TrackLimiterElement> TrackLimiterElement::create(Document* document) { RefPtr<TrackLimiterElement> element = adoptRef(new TrackLimiterElement(document)); - CSSMutableStyleDeclaration* style = element->ensureInlineStyleDecl(); + StylePropertySet* style = element->ensureInlineStyleDecl(); style->setProperty(CSSPropertyVisibility, CSSValueHidden); style->setProperty(CSSPropertyPosition, CSSValueStatic); diff --git a/Source/WebCore/html/track/TextTrackList.idl b/Source/WebCore/html/track/TextTrackList.idl index f1460b6da..aedda2e07 100644 --- a/Source/WebCore/html/track/TextTrackList.idl +++ b/Source/WebCore/html/track/TextTrackList.idl @@ -27,11 +27,11 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, - HasIndexGetter, + V8EnabledAtRuntime=webkitVideoTrack, + IndexedGetter, EventTarget, - CustomMarkFunction, - CustomIsReachable + JSCustomMarkFunction, + JSCustomIsReachable ] TextTrackList { readonly attribute unsigned long length; TextTrack item(in unsigned long index); diff --git a/Source/WebCore/html/track/TrackEvent.idl b/Source/WebCore/html/track/TrackEvent.idl index 5d28f3b53..b475ad41a 100644 --- a/Source/WebCore/html/track/TrackEvent.idl +++ b/Source/WebCore/html/track/TrackEvent.idl @@ -27,10 +27,10 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, + V8EnabledAtRuntime=webkitVideoTrack, ConstructorTemplate=Event ] TrackEvent : Event { - readonly attribute [InitializedByConstructor, CustomGetter] object track; + readonly attribute [InitializedByEventConstructor, CustomGetter] object track; }; } |