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-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (name == alignAttr || name == contenteditableAttr || name == hiddenAttr |
| name == langAttr || name.matches(XMLNames::langAttr) || name == draggableAttr
|| name == dirAttr) | 177 if (name == alignAttr || name == contenteditableAttr || name == hiddenAttr |
| name == langAttr || name.matches(XMLNames::langAttr) || name == draggableAttr
|| name == dirAttr) |
178 return true; | 178 return true; |
179 return Element::isPresentationAttribute(name); | 179 return Element::isPresentationAttribute(name); |
180 } | 180 } |
181 | 181 |
182 static inline bool isValidDirAttribute(const AtomicString& value) | 182 static inline bool isValidDirAttribute(const AtomicString& value) |
183 { | 183 { |
184 return equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "ltr") |
| equalIgnoringCase(value, "rtl"); | 184 return equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "ltr") |
| equalIgnoringCase(value, "rtl"); |
185 } | 185 } |
186 | 186 |
| 187 static bool shouldUseUnicodeBidiEmbed(const Element* element) |
| 188 { |
| 189 if (element->hasTagName(bdoTag) |
| 190 || element->hasTagName(addressTag) |
| 191 || element->hasTagName(blockquoteTag) |
| 192 || element->hasTagName(centerTag) |
| 193 || element->hasTagName(divTag) |
| 194 || element->hasTagName(figureTag) |
| 195 || element->hasTagName(figcaptionTag) |
| 196 || element->hasTagName(footerTag) |
| 197 || element->hasTagName(formTag) |
| 198 || element->hasTagName(headerTag) |
| 199 || element->hasTagName(hrTag) |
| 200 || element->hasTagName(legendTag) |
| 201 || element->hasTagName(listingTag) |
| 202 || element->hasTagName(pTag) |
| 203 || element->hasTagName(plaintextTag) |
| 204 || element->hasTagName(preTag) |
| 205 || element->hasTagName(summaryTag) |
| 206 || element->hasTagName(xmpTag) |
| 207 || element->hasTagName(articleTag) |
| 208 || element->hasTagName(asideTag) |
| 209 || element->hasTagName(h1Tag) |
| 210 || element->hasTagName(h2Tag) |
| 211 || element->hasTagName(h3Tag) |
| 212 || element->hasTagName(h4Tag) |
| 213 || element->hasTagName(h5Tag) |
| 214 || element->hasTagName(h6Tag) |
| 215 || element->hasTagName(hgroupTag) |
| 216 || element->hasTagName(mainTag) |
| 217 || element->hasTagName(navTag) |
| 218 || element->hasTagName(sectionTag) |
| 219 || element->hasTagName(tableTag) |
| 220 || element->hasTagName(captionTag) |
| 221 || element->hasTagName(colgroupTag) |
| 222 || element->hasTagName(colTag) |
| 223 || element->hasTagName(theadTag) |
| 224 || element->hasTagName(tbodyTag) |
| 225 || element->hasTagName(tfootTag) |
| 226 || element->hasTagName(trTag) |
| 227 || element->hasTagName(tdTag) |
| 228 || element->hasTagName(thTag) |
| 229 || element->hasTagName(dirTag) |
| 230 || element->hasTagName(ddTag) |
| 231 || element->hasTagName(dlTag) |
| 232 || element->hasTagName(dtTag) |
| 233 || element->hasTagName(menuTag) |
| 234 || element->hasTagName(olTag) |
| 235 || element->hasTagName(ulTag) |
| 236 || element->hasTagName(liTag) |
| 237 || element->hasTagName(bdiTag) |
| 238 || element->hasTagName(outputTag)) |
| 239 return false; |
| 240 return true; |
| 241 } |
| 242 |
187 void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name
, const AtomicString& value, MutableStylePropertySet* style) | 243 void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name
, const AtomicString& value, MutableStylePropertySet* style) |
188 { | 244 { |
189 if (name == alignAttr) { | 245 if (name == alignAttr) { |
190 if (equalIgnoringCase(value, "middle")) | 246 if (equalIgnoringCase(value, "middle")) |
191 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign,
CSSValueCenter); | 247 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign,
CSSValueCenter); |
192 else | 248 else |
193 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign,
value); | 249 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign,
value); |
194 } else if (name == contenteditableAttr) { | 250 } else if (name == contenteditableAttr) { |
195 if (value.isEmpty() || equalIgnoringCase(value, "true")) { | 251 if (value.isEmpty() || equalIgnoringCase(value, "true")) { |
196 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser
Modify, CSSValueReadWrite); | 252 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser
Modify, CSSValueReadWrite); |
(...skipping 16 matching lines...) Expand all Loading... |
213 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser
Drag, CSSValueNone); | 269 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser
Drag, CSSValueNone); |
214 } | 270 } |
215 } else if (name == dirAttr) { | 271 } else if (name == dirAttr) { |
216 if (equalIgnoringCase(value, "auto")) { | 272 if (equalIgnoringCase(value, "auto")) { |
217 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBid
i, unicodeBidiAttributeForDirAuto(this)); | 273 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBid
i, unicodeBidiAttributeForDirAuto(this)); |
218 } else { | 274 } else { |
219 if (isValidDirAttribute(value)) | 275 if (isValidDirAttribute(value)) |
220 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect
ion, value); | 276 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect
ion, value); |
221 else | 277 else |
222 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect
ion, "ltr"); | 278 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect
ion, "ltr"); |
223 if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(output
Tag)) | 279 if (shouldUseUnicodeBidiEmbed(this)) |
224 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicod
eBidi, CSSValueEmbed); | 280 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicod
eBidi, CSSValueEmbed); |
225 } | 281 } |
226 } else if (name.matches(XMLNames::langAttr)) { | 282 } else if (name.matches(XMLNames::langAttr)) { |
227 mapLanguageAttributeToLocale(value, style); | 283 mapLanguageAttributeToLocale(value, style); |
228 } else if (name == langAttr) { | 284 } else if (name == langAttr) { |
229 // xml:lang has a higher priority than lang. | 285 // xml:lang has a higher priority than lang. |
230 if (!fastHasAttribute(XMLNames::langAttr)) | 286 if (!fastHasAttribute(XMLNames::langAttr)) |
231 mapLanguageAttributeToLocale(value, style); | 287 mapLanguageAttributeToLocale(value, style); |
232 } else { | 288 } else { |
233 Element::collectStyleForPresentationAttribute(name, value, style); | 289 Element::collectStyleForPresentationAttribute(name, value, style); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 #ifndef NDEBUG | 1072 #ifndef NDEBUG |
1017 | 1073 |
1018 // For use in the debugger | 1074 // For use in the debugger |
1019 void dumpInnerHTML(blink::HTMLElement*); | 1075 void dumpInnerHTML(blink::HTMLElement*); |
1020 | 1076 |
1021 void dumpInnerHTML(blink::HTMLElement* element) | 1077 void dumpInnerHTML(blink::HTMLElement* element) |
1022 { | 1078 { |
1023 printf("%s\n", element->innerHTML().ascii().data()); | 1079 printf("%s\n", element->innerHTML().ascii().data()); |
1024 } | 1080 } |
1025 #endif | 1081 #endif |
OLD | NEW |