Bug 1067728 Part 1 - Generalize scroll frame boundary checking logic. f=mtseng, r=roc
Bug 1067728 - Part 1.1 - Move IsRectVisibleInScrollFrames to nsLayoutUtils. f=mtseng, r=roc
Bug 1067728 - Part 2 - Hide start or end selection caret if it's out of scroll frame. f=mtseng, r=roc

nsLayoutUtils::IsRectVisibleInScrollFrames() had been used by
TouchCaret. We do the similar check for SelectionCarets.
Bug 1067728 - Part 3 - Expose FindNearestCommonAncestorFrame. r=roc
Bug 1067728 - Part 4 - Refactor two functions in SeletionCarets. r=roc

Make DispatchSelectionStateChangedEvent() and GetSelectionBoundingRect()
become member functions of SeletionCarets so that they are easier to use
in later patches.
Bug 1067728 - Part 5 - Dispatch updateposition after scroll end and reflow. r=roc, sr=smaug

Add a selection state "updateposition" and a field "visible" to indicate
that the current selection's boundingClientRect or visible is changed.
We dispatch this state after scrolling or reflowing is done.