Revert r174436 (Reduce the cost of the n^2 loop in collectTreeBoundaryCrossingRules)

https://src.chromium.org/viewvc/blink?view=rev&revision=174436

r174436 was introduced to improve the performance, but
introduced some regressions for shadow styling.

Added a layout test based on the report in issue 383366
to prevent the same regression again.

BUG=383366, 372083
TEST=pass all layout tests.

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

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