Update HTMLElement.dir / Document.dir to return only known values

Update HTMLElement.dir / Document.dir to return only known values ('ltr',
'rtl', 'auto'), in their canonical form, as per the specification:
- http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-dir
- http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#limited-to-only-known-values

Previously, Chromium was returning the 'dir' value exactly as set, no matter if
it is a known value or not, and no matter its case.

The new behavior is consistent with Firefox 28. The behavior of IE11 is
slightly different:
- When setting an unknown 'dir' value, an exception will be thrown.
- Setting a known 'dir' value in a non-canonical case (e.g. "RTL"), the value
  will be directly converted to its canonical form (e.g. "rtl") before updating
  the DOM tree.

R=arv@chromium.org,tkent@chromium.org
BUG=363628
TEST=fast/dom/document-dir-property.html

Review URL: https://codereview.chromium.org/240243004

git-svn-id: svn://svn.chromium.org/blink/trunk@171861 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Skip invalidations for zero size objects.

When doing an incremental invalidation we can endup issuing the same
invalidation twice if either of the new bounds or old bounds is zero sized.

This CL adds a check so we can just issue one invalidation in case either of
the bounds are zero sized and exit early.

BUG=320139

Review URL: https://codereview.chromium.org/235983004

git-svn-id: svn://svn.chromium.org/blink/trunk@171862 bbb929c8-8fbe-4397-9dbb-9b2b20218538