| Index: Source/core/html/HTMLElement.cpp
|
| diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
|
| index 1a98cf035b19329dd366f97188a7a7072d8790bd..1a64404b4da13ab17e6cd8bb4a8591f6ef051085 100644
|
| --- a/Source/core/html/HTMLElement.cpp
|
| +++ b/Source/core/html/HTMLElement.cpp
|
| @@ -611,13 +611,11 @@ TranslateAttributeMode HTMLElement::translateAttributeMode() const
|
|
|
| bool HTMLElement::translate() const
|
| {
|
| - for (const Node* n = this; n; n = n->parentNode()) {
|
| - if (n->isHTMLElement()) {
|
| - TranslateAttributeMode mode = toHTMLElement(n)->translateAttributeMode();
|
| - if (mode != TranslateAttributeInherit) {
|
| - ASSERT(mode == TranslateAttributeYes || mode == TranslateAttributeNo);
|
| - return mode == TranslateAttributeYes;
|
| - }
|
| + for (const HTMLElement* element = this; element; element = Traversal<HTMLElement>::firstAncestor(*element)) {
|
| + TranslateAttributeMode mode = element->translateAttributeMode();
|
| + if (mode != TranslateAttributeInherit) {
|
| + ASSERT(mode == TranslateAttributeYes || mode == TranslateAttributeNo);
|
| + return mode == TranslateAttributeYes;
|
| }
|
| }
|
|
|
| @@ -632,11 +630,7 @@ void HTMLElement::setTranslate(bool enable)
|
|
|
| HTMLFormElement* HTMLElement::findFormAncestor() const
|
| {
|
| - for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
|
| - if (isHTMLFormElement(*ancestor))
|
| - return toHTMLFormElement(ancestor);
|
| - }
|
| - return 0;
|
| + return Traversal<HTMLFormElement>::firstAncestor(*this);
|
| }
|
|
|
| static inline bool elementAffectsDirectionality(const Node* node)
|
|
|