Bug 1048752. Part 5: Reorder API declarations. r=tn
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 06 Aug 2014 17:19:24 +1200
changeset 199942 e94c0c00ffeddb562dec85a9824de13bf13b1e7e
parent 199941 52109d5178c9a06fc4bff02d2bf03e86bb607d2f
child 199943 49bf30b051038a6e6fe2184d3bd369d34df036a2
push id9784
push userryanvm@gmail.com
push dateSat, 16 Aug 2014 21:45:40 +0000
treeherderb2g-inbound@94ba78a42305 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1048752
milestone34.0a1
Bug 1048752. Part 5: Reorder API declarations. r=tn To make it more clear what's going on, make CaretBlinkCallback protected and reorder the public methods to put the state-changing "API" methods first.
layout/base/nsCaret.h
--- a/layout/base/nsCaret.h
+++ b/layout/base/nsCaret.h
@@ -26,133 +26,126 @@ class nsCaret : public nsISelectionListe
     nsCaret();
 
   protected:
     virtual ~nsCaret();
 
   public:
     NS_DECL_ISUPPORTS
 
-    nsresult    Init(nsIPresShell *inPresShell);
-    void    Terminate();
+    nsresult Init(nsIPresShell *inPresShell);
+    void Terminate();
 
-    nsISelection*    GetCaretDOMSelection();
-    nsresult    SetCaretDOMSelection(nsISelection *inDOMSel);
-
+    nsresult SetCaretDOMSelection(nsISelection *inDOMSel);
+    nsISelection* GetCaretDOMSelection();
+    /**
+     * Sets whether the caret should only be visible in nodes that are not
+     * user-modify: read-only, or whether it should be visible in all nodes.
+     *
+     * @param aIgnoreUserModify true to have the cursor visible in all nodes,
+     *                          false to have it visible in all nodes except
+     *                          those with user-modify: read-only
+     */
+    void SetIgnoreUserModify(bool aIgnoreUserModify);
+    void CheckCaretDrawingState();
+    /** SetCaretVisible will set the visibility of the caret
+     *  @param inMakeVisible true to show the caret, false to hide it
+     */
+    void SetCaretVisible(bool intMakeVisible);
     /** GetCaretVisible will get the visibility of the caret
      *  This function is virtual so that it can be used by nsCaretAccessible
      *  without linking
      *  @param outMakeVisible true if it is shown, false if it is hidden
      *  @return NS_OK
      */
-    virtual nsresult    GetCaretVisible(bool *outMakeVisible);
-
-    /** SetCaretVisible will set the visibility of the caret
-     *  @param inMakeVisible true to show the caret, false to hide it
-     */
-    void    SetCaretVisible(bool intMakeVisible);
-
+    virtual nsresult GetCaretVisible(bool *outMakeVisible);
     /** SetCaretReadOnly set the appearance of the caret
      *  @param inMakeReadonly true to show the caret in a 'read only' state,
      *         false to show the caret in normal, editing state
      */
-    void    SetCaretReadOnly(bool inMakeReadonly);
+    void SetCaretReadOnly(bool inMakeReadonly);
+    /**
+     * @param aVisibility true if the caret should be visible even when the
+     * selection is not collapsed.
+     */
+    void SetVisibilityDuringSelection(bool aVisibility);
+
+    /** EraseCaret
+     *  this will erase the caret if its drawn and reset drawn status
+     */
+    void EraseCaret();
+    /** UpdateCaretPosition
+     *  Update the caret's current frame and rect, but don't draw yet. This is
+     *  useful for flickerless moving of the caret (e.g., when the frame the
+     *  caret is in reflows and is moved).
+     */
+    void UpdateCaretPosition();
+    /** DrawAtPosition
+     *
+     *  Draw the caret explicitly, at the specified node and offset.
+     *  To avoid drawing glitches, you should call EraseCaret()
+     *  after each call to DrawAtPosition().
+     *
+     *  Note: This call breaks the caret's ability to blink at all.
+     **/
+    nsresult DrawAtPosition(nsIDOMNode* aNode, int32_t aOffset);
 
     /**
      * Gets the position and size of the caret that would be drawn for
      * the focus node/offset of aSelection (assuming it would be drawn,
      * i.e., disregarding blink status). The geometry is stored in aRect,
      * and we return the frame aRect is relative to.
      * @param aRect must be non-null
      * @param aBidiIndicatorSize if non-null, set to the bidi indicator size.
      */
     virtual nsIFrame* GetGeometry(nsISelection* aSelection,
                                   nsRect* aRect,
                                   nscoord* aBidiIndicatorSize = nullptr);
