Optimize for horizontal writing mode

Optimize layout and painting by avoiding or short-circuiting vertical
writing mode logic unless it is used at least once in a document.

A per-document containsAnyVerticalWritingModes flag is introduced that
is set the first time a vertical writing mode is encountered. Unless
this flag has been set all flipForWritingMode functions short-circuit.
Some of the RenderBox flip methods is moved to the header file to allow
for better inlining.

Early testing indicates a ~10% performance improvement across the board
with 35 of our 42 layout performance tests showing a 6% to 19%
performance improvement. The remaining 7 tests show no significant
improvement and none of them show any regression.

R=dglazkov@chromium.org, pdr@chromium.org
BUG=425364
TEST=PerformanceTests/Layout

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

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