<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[46395] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/46395">46395</a></dd>
<dt>Author</dt> <dd>zimmermann@webkit.org</dd>
<dt>Date</dt> <dd>2009-07-25 09:43:52 -0700 (Sat, 25 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>2009-07-25  Nikolas Zimmermann  &lt;nikolas.zimmermann@torchmobile.com&gt;

        Reviewed by George Staikos.

        [WML] Variable substitution is buggy
        https://bugs.webkit.org/show_bug.cgi?id=27677

        Substitute variables upon attach() time instead of insertedIntoDocument(). Otherwhise variable substitution
        won't work during inter-deck jumps (same URL, different fragment). Covered by new test fast/wml/newcontext-same-deck.html.

        * dom/Text.cpp:
        (WebCore::Text::attach):
        * dom/Text.h:

2009-07-25  Nikolas Zimmermann  &lt;nikolas.zimmermann@torchmobile.com&gt;

        Reviewed by George Staikos.

        [WML] Variable substitution is buggy
        https://bugs.webkit.org/show_bug.cgi?id=27677

        Always substitute variables regardless of their existance. If a variable doesn't exist, expand it to an empty string.
        Correct several testcases, relying on the old buggy behaviour.

        * wml/newcontext-same-deck-expected.txt: Added.
        * wml/newcontext-same-deck.html: Added.
        * wml/resources/WMLTestCase.js:
        (createWMLTestCase.iframeElement.onload):
        (createWMLTestCase):
        (assureLayout):
        (startTest):
        (triggerMouseEvent):
        * wml/resources/newcontext-same-deck.js: Added.
        (setupTestDocument):
        (prepareTest):
        (executeTest):
        * wml/resources/newcontext-same-deck.wml: Added.
        * wml/resources/select-element-variables.js:
        (prepareTest):
        * wml/select-element-variables-expected.txt:
        * wml/variable-reference-invalid-character-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestswmlresourcesWMLTestCasejs">trunk/LayoutTests/wml/resources/WMLTestCase.js</a></li>
<li><a href="#trunkLayoutTestswmlresourcesselectelementvariablesjs">trunk/LayoutTests/wml/resources/select-element-variables.js</a></li>
<li><a href="#trunkLayoutTestswmlselectelementvariablesexpectedtxt">trunk/LayoutTests/wml/select-element-variables-expected.txt</a></li>
<li><a href="#trunkLayoutTestswmlvariablereferenceinvalidcharacterexpectedtxt">trunk/LayoutTests/wml/variable-reference-invalid-character-expected.txt</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoredomTextcpp">trunk/WebCore/dom/Text.cpp</a></li>
<li><a href="#trunkWebCoredomTexth">trunk/WebCore/dom/Text.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestswmlnewcontextsamedeckexpectedtxt">trunk/LayoutTests/wml/newcontext-same-deck-expected.txt</a></li>
<li><a href="#trunkLayoutTestswmlnewcontextsamedeckhtml">trunk/LayoutTests/wml/newcontext-same-deck.html</a></li>
<li><a href="#trunkLayoutTestswmlresourcesnewcontextsamedeckjs">trunk/LayoutTests/wml/resources/newcontext-same-deck.js</a></li>
<li><a href="#trunkLayoutTestswmlresourcesnewcontextsamedeckwml">trunk/LayoutTests/wml/resources/newcontext-same-deck.wml</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/LayoutTests/ChangeLog        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -2,6 +2,34 @@
</span><span class="cx"> 
</span><span class="cx">         Reviewed by George Staikos.
</span><span class="cx"> 
</span><ins>+        [WML] Variable substitution is buggy
+        https://bugs.webkit.org/show_bug.cgi?id=27677
+
+        Always substitute variables regardless of their existance. If a variable doesn't exist, expand it to an empty string.
+        Correct several testcases, relying on the old buggy behaviour.
+
+        * wml/newcontext-same-deck-expected.txt: Added.
+        * wml/newcontext-same-deck.html: Added.
+        * wml/resources/WMLTestCase.js:
+        (createWMLTestCase.iframeElement.onload):
+        (createWMLTestCase):
+        (assureLayout):
+        (startTest):
+        (triggerMouseEvent):
+        * wml/resources/newcontext-same-deck.js: Added.
+        (setupTestDocument):
+        (prepareTest):
+        (executeTest):
+        * wml/resources/newcontext-same-deck.wml: Added.
+        * wml/resources/select-element-variables.js:
+        (prepareTest):
+        * wml/select-element-variables-expected.txt:
+        * wml/variable-reference-invalid-character-expected.txt:
+
+2009-07-25  Nikolas Zimmermann  &lt;nikolas.zimmermann@torchmobile.com&gt;
+
+        Reviewed by George Staikos.
+
</ins><span class="cx">         [WML] WMLDoElement doesn't update its RenderButton object upon attach()
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=27676
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestswmlnewcontextsamedeckexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/wml/newcontext-same-deck-expected.txt (0 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/newcontext-same-deck-expected.txt                                (rev 0)
+++ trunk/LayoutTests/wml/newcontext-same-deck-expected.txt        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+WML layout tests - using XHTML scripting
+
+
+Tests newcontext attribute handling on cards within the same deck
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result1.textContent is &quot;Test 1/3: var1=''&quot;
+PASS result2.textContent is &quot;Test 2/3: var1=''&quot;
+PASS result3.textContent is &quot;Test 3/3: var2='PASS'&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+Test 2/3: var1=''
+Test 3/3: var2='PASS'
</ins></span></pre></div>
<a id="trunkLayoutTestswmlnewcontextsamedeckhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/wml/newcontext-same-deck.html (0 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/newcontext-same-deck.html                                (rev 0)
+++ trunk/LayoutTests/wml/newcontext-same-deck.html        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;../fast/js/resources/js-test-style.css&quot;&gt;
+&lt;script&gt;var relativePathToLayoutTests = &quot;..&quot;;&lt;/script&gt;
+&lt;script src=&quot;resources/WMLTestCase.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../fast/js/resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;h1&gt;WML layout tests - using XHTML scripting&lt;/h1&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script src=&quot;resources/newcontext-same-deck.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestswmlresourcesWMLTestCasejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/wml/resources/WMLTestCase.js (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/resources/WMLTestCase.js        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/LayoutTests/wml/resources/WMLTestCase.js        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -9,17 +9,18 @@
</span><span class="cx">     return testDocument.createElementNS(wmlNS, &quot;wml:&quot; + name);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function createWMLTestCase(testDescription, substitutesVariables, testName) {
</del><ins>+function createWMLTestCase(testDescription, substitutesVariables, testName, executeImmediately) {
</ins><span class="cx">     // Setup default test options
</span><span class="cx">     if (substitutesVariables == null) {
</span><span class="cx">         substitutesVariables = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Setup default test name
</span><del>-    var usesDefaultTestDocument = false;
</del><span class="cx">     if (testName == null) {
</span><del>-        usesDefaultTestDocument = true;
</del><ins>+        executeImmediately = false; // Only honored, when testName != null
</ins><span class="cx">         testName = relativePathToLayoutTests + &quot;/wml/resources/test-document.wml&quot;;
</span><ins>+    } else if (executeImmediately == null) {
+        executeImmediately = true;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Initialize JS test
</span><span class="lines">@@ -49,6 +50,7 @@
</span><span class="cx">                 setupTestDocument();
</span><span class="cx">             }
</span><span class="cx"> 
</span><ins>+            assureLayout();
</ins><span class="cx">             executeTest();
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -62,8 +64,9 @@
</span><span class="cx">         testDocument.initializeWMLPageState();
</span><span class="cx"> 
</span><span class="cx">         // Handle the case of a special WML test document. That's always the case for static WML testcases
</span><del>-        //(which are NOT created manually using JS in prepareTest). Fire off test immediately for those.
-        if (!usesDefaultTestDocument) {
</del><ins>+        // (which are NOT created manually using JS in prepareTest). Fire off test immediately for those.
+        if (executeImmediately) {
+            assureLayout();
</ins><span class="cx">             executeTest();
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -71,7 +74,20 @@
</span><span class="cx">     bodyElement.insertBefore(iframeElement, document.getElementById(&quot;description&quot;));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function triggerUpdate(x, y) {
</del><ins>+function assureLayout() {
+    // Assure initial layout finished (variable substitions happen on attach time)
+    var cards = testDocument.getElementsByTagName(&quot;card&quot;);
+    for (var i = 0; i &lt; cards.length; ++i) {
+        cards[i].offsetTop;
+    }
+}
+
+function startTest(x, y) {
+    assureLayout();
+    triggerMouseEvent(x, y);
+}
+
+function triggerMouseEvent(x, y) {
</ins><span class="cx">     // Translation due to HTML content above the WML document in the iframe
</span><span class="cx">     x = x + iframeElement.offsetLeft;
</span><span class="cx">     y = y + iframeElement.offsetTop;
</span><span class="lines">@@ -83,11 +99,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function startTest(x, y) {
-    // Assure first layout finished
-    window.setTimeout(&quot;triggerUpdate(&quot; + x + &quot;, &quot; + y + &quot;)&quot;, 0);
-}
-
</del><span class="cx"> function completeTest() {
</span><span class="cx">     var script = document.createElementNS(xhtmlNS, &quot;script&quot;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestswmlresourcesnewcontextsamedeckjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/wml/resources/newcontext-same-deck.js (0 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/resources/newcontext-same-deck.js                                (rev 0)
+++ trunk/LayoutTests/wml/resources/newcontext-same-deck.js        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+/// [Name] newcontext-same-deck.js
+
+createWMLTestCase(&quot;Tests newcontext attribute handling on cards within the same deck&quot;, true, &quot;resources/newcontext-same-deck.wml&quot;, false);
+
+var counter = 0;
+
+var result1;
+var result2;
+var result3;
+
+function setupTestDocument() {
+    result1 = testDocument.getElementById(&quot;result1&quot;);
+    result2 = testDocument.getElementById(&quot;result2&quot;);
+    result3 = testDocument.getElementById(&quot;result3&quot;);
+}
+
+function prepareTest() {
+    startTest(25, 15);
+}
+
+function executeTest() {
+    if (counter == 0) {
+        shouldBeEqualToString(&quot;result1.textContent&quot;, &quot;Test 1/3: var1=''&quot;);
+        startTest(25, 15);
+    } else if (counter == 1) {
+        shouldBeEqualToString(&quot;result2.textContent&quot;, &quot;Test 2/3: var1=''&quot;);
+        shouldBeEqualToString(&quot;result3.textContent&quot;, &quot;Test 3/3: var2='PASS'&quot;);
+        completeTest();
+    }
+
+    ++counter;
+}
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestswmlresourcesnewcontextsamedeckwml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/wml/resources/newcontext-same-deck.wml (0 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/resources/newcontext-same-deck.wml                                (rev 0)
+++ trunk/LayoutTests/wml/resources/newcontext-same-deck.wml        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot;?&gt;
+&lt;!DOCTYPE wml PUBLIC &quot;-//WAPFORUM//DTD WML 1.1//EN&quot; &quot;http://www.wapforum.org/DTD/wml_1.1.xml&quot;&gt;
+&lt;wml&gt;
+    &lt;card id=&quot;one&quot;&gt;
+       &lt;do type=&quot;accept&quot; label=&quot;Next test&quot;&gt;
+            &lt;go href=&quot;#two&quot;&gt;
+                &lt;setvar name=&quot;var1&quot; value=&quot;PASS&quot;/&gt;
+            &lt;/go&gt;
+        &lt;/do&gt;
+    &lt;/card&gt;
+
+    &lt;card id=&quot;two&quot; newcontext=&quot;true&quot;&gt;
+        &lt;do type=&quot;accept&quot; label=&quot;Next test&quot;&gt;
+            &lt;go href=&quot;#three&quot;&gt;
+                &lt;setvar name=&quot;var2&quot; value=&quot;PASS&quot;/&gt;
+            &lt;/go&gt;
+        &lt;/do&gt;
+        &lt;p id=&quot;result1&quot;&gt;Test 1/3: var1='$var1'&lt;/p&gt;
+    &lt;/card&gt;
+
+    &lt;card id=&quot;three&quot;&gt;
+        &lt;p id=&quot;result2&quot;&gt;Test 2/3: var1='$var1'&lt;/p&gt;
+        &lt;p id=&quot;result3&quot;&gt;Test 3/3: var2='$var2'&lt;/p&gt;
+    &lt;/card&gt;
+&lt;/wml&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestswmlresourcesselectelementvariablesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/wml/resources/select-element-variables.js (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/resources/select-element-variables.js        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/LayoutTests/wml/resources/select-element-variables.js        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function prepareTest() {
</span><del>-    shouldBeEqualToString(&quot;resultElement.textContent&quot;, &quot;Selection result: '$result'&quot;);
</del><ins>+    shouldBeEqualToString(&quot;resultElement.textContent&quot;, &quot;Selection result: ''&quot;);
</ins><span class="cx">     startTest(25, 15);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestswmlselectelementvariablesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/wml/select-element-variables-expected.txt (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/select-element-variables-expected.txt        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/LayoutTests/wml/select-element-variables-expected.txt        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS resultElement.textContent is &quot;Selection result: '$result'&quot;
</del><ins>+PASS resultElement.textContent is &quot;Selection result: ''&quot;
</ins><span class="cx"> PASS resultElement.textContent is &quot;Selection result: 'doggy'&quot;
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestswmlvariablereferenceinvalidcharacterexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/wml/variable-reference-invalid-character-expected.txt (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/wml/variable-reference-invalid-character-expected.txt        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/LayoutTests/wml/variable-reference-invalid-character-expected.txt        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -2,6 +2,8 @@
</span><span class="cx"> CONSOLE MESSAGE: line 0: A variable reference uses invalid syntax.
</span><span class="cx"> CONSOLE MESSAGE: line 0: A variable reference uses invalid syntax.
</span><span class="cx"> CONSOLE MESSAGE: line 0: A variable reference uses invalid syntax.
</span><ins>+CONSOLE MESSAGE: line 0: A variable reference uses invalid syntax.
+CONSOLE MESSAGE: line 0: A variable reference uses invalid syntax.
</ins><span class="cx"> WML layout tests - using XHTML scripting
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/WebCore/ChangeLog        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -2,6 +2,20 @@
</span><span class="cx"> 
</span><span class="cx">         Reviewed by George Staikos.
</span><span class="cx"> 
</span><ins>+        [WML] Variable substitution is buggy
+        https://bugs.webkit.org/show_bug.cgi?id=27677
+
+        Substitute variables upon attach() time instead of insertedIntoDocument(). Otherwhise variable substitution
+        won't work during inter-deck jumps (same URL, different fragment). Covered by new test fast/wml/newcontext-same-deck.html.
+
+        * dom/Text.cpp:
+        (WebCore::Text::attach):
+        * dom/Text.h:
+
+2009-07-25  Nikolas Zimmermann  &lt;nikolas.zimmermann@torchmobile.com&gt;
+
+        Reviewed by George Staikos.
+
</ins><span class="cx">         [WML] WMLDoElement doesn't update its RenderButton object upon attach()
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=27676
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Text.cpp (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Text.cpp        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/WebCore/dom/Text.cpp        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -260,6 +260,19 @@
</span><span class="cx"> 
</span><span class="cx"> void Text::attach()
</span><span class="cx"> {
</span><ins>+#if ENABLE(WML)
+    if (document()-&gt;isWMLDocument() &amp;&amp; !containsOnlyWhitespace()) {
+        String text = m_data;
+        ASSERT(!text.isEmpty());
+
+        text = substituteVariableReferences(text, document());
+
+        ExceptionCode code = 0;
+        setData(text, code);
+        ASSERT(!code);
+    }
+#endif
+
</ins><span class="cx">     createRendererIfNeeded();
</span><span class="cx">     CharacterData::attach();
</span><span class="cx"> }
</span><span class="lines">@@ -319,29 +332,6 @@
</span><span class="cx">     return new Text(doc, nodeText);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(WML)
-void Text::insertedIntoDocument()
-{
-    CharacterData::insertedIntoDocument();
-
-    if (!parentNode()-&gt;isWMLElement() || !length())
-        return;
-
-    WMLPageState* pageState = wmlPageStateForDocument(document());
-    if (!pageState-&gt;hasVariables())
-        return;
-
-    String text = data();
-    if (!text.impl() || text.impl()-&gt;containsOnlyWhitespace())
-        return;
-
-    text = substituteVariableReferences(text, document());
-
-    ExceptionCode ec;
-    setData(text, ec);
-}
-#endif
-
</del><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> void Text::formatForDebugger(char *buffer, unsigned length) const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkWebCoredomTexth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Text.h (46394 => 46395)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Text.h        2009-07-25 16:35:07 UTC (rev 46394)
+++ trunk/WebCore/dom/Text.h        2009-07-25 16:43:52 UTC (rev 46395)
</span><span class="lines">@@ -59,10 +59,6 @@
</span><span class="cx"> 
</span><span class="cx">     static PassRefPtr&lt;Text&gt; createWithLengthLimit(Document*, const String&amp;, unsigned&amp; charsLeft, unsigned maxChars = cTextNodeLengthLimit);
</span><span class="cx"> 
</span><del>-#if ENABLE(WML)
-    virtual void insertedIntoDocument();
-#endif
-
</del><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     virtual void formatForDebugger(char* buffer, unsigned length) const;
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>