Changeset 107883 in webkit
- Timestamp:
- Feb 15, 2012 9:42:02 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r107882 r107883 1 2012-02-15 Pablo Flouret <pablof@motorola.com> 2 3 Add support for the translate attribute in html elements. 4 https://bugs.webkit.org/show_bug.cgi?id=78751 5 6 Reviewed by Adam Barth. 7 8 The translate attribute is used to specify whether an element's 9 attribute values and the values of its Text node children are to be 10 translated when the page is localized, or whether to leave them 11 unchanged. 12 13 Details at http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#attr-translate 14 15 * fast/dom/HTMLElement/translate-expected.txt: Added. 16 * fast/dom/HTMLElement/translate.html: Added. 17 1 18 2012-02-15 Noel Gordon <noel.gordon@gmail.com> 2 19 -
trunk/Source/WebCore/ChangeLog
r107881 r107883 1 2012-02-15 Pablo Flouret <pablof@motorola.com> 2 3 Add support for the translate attribute in html elements. 4 https://bugs.webkit.org/show_bug.cgi?id=78751 5 6 Reviewed by Adam Barth. 7 8 The translate attribute is used to specify whether an element's 9 attribute values and the values of its Text node children are to be 10 translated when the page is localized, or whether to leave them 11 unchanged. 12 13 Details at http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#attr-translate 14 15 Test: fast/dom/HTMLElement/translate.html 16 17 * html/HTMLAttributeNames.in: 18 * html/HTMLElement.cpp: 19 (WebCore::HTMLElement::translateAttributeMode): 20 (WebCore): 21 (WebCore::HTMLElement::translate): 22 (WebCore::HTMLElement::setTranslate): 23 * html/HTMLElement.h: 24 (HTMLElement): 25 * html/HTMLElement.idl: 26 1 27 2012-02-15 Sami Kyostila <skyostil@google.com> 2 28 -
trunk/Source/WebCore/html/HTMLAttributeNames.in
r104919 r107883 305 305 top 306 306 topmargin 307 translate 307 308 truespeed 308 309 type -
trunk/Source/WebCore/html/HTMLElement.cpp
r107554 r107883 801 801 } 802 802 803 TranslateAttributeMode HTMLElement::translateAttributeMode() const 804 { 805 const AtomicString& value = getAttribute(translateAttr); 806 807 if (value == nullAtom) 808 return TranslateAttributeInherit; 809 if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "")) 810 return TranslateAttributeYes; 811 if (equalIgnoringCase(value, "no")) 812 return TranslateAttributeNo; 813 814 return TranslateAttributeInherit; 815 } 816 817 bool HTMLElement::translate() const 818 { 819 for (const Node* n = this; n; n = n->parentNode()) { 820 if (n->isHTMLElement()) { 821 TranslateAttributeMode mode = static_cast<const HTMLElement*>(n)->translateAttributeMode(); 822 if (mode != TranslateAttributeInherit) { 823 ASSERT(mode == TranslateAttributeYes || mode == TranslateAttributeNo); 824 return mode == TranslateAttributeYes; 825 } 826 } 827 } 828 829 // Default on the root element is translate=yes. 830 return true; 831 } 832 833 void HTMLElement::setTranslate(bool enable) 834 { 835 setAttribute(translateAttr, enable ? "yes" : "no"); 836 } 837 838 803 839 HTMLCollection* HTMLElement::children() 804 840 { -
trunk/Source/WebCore/html/HTMLElement.h
r107554 r107883 36 36 #endif 37 37 38 enum TranslateAttributeMode { 39 TranslateAttributeYes, 40 TranslateAttributeNo, 41 TranslateAttributeInherit 42 }; 43 38 44 class HTMLElement : public StyledElement { 39 45 public: … … 68 74 bool spellcheck() const; 69 75 void setSpellcheck(bool); 76 77 bool translate() const; 78 void setTranslate(bool); 70 79 71 80 void click(); … … 122 131 TextDirection directionality(Node** strongDirectionalityTextNode= 0) const; 123 132 133 TranslateAttributeMode translateAttributeMode() const; 134 124 135 #if ENABLE(MICRODATA) 125 136 virtual String itemValueText() const; -
trunk/Source/WebCore/html/HTMLElement.idl
r107530 r107883 31 31 attribute [Reflect] DOMString title; 32 32 attribute [Reflect] DOMString lang; 33 attribute boolean translate; 33 34 attribute [Reflect] DOMString dir; 34 35 attribute [Reflect=class] DOMString className;
Note: See TracChangeset
for help on using the changeset viewer.