Correctly invalidate styles before clearing the StyleResolver.

The StyleResolver contains a RuleFeatureSet, which in turn contains
pending style invalidations. Before clearing and rebuilding the StyleResolver,
those pending invalidations need to be processed, or else style recalc may not
happen when necessary.

The StyleResolver object is cleared and rebuilt when adding or removing a style
sheet, or in a couple of other corner cases like changing doc type.

BUG=346873

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

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