Changeset 106740 in webkit
- Timestamp:
- Feb 4, 2012 4:24:19 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 74 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106736 r106740 1 2012-02-03 Andreas Kling <awesomekling@apple.com> 2 3 Kill per-Attribute style declarations. 4 <http://webkit.org/b/77204> 5 6 Reviewed by Antti Koivisto. 7 8 Rebaselined 3 inspector tests since attribute styles are no longer shown per-attribute. 9 10 * inspector/elements/elements-panel-styles-expected.txt: 11 * inspector/styles/styles-computed-trace-expected.txt: 12 * inspector/styles/styles-new-API-expected.txt: 13 1 14 2012-02-04 Adam Barth <abarth@webkit.org> 2 15 -
trunk/LayoutTests/inspector/elements/elements-panel-styles-expected.txt
r99713 r106740 33 33 .foo - 10px elements-panel-styles.css:14 34 34 text-align: -webkit-left; 35 div[ align=left] - -webkit-left35 div[] - -webkit-left 36 36 37 37 [expanded] … … 68 68 69 69 [expanded] 70 div[ align=left] { ()70 div[] { () 71 71 text-align: -webkit-left; 72 72 -
trunk/LayoutTests/inspector/styles/styles-computed-trace-expected.txt
r99713 r106740 53 53 ======== Matched CSS Rules ======== 54 54 [expanded] 55 button[ hidden] { ()55 button[] { () 56 56 display: none; 57 57 -
trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt
r103761 r106740 92 92 93 93 === Attribute styles for table === 94 Attribute: width94 Attribute: 95 95 96 96 style -
trunk/Source/WebCore/ChangeLog
r106738 r106740 1 2012-02-03 Andreas Kling <awesomekling@apple.com> 2 3 Kill per-Attribute style declarations. 4 <http://webkit.org/b/77204> 5 6 Reviewed by Antti Koivisto. 7 8 TL;DR summary: Remove the per-Attribute style declarations and replace them by a single 9 style declaration on StyledElement that acts as a secondary inline style. 10 11 The previous design was conceived in the Age of the Old Web(tm) where the majority of 12 element styling was accomplished via attributes. Nowadays, CSS is a much better tool for 13 this and we should optimize around that instead. 14 15 StyledElements now have an attributeStyle() which contains all the styling from attributes. 16 parseMappedAttribute() is responsible for adding/removing properties to the attributeStyle 17 as the corresponding attributes come in/out of the element. 18 19 Each Attribute instance shrinks by one pointer, each element that has attributes grows by 20 one pointer. The styles from individual attributes are no longer shared, so content that 21 uses a lot of repeating styling attributes will see a slight memory regression from this. 22 Future improvements to this could enable sharing the attributeStyle between elements that 23 have the same exact attributes to mitigate some of the damage. 24 25 There should be no web-facing behavior change from this, but it does break two things: 26 27 - The Inspector feature for displaying per-attribute styles. To keep things manageable, 28 this patch simply files all the attribute styles together under an anonymous attribute 29 in the Inspector. 30 31 - The Obj-C DOM binding for Attr::style() has to be kept for compatibility reasons, 32 though it's already deprecated. It will now always return nil, since there's no way to 33 retrieve a live style declaration that's specific to a certain Attr. 34 35 * css/CSSStyleSelector.cpp: 36 (WebCore::CSSStyleSelector::matchAllRules): 37 (WebCore::CSSStyleSelector::canShareStyleWithElement): 38 * dom/Attr.h: 39 (WebCore): 40 (Attr): 41 (WebCore::Attr::style): 42 * dom/Attribute.cpp: 43 (WebCore::Attribute::clone): 44 * dom/Attribute.h: 45 (WebCore): 46 (WebCore::Attribute::create): 47 (WebCore::Attribute::createMapped): 48 (Attribute): 49 (WebCore::Attribute::Attribute): 50 * dom/CSSMappedAttributeDeclaration.cpp: 51 (WebCore::CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration): 52 (WebCore::CSSMappedAttributeDeclaration::setMappedProperty): 53 * dom/CSSMappedAttributeDeclaration.h: 54 (CSSMappedAttributeDeclaration): 55 (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration): 56 * dom/Element.h: 57 (Element): 58 * dom/ElementAttributeData.h: 59 (ElementAttributeData): 60 * dom/NamedNodeMap.cpp: 61 (WebCore::NamedNodeMap::ensureAttributeStyle): 62 (WebCore): 63 * dom/NamedNodeMap.h: 64 (WebCore::NamedNodeMap::attributeStyle): 65 (NamedNodeMap): 66 * dom/StyledElement.cpp: 67 (WebCore): 68 (WebCore::StyledElement::attributeChanged): 69 (WebCore::StyledElement::removeCSSProperties): 70 (WebCore::StyledElement::addCSSProperty): 71 (WebCore::StyledElement::addCSSImageProperty): 72 (WebCore::StyledElement::addCSSLength): 73 (WebCore::StyledElement::addCSSColor): 74 * dom/StyledElement.h: 75 (StyledElement): 76 (WebCore::StyledElement::removeCSSProperty): 77 (WebCore::StyledElement::attributeStyle): 78 (WebCore::StyledElement::ensureAttributeStyle): 79 * html/HTMLBRElement.cpp: 80 (WebCore::HTMLBRElement::parseMappedAttribute): 81 * html/HTMLBRElement.h: 82 (HTMLBRElement): 83 * html/HTMLBodyElement.cpp: 84 (WebCore::HTMLBodyElement::parseMappedAttribute): 85 * html/HTMLBodyElement.h: 86 (HTMLBodyElement): 87 * html/HTMLDivElement.cpp: 88 (WebCore::HTMLDivElement::parseMappedAttribute): 89 * html/HTMLDivElement.h: 90 (HTMLDivElement): 91 * html/HTMLElement.cpp: 92 (WebCore::HTMLElement::applyBorderAttribute): 93 (WebCore::HTMLElement::mapLanguageAttributeToLocale): 94 (WebCore::HTMLElement::parseMappedAttribute): 95 (WebCore::HTMLElement::removeHTMLAlignment): 96 (WebCore): 97 (WebCore::HTMLElement::addHTMLAlignmentToStyledElement): 98 (WebCore::HTMLElement::setContentEditable): 99 * html/HTMLElement.h: 100 (HTMLElement): 101 * html/HTMLEmbedElement.cpp: 102 (WebCore::HTMLEmbedElement::parseMappedAttribute): 103 * html/HTMLEmbedElement.h: 104 (HTMLEmbedElement): 105 * html/HTMLFontElement.cpp: 106 (WebCore::HTMLFontElement::parseMappedAttribute): 107 * html/HTMLFontElement.h: 108 (HTMLFontElement): 109 * html/HTMLFrameSetElement.cpp: 110 (WebCore::HTMLFrameSetElement::parseMappedAttribute): 111 * html/HTMLFrameSetElement.h: 112 (HTMLFrameSetElement): 113 * html/HTMLHRElement.cpp: 114 (WebCore::HTMLHRElement::parseMappedAttribute): 115 * html/HTMLHRElement.h: 116 (HTMLHRElement): 117 * html/HTMLIFrameElement.cpp: 118 (WebCore::HTMLIFrameElement::parseMappedAttribute): 119 * html/HTMLIFrameElement.h: 120 (HTMLIFrameElement): 121 * html/HTMLImageElement.cpp: 122 (WebCore::HTMLImageElement::parseMappedAttribute): 123 * html/HTMLImageElement.h: 124 (HTMLImageElement): 125 * html/HTMLInputElement.cpp: 126 (WebCore::HTMLInputElement::parseMappedAttribute): 127 * html/HTMLInputElement.h: 128 (HTMLInputElement): 129 * html/HTMLLIElement.cpp: 130 (WebCore::HTMLLIElement::parseMappedAttribute): 131 * html/HTMLLIElement.h: 132 (HTMLLIElement): 133 * html/HTMLMarqueeElement.cpp: 134 (WebCore::HTMLMarqueeElement::parseMappedAttribute): 135 * html/HTMLMarqueeElement.h: 136 (HTMLMarqueeElement): 137 * html/HTMLOListElement.cpp: 138 (WebCore::HTMLOListElement::parseMappedAttribute): 139 * html/HTMLOListElement.h: 140 (HTMLOListElement): 141 * html/HTMLOutputElement.cpp: 142 * html/HTMLOutputElement.h: 143 (HTMLOutputElement): 144 * html/HTMLParagraphElement.cpp: 145 (WebCore::HTMLParagraphElement::parseMappedAttribute): 146 * html/HTMLParagraphElement.h: 147 (HTMLParagraphElement): 148 * html/HTMLPlugInElement.cpp: 149 (WebCore::HTMLPlugInElement::parseMappedAttribute): 150 * html/HTMLPlugInElement.h: 151 (HTMLPlugInElement): 152 * html/HTMLPreElement.cpp: 153 (WebCore::HTMLPreElement::parseMappedAttribute): 154 * html/HTMLPreElement.h: 155 (HTMLPreElement): 156 * html/HTMLTableCaptionElement.cpp: 157 (WebCore::HTMLTableCaptionElement::parseMappedAttribute): 158 * html/HTMLTableCaptionElement.h: 159 (HTMLTableCaptionElement): 160 * html/HTMLTableCellElement.cpp: 161 (WebCore::HTMLTableCellElement::parseMappedAttribute): 162 * html/HTMLTableCellElement.h: 163 (HTMLTableCellElement): 164 * html/HTMLTableColElement.cpp: 165 (WebCore::HTMLTableColElement::parseMappedAttribute): 166 * html/HTMLTableColElement.h: 167 (HTMLTableColElement): 168 * html/HTMLTableElement.cpp: 169 (WebCore::HTMLTableElement::parseMappedAttribute): 170 * html/HTMLTableElement.h: 171 (HTMLTableElement): 172 * html/HTMLTablePartElement.cpp: 173 (WebCore): 174 (WebCore::HTMLTablePartElement::parseMappedAttribute): 175 * html/HTMLTablePartElement.h: 176 * html/HTMLTextAreaElement.cpp: 177 (WebCore::HTMLTextAreaElement::parseMappedAttribute): 178 * html/HTMLUListElement.cpp: 179 (WebCore::HTMLUListElement::parseMappedAttribute): 180 * html/HTMLUListElement.h: 181 (HTMLUListElement): 182 * html/HTMLVideoElement.cpp: 183 (WebCore::HTMLVideoElement::parseMappedAttribute): 184 * inspector/InspectorCSSAgent.cpp: 185 (WebCore::InspectorCSSAgent::buildArrayForAttributeStyles): 186 * mathml/MathMLElement.cpp: 187 (WebCore::MathMLElement::parseMappedAttribute): 188 * mathml/MathMLElement.h: 189 * svg/SVGImageElement.cpp: 190 (WebCore::SVGImageElement::parseMappedAttribute): 191 * svg/SVGStyledElement.cpp: 192 (WebCore::SVGStyledElement::parseMappedAttribute): 193 (WebCore::SVGStyledElement::getPresentationAttribute): 194 * svg/SVGStyledElement.h: 195 (SVGStyledElement): 196 * svg/SVGTextContentElement.cpp: 197 (WebCore::SVGTextContentElement::parseMappedAttribute): 198 1 199 2012-02-03 Ilya Tikhonovsky <loislo@chromium.org> 2 200 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r106681 r106740 997 997 // Now check author rules, beginning first with presentational attributes mapped from HTML. 998 998 if (m_styledElement) { 999 if (const NamedNodeMap* map = m_styledElement->attributeMap()) { 1000 // Walk the element's attribute map and add all mapped attribute declarations. 1001 for (unsigned i = 0; i < map->length(); ++i) { 1002 Attribute* attribute = map->attributeItem(i); 1003 if (!attribute->decl()) 1004 continue; 1005 ASSERT(attribute->isMappedAttribute()); 1006 result.ranges.lastAuthorRule = m_matchedDecls.size(); 999 if (CSSMappedAttributeDeclaration* attributeStyle = m_styledElement->attributeStyle()) { 1000 ASSERT(attributeStyle->declaration()); 1001 if (!attributeStyle->declaration()->isEmpty()) { 1002 result.ranges.lastAuthorRule = m_matchedRules.size(); 1007 1003 if (result.ranges.firstAuthorRule == -1) 1008 1004 result.ranges.firstAuthorRule = result.ranges.lastAuthorRule; 1009 addMatchedDeclaration(attribute ->decl());1005 addMatchedDeclaration(attributeStyle->declaration()); 1010 1006 } 1011 1007 } … … 1199 1195 } 1200 1196 1201 static inline bool mappedAttributesEquivalent(NamedNodeMap* a, NamedNodeMap* b)1202 {1203 ASSERT(a->mappedAttributeCount() == b->mappedAttributeCount());1204 1205 for (size_t i = 0; i < a->length(); ++i) {1206 Attribute* attribute = a->attributeItem(i);1207 if (!attribute->decl())1208 continue;1209 ASSERT(attribute->isMappedAttribute());1210 Attribute* otherAttribute = b->getAttributeItem(attribute->name());1211 if (!otherAttribute || attribute->value() != otherAttribute->value() || attribute->decl() != otherAttribute->decl())1212 return false;1213 }1214 return true;1215 }1216 1217 1197 bool CSSStyleSelector::canShareStyleWithElement(StyledElement* element) const 1218 1198 { … … 1229 1209 if (element->inlineStyleDecl()) 1230 1210 return false; 1231 size_t mappedAttributeCount = element->mappedAttributeCount(); 1232 if (mappedAttributeCount != m_styledElement->mappedAttributeCount()) 1211 if (!!element->attributeStyle() != !!m_styledElement->attributeStyle()) 1233 1212 return false; 1234 1213 if (element->isLink() != m_element->isLink()) … … 1296 1275 return false; 1297 1276 1298 if ( mappedAttributeCount && !mappedAttributesEquivalent(element->attributeMap(),m_styledElement->attributeMap()))1277 if (element->attributeStyle() && !element->attributeMap()->mapsEquivalent(m_styledElement->attributeMap())) 1299 1278 return false; 1300 1279 -
trunk/Source/WebCore/dom/Attr.h
r106681 r106740 31 31 namespace WebCore { 32 32 33 class CSSStyleDeclaration; 34 33 35 // Attr can have Text and EntityReference children 34 36 // therefore it has to be a fullblown Node. The plan … … 56 58 bool isId() const; 57 59 58 // An extension to get presentational information for attributes. 59 CSSStyleDeclaration* style() { return m_attribute->decl()->ensureCSSStyleDeclaration(); } 60 // A deprecated extension to get presentational information for attributes. 61 // We have to keep it around because it's exposed in the Obj-C DOM API. 62 CSSStyleDeclaration* style() { return 0; } 60 63 61 64 void setSpecified(bool specified) { m_specified = specified; } -
trunk/Source/WebCore/dom/Attribute.cpp
r106471 r106740 41 41 PassRefPtr<Attribute> Attribute::clone() const 42 42 { 43 return adoptRef(new Attribute(m_name, m_value, m_isMappedAttribute , m_mappedAttributeDeclaration.get()));43 return adoptRef(new Attribute(m_name, m_value, m_isMappedAttribute)); 44 44 } 45 45 -
trunk/Source/WebCore/dom/Attribute.h
r106681 r106740 26 26 #define Attribute_h 27 27 28 #include "CSSMappedAttributeDeclaration.h"29 28 #include "QualifiedName.h" 30 29 … … 32 31 33 32 class Attr; 34 class CSSStyleDeclaration;35 33 class Element; 36 34 class NamedNodeMap; … … 44 42 static PassRefPtr<Attribute> create(const QualifiedName& name, const AtomicString& value) 45 43 { 46 return adoptRef(new Attribute(name, value, false , 0));44 return adoptRef(new Attribute(name, value, false)); 47 45 } 48 46 static PassRefPtr<Attribute> createMapped(const QualifiedName& name, const AtomicString& value) 49 47 { 50 return adoptRef(new Attribute(name, value, true , 0));48 return adoptRef(new Attribute(name, value, true)); 51 49 } 52 50 static PassRefPtr<Attribute> createMapped(const AtomicString& name, const AtomicString& value) 53 51 { 54 return adoptRef(new Attribute(name, value, true , 0));52 return adoptRef(new Attribute(name, value, true)); 55 53 } 56 54 … … 69 67 70 68 PassRefPtr<Attribute> clone() const; 71 72 StylePropertySet* decl() const { return m_mappedAttributeDeclaration ? m_mappedAttributeDeclaration->declaration() : 0; }73 74 CSSMappedAttributeDeclaration* mappedAttributeDeclaration() const { return m_mappedAttributeDeclaration.get(); }75 void setMappedAttributeDeclaration(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_mappedAttributeDeclaration = decl; }76 69 77 70 void setValue(const AtomicString& value) { m_value = value; } … … 86 79 87 80 private: 88 Attribute(const QualifiedName& name, const AtomicString& value, bool isMappedAttribute , CSSMappedAttributeDeclaration* styleDecl)81 Attribute(const QualifiedName& name, const AtomicString& value, bool isMappedAttribute) 89 82 : m_isMappedAttribute(isMappedAttribute) 90 83 , m_hasAttr(false) 91 84 , m_name(name) 92 85 , m_value(value) 93 , m_mappedAttributeDeclaration(styleDecl)94 86 { 95 87 } 96 88 97 Attribute(const AtomicString& name, const AtomicString& value, bool isMappedAttribute , CSSMappedAttributeDeclaration* styleDecl)89 Attribute(const AtomicString& name, const AtomicString& value, bool isMappedAttribute) 98 90 : m_isMappedAttribute(isMappedAttribute) 99 91 , m_hasAttr(false) 100 92 , m_name(nullAtom, name, nullAtom) 101 93 , m_value(value) 102 , m_mappedAttributeDeclaration(styleDecl)103 94 { 104 95 } … … 113 104 QualifiedName m_name; 114 105 AtomicString m_value; 115 RefPtr<CSSMappedAttributeDeclaration> m_mappedAttributeDeclaration;116 106 }; 117 107 -
trunk/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp
r106471 r106740 39 39 CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration() 40 40 { 41 StyledElement::removeMappedAttributeDecl(m_entryType, m_attrName, m_attrValue);42 41 } 43 42 … … 67 66 } 68 67 69 if (!CSSParser::parseMappedAttributeValue(this, element, propertyId, value)) 68 if (!CSSParser::parseMappedAttributeValue(this, element, propertyId, value)) { 69 removeMappedProperty(element, propertyId); 70 70 return; 71 } 71 72 72 73 setNeedsStyleRecalc(element); -
trunk/Source/WebCore/dom/CSSMappedAttributeDeclaration.h
r106695 r106740 43 43 ~CSSMappedAttributeDeclaration(); 44 44 45 void setMappedState(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& val)46 {47 m_entryType = type;48 m_attrName = name;49 m_attrValue = val;50 }51 52 45 void setMappedProperty(StyledElement*, int propertyId, int value); 53 46 void setMappedProperty(StyledElement*, int propertyId, const String& value); … … 64 57 CSSMappedAttributeDeclaration() 65 58 : m_declaration(StylePropertySet::create()) 66 , m_entryType(eNone)67 , m_attrName(anyQName())68 59 { 69 60 } … … 72 63 73 64 RefPtr<StylePropertySet> m_declaration; 74 MappedAttributeEntry m_entryType;75 QualifiedName m_attrName;76 AtomicString m_attrValue;77 65 }; 78 66 -
trunk/Source/WebCore/dom/Element.h
r106626 r106740 222 222 223 223 // This method is called whenever an attribute is added, changed or removed. 224 // FIXME: Remove the preserveDecls argument. 224 225 virtual void attributeChanged(Attribute*, bool preserveDecls = false); 225 226 -
trunk/Source/WebCore/dom/ElementAttributeData.h
r106695 r106740 27 27 #define ElementAttributeData_h 28 28 29 #include "CSSMappedAttributeDeclaration.h" 29 30 #include "SpaceSplitString.h" 30 31 #include "StylePropertySet.h" … … 51 52 52 53 RefPtr<StylePropertySet> m_inlineStyleDecl; 54 RefPtr<CSSMappedAttributeDeclaration> m_attributeStyle; 53 55 SpaceSplitString m_classNames; 54 56 AtomicString m_idForStyleResolution; -
trunk/Source/WebCore/dom/NamedNodeMap.cpp
r106681 r106740 340 340 } 341 341 342 CSSMappedAttributeDeclaration* NamedNodeMap::ensureAttributeStyle() 343 { 344 if (!attributeData()->m_attributeStyle) { 345 attributeData()->m_attributeStyle = CSSMappedAttributeDeclaration::create(); 346 attributeData()->m_attributeStyle->declaration()->setStrictParsing(false); 347 } 348 return attributeData()->m_attributeStyle.get(); 349 } 350 342 351 } // namespace WebCore -
trunk/Source/WebCore/dom/NamedNodeMap.h
r106681 r106740 27 27 28 28 #include "Attribute.h" 29 #include "CSSMappedAttributeDeclaration.h" 30 #include "CSSPropertyNames.h" 29 31 #include "ElementAttributeData.h" 30 32 #include "SpaceSplitString.h" … … 103 105 StylePropertySet* ensureInlineStyleDecl(); 104 106 void destroyInlineStyleDecl(); 107 108 CSSMappedAttributeDeclaration* attributeStyle() const { return attributeData()->m_attributeStyle.get(); } 109 CSSMappedAttributeDeclaration* ensureAttributeStyle(); 105 110 106 111 private: … … 185 190 } 186 191 187 inline size_t NamedNodeMap::mappedAttributeCount() const188 {189 size_t count = 0;190 for (size_t i = 0; i < m_attributes.size(); ++i) {191 if (m_attributes[i]->decl())192 ++count;193 }194 return count;195 }196 197 192 } // namespace WebCore 198 193 -
trunk/Source/WebCore/dom/StyledElement.cpp
r106695 r106740 45 45 using namespace HTMLNames; 46 46 47 struct MappedAttributeKey {48 uint16_t type;49 StringImpl* name;50 StringImpl* value;51 MappedAttributeKey(MappedAttributeEntry t = eNone, StringImpl* n = 0, StringImpl* v = 0)52 : type(t), name(n), value(v) { }53 };54 55 static inline bool operator==(const MappedAttributeKey& a, const MappedAttributeKey& b)56 { return a.type == b.type && a.name == b.name && a.value == b.value; }57 58 struct MappedAttributeKeyTraits : WTF::GenericHashTraits<MappedAttributeKey> {59 static const bool emptyValueIsZero = true;60 static const bool needsDestruction = false;61 static void constructDeletedValue(MappedAttributeKey& slot) { slot.type = eLastEntry; }62 static bool isDeletedValue(const MappedAttributeKey& value) { return value.type == eLastEntry; }63 };64 65 struct MappedAttributeHash {66 static unsigned hash(const MappedAttributeKey&);67 static bool equal(const MappedAttributeKey& a, const MappedAttributeKey& b) { return a == b; }68 static const bool safeToCompareToEmptyOrDeleted = true;69 };70 71 typedef HashMap<MappedAttributeKey, CSSMappedAttributeDeclaration*, MappedAttributeHash, MappedAttributeKeyTraits> MappedAttributeDecls;72 73 static MappedAttributeDecls* mappedAttributeDecls = 0;74 75 CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr)76 {77 if (!mappedAttributeDecls)78 return 0;79 return mappedAttributeDecls->get(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()));80 }81 82 CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value)83 {84 if (!mappedAttributeDecls)85 return 0;86 return mappedAttributeDecls->get(MappedAttributeKey(type, name.localName().impl(), value.impl()));87 }88 89 void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr, CSSMappedAttributeDeclaration* decl)90 {91 if (!mappedAttributeDecls)92 mappedAttributeDecls = new MappedAttributeDecls;93 mappedAttributeDecls->set(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()), decl);94 }95 96 void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* decl)97 {98 if (!mappedAttributeDecls)99 mappedAttributeDecls = new MappedAttributeDecls;100 mappedAttributeDecls->set(MappedAttributeKey(entryType, name.localName().impl(), value.impl()), decl);101 }102 103 void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& attrName, const AtomicString& attrValue)104 {105 if (!mappedAttributeDecls)106 return;107 mappedAttributeDecls->remove(MappedAttributeKey(entryType, attrName.localName().impl(), attrValue.impl()));108 }109 110 47 void StyledElement::updateStyleAttribute() const 111 48 { … … 137 74 return; 138 75 } 139 140 if (attr->mappedAttributeDeclaration() && !preserveDecls) { 141 attr->setMappedAttributeDeclaration(0); 142 setNeedsStyleRecalc(); 143 } 144 145 bool checkDecl = true; 146 MappedAttributeEntry entry; 147 bool needToParse = mapToEntry(attr->name(), entry); 148 if (preserveDecls) { 149 if (attr->mappedAttributeDeclaration()) { 150 setNeedsStyleRecalc(); 151 checkDecl = false; 152 } 153 } else if (!attr->isNull() && entry != eNone) { 154 CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(entry, attr); 155 if (decl) { 156 attr->setMappedAttributeDeclaration(decl); 157 setNeedsStyleRecalc(); 158 checkDecl = false; 159 } else 160 needToParse = true; 161 } 162 163 // parseMappedAttribute() might create a CSSMappedAttributeDeclaration on the attribute. 164 // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewDocument(). 165 // But currently we always clear its parent and node below when adding it to the decl table. 166 // If that changes for some reason moving between documents will be buggy. 167 // webarchive/adopt-attribute-styled-node-webarchive.html should catch any resulting crashes. 168 if (needToParse) 76 77 if (!(attr->name() == styleAttr && isSynchronizingStyleAttribute())) 169 78 parseMappedAttribute(attr); 170 79 171 if (entry == eNone) 172 recalcStyleIfNeededAfterAttributeChanged(attr); 173 174 if (checkDecl && attr->mappedAttributeDeclaration()) { 175 // Add the decl to the table in the appropriate spot. 176 setMappedAttributeDecl(entry, attr, attr->mappedAttributeDeclaration()); 177 attr->mappedAttributeDeclaration()->setMappedState(entry, attr->name(), attr->value()); 178 } 179 80 recalcStyleIfNeededAfterAttributeChanged(attr); 180 81 updateAfterAttributeChanged(attr); 181 }182 183 bool StyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const184 {185 result = eNone;186 if (attrName == styleAttr)187 return !isSynchronizingStyleAttribute();188 return true;189 82 } 190 83 … … 227 120 } 228 121 229 void StyledElement::removeCSSProperty(Attribute* attribute, int id) 230 { 231 if (!attribute->mappedAttributeDeclaration()) 232 createMappedDecl(attribute); 233 attribute->mappedAttributeDeclaration()->removeMappedProperty(this, id); 234 } 235 236 void StyledElement::addCSSProperty(Attribute* attribute, int id, const String &value) 237 { 238 if (!attribute->mappedAttributeDeclaration()) 239 createMappedDecl(attribute); 240 attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, value); 241 } 242 243 void StyledElement::addCSSProperty(Attribute* attribute, int id, int value) 244 { 245 if (!attribute->mappedAttributeDeclaration()) 246 createMappedDecl(attribute); 247 attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, value); 248 } 249 250 void StyledElement::addCSSImageProperty(Attribute* attribute, int id, const String& url) 251 { 252 if (!attribute->mappedAttributeDeclaration()) 253 createMappedDecl(attribute); 254 attribute->mappedAttributeDeclaration()->setMappedImageProperty(this, id, url); 255 } 256 257 void StyledElement::addCSSLength(Attribute* attribute, int id, const String &value) 122 void StyledElement::removeCSSProperties(int id1, int id2, int id3, int id4, int id5, int id6, int id7, int id8) 123 { 124 CSSMappedAttributeDeclaration* style = attributeStyle(); 125 if (!style) 126 return; 127 128 ASSERT(id1 != CSSPropertyInvalid); 129 style->removeMappedProperty(this, id1); 130 131 if (id2 == CSSPropertyInvalid) 132 return; 133 style->removeMappedProperty(this, id2); 134 if (id3 == CSSPropertyInvalid) 135 return; 136 style->removeMappedProperty(this, id3); 137 if (id4 == CSSPropertyInvalid) 138 return; 139 style->removeMappedProperty(this, id4); 140 if (id5 == CSSPropertyInvalid) 141 return; 142 style->removeMappedProperty(this, id5); 143 if (id6 == CSSPropertyInvalid) 144 return; 145 style->removeMappedProperty(this, id6); 146 if (id7 == CSSPropertyInvalid) 147 return; 148 style->removeMappedProperty(this, id7); 149 if (id8 == CSSPropertyInvalid) 150 return; 151 style->removeMappedProperty(this, id8); 152 } 153 154 void StyledElement::addCSSProperty(int id, const String &value) 155 { 156 ensureAttributeStyle()->setMappedProperty(this, id, value); 157 } 158 159 void StyledElement::addCSSProperty(int id, int value) 160 { 161 ensureAttributeStyle()->setMappedProperty(this, id, value); 162 } 163 164 void StyledElement::addCSSImageProperty(int id, const String& url) 165 { 166 ensureAttributeStyle()->setMappedImageProperty(this, id, url); 167 } 168 169 void StyledElement::addCSSLength(int id, const String &value) 258 170 { 259 171 // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct 260 172 // length unit and make the appropriate parsed value. 261 if (!attribute->mappedAttributeDeclaration())262 createMappedDecl(attribute);263 173 264 174 // strip attribute garbage.. … … 283 193 284 194 if (l != v->length()) { 285 attribute->mappedAttributeDeclaration()->setMappedLengthProperty(this, id, v->substring(0, l));195 ensureAttributeStyle()->setMappedLengthProperty(this, id, v->substring(0, l)); 286 196 return; 287 197 } 288 198 } 289 199 290 attribute->mappedAttributeDeclaration()->setMappedLengthProperty(this, id, value);200 ensureAttributeStyle()->setMappedLengthProperty(this, id, value); 291 201 } 292 202 … … 344 254 345 255 // Color parsing that matches HTML's "rules for parsing a legacy color value" 346 void StyledElement::addCSSColor( Attribute* attribute,int id, const String& attributeValue)256 void StyledElement::addCSSColor(int id, const String& attributeValue) 347 257 { 348 258 // An empty string doesn't apply a color. (One containing only whitespace does, which is why this check occurs before stripping.) 349 if (attributeValue.isEmpty()) 350 return; 259 if (attributeValue.isEmpty()) { 260 removeCSSProperty(id); 261 return; 262 } 351 263 352 264 String colorString = attributeValue.stripWhiteSpace(); 353 265 354 266 // "transparent" doesn't apply a color either. 355 if (equalIgnoringCase(colorString, "transparent")) 356 return; 357 358 if (!attribute->mappedAttributeDeclaration()) 359 createMappedDecl(attribute); 267 if (equalIgnoringCase(colorString, "transparent")) { 268 removeCSSProperty(id); 269 return; 270 } 360 271 361 272 // If the string is a named CSS color or a 3/6-digit hex color, use that. 362 273 Color parsedColor(colorString); 363 274 if (parsedColor.isValid()) { 364 attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, colorString); 365 return; 366 } 367 368 attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, parseColorStringWithCrazyLegacyRules(colorString)); 369 } 370 371 void StyledElement::createMappedDecl(Attribute* attr) 372 { 373 RefPtr<CSSMappedAttributeDeclaration> decl = CSSMappedAttributeDeclaration::create(); 374 attr->setMappedAttributeDeclaration(decl); 375 ASSERT(!decl->declaration()->useStrictParsing()); 376 } 377 378 unsigned MappedAttributeHash::hash(const MappedAttributeKey& key) 379 { 380 COMPILE_ASSERT(sizeof(key.name) == 4 || sizeof(key.name) == 8, key_name_size); 381 COMPILE_ASSERT(sizeof(key.value) == 4 || sizeof(key.value) == 8, key_value_size); 382 383 StringHasher hasher; 384 const UChar* data; 385 386 data = reinterpret_cast<const UChar*>(&key.name); 387 hasher.addCharacters(data[0], data[1]); 388 if (sizeof(key.name) == 8) 389 hasher.addCharacters(data[2], data[3]); 390 391 data = reinterpret_cast<const UChar*>(&key.value); 392 hasher.addCharacters(data[0], data[1]); 393 if (sizeof(key.value) == 8) 394 hasher.addCharacters(data[2], data[3]); 395 396 return hasher.hash(); 275 ensureAttributeStyle()->setMappedProperty(this, id, colorString); 276 return; 277 } 278 279 ensureAttributeStyle()->setMappedProperty(this, id, parseColorStringWithCrazyLegacyRules(colorString)); 397 280 } 398 281 -
trunk/Source/WebCore/dom/StyledElement.h
r106695 r106740 40 40 41 41 size_t mappedAttributeCount() const { return attributeMap() ? attributeMap()->mappedAttributeCount() : 0; } 42 bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; }43 42 44 void addCSSLength(Attribute*, int id, const String& value); 45 void addCSSProperty(Attribute*, int id, const String& value); 46 void addCSSProperty(Attribute*, int id, int value); 47 void addCSSImageProperty(Attribute*, int propertyID, const String& url); 48 void addCSSColor(Attribute*, int id, const String& color); 49 void removeCSSProperty(Attribute*, int id); 50 51 static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value); 52 static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*); 53 static void removeMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value); 54 55 static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*); 56 static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*); 43 void addCSSLength(int id, const String& value); 44 void addCSSProperty(int id, const String& value); 45 void addCSSProperty(int id, int value); 46 void addCSSImageProperty(int propertyID, const String& url); 47 void addCSSColor(int id, const String& color); 48 void removeCSSProperties(int id1, int id2 = CSSPropertyInvalid, int id3 = CSSPropertyInvalid, int id4 = CSSPropertyInvalid, int id5 = CSSPropertyInvalid, int id6 = CSSPropertyInvalid, int id7 = CSSPropertyInvalid, int id8 = CSSPropertyInvalid); 49 void removeCSSProperty(int id) { removeCSSProperties(id); } 57 50 58 51 virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() { return 0; } … … 63 56 virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl()->ensureCSSStyleDeclaration(); } 64 57 58 CSSMappedAttributeDeclaration* attributeStyle() const { return attributeMap() ? attributeMap()->attributeStyle() : 0; } 59 CSSMappedAttributeDeclaration* ensureAttributeStyle() { return ensureAttributeMap()->ensureAttributeStyle(); } 60 65 61 const SpaceSplitString& classNames() const; 66 67 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;68 62 69 63 virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); … … 87 81 88 82 private: 89 void createMappedDecl(Attribute*);90 91 83 virtual void updateStyleAttribute() const; 92 84 -
trunk/Source/WebCore/html/HTMLBRElement.cpp
r88270 r106740 49 49 } 50 50 51 bool HTMLBRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const52 {53 if (attrName == clearAttr) {54 result = eUniversal;55 return false;56 }57 58 return HTMLElement::mapToEntry(attrName, result);59 }60 61 51 void HTMLBRElement::parseMappedAttribute(Attribute* attr) 62 52 { … … 64 54 // If the string is empty, then don't add the clear property. 65 55 // <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh 66 const AtomicString& str = attr->value(); 67 if (!str.isEmpty()) { 68 if (equalIgnoringCase(str, "all")) 69 addCSSProperty(attr, CSSPropertyClear, "both"); 56 if (attr->value().isNull()) 57 removeCSSProperty(CSSPropertyClear); 58 else if (!attr->value().isEmpty()) { 59 if (equalIgnoringCase(attr->value(), "all")) 60 addCSSProperty(CSSPropertyClear, "both"); 70 61 else 71 addCSSProperty( attr, CSSPropertyClear, str);62 addCSSProperty(CSSPropertyClear, attr->value()); 72 63 } 73 64 } else -
trunk/Source/WebCore/html/HTMLBRElement.h
r86491 r106740 39 39 HTMLBRElement(const QualifiedName&, Document*); 40 40 41 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;42 41 virtual void parseMappedAttribute(Attribute*); 43 42 -
trunk/Source/WebCore/html/HTMLBodyElement.cpp
r99742 r106740 61 61 } 62 62 63 bool HTMLBodyElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const64 {65 if (attrName == backgroundAttr) {66 result = (MappedAttributeEntry)(eLastEntry + document()->docID());67 return false;68 }69 70 if (attrName == bgcolorAttr ||71 attrName == textAttr ||72 attrName == marginwidthAttr ||73 attrName == leftmarginAttr ||74 attrName == marginheightAttr ||75 attrName == topmarginAttr ||76 attrName == bgpropertiesAttr) {77 result = eUniversal;78 return false;79 }80 81 return HTMLElement::mapToEntry(attrName, result);82 }83 84 63 void HTMLBodyElement::parseMappedAttribute(Attribute* attr) 85 64 { … … 87 66 String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); 88 67 if (!url.isEmpty()) 89 addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); 68 addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); 69 else 70 removeCSSProperty(CSSPropertyBackgroundImage); 90 71 } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) { 91 addCSSLength(attr, CSSPropertyMarginRight, attr->value()); 92 addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); 72 if (attr->value().isNull()) 73 removeCSSProperties(CSSPropertyMarginRight, CSSPropertyMarginLeft); 74 else { 75 addCSSLength(CSSPropertyMarginRight, attr->value()); 76 addCSSLength(CSSPropertyMarginLeft, attr->value()); 77 } 93 78 } else if (attr->name() == marginheightAttr || attr->name() == topmarginAttr) { 94 addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); 95 addCSSLength(attr, CSSPropertyMarginTop, attr->value()); 79 if (attr->value().isNull()) 80 removeCSSProperties(CSSPropertyMarginBottom, CSSPropertyMarginTop); 81 else { 82 addCSSLength(CSSPropertyMarginBottom, attr->value()); 83 addCSSLength(CSSPropertyMarginTop, attr->value()); 84 } 96 85 } else if (attr->name() == bgcolorAttr) { 97 addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); 86 if (attr->value().isNull()) 87 removeCSSProperty(CSSPropertyBackgroundColor); 88 else 89 addCSSColor(CSSPropertyBackgroundColor, attr->value()); 98 90 } else if (attr->name() == textAttr) { 99 addCSSColor(attr, CSSPropertyColor, attr->value()); 91 if (attr->value().isNull()) 92 removeCSSProperty(CSSPropertyColor); 93 else 94 addCSSColor(CSSPropertyColor, attr->value()); 100 95 } else if (attr->name() == bgpropertiesAttr) { 101 96 if (equalIgnoringCase(attr->value(), "fixed")) 102 addCSSProperty(attr, CSSPropertyBackgroundAttachment, CSSValueFixed); 97 addCSSProperty(CSSPropertyBackgroundAttachment, CSSValueFixed); 98 else 99 removeCSSProperty(CSSPropertyBackgroundAttachment); 103 100 } else if (attr->name() == vlinkAttr || 104 101 attr->name() == alinkAttr || -
trunk/Source/WebCore/html/HTMLBodyElement.h
r97877 r106740 71 71 HTMLBodyElement(const QualifiedName&, Document*); 72 72 73 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;74 73 virtual void parseMappedAttribute(Attribute*); 75 74 -
trunk/Source/WebCore/html/HTMLDivElement.cpp
r103828 r106740 49 49 } 50 50 51 bool HTMLDivElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const52 {53 if (attrName == alignAttr) {54 result = eBlock;55 return false;56 }57 return HTMLElement::mapToEntry(attrName, result);58 }59 60 51 void HTMLDivElement::parseMappedAttribute(Attribute* attr) 61 52 { 62 53 if (attr->name() == alignAttr) { 54 if (attr->value().isNull()) 55 removeCSSProperty(CSSPropertyTextAlign); 63 56 if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) 64 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueWebkitCenter);57 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); 65 58 else if (equalIgnoringCase(attr->value(), "left")) 66 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueWebkitLeft);59 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); 67 60 else if (equalIgnoringCase(attr->value(), "right")) 68 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueWebkitRight);61 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); 69 62 else 70 addCSSProperty( attr,CSSPropertyTextAlign, attr->value());63 addCSSProperty(CSSPropertyTextAlign, attr->value()); 71 64 } else 72 65 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLDivElement.h
r89452 r106740 37 37 38 38 private: 39 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;40 39 virtual void parseMappedAttribute(Attribute*); 41 40 }; -
trunk/Source/WebCore/html/HTMLElement.cpp
r106685 r106740 121 121 } 122 122 123 bool HTMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const124 {125 if (attrName == alignAttr126 || attrName == contenteditableAttr127 || attrName == hiddenAttr) {128 result = eUniversal;129 return false;130 }131 if (attrName == dirAttr) {132 if (hasLocalName(bdoTag))133 result = eBDO;134 else if (hasLocalName(bdiTag))135 result = eBDI;136 else137 result = eUniversal;138 return true;139 }140 141 return StyledElement::mapToEntry(attrName, result);142 }143 144 123 static inline int unicodeBidiAttributeForDirAuto(HTMLElement* element) 145 124 { … … 164 143 void HTMLElement::applyBorderAttribute(Attribute* attr) 165 144 { 166 addCSSLength( attr,CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr)));167 addCSSProperty( attr,CSSPropertyBorderTopStyle, CSSValueSolid);168 addCSSProperty( attr,CSSPropertyBorderRightStyle, CSSValueSolid);169 addCSSProperty( attr,CSSPropertyBorderBottomStyle, CSSValueSolid);170 addCSSProperty( attr,CSSPropertyBorderLeftStyle, CSSValueSolid);145 addCSSLength(CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr))); 146 addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); 147 addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); 148 addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); 149 addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); 171 150 } 172 151 … … 175 154 ASSERT(attribute && (attribute->name() == langAttr || attribute->name().matches(XMLNames::langAttr))); 176 155 const AtomicString& value = attribute->value(); 177 if (!value.isEmpty()) { 156 if (value.isNull()) 157 removeCSSProperty(CSSPropertyWebkitLocale); 158 else if (!value.isEmpty()) { 178 159 // Have to quote so the locale id is treated as a string instead of as a CSS keyword. 179 addCSSProperty( attribute,CSSPropertyWebkitLocale, quoteCSSString(value));160 addCSSProperty(CSSPropertyWebkitLocale, quoteCSSString(value)); 180 161 } else { 181 162 // The empty string means the language is explicitly unknown. 182 addCSSProperty( attribute,CSSPropertyWebkitLocale, CSSValueAuto);163 addCSSProperty(CSSPropertyWebkitLocale, CSSValueAuto); 183 164 } 184 165 setNeedsStyleRecalc(); … … 191 172 192 173 if (attr->name() == alignAttr) { 193 if (equalIgnoringCase(attr->value(), "middle")) 194 addCSSProperty(attr, CSSPropertyTextAlign, "center"); 174 if (attr->isNull()) 175 removeCSSProperty(CSSPropertyTextAlign); 176 else if (equalIgnoringCase(attr->value(), "middle")) 177 addCSSProperty(CSSPropertyTextAlign, "center"); 195 178 else 196 addCSSProperty( attr,CSSPropertyTextAlign, attr->value());179 addCSSProperty(CSSPropertyTextAlign, attr->value()); 197 180 } else if (attr->name() == contenteditableAttr) { 198 181 setContentEditable(attr); 199 182 } else if (attr->name() == hiddenAttr) { 200 addCSSProperty(attr, CSSPropertyDisplay, CSSValueNone); 183 if (attr->isNull()) 184 removeCSSProperty(CSSPropertyDisplay); 185 else 186 addCSSProperty(CSSPropertyDisplay, CSSValueNone); 201 187 } else if (attr->name() == tabindexAttr) { 202 188 int tabindex = 0; … … 214 200 mapLanguageAttributeToLocale(attr); 215 201 } else if (attr->name() == dirAttr) { 216 bool dirIsAuto = equalIgnoringCase(attr->value(), "auto"); 217 if (!dirIsAuto) 218 addCSSProperty(attr, CSSPropertyDirection, attr->value()); 219 dirAttributeChanged(attr); 220 if (dirIsAuto) 221 addCSSProperty(attr, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); 222 else if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) 223 addCSSProperty(attr, CSSPropertyUnicodeBidi, CSSValueEmbed); 202 if (attr->isNull()) 203 removeCSSProperties(CSSPropertyDirection, CSSPropertyUnicodeBidi); 204 else { 205 bool dirIsAuto = equalIgnoringCase(attr->value(), "auto"); 206 if (!dirIsAuto) 207 addCSSProperty(CSSPropertyDirection, attr->value()); 208 else 209 removeCSSProperty(CSSPropertyDirection); 210 211 dirAttributeChanged(attr); 212 if (dirIsAuto) 213 addCSSProperty(CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); 214 else if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) 215 addCSSProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); 216 else 217 removeCSSProperty(CSSPropertyUnicodeBidi); 218 } 224 219 } else if (attr->name() == draggableAttr) { 225 220 const AtomicString& value = attr->value(); 226 221 if (equalIgnoringCase(value, "true")) { 227 addCSSProperty(attr, CSSPropertyWebkitUserDrag, CSSValueElement); 228 addCSSProperty(attr, CSSPropertyWebkitUserSelect, CSSValueNone); 229 } else if (equalIgnoringCase(value, "false")) 230 addCSSProperty(attr, CSSPropertyWebkitUserDrag, CSSValueNone); 222 addCSSProperty(CSSPropertyWebkitUserDrag, CSSValueElement); 223 addCSSProperty(CSSPropertyWebkitUserSelect, CSSValueNone); 224 } else if (equalIgnoringCase(value, "false")) { 225 addCSSProperty(CSSPropertyWebkitUserDrag, CSSValueNone); 226 removeCSSProperty(CSSPropertyWebkitUserSelect); 227 } else 228 removeCSSProperties(CSSPropertyWebkitUserDrag, CSSPropertyWebkitUserSelect); 231 229 #if ENABLE(MICRODATA) 232 230 } else if (attr->name() == itempropAttr) { … … 686 684 } 687 685 686 void HTMLElement::removeHTMLAlignment() 687 { 688 removeCSSProperties(CSSPropertyFloat, CSSPropertyVerticalAlign); 689 } 690 688 691 void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, Attribute* attr) 689 692 { … … 716 719 717 720 if (floatValue != CSSValueInvalid) 718 element->addCSSProperty(attr, CSSPropertyFloat, floatValue); 721 element->addCSSProperty(CSSPropertyFloat, floatValue); 722 else 723 element->removeCSSProperty(CSSPropertyFloat); 719 724 720 725 if (verticalAlignValue != CSSValueInvalid) 721 element->addCSSProperty(attr, CSSPropertyVerticalAlign, verticalAlignValue); 726 element->addCSSProperty(CSSPropertyVerticalAlign, verticalAlignValue); 727 else 728 element->removeCSSProperty(CSSPropertyVerticalAlign); 722 729 } 723 730 … … 746 753 { 747 754 const AtomicString& enabled = attr->value(); 748 if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) { 749 addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadWrite); 750 addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord); 751 addCSSProperty(attr, CSSPropertyWebkitNbspMode, CSSValueSpace); 752 addCSSProperty(attr, CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); 755 if (enabled.isNull()) 756 removeCSSProperties(CSSPropertyWebkitUserModify, CSSPropertyWordWrap, CSSPropertyWebkitNbspMode, CSSPropertyWebkitLineBreak); 757 else if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) { 758 addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadWrite); 759 addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); 760 addCSSProperty(CSSPropertyWebkitNbspMode, CSSValueSpace); 761 addCSSProperty(CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); 753 762 } else if (equalIgnoringCase(enabled, "false")) { 754 addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadOnly); 755 removeCSSProperty(attr, CSSPropertyWordWrap); 756 removeCSSProperty(attr, CSSPropertyWebkitNbspMode); 757 removeCSSProperty(attr, CSSPropertyWebkitLineBreak); 763 addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadOnly); 764 removeCSSProperties(CSSPropertyWordWrap, CSSPropertyWebkitNbspMode, CSSPropertyWebkitLineBreak); 758 765 } else if (equalIgnoringCase(enabled, "plaintext-only")) { 759 addCSSProperty( attr,CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly);760 addCSSProperty( attr,CSSPropertyWordWrap, CSSValueBreakWord);761 addCSSProperty( attr,CSSPropertyWebkitNbspMode, CSSValueSpace);762 addCSSProperty( attr,CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace);766 addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly); 767 addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); 768 addCSSProperty(CSSPropertyWebkitNbspMode, CSSValueSpace); 769 addCSSProperty(CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); 763 770 } 764 771 } -
trunk/Source/WebCore/html/HTMLElement.h
r104383 r106740 95 95 96 96 void addHTMLAlignment(Attribute*); 97 void removeHTMLAlignment(); 97 98 98 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;99 99 virtual void parseMappedAttribute(Attribute*); 100 100 void applyBorderAttribute(Attribute*); -
trunk/Source/WebCore/html/HTMLEmbedElement.cpp
r106515 r106740 75 75 } 76 76 77 bool HTMLEmbedElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const78 {79 if (attrName == hiddenAttr) {80 result = eUniversal;81 return false;82 }83 84 return HTMLPlugInImageElement::mapToEntry(attrName, result);85 }86 87 77 void HTMLEmbedElement::parseMappedAttribute(Attribute* attr) 88 78 { … … 109 99 // FIXME: Not dynamic, since we add this but don't remove it, but it may be OK for now 110 100 // that this rarely-used attribute won't work properly if you remove it. 111 addCSSLength(attr, CSSPropertyWidth, "0"); 112 addCSSLength(attr, CSSPropertyHeight, "0"); 113 } 101 addCSSLength(CSSPropertyWidth, "0"); 102 addCSSLength(CSSPropertyHeight, "0"); 103 } else 104 removeCSSProperties(CSSPropertyWidth, CSSPropertyHeight); 114 105 } else 115 106 HTMLPlugInImageElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLEmbedElement.h
r105030 r106740 35 35 HTMLEmbedElement(const QualifiedName&, Document*, bool createdByParser); 36 36 37 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;38 37 virtual void parseMappedAttribute(Attribute*); 39 38 -
trunk/Source/WebCore/html/HTMLFontElement.cpp
r94640 r106740 124 124 } 125 125 126 bool HTMLFontElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const127 {128 if (attrName == sizeAttr ||129 attrName == colorAttr ||130 attrName == faceAttr) {131 result = eUniversal;132 return false;133 }134 135 return HTMLElement::mapToEntry(attrName, result);136 }137 138 126 bool HTMLFontElement::cssValueFromFontSizeNumber(const String& s, int& size) 139 127 { … … 176 164 int size = 0; 177 165 if (cssValueFromFontSizeNumber(attr->value(), size)) 178 addCSSProperty(attr, CSSPropertyFontSize, size); 166 addCSSProperty(CSSPropertyFontSize, size); 167 else 168 removeCSSProperty(CSSPropertyFontSize); 179 169 } else if (attr->name() == colorAttr) { 180 addCSSColor(attr, CSSPropertyColor, attr->value()); 170 if (attr->value().isNull()) 171 removeCSSProperty(CSSPropertyColor); 172 else 173 addCSSColor(CSSPropertyColor, attr->value()); 181 174 } else if (attr->name() == faceAttr) { 182 addCSSProperty(attr, CSSPropertyFontFamily, attr->value()); 175 if (attr->value().isNull()) 176 removeCSSProperty(CSSPropertyFontFamily); 177 else 178 addCSSProperty(CSSPropertyFontFamily, attr->value()); 183 179 } else 184 180 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLFontElement.h
r66057 r106740 38 38 HTMLFontElement(const QualifiedName&, Document*); 39 39 40 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;41 40 virtual void parseMappedAttribute(Attribute*); 42 41 }; -
trunk/Source/WebCore/html/HTMLFrameSetElement.cpp
r94406 r106740 65 65 } 66 66 67 bool HTMLFrameSetElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const68 {69 if (attrName == bordercolorAttr) {70 result = eUniversal;71 return true;72 }73 74 return HTMLElement::mapToEntry(attrName, result);75 }76 77 67 void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr) 78 68 { … … 110 100 m_borderSet = false; 111 101 } else if (attr->name() == bordercolorAttr) { 112 m_borderColorSet = attr->decl();113 if ( !attr->decl() && !attr->isEmpty()) {114 addCSSColor(attr, CSSPropertyBorderColor, attr->value());115 m_borderColorSet = true;116 }102 m_borderColorSet = !attr->isEmpty(); 103 if (attr->value().isNull()) 104 removeCSSProperty(CSSPropertyBorderColor); 105 else 106 addCSSColor(CSSPropertyBorderColor, attr->value()); 117 107 } else if (attr->name() == onloadAttr) 118 108 document()->setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document()->frame(), attr)); -
trunk/Source/WebCore/html/HTMLFrameSetElement.h
r94406 r106740 68 68 HTMLFrameSetElement(const QualifiedName&, Document*); 69 69 70 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;71 70 virtual void parseMappedAttribute(Attribute*); 72 71 -
trunk/Source/WebCore/html/HTMLHRElement.cpp
r61959 r106740 49 49 } 50 50 51 bool HTMLHRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const52 {53 if (attrName == alignAttr ||54 attrName == widthAttr ||55 attrName == colorAttr ||56 attrName == sizeAttr ||57 attrName == noshadeAttr) {58 result = eHR;59 return false;60 }61 return HTMLElement::mapToEntry(attrName, result);62 }63 64 51 void HTMLHRElement::parseMappedAttribute(Attribute* attr) 65 52 { 66 53 if (attr->name() == alignAttr) { 67 if (equalIgnoringCase(attr->value(), "left")) { 68 addCSSProperty(attr, CSSPropertyMarginLeft, "0"); 69 addCSSProperty(attr, CSSPropertyMarginRight, CSSValueAuto); 54 if (attr->value().isNull()) { 55 removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); 56 } else if (equalIgnoringCase(attr->value(), "left")) { 57 addCSSProperty(CSSPropertyMarginLeft, "0"); 58 addCSSProperty(CSSPropertyMarginRight, CSSValueAuto); 70 59 } else if (equalIgnoringCase(attr->value(), "right")) { 71 addCSSProperty( attr,CSSPropertyMarginLeft, CSSValueAuto);72 addCSSProperty( attr,CSSPropertyMarginRight, "0");60 addCSSProperty(CSSPropertyMarginLeft, CSSValueAuto); 61 addCSSProperty(CSSPropertyMarginRight, "0"); 73 62 } else { 74 addCSSProperty( attr,CSSPropertyMarginLeft, CSSValueAuto);75 addCSSProperty( attr,CSSPropertyMarginRight, CSSValueAuto);63 addCSSProperty(CSSPropertyMarginLeft, CSSValueAuto); 64 addCSSProperty(CSSPropertyMarginRight, CSSValueAuto); 76 65 } 77 66 } else if (attr->name() == widthAttr) { 78 bool ok; 79 int v = attr->value().toInt(&ok); 80 if (ok && !v) 81 addCSSLength(attr, CSSPropertyWidth, "1"); 82 else 83 addCSSLength(attr, CSSPropertyWidth, attr->value()); 67 if (attr->value().isNull()) 68 removeCSSProperty(CSSPropertyWidth); 69 else { 70 bool ok; 71 int v = attr->value().toInt(&ok); 72 if (ok && !v) 73 addCSSLength(CSSPropertyWidth, "1"); 74 else 75 addCSSLength(CSSPropertyWidth, attr->value()); 76 } 84 77 } else if (attr->name() == colorAttr) { 85 addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); 86 addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); 87 addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); 88 addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); 89 addCSSColor(attr, CSSPropertyBorderColor, attr->value()); 90 addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); 78 if (attr->value().isNull()) 79 removeCSSProperties(CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderColor, CSSPropertyBackgroundColor); 80 else { 81 addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); 82 addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); 83 addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); 84 addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); 85 addCSSColor(CSSPropertyBorderColor, attr->value()); 86 addCSSColor(CSSPropertyBackgroundColor, attr->value()); 87 } 91 88 } else if (attr->name() == noshadeAttr) { 92 addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); 93 addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); 94 addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); 95 addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); 96 addCSSColor(attr, CSSPropertyBorderColor, String("grey")); 97 addCSSColor(attr, CSSPropertyBackgroundColor, String("grey")); 89 if (attr->value().isNull()) 90 removeCSSProperties(CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderColor, CSSPropertyBackgroundColor); 91 else { 92 addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); 93 addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); 94 addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); 95 addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); 96 addCSSColor(CSSPropertyBorderColor, String("grey")); 97 addCSSColor(CSSPropertyBackgroundColor, String("grey")); 98 } 98 99 } else if (attr->name() == sizeAttr) { 99 StringImpl* si = attr->value().impl(); 100 int size = si->toInt(); 101 if (size <= 1) 102 addCSSProperty(attr, CSSPropertyBorderBottomWidth, String("0")); 103 else 104 addCSSLength(attr, CSSPropertyHeight, String::number(size-2)); 100 if (attr->value().isNull()) 101 removeCSSProperties(CSSPropertyBorderBottomWidth, CSSPropertyHeight); 102 else { 103 StringImpl* si = attr->value().impl(); 104 int size = si->toInt(); 105 if (size <= 1) { 106 addCSSProperty(CSSPropertyBorderBottomWidth, String("0")); 107 removeCSSProperty(CSSPropertyHeight); 108 } else { 109 addCSSLength(CSSPropertyHeight, String::number(size-2)); 110 removeCSSProperty(CSSPropertyBorderBottomWidth); 111 } 112 } 105 113 } else 106 114 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLHRElement.h
r86491 r106740 37 37 private: 38 38 HTMLHRElement(const QualifiedName&, Document*); 39 40 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; 39 41 40 virtual void parseMappedAttribute(Attribute*); 42 41 }; -
trunk/Source/WebCore/html/HTMLIFrameElement.cpp
r105668 r106740 49 49 } 50 50 51 bool HTMLIFrameElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const52 {53 if (attrName == widthAttr || attrName == heightAttr) {54 result = eUniversal;55 return false;56 }57 58 if (attrName == alignAttr) {59 result = eReplaced; // Share with <img> since the alignment behavior is the same.60 return false;61 }62 63 if (attrName == frameborderAttr) {64 result = eReplaced;65 return false;66 }67 68 return HTMLFrameElementBase::mapToEntry(attrName, result);69 }70 71 51 void HTMLIFrameElement::parseMappedAttribute(Attribute* attr) 72 52 { 73 53 if (attr->name() == widthAttr) 74 addCSSLength( attr,CSSPropertyWidth, attr->value());54 addCSSLength(CSSPropertyWidth, attr->value()); 75 55 else if (attr->name() == heightAttr) 76 addCSSLength( attr,CSSPropertyHeight, attr->value());56 addCSSLength(CSSPropertyHeight, attr->value()); 77 57 else if (attr->name() == alignAttr) 78 58 addHTMLAlignment(attr); … … 88 68 // Frame border doesn't really match the HTML4 spec definition for iframes. It simply adds 89 69 // a presentational hint that the border should be off if set to zero. 90 if (!attr->isNull() && !attr->value().toInt()) 70 if (!attr->isNull() && !attr->value().toInt()) { 91 71 // Add a rule that nulls out our border width. 92 addCSSLength(attr, CSSPropertyBorderWidth, "0"); 72 addCSSLength(CSSPropertyBorderWidth, "0"); 73 } else 74 removeCSSProperty(CSSPropertyBorderWidth); 93 75 } else if (attr->name() == sandboxAttr) 94 76 setSandboxFlags(attr->isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(attr->value())); -
trunk/Source/WebCore/html/HTMLIFrameElement.h
r99742 r106740 36 36 HTMLIFrameElement(const QualifiedName&, Document*); 37 37 38 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;39 38 virtual void parseMappedAttribute(Attribute*); 40 39 -
trunk/Source/WebCore/html/HTMLImageElement.cpp
r105668 r106740 79 79 } 80 80 81 bool HTMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const82 {83 if (attrName == widthAttr ||84 attrName == heightAttr ||85 attrName == vspaceAttr ||86 attrName == hspaceAttr ||87 attrName == valignAttr) {88 result = eUniversal;89 return false;90 }91 92 if (attrName == borderAttr || attrName == alignAttr) {93 result = eReplaced; // Shared with embed and iframe elements.94 return false;95 }96 97 return HTMLElement::mapToEntry(attrName, result);98 }99 100 81 void HTMLImageElement::parseMappedAttribute(Attribute* attr) 101 82 { … … 107 88 m_imageLoader.updateFromElementIgnoringPreviousError(); 108 89 else if (attrName == widthAttr) 109 addCSSLength(attr, CSSPropertyWidth, attr->value()); 90 if (attr->value().isNull()) 91 removeCSSProperty(CSSPropertyWidth); 92 else 93 addCSSLength(CSSPropertyWidth, attr->value()); 110 94 else if (attrName == heightAttr) 111 addCSSLength(attr, CSSPropertyHeight, attr->value()); 95 if (attr->value().isNull()) 96 removeCSSProperty(CSSPropertyHeight); 97 else 98 addCSSLength(CSSPropertyHeight, attr->value()); 112 99 else if (attrName == borderAttr) { 113 100 // border="noborder" -> border="0" 114 101 applyBorderAttribute(attr); 115 102 } else if (attrName == vspaceAttr) { 116 addCSSLength(attr, CSSPropertyMarginTop, attr->value()); 117 addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); 103 if (attr->value().isNull()) 104 removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); 105 else { 106 addCSSLength(CSSPropertyMarginTop, attr->value()); 107 addCSSLength(CSSPropertyMarginBottom, attr->value()); 108 } 118 109 } else if (attrName == hspaceAttr) { 119 addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); 120 addCSSLength(attr, CSSPropertyMarginRight, attr->value()); 110 if (attr->value().isNull()) 111 removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); 112 else { 113 addCSSLength(CSSPropertyMarginLeft, attr->value()); 114 addCSSLength(CSSPropertyMarginRight, attr->value()); 115 } 121 116 } else if (attrName == alignAttr) 122 117 addHTMLAlignment(attr); 123 118 else if (attrName == valignAttr) 124 addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); 119 if (attr->value().isNull()) 120 removeCSSProperty(CSSPropertyVerticalAlign); 121 else 122 addCSSProperty(CSSPropertyVerticalAlign, attr->value()); 125 123 else if (attrName == usemapAttr) 126 124 setIsLink(!attr->isNull()); -
trunk/Source/WebCore/html/HTMLImageElement.h
r103679 r106740 84 84 85 85 private: 86 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;87 86 virtual void parseMappedAttribute(Attribute*); 88 87 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r105980 r106740 658 658 { 659 659 m_inputType->accessKeyAction(sendMouseEvents); 660 }661 662 bool HTMLInputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const663 {664 if (((attrName == heightAttr || attrName == widthAttr) && m_inputType->shouldRespectHeightAndWidthAttributes())665 || attrName == vspaceAttr666 || attrName == hspaceAttr) {667 result = eUniversal;668 return false;669 }670 671 if (attrName == alignAttr && m_inputType->shouldRespectAlignAttribute()) {672 // Share with <img> since the alignment behavior is the same.673 result = eReplaced;674 return false;675 }676 677 return HTMLElement::mapToEntry(attrName, result);678 660 } 679 661 … … 734 716 // FIXME: ignore for the moment 735 717 } else if (attr->name() == vspaceAttr) { 736 addCSSLength( attr,CSSPropertyMarginTop, attr->value());737 addCSSLength( attr,CSSPropertyMarginBottom, attr->value());718 addCSSLength(CSSPropertyMarginTop, attr->value()); 719 addCSSLength(CSSPropertyMarginBottom, attr->value()); 738 720 } else if (attr->name() == hspaceAttr) { 739 addCSSLength( attr,CSSPropertyMarginLeft, attr->value());740 addCSSLength( attr,CSSPropertyMarginRight, attr->value());721 addCSSLength(CSSPropertyMarginLeft, attr->value()); 722 addCSSLength(CSSPropertyMarginRight, attr->value()); 741 723 } else if (attr->name() == alignAttr) { 742 724 if (m_inputType->shouldRespectAlignAttribute()) 743 725 addHTMLAlignment(attr); 726 else 727 removeHTMLAlignment(); 744 728 } else if (attr->name() == widthAttr) { 745 729 if (m_inputType->shouldRespectHeightAndWidthAttributes()) 746 addCSSLength(attr, CSSPropertyWidth, attr->value()); 730 addCSSLength(CSSPropertyWidth, attr->value()); 731 else 732 removeCSSProperty(CSSPropertyWidth); 747 733 } else if (attr->name() == heightAttr) { 748 734 if (m_inputType->shouldRespectHeightAndWidthAttributes()) 749 addCSSLength(attr, CSSPropertyHeight, attr->value()); 735 addCSSLength(CSSPropertyHeight, attr->value()); 736 else 737 removeCSSProperty(CSSPropertyHeight); 750 738 } else if (attr->name() == borderAttr && isImageButton()) { 751 739 applyBorderAttribute(attr); -
trunk/Source/WebCore/html/HTMLInputElement.h
r105710 r106740 277 277 virtual void accessKeyAction(bool sendMouseEvents); 278 278 279 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;280 279 virtual void parseMappedAttribute(Attribute*); 281 280 virtual void finishParsingChildren(); -
trunk/Source/WebCore/html/HTMLLIElement.cpp
r102290 r106740 50 50 } 51 51 52 bool HTMLLIElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const53 {54 if (attrName == typeAttr) {55 result = eListItem; // Share with <ol> since all the values are the same56 return false;57 }58 59 return HTMLElement::mapToEntry(attrName, result);60 }61 62 52 void HTMLLIElement::parseMappedAttribute(Attribute* attr) 63 53 { … … 66 56 parseValue(attr->value()); 67 57 } else if (attr->name() == typeAttr) { 68 if (attr->value() == "a") 69 addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerAlpha); 58 if (attr->value().isNull()) 59 removeCSSProperty(CSSPropertyListStyleType); 60 else if (attr->value() == "a") 61 addCSSProperty(CSSPropertyListStyleType, CSSValueLowerAlpha); 70 62 else if (attr->value() == "A") 71 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueUpperAlpha);63 addCSSProperty(CSSPropertyListStyleType, CSSValueUpperAlpha); 72 64 else if (attr->value() == "i") 73 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueLowerRoman);65 addCSSProperty(CSSPropertyListStyleType, CSSValueLowerRoman); 74 66 else if (attr->value() == "I") 75 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueUpperRoman);67 addCSSProperty(CSSPropertyListStyleType, CSSValueUpperRoman); 76 68 else if (attr->value() == "1") 77 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueDecimal);69 addCSSProperty(CSSPropertyListStyleType, CSSValueDecimal); 78 70 else 79 addCSSProperty( attr,CSSPropertyListStyleType, attr->value());71 addCSSProperty(CSSPropertyListStyleType, attr->value()); 80 72 } else 81 73 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLLIElement.h
r102290 r106740 36 36 HTMLLIElement(const QualifiedName&, Document*); 37 37 38 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;39 38 virtual void parseMappedAttribute(Attribute*); 40 39 -
trunk/Source/WebCore/html/HTMLMarqueeElement.cpp
r106667 r106740 52 52 } 53 53 54 bool HTMLMarqueeElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const55 {56 if (attrName == widthAttr ||57 attrName == heightAttr ||58 attrName == bgcolorAttr ||59 attrName == vspaceAttr ||60 attrName == hspaceAttr ||61 attrName == scrollamountAttr ||62 attrName == scrolldelayAttr ||63 attrName == loopAttr ||64 attrName == behaviorAttr ||65 attrName == directionAttr) {66 result = eUniversal;67 return false;68 }69 70 return HTMLElement::mapToEntry(attrName, result);71 }72 73 54 void HTMLMarqueeElement::parseMappedAttribute(Attribute* attr) 74 55 { 75 56 if (attr->name() == widthAttr) { 76 57 if (!attr->value().isEmpty()) 77 addCSSLength(attr, CSSPropertyWidth, attr->value()); 58 addCSSLength(CSSPropertyWidth, attr->value()); 59 else 60 removeCSSProperty(CSSPropertyWidth); 78 61 } else if (attr->name() == heightAttr) { 79 62 if (!attr->value().isEmpty()) 80 addCSSLength(attr, CSSPropertyHeight, attr->value()); 63 addCSSLength(CSSPropertyHeight, attr->value()); 64 else 65 removeCSSProperty(CSSPropertyHeight); 81 66 } else if (attr->name() == bgcolorAttr) { 82 67 if (!attr->value().isEmpty()) 83 addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); 68 addCSSColor(CSSPropertyBackgroundColor, attr->value()); 69 else 70 removeCSSProperty(CSSPropertyBackgroundColor); 84 71 } else if (attr->name() == vspaceAttr) { 85 72 if (!attr->value().isEmpty()) { 86 addCSSLength(attr, CSSPropertyMarginTop, attr->value()); 87 addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); 88 } 73 addCSSLength(CSSPropertyMarginTop, attr->value()); 74 addCSSLength(CSSPropertyMarginBottom, attr->value()); 75 } else 76 removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); 89 77 } else if (attr->name() == hspaceAttr) { 90 78 if (!attr->value().isEmpty()) { 91 addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); 92 addCSSLength(attr, CSSPropertyMarginRight, attr->value()); 93 } 79 addCSSLength(CSSPropertyMarginLeft, attr->value()); 80 addCSSLength(CSSPropertyMarginRight, attr->value()); 81 } else 82 removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); 94 83 } else if (attr->name() == scrollamountAttr) { 95 84 if (!attr->value().isEmpty()) 96 addCSSLength(attr, CSSPropertyWebkitMarqueeIncrement, attr->value()); 85 addCSSLength(CSSPropertyWebkitMarqueeIncrement, attr->value()); 86 else 87 removeCSSProperty(CSSPropertyWebkitMarqueeIncrement); 97 88 } else if (attr->name() == scrolldelayAttr) { 98 89 if (!attr->value().isEmpty()) 99 addCSSLength(attr, CSSPropertyWebkitMarqueeSpeed, attr->value()); 90 addCSSLength(CSSPropertyWebkitMarqueeSpeed, attr->value()); 91 else 92 removeCSSProperty(CSSPropertyWebkitMarqueeSpeed); 100 93 } else if (attr->name() == loopAttr) { 101 94 if (!attr->value().isEmpty()) { 102 95 if (attr->value() == "-1" || equalIgnoringCase(attr->value(), "infinite")) 103 addCSSProperty( attr,CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite);96 addCSSProperty(CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite); 104 97 else 105 addCSSLength(attr, CSSPropertyWebkitMarqueeRepetition, attr->value()); 106 } 98 addCSSLength(CSSPropertyWebkitMarqueeRepetition, attr->value()); 99 } else 100 removeCSSProperty(CSSPropertyWebkitMarqueeRepetition); 107 101 } else if (attr->name() == behaviorAttr) { 108 102 if (!attr->value().isEmpty()) 109 addCSSProperty(attr, CSSPropertyWebkitMarqueeStyle, attr->value()); 103 addCSSProperty(CSSPropertyWebkitMarqueeStyle, attr->value()); 104 else 105 removeCSSProperty(CSSPropertyWebkitMarqueeStyle); 110 106 } else if (attr->name() == directionAttr) { 111 107 if (!attr->value().isEmpty()) 112 addCSSProperty(attr, CSSPropertyWebkitMarqueeDirection, attr->value()); 108 addCSSProperty(CSSPropertyWebkitMarqueeDirection, attr->value()); 109 else 110 removeCSSProperty(CSSPropertyWebkitMarqueeDirection); 113 111 } else if (attr->name() == truespeedAttr) 114 112 m_minimumDelay = !attr->isEmpty() ? 0 : defaultMinimumDelay; -
trunk/Source/WebCore/html/HTMLMarqueeElement.h
r73189 r106740 54 54 HTMLMarqueeElement(const QualifiedName&, Document*); 55 55 56 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;57 56 virtual void parseMappedAttribute(Attribute*); 58 57 -
trunk/Source/WebCore/html/HTMLOListElement.cpp
r103074 r106740 55 55 } 56 56 57 bool HTMLOListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const58 {59 if (attrName == typeAttr) {60 result = eListItem; // Share with <li>61 return false;62 }63 64 return HTMLElement::mapToEntry(attrName, result);65 }66 67 57 void HTMLOListElement::parseMappedAttribute(Attribute* attr) 68 58 { 69 59 if (attr->name() == typeAttr) { 70 60 if (attr->value() == "a") 71 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueLowerAlpha);61 addCSSProperty(CSSPropertyListStyleType, CSSValueLowerAlpha); 72 62 else if (attr->value() == "A") 73 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueUpperAlpha);63 addCSSProperty(CSSPropertyListStyleType, CSSValueUpperAlpha); 74 64 else if (attr->value() == "i") 75 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueLowerRoman);65 addCSSProperty(CSSPropertyListStyleType, CSSValueLowerRoman); 76 66 else if (attr->value() == "I") 77 addCSSProperty( attr,CSSPropertyListStyleType, CSSValueUpperRoman);67 addCSSProperty(CSSPropertyListStyleType, CSSValueUpperRoman); 78 68 else if (attr->value() == "1") 79 addCSSProperty(attr, CSSPropertyListStyleType, CSSValueDecimal); 69 addCSSProperty(CSSPropertyListStyleType, CSSValueDecimal); 70 else 71 removeCSSProperty(CSSPropertyListStyleType); 80 72 } else if (attr->name() == startAttr) { 81 73 int oldStart = start(); -
trunk/Source/WebCore/html/HTMLOListElement.h
r103074 r106740 54 54 void recalculateItemCount(); 55 55 56 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;57 56 virtual void parseMappedAttribute(Attribute*); 58 57 -
trunk/Source/WebCore/html/HTMLOutputElement.cpp
r101268 r106740 60 60 { 61 61 return Node::supportsFocus() && !disabled(); 62 }63 64 bool HTMLOutputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const65 {66 if (attrName == HTMLNames::dirAttr) {67 result = eBDI;68 return true;69 }70 71 return HTMLElement::mapToEntry(attrName, result);72 62 } 73 63 -
trunk/Source/WebCore/html/HTMLOutputElement.h
r101268 r106740 56 56 HTMLOutputElement(const QualifiedName&, Document*, HTMLFormElement*); 57 57 58 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const OVERRIDE;59 58 virtual void parseMappedAttribute(Attribute*); 60 59 virtual const AtomicString& formControlType() const; -
trunk/Source/WebCore/html/HTMLParagraphElement.cpp
r103827 r106740 45 45 } 46 46 47 bool HTMLParagraphElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const48 {49 if (attrName == alignAttr) {50 result = eBlock; // We can share with DIV here.51 return false;52 }53 return HTMLElement::mapToEntry(attrName, result);54 }55 56 47 void HTMLParagraphElement::parseMappedAttribute(Attribute* attr) 57 48 { 58 49 if (attr->name() == alignAttr) { 59 if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) 60 addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); 50 if (attr->value().isNull()) 51 removeCSSProperty(CSSPropertyTextAlign); 52 else if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) 53 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); 61 54 else if (equalIgnoringCase(attr->value(), "left")) 62 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueWebkitLeft);55 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); 63 56 else if (equalIgnoringCase(attr->value(), "right")) 64 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueWebkitRight);57 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); 65 58 else 66 addCSSProperty( attr,CSSPropertyTextAlign, attr->value());59 addCSSProperty(CSSPropertyTextAlign, attr->value()); 67 60 } else 68 61 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLParagraphElement.h
r66057 r106740 35 35 HTMLParagraphElement(const QualifiedName&, Document*); 36 36 37 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;38 37 virtual void parseMappedAttribute(Attribute*); 39 38 }; -
trunk/Source/WebCore/html/HTMLPlugInElement.cpp
r105932 r106740 137 137 } 138 138 139 bool HTMLPlugInElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const140 {141 if (attrName == widthAttr ||142 attrName == heightAttr ||143 attrName == vspaceAttr ||144 attrName == hspaceAttr) {145 result = eUniversal;146 return false;147 }148 149 if (attrName == alignAttr) {150 result = eReplaced; // Share with <img> since the alignment behavior is the same.151 return false;152 }153 154 return HTMLFrameOwnerElement::mapToEntry(attrName, result);155 }156 157 139 void HTMLPlugInElement::parseMappedAttribute(Attribute* attr) 158 140 { 159 141 if (attr->name() == widthAttr) 160 addCSSLength(attr, CSSPropertyWidth, attr->value()); 142 if (attr->isNull()) 143 removeCSSProperty(CSSPropertyWidth); 144 else 145 addCSSLength(CSSPropertyWidth, attr->value()); 161 146 else if (attr->name() == heightAttr) 162 addCSSLength(attr, CSSPropertyHeight, attr->value()); 147 if (attr->isNull()) 148 removeCSSProperty(CSSPropertyHeight); 149 else 150 addCSSLength(CSSPropertyHeight, attr->value()); 163 151 else if (attr->name() == vspaceAttr) { 164 addCSSLength(attr, CSSPropertyMarginTop, attr->value()); 165 addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); 152 if (attr->isNull()) 153 removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); 154 else { 155 addCSSLength(CSSPropertyMarginTop, attr->value()); 156 addCSSLength(CSSPropertyMarginBottom, attr->value()); 157 } 166 158 } else if (attr->name() == hspaceAttr) { 167 addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); 168 addCSSLength(attr, CSSPropertyMarginRight, attr->value()); 159 if (attr->isNull()) 160 removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); 161 else { 162 addCSSLength(CSSPropertyMarginLeft, attr->value()); 163 addCSSLength(CSSPropertyMarginRight, attr->value()); 164 } 169 165 } else if (attr->name() == alignAttr) 170 166 addHTMLAlignment(attr); -
trunk/Source/WebCore/html/HTMLPlugInElement.h
r105932 r106740 59 59 virtual void detach(); 60 60 virtual void removedFromDocument(); 61 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;62 61 virtual void parseMappedAttribute(Attribute*); 63 62 -
trunk/Source/WebCore/html/HTMLPreElement.cpp
r61959 r106740 43 43 } 44 44 45 bool HTMLPreElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const46 {47 if (attrName == widthAttr || attrName == wrapAttr) {48 result = ePre;49 return false;50 }51 return HTMLElement::mapToEntry(attrName, result);52 }53 54 45 void HTMLPreElement::parseMappedAttribute(Attribute* attr) 55 46 { … … 60 51 // property. 61 52 } else if (attr->name() == wrapAttr) { 62 if (!attr->value().isNull()) 63 addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePreWrap); 53 if (attr->value().isNull()) 54 removeCSSProperty(CSSPropertyWhiteSpace); 55 else 56 addCSSProperty(CSSPropertyWhiteSpace, CSSValuePreWrap); 64 57 } else 65 58 return HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLPreElement.h
r66057 r106740 35 35 HTMLPreElement(const QualifiedName&, Document*); 36 36 37 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;38 37 virtual void parseMappedAttribute(Attribute*); 39 38 }; -
trunk/Source/WebCore/html/HTMLTableCaptionElement.cpp
r61959 r106740 45 45 } 46 46 47 bool HTMLTableCaptionElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const48 {49 if (attrName == alignAttr) {50 result = eCaption;51 return false;52 }53 54 return HTMLElement::mapToEntry(attrName, result);55 }56 57 47 void HTMLTableCaptionElement::parseMappedAttribute(Attribute* attr) 58 48 { 59 49 if (attr->name() == alignAttr) { 60 50 if (!attr->value().isEmpty()) 61 addCSSProperty(attr, CSSPropertyCaptionSide, attr->value()); 51 addCSSProperty(CSSPropertyCaptionSide, attr->value()); 52 else 53 removeCSSProperty(CSSPropertyCaptionSide); 62 54 } else 63 55 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLTableCaptionElement.h
r66057 r106740 37 37 private: 38 38 HTMLTableCaptionElement(const QualifiedName&, Document*); 39 40 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; 39 41 40 virtual void parseMappedAttribute(Attribute*); 42 41 }; -
trunk/Source/WebCore/html/HTMLTableCellElement.cpp
r106681 r106740 76 76 } 77 77 78 bool HTMLTableCellElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const79 {80 if (attrName == nowrapAttr) {81 result = eUniversal;82 return false;83 }84 85 if (attrName == widthAttr ||86 attrName == heightAttr) {87 result = eCell; // Because of the quirky behavior of ignoring 0 values, cells are special.88 return false;89 }90 91 return HTMLTablePartElement::mapToEntry(attrName, result);92 }93 94 78 void HTMLTableCellElement::parseMappedAttribute(Attribute* attr) 95 79 { … … 101 85 toRenderTableCell(renderer())->colSpanOrRowSpanChanged(); 102 86 } else if (attr->name() == nowrapAttr) { 103 if (!attr->isNull()) 104 addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueWebkitNowrap); 87 if (attr->isNull()) 88 removeCSSProperty(CSSPropertyWhiteSpace); 89 else 90 addCSSProperty(CSSPropertyWhiteSpace, CSSValueWebkitNowrap); 91 105 92 } else if (attr->name() == widthAttr) { 106 93 if (!attr->value().isEmpty()) { 107 94 int widthInt = attr->value().toInt(); 108 95 if (widthInt > 0) // width="0" is ignored for compatibility with WinIE. 109 addCSSLength(attr, CSSPropertyWidth, attr->value()); 110 } 96 addCSSLength(CSSPropertyWidth, attr->value()); 97 } else 98 removeCSSProperty(CSSPropertyWidth); 111 99 } else if (attr->name() == heightAttr) { 112 100 if (!attr->value().isEmpty()) { 113 101 int heightInt = attr->value().toInt(); 114 102 if (heightInt > 0) // height="0" is ignored for compatibility with WinIE. 115 addCSSLength(attr, CSSPropertyHeight, attr->value()); 116 } 103 addCSSLength(CSSPropertyHeight, attr->value()); 104 } else 105 removeCSSProperty(CSSPropertyHeight); 117 106 } else 118 107 HTMLTablePartElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLTableCellElement.h
r106681 r106740 54 54 HTMLTableCellElement(const QualifiedName&, Document*); 55 55 56 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;57 56 virtual void parseMappedAttribute(Attribute*); 58 57 -
trunk/Source/WebCore/html/HTMLTableColElement.cpp
r106681 r106740 48 48 } 49 49 50 bool HTMLTableColElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const51 {52 if (attrName == widthAttr) {53 result = eUniversal;54 return false;55 }56 57 return HTMLTablePartElement::mapToEntry(attrName, result);58 }59 60 50 void HTMLTableColElement::parseMappedAttribute(Attribute* attr) 61 51 { … … 66 56 } else if (attr->name() == widthAttr) { 67 57 if (!attr->value().isEmpty()) { 68 addCSSLength( attr,CSSPropertyWidth, attr->value());58 addCSSLength(CSSPropertyWidth, attr->value()); 69 59 if (renderer() && renderer()->isTableCol()) { 70 60 RenderTableCol* col = toRenderTableCol(renderer()); … … 73 63 col->setNeedsLayoutAndPrefWidthsRecalc(); 74 64 } 75 } 65 } else 66 removeCSSProperty(CSSPropertyWidth); 76 67 } else 77 68 HTMLTablePartElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLTableColElement.h
r106681 r106740 43 43 HTMLTableColElement(const QualifiedName& tagName, Document*); 44 44 45 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;46 45 virtual void parseMappedAttribute(Attribute*); 47 46 virtual PassRefPtr<StylePropertySet> additionalAttributeStyle() OVERRIDE; -
trunk/Source/WebCore/html/HTMLTableElement.cpp
r106681 r106740 242 242 } 243 243 244 bool HTMLTableElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const245 {246 if (attrName == backgroundAttr) {247 result = (MappedAttributeEntry)(eLastEntry + document()->docID());248 return false;249 }250 251 if (attrName == widthAttr ||252 attrName == heightAttr ||253 attrName == bgcolorAttr ||254 attrName == cellspacingAttr ||255 attrName == vspaceAttr ||256 attrName == hspaceAttr ||257 attrName == valignAttr) {258 result = eUniversal;259 return false;260 }261 262 if (attrName == bordercolorAttr || attrName == frameAttr || attrName == rulesAttr) {263 result = eUniversal;264 return true;265 }266 267 if (attrName == borderAttr) {268 result = eTable;269 return true;270 }271 272 if (attrName == alignAttr) {273 result = eTable;274 return false;275 }276 277 return HTMLElement::mapToEntry(attrName, result);278 }279 280 244 static inline bool isTableCellAncestor(Node* n) 281 245 { … … 309 273 310 274 if (attr->name() == widthAttr) 311 addCSSLength(attr, CSSPropertyWidth, attr->value()); 275 if (attr->isNull()) 276 removeCSSProperty(CSSPropertyWidth); 277 else 278 addCSSLength(CSSPropertyWidth, attr->value()); 312 279 else if (attr->name() == heightAttr) 313 addCSSLength(attr, CSSPropertyHeight, attr->value()); 280 if (attr->isNull()) 281 removeCSSProperty(CSSPropertyHeight); 282 else 283 addCSSLength(CSSPropertyHeight, attr->value()); 314 284 else if (attr->name() == borderAttr) { 315 285 m_borderAttr = true; 316 if (attr->decl()) { 317 RefPtr<CSSValue> val = attr->decl()->getPropertyCSSValue(CSSPropertyBorderLeftWidth); 318 if (val && val->isPrimitiveValue()) { 319 CSSPrimitiveValue* primVal = static_cast<CSSPrimitiveValue*>(val.get()); 320 m_borderAttr = primVal->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER); 321 } 322 } else if (!attr->isNull()) { 286 287 if (attr->isNull()) 288 removeCSSProperty(CSSPropertyBorderWidth); 289 else { 323 290 int border = 0; 324 291 if (attr->isEmpty()) … … 327 294 border = attr->value().toInt(); 328 295 m_borderAttr = border; 329 addCSSLength( attr,CSSPropertyBorderWidth, String::number(border));296 addCSSLength(CSSPropertyBorderWidth, String::number(border)); 330 297 } 331 298 } else if (attr->name() == bgcolorAttr) 332 addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); 299 if (attr->isNull()) 300 removeCSSProperty(CSSPropertyBackgroundColor); 301 else 302 addCSSColor(CSSPropertyBackgroundColor, attr->value()); 333 303 else if (attr->name() == bordercolorAttr) { 334 m_borderColorAttr = attr->decl();335 if (!attr-> decl() && !attr->isEmpty()) {336 addCSSColor( attr,CSSPropertyBorderColor, attr->value());337 m_borderColorAttr = true;338 }304 m_borderColorAttr = !attr->isEmpty(); 305 if (!attr->isEmpty()) 306 addCSSColor(CSSPropertyBorderColor, attr->value()); 307 else 308 removeCSSProperty(CSSPropertyBorderColor); 339 309 } else if (attr->name() == backgroundAttr) { 340 310 String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); 341 311 if (!url.isEmpty()) 342 addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); 312 addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); 313 else 314 removeCSSProperty(CSSPropertyBackgroundImage); 343 315 } else if (attr->name() == frameAttr) { 344 316 // Cache the value of "frame" so that the table can examine it later. … … 381 353 // Now map in the border styles of solid and hidden respectively. 382 354 if (m_frameAttr) { 383 addCSSProperty(attr, CSSPropertyBorderTopWidth, CSSValueThin); 384 addCSSProperty(attr, CSSPropertyBorderBottomWidth, CSSValueThin); 385 addCSSProperty(attr, CSSPropertyBorderLeftWidth, CSSValueThin); 386 addCSSProperty(attr, CSSPropertyBorderRightWidth, CSSValueThin); 387 addCSSProperty(attr, CSSPropertyBorderTopStyle, borders[cTop] ? CSSValueSolid : CSSValueHidden); 388 addCSSProperty(attr, CSSPropertyBorderBottomStyle, borders[cBottom] ? CSSValueSolid : CSSValueHidden); 389 addCSSProperty(attr, CSSPropertyBorderLeftStyle, borders[cLeft] ? CSSValueSolid : CSSValueHidden); 390 addCSSProperty(attr, CSSPropertyBorderRightStyle, borders[cRight] ? CSSValueSolid : CSSValueHidden); 391 } 355 addCSSProperty(CSSPropertyBorderTopWidth, CSSValueThin); 356 addCSSProperty(CSSPropertyBorderBottomWidth, CSSValueThin); 357 addCSSProperty(CSSPropertyBorderLeftWidth, CSSValueThin); 358 addCSSProperty(CSSPropertyBorderRightWidth, CSSValueThin); 359 addCSSProperty(CSSPropertyBorderTopStyle, borders[cTop] ? CSSValueSolid : CSSValueHidden); 360 addCSSProperty(CSSPropertyBorderBottomStyle, borders[cBottom] ? CSSValueSolid : CSSValueHidden); 361 addCSSProperty(CSSPropertyBorderLeftStyle, borders[cLeft] ? CSSValueSolid : CSSValueHidden); 362 addCSSProperty(CSSPropertyBorderRightStyle, borders[cRight] ? CSSValueSolid : CSSValueHidden); 363 } else 364 removeCSSProperties(CSSPropertyBorderTopWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderTopStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderRightStyle); 392 365 } else if (attr->name() == rulesAttr) { 393 366 m_rulesAttr = UnsetRules; … … 405 378 // The presence of a valid rules attribute causes border collapsing to be enabled. 406 379 if (m_rulesAttr != UnsetRules) 407 addCSSProperty(attr, CSSPropertyBorderCollapse, CSSValueCollapse); 380 addCSSProperty(CSSPropertyBorderCollapse, CSSValueCollapse); 381 else 382 removeCSSProperty(CSSPropertyBorderCollapse); 408 383 } else if (attr->name() == cellspacingAttr) { 409 384 if (!attr->value().isEmpty()) 410 addCSSLength(attr, CSSPropertyBorderSpacing, attr->value()); 385 addCSSLength(CSSPropertyBorderSpacing, attr->value()); 386 else 387 removeCSSProperty(CSSPropertyBorderSpacing); 411 388 } else if (attr->name() == cellpaddingAttr) { 412 389 if (!attr->value().isEmpty()) … … 417 394 // ### 418 395 } else if (attr->name() == vspaceAttr) { 419 addCSSLength(attr, CSSPropertyMarginTop, attr->value()); 420 addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); 396 if (attr->isNull()) 397 removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); 398 else { 399 addCSSLength(CSSPropertyMarginTop, attr->value()); 400 addCSSLength(CSSPropertyMarginBottom, attr->value()); 401 } 421 402 } else if (attr->name() == hspaceAttr) { 422 addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); 423 addCSSLength(attr, CSSPropertyMarginRight, attr->value()); 403 if (attr->isNull()) 404 removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); 405 else { 406 addCSSLength(CSSPropertyMarginLeft, attr->value()); 407 addCSSLength(CSSPropertyMarginRight, attr->value()); 408 } 424 409 } else if (attr->name() == alignAttr) { 425 410 if (!attr->value().isEmpty()) { 426 411 if (equalIgnoringCase(attr->value(), "center")) { 427 addCSSProperty( attr,CSSPropertyWebkitMarginStart, CSSValueAuto);428 addCSSProperty( attr,CSSPropertyWebkitMarginEnd, CSSValueAuto);412 addCSSProperty(CSSPropertyWebkitMarginStart, CSSValueAuto); 413 addCSSProperty(CSSPropertyWebkitMarginEnd, CSSValueAuto); 429 414 } else 430 addCSSProperty(attr, CSSPropertyFloat, attr->value()); 431 } 415 addCSSProperty(CSSPropertyFloat, attr->value()); 416 } else 417 removeCSSProperties(CSSPropertyWebkitMarginStart, CSSPropertyWebkitMarginEnd, CSSPropertyFloat); 432 418 } else if (attr->name() == valignAttr) { 433 419 if (!attr->value().isEmpty()) 434 addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); 420 addCSSProperty(CSSPropertyVerticalAlign, attr->value()); 421 else 422 removeCSSProperty(CSSPropertyVerticalAlign); 435 423 } else 436 424 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLTableElement.h
r106681 r106740 73 73 HTMLTableElement(const QualifiedName&, Document*); 74 74 75 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;76 75 virtual void parseMappedAttribute(Attribute*); 77 76 virtual bool isURLAttribute(Attribute*) const; -
trunk/Source/WebCore/html/HTMLTablePartElement.cpp
r68854 r106740 37 37 using namespace HTMLNames; 38 38 39 bool HTMLTablePartElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const40 {41 if (attrName == backgroundAttr) {42 result = (MappedAttributeEntry)(eLastEntry + document()->docID());43 return false;44 }45 46 if (attrName == bgcolorAttr ||47 attrName == bordercolorAttr ||48 attrName == valignAttr ||49 attrName == heightAttr) {50 result = eUniversal;51 return false;52 }53 54 if (attrName == alignAttr) {55 result = eCell; // All table parts will just share in the TD space.56 return false;57 }58 59 return HTMLElement::mapToEntry(attrName, result);60 }61 62 39 void HTMLTablePartElement::parseMappedAttribute(Attribute* attr) 63 40 { 64 41 if (attr->name() == bgcolorAttr) 65 addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); 42 if (attr->value().isNull()) 43 removeCSSProperty(CSSPropertyBackgroundColor); 44 else 45 addCSSColor(CSSPropertyBackgroundColor, attr->value()); 66 46 else if (attr->name() == backgroundAttr) { 67 47 String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); 68 48 if (!url.isEmpty()) 69 addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); 49 addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); 50 else 51 removeCSSProperty(CSSPropertyBackgroundImage); 70 52 } else if (attr->name() == bordercolorAttr) { 71 53 if (!attr->value().isEmpty()) { 72 addCSSColor(attr, CSSPropertyBorderColor, attr->value()); 73 addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); 74 addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); 75 addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); 76 addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); 77 } 54 addCSSColor(CSSPropertyBorderColor, attr->value()); 55 addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); 56 addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); 57 addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); 58 addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); 59 } else 60 removeCSSProperties(CSSPropertyBorderColor, CSSPropertyBorderTopStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderRightStyle); 78 61 } else if (attr->name() == valignAttr) { 79 62 if (!attr->value().isEmpty()) 80 addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); 63 addCSSProperty(CSSPropertyVerticalAlign, attr->value()); 64 else 65 removeCSSProperty(CSSPropertyVerticalAlign); 81 66 } else if (attr->name() == alignAttr) { 82 67 const AtomicString& v = attr->value(); 83 if (equalIgnoringCase(v, "middle") || equalIgnoringCase(v, "center")) 84 addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); 68 if (v.isNull()) 69 removeCSSProperty(CSSPropertyTextAlign); 70 else if (equalIgnoringCase(v, "middle") || equalIgnoringCase(v, "center")) 71 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); 85 72 else if (equalIgnoringCase(v, "absmiddle")) 86 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueCenter);73 addCSSProperty(CSSPropertyTextAlign, CSSValueCenter); 87 74 else if (equalIgnoringCase(v, "left")) 88 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueWebkitLeft);75 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); 89 76 else if (equalIgnoringCase(v, "right")) 90 addCSSProperty( attr,CSSPropertyTextAlign, CSSValueWebkitRight);77 addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); 91 78 else 92 addCSSProperty( attr,CSSPropertyTextAlign, v);79 addCSSProperty(CSSPropertyTextAlign, v); 93 80 } else if (attr->name() == heightAttr) { 94 81 if (!attr->value().isEmpty()) 95 addCSSLength(attr, CSSPropertyHeight, attr->value()); 82 addCSSLength(CSSPropertyHeight, attr->value()); 83 else 84 removeCSSProperty(CSSPropertyHeight); 96 85 } else 97 86 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLTablePartElement.h
r60361 r106740 38 38 } 39 39 40 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;41 40 virtual void parseMappedAttribute(Attribute*); 42 41 }; -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r103051 r106740 152 152 153 153 if (shouldWrapText()) { 154 addCSSProperty( attr,CSSPropertyWhiteSpace, CSSValuePreWrap);155 addCSSProperty( attr,CSSPropertyWordWrap, CSSValueBreakWord);154 addCSSProperty(CSSPropertyWhiteSpace, CSSValuePreWrap); 155 addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); 156 156 } else { 157 addCSSProperty( attr,CSSPropertyWhiteSpace, CSSValuePre);158 addCSSProperty( attr,CSSPropertyWordWrap, CSSValueNormal);157 addCSSProperty(CSSPropertyWhiteSpace, CSSValuePre); 158 addCSSProperty(CSSPropertyWordWrap, CSSValueNormal); 159 159 } 160 160 -
trunk/Source/WebCore/html/HTMLUListElement.cpp
r61959 r106740 48 48 } 49 49 50 bool HTMLUListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const51 {52 if (attrName == typeAttr) {53 result = eUnorderedList;54 return false;55 }56 57 return HTMLElement::mapToEntry(attrName, result);58 }59 60 50 void HTMLUListElement::parseMappedAttribute(Attribute* attr) 61 51 { 62 52 if (attr->name() == typeAttr) 63 addCSSProperty(attr, CSSPropertyListStyleType, attr->value()); 53 if (attr->value().isNull()) 54 removeCSSProperty(CSSPropertyListStyleType); 55 else 56 addCSSProperty(CSSPropertyListStyleType, attr->value()); 64 57 else 65 58 HTMLElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/html/HTMLUListElement.h
r66057 r106740 36 36 HTMLUListElement(const QualifiedName&, Document*); 37 37 38 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;39 38 virtual void parseMappedAttribute(Attribute*); 40 39 }; -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r106667 r106740 115 115 #endif 116 116 } else if (attrName == widthAttr) 117 addCSSLength(attr, CSSPropertyWidth, attr->value()); 117 if (attr->value().isNull()) 118 removeCSSProperty(CSSPropertyWidth); 119 else 120 addCSSLength(CSSPropertyWidth, attr->value()); 118 121 else if (attrName == heightAttr) 119 addCSSLength(attr, CSSPropertyHeight, attr->value()); 122 if (attr->value().isNull()) 123 removeCSSProperty(CSSPropertyHeight); 124 else 125 addCSSLength(CSSPropertyHeight, attr->value()); 120 126 else 121 127 HTMLMediaElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r106695 r106740 717 717 PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Element* element) 718 718 { 719 // FIXME: Since we no longer have per-attribute style declarations, we should come up 720 // with a nicer way to present what we do have. 721 722 if (!element->isStyledElement()) 723 return InspectorArray::create(); 724 725 CSSMappedAttributeDeclaration* attributeStyle = static_cast<StyledElement*>(element)->attributeStyle(); 726 if (!attributeStyle || !attributeStyle->declaration()) 727 return InspectorArray::create(); 728 729 RefPtr<InspectorObject> attrStyleObject = InspectorObject::create(); 730 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attributeStyle->declaration()->ensureCSSStyleDeclaration(), 0); 731 attrStyleObject->setString("name", ""); 732 attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle()); 733 719 734 RefPtr<InspectorArray> attrStyles = InspectorArray::create(); 720 NamedNodeMap* attributes = element->updatedAttributes(); 721 if (!attributes) 722 return attrStyles.release(); 723 724 for (unsigned i = 0; attributes && i < attributes->length(); ++i) { 725 Attribute* attribute = attributes->attributeItem(i); 726 if (!attribute->decl()) 727 continue; 728 RefPtr<InspectorObject> attrStyleObject = InspectorObject::create(); 729 String attributeName = attribute->localName(); 730 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attribute->decl()->ensureCSSStyleDeclaration(), 0); 731 attrStyleObject->setString("name", attributeName.utf8().data()); 732 attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle()); 733 attrStyles->pushObject(attrStyleObject.release()); 734 } 735 735 attrStyles->pushObject(attrStyleObject.release()); 736 736 return attrStyles.release(); 737 737 } -
trunk/Source/WebCore/mathml/MathMLElement.cpp
r95901 r106740 49 49 } 50 50 51 bool MathMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const52 {53 if (attrName == mathcolorAttr || attrName == mathbackgroundAttr54 || attrName == colorAttr || attrName == backgroundAttr55 || attrName == fontsizeAttr || attrName == fontstyleAttr56 || attrName == fontweightAttr || attrName == fontfamilyAttr) {57 result = eMathML;58 return false;59 }60 return StyledElement::mapToEntry(attrName, result);61 }62 63 51 void MathMLElement::parseMappedAttribute(Attribute* attr) 64 52 { 65 53 if (attr->name() == mathbackgroundAttr) 66 addCSSProperty( attr,CSSPropertyBackgroundColor, attr->value());54 addCSSProperty(CSSPropertyBackgroundColor, attr->value()); 67 55 else if (attr->name() == mathsizeAttr) { 68 56 // The following three values of mathsize are handled in WebCore/css/mathml.css 69 57 if (attr->value() != "normal" && attr->value() != "small" && attr->value() != "big") 70 addCSSProperty( attr,CSSPropertyFontSize, attr->value());58 addCSSProperty(CSSPropertyFontSize, attr->value()); 71 59 } else if (attr->name() == mathcolorAttr) 72 addCSSProperty( attr,CSSPropertyColor, attr->value());60 addCSSProperty(CSSPropertyColor, attr->value()); 73 61 // FIXME: deprecated attributes that should loose in a conflict with a non deprecated attribute 74 62 else if (attr->name() == fontsizeAttr) 75 addCSSProperty( attr,CSSPropertyFontSize, attr->value());63 addCSSProperty(CSSPropertyFontSize, attr->value()); 76 64 else if (attr->name() == backgroundAttr) 77 addCSSProperty( attr,CSSPropertyBackgroundColor, attr->value());65 addCSSProperty(CSSPropertyBackgroundColor, attr->value()); 78 66 else if (attr->name() == colorAttr) 79 addCSSProperty( attr,CSSPropertyColor, attr->value());67 addCSSProperty(CSSPropertyColor, attr->value()); 80 68 else if (attr->name() == fontstyleAttr) 81 addCSSProperty( attr,CSSPropertyFontStyle, attr->value());69 addCSSProperty(CSSPropertyFontStyle, attr->value()); 82 70 else if (attr->name() == fontweightAttr) 83 addCSSProperty( attr,CSSPropertyFontWeight, attr->value());71 addCSSProperty(CSSPropertyFontWeight, attr->value()); 84 72 else if (attr->name() == fontfamilyAttr) 85 addCSSProperty( attr,CSSPropertyFontFamily, attr->value());73 addCSSProperty(CSSPropertyFontFamily, attr->value()); 86 74 else 87 75 StyledElement::parseMappedAttribute(attr); -
trunk/Source/WebCore/mathml/MathMLElement.h
r95901 r106740 43 43 private: 44 44 virtual bool isMathMLElement() const { return true; } 45 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;46 45 virtual void parseMappedAttribute(Attribute*); 47 46 }; -
trunk/Source/WebCore/svg/SVGImageElement.cpp
r105613 r106740 106 106 else if (attr->name() == SVGNames::widthAttr) { 107 107 setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); 108 addCSSProperty( attr,CSSPropertyWidth, attr->value());108 addCSSProperty(CSSPropertyWidth, attr->value()); 109 109 } else if (attr->name() == SVGNames::heightAttr) { 110 110 setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); 111 addCSSProperty( attr,CSSPropertyHeight, attr->value());111 addCSSProperty(CSSPropertyHeight, attr->value()); 112 112 } else if (SVGTests::parseMappedAttribute(attr) 113 113 || SVGLangSpace::parseMappedAttribute(attr) -
trunk/Source/WebCore/svg/SVGStyledElement.cpp
r106471 r106740 293 293 } 294 294 295 bool SVGStyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const296 {297 if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName) > 0) {298 result = eSVG;299 return false;300 }301 return SVGElement::mapToEntry(attrName, result);302 }303 304 295 void SVGStyledElement::parseMappedAttribute(Attribute* attr) 305 296 { 306 // NOTE: Any subclass which overrides parseMappedAttribute for a property handled by307 // cssPropertyIdForSVGAttributeName will also have to override mapToEntry to disable the default eSVG mapping308 297 int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()); 309 298 if (propId > 0) { 310 addCSSProperty( attr,propId, attr->value());299 addCSSProperty(propId, attr->value()); 311 300 setNeedsStyleRecalc(); 312 301 return; … … 423 412 QualifiedName attributeName(nullAtom, name, nullAtom); 424 413 Attribute* attr = attributeMap()->getAttributeItem(attributeName); 425 if (!attr || !attr->isMappedAttribute() || !attr->mappedAttributeDeclaration())414 if (!attr || !attr->isMappedAttribute()) 426 415 return 0; 427 416 428 Attribute* cssSVGAttr = attr; 429 // This function returns a pointer to a CSSValue which can be mutated from JavaScript. 430 // If the associated MappedAttribute uses the same CSSMappedAttributeDeclaration 431 // as StyledElement's mappedAttributeDecls cache, create a new CSSMappedAttributeDeclaration 432 // before returning so that any modifications to the CSSValue will not affect other attributes. 433 MappedAttributeEntry entry; 434 mapToEntry(attributeName, entry); 435 if (getMappedAttributeDecl(entry, cssSVGAttr) == cssSVGAttr->mappedAttributeDeclaration()) { 436 cssSVGAttr->setMappedAttributeDeclaration(0); 437 int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(cssSVGAttr->name()); 438 addCSSProperty(cssSVGAttr, propId, cssSVGAttr->value()); 439 } 440 return cssSVGAttr->decl()->getPropertyCSSValue(cssPropertyID(name)); 417 RefPtr<StylePropertySet> style = StylePropertySet::create(); 418 style->setStrictParsing(false); 419 int propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()); 420 style->setProperty(propertyID, attr->value()); 421 return style->getPropertyCSSValue(propertyID); 441 422 } 442 423 -
trunk/Source/WebCore/svg/SVGStyledElement.h
r96803 r106740 66 66 virtual bool rendererIsNeeded(const NodeRenderingContext&); 67 67 68 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;69 68 virtual void parseMappedAttribute(Attribute*); 70 69 virtual void svgAttributeChanged(const QualifiedName&); -
trunk/Source/WebCore/svg/SVGTextContentElement.cpp
r105143 r106740 248 248 249 249 if (attr->value() == preserveString) 250 addCSSProperty( attr,CSSPropertyWhiteSpace, CSSValuePre);250 addCSSProperty(CSSPropertyWhiteSpace, CSSValuePre); 251 251 else 252 addCSSProperty( attr,CSSPropertyWhiteSpace, CSSValueNowrap);252 addCSSProperty(CSSPropertyWhiteSpace, CSSValueNowrap); 253 253 } 254 254 } else
Note: See TracChangeset
for help on using the changeset viewer.