Main part of this diff is caching of selector parts, so it does not get redrawn all the time.
Includes changes to prevent crashes related to bug 399860.
Foreground and background color indicator now display correctly when color profile changes (e.g. are shown as gray if profile is set to grayscale).
CCBUG: 399860