Add the <t> element and ignore whitespace outside it.
We now only preserve the whitespace inside a <t> element inside the parser. This removes the known n^2 from reattaching whitespace which should make parsing and appending nodes faster. I also removed the dead WhitespaceMode code from the parser, and made the dom-seralizer.sky auto indent the markup so the test output would be readable. R=abarth@chromium.org Review URL: https://codereview.chromium.org/867963006
This commit is contained in:
@@ -41,5 +41,4 @@ layer at (686,582) size 114x18
|
||||
RenderInline {a} at (0,0) size 36x12
|
||||
RenderText {#text} at (75,3) size 36x12
|
||||
text run at (75,3) width 36: "J\x{E9}r\x{F4}me"
|
||||
RenderText {#text} at (0,0) size 0x0
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
THIS TEST SHOULD PASS
|
||||
(control test for success)
|
||||
</body>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
|
||||
<diva>1</diva>
|
||||
<divb>2</divb>
|
||||
<divc>3</divc>
|
||||
<divd>4</divd>;>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<diva>1</diva>
|
||||
<divb>2</divb>
|
||||
<divc>3</divc>
|
||||
<divd>4</divd>;>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<div>aaa'bbb</div>
|
||||
<div><</div>
|
||||
<div>aaa<61>bbb</div>
|
||||
<div foo="bar ">A</div>
|
||||
<div>&</div>
|
||||
<div>&#</div>
|
||||
<div>&#x</div>
|
||||
<div>&#x41</div>
|
||||
<div>&;</div>
|
||||
<div>&#;</div>
|
||||
<div>&#x;</div>
|
||||
<div>A</div>
|
||||
<div><3E></div>
|
||||
</body>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<div>aaa'bbb</div>
|
||||
<div><</div>
|
||||
<div>aaa<61>bbb</div>
|
||||
<div foo="bar ">A</div>
|
||||
<div>&</div>
|
||||
<div>&#</div>
|
||||
<div>&#x</div>
|
||||
<div>&#x41</div>
|
||||
<div>&;</div>
|
||||
<div>&#;</div>
|
||||
<div>&#x;</div>
|
||||
<div>A</div>
|
||||
<div><3E></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
|
||||
A <!DOCTYPE HTMLAGAIN>
|
||||
B <!BOGUSCOMMENT>
|
||||
@@ -11,13 +11,20 @@ G <! -- -- >
|
||||
H <image></image>
|
||||
I <keygen>
|
||||
J <isindex>
|
||||
K <table><div></div><input type="hidden"></input></table>
|
||||
K <table>
|
||||
<div></div>
|
||||
<input type="hidden"></input>
|
||||
</table>
|
||||
L <frameset></frameset>
|
||||
M <p></p>
|
||||
N
|
||||
O <br></br>
|
||||
P
|
||||
Q <template><div>contents</div></template>
|
||||
|
||||
</isindex></keygen></body>
|
||||
Q <template>
|
||||
<div>contents</div>
|
||||
</template>
|
||||
</isindex>
|
||||
</keygen>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -13,45 +13,36 @@ SOURCE: http://127.0.0.1:8000/sky/tests/parser/script.sky:38
|
||||
ERROR: Uncaught SyntaxError: Unexpected token }
|
||||
SOURCE: http://127.0.0.1:8000/sky/tests/parser/script.sky:43
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<script>
|
||||
TEST <a></a>
|
||||
</script>
|
||||
|
||||
<SCRIPT>
|
||||
<SCRIPT>
|
||||
TEST <a></a>
|
||||
</SCRIPT>
|
||||
|
||||
<script>
|
||||
</SCRIPT>
|
||||
<script>
|
||||
<SCRIPT>
|
||||
TEST <a></a>
|
||||
</SCRIPT>
|
||||
</script>
|
||||
|
||||
<SCRIPT>
|
||||
<script>
|
||||
<SCRIPT>
|
||||
<script>
|
||||
TEST <a></a>
|
||||
</SCRIPT>
|
||||
</script>
|
||||
</SCRIPT>
|
||||
|
||||
<script> TEST </script>
|
||||
</SCRIPT>
|
||||
<script> TEST </script>
|
||||
|
||||
<
|
||||
script
|
||||
> TEST
|
||||
|
||||
<script> TEST </
|
||||
> TEST <script> TEST </
|
||||
script>
|
||||
</script>
|
||||
|
||||
<script> TEST </scrip>
|
||||
<script> TEST </scrip>
|
||||
</script>
|
||||
|
||||
<script> TEST <//script>
|
||||
<script> TEST <//script>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
|
||||
<a>1</a>
|
||||
|
||||
<a>2</a>
|
||||
<a.>3</a.>
|
||||
<a_>4</a_>
|
||||
<a->5</a->
|
||||
<a!>6</a!>
|
||||
<a%>7</a%>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<a>1</a>
|
||||
<a>2</a>
|
||||
<a.>3</a.>
|
||||
<a_>4</a_>
|
||||
<a->5</a->
|
||||
<a!>6</a!>
|
||||
<a%>7</a%>
|
||||
|
||||
< a>8</ a>
|
||||
<.a>9</.a>
|
||||
<_a>a</_a>
|
||||
<-a>b</-a>
|
||||
<_a>a</_a>
|
||||
<-a>b</-a>
|
||||
<!a>c</!a>
|
||||
<%a>d</%a>
|
||||
|
||||
<a _a=""></a>
|
||||
|
||||
<a foo="bar" <="" a=""></a>
|
||||
|
||||
<a a1="" a2="xx=xx" a3="&" a4="&#" a5="&#x" a6="&#x1" a7="" a8="&#1" a9="" aa="&a" ab="<22>" ac="&;" ad="a" ae="<" af="&lt" ag="<22>" b3="&" b4="&#" b5="&#x" b6="&#x1" b7="" b8="&#1" b9="" ba="&a" bb="<22>" bc="&;" bd="a" be="<" bf="&lt" bg="<22>" c3="&" c4="&#" c5="&#x" c6="&#x1" c7="" c8="&#1" c9="" ca="&a" cb="<22>" cc="&;" cd="a" ce="<" cf="&lt" cg="<22>">
|
||||
|
||||
</a></body>
|
||||
<a foo="bar" <="" a=""></a>
|
||||
<a a1="" a2="xx=xx" a3="&" a4="&#" a5="&#x" a6="&#x1" a7="" a8="&#1" a9="" aa="&a" ab="<22>" ac="&;" ad="a" ae="<" af="&lt" ag="<22>" b3="&" b4="&#" b5="&#x" b6="&#x1" b7="" b8="&#1" b9="" ba="&a" bb="<22>" bc="&;" bd="a" be="<" bf="&lt" bg="<22>" c3="&" c4="&#" c5="&#x" c6="&#x1" c7="" c8="&#1" c9="" ca="&a" cb="<22>" cc="&;" cd="a" ce="<" cf="&lt" cg="<22>"></a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
|
||||
<style>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<style>
|
||||
& TEST <a></a>
|
||||
</style>
|
||||
|
||||
<STYLE>
|
||||
<STYLE>
|
||||
& TEST <a></a>
|
||||
</STYLE>
|
||||
|
||||
<style>
|
||||
</STYLE>
|
||||
<style>
|
||||
& TEST
|
||||
<STYLE>
|
||||
& TEST <a></a>
|
||||
</STYLE>
|
||||
& TEST
|
||||
</style>
|
||||
|
||||
<STYLE>
|
||||
<STYLE>
|
||||
& TEST
|
||||
<style>
|
||||
TEST <a></a>
|
||||
@@ -27,8 +23,7 @@
|
||||
</style>
|
||||
& TEST
|
||||
</STYLE>
|
||||
|
||||
<style> TEST </style>
|
||||
<style> TEST </style>
|
||||
|
||||
<
|
||||
style
|
||||
@@ -40,12 +35,10 @@ style
|
||||
style>
|
||||
& TEST
|
||||
</style>
|
||||
|
||||
<style> & TEST </styl>
|
||||
<style> & TEST </styl>
|
||||
& TEST
|
||||
</style>
|
||||
|
||||
<style> & TEST <//style>
|
||||
<style> & TEST <//style>
|
||||
& TEST
|
||||
</style>
|
||||
|
||||
@@ -53,3 +46,4 @@ style>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
<html>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
|
||||
<p></p> a
|
||||
<p></p> a
|
||||
<p test=""></p> a
|
||||
<p test=""></p> a
|
||||
<p test="/"> a </p>
|
||||
<p test="/"> a </p>
|
||||
<p test="a/"> a </p>
|
||||
<p test="a"></p> a
|
||||
<p test="a"></p> a
|
||||
<p test="a"></p> a
|
||||
<p test="a"></p> a
|
||||
<p test="a"></p> a
|
||||
<p test="&/"> a </p>
|
||||
<p test="&"></p> a
|
||||
<p test="a/"> a </p>
|
||||
<p test="a"></p> a
|
||||
|
||||
</body>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<body>
|
||||
<p></p> a <p></p> a <p test=""></p> a <p test=""></p> a <p test="/"> a </p>
|
||||
<p test="/"> a </p>
|
||||
<p test="a/"> a </p>
|
||||
<p test="a"></p> a <p test="a"></p> a <p test="a"></p> a <p test="a"></p> a <p test="a"></p> a <p test="&/"> a </p>
|
||||
<p test="&"></p> a <p test="a/"> a </p>
|
||||
<p test="a"></p> a </body>
|
||||
</html>
|
||||
|
||||
|
||||
28
engine/src/flutter/tests/parser/whitespace-expected.txt
Normal file
28
engine/src/flutter/tests/parser/whitespace-expected.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
<sky>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
<t>
|
||||
<span>
|
||||
A
|
||||
<div>
|
||||
<span></span>
|
||||
|
||||
|
||||
|
||||
|
||||
<span></span>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
<span>B</span>
|
||||
</t>
|
||||
<div>
|
||||
<span>
|
||||
A
|
||||
</span>
|
||||
<span>B</span>
|
||||
</div>
|
||||
</sky>
|
||||
|
||||
33
engine/src/flutter/tests/parser/whitespace.sky
Normal file
33
engine/src/flutter/tests/parser/whitespace.sky
Normal file
@@ -0,0 +1,33 @@
|
||||
<sky>
|
||||
<import src="../resources/dump-as-markup.sky"></import>
|
||||
|
||||
<t>
|
||||
<span>
|
||||
A
|
||||
<div>
|
||||
<span></span>
|
||||
|
||||
<!-- All whitespace in a subtree should be kept under <t>. -->
|
||||
|
||||
|
||||
<span></span>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
|
||||
<!-- This whitespace should be preserved. -->
|
||||
|
||||
<span>B</span>
|
||||
</t>
|
||||
|
||||
<div>
|
||||
<span>
|
||||
A
|
||||
</span>
|
||||
|
||||
<!-- This whitespace should be ignored. -->
|
||||
|
||||
<span>B</span>
|
||||
</div>
|
||||
|
||||
</sky>
|
||||
Reference in New Issue
Block a user