Title: [130311] trunk/Source/WebCore
Revision
130311
Author
benja...@webkit.org
Date
2012-10-03 12:17:18 -0700 (Wed, 03 Oct 2012)

Log Message

Element::computeInheritedLanguage: evaluate the while() condition after fetching the string
https://bugs.webkit.org/show_bug.cgi?id=98220

Patch by Benjamin Poulain <bpoul...@apple.com> on 2012-10-03
Reviewed by Andreas Kling.

* dom/Element.cpp:
(WebCore::Element::computeInheritedLanguage):
The condition is never false on the first execution. Move the condition to the
end of the loop for fun and profit.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130310 => 130311)


--- trunk/Source/WebCore/ChangeLog	2012-10-03 19:16:52 UTC (rev 130310)
+++ trunk/Source/WebCore/ChangeLog	2012-10-03 19:17:18 UTC (rev 130311)
@@ -1,3 +1,15 @@
+2012-10-03  Benjamin Poulain  <bpoul...@apple.com>
+
+        Element::computeInheritedLanguage: evaluate the while() condition after fetching the string
+        https://bugs.webkit.org/show_bug.cgi?id=98220
+
+        Reviewed by Andreas Kling.
+
+        * dom/Element.cpp:
+        (WebCore::Element::computeInheritedLanguage):
+        The condition is never false on the first execution. Move the condition to the
+        end of the loop for fun and profit.
+
 2012-10-03  Hans Wennborg  <h...@chromium.org>
 
         Speech _javascript_ API: Add SpeechRecognition.interimResults attribute

Modified: trunk/Source/WebCore/dom/Element.cpp (130310 => 130311)


--- trunk/Source/WebCore/dom/Element.cpp	2012-10-03 19:16:52 UTC (rev 130310)
+++ trunk/Source/WebCore/dom/Element.cpp	2012-10-03 19:17:18 UTC (rev 130311)
@@ -1756,7 +1756,7 @@
     const Node* n = this;
     AtomicString value;
     // The language property is inherited, so we iterate over the parents to find the first language.
-    while (n && value.isNull()) {
+    do {
         if (n->isElementNode()) {
             // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
             value = static_cast<const Element*>(n)->fastGetAttribute(XMLNames::langAttr);
@@ -1768,7 +1768,7 @@
         }
 
         n = n->parentNode();
-    }
+    } while (n && value.isNull());
 
     return value;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to