WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch for EWS and brave people
bug-77204-wip.diff (text/plain), 127.32 KB, created by
Andreas Kling
on 2012-01-27 05:08:04 PST
(
hide
)
Description:
Patch for EWS and brave people
Filename:
MIME Type:
Creator:
Andreas Kling
Created:
2012-01-27 05:08:04 PST
Size:
127.32 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e4927df..2be7dec 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,179 @@ >+2012-01-27 Andreas Kling <awesomekling@apple.com> >+ >+ Kill per-Attribute style declarations. >+ <http://webkit.org/b/77204> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No proper ChangeLog (OOPS!) >+ >+ * css/CSSStyleSelector.cpp: >+ (WebCore::CSSStyleSelector::matchAllRules): >+ (WebCore::CSSStyleSelector::canShareStyleWithElement): >+ * dom/Attr.cpp: >+ (WebCore::Attr::style): >+ (WebCore): >+ * dom/Attr.h: >+ (WebCore): >+ (Attr): >+ * dom/Attribute.cpp: >+ (WebCore::Attribute::clone): >+ * dom/Attribute.h: >+ (WebCore): >+ (WebCore::Attribute::create): >+ (WebCore::Attribute::createMapped): >+ (Attribute): >+ (WebCore::Attribute::Attribute): >+ * dom/CSSMappedAttributeDeclaration.cpp: >+ (WebCore::CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration): >+ (WebCore::CSSMappedAttributeDeclaration::setMappedLengthProperty): >+ (WebCore::CSSMappedAttributeDeclaration::setMappedProperty): >+ (WebCore::CSSMappedAttributeDeclaration::removeMappedProperty): >+ * dom/CSSMappedAttributeDeclaration.h: >+ (CSSMappedAttributeDeclaration): >+ (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration): >+ * dom/Element.h: >+ (Element): >+ * dom/NamedNodeMap.cpp: >+ (WebCore::NamedNodeMap::ensureAttributeStyle): >+ (WebCore): >+ * dom/NamedNodeMap.h: >+ (WebCore::NamedNodeMap::attributeStyle): >+ (NamedNodeMap): >+ * dom/StyledElement.cpp: >+ (WebCore): >+ (WebCore::StyledElement::attributeChanged): >+ (WebCore::StyledElement::removeCSSProperties): >+ (WebCore::StyledElement::addCSSProperty): >+ (WebCore::StyledElement::addCSSImageProperty): >+ (WebCore::StyledElement::addCSSLength): >+ (WebCore::StyledElement::addCSSColor): >+ * dom/StyledElement.h: >+ (StyledElement): >+ (WebCore::StyledElement::removeCSSProperty): >+ (WebCore::StyledElement::attributeStyle): >+ * html/HTMLBRElement.cpp: >+ (WebCore::HTMLBRElement::parseMappedAttribute): >+ * html/HTMLBRElement.h: >+ (HTMLBRElement): >+ * html/HTMLBodyElement.cpp: >+ (WebCore::HTMLBodyElement::parseMappedAttribute): >+ * html/HTMLBodyElement.h: >+ (HTMLBodyElement): >+ * html/HTMLDivElement.cpp: >+ (WebCore::HTMLDivElement::parseMappedAttribute): >+ * html/HTMLDivElement.h: >+ (HTMLDivElement): >+ * html/HTMLElement.cpp: >+ (WebCore::HTMLElement::applyBorderAttribute): >+ (WebCore::HTMLElement::mapLanguageAttributeToLocale): >+ (WebCore::HTMLElement::parseMappedAttribute): >+ (WebCore::HTMLElement::removeHTMLAlignment): >+ (WebCore): >+ (WebCore::HTMLElement::addHTMLAlignmentToStyledElement): >+ (WebCore::HTMLElement::setContentEditable): >+ * html/HTMLElement.h: >+ (HTMLElement): >+ * html/HTMLEmbedElement.cpp: >+ (WebCore::HTMLEmbedElement::parseMappedAttribute): >+ * html/HTMLEmbedElement.h: >+ (HTMLEmbedElement): >+ (): >+ * html/HTMLFontElement.cpp: >+ (WebCore::HTMLFontElement::parseMappedAttribute): >+ * html/HTMLFontElement.h: >+ (HTMLFontElement): >+ * html/HTMLFrameSetElement.cpp: >+ (WebCore::HTMLFrameSetElement::parseMappedAttribute): >+ * html/HTMLFrameSetElement.h: >+ (HTMLFrameSetElement): >+ * html/HTMLHRElement.cpp: >+ (WebCore::HTMLHRElement::parseMappedAttribute): >+ * html/HTMLHRElement.h: >+ (HTMLHRElement): >+ * html/HTMLIFrameElement.cpp: >+ (WebCore::HTMLIFrameElement::parseMappedAttribute): >+ * html/HTMLIFrameElement.h: >+ (HTMLIFrameElement): >+ * html/HTMLImageElement.cpp: >+ (WebCore::HTMLImageElement::parseMappedAttribute): >+ * html/HTMLImageElement.h: >+ (HTMLImageElement): >+ * html/HTMLInputElement.cpp: >+ (WebCore::HTMLInputElement::parseMappedAttribute): >+ * html/HTMLInputElement.h: >+ (HTMLInputElement): >+ * html/HTMLLIElement.cpp: >+ (WebCore::HTMLLIElement::parseMappedAttribute): >+ * html/HTMLLIElement.h: >+ (HTMLLIElement): >+ * html/HTMLMarqueeElement.cpp: >+ (WebCore::HTMLMarqueeElement::parseMappedAttribute): >+ * html/HTMLMarqueeElement.h: >+ (HTMLMarqueeElement): >+ * html/HTMLOListElement.cpp: >+ (WebCore::HTMLOListElement::parseMappedAttribute): >+ * html/HTMLOListElement.h: >+ (HTMLOListElement): >+ * html/HTMLOutputElement.cpp: >+ * html/HTMLOutputElement.h: >+ (HTMLOutputElement): >+ * html/HTMLParagraphElement.cpp: >+ (WebCore::HTMLParagraphElement::parseMappedAttribute): >+ * html/HTMLParagraphElement.h: >+ (HTMLParagraphElement): >+ * html/HTMLPlugInElement.cpp: >+ (WebCore::HTMLPlugInElement::parseMappedAttribute): >+ * html/HTMLPlugInElement.h: >+ (HTMLPlugInElement): >+ * html/HTMLPreElement.cpp: >+ (WebCore::HTMLPreElement::parseMappedAttribute): >+ * html/HTMLPreElement.h: >+ (HTMLPreElement): >+ * html/HTMLTableCaptionElement.cpp: >+ (WebCore::HTMLTableCaptionElement::parseMappedAttribute): >+ * html/HTMLTableCaptionElement.h: >+ (HTMLTableCaptionElement): >+ * html/HTMLTableCellElement.cpp: >+ (WebCore::HTMLTableCellElement::parseMappedAttribute): >+ * html/HTMLTableCellElement.h: >+ (HTMLTableCellElement): >+ * html/HTMLTableColElement.cpp: >+ (WebCore::HTMLTableColElement::parseMappedAttribute): >+ * html/HTMLTableColElement.h: >+ (HTMLTableColElement): >+ * html/HTMLTableElement.cpp: >+ (WebCore::HTMLTableElement::parseMappedAttribute): >+ * html/HTMLTableElement.h: >+ (HTMLTableElement): >+ (): >+ * html/HTMLTablePartElement.cpp: >+ (WebCore): >+ (WebCore::HTMLTablePartElement::parseMappedAttribute): >+ * html/HTMLTablePartElement.h: >+ * html/HTMLTextAreaElement.cpp: >+ (WebCore::HTMLTextAreaElement::parseMappedAttribute): >+ * html/HTMLUListElement.cpp: >+ (WebCore::HTMLUListElement::parseMappedAttribute): >+ * html/HTMLUListElement.h: >+ (HTMLUListElement): >+ * html/HTMLVideoElement.cpp: >+ (WebCore::HTMLVideoElement::parseMappedAttribute): >+ * inspector/InspectorCSSAgent.cpp: >+ (WebCore::InspectorCSSAgent::buildArrayForAttributeStyles): >+ * mathml/MathMLElement.cpp: >+ (WebCore::MathMLElement::parseMappedAttribute): >+ * mathml/MathMLElement.h: >+ * svg/SVGImageElement.cpp: >+ (WebCore::SVGImageElement::parseMappedAttribute): >+ * svg/SVGStyledElement.cpp: >+ (WebCore::SVGStyledElement::parseMappedAttribute): >+ (WebCore::SVGStyledElement::getPresentationAttribute): >+ * svg/SVGStyledElement.h: >+ (SVGStyledElement): >+ * svg/SVGTextContentElement.cpp: >+ (WebCore::SVGTextContentElement::parseMappedAttribute): >+ > 2012-01-26 Andreas Kling <awesomekling@apple.com> > > Refactor application of additional style attributes for table elements. >diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp >index e32b65b..d347885 100644 >--- a/Source/WebCore/css/CSSStyleSelector.cpp >+++ b/Source/WebCore/css/CSSStyleSelector.cpp >@@ -835,17 +835,13 @@ void CSSStyleSelector::matchAllRules(MatchResult& result) > > // Now check author rules, beginning first with presentational attributes mapped from HTML. > if (m_styledElement) { >- if (const NamedNodeMap* map = m_styledElement->attributeMap()) { >- // Walk the element's attribute map and add all mapped attribute declarations. >- for (unsigned i = 0; i < map->length(); ++i) { >- Attribute* attribute = map->attributeItem(i); >- if (!attribute->decl()) >- continue; >- ASSERT(attribute->isMappedAttribute()); >- result.ranges.lastAuthorRule = m_matchedDecls.size(); >+ if (CSSMutableStyleDeclaration* attributeStyle = m_styledElement->attributeStyle()) { >+ if (attributeStyle->length()) { >+ result.ranges.lastAuthorRule = m_matchedRules.size(); > if (result.ranges.firstAuthorRule == -1) > result.ranges.firstAuthorRule = result.ranges.lastAuthorRule; >- addMatchedDeclaration(attribute->decl()); >+ addMatchedDeclaration(attributeStyle); >+ result.isCacheable = false; > } > } > >@@ -1033,22 +1029,6 @@ bool CSSStyleSelector::canShareStyleWithControl(StyledElement* element) const > return true; > } > >-static inline bool mappedAttributesEquivalent(NamedNodeMap* a, NamedNodeMap* b) >-{ >- ASSERT(a->mappedAttributeCount() == b->mappedAttributeCount()); >- >- for (size_t i = 0; i < a->length(); ++i) { >- Attribute* attribute = a->attributeItem(i); >- if (!attribute->decl()) >- continue; >- ASSERT(attribute->isMappedAttribute()); >- Attribute* otherAttribute = b->getAttributeItem(attribute->name()); >- if (!otherAttribute || attribute->value() != otherAttribute->value() || attribute->decl() != otherAttribute->decl()) >- return false; >- } >- return true; >-} >- > bool CSSStyleSelector::canShareStyleWithElement(StyledElement* element) const > { > RenderStyle* style = element->renderStyle(); >@@ -1063,8 +1043,7 @@ bool CSSStyleSelector::canShareStyleWithElement(StyledElement* element) const > return false; > if (element->inlineStyleDecl()) > return false; >- size_t mappedAttributeCount = element->mappedAttributeCount(); >- if (mappedAttributeCount != m_styledElement->mappedAttributeCount()) >+ if (!!element->attributeStyle() != !!m_styledElement->attributeStyle()) > return false; > if (element->isLink() != m_element->isLink()) > return false; >@@ -1125,7 +1104,7 @@ bool CSSStyleSelector::canShareStyleWithElement(StyledElement* element) const > if (element->hasClass() && m_element->getAttribute(classAttr) != element->getAttribute(classAttr)) > return false; > >- if (mappedAttributeCount && !mappedAttributesEquivalent(element->attributeMap(), m_styledElement->attributeMap())) >+ if (element->attributeStyle() && !element->attributeMap()->mapsEquivalent(m_styledElement->attributeMap())) > return false; > > if (element->isLink() && m_elementLinkState != style->insideLink()) >diff --git a/Source/WebCore/dom/Attr.cpp b/Source/WebCore/dom/Attr.cpp >index 6930fa1..44ec143 100644 >--- a/Source/WebCore/dom/Attr.cpp >+++ b/Source/WebCore/dom/Attr.cpp >@@ -198,4 +198,11 @@ bool Attr::isId() const > return qualifiedName().matches(document()->idAttributeName()); > } > >+CSSStyleDeclaration* Attr::style() >+{ >+ // FIXME: Perhaps we need to return a proper CSSStyleDeclaration here? We could go with StyledElement::attributeStyle() >+ // as an easy way out, though that would not match the previous behavior of this function. >+ return 0; >+} >+ > } >diff --git a/Source/WebCore/dom/Attr.h b/Source/WebCore/dom/Attr.h >index 7b6e332..9b0ea09 100644 >--- a/Source/WebCore/dom/Attr.h >+++ b/Source/WebCore/dom/Attr.h >@@ -30,6 +30,8 @@ > > namespace WebCore { > >+class CSSStyleDeclaration; >+ > // Attr can have Text and EntityReference children > // therefore it has to be a fullblown Node. The plan > // is to dynamically allocate a textchild and store the >@@ -56,7 +58,7 @@ public: > bool isId() const; > > // An extension to get presentational information for attributes. >- CSSStyleDeclaration* style() { return m_attribute->decl(); } >+ CSSStyleDeclaration* style(); > > void setSpecified(bool specified) { m_specified = specified; } > >diff --git a/Source/WebCore/dom/Attribute.cpp b/Source/WebCore/dom/Attribute.cpp >index 20c05d8..9eabe58 100644 >--- a/Source/WebCore/dom/Attribute.cpp >+++ b/Source/WebCore/dom/Attribute.cpp >@@ -40,7 +40,7 @@ static AttributeAttrMap& attributeAttrMap() > > PassRefPtr<Attribute> Attribute::clone() const > { >- return adoptRef(new Attribute(m_name, m_value, m_isMappedAttribute, m_styleDecl.get())); >+ return adoptRef(new Attribute(m_name, m_value, m_isMappedAttribute)); > } > > Attr* Attribute::attr() const >diff --git a/Source/WebCore/dom/Attribute.h b/Source/WebCore/dom/Attribute.h >index 6c2b468..6660989 100644 >--- a/Source/WebCore/dom/Attribute.h >+++ b/Source/WebCore/dom/Attribute.h >@@ -25,13 +25,11 @@ > #ifndef Attribute_h > #define Attribute_h > >-#include "CSSMappedAttributeDeclaration.h" > #include "QualifiedName.h" > > namespace WebCore { > > class Attr; >-class CSSStyleDeclaration; > class Element; > class NamedNodeMap; > >@@ -43,15 +41,15 @@ class Attribute : public RefCounted<Attribute> { > public: > static PassRefPtr<Attribute> create(const QualifiedName& name, const AtomicString& value) > { >- return adoptRef(new Attribute(name, value, false, 0)); >+ return adoptRef(new Attribute(name, value, false)); > } > static PassRefPtr<Attribute> createMapped(const QualifiedName& name, const AtomicString& value) > { >- return adoptRef(new Attribute(name, value, true, 0)); >+ return adoptRef(new Attribute(name, value, true)); > } > static PassRefPtr<Attribute> createMapped(const AtomicString& name, const AtomicString& value) > { >- return adoptRef(new Attribute(name, value, true, 0)); >+ return adoptRef(new Attribute(name, value, true)); > } > > const AtomicString& value() const { return m_value; } >@@ -69,9 +67,6 @@ public: > > PassRefPtr<Attribute> clone() const; > >- CSSMappedAttributeDeclaration* decl() const { return m_styleDecl.get(); } >- void setDecl(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_styleDecl = decl; } >- > void setValue(const AtomicString& value) { m_value = value; } > void setPrefix(const AtomicString& prefix) { m_name.setPrefix(prefix); } > >@@ -83,21 +78,19 @@ public: > bool isMappedAttribute() { return m_isMappedAttribute; } > > private: >- Attribute(const QualifiedName& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl) >+ Attribute(const QualifiedName& name, const AtomicString& value, bool isMappedAttribute) > : m_isMappedAttribute(isMappedAttribute) > , m_hasAttr(false) > , m_name(name) > , m_value(value) >- , m_styleDecl(styleDecl) > { > } > >- Attribute(const AtomicString& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl) >+ Attribute(const AtomicString& name, const AtomicString& value, bool isMappedAttribute) > : m_isMappedAttribute(isMappedAttribute) > , m_hasAttr(false) > , m_name(nullAtom, name, nullAtom) > , m_value(value) >- , m_styleDecl(styleDecl) > { > } > >@@ -110,7 +103,6 @@ private: > > QualifiedName m_name; > AtomicString m_value; >- RefPtr<CSSMappedAttributeDeclaration> m_styleDecl; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp b/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp >index 1585f80..7a6aa34 100644 >--- a/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp >+++ b/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp >@@ -38,7 +38,6 @@ inline void CSSMappedAttributeDeclaration::setNeedsStyleRecalc(StyledElement* el > > CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration() > { >- StyledElement::removeMappedAttributeDecl(m_entryType, m_attrName, m_attrValue); > } > > void CSSMappedAttributeDeclaration::setMappedImageProperty(StyledElement* element, int propertyId, const String& url) >@@ -49,31 +48,37 @@ void CSSMappedAttributeDeclaration::setMappedImageProperty(StyledElement* elemen > > void CSSMappedAttributeDeclaration::setMappedLengthProperty(StyledElement* element, int propertyId, const String& value) > { >+ //printf("setMappedLengthProperty(%p, %d, '%s')\n", this, propertyId, value.utf8().data()); > setMappedProperty(element, propertyId, value); > } > > void CSSMappedAttributeDeclaration::setMappedProperty(StyledElement* element, int propertyId, int value) > { > ASSERT(element->document()); >+ //printf("setMappedProperty(%p, %d, %d)\n", this, propertyId, value); > setPropertyInternal(CSSProperty(propertyId, element->document()->cssValuePool()->createIdentifierValue(value))); > setNeedsStyleRecalc(element); > } > > void CSSMappedAttributeDeclaration::setMappedProperty(StyledElement* element, int propertyId, const String& value) > { >+ //printf("setMappedProperty(%p, %d, '%s')\n", this, propertyId, value.utf8().data()); > if (value.isEmpty()) { > removeMappedProperty(element, propertyId); > return; > } > >- if (!CSSParser::parseMappedAttributeValue(this, element, propertyId, value)) >+ if (!CSSParser::parseMappedAttributeValue(this, element, propertyId, value)) { >+ removeMappedProperty(element, propertyId); > return; >+ } > > setNeedsStyleRecalc(element); > } > > void CSSMappedAttributeDeclaration::removeMappedProperty(StyledElement* element, int propertyId) > { >+ //printf("removeMappedProperty(%p, %d)\n", this, propertyId); > removeProperty(propertyId, false, false); > setNeedsStyleRecalc(element); > } >diff --git a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h b/Source/WebCore/dom/CSSMappedAttributeDeclaration.h >index a5b7551..ff1ba50 100644 >--- a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h >+++ b/Source/WebCore/dom/CSSMappedAttributeDeclaration.h >@@ -42,13 +42,6 @@ public: > > virtual ~CSSMappedAttributeDeclaration(); > >- void setMappedState(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& val) >- { >- m_entryType = type; >- m_attrName = name; >- m_attrValue = val; >- } >- > void setMappedProperty(StyledElement*, int propertyId, int value); > void setMappedProperty(StyledElement*, int propertyId, const String& value); > void setMappedImageProperty(StyledElement*, int propertyId, const String& url); >@@ -61,16 +54,10 @@ public: > private: > CSSMappedAttributeDeclaration() > : CSSMutableStyleDeclaration() >- , m_entryType(eNone) >- , m_attrName(anyQName()) > { > } > > void setNeedsStyleRecalc(StyledElement*); >- >- MappedAttributeEntry m_entryType; >- QualifiedName m_attrName; >- AtomicString m_attrValue; > }; > > } //namespace >diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h >index 25ec785..0713074 100644 >--- a/Source/WebCore/dom/Element.h >+++ b/Source/WebCore/dom/Element.h >@@ -217,6 +217,7 @@ public: > NamedNodeMap* attributes(bool readonly = false) const; > > // This method is called whenever an attribute is added, changed or removed. >+ // FIXME: Remove the preserveDecls argument. > virtual void attributeChanged(Attribute*, bool preserveDecls = false); > > // Only called by the parser immediately after element construction. >diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp >index 9b72488..24afa9a 100644 >--- a/Source/WebCore/dom/NamedNodeMap.cpp >+++ b/Source/WebCore/dom/NamedNodeMap.cpp >@@ -353,4 +353,13 @@ void NamedNodeMap::createInlineStyleDecl() > m_inlineStyleDecl->setStrictParsing(m_element->isHTMLElement() && !m_element->document()->inQuirksMode()); > } > >+CSSMappedAttributeDeclaration* NamedNodeMap::ensureAttributeStyle() >+{ >+ if (!m_attributeStyle) { >+ m_attributeStyle = CSSMappedAttributeDeclaration::create(); >+ m_attributeStyle->setStrictParsing(false); >+ } >+ return m_attributeStyle.get(); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/dom/NamedNodeMap.h b/Source/WebCore/dom/NamedNodeMap.h >index 2e53847..5862b72 100644 >--- a/Source/WebCore/dom/NamedNodeMap.h >+++ b/Source/WebCore/dom/NamedNodeMap.h >@@ -26,6 +26,8 @@ > #define NamedNodeMap_h > > #include "Attribute.h" >+#include "CSSMappedAttributeDeclaration.h" >+#include "CSSPropertyNames.h" > #include "SpaceSplitString.h" > #include <wtf/NotFound.h> > >@@ -106,6 +108,9 @@ public: > CSSMutableStyleDeclaration* ensureInlineStyleDecl(); > void destroyInlineStyleDecl(); > >+ CSSMappedAttributeDeclaration* attributeStyle() const { return m_attributeStyle.get(); } >+ CSSMappedAttributeDeclaration* ensureAttributeStyle(); >+ > private: > NamedNodeMap(Element* element) > : m_element(element) >@@ -130,6 +135,7 @@ private: > Vector<RefPtr<Attribute>, 4> m_attributes; > AtomicString m_idForStyleResolution; > RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl; >+ RefPtr<CSSMappedAttributeDeclaration> m_attributeStyle; > }; > > inline Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const >@@ -189,16 +195,6 @@ inline void NamedNodeMap::removeAttribute(const QualifiedName& name) > removeAttribute(index); > } > >-inline size_t NamedNodeMap::mappedAttributeCount() const >-{ >- size_t count = 0; >- for (size_t i = 0; i < m_attributes.size(); ++i) { >- if (m_attributes[i]->decl()) >- ++count; >- } >- return count; >-} >- > } // namespace WebCore > > #endif // NamedNodeMap_h >diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp >index 8bee53d..15292c1 100644 >--- a/Source/WebCore/dom/StyledElement.cpp >+++ b/Source/WebCore/dom/StyledElement.cpp >@@ -44,69 +44,6 @@ namespace WebCore { > > using namespace HTMLNames; > >-struct MappedAttributeKey { >- uint16_t type; >- StringImpl* name; >- StringImpl* value; >- MappedAttributeKey(MappedAttributeEntry t = eNone, StringImpl* n = 0, StringImpl* v = 0) >- : type(t), name(n), value(v) { } >-}; >- >-static inline bool operator==(const MappedAttributeKey& a, const MappedAttributeKey& b) >- { return a.type == b.type && a.name == b.name && a.value == b.value; } >- >-struct MappedAttributeKeyTraits : WTF::GenericHashTraits<MappedAttributeKey> { >- static const bool emptyValueIsZero = true; >- static const bool needsDestruction = false; >- static void constructDeletedValue(MappedAttributeKey& slot) { slot.type = eLastEntry; } >- static bool isDeletedValue(const MappedAttributeKey& value) { return value.type == eLastEntry; } >-}; >- >-struct MappedAttributeHash { >- static unsigned hash(const MappedAttributeKey&); >- static bool equal(const MappedAttributeKey& a, const MappedAttributeKey& b) { return a == b; } >- static const bool safeToCompareToEmptyOrDeleted = true; >-}; >- >-typedef HashMap<MappedAttributeKey, CSSMappedAttributeDeclaration*, MappedAttributeHash, MappedAttributeKeyTraits> MappedAttributeDecls; >- >-static MappedAttributeDecls* mappedAttributeDecls = 0; >- >-CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr) >-{ >- if (!mappedAttributeDecls) >- return 0; >- return mappedAttributeDecls->get(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl())); >-} >- >-CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value) >-{ >- if (!mappedAttributeDecls) >- return 0; >- return mappedAttributeDecls->get(MappedAttributeKey(type, name.localName().impl(), value.impl())); >-} >- >-void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr, CSSMappedAttributeDeclaration* decl) >-{ >- if (!mappedAttributeDecls) >- mappedAttributeDecls = new MappedAttributeDecls; >- mappedAttributeDecls->set(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()), decl); >-} >- >-void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* decl) >-{ >- if (!mappedAttributeDecls) >- mappedAttributeDecls = new MappedAttributeDecls; >- mappedAttributeDecls->set(MappedAttributeKey(entryType, name.localName().impl(), value.impl()), decl); >-} >- >-void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& attrName, const AtomicString& attrValue) >-{ >- if (!mappedAttributeDecls) >- return; >- mappedAttributeDecls->remove(MappedAttributeKey(entryType, attrName.localName().impl(), attrValue.impl())); >-} >- > void StyledElement::updateStyleAttribute() const > { > ASSERT(!isStyleAttributeValid()); >@@ -136,58 +73,14 @@ void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls) > Element::attributeChanged(attr, preserveDecls); > return; > } >- >- if (attr->decl() && !preserveDecls) { >- attr->setDecl(0); >- setNeedsStyleRecalc(); >- } >- >- bool checkDecl = true; >- MappedAttributeEntry entry; >- bool needToParse = mapToEntry(attr->name(), entry); >- if (preserveDecls) { >- if (attr->decl()) { >- setNeedsStyleRecalc(); >- checkDecl = false; >- } >- } else if (!attr->isNull() && entry != eNone) { >- CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(entry, attr); >- if (decl) { >- attr->setDecl(decl); >- setNeedsStyleRecalc(); >- checkDecl = false; >- } else >- needToParse = true; >- } > >- // parseMappedAttribute() might create a CSSMappedAttributeDeclaration on the attribute. >- // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewDocument(). >- // But currently we always clear its parent and node below when adding it to the decl table. >- // If that changes for some reason moving between documents will be buggy. >- // webarchive/adopt-attribute-styled-node-webarchive.html should catch any resulting crashes. >- if (needToParse) >+ if (!(attr->name() == styleAttr && isSynchronizingStyleAttribute())) > parseMappedAttribute(attr); > >- if (entry == eNone) >- recalcStyleIfNeededAfterAttributeChanged(attr); >- >- if (checkDecl && attr->decl()) { >- // Add the decl to the table in the appropriate spot. >- setMappedAttributeDecl(entry, attr, attr->decl()); >- attr->decl()->setMappedState(entry, attr->name(), attr->value()); >- } >- >+ recalcStyleIfNeededAfterAttributeChanged(attr); > updateAfterAttributeChanged(attr); > } > >-bool StyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const >-{ >- result = eNone; >- if (attrName == styleAttr) >- return !isSynchronizingStyleAttribute(); >- return true; >-} >- > void StyledElement::classAttributeChanged(const AtomicString& newClassString) > { > const UChar* characters = newClassString.characters(); >@@ -225,40 +118,44 @@ void StyledElement::parseMappedAttribute(Attribute* attr) > } > } > >-void StyledElement::removeCSSProperty(Attribute* attribute, int id) >+void StyledElement::removeCSSProperties(int id1, int id2, int id3, int id4, int id5) > { >- if (!attribute->decl()) >- createMappedDecl(attribute); >- attribute->decl()->removeMappedProperty(this, id); >+ CSSMappedAttributeDeclaration* style = attributeStyle(); >+ if (!style) >+ return; >+ >+ ASSERT(id1 != CSSPropertyInvalid); >+ style->removeMappedProperty(this, id1); >+ >+ if (id2 != CSSPropertyInvalid) >+ style->removeMappedProperty(this, id2); >+ if (id3 != CSSPropertyInvalid) >+ style->removeMappedProperty(this, id3); >+ if (id4 != CSSPropertyInvalid) >+ style->removeMappedProperty(this, id4); >+ if (id5 != CSSPropertyInvalid) >+ style->removeMappedProperty(this, id5); > } > >-void StyledElement::addCSSProperty(Attribute* attribute, int id, const String &value) >+void StyledElement::addCSSProperty(int id, const String &value) > { >- if (!attribute->decl()) >- createMappedDecl(attribute); >- attribute->decl()->setMappedProperty(this, id, value); >+ attributes(false)->ensureAttributeStyle()->setMappedProperty(this, id, value); > } > >-void StyledElement::addCSSProperty(Attribute* attribute, int id, int value) >+void StyledElement::addCSSProperty(int id, int value) > { >- if (!attribute->decl()) >- createMappedDecl(attribute); >- attribute->decl()->setMappedProperty(this, id, value); >+ attributes(false)->ensureAttributeStyle()->setMappedProperty(this, id, value); > } > >-void StyledElement::addCSSImageProperty(Attribute* attribute, int id, const String& url) >+void StyledElement::addCSSImageProperty(int id, const String& url) > { >- if (!attribute->decl()) >- createMappedDecl(attribute); >- attribute->decl()->setMappedImageProperty(this, id, url); >+ attributes(false)->ensureAttributeStyle()->setMappedImageProperty(this, id, url); > } > >-void StyledElement::addCSSLength(Attribute* attribute, int id, const String &value) >+void StyledElement::addCSSLength(int id, const String &value) > { > // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct > // length unit and make the appropriate parsed value. >- if (!attribute->decl()) >- createMappedDecl(attribute); > > // strip attribute garbage.. > StringImpl* v = value.impl(); >@@ -281,12 +178,12 @@ void StyledElement::addCSSLength(Attribute* attribute, int id, const String &val > } > > if (l != v->length()) { >- attribute->decl()->setMappedLengthProperty(this, id, v->substring(0, l)); >+ attributes(false)->ensureAttributeStyle()->setMappedLengthProperty(this, id, v->substring(0, l)); > return; > } > } > >- attribute->decl()->setMappedLengthProperty(this, id, value); >+ attributes(false)->ensureAttributeStyle()->setMappedLengthProperty(this, id, value); > } > > static String parseColorStringWithCrazyLegacyRules(const String& colorString) >@@ -342,57 +239,30 @@ static String parseColorStringWithCrazyLegacyRules(const String& colorString) > } > > // Color parsing that matches HTML's "rules for parsing a legacy color value" >-void StyledElement::addCSSColor(Attribute* attribute, int id, const String& attributeValue) >+void StyledElement::addCSSColor(int id, const String& attributeValue) > { > // An empty string doesn't apply a color. (One containing only whitespace does, which is why this check occurs before stripping.) >- if (attributeValue.isEmpty()) >+ if (attributeValue.isEmpty()) { >+ removeCSSProperty(id); > return; >+ } > > String colorString = attributeValue.stripWhiteSpace(); > > // "transparent" doesn't apply a color either. >- if (equalIgnoringCase(colorString, "transparent")) >+ if (equalIgnoringCase(colorString, "transparent")) { >+ removeCSSProperty(id); > return; >- >- if (!attribute->decl()) >- createMappedDecl(attribute); >+ } > > // If the string is a named CSS color or a 3/6-digit hex color, use that. > Color parsedColor(colorString); > if (parsedColor.isValid()) { >- attribute->decl()->setMappedProperty(this, id, colorString); >+ attributes(false)->ensureAttributeStyle()->setMappedProperty(this, id, colorString); > return; > } > >- attribute->decl()->setMappedProperty(this, id, parseColorStringWithCrazyLegacyRules(colorString)); >-} >- >-void StyledElement::createMappedDecl(Attribute* attr) >-{ >- RefPtr<CSSMappedAttributeDeclaration> decl = CSSMappedAttributeDeclaration::create(); >- attr->setDecl(decl); >- ASSERT(!decl->useStrictParsing()); >-} >- >-unsigned MappedAttributeHash::hash(const MappedAttributeKey& key) >-{ >- COMPILE_ASSERT(sizeof(key.name) == 4 || sizeof(key.name) == 8, key_name_size); >- COMPILE_ASSERT(sizeof(key.value) == 4 || sizeof(key.value) == 8, key_value_size); >- >- StringHasher hasher; >- const UChar* data; >- >- data = reinterpret_cast<const UChar*>(&key.name); >- hasher.addCharacters(data[0], data[1]); >- if (sizeof(key.name) == 8) >- hasher.addCharacters(data[2], data[3]); >- >- data = reinterpret_cast<const UChar*>(&key.value); >- hasher.addCharacters(data[0], data[1]); >- if (sizeof(key.value) == 8) >- hasher.addCharacters(data[2], data[3]); >- >- return hasher.hash(); >+ attributes(false)->ensureAttributeStyle()->setMappedProperty(this, id, parseColorStringWithCrazyLegacyRules(colorString)); > } > > void StyledElement::copyNonAttributeProperties(const Element* sourceElement) >diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h >index 932c847..780b17b 100644 >--- a/Source/WebCore/dom/StyledElement.h >+++ b/Source/WebCore/dom/StyledElement.h >@@ -39,21 +39,14 @@ public: > virtual ~StyledElement(); > > size_t mappedAttributeCount() const { return attributeMap() ? attributeMap()->mappedAttributeCount() : 0; } >- bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; } > >- void addCSSLength(Attribute*, int id, const String& value); >- void addCSSProperty(Attribute*, int id, const String& value); >- void addCSSProperty(Attribute*, int id, int value); >- void addCSSImageProperty(Attribute*, int propertyID, const String& url); >- void addCSSColor(Attribute*, int id, const String& color); >- void removeCSSProperty(Attribute*, int id); >- >- static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value); >- static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*); >- static void removeMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value); >- >- static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*); >- static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*); >+ void addCSSLength(int id, const String& value); >+ void addCSSProperty(int id, const String& value); >+ void addCSSProperty(int id, int value); >+ void addCSSImageProperty(int propertyID, const String& url); >+ void addCSSColor(int id, const String& color); >+ void removeCSSProperties(int id1, int id2 = CSSPropertyInvalid, int id3 = CSSPropertyInvalid, int id4 = CSSPropertyInvalid, int id5 = CSSPropertyInvalid); >+ void removeCSSProperty(int id) { removeCSSProperties(id); } > > virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() { return 0; } > void invalidateStyleAttribute(); >@@ -62,9 +55,9 @@ public: > CSSMutableStyleDeclaration* ensureInlineStyleDecl() { return attributes(false)->ensureInlineStyleDecl(); } > virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl(); } > >- const SpaceSplitString& classNames() const; >+ CSSMappedAttributeDeclaration* attributeStyle() const { return attributeMap() ? attributeMap()->attributeStyle() : 0; } > >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; >+ const SpaceSplitString& classNames() const; > > virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); > >@@ -86,8 +79,6 @@ protected: > void classAttributeChanged(const AtomicString& newClassString); > > private: >- void createMappedDecl(Attribute*); >- > virtual void updateStyleAttribute() const; > void destroyInlineStyleDecl() { if (attributeMap()) attributeMap()->destroyInlineStyleDecl(); } > }; >diff --git a/Source/WebCore/html/HTMLBRElement.cpp b/Source/WebCore/html/HTMLBRElement.cpp >index 2639060..1044418 100644 >--- a/Source/WebCore/html/HTMLBRElement.cpp >+++ b/Source/WebCore/html/HTMLBRElement.cpp >@@ -48,27 +48,18 @@ 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) > { > 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); >diff --git a/Source/WebCore/html/HTMLBRElement.h b/Source/WebCore/html/HTMLBRElement.h >index 3857a9b..5705315 100644 >--- a/Source/WebCore/html/HTMLBRElement.h >+++ b/Source/WebCore/html/HTMLBRElement.h >@@ -38,7 +38,6 @@ public: > private: > HTMLBRElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > > virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); >diff --git a/Source/WebCore/html/HTMLBodyElement.cpp b/Source/WebCore/html/HTMLBodyElement.cpp >index 6558d46..af5928f 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) > { > 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) { >diff --git a/Source/WebCore/html/HTMLBodyElement.h b/Source/WebCore/html/HTMLBodyElement.h >index 5c63264..eb53a22 100644 >--- a/Source/WebCore/html/HTMLBodyElement.h >+++ b/Source/WebCore/html/HTMLBodyElement.h >@@ -70,7 +70,6 @@ public: > private: > HTMLBodyElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > > virtual void insertedIntoDocument(); >diff --git a/Source/WebCore/html/HTMLDivElement.cpp b/Source/WebCore/html/HTMLDivElement.cpp >index 23e6585..0477646 100644 >--- a/Source/WebCore/html/HTMLDivElement.cpp >+++ b/Source/WebCore/html/HTMLDivElement.cpp >@@ -48,26 +48,19 @@ 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) > { > 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); > } >diff --git a/Source/WebCore/html/HTMLDivElement.h b/Source/WebCore/html/HTMLDivElement.h >index 2e2b417..7bb5f21 100644 >--- a/Source/WebCore/html/HTMLDivElement.h >+++ b/Source/WebCore/html/HTMLDivElement.h >@@ -36,7 +36,6 @@ protected: > HTMLDivElement(const QualifiedName&, Document*); > > private: >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp >index 680c23b..404554d 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,23 +142,25 @@ 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(); > } >@@ -191,14 +172,19 @@ void HTMLElement::parseMappedAttribute(Attribute* 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; >@@ -217,19 +203,26 @@ void HTMLElement::parseMappedAttribute(Attribute* attr) > } else if (attr->name() == dirAttr) { > bool dirIsAuto = equalIgnoringCase(attr->value(), "auto"); > if (!dirIsAuto) >- addCSSProperty(attr, CSSPropertyDirection, attr->value()); >+ addCSSProperty(CSSPropertyDirection, attr->value()); >+ else >+ removeCSSProperty(CSSPropertyDirection); > dirAttributeChanged(attr); > if (dirIsAuto) >- addCSSProperty(attr, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); >+ addCSSProperty(CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); > else if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) >- addCSSProperty(attr, CSSPropertyUnicodeBidi, CSSValueEmbed); >+ 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 +680,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 +715,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 +749,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 a86b2b9..001dd09 100644 >--- a/Source/WebCore/html/HTMLElement.h >+++ b/Source/WebCore/html/HTMLElement.h >@@ -94,8 +94,8 @@ protected: > HTMLElement(const QualifiedName& tagName, Document*); > > void addHTMLAlignment(Attribute*); >+ void removeHTMLAlignment(); > >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; > virtual void parseMappedAttribute(Attribute*); > void applyBorderAttribute(Attribute*); > >diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp >index 08c15e9..a92835b 100644 >--- a/Source/WebCore/html/HTMLEmbedElement.cpp >+++ b/Source/WebCore/html/HTMLEmbedElement.cpp >@@ -74,16 +74,6 @@ 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) > { > const AtomicString& value = attr->value(); >@@ -108,9 +98,10 @@ 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); > } >diff --git a/Source/WebCore/html/HTMLEmbedElement.h b/Source/WebCore/html/HTMLEmbedElement.h >index 12ce271..c33523e 100644 >--- a/Source/WebCore/html/HTMLEmbedElement.h >+++ b/Source/WebCore/html/HTMLEmbedElement.h >@@ -34,7 +34,6 @@ public: > private: > HTMLEmbedElement(const QualifiedName&, Document*, bool createdByParser); > >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; > virtual void parseMappedAttribute(Attribute*); > > virtual bool rendererIsNeeded(const NodeRenderingContext&); >diff --git a/Source/WebCore/html/HTMLFontElement.cpp b/Source/WebCore/html/HTMLFontElement.cpp >index d0ade29..a5f5387 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; >@@ -175,11 +163,19 @@ void HTMLFontElement::parseMappedAttribute(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); > } >diff --git a/Source/WebCore/html/HTMLFontElement.h b/Source/WebCore/html/HTMLFontElement.h >index f97ab08..34ec6fd 100644 >--- a/Source/WebCore/html/HTMLFontElement.h >+++ b/Source/WebCore/html/HTMLFontElement.h >@@ -37,7 +37,6 @@ public: > private: > HTMLFontElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLFrameSetElement.cpp b/Source/WebCore/html/HTMLFrameSetElement.cpp >index 978a72d..9cdd438 100644 >--- a/Source/WebCore/html/HTMLFrameSetElement.cpp >+++ b/Source/WebCore/html/HTMLFrameSetElement.cpp >@@ -64,16 +64,6 @@ 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) > { > if (attr->name() == rowsAttr) { >@@ -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) >diff --git a/Source/WebCore/html/HTMLFrameSetElement.h b/Source/WebCore/html/HTMLFrameSetElement.h >index 6988974..0bc34b6 100644 >--- a/Source/WebCore/html/HTMLFrameSetElement.h >+++ b/Source/WebCore/html/HTMLFrameSetElement.h >@@ -67,7 +67,6 @@ public: > private: > HTMLFrameSetElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; > virtual void parseMappedAttribute(Attribute*); > > virtual void attach(); >diff --git a/Source/WebCore/html/HTMLHRElement.cpp b/Source/WebCore/html/HTMLHRElement.cpp >index 44aa052..a849013 100644 >--- a/Source/WebCore/html/HTMLHRElement.cpp >+++ b/Source/WebCore/html/HTMLHRElement.cpp >@@ -48,60 +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) > { > 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); >+ removeCSSProperty(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); >+ removeCSSProperty(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); > } >diff --git a/Source/WebCore/html/HTMLHRElement.h b/Source/WebCore/html/HTMLHRElement.h >index 37c1190..079b8e3 100644 >--- a/Source/WebCore/html/HTMLHRElement.h >+++ b/Source/WebCore/html/HTMLHRElement.h >@@ -36,8 +36,7 @@ public: > > private: > HTMLHRElement(const QualifiedName&, Document*); >- >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; >+ > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLIFrameElement.cpp b/Source/WebCore/html/HTMLIFrameElement.cpp >index 817b5d7..42d4758 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) > { > 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,9 +67,11 @@ 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 >diff --git a/Source/WebCore/html/HTMLIFrameElement.h b/Source/WebCore/html/HTMLIFrameElement.h >index a7aecf8..356fd42 100644 >--- a/Source/WebCore/html/HTMLIFrameElement.h >+++ b/Source/WebCore/html/HTMLIFrameElement.h >@@ -35,7 +35,6 @@ public: > private: > HTMLIFrameElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > > virtual void insertedIntoDocument(); >diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp >index b5c513d..89cbdb2 100644 >--- a/Source/WebCore/html/HTMLImageElement.cpp >+++ b/Source/WebCore/html/HTMLImageElement.cpp >@@ -78,25 +78,6 @@ 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) > { > const QualifiedName& attrName = attr->name(); >@@ -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) >diff --git a/Source/WebCore/html/HTMLImageElement.h b/Source/WebCore/html/HTMLImageElement.h >index 8cb3ee9..cfa520d 100644 >--- a/Source/WebCore/html/HTMLImageElement.h >+++ b/Source/WebCore/html/HTMLImageElement.h >@@ -83,7 +83,6 @@ protected: > virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; > > private: >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; > virtual void parseMappedAttribute(Attribute*); > > virtual void attach(); >diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp >index 413c127..b64c0e0 100644 >--- a/Source/WebCore/html/HTMLInputElement.cpp >+++ b/Source/WebCore/html/HTMLInputElement.cpp >@@ -659,24 +659,6 @@ 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) > { > if (attr->name() == nameAttr) { >@@ -733,20 +715,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) { >diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h >index 47ac4d3..991f8f0 100644 >--- a/Source/WebCore/html/HTMLInputElement.h >+++ b/Source/WebCore/html/HTMLInputElement.h >@@ -276,7 +276,6 @@ private: > > virtual void accessKeyAction(bool sendMouseEvents); > >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; > virtual void parseMappedAttribute(Attribute*); > virtual void finishParsingChildren(); > >diff --git a/Source/WebCore/html/HTMLLIElement.cpp b/Source/WebCore/html/HTMLLIElement.cpp >index 32886cb..688f7a4 100644 >--- a/Source/WebCore/html/HTMLLIElement.cpp >+++ b/Source/WebCore/html/HTMLLIElement.cpp >@@ -49,34 +49,26 @@ 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) > { > 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); > } >diff --git a/Source/WebCore/html/HTMLLIElement.h b/Source/WebCore/html/HTMLLIElement.h >index 7e6a953..862606f 100644 >--- a/Source/WebCore/html/HTMLLIElement.h >+++ b/Source/WebCore/html/HTMLLIElement.h >@@ -35,7 +35,6 @@ public: > private: > HTMLLIElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > > virtual void attach(); >diff --git a/Source/WebCore/html/HTMLMarqueeElement.cpp b/Source/WebCore/html/HTMLMarqueeElement.cpp >index 053ffa8..2127bca 100644 >--- a/Source/WebCore/html/HTMLMarqueeElement.cpp >+++ b/Source/WebCore/html/HTMLMarqueeElement.cpp >@@ -51,65 +51,63 @@ 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) > { > 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 >diff --git a/Source/WebCore/html/HTMLMarqueeElement.h b/Source/WebCore/html/HTMLMarqueeElement.h >index 586aa6f..ac3953f 100644 >--- a/Source/WebCore/html/HTMLMarqueeElement.h >+++ b/Source/WebCore/html/HTMLMarqueeElement.h >@@ -53,7 +53,6 @@ public: > private: > HTMLMarqueeElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > > // ActiveDOMObject >diff --git a/Source/WebCore/html/HTMLOListElement.cpp b/Source/WebCore/html/HTMLOListElement.cpp >index d90a2f7..3229511 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) > { > 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; >diff --git a/Source/WebCore/html/HTMLOListElement.h b/Source/WebCore/html/HTMLOListElement.h >index 8000b28..017957f 100644 >--- a/Source/WebCore/html/HTMLOListElement.h >+++ b/Source/WebCore/html/HTMLOListElement.h >@@ -53,7 +53,6 @@ private: > > void recalculateItemCount(); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > > int m_start; >diff --git a/Source/WebCore/html/HTMLOutputElement.cpp b/Source/WebCore/html/HTMLOutputElement.cpp >index ee3c0d8..a85bfd4 100644 >--- a/Source/WebCore/html/HTMLOutputElement.cpp >+++ b/Source/WebCore/html/HTMLOutputElement.cpp >@@ -61,16 +61,6 @@ 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) > { > if (attr->name() == HTMLNames::forAttr) >diff --git a/Source/WebCore/html/HTMLOutputElement.h b/Source/WebCore/html/HTMLOutputElement.h >index 83df7fa..969c6cb 100644 >--- a/Source/WebCore/html/HTMLOutputElement.h >+++ b/Source/WebCore/html/HTMLOutputElement.h >@@ -55,7 +55,6 @@ public: > private: > HTMLOutputElement(const QualifiedName&, Document*, HTMLFormElement*); > >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const OVERRIDE; > virtual void parseMappedAttribute(Attribute*); > virtual const AtomicString& formControlType() const; > virtual bool isEnumeratable() const { return true; } >diff --git a/Source/WebCore/html/HTMLParagraphElement.cpp b/Source/WebCore/html/HTMLParagraphElement.cpp >index e8a5aa7..2455c5c 100644 >--- a/Source/WebCore/html/HTMLParagraphElement.cpp >+++ b/Source/WebCore/html/HTMLParagraphElement.cpp >@@ -44,26 +44,19 @@ 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) > { > 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); > } >diff --git a/Source/WebCore/html/HTMLParagraphElement.h b/Source/WebCore/html/HTMLParagraphElement.h >index 6dbf071..ea879a8 100644 >--- a/Source/WebCore/html/HTMLParagraphElement.h >+++ b/Source/WebCore/html/HTMLParagraphElement.h >@@ -34,7 +34,6 @@ public: > private: > HTMLParagraphElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLPlugInElement.cpp b/Source/WebCore/html/HTMLPlugInElement.cpp >index 6229d2e..7287bc3 100644 >--- a/Source/WebCore/html/HTMLPlugInElement.cpp >+++ b/Source/WebCore/html/HTMLPlugInElement.cpp >@@ -136,36 +136,32 @@ 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) > { > 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 >diff --git a/Source/WebCore/html/HTMLPlugInElement.h b/Source/WebCore/html/HTMLPlugInElement.h >index a10af61..ab9a49f 100644 >--- a/Source/WebCore/html/HTMLPlugInElement.h >+++ b/Source/WebCore/html/HTMLPlugInElement.h >@@ -58,7 +58,6 @@ protected: > > virtual void detach(); > virtual void removedFromDocument(); >- virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; > virtual void parseMappedAttribute(Attribute*); > > bool m_inBeforeLoadEventHandler; >diff --git a/Source/WebCore/html/HTMLPreElement.cpp b/Source/WebCore/html/HTMLPreElement.cpp >index fc67aca..0e958bf 100644 >--- a/Source/WebCore/html/HTMLPreElement.cpp >+++ b/Source/WebCore/html/HTMLPreElement.cpp >@@ -42,15 +42,6 @@ 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) > { > if (attr->name() == widthAttr) { >@@ -59,8 +50,10 @@ 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); > } >diff --git a/Source/WebCore/html/HTMLPreElement.h b/Source/WebCore/html/HTMLPreElement.h >index 3ccdb86..9bfee57 100644 >--- a/Source/WebCore/html/HTMLPreElement.h >+++ b/Source/WebCore/html/HTMLPreElement.h >@@ -34,7 +34,6 @@ public: > private: > HTMLPreElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLTableCaptionElement.cpp b/Source/WebCore/html/HTMLTableCaptionElement.cpp >index b726df6..9b82bf9 100644 >--- a/Source/WebCore/html/HTMLTableCaptionElement.cpp >+++ b/Source/WebCore/html/HTMLTableCaptionElement.cpp >@@ -44,21 +44,13 @@ 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) > { > if (attr->name() == alignAttr) { > if (!attr->value().isEmpty()) >- addCSSProperty(attr, CSSPropertyCaptionSide, attr->value()); >+ addCSSProperty(CSSPropertyCaptionSide, attr->value()); >+ else >+ removeCSSProperty(CSSPropertyCaptionSide); > } else > HTMLElement::parseMappedAttribute(attr); > } >diff --git a/Source/WebCore/html/HTMLTableCaptionElement.h b/Source/WebCore/html/HTMLTableCaptionElement.h >index a2dd2fa..5c5ce97 100644 >--- a/Source/WebCore/html/HTMLTableCaptionElement.h >+++ b/Source/WebCore/html/HTMLTableCaptionElement.h >@@ -36,8 +36,7 @@ public: > > private: > HTMLTableCaptionElement(const QualifiedName&, Document*); >- >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; >+ > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLTableCellElement.cpp b/Source/WebCore/html/HTMLTableCellElement.cpp >index 9a96a36..924487b 100644 >--- a/Source/WebCore/html/HTMLTableCellElement.cpp >+++ b/Source/WebCore/html/HTMLTableCellElement.cpp >@@ -75,22 +75,6 @@ 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) > { > if (attr->name() == rowspanAttr) { >@@ -100,20 +84,25 @@ 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); > } >diff --git a/Source/WebCore/html/HTMLTableCellElement.h b/Source/WebCore/html/HTMLTableCellElement.h >index d7ddc86..f7827bd 100644 >--- a/Source/WebCore/html/HTMLTableCellElement.h >+++ b/Source/WebCore/html/HTMLTableCellElement.h >@@ -53,7 +53,6 @@ public: > private: > HTMLTableCellElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > > virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; >diff --git a/Source/WebCore/html/HTMLTableColElement.cpp b/Source/WebCore/html/HTMLTableColElement.cpp >index 10657e6..b8f44c6 100644 >--- a/Source/WebCore/html/HTMLTableColElement.cpp >+++ b/Source/WebCore/html/HTMLTableColElement.cpp >@@ -47,16 +47,6 @@ 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) > { > if (attr->name() == spanAttr) { >@@ -65,14 +55,15 @@ 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); > } >diff --git a/Source/WebCore/html/HTMLTableColElement.h b/Source/WebCore/html/HTMLTableColElement.h >index 36180c7..49645c7 100644 >--- a/Source/WebCore/html/HTMLTableColElement.h >+++ b/Source/WebCore/html/HTMLTableColElement.h >@@ -42,7 +42,6 @@ public: > private: > HTMLTableColElement(const QualifiedName& tagName, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; > >diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp >index cac8b4d..2c1e3a2 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) || >@@ -308,38 +272,46 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) > 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,14 +352,17 @@ 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); >+ removeCSSProperties(CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderRightStyle); > } > } else if (attr->name() == rulesAttr) { > m_rulesAttr = UnsetRules; >@@ -404,10 +379,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,22 +395,33 @@ 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); > >diff --git a/Source/WebCore/html/HTMLTableElement.h b/Source/WebCore/html/HTMLTableElement.h >index cfde1df..e7da502 100644 >--- a/Source/WebCore/html/HTMLTableElement.h >+++ b/Source/WebCore/html/HTMLTableElement.h >@@ -72,7 +72,6 @@ public: > private: > HTMLTableElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > virtual bool isURLAttribute(Attribute*) const; > >diff --git a/Source/WebCore/html/HTMLTablePartElement.cpp b/Source/WebCore/html/HTMLTablePartElement.cpp >index dfaecca..c96bea9 100644 >--- a/Source/WebCore/html/HTMLTablePartElement.cpp >+++ b/Source/WebCore/html/HTMLTablePartElement.cpp >@@ -36,63 +36,52 @@ 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) > { > 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); > } >diff --git a/Source/WebCore/html/HTMLTablePartElement.h b/Source/WebCore/html/HTMLTablePartElement.h >index 9df2f91..317f18a 100644 >--- a/Source/WebCore/html/HTMLTablePartElement.h >+++ b/Source/WebCore/html/HTMLTablePartElement.h >@@ -37,7 +37,6 @@ protected: > { > } > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp >index b5ac633..ea062ed 100644 >--- a/Source/WebCore/html/HTMLTextAreaElement.cpp >+++ b/Source/WebCore/html/HTMLTextAreaElement.cpp >@@ -151,11 +151,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()) >diff --git a/Source/WebCore/html/HTMLUListElement.cpp b/Source/WebCore/html/HTMLUListElement.cpp >index 4b121aa..8073390 100644 >--- a/Source/WebCore/html/HTMLUListElement.cpp >+++ b/Source/WebCore/html/HTMLUListElement.cpp >@@ -47,20 +47,13 @@ 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) > { > if (attr->name() == typeAttr) >- addCSSProperty(attr, CSSPropertyListStyleType, attr->value()); >+ if (attr->value().isNull()) >+ removeCSSProperty(CSSPropertyListStyleType); >+ else >+ addCSSProperty(CSSPropertyListStyleType, attr->value()); > else > HTMLElement::parseMappedAttribute(attr); > } >diff --git a/Source/WebCore/html/HTMLUListElement.h b/Source/WebCore/html/HTMLUListElement.h >index f91bf1c..90ec4ab 100644 >--- a/Source/WebCore/html/HTMLUListElement.h >+++ b/Source/WebCore/html/HTMLUListElement.h >@@ -35,7 +35,6 @@ public: > private: > HTMLUListElement(const QualifiedName&, Document*); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/html/HTMLVideoElement.cpp b/Source/WebCore/html/HTMLVideoElement.cpp >index fed2fa4..2778cee 100644 >--- a/Source/WebCore/html/HTMLVideoElement.cpp >+++ b/Source/WebCore/html/HTMLVideoElement.cpp >@@ -114,9 +114,15 @@ 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); > } >diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp >index b1a59a3..360ed61 100644 >--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp >+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp >@@ -714,9 +714,10 @@ PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForRuleList(CSSRuleList* > return result.release(); > } > >-PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Element* element) >+PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Element*) > { > RefPtr<InspectorArray> attrStyles = InspectorArray::create(); >+#if 0 > NamedNodeMap* attributes = element->attributes(); > for (unsigned i = 0; attributes && i < attributes->length(); ++i) { > Attribute* attribute = attributes->attributeItem(i); >@@ -729,7 +730,7 @@ PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Eleme > attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle()); > attrStyles->pushObject(attrStyleObject.release()); > } >- >+#endif > return attrStyles.release(); > } > >diff --git a/Source/WebCore/mathml/MathMLElement.cpp b/Source/WebCore/mathml/MathMLElement.cpp >index 6088810..7dacf61 100644 >--- a/Source/WebCore/mathml/MathMLElement.cpp >+++ b/Source/WebCore/mathml/MathMLElement.cpp >@@ -48,41 +48,29 @@ PassRefPtr<MathMLElement> MathMLElement::create(const QualifiedName& tagName, Do > return adoptRef(new MathMLElement(tagName, document)); > } > >-bool MathMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const >-{ >- if (attrName == mathcolorAttr || attrName == mathbackgroundAttr >- || attrName == colorAttr || attrName == backgroundAttr >- || attrName == fontsizeAttr || attrName == fontstyleAttr >- || attrName == fontweightAttr || attrName == fontfamilyAttr) { >- result = eMathML; >- return false; >- } >- return StyledElement::mapToEntry(attrName, result); >-} >- > void MathMLElement::parseMappedAttribute(Attribute* attr) > { > if (attr->name() == mathbackgroundAttr) >- addCSSProperty(attr, CSSPropertyBackgroundColor, attr->value()); >+ addCSSProperty(CSSPropertyBackgroundColor, attr->value()); > else if (attr->name() == mathsizeAttr) { > // The following three values of mathsize are handled in WebCore/css/mathml.css > if (attr->value() != "normal" && attr->value() != "small" && attr->value() != "big") >- addCSSProperty(attr, CSSPropertyFontSize, attr->value()); >+ addCSSProperty(CSSPropertyFontSize, attr->value()); > } else if (attr->name() == mathcolorAttr) >- addCSSProperty(attr, CSSPropertyColor, attr->value()); >+ addCSSProperty(CSSPropertyColor, attr->value()); > // FIXME: deprecated attributes that should loose in a conflict with a non deprecated attribute > else if (attr->name() == fontsizeAttr) >- addCSSProperty(attr, CSSPropertyFontSize, attr->value()); >+ addCSSProperty(CSSPropertyFontSize, attr->value()); > else if (attr->name() == backgroundAttr) >- addCSSProperty(attr, CSSPropertyBackgroundColor, attr->value()); >+ addCSSProperty(CSSPropertyBackgroundColor, attr->value()); > else if (attr->name() == colorAttr) >- addCSSProperty(attr, CSSPropertyColor, attr->value()); >+ addCSSProperty(CSSPropertyColor, attr->value()); > else if (attr->name() == fontstyleAttr) >- addCSSProperty(attr, CSSPropertyFontStyle, attr->value()); >+ addCSSProperty(CSSPropertyFontStyle, attr->value()); > else if (attr->name() == fontweightAttr) >- addCSSProperty(attr, CSSPropertyFontWeight, attr->value()); >+ addCSSProperty(CSSPropertyFontWeight, attr->value()); > else if (attr->name() == fontfamilyAttr) >- addCSSProperty(attr, CSSPropertyFontFamily, attr->value()); >+ addCSSProperty(CSSPropertyFontFamily, attr->value()); > else > StyledElement::parseMappedAttribute(attr); > } >diff --git a/Source/WebCore/mathml/MathMLElement.h b/Source/WebCore/mathml/MathMLElement.h >index 7678f26..ef4744a 100644 >--- a/Source/WebCore/mathml/MathMLElement.h >+++ b/Source/WebCore/mathml/MathMLElement.h >@@ -42,7 +42,6 @@ protected: > > private: > virtual bool isMathMLElement() const { return true; } >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > }; > >diff --git a/Source/WebCore/svg/SVGImageElement.cpp b/Source/WebCore/svg/SVGImageElement.cpp >index 447d70f..bb749d9 100644 >--- a/Source/WebCore/svg/SVGImageElement.cpp >+++ b/Source/WebCore/svg/SVGImageElement.cpp >@@ -105,10 +105,10 @@ void SVGImageElement::parseMappedAttribute(Attribute* attr) > SVGPreserveAspectRatio::parsePreserveAspectRatio(this, attr->value()); > else if (attr->name() == SVGNames::widthAttr) { > setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); >- addCSSProperty(attr, CSSPropertyWidth, attr->value()); >+ addCSSProperty(CSSPropertyWidth, attr->value()); > } else if (attr->name() == SVGNames::heightAttr) { > setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); >- addCSSProperty(attr, CSSPropertyHeight, attr->value()); >+ addCSSProperty(CSSPropertyHeight, attr->value()); > } else if (SVGTests::parseMappedAttribute(attr) > || SVGLangSpace::parseMappedAttribute(attr) > || SVGExternalResourcesRequired::parseMappedAttribute(attr) >diff --git a/Source/WebCore/svg/SVGStyledElement.cpp b/Source/WebCore/svg/SVGStyledElement.cpp >index 08349ff..697bfe6 100644 >--- a/Source/WebCore/svg/SVGStyledElement.cpp >+++ b/Source/WebCore/svg/SVGStyledElement.cpp >@@ -292,22 +292,11 @@ bool SVGStyledElement::isAnimatableCSSProperty(const QualifiedName& attrName) > return cssPropertyToTypeMap().contains(attrName); > } > >-bool SVGStyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const >-{ >- if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName) > 0) { >- result = eSVG; >- return false; >- } >- return SVGElement::mapToEntry(attrName, result); >-} >- > void SVGStyledElement::parseMappedAttribute(Attribute* attr) > { >- // NOTE: Any subclass which overrides parseMappedAttribute for a property handled by >- // cssPropertyIdForSVGAttributeName will also have to override mapToEntry to disable the default eSVG mapping > int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()); > if (propId > 0) { >- addCSSProperty(attr, propId, attr->value()); >+ addCSSProperty(propId, attr->value()); > setNeedsStyleRecalc(); > return; > } >@@ -422,22 +411,14 @@ PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& na > > QualifiedName attributeName(nullAtom, name, nullAtom); > Attribute* attr = attributeMap()->getAttributeItem(attributeName); >- if (!attr || !attr->isMappedAttribute() || !attr->decl()) >+ if (!attr || !attr->isMappedAttribute()) > return 0; > >- Attribute* cssSVGAttr = attr; >- // This function returns a pointer to a CSSValue which can be mutated from JavaScript. >- // If the associated MappedAttribute uses the same CSSMappedAttributeDeclaration >- // as StyledElement's mappedAttributeDecls cache, create a new CSSMappedAttributeDeclaration >- // before returning so that any modifications to the CSSValue will not affect other attributes. >- MappedAttributeEntry entry; >- mapToEntry(attributeName, entry); >- if (getMappedAttributeDecl(entry, cssSVGAttr) == cssSVGAttr->decl()) { >- cssSVGAttr->setDecl(0); >- int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(cssSVGAttr->name()); >- addCSSProperty(cssSVGAttr, propId, cssSVGAttr->value()); >- } >- return cssSVGAttr->decl()->getPropertyCSSValue(name); >+ RefPtr<CSSMappedAttributeDeclaration> style = CSSMappedAttributeDeclaration::create(); >+ >+ int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()); >+ style->setMappedProperty(this, propId, attr->value()); >+ return static_cast<CSSStyleDeclaration*>(style.get())->getPropertyCSSValue(name); > } > > bool SVGStyledElement::instanceUpdatesBlocked() const >diff --git a/Source/WebCore/svg/SVGStyledElement.h b/Source/WebCore/svg/SVGStyledElement.h >index 7577151..a482762 100644 >--- a/Source/WebCore/svg/SVGStyledElement.h >+++ b/Source/WebCore/svg/SVGStyledElement.h >@@ -65,7 +65,6 @@ protected: > SVGStyledElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); > virtual bool rendererIsNeeded(const NodeRenderingContext&); > >- virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; > virtual void parseMappedAttribute(Attribute*); > virtual void svgAttributeChanged(const QualifiedName&); > >diff --git a/Source/WebCore/svg/SVGTextContentElement.cpp b/Source/WebCore/svg/SVGTextContentElement.cpp >index fba6780..fabb797 100644 >--- a/Source/WebCore/svg/SVGTextContentElement.cpp >+++ b/Source/WebCore/svg/SVGTextContentElement.cpp >@@ -247,9 +247,9 @@ void SVGTextContentElement::parseMappedAttribute(Attribute* attr) > DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve")); > > if (attr->value() == preserveString) >- addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePre); >+ addCSSProperty(CSSPropertyWhiteSpace, CSSValuePre); > else >- addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueNowrap); >+ addCSSProperty(CSSPropertyWhiteSpace, CSSValueNowrap); > } > } else > ASSERT_NOT_REACHED();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
webkit.review.bot
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 77204
:
124293
|
125444
|
125445