From 20a1185b2bd7eaf7b91b04db0d1dea235232cf10 Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Tue, 18 Dec 2001 01:29:49 +0000 Subject: [PATCH] bs=7868 r=saari Adding in new api to bake on trunk before going to branch. this adds nsISelectionDisplay to nsISelectionController. SetDisplayFlags are how we now set if you want images selected or not git-svn-id: svn://10.0.0.236/trunk@110680 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/build/Makefile.in | 2 ++ mozilla/content/build/makefile.win | 1 + mozilla/content/events/src/Makefile.in | 1 + mozilla/content/events/src/makefile.win | 1 + mozilla/content/html/document/src/Makefile.in | 1 + .../content/html/document/src/makefile.win | 1 + mozilla/content/xbl/src/Makefile.in | 1 + mozilla/content/xbl/src/makefile.win | 1 + .../content/xbl/src/nsXBLWindowHandler.cpp | 8 +++-- mozilla/content/xul/document/src/Makefile.in | 1 + mozilla/content/xul/document/src/makefile.win | 1 + mozilla/editor/composer/src/Makefile.in | 1 + mozilla/editor/composer/src/makefile.win | 1 + mozilla/editor/libeditor/base/Makefile.in | 1 + mozilla/editor/libeditor/base/makefile.win | 1 + mozilla/editor/libeditor/base/nsEditor.cpp | 4 +-- mozilla/editor/libeditor/html/Makefile.in | 1 + mozilla/editor/libeditor/html/makefile.win | 1 + mozilla/editor/libeditor/text/Makefile.in | 3 +- mozilla/editor/libeditor/text/makefile.win | 1 + mozilla/editor/txtsvc/src/Makefile.in | 1 + mozilla/editor/txtsvc/src/makefile.win | 1 + .../embedding/browser/macbuild/browserIDL.xml | 30 +++++++++++++++++++ .../embedding/browser/webBrowser/Makefile.in | 1 + .../embedding/browser/webBrowser/makefile.win | 1 + mozilla/layout/base/nsIPresShell.h | 4 +-- mozilla/layout/base/nsPresShell.cpp | 10 +++---- mozilla/layout/base/public/nsIPresShell.h | 4 +-- mozilla/layout/base/src/Makefile.in | 1 + mozilla/layout/base/src/makefile.win | 2 ++ mozilla/layout/generic/nsFrame.cpp | 27 ++++++++++------- mozilla/layout/generic/nsImageFrame.cpp | 12 ++++++++ mozilla/layout/generic/nsTextFrame.cpp | 4 +++ mozilla/layout/html/base/src/nsFrame.cpp | 27 ++++++++++------- mozilla/layout/html/base/src/nsImageFrame.cpp | 12 ++++++++ mozilla/layout/html/base/src/nsPresShell.cpp | 10 +++---- mozilla/layout/html/base/src/nsTextFrame.cpp | 4 +++ mozilla/layout/html/document/src/Makefile.in | 1 + mozilla/layout/html/document/src/makefile.win | 1 + mozilla/layout/html/forms/src/Makefile.in | 1 + mozilla/layout/html/forms/src/makefile.win | 1 + .../html/forms/src/nsGfxTextControlFrame2.cpp | 8 ++--- mozilla/layout/html/style/src/Makefile.in | 1 + mozilla/layout/html/style/src/makefile.win | 1 + mozilla/layout/html/table/src/Makefile.in | 1 + mozilla/layout/html/table/src/makefile.win | 1 + mozilla/layout/xul/base/src/Makefile.in | 1 + mozilla/layout/xul/base/src/grid/Makefile.in | 1 + mozilla/layout/xul/base/src/grid/makefile.win | 1 + mozilla/layout/xul/base/src/makefile.win | 1 + .../xul/base/src/outliner/src/Makefile.in | 1 + .../xul/base/src/outliner/src/makefile.win | 1 + mozilla/mailnews/compose/src/Makefile.in | 1 + mozilla/mailnews/compose/src/makefile.win | 1 + 54 files changed, 164 insertions(+), 44 deletions(-) diff --git a/mozilla/content/build/Makefile.in b/mozilla/content/build/Makefile.in index 345e16c19c7..924f023f3a4 100644 --- a/mozilla/content/build/Makefile.in +++ b/mozilla/content/build/Makefile.in @@ -55,6 +55,8 @@ REQUIRES = xpcom \ xul \ xuldoc \ xultmpl \ + timer \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/content/build/makefile.win b/mozilla/content/build/makefile.win index e1f61529a4a..e666b1cb21e 100644 --- a/mozilla/content/build/makefile.win +++ b/mozilla/content/build/makefile.win @@ -53,6 +53,7 @@ REQUIRES = xpcom \ gfx \ layout_xul \ content_xul \ + webBrowser_core \ $(NULL) LCFLAGS = \ diff --git a/mozilla/content/events/src/Makefile.in b/mozilla/content/events/src/Makefile.in index 36d5f0fa222..f32c117c2a3 100644 --- a/mozilla/content/events/src/Makefile.in +++ b/mozilla/content/events/src/Makefile.in @@ -44,6 +44,7 @@ REQUIRES = xpcom \ htmlparser \ view \ necko \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/content/events/src/makefile.win b/mozilla/content/events/src/makefile.win index 18ce650b97f..07b9bc81f14 100644 --- a/mozilla/content/events/src/makefile.win +++ b/mozilla/content/events/src/makefile.win @@ -42,6 +42,7 @@ REQUIRES = xpcom \ layout \ layout_xul \ necko \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/content/html/document/src/Makefile.in b/mozilla/content/html/document/src/Makefile.in index 8b2073c7382..4972e8063e9 100644 --- a/mozilla/content/html/document/src/Makefile.in +++ b/mozilla/content/html/document/src/Makefile.in @@ -57,6 +57,7 @@ REQUIRES = xpcom \ imglib2 \ xpconnect \ unicharutil \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/content/html/document/src/makefile.win b/mozilla/content/html/document/src/makefile.win index 5c61524ae8e..379f81221a2 100644 --- a/mozilla/content/html/document/src/makefile.win +++ b/mozilla/content/html/document/src/makefile.win @@ -52,6 +52,7 @@ REQUIRES = xpcom \ layout \ gfx \ bookmarks \ + webBrowser_core\ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/mozilla/content/xbl/src/Makefile.in b/mozilla/content/xbl/src/Makefile.in index f042bb1ca0c..b933c1af674 100644 --- a/mozilla/content/xbl/src/Makefile.in +++ b/mozilla/content/xbl/src/Makefile.in @@ -52,6 +52,7 @@ REQUIRES = xpcom \ rdf \ imglib2 \ unicharutil \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/content/xbl/src/makefile.win b/mozilla/content/xbl/src/makefile.win index b8e73646ad5..94ae5263b9e 100644 --- a/mozilla/content/xbl/src/makefile.win +++ b/mozilla/content/xbl/src/makefile.win @@ -46,6 +46,7 @@ REQUIRES = xpcom \ rdf \ content_xul \ unicharutil \ + webBrowser_core \ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/mozilla/content/xbl/src/nsXBLWindowHandler.cpp b/mozilla/content/xbl/src/nsXBLWindowHandler.cpp index dd30adc783b..1217ccac250 100644 --- a/mozilla/content/xbl/src/nsXBLWindowHandler.cpp +++ b/mozilla/content/xbl/src/nsXBLWindowHandler.cpp @@ -63,6 +63,8 @@ #include "nsIXBLService.h" #include "nsIServiceManager.h" #include "nsIDOMDocument.h" +#include "nsISelectionController.h" + #ifdef INCLUDE_XUL #include "nsXULAtoms.h" #endif @@ -240,9 +242,9 @@ nsXBLWindowHandler :: IsEditor() docShell->GetPresShell(getter_AddRefs(presShell)); if (presShell) { - PRBool isEditor; - presShell->GetDisplayNonTextSelection(&isEditor); - return isEditor; + PRInt16 isEditor; + presShell->GetSelectionFlags(&isEditor); + return isEditor == nsISelectionDisplay::DISPLAY_ALL; } return PR_FALSE; diff --git a/mozilla/content/xul/document/src/Makefile.in b/mozilla/content/xul/document/src/Makefile.in index 8e4a0dd4aac..cb1cde48e9c 100644 --- a/mozilla/content/xul/document/src/Makefile.in +++ b/mozilla/content/xul/document/src/Makefile.in @@ -53,6 +53,7 @@ REQUIRES = xpcom \ xul \ xultmpl \ webshell \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/content/xul/document/src/makefile.win b/mozilla/content/xul/document/src/makefile.win index bc7c4e17f00..795e37f418b 100644 --- a/mozilla/content/xul/document/src/makefile.win +++ b/mozilla/content/xul/document/src/makefile.win @@ -47,6 +47,7 @@ REQUIRES = xpcom \ layout_xul \ content \ webshell \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/editor/composer/src/Makefile.in b/mozilla/editor/composer/src/Makefile.in index ef40e2ef63d..e7e547d049f 100644 --- a/mozilla/editor/composer/src/Makefile.in +++ b/mozilla/editor/composer/src/Makefile.in @@ -56,6 +56,7 @@ REQUIRES = xpcom \ mimetype \ imglib2 \ gfx2 \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/editor/composer/src/makefile.win b/mozilla/editor/composer/src/makefile.win index a750ebb5ea3..235ca44bc81 100644 --- a/mozilla/editor/composer/src/makefile.win +++ b/mozilla/editor/composer/src/makefile.win @@ -62,6 +62,7 @@ REQUIRES = xpcom \ content_xul \ imglib2 \ gfx2 \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/editor/libeditor/base/Makefile.in b/mozilla/editor/libeditor/base/Makefile.in index 1eceb64c052..13a3be8561e 100644 --- a/mozilla/editor/libeditor/base/Makefile.in +++ b/mozilla/editor/libeditor/base/Makefile.in @@ -44,6 +44,7 @@ REQUIRES = xpcom \ gfx \ widget \ xuldoc \ + webBrowser_core \ $(NULL) # Internal header files, needed by other editor sublibs: diff --git a/mozilla/editor/libeditor/base/makefile.win b/mozilla/editor/libeditor/base/makefile.win index 76e1e8f8e37..ec4010b9bb8 100644 --- a/mozilla/editor/libeditor/base/makefile.win +++ b/mozilla/editor/libeditor/base/makefile.win @@ -38,6 +38,7 @@ REQUIRES = xpcom \ appshell \ gfx \ widget \ + webBrowser_core \ $(NULL) CPP_OBJS = \ diff --git a/mozilla/editor/libeditor/base/nsEditor.cpp b/mozilla/editor/libeditor/base/nsEditor.cpp index baddd432357..6d7649662b0 100644 --- a/mozilla/editor/libeditor/base/nsEditor.cpp +++ b/mozilla/editor/libeditor/base/nsEditor.cpp @@ -38,7 +38,6 @@ * ***** END LICENSE BLOCK ***** */ #include "pratom.h" - #include "nsIDOMDocument.h" #include "nsIPref.h" @@ -108,6 +107,7 @@ #include "nsEditor.h" #include "nsEditorUtils.h" +#include "nsISelectionDisplay.h" #ifdef HACK_FORCE_REDRAW // INCLUDES FOR EVIL HACK TO FOR REDRAW @@ -319,7 +319,7 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot aSelCon->SetCaretReadOnly(PR_FALSE); aSelCon->SetDisplaySelection(nsISelectionController::SELECTION_ON); - aSelCon->SetDisplayNonTextSelection(PR_TRUE);//we want to see all the selection reflected to user + aSelCon->SetSelectionFlags(nsISelectionDisplay::DISPLAY_ALL);//we want to see all the selection reflected to user // Set the selection to the beginning: diff --git a/mozilla/editor/libeditor/html/Makefile.in b/mozilla/editor/libeditor/html/Makefile.in index 5af151cabbc..2418df3f0fb 100644 --- a/mozilla/editor/libeditor/html/Makefile.in +++ b/mozilla/editor/libeditor/html/Makefile.in @@ -42,6 +42,7 @@ REQUIRES = xpcom \ pref \ gfx \ widget \ + webBrowser_core \ $(NULL) # Building the full blown HTML Editor so add its source files and objects: diff --git a/mozilla/editor/libeditor/html/makefile.win b/mozilla/editor/libeditor/html/makefile.win index 558cc837280..457e100baca 100644 --- a/mozilla/editor/libeditor/html/makefile.win +++ b/mozilla/editor/libeditor/html/makefile.win @@ -36,6 +36,7 @@ REQUIRES = xpcom \ pref \ gfx \ widget \ + webBrowser_core \ $(NULL) CPP_OBJS = \ diff --git a/mozilla/editor/libeditor/text/Makefile.in b/mozilla/editor/libeditor/text/Makefile.in index 6ee57181828..13e1466ab54 100644 --- a/mozilla/editor/libeditor/text/Makefile.in +++ b/mozilla/editor/libeditor/text/Makefile.in @@ -44,7 +44,8 @@ REQUIRES = xpcom \ lwbrk \ gfx \ widget \ - unicharutil \ + webBrowser_core \ + unicharutil \ $(NULL) CPPSRCS = \ diff --git a/mozilla/editor/libeditor/text/makefile.win b/mozilla/editor/libeditor/text/makefile.win index 8b98f24990c..2af22eff8fd 100644 --- a/mozilla/editor/libeditor/text/makefile.win +++ b/mozilla/editor/libeditor/text/makefile.win @@ -37,6 +37,7 @@ REQUIRES = xpcom \ lwbrk \ gfx \ widget \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/editor/txtsvc/src/Makefile.in b/mozilla/editor/txtsvc/src/Makefile.in index 61ec7c02229..9ef1a7c2cc6 100644 --- a/mozilla/editor/txtsvc/src/Makefile.in +++ b/mozilla/editor/txtsvc/src/Makefile.in @@ -39,6 +39,7 @@ REQUIRES = xpcom \ content \ dom \ widget \ + webBrowser_core \ unicharutil \ $(NULL) diff --git a/mozilla/editor/txtsvc/src/makefile.win b/mozilla/editor/txtsvc/src/makefile.win index aa3da413bbb..05223f24146 100644 --- a/mozilla/editor/txtsvc/src/makefile.win +++ b/mozilla/editor/txtsvc/src/makefile.win @@ -30,6 +30,7 @@ REQUIRES = xpcom \ dom \ widget \ gfx \ + webBrowser_core \ unicharutil \ $(NULL) LIBRARY_NAME=txtsvc diff --git a/mozilla/embedding/browser/macbuild/browserIDL.xml b/mozilla/embedding/browser/macbuild/browserIDL.xml index 66803577c5a..5486e58a85e 100644 --- a/mozilla/embedding/browser/macbuild/browserIDL.xml +++ b/mozilla/embedding/browser/macbuild/browserIDL.xml @@ -738,6 +738,13 @@ Text + + Name + nsISelectionDisplay.idl + MacOS + Text + + Name nsIContextMenuListener.idl @@ -821,6 +828,11 @@ nsICommandHandler.idl MacOS + + Name + nsISelectionDisplay.idl + MacOS + Name nsIContextMenuListener.idl @@ -1543,6 +1555,13 @@ Text + + Name + nsISelectionDisplay.idl + MacOS + Text + + Name nsIContextMenuListener.idl @@ -1621,6 +1640,11 @@ nsICommandHandler.idl MacOS + + Name + nsISelectionDisplay.idl + MacOS + Name nsIContextMenuListener.idl @@ -1683,6 +1707,12 @@ nsICommandHandler.idl MacOS + + embeddingbrowser.xpt + Name + nsISelectionDisplay.idl + MacOS + embeddingbrowser.xpt Name diff --git a/mozilla/embedding/browser/webBrowser/Makefile.in b/mozilla/embedding/browser/webBrowser/Makefile.in index 881796f41df..0d15702f6ca 100644 --- a/mozilla/embedding/browser/webBrowser/Makefile.in +++ b/mozilla/embedding/browser/webBrowser/Makefile.in @@ -65,6 +65,7 @@ XPIDLSRCS = \ nsITooltipTextProvider.idl \ nsIWebBrowserFocus.idl \ nsIWebBrowserPrint.idl \ + nsISelectionDisplay.idl\ $(NULL) CPPSRCS = \ diff --git a/mozilla/embedding/browser/webBrowser/makefile.win b/mozilla/embedding/browser/webBrowser/makefile.win index 51ce724d227..9758d6b6b03 100644 --- a/mozilla/embedding/browser/webBrowser/makefile.win +++ b/mozilla/embedding/browser/webBrowser/makefile.win @@ -58,6 +58,7 @@ XPIDLSRCS= \ .\nsIEmbeddingSiteWindow.idl \ .\nsIWebBrowserFocus.idl \ .\nsIWebBrowserPrint.idl \ + .\nsISelectionDisplay.idl \ $(NULL) LIBRARY_NAME=nsWebBrowser_s diff --git a/mozilla/layout/base/nsIPresShell.h b/mozilla/layout/base/nsIPresShell.h index e4e3e3cec35..26df6858229 100644 --- a/mozilla/layout/base/nsIPresShell.h +++ b/mozilla/layout/base/nsIPresShell.h @@ -445,7 +445,7 @@ public: * if PR_FALSE visual selection effects are disabled * @return always NS_OK */ - NS_IMETHOD SetDisplayNonTextSelection(PRBool aInEnable) = 0; + NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable) = 0; /** * Gets the current state of non text selection effects @@ -454,7 +454,7 @@ public: * @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG * else NS_OK */ - NS_IMETHOD GetDisplayNonTextSelection(PRBool *aOutEnabled) = 0; + NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnabled) = 0; /** * Interface to dispatch events via the presshell diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 2b548d5cd68..c44c8e2c683 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -1001,8 +1001,8 @@ public: NS_IMETHOD SetCaretReadOnly(PRBool aReadOnly); NS_IMETHOD GetCaretEnabled(PRBool *aOutEnabled); - NS_IMETHOD SetDisplayNonTextSelection(PRBool aInEnable); - NS_IMETHOD GetDisplayNonTextSelection(PRBool *aOutEnable); + NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable); + NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnable); // nsISelectionController @@ -3057,13 +3057,13 @@ NS_IMETHODIMP PresShell::GetCaretEnabled(PRBool *aOutEnabled) return NS_OK; } -NS_IMETHODIMP PresShell::SetDisplayNonTextSelection(PRBool aInEnable) +NS_IMETHODIMP PresShell::SetSelectionFlags(PRInt16 aInEnable) { - mDisplayNonTextSelection = PR_TRUE; + mDisplayNonTextSelection = aInEnable; return NS_OK; } -NS_IMETHODIMP PresShell::GetDisplayNonTextSelection(PRBool *aOutEnable) +NS_IMETHODIMP PresShell::GetSelectionFlags(PRInt16 *aOutEnable) { if (!aOutEnable) return NS_ERROR_INVALID_ARG; diff --git a/mozilla/layout/base/public/nsIPresShell.h b/mozilla/layout/base/public/nsIPresShell.h index e4e3e3cec35..26df6858229 100644 --- a/mozilla/layout/base/public/nsIPresShell.h +++ b/mozilla/layout/base/public/nsIPresShell.h @@ -445,7 +445,7 @@ public: * if PR_FALSE visual selection effects are disabled * @return always NS_OK */ - NS_IMETHOD SetDisplayNonTextSelection(PRBool aInEnable) = 0; + NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable) = 0; /** * Gets the current state of non text selection effects @@ -454,7 +454,7 @@ public: * @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG * else NS_OK */ - NS_IMETHOD GetDisplayNonTextSelection(PRBool *aOutEnabled) = 0; + NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnabled) = 0; /** * Interface to dispatch events via the presshell diff --git a/mozilla/layout/base/src/Makefile.in b/mozilla/layout/base/src/Makefile.in index 96e4a809a9c..e924c8aea68 100644 --- a/mozilla/layout/base/src/Makefile.in +++ b/mozilla/layout/base/src/Makefile.in @@ -46,6 +46,7 @@ REQUIRES = xpcom \ docshell \ imglib2 \ gfx2 \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/base/src/makefile.win b/mozilla/layout/base/src/makefile.win index 1598552ec81..3ff94329e32 100644 --- a/mozilla/layout/base/src/makefile.win +++ b/mozilla/layout/base/src/makefile.win @@ -38,6 +38,8 @@ REQUIRES = xpcom \ imglib2 \ gfx2 \ content \ + gfx \ + webBrowser_core \ gfx \ $(NULL) diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 25ed485048a..7d7972f560b 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -611,12 +611,15 @@ nsFrame::Paint(nsIPresContext* aPresContext, if (NS_FAILED(result)) return result; - PRBool displaySelection = PR_TRUE; - result = shell->GetDisplayNonTextSelection(&displaySelection); - if (NS_FAILED(result)) - return result; - if (!displaySelection) - return NS_OK; + PRInt16 displaySelection = nsISelectionDisplay::DISPLAY_ALL; + if (aFlags != nsISelectionDisplay::DISPLAY_IMAGES) + { + result = shell->GetSelectionFlags(&displaySelection); + if (NS_FAILED(result)) + return result; + if (!(displaySelection == nsISelectionDisplay::DISPLAY_FRAMES)) + return NS_OK; + } //check frame selection state PRBool isSelected; @@ -987,8 +990,11 @@ nsFrame::HandlePress(nsIPresContext* aPresContext, // if we are in Navigator and the click is in a link, we don't want to start // selection because we don't want to interfere with a potential drag of said // link and steal all its glory. - PRBool isEditor = PR_FALSE; - shell->GetDisplayNonTextSelection ( &isEditor ); + PRInt16 isEditor = 0; + shell->GetSelectionFlags ( &isEditor ); + //weaaak. only the editor can display frame selction not just text and images + isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL; + nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent; if (!isEditor && !keyEvent->isAlt) { nsCOMPtr content; @@ -2878,12 +2884,13 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, //special check. if we allow non-text selection then we can allow a hit location to fall before a table. //otherwise there is no way to get and click signal to fall before a table (it being a line iterator itself) - PRBool isEditor = PR_FALSE; + PRInt16 isEditor = 0; nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); if (!shell) return NS_ERROR_FAILURE; - shell->GetDisplayNonTextSelection ( &isEditor ); + shell->GetSelectionFlags ( &isEditor ); + isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL; if ( isEditor ) { nsIAtom *resultFrameType; diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index bdf8f1ee011..fa59c3a07af 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -1342,6 +1342,18 @@ nsImageFrame::Paint(nsIPresContext* aPresContext, } } + PRInt16 displaySelection = 0; + + nsresult result; + nsCOMPtr shell; + result = aPresContext->GetShell(getter_AddRefs(shell)); + if (NS_FAILED(result)) + return result; + result = shell->GetSelectionFlags(&displaySelection); + if (NS_FAILED(result)) + return result; + if (!(displaySelection & nsISelectionDisplay::DISPLAY_IMAGES)) + return NS_OK;//no need to check the blue border, we cannot be drawn selected return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index bdea9020794..d4b3fb2e485 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -2011,6 +2011,10 @@ nsresult nsTextFrame::GetTextInfoForPainting(nsIPresContext* aPresConte aDisplayingSelection = (aSelectionValue > nsISelectionController::SELECTION_HIDDEN); } + PRInt16 textSel=0; + (*aSelectionController)->GetSelectionFlags(&textSel); + if (!(textSel & nsISelectionDisplay::DISPLAY_TEXT)) + aDisplayingSelection = false; // Transform text from content into renderable form // XXX If the text fragment is already Unicode and text text wasn't diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 25ed485048a..7d7972f560b 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -611,12 +611,15 @@ nsFrame::Paint(nsIPresContext* aPresContext, if (NS_FAILED(result)) return result; - PRBool displaySelection = PR_TRUE; - result = shell->GetDisplayNonTextSelection(&displaySelection); - if (NS_FAILED(result)) - return result; - if (!displaySelection) - return NS_OK; + PRInt16 displaySelection = nsISelectionDisplay::DISPLAY_ALL; + if (aFlags != nsISelectionDisplay::DISPLAY_IMAGES) + { + result = shell->GetSelectionFlags(&displaySelection); + if (NS_FAILED(result)) + return result; + if (!(displaySelection == nsISelectionDisplay::DISPLAY_FRAMES)) + return NS_OK; + } //check frame selection state PRBool isSelected; @@ -987,8 +990,11 @@ nsFrame::HandlePress(nsIPresContext* aPresContext, // if we are in Navigator and the click is in a link, we don't want to start // selection because we don't want to interfere with a potential drag of said // link and steal all its glory. - PRBool isEditor = PR_FALSE; - shell->GetDisplayNonTextSelection ( &isEditor ); + PRInt16 isEditor = 0; + shell->GetSelectionFlags ( &isEditor ); + //weaaak. only the editor can display frame selction not just text and images + isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL; + nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent; if (!isEditor && !keyEvent->isAlt) { nsCOMPtr content; @@ -2878,12 +2884,13 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, //special check. if we allow non-text selection then we can allow a hit location to fall before a table. //otherwise there is no way to get and click signal to fall before a table (it being a line iterator itself) - PRBool isEditor = PR_FALSE; + PRInt16 isEditor = 0; nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); if (!shell) return NS_ERROR_FAILURE; - shell->GetDisplayNonTextSelection ( &isEditor ); + shell->GetSelectionFlags ( &isEditor ); + isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL; if ( isEditor ) { nsIAtom *resultFrameType; diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index bdf8f1ee011..fa59c3a07af 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -1342,6 +1342,18 @@ nsImageFrame::Paint(nsIPresContext* aPresContext, } } + PRInt16 displaySelection = 0; + + nsresult result; + nsCOMPtr shell; + result = aPresContext->GetShell(getter_AddRefs(shell)); + if (NS_FAILED(result)) + return result; + result = shell->GetSelectionFlags(&displaySelection); + if (NS_FAILED(result)) + return result; + if (!(displaySelection & nsISelectionDisplay::DISPLAY_IMAGES)) + return NS_OK;//no need to check the blue border, we cannot be drawn selected return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 2b548d5cd68..c44c8e2c683 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -1001,8 +1001,8 @@ public: NS_IMETHOD SetCaretReadOnly(PRBool aReadOnly); NS_IMETHOD GetCaretEnabled(PRBool *aOutEnabled); - NS_IMETHOD SetDisplayNonTextSelection(PRBool aInEnable); - NS_IMETHOD GetDisplayNonTextSelection(PRBool *aOutEnable); + NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable); + NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnable); // nsISelectionController @@ -3057,13 +3057,13 @@ NS_IMETHODIMP PresShell::GetCaretEnabled(PRBool *aOutEnabled) return NS_OK; } -NS_IMETHODIMP PresShell::SetDisplayNonTextSelection(PRBool aInEnable) +NS_IMETHODIMP PresShell::SetSelectionFlags(PRInt16 aInEnable) { - mDisplayNonTextSelection = PR_TRUE; + mDisplayNonTextSelection = aInEnable; return NS_OK; } -NS_IMETHODIMP PresShell::GetDisplayNonTextSelection(PRBool *aOutEnable) +NS_IMETHODIMP PresShell::GetSelectionFlags(PRInt16 *aOutEnable) { if (!aOutEnable) return NS_ERROR_INVALID_ARG; diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index bdea9020794..d4b3fb2e485 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -2011,6 +2011,10 @@ nsresult nsTextFrame::GetTextInfoForPainting(nsIPresContext* aPresConte aDisplayingSelection = (aSelectionValue > nsISelectionController::SELECTION_HIDDEN); } + PRInt16 textSel=0; + (*aSelectionController)->GetSelectionFlags(&textSel); + if (!(textSel & nsISelectionDisplay::DISPLAY_TEXT)) + aDisplayingSelection = false; // Transform text from content into renderable form // XXX If the text fragment is already Unicode and text text wasn't diff --git a/mozilla/layout/html/document/src/Makefile.in b/mozilla/layout/html/document/src/Makefile.in index 9faae98e7de..4d4b3ff3ae5 100644 --- a/mozilla/layout/html/document/src/Makefile.in +++ b/mozilla/layout/html/document/src/Makefile.in @@ -46,6 +46,7 @@ REQUIRES = xpcom \ shistory \ xpconnect \ accessibility \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/html/document/src/makefile.win b/mozilla/layout/html/document/src/makefile.win index 11d8ef97288..53102f56f20 100644 --- a/mozilla/layout/html/document/src/makefile.win +++ b/mozilla/layout/html/document/src/makefile.win @@ -42,6 +42,7 @@ REQUIRES = xpcom \ gfx \ content \ layout_xul \ + webBrowser_core \ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/mozilla/layout/html/forms/src/Makefile.in b/mozilla/layout/html/forms/src/Makefile.in index efb109210ac..1f8362783eb 100644 --- a/mozilla/layout/html/forms/src/Makefile.in +++ b/mozilla/layout/html/forms/src/Makefile.in @@ -52,6 +52,7 @@ REQUIRES = xpcom \ xpconnect \ unicharutil \ pref \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/html/forms/src/makefile.win b/mozilla/layout/html/forms/src/makefile.win index f08d31d9e79..ff461fee400 100644 --- a/mozilla/layout/html/forms/src/makefile.win +++ b/mozilla/layout/html/forms/src/makefile.win @@ -49,6 +49,7 @@ REQUIRES = xpcom \ gfx \ content \ content_xul \ + webBrowser_core \ $(NULL) CPP_OBJS= \ diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 52bd2d7d877..aa87f23497c 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -610,8 +610,8 @@ public: //NSISELECTIONCONTROLLER INTERFACES NS_IMETHOD SetDisplaySelection(PRInt16 toggle); NS_IMETHOD GetDisplaySelection(PRInt16 *_retval); - NS_IMETHOD SetDisplayNonTextSelection(PRBool toggle); - NS_IMETHOD GetDisplayNonTextSelection(PRBool *_retval); + NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable); + NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnable); NS_IMETHOD GetSelection(PRInt16 type, nsISelection **_retval); NS_IMETHOD ScrollSelectionIntoView(PRInt16 type, PRInt16 region); NS_IMETHOD RepaintSelection(PRInt16 type); @@ -728,13 +728,13 @@ nsTextInputSelectionImpl::GetDisplaySelection(PRInt16 *aToggle) } NS_IMETHODIMP -nsTextInputSelectionImpl::SetDisplayNonTextSelection(PRBool aToggle) +nsTextInputSelectionImpl::SetSelectionFlags(PRInt16 aToggle) { return NS_OK;//stub this out. not used in input } NS_IMETHODIMP -nsTextInputSelectionImpl::GetDisplayNonTextSelection(PRBool *aToggle) +nsTextInputSelectionImpl::GetSelectionFlags(PRInt16 *aOutEnable) { return NS_OK;//stub this out. not used in input } diff --git a/mozilla/layout/html/style/src/Makefile.in b/mozilla/layout/html/style/src/Makefile.in index 7395a1a070d..35546e3c55e 100644 --- a/mozilla/layout/html/style/src/Makefile.in +++ b/mozilla/layout/html/style/src/Makefile.in @@ -44,6 +44,7 @@ REQUIRES = xpcom \ xuldoc \ imglib2 \ gfx2 \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/html/style/src/makefile.win b/mozilla/layout/html/style/src/makefile.win index a6193130731..fa57d625886 100644 --- a/mozilla/layout/html/style/src/makefile.win +++ b/mozilla/layout/html/style/src/makefile.win @@ -44,6 +44,7 @@ REQUIRES = xpcom \ !ifdef MOZ_SVG raptor \ !endif + webBrowser_core \ $(NULL) diff --git a/mozilla/layout/html/table/src/Makefile.in b/mozilla/layout/html/table/src/Makefile.in index b7d00a7f762..fd84d910cc7 100644 --- a/mozilla/layout/html/table/src/Makefile.in +++ b/mozilla/layout/html/table/src/Makefile.in @@ -39,6 +39,7 @@ REQUIRES = xpcom \ view \ accessibility \ necko \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/html/table/src/makefile.win b/mozilla/layout/html/table/src/makefile.win index 64cf28a9d19..8ee237cb660 100644 --- a/mozilla/layout/html/table/src/makefile.win +++ b/mozilla/layout/html/table/src/makefile.win @@ -34,6 +34,7 @@ REQUIRES = xpcom \ gfx \ content \ necko \ + webBrowser_core \ $(NULL) diff --git a/mozilla/layout/xul/base/src/Makefile.in b/mozilla/layout/xul/base/src/Makefile.in index a18e18725e6..e35f6ca019b 100644 --- a/mozilla/layout/xul/base/src/Makefile.in +++ b/mozilla/layout/xul/base/src/Makefile.in @@ -49,6 +49,7 @@ REQUIRES = xpcom \ gfx2 \ imglib2 \ unicharutil \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/xul/base/src/grid/Makefile.in b/mozilla/layout/xul/base/src/grid/Makefile.in index 77ea4d312d7..6a2037661b1 100644 --- a/mozilla/layout/xul/base/src/grid/Makefile.in +++ b/mozilla/layout/xul/base/src/grid/Makefile.in @@ -36,6 +36,7 @@ REQUIRES = xpcom \ locale \ view \ necko \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/xul/base/src/grid/makefile.win b/mozilla/layout/xul/base/src/grid/makefile.win index d1f3aef0755..ef033d15350 100644 --- a/mozilla/layout/xul/base/src/grid/makefile.win +++ b/mozilla/layout/xul/base/src/grid/makefile.win @@ -31,6 +31,7 @@ REQUIRES = xpcom \ necko \ gfx \ content \ + webBrowser_core \ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/mozilla/layout/xul/base/src/makefile.win b/mozilla/layout/xul/base/src/makefile.win index e6e87c4232c..3adef466591 100644 --- a/mozilla/layout/xul/base/src/makefile.win +++ b/mozilla/layout/xul/base/src/makefile.win @@ -45,6 +45,7 @@ REQUIRES = xpcom \ gfx \ content \ layout \ + webBrowser_core \ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/mozilla/layout/xul/base/src/outliner/src/Makefile.in b/mozilla/layout/xul/base/src/outliner/src/Makefile.in index e4252b63370..321aa505c68 100644 --- a/mozilla/layout/xul/base/src/outliner/src/Makefile.in +++ b/mozilla/layout/xul/base/src/outliner/src/Makefile.in @@ -41,6 +41,7 @@ REQUIRES = xpcom \ necko \ gfx2 \ imglib2 \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/layout/xul/base/src/outliner/src/makefile.win b/mozilla/layout/xul/base/src/outliner/src/makefile.win index adf2818a9aa..d3858acf225 100644 --- a/mozilla/layout/xul/base/src/outliner/src/makefile.win +++ b/mozilla/layout/xul/base/src/outliner/src/makefile.win @@ -36,6 +36,7 @@ REQUIRES = xpcom \ gfx \ content \ content_xul \ + webBrowser_core \ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/mozilla/mailnews/compose/src/Makefile.in b/mozilla/mailnews/compose/src/Makefile.in index ad6f3eaeeda..5e0060c564e 100644 --- a/mozilla/mailnews/compose/src/Makefile.in +++ b/mozilla/mailnews/compose/src/Makefile.in @@ -62,6 +62,7 @@ REQUIRES = xpcom \ nkcache \ mimetype \ windowwatcher \ + webBrowser_core \ $(NULL) CPPSRCS = \ diff --git a/mozilla/mailnews/compose/src/makefile.win b/mozilla/mailnews/compose/src/makefile.win index 09db104d383..d804dad0ce9 100644 --- a/mozilla/mailnews/compose/src/makefile.win +++ b/mozilla/mailnews/compose/src/makefile.win @@ -55,6 +55,7 @@ REQUIRES = xpcom \ mimetype \ windowwatcher \ content \ + webBrowser_core \ $(NULL) include <$(DEPTH)\config\config.mak>