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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 622 |
623 // Default on the root element is translate=yes. | 623 // Default on the root element is translate=yes. |
624 return true; | 624 return true; |
625 } | 625 } |
626 | 626 |
627 void HTMLElement::setTranslate(bool enable) | 627 void HTMLElement::setTranslate(bool enable) |
628 { | 628 { |
629 setAttribute(translateAttr, enable ? "yes" : "no"); | 629 setAttribute(translateAttr, enable ? "yes" : "no"); |
630 } | 630 } |
631 | 631 |
| 632 // Returns the conforming 'dir' value associated with the state the attribute is
in (in its canonical case), if any, |
| 633 // or the empty string if the attribute is in a state that has no associated key
word value or if the attribute is |
| 634 // not in a defined state (e.g. the attribute is missing and there is no missing
value default). |
| 635 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interf
aces.html#limited-to-only-known-values |
| 636 static inline const AtomicString& toValidDirValue(const AtomicString& value) |
| 637 { |
| 638 DEFINE_STATIC_LOCAL(const AtomicString, ltrValue, ("ltr", AtomicString::Cons
tructFromLiteral)); |
| 639 DEFINE_STATIC_LOCAL(const AtomicString, rtlValue, ("rtl", AtomicString::Cons
tructFromLiteral)); |
| 640 DEFINE_STATIC_LOCAL(const AtomicString, autoValue, ("auto", AtomicString::Co
nstructFromLiteral)); |
| 641 |
| 642 if (equalIgnoringCase(value, ltrValue)) |
| 643 return ltrValue; |
| 644 if (equalIgnoringCase(value, rtlValue)) |
| 645 return rtlValue; |
| 646 if (equalIgnoringCase(value, autoValue)) |
| 647 return autoValue; |
| 648 return nullAtom; |
| 649 } |
| 650 |
| 651 const AtomicString& HTMLElement::dir() |
| 652 { |
| 653 return toValidDirValue(fastGetAttribute(dirAttr)); |
| 654 } |
| 655 |
| 656 void HTMLElement::setDir(const AtomicString& value) |
| 657 { |
| 658 setAttribute(dirAttr, value); |
| 659 } |
| 660 |
632 HTMLFormElement* HTMLElement::findFormAncestor() const | 661 HTMLFormElement* HTMLElement::findFormAncestor() const |
633 { | 662 { |
634 return Traversal<HTMLFormElement>::firstAncestor(*this); | 663 return Traversal<HTMLFormElement>::firstAncestor(*this); |
635 } | 664 } |
636 | 665 |
637 static inline bool elementAffectsDirectionality(const Node* node) | 666 static inline bool elementAffectsDirectionality(const Node* node) |
638 { | 667 { |
639 return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(no
de)->hasAttribute(dirAttr)); | 668 return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(no
de)->hasAttribute(dirAttr)); |
640 } | 669 } |
641 | 670 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 #ifndef NDEBUG | 993 #ifndef NDEBUG |
965 | 994 |
966 // For use in the debugger | 995 // For use in the debugger |
967 void dumpInnerHTML(WebCore::HTMLElement*); | 996 void dumpInnerHTML(WebCore::HTMLElement*); |
968 | 997 |
969 void dumpInnerHTML(WebCore::HTMLElement* element) | 998 void dumpInnerHTML(WebCore::HTMLElement* element) |
970 { | 999 { |
971 printf("%s\n", element->innerHTML().ascii().data()); | 1000 printf("%s\n", element->innerHTML().ascii().data()); |
972 } | 1001 } |
973 #endif | 1002 #endif |
OLD | NEW |