From 070645421e985db4236b43e25498f3a3aabf16fd Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Tue, 11 Jan 2000 19:44:59 +0000 Subject: [PATCH] bug 15982 r=cmanske. needed more places to add checks for style turning off normal selection. git-svn-id: svn://10.0.0.236/trunk@57411 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsFrame.cpp | 15 +++++++++++++++ mozilla/layout/generic/nsTextFrame.cpp | 15 +++++++++++++++ mozilla/layout/html/base/src/nsFrame.cpp | 15 +++++++++++++++ mozilla/layout/html/base/src/nsTextFrame.cpp | 15 +++++++++++++++ 4 files changed, 60 insertions(+) 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) {