Adjust PNG encoder color type to match what's read from gl2

This should fix images produced by the -o flag.
Drain compositor_chan on shutdown, causes deadlocks on constellation

Constellation blocks on SetId by sending a Port through the compositor
channel and waits for a response.  If the compositor is in the process of
shutting down, it will not look in the queue again.  The compositor
requires the constellation to be shut down first, so it sends a message
to shut down and blocks until the constellation finishes, deadlocking.

Only very short lived executions would've been likely to see this deadlock.
auto merge of #1415 : dhedlund/servo/constellation_deadlock, r=pcwalton

Constellation blocks on SetId by sending a Port through the compositor channel and waits for a response.  If the compositor is in the process of shutting down, it will not look in the queue again.  The compositor requires the constellation to be shut down first, so it sends a message to shut down and blocks until the constellation finishes, deadlocking.

Only very short lived executions would've been likely to see this deadlock.

_It is technically still possible to trigger a SetId message between when the compositor finishes running and when the constellation shuts down, but the window for exposure is greatly reduced.  I've only seen it with "-o" so far._
auto merge of #1393 : pcwalton/servo/optimize-css, r=pcwalton

This is a 27% improvement in CSS selector matching performance.

r? @SimonSapin
auto merge of #1413 : dhedlund/servo/png_color_type, r=pcwalton

This should fix images produced by the -o flag.

The gl2::read_pixels call was asking for pixel data in RGB8 but was then telling the PNG encoder that the data was RGBA8.  The value was originally set correctly, but was changed when support was added for drawing transparent PNGs.

We could instead adjust the gl2::read_pixels call to return RGBA8 so we can write transparent screenshots, but I'm not sure if there's a use case for that.
Don't perform composite unless renderer has indicated it's idle

The rendergl::render_scene() function is being called more often than
it needs to be, sometimes before the renderer has finished.  This
could result in PNG images that are drawn before the frame trees set
in SetIds is rendered.
Ensure render and layout tasks get destructed before main thread finishes

Fixes #1097.
auto merge of #1411 : dhedlund/servo/_1097_2, r=pcwalton

Pipeline now blocks on `Pipeline.exit()` and waits for confirmation that RenderTask and LayoutTask were successfully destructed (they're created inside a block which ensures they go out of scope before the message is sent.

Other notable changes include:
* The blocking recv in main/servo.rc that waits for a constellation exit confirmation was moved out of the spawn and into the main thread.  `Constellation::start()` spawns a new task, so there's no need to block in that task once the ExitMsg is sent off.

* Application initialization was moved out of `run_compositor` and into `CompositorTask`, so it could be stored with the compositor task and not go out of scope until the program's main block finishes.

I had to use SharedPort<()> objects to work around the fact that pipelines get cloned, even though it feels like pipelines should probably be ref counted instead.  I went down that route for a few hours but got bogged down trying to wrap my head around some region/lifetime issues; I would be happy to work on that part again, but would need some mentoring to help me figure out what I was doing wrong and possibly why.  The current solution doesn't feel too bad though.

Fixes #1097.
Add comments and improve performance of a comparison
Track whether first render has run, not whether it's currently idle
auto merge of #1418 : dhedlund/servo/composite_when_ready, r=pcwalton

The rendergl::render_scene() function is being called more often than it needs to be, sometimes before the renderer has finished.  This could result in PNG images that are drawn before the frame trees set in SetIds is rendered.
Add `CompositorTask::create()` to initialize and start CompositorTask.
auto merge of #1419 : saneyuki/servo/create, r=pcwalton

This hide initializing steps of `CompositorTask` to make it easy to handle variables which related to compositor code.

Related: #1351.
Added recognition of positioned offsets

  top, bottom, right, and left
auto merge of #1407 : ibnc/servo/positioned_box_offsets, r=metajack

For #1406

Not really sure about some of my naming conventions, but offset was kinda taken in box.rs :/

Also this doesn't fully implement the offsets, but I'll do that alongside #782.
layout: Stop going to the DOM to guess width.
layout: Stop going to the DOM for text alignment.

Verified against the existing text alignment reftests.
layout: Stop going to the DOM for vertical align font sizing.
layout: Change a couple of `Box::new` calls that accessed the nodes into
`Box::transform`.
layout: Replace `AbstractNode`s in layout with `OpaqueNode`, preventing
DOM access during reflow.