Don't allow sharing between elements that have different :host styles

Elements can only share style if they either both don't have any
ShadowRoots or they both have ShadowRoots and all their ShadowRoots have
the same styles.

We were incorrectly allowing sharing between elements without shadow roots
and ones with shadow roots, and also allowing sharing between elements that
had styles in an older ShadowRoot but no <shadow> in the younger shadow
root. The second case was previously correct before r170091 when we made
styles apply even when <shadow> was not present.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@171533 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Replace Selection.collapse() with Selection.removeAllRanges() in other layout tests.

There are some tests calling Selection.collapse(null).
Selection.collapse(null) clears the current selection and its behavior is essentially same as Selection.removeAllRanges().
However, the Selection.collapse method is intended to create a range forming a caret:
https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-selection-collapse
Calling Selection.collapse(null) to clear the selection is non-standard and I'm going to change Selection.idl to restrict such a usage.

This CL is similar to previous one: https://src.chromium.org/viewvc/blink?view=rev&revision=171436.

BUG=361954

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

git-svn-id: svn://svn.chromium.org/blink/trunk@171534 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Revert of "Split the invisible-descendants-should-not-affect-opt-in test up.". (https://codereview.chromium.org/232043002)

Reason for revert:
[blink gardening] The following tests failed.
- compositing/overflow/nodisplay-descendants-should-not-affect-opt-in.html
- compositing/overflow/invisible-descendants-should-not-affect-opt-in.html

Dashboard:
- http://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=compositing%2Foverflow%2Finvisible-descendants-should-not-affect-opt-in.html
- http://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=virtual%2Fgpu%2Fcompositedscrolling%2Foverflow%2Fnodisplay-descendants-should-not-affect-opt-in.html

Original issue's description:
> Split the invisible-descendants-should-not-affect-opt-in test up.
>> The test does a for loop over 3 cases, checking if composited is enabled
> at all to determine if we've promoted layers. When ForceCompositingMode
> is on, we can not use this test to verify promotion. So split the
> test's 3 cases into separate tests, and each one dumps the layer tree
> so that we can verify promotion/not correctly.
>
> R=vollick@chromium.org, enne@chromium.org
> BUG=361729

TBR=danakj@chromium.org,vollick@chromium.org,enne@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=361729

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

git-svn-id: svn://svn.chromium.org/blink/trunk@171535 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Web Animations API: Add runtime flag for minimal element.animate feature

Includes:
* element.animate(sequence<Keyframe> effect, optional (double or TimingInput) timing)
* [NoInterfaceObject] AnimationPlayer with only finish event and cancel() method

BUG=327564

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

git-svn-id: svn://svn.chromium.org/blink/trunk@171536 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Web Animations: Break reference cycle keeping Elements alive

We currently have a couple of reference cycles, basically stemming from the
strong pointer Animation->Element. As a result, we will not be able to free
Elements when they have current or in effect Animations, even if there are
no longer any references around (or we've navigated to a separate page!)

This is a temporary patch (until Element is moved to Oilpan) to break the
reference cycles that we have (see referenced bug). We simply change the
Animation->Element pointer to a raw pointer, and clean it upon Element
destruction. Note that this is somewhat incorrect behaviour, since
Animations should keep their target alive if they are still reachable,
but we probably can't easily do this without leaking before we have Oilpan.

BUG=362404

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

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