Avoid null Node pointers in theme painting code

A recent change to reduce the dependence of theme
code on layout objects changed painting code to take Node
objects instead of LayoutObjects. However, Node can be null
for anonymous layout objects, and the theme code crashes
when accessing this null node in numerous places.

As part of this patch, all of the uses of Node in the theme
painting code were audited to identify potential null accesses.
The sites affected have been changed to either check for null
or take a Document as an argument to avoid the node access.

R=eae@chromium.org
BUG=782817,779377

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I409ea5f16f462d959cf2864b7019ca9ca0bf22c2
Reviewed-on: https://chromium-review.googlesource.com/764447
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516175}
11 files changed