Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: Source/core/html/HTMLElement.cpp

Issue 624033002: Make unicode-bidi:isolate the default for block elements instead of unicode-bidi:embed Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/html.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (name == alignAttr || name == contenteditableAttr || name == hiddenAttr | | name == langAttr || name.matches(XMLNames::langAttr) || name == draggableAttr || name == dirAttr) 151 if (name == alignAttr || name == contenteditableAttr || name == hiddenAttr | | name == langAttr || name.matches(XMLNames::langAttr) || name == draggableAttr || name == dirAttr)
152 return true; 152 return true;
153 return Element::isPresentationAttribute(name); 153 return Element::isPresentationAttribute(name);
154 } 154 }
155 155
156 static inline bool isValidDirAttribute(const AtomicString& value) 156 static inline bool isValidDirAttribute(const AtomicString& value)
157 { 157 {
158 return equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "ltr") | | equalIgnoringCase(value, "rtl"); 158 return equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "ltr") | | equalIgnoringCase(value, "rtl");
159 } 159 }
160 160
161 static bool shouldUseUnicodeBidiEmbed(const Element* element)
162 {
163 if (element->hasTagName(bdoTag)
164 || element->hasTagName(addressTag)
165 || element->hasTagName(blockquoteTag)
166 || element->hasTagName(centerTag)
167 || element->hasTagName(divTag)
168 || element->hasTagName(figureTag)
169 || element->hasTagName(figcaptionTag)
170 || element->hasTagName(footerTag)
171 || element->hasTagName(formTag)
172 || element->hasTagName(headerTag)
173 || element->hasTagName(hrTag)
174 || element->hasTagName(legendTag)
175 || element->hasTagName(listingTag)
176 || element->hasTagName(pTag)
177 || element->hasTagName(plaintextTag)
178 || element->hasTagName(preTag)
179 || element->hasTagName(summaryTag)
180 || element->hasTagName(xmpTag)
181 || element->hasTagName(articleTag)
182 || element->hasTagName(asideTag)
183 || element->hasTagName(h1Tag)
184 || element->hasTagName(h2Tag)
185 || element->hasTagName(h3Tag)
186 || element->hasTagName(h4Tag)
187 || element->hasTagName(h5Tag)
188 || element->hasTagName(h6Tag)
189 || element->hasTagName(hgroupTag)
190 || element->hasTagName(mainTag)
191 || element->hasTagName(navTag)
192 || element->hasTagName(sectionTag)
193 || element->hasTagName(tableTag)
194 || element->hasTagName(captionTag)
195 || element->hasTagName(colgroupTag)
196 || element->hasTagName(colTag)
197 || element->hasTagName(theadTag)
198 || element->hasTagName(tbodyTag)
199 || element->hasTagName(tfootTag)
200 || element->hasTagName(trTag)
201 || element->hasTagName(tdTag)
202 || element->hasTagName(thTag)
203 || element->hasTagName(dirTag)
204 || element->hasTagName(ddTag)
205 || element->hasTagName(dlTag)
206 || element->hasTagName(dtTag)
207 || element->hasTagName(menuTag)
208 || element->hasTagName(olTag)
209 || element->hasTagName(ulTag)
210 || element->hasTagName(liTag)
211 || element->hasTagName(bdiTag)
212 || element->hasTagName(outputTag))
213 return false;
214 return true;
215 }
216
161 void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name , const AtomicString& value, MutableStylePropertySet* style) 217 void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name , const AtomicString& value, MutableStylePropertySet* style)
162 { 218 {
163 if (name == alignAttr) { 219 if (name == alignAttr) {
164 if (equalIgnoringCase(value, "middle")) 220 if (equalIgnoringCase(value, "middle"))
165 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter); 221 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter);
166 else 222 else
167 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value); 223 addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value);
168 } else if (name == contenteditableAttr) { 224 } else if (name == contenteditableAttr) {
169 if (value.isEmpty() || equalIgnoringCase(value, "true")) { 225 if (value.isEmpty() || equalIgnoringCase(value, "true")) {
170 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Modify, CSSValueReadWrite); 226 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Modify, CSSValueReadWrite);
(...skipping 14 matching lines...) Expand all
185 } else if (equalIgnoringCase(value, "false")) 241 } else if (equalIgnoringCase(value, "false"))
186 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Drag, CSSValueNone); 242 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUser Drag, CSSValueNone);
187 } else if (name == dirAttr) { 243 } else if (name == dirAttr) {
188 if (equalIgnoringCase(value, "auto")) 244 if (equalIgnoringCase(value, "auto"))
189 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBid i, unicodeBidiAttributeForDirAuto(this)); 245 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBid i, unicodeBidiAttributeForDirAuto(this));
190 else { 246 else {
191 if (isValidDirAttribute(value)) 247 if (isValidDirAttribute(value))
192 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, value); 248 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, value);
193 else 249 else
194 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, "ltr"); 250 addPropertyToPresentationAttributeStyle(style, CSSPropertyDirect ion, "ltr");
195 if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(output Tag)) 251 if (shouldUseUnicodeBidiEmbed(this))
196 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicod eBidi, CSSValueEmbed); 252 addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicod eBidi, CSSValueEmbed);
197 } 253 }
198 } else if (name.matches(XMLNames::langAttr)) 254 } else if (name.matches(XMLNames::langAttr))
199 mapLanguageAttributeToLocale(value, style); 255 mapLanguageAttributeToLocale(value, style);
200 else if (name == langAttr) { 256 else if (name == langAttr) {
201 // xml:lang has a higher priority than lang. 257 // xml:lang has a higher priority than lang.
202 if (!fastHasAttribute(XMLNames::langAttr)) 258 if (!fastHasAttribute(XMLNames::langAttr))
203 mapLanguageAttributeToLocale(value, style); 259 mapLanguageAttributeToLocale(value, style);
204 } else 260 } else
205 Element::collectStyleForPresentationAttribute(name, value, style); 261 Element::collectStyleForPresentationAttribute(name, value, style);
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 #ifndef NDEBUG 1059 #ifndef NDEBUG
1004 1060
1005 // For use in the debugger 1061 // For use in the debugger
1006 void dumpInnerHTML(blink::HTMLElement*); 1062 void dumpInnerHTML(blink::HTMLElement*);
1007 1063
1008 void dumpInnerHTML(blink::HTMLElement* element) 1064 void dumpInnerHTML(blink::HTMLElement* element)
1009 { 1065 {
1010 printf("%s\n", element->innerHTML().ascii().data()); 1066 printf("%s\n", element->innerHTML().ascii().data());
1011 } 1067 }
1012 #endif 1068 #endif
OLDNEW
« no previous file with comments | « Source/core/css/html.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698