StyleElement and ScriptElement should share more

Both StyleElement and ScriptElement were doing the same work to get the text of
all their Text node children. Unfortunately, the code was duplicated and had
different optimizations.

This CL combines the two implementations into one and applies all the
optimizations.

R=esprehn

Review URL: https://chromiumcodereview.appspot.com/17063017

git-svn-id: svn://svn.chromium.org/blink/trunk@152920 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Mock resource in CachedImageTest.CancelOnDetach

R=abarth@chromium.org,japhet@chromium.org

Review URL: https://chromiumcodereview.appspot.com/17444012

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