OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 if (name == alignAttr || name == contenteditableAttr || name == hiddenAttr | | name == langAttr || name.matches(XMLNames::langAttr) || name == draggableAttr || name == dirAttr) | 150 if (name == alignAttr || name == contenteditableAttr || name == hiddenAttr | | name == langAttr || name.matches(XMLNames::langAttr) || name == draggableAttr || name == dirAttr) |
151 return true; | 151 return true; |
152 return Element::isPresentationAttribute(name); | 152 return Element::isPresentationAttribute(name); |
153 } | 153 } |
154 | 154 |
155 static inline bool isValidDirAttribute(const AtomicString& value) | 155 static inline bool isValidDirAttribute(const AtomicString& value) |
156 { | 156 { |
157 return equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "ltr") | | equalIgnoringCase(value, "rtl"); | 157 return equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "ltr") | | equalIgnoringCase(value, "rtl"); |
158 } | 158 } |
159 | 159 |
160 static bool shouldUseUnicodeBidiEmbed(const Element* element) | |
eseidel
2013/11/14 06:41:30
Is this trying to list all block elements? Why wo
| |
161 { | |
162 if (element->hasTagName(bdoTag) | |
esprehn
2013/11/14 06:46:54
This is not right.
| |
163 || element->hasTagName(addressTag) | |
164 || element->hasTagName(blockquoteTag) | |
165 || element->hasTagName(centerTag) | |
166 || element->hasTagName(divTag) | |
167 || element->hasTagName(figureTag) | |
168 || element->hasTagName(figcaptionTag) | |
169 || element->hasTagName(footerTag) | |
170 || element->hasTagName(formTag) | |
171 || element->hasTagName(headerTag) | |
172 || element->hasTagName(hrTag) | |
173 || element->hasTagName(legendTag) | |
174 || element->hasTagName(listingTag) | |
175 || element->hasTagName(pTag) | |
176 || element->hasTagName(plaintextTag) | |
177 || element->hasTagName(preTag) | |
178 || element->hasTagName(summaryTag) | |
179 || element->hasTagName(xmpTag) | |
180 || element->hasTagName(articleTag) | |
181 || element->hasTagName(asideTag) | |
182 || element->hasTagName(h1Tag) | |
183 || element->hasTagName(h2Tag) | |
184 || element->hasTagName(h3Tag) | |
185 || element->hasTagName(h4Tag) | |
186 || element->hasTagName(h5Tag) | |
187 || element->hasTagName(h6Tag) | |
188 || element->hasTagName(hgroupTag) | |
189 || element->hasTagName(mainTag) | |
190 || element->hasTagName(navTag) | |
191 || element->hasTagName(sectionTag) | |
192 || element->hasTagName(tableTag) | |
193 || element->hasTagName(captionTag) | |
194 || element->hasTagName(colgroupTag) | |
195 || element->hasTagName(colTag) | |
196 || element->hasTagName(theadTag) | |
197 || element->hasTagName(tbodyTag) | |
198 || element->hasTagName(tfootTag) | |
199 || element->hasTagName(trTag) | |
200 || element->hasTagName(tdTag) | |
201 || element->hasTagName(thTag) | |
202 || element->hasTagName(dirTag) | |
203 || element->hasTagName(ddTag) | |
204 || element->hasTagName(dlTag) | |
205 || element->hasTagName(dtTag) | |
206 || element->hasTagName(menuTag) | |
207 || element->hasTagName(olTag) | |
208 || element->hasTagName(ulTag) | |
209 || element->hasTagName(liTag) | |
210 || element->hasTagName(bdiTag) | |
211 || element->hasTagName(outputTag)) | |
212 return false; | |
213 return true; | |
214 } | |
215 | |
160 void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name , const AtomicString& value, MutableStylePropertySet* style) | 216 void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name , const AtomicString& value, MutableStylePropertySet* style) |
161 { | 217 { |
162 if (name == alignAttr) { | 218 if (name == alignAttr) { |
163 if (equalIgnoringCase(value, "middle")) | 219 if (equalIgnoringCase(value, "middle")) |
164 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter); | 220 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter); |
165 else | 221 else |
166 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value); | 222 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value); |
167 } else if (name == contenteditableAttr) { | 223 } else if (name == contenteditableAttr) { |
168 if (value.isEmpty() || equalIgnoringCase(value, "true")) { | 224 if (value.isEmpty() || equalIgnoringCase(value, "true")) { |
169 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Modify, CSSValueReadWrite); | 225 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Modify, CSSValueReadWrite); |
(...skipping 14 matching lines...) Expand all Loading... | |
184 } else if (equalIgnoringCase(value, "false")) | 240 } else if (equalIgnoringCase(value, "false")) |
185 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Drag, CSSValueNone); | 241 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Drag, CSSValueNone); |
186 } else if (name == dirAttr) { | 242 } else if (name == dirAttr) { |
187 if (equalIgnoringCase(value, "auto")) | 243 if (equalIgnoringCase(value, "auto")) |
188 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBid i, unicodeBidiAttributeForDirAuto(this)); | 244 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBid i, unicodeBidiAttributeForDirAuto(this)); |
189 else { | 245 else { |
190 if (isValidDirAttribute(value)) | 246 if (isValidDirAttribute(value)) |
191 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, value); | 247 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, value); |
192 else | 248 else |
193 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, "ltr"); | 249 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, "ltr"); |
194 if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(output Tag)) | 250 if (shouldUseUnicodeBidiEmbed(this)) |
195 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicod eBidi, CSSValueEmbed); | 251 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicod eBidi, CSSValueEmbed); |
196 } | 252 } |
197 } else if (name.matches(XMLNames::langAttr)) | 253 } else if (name.matches(XMLNames::langAttr)) |
198 mapLanguageAttributeToLocale(value, style); | 254 mapLanguageAttributeToLocale(value, style); |
199 else if (name == langAttr) { | 255 else if (name == langAttr) { |
200 // xml:lang has a higher priority than lang. | 256 // xml:lang has a higher priority than lang. |
201 if (!fastHasAttribute(XMLNames::langAttr)) | 257 if (!fastHasAttribute(XMLNames::langAttr)) |
202 mapLanguageAttributeToLocale(value, style); | 258 mapLanguageAttributeToLocale(value, style); |
203 } else | 259 } else |
204 Element::collectStyleForPresentationAttribute(name, value, style); | 260 Element::collectStyleForPresentationAttribute(name, value, style); |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1072 #ifndef NDEBUG | 1128 #ifndef NDEBUG |
1073 | 1129 |
1074 // For use in the debugger | 1130 // For use in the debugger |
1075 void dumpInnerHTML(WebCore::HTMLElement*); | 1131 void dumpInnerHTML(WebCore::HTMLElement*); |
1076 | 1132 |
1077 void dumpInnerHTML(WebCore::HTMLElement* element) | 1133 void dumpInnerHTML(WebCore::HTMLElement* element) |
1078 { | 1134 { |
1079 printf("%s\n", element->innerHTML().ascii().data()); | 1135 printf("%s\n", element->innerHTML().ascii().data()); |
1080 } | 1136 } |
1081 #endif | 1137 #endif |
OLD | NEW |