-
-    /** EraseCaret
-     *  this will erase the caret if its drawn and reset drawn status
-     */
-    void    EraseCaret();
-
-    void    SetVisibilityDuringSelection(bool aVisibility);
-
-    /** DrawAtPosition
-     *
-     *  Draw the caret explicitly, at the specified node and offset.
-     *  To avoid drawing glitches, you should call EraseCaret()
-     *  after each call to DrawAtPosition().
-     *
-     *  Note: This call breaks the caret's ability to blink at all.
-     **/
-    nsresult    DrawAtPosition(nsIDOMNode* aNode, int32_t aOffset);
-
     /** GetCaretFrame
      *  Get the current frame that the caret should be drawn in. If the caret is
      *  not currently visible (i.e., it is between blinks), then this will
      *  return null.
      *
      *  @param aOffset is result of the caret offset in the content.
      */
-    nsIFrame*     GetCaretFrame(int32_t *aOffset = nullptr);
-
+    nsIFrame* GetCaretFrame(int32_t *aOffset = nullptr);
     /** GetCaretRect
      *  Get the current caret rect. Only call this when GetCaretFrame returns
      *  non-null.
      */
-    nsRect        GetCaretRect()
+    nsRect GetCaretRect()
     {
       nsRect r;
       r.UnionRect(mCaretRect, GetHookRect());
       return r;
     }
 
-    /** UpdateCaretPosition
-     *  Update the caret's current frame and rect, but don't draw yet. This is
-     *  useful for flickerless moving of the caret (e.g., when the frame the
-     *  caret is in reflows and is moved).
-     */
-    void      UpdateCaretPosition();
-
     /** PaintCaret
      *  Actually paint the caret onto the given rendering context.
      */
-    void      PaintCaret(nsDisplayListBuilder *aBuilder,
-                         nsRenderingContext *aCtx,
-                         nsIFrame *aForFrame,
-                         const nsPoint &aOffset);
-    /**
-     * Sets whether the caret should only be visible in nodes that are not
-     * user-modify: read-only, or whether it should be visible in all nodes.
-     *
-     * @param aIgnoreUserModify true to have the cursor visible in all nodes,
-     *                          false to have it visible in all nodes except
-     *                          those with user-modify: read-only
-     */
-
-    void SetIgnoreUserModify(bool aIgnoreUserModify);
+    void PaintCaret(nsDisplayListBuilder *aBuilder,
+                    nsRenderingContext *aCtx,
+                    nsIFrame *aForFrame,
+                    const nsPoint &aOffset);
 
     //nsISelectionListener interface
     NS_DECL_NSISELECTIONLISTENER
 
-    static void   CaretBlinkCallback(nsITimer *aTimer, void *aClosure);
-
     static nsresult GetCaretFrameForNodeOffset(nsFrameSelection* aFrameSelection,
                                                nsIContent* aContentNode,
                                                int32_t aOffset,
                                                nsFrameSelection::HINT aFrameHint,
                                                uint8_t aBidiLevel,
                                                nsIFrame** aReturnFrame,
                                                int32_t* aReturnOffset);
 
-    void CheckCaretDrawingState();
-
     size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
 protected:
+    static void   CaretBlinkCallback(nsITimer *aTimer, void *aClosure);
 
     void          KillTimer();
     nsresult      PrimeTimer();
 
     void          StartBlinking();
     void          StopBlinking();
 
     bool          DrawAtPositionWithHint(nsIDOMNode* aNode,