Bug 1320815 - Make nsIFrame::IsSelectable non-virtual, and move implementation from nsFrame to nsIFrame. r=xidorn
authorL. David Baron <dbaron@dbaron.org>
Mon, 28 Nov 2016 15:31:29 -0800
changeset 324567 02cc5b7bf39c6cb91a1a43980b59fb0cddc300e8
parent 324566 405a08f9905b60b5610ec605b549273904b68b73
child 324568 ae6227686e4734e82a1c1c4d7c5e37e5e0c481bd
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersxidorn
bugs1320815
milestone53.0a1
Bug 1320815 - Make nsIFrame::IsSelectable non-virtual, and move implementation from nsFrame to nsIFrame. r=xidorn MozReview-Commit-ID: HphEFug7EbQ
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsIFrame.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3159,17 +3159,17 @@ nsFrame::GetDataForTableSelection(const 
     *aTarget = nsISelectionPrivate::TABLESELECTION_CELL;
   else if (foundTable)
     *aTarget = nsISelectionPrivate::TABLESELECTION_TABLE;
 
   return NS_OK;
 }
 
 nsresult
-nsFrame::IsSelectable(bool* aSelectable, StyleUserSelect* aSelectStyle) const
+nsIFrame::IsSelectable(bool* aSelectable, StyleUserSelect* aSelectStyle) const
 {
   if (!aSelectable) //it's ok if aSelectStyle is null
     return NS_ERROR_NULL_POINTER;
 
   // Like 'visibility', we must check all the parents: if a parent
   // is not selectable, none of its children is selectable.
   //
   // The -moz-all value acts similarly: if a frame has 'user-select:-moz-all',
@@ -3186,17 +3186,17 @@ nsFrame::IsSelectable(bool* aSelectable,
   //    AUTO     -> _MOZ_ALL  -> NONE -> TEXT,      the returned value is ALL
   //    AUTO     -> _MOZ_ALL  -> NONE -> _MOZ_TEXT, the returned value is TEXT.
   //    TEXT     -> NONE      -> AUTO -> _MOZ_ALL,  the returned value is TEXT
   //    _MOZ_ALL -> TEXT      -> AUTO -> AUTO,      the returned value is ALL
   //    _MOZ_ALL -> _MOZ_TEXT -> AUTO -> AUTO,      the returned value is TEXT.
   //    AUTO     -> CELL      -> TEXT -> AUTO,      the returned value is TEXT
   //
   StyleUserSelect selectStyle  = StyleUserSelect::Auto;
-  nsIFrame* frame              = const_cast<nsFrame*>(this);
+  nsIFrame* frame              = const_cast<nsIFrame*>(this);
   bool containsEditable        = false;
 
   while (frame) {
     const nsStyleUIReset* userinterface = frame->StyleUIReset();
     switch (userinterface->mUserSelect) {
       case StyleUserSelect::All:
       case StyleUserSelect::MozAll:
       {
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -195,19 +195,16 @@ public:
   virtual nsIFrame* GetNextContinuation() const override;
   virtual void SetNextContinuation(nsIFrame*) override;
   virtual nsIFrame* GetPrevInFlowVirtual() const override;
   virtual void SetPrevInFlow(nsIFrame*) override;
   virtual nsIFrame* GetNextInFlowVirtual() const override;
   virtual void SetNextInFlow(nsIFrame*) override;
   virtual nsIAtom* GetType() const override;
 
-  virtual nsresult IsSelectable(bool* aIsSelectable,
-                      mozilla::StyleUserSelect* aSelectStyle) const override;
-
   virtual nsresult  GetSelectionController(nsPresContext *aPresContext, nsISelectionController **aSelCon) override;
 
   virtual FrameSearchResult PeekOffsetNoAmount(bool aForward, int32_t* aOffset) override;
   virtual FrameSearchResult PeekOffsetCharacter(bool aForward, int32_t* aOffset,
                                      bool aRespectClusters = true) override;
   virtual FrameSearchResult PeekOffsetWord(bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
                                 int32_t* aOffset, PeekWordState *aState) override;
   /**
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2776,24 +2776,24 @@ public:
   /**
    * @returns true if this frame is selected.
    */
   bool IsSelected() const;
 
   /**
    *  called to discover where this frame, or a parent frame has user-select style
    *  applied, which affects that way that it is selected.
-   *    
+   *
    *  @param aIsSelectable out param. Set to true if the frame can be selected
    *                       (i.e. is not affected by user-select: none)
    *  @param aSelectStyle  out param. Returns the type of selection style found
    *                        (using values defined in nsStyleConsts.h).
    */
-  virtual nsresult IsSelectable(bool* aIsSelectable,
-                            mozilla::StyleUserSelect* aSelectStyle) const = 0;
+  nsresult IsSelectable(bool* aIsSelectable,
+                        mozilla::StyleUserSelect* aSelectStyle) const;
 
   /** 
    *  Called to retrieve the SelectionController associated with the frame.
    *  @param aSelCon will contain the selection controller associated with
    *  the frame.
    */
   virtual nsresult  GetSelectionController(nsPresContext *aPresContext, nsISelectionController **aSelCon) = 0;