| Index: Source/core/html/HTMLElement.cpp
|
| diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
|
| index a04a54f540f164f981720a647af726ff57cc7892..1385f8bf22adbe58556a6d782383085e99a24686 100644
|
| --- a/Source/core/html/HTMLElement.cpp
|
| +++ b/Source/core/html/HTMLElement.cpp
|
| @@ -610,13 +610,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;
|
| }
|
| }
|
|
|
| @@ -631,11 +629,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)
|
|
|