Common invalidateTreeIfNeeded()

Extract common part of invalidateTreeIfNeeded() of
RenderLayerModelObject and RenderSVGModelObject.

This is preparation of letting setShouldDoFullPaintInvalidation() work
for RenderText (to avoid invalidatePaintForWholeRenderer from
DocumentMarkerController).

No functional change.

BUG=394133

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

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