mozilla/servo — pull request #1349 by dhedlund (2013-12-07 18:02:48+00:00)
Title: InlineFlow should always inherit text-width from base style

Fixes #222.

Implements 'text-align' inheritance for inline elements. The text alignment code has been changed a couple of times since the ticket was originally opened and was improved to inherit the text-align property from from an ancestor element. This addressed the issue, so long as no inline elements had a text-align property defined. Both Firefox and Chromium ignore any text-align properties attached to inline elements, but none of the specs are explicit about ignoring the property or inheriting only from non-inline elements:
http://www.w3.org/TR/CSS2/visuren.html#inline-formatting
http://www.w3.org/TR/CSS2/text.html#propdef-text-align

This is my first stab at writing any code that touches the DOM node tree. Based on a few observations, I made the assumption that the `self.base.node` of a InlineFlow always corresponds to a BlockFlow-based node, no matter how deep inline DOM elements are nested; there was no obvious way to traverse Flow-traited objects directly and I'm sure if it's possible to get from a FlowData struct back to a {Block,Inline}Flow (probably intentionally).

I could've kept traversing the node tree directly, checking against each node style to ensure it didn't have an inline display property, but I could not create a scenario where the `base.node` was ever an inline. It also feels like a code smell to be walking up the tree at all, especially for stylesheet properties. Feels like it should eventually be handled in style::properties directly as being conditional inherited?