diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index dc097d0763a..bbe404c0b08 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -1857,6 +1857,21 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aS { if (aSelected && ParentDisablesSelection()) return NS_OK; + // check whether style allows selection + const nsStyleUserInterface* userinterface; + GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + if (userinterface) { + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_AUTO) { + // if 'user-select' isn't set for this frame, use the parent's + if (mParent) { + mParent->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + } + } + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_NONE) { + return NS_OK;//do not continue no selection for this frame. + } + } + /* nsresult rv; if (eSpreadDown == aSpread){ diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index c4834a9e9e9..c41100634f3 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -2098,6 +2098,21 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, return NS_OK; }*/ + // check whether style allows selection + const nsStyleUserInterface* userinterface; + GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + if (userinterface) { + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_AUTO) { + // if 'user-select' isn't set for this frame, use the parent's + if (mParent) { + mParent->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + } + } + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_NONE) { + return NS_OK;//do not continue no selection for this frame. + } + } + PRBool found = PR_FALSE; PRBool wholeContentFound = PR_FALSE;//if the entire content we look at is selected. if (aRange) { diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index dc097d0763a..bbe404c0b08 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -1857,6 +1857,21 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aS { if (aSelected && ParentDisablesSelection()) return NS_OK; + // check whether style allows selection + const nsStyleUserInterface* userinterface; + GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + if (userinterface) { + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_AUTO) { + // if 'user-select' isn't set for this frame, use the parent's + if (mParent) { + mParent->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + } + } + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_NONE) { + return NS_OK;//do not continue no selection for this frame. + } + } + /* nsresult rv; if (eSpreadDown == aSpread){ diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index c4834a9e9e9..c41100634f3 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -2098,6 +2098,21 @@ nsTextFrame::SetSelected(nsIPresContext* aPresContext, return NS_OK; }*/ + // check whether style allows selection + const nsStyleUserInterface* userinterface; + GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + if (userinterface) { + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_AUTO) { + // if 'user-select' isn't set for this frame, use the parent's + if (mParent) { + mParent->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface); + } + } + if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_NONE) { + return NS_OK;//do not continue no selection for this frame. + } + } + PRBool found = PR_FALSE; PRBool wholeContentFound = PR_FALSE;//if the entire content we look at is selected. if (aRange) {