Bug 1320815 - Make nsIFrame::IsSelectable non-virtual, and move implementation from nsFrame to nsIFrame. r?xidorn
MozReview-Commit-ID: HphEFug7EbQ
--- 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;