From a43c73c52fe053a77eea378cb49bc368adf05825 Mon Sep 17 00:00:00 2001 From: Elliott Sprehn Date: Fri, 23 Jan 2015 16:50:00 -0800 Subject: [PATCH] Add the element and ignore whitespace outside it. We now only preserve the whitespace inside a 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 --- .../tests/lowlevel/abarth-expected.txt | 1 - .../flutter/tests/parser/control-expected.txt | 4 +- .../flutter/tests/parser/endtag-expected.txt | 14 +++---- .../flutter/tests/parser/entity-expected.txt | 32 +++++++-------- .../flutter/tests/parser/html-expected.txt | 19 ++++++--- .../flutter/tests/parser/script-expected.txt | 39 +++++++------------ .../tests/parser/starttag-expected.txt | 34 +++++++--------- .../flutter/tests/parser/style-expected.txt | 28 ++++++------- .../flutter/tests/parser/voidtag-expected.txt | 30 +++++--------- .../tests/parser/whitespace-expected.txt | 28 +++++++++++++ .../src/flutter/tests/parser/whitespace.sky | 33 ++++++++++++++++ 11 files changed, 149 insertions(+), 113 deletions(-) create mode 100644 engine/src/flutter/tests/parser/whitespace-expected.txt create mode 100644 engine/src/flutter/tests/parser/whitespace.sky diff --git a/engine/src/flutter/tests/lowlevel/abarth-expected.txt b/engine/src/flutter/tests/lowlevel/abarth-expected.txt index 51749344b6..2bd63bcf68 100644 --- a/engine/src/flutter/tests/lowlevel/abarth-expected.txt +++ b/engine/src/flutter/tests/lowlevel/abarth-expected.txt @@ -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 diff --git a/engine/src/flutter/tests/parser/control-expected.txt b/engine/src/flutter/tests/parser/control-expected.txt index dbe196fcb5..626570434c 100644 --- a/engine/src/flutter/tests/parser/control-expected.txt +++ b/engine/src/flutter/tests/parser/control-expected.txt @@ -1,6 +1,6 @@ - - + + THIS TEST SHOULD PASS (control test for success) diff --git a/engine/src/flutter/tests/parser/endtag-expected.txt b/engine/src/flutter/tests/parser/endtag-expected.txt index 3ac826c6c4..3ec44cd320 100644 --- a/engine/src/flutter/tests/parser/endtag-expected.txt +++ b/engine/src/flutter/tests/parser/endtag-expected.txt @@ -1,11 +1,11 @@ - - - -1 -2 -3 -4;> + + + 1 + 2 + 3 + 4;> + diff --git a/engine/src/flutter/tests/parser/entity-expected.txt b/engine/src/flutter/tests/parser/entity-expected.txt index 84a78d314d..a1fe00d47e 100644 --- a/engine/src/flutter/tests/parser/entity-expected.txt +++ b/engine/src/flutter/tests/parser/entity-expected.txt @@ -1,19 +1,19 @@ - - -
aaa'bbb
-
<
-
aaa�bbb
-
A
-
&
-
&#
-
&#x
-
&#x41
-
&;
-
&#;
-
&#x;
-
A
-
�
- + + +
aaa'bbb
+
<
+
aaa�bbb
+
A
+
&
+
&#
+
&#x
+
&#x41
+
&;
+
&#;
+
&#x;
+
A
+
�
+ diff --git a/engine/src/flutter/tests/parser/html-expected.txt b/engine/src/flutter/tests/parser/html-expected.txt index 9a58594dfe..e910c277fe 100644 --- a/engine/src/flutter/tests/parser/html-expected.txt +++ b/engine/src/flutter/tests/parser/html-expected.txt @@ -1,7 +1,7 @@ <!DOCTYPE HTML> - - + + A <!DOCTYPE HTMLAGAIN> B <!BOGUSCOMMENT> @@ -11,13 +11,20 @@ G <! -- -- > H I J -K
+K +
+ +
L M

N O

P -Q - -
+Q + + + + diff --git a/engine/src/flutter/tests/parser/script-expected.txt b/engine/src/flutter/tests/parser/script-expected.txt index ba7de047b3..f8e0a3029f 100644 --- a/engine/src/flutter/tests/parser/script-expected.txt +++ b/engine/src/flutter/tests/parser/script-expected.txt @@ -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 - - - - - - - - + - - - - - + + < script -> TEST - - - - - - - - + + diff --git a/engine/src/flutter/tests/parser/starttag-expected.txt b/engine/src/flutter/tests/parser/starttag-expected.txt index 90b05d1bfc..0e6d2d046d 100644 --- a/engine/src/flutter/tests/parser/starttag-expected.txt +++ b/engine/src/flutter/tests/parser/starttag-expected.txt @@ -1,28 +1,24 @@ - - - - 1 - -2 -3 -4 -5 -6 -7 + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 < a>8</ a> <.a>9 -<_a>a -<-a>b + <_a>a + <-a>b <!a>c</!a> <%a>d</%a> - - - - - - + + + + diff --git a/engine/src/flutter/tests/parser/style-expected.txt b/engine/src/flutter/tests/parser/style-expected.txt index 23df5d5042..4f67060150 100644 --- a/engine/src/flutter/tests/parser/style-expected.txt +++ b/engine/src/flutter/tests/parser/style-expected.txt @@ -1,24 +1,20 @@ - - - - - - - - + & TEST - - & TEST - - + < style @@ -40,12 +35,10 @@ style style> & TEST - - - - @@ -53,3 +46,4 @@ style> + diff --git a/engine/src/flutter/tests/parser/voidtag-expected.txt b/engine/src/flutter/tests/parser/voidtag-expected.txt index 53031b9ace..dc641b6292 100644 --- a/engine/src/flutter/tests/parser/voidtag-expected.txt +++ b/engine/src/flutter/tests/parser/voidtag-expected.txt @@ -1,23 +1,11 @@ - - - -

a -

a -

a -

a -

a

-

a

-

a

-

a -

a -

a -

a -

a -

a

-

a -

a

-

a - - + + +

a

a

a

a

a

+

a

+

a

+

a

a

a

a

a

a

+

a

a

+

a + diff --git a/engine/src/flutter/tests/parser/whitespace-expected.txt b/engine/src/flutter/tests/parser/whitespace-expected.txt new file mode 100644 index 0000000000..e0b75ffca6 --- /dev/null +++ b/engine/src/flutter/tests/parser/whitespace-expected.txt @@ -0,0 +1,28 @@ + + + + + A +
+ + + + + + +
+
+ + + + + B +
+
+ + A + + B +
+
+ diff --git a/engine/src/flutter/tests/parser/whitespace.sky b/engine/src/flutter/tests/parser/whitespace.sky new file mode 100644 index 0000000000..8f56106a5e --- /dev/null +++ b/engine/src/flutter/tests/parser/whitespace.sky @@ -0,0 +1,33 @@ + + + + + + A +
+ + + + + + +
+
+ + + + + B +
+ +
+ + A + + + + + B +
+ +
\ No newline at end of file