Commit graph

69 commits

Author SHA1 Message Date
Anthony Ramine
c831c2c0a5 Remove helper traits
Now that JSRef<T> is gone, there is no need to have helper traits.

On components/script/*.rs:

    # Remove imports.
    /^ *use dom::[a-z]+::\{.*Helpers/ {
        s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/
        s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g
        s/\{([a-zA-Z]+)\}/\1/
        /\{\}/d
        s/::self;$/;/
    }
    /^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d

On components/script/dom/*.rs:

    # Ignore layout things.
    /^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; }

    # Delete helpers traits.
    /^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D

    # Patch private helpers.
    /^impl.*Private.*Helpers/,/^\}$/ {
        s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

    # Patch public helpers.
    /^impl.*Helpers/,/^\}$/ {
        s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/
        /^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

The few error cases were then fixed by hand.
2015-08-27 16:59:02 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
João Oliveira
067a22a868 Replace uses of for foo in bar.iter(),
and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
2015-08-18 01:46:11 +01:00
Michael Wu
2752d3398e Directly append children to output node in parse_html_fragment 2015-07-15 17:09:26 -04:00
Simon Sapin
34bfa16517 Update to zero-copy* HTML parsing
html5ever now uses the Tendril string type to minimize copying internally,
but Servo still converts from/to `String` at the boundary
(which involves copying).
2015-06-25 20:40:38 -07:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
Josh Matthews
8082df7d0d Make external script sources load asynchronously, yet still block further parsing. Hook up document loading to async networking events. 2015-05-20 14:22:09 -04:00
Josh Matthews
7f0706ed42 Implement a DocumentLoader type that tracks pending loads and notifies the script task when the queue is empty. Dispatch the document load event based on the DocumentLoader's notification. 2015-05-11 13:41:51 -04:00
bors-servo
16a7c792b5 Auto merge of #5931 - nox:rm-helpers, r=jdm
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5931)
<!-- Reviewable:end -->
2015-05-06 01:31:26 -05:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Anthony Ramine
06436e9c79 Remove helpers that correspond to DOM methods 2015-05-04 15:18:27 +02:00
Jinwoo Song
f404853c99 Make NodeTypeId include CharacterData variant
NodeTypeId is supposed to reflect the WebIDL inheritance hierarchy.
All of Text/ProcessingInstruction/Comment inherit from CharacterData,
which inherits from Node. There should be a CharacterDataTypeId value
that differentiates between those, instead.
2015-04-29 13:30:21 +09:00
Anthony Ramine
1a30925cad Remove Temporary::new()
Temporary::from_rooted() now takes an Assignable value.
2015-04-28 09:22:46 +02:00
Anthony Ramine
7197052c0d Uniformise root() methods
They now live in traits Rootable, OptionalOptionalRootable, OptionalRootable
and ResultRootable.
2015-04-28 09:22:45 +02:00
Ms2ger
a862479ca8 Remove as_slice() calls from script. 2015-04-26 10:52:55 +02:00
Ms2ger
41cc0a939e Replace the Str implementation for AttrValue by a Deref implementation. 2015-04-25 15:24:27 +02:00
nithin murali
c5e101b6e5 Implement child reparenting and node removal during parsing. 2015-04-22 13:47:28 -04:00
Dhananjay Nakrani
7cdfc76ea9 Change parse_progress() take JSRef by value. [Issue#5738] 2015-04-19 11:24:45 -07:00
Bogdan Cuza
19ffab82f1 Make Metadata use ContentType 2015-04-14 22:03:21 +03:00
Ms2ger
49393a8762 Update some URLs.
The HTML spec's division into pages is not stable, so it is safer to use the
URL without a specific page (which will redirect).
2015-04-14 10:44:51 +02:00
Anthony Ramine
2411d607d4 Cleanup ProcessingInstruction 2015-04-10 00:32:01 +02:00
Anthony Ramine
8f73b452fb Cleanup access to CharacterData nodes 2015-04-09 16:54:55 +02:00
Anthony Ramine
bf7c791e3a Hold a Temporary in AncestorIterator 2015-04-07 15:46:31 +02:00
Chris Paris
f76a137344 Produce output of fragment parsing in &mut RootedVec<JS<Node>> argument 2015-04-06 12:59:54 -10:00
Chris Paris
ce16075588 Replace spec quotes with spec step numbers 2015-04-06 12:59:53 -10:00
Chris Paris
cc771fdd68 fragment parsing functions take DOMString instead of HTMLInput 2015-04-06 12:56:55 -10:00
Chris Paris
63ced23fca Refactor fragment parsing 2015-04-06 12:54:58 -10:00
Gilles Leblanc
ba36a108c1 Split out shared networking code into net_traits crate
Fixes #4476
2015-04-03 13:38:10 -04:00
Ms2ger
c8106da277 Rewrite NodeChildrenIterator to return Temporary. 2015-04-02 13:07:51 +02:00
Adenilson Cavalcanti
4e9bb15ba7 Instead of panicking on broken url, break from the loop and return. 2015-04-01 15:30:33 +02:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
Ms2ger
1604515fd9 Fix various build warnings. 2015-03-20 17:57:49 +01:00
bors-servo
1236280bea auto merge of #5029 : ChrisParis/servo/h5e-serialize, r=jdm
Fixes https://github.com/servo/servo/issues/3713. Depends on https://github.com/servo/html5ever/pull/100 and https://github.com/servo/html5ever/pull/101.
2015-03-18 18:06:49 -06:00
Chris Paris
a5d6c6a1fc Serialize using html5ever 2015-03-18 12:17:56 -10:00
Chris Paris
99286e4b4f Implement Element.innerHTML setter 2015-03-18 11:20:47 -10:00
Chris Double
618142fac7 Implement displaying of text/plain documents
This is done by detecting the content type as text/plain
and following the requirements from:
https://html.spec.whatwg.org/multipage/browsers.html#read-text
2015-03-17 18:11:33 +13:00
Chris Double
82c52a7a1c Implement view-source protocol. Fixes #4181.
This follows the recommendation from issue #4181. A handler
for 'view-source' delegates to the HTTP loader. In that
loader I check for view-source, adjust the URL to be the
URL to be viewed and modify the Content-Type header to be
text/plain.

This doesn't actually result in the source being
viewed as rendering text/plain is not yet implemented.
2015-03-17 11:06:44 +13:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08:00
Ms2ger
a09a912178 Import net as net rather than servo_net. 2015-02-10 12:55:24 +01:00
Ms2ger
12be33efc9 Use JS<Node> rather than TrustedNodeAddress in the HTML parser. 2015-02-03 16:03:23 +01:00
Ms2ger
505159a464 Import the util crate as util rather than servo_util.
This used to conflict with the util crate from the standard library, which
has long since been removed.

The import in layout has not been changed because of a conflict with the
util mod there.
2015-01-29 12:16:41 +01:00
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
edc1d89251 Deny unsafe blocks in script.
As a first start, this allows them indiscriminately where used.
2015-01-09 10:13:25 +01:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Ms2ger
323daffbf0 Qualify resource_task enums. 2015-01-04 15:47:46 +01:00
Ms2ger
b51e83819d Fix obsolete format traits.
They are to be removed from the language in the next rust upgrade.
2015-01-02 19:04:18 +01:00
Ms2ger
1dad710063 Replace Root::deref() calls by Root::r() calls where possible.
This changes those calls that were already sound.
2015-01-01 20:36:43 +01:00
Chris Paris
96f73d67d4 Use parse_html in DOMParser. 2014-12-17 17:40:38 -10:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Ms2ger
795327d5c4 Pass a borrowed Url to parse_html.
It does not need to take ownership, and I want to reuse final_url in the
caller.
2014-12-09 15:12:01 +01:00