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.