| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "")) | 604 if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "")) |
| 605 return TranslateAttributeYes; | 605 return TranslateAttributeYes; |
| 606 if (equalIgnoringCase(value, "no")) | 606 if (equalIgnoringCase(value, "no")) |
| 607 return TranslateAttributeNo; | 607 return TranslateAttributeNo; |
| 608 | 608 |
| 609 return TranslateAttributeInherit; | 609 return TranslateAttributeInherit; |
| 610 } | 610 } |
| 611 | 611 |
| 612 bool HTMLElement::translate() const | 612 bool HTMLElement::translate() const |
| 613 { | 613 { |
| 614 for (const Node* n = this; n; n = n->parentNode()) { | 614 for (const HTMLElement* element = this; element; element = Traversal<HTMLEle
ment>::firstAncestor(*element)) { |
| 615 if (n->isHTMLElement()) { | 615 TranslateAttributeMode mode = element->translateAttributeMode(); |
| 616 TranslateAttributeMode mode = toHTMLElement(n)->translateAttributeMo
de(); | 616 if (mode != TranslateAttributeInherit) { |
| 617 if (mode != TranslateAttributeInherit) { | 617 ASSERT(mode == TranslateAttributeYes || mode == TranslateAttributeNo
); |
| 618 ASSERT(mode == TranslateAttributeYes || mode == TranslateAttribu
teNo); | 618 return mode == TranslateAttributeYes; |
| 619 return mode == TranslateAttributeYes; | |
| 620 } | |
| 621 } | 619 } |
| 622 } | 620 } |
| 623 | 621 |
| 624 // Default on the root element is translate=yes. | 622 // Default on the root element is translate=yes. |
| 625 return true; | 623 return true; |
| 626 } | 624 } |
| 627 | 625 |
| 628 void HTMLElement::setTranslate(bool enable) | 626 void HTMLElement::setTranslate(bool enable) |
| 629 { | 627 { |
| 630 setAttribute(translateAttr, enable ? "yes" : "no"); | 628 setAttribute(translateAttr, enable ? "yes" : "no"); |
| 631 } | 629 } |
| 632 | 630 |
| 633 HTMLFormElement* HTMLElement::findFormAncestor() const | 631 HTMLFormElement* HTMLElement::findFormAncestor() const |
| 634 { | 632 { |
| 635 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->
parentNode()) { | 633 return Traversal<HTMLFormElement>::firstAncestor(*this); |
| 636 if (isHTMLFormElement(*ancestor)) | |
| 637 return toHTMLFormElement(ancestor); | |
| 638 } | |
| 639 return 0; | |
| 640 } | 634 } |
| 641 | 635 |
| 642 static inline bool elementAffectsDirectionality(const Node* node) | 636 static inline bool elementAffectsDirectionality(const Node* node) |
| 643 { | 637 { |
| 644 return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(no
de)->hasAttribute(dirAttr)); | 638 return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(no
de)->hasAttribute(dirAttr)); |
| 645 } | 639 } |
| 646 | 640 |
| 647 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN
ode = 0) | 641 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN
ode = 0) |
| 648 { | 642 { |
| 649 firstNode->setSelfOrAncestorHasDirAutoAttribute(flag); | 643 firstNode->setSelfOrAncestorHasDirAutoAttribute(flag); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 #ifndef NDEBUG | 962 #ifndef NDEBUG |
| 969 | 963 |
| 970 // For use in the debugger | 964 // For use in the debugger |
| 971 void dumpInnerHTML(WebCore::HTMLElement*); | 965 void dumpInnerHTML(WebCore::HTMLElement*); |
| 972 | 966 |
| 973 void dumpInnerHTML(WebCore::HTMLElement* element) | 967 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 974 { | 968 { |
| 975 printf("%s\n", element->innerHTML().ascii().data()); | 969 printf("%s\n", element->innerHTML().ascii().data()); |
| 976 } | 970 } |
| 977 #endif | 971 #endif |
| OLD | NEW |