diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index d086b581bcc..d91537d1135 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -71,6 +71,7 @@ #include "nsIDocShell.h" #include "nsIMarkupDocumentViewer.h" #include "nsITreeFrame.h" +#include "nsIOutlinerBoxObject.h" #include "nsIScrollableViewProvider.h" #include "nsIDOMNSDocument.h" @@ -905,16 +906,52 @@ nsEventStateManager::DoWheelScroll(nsIPresContext* aPresContext, // Special case for tree/list frames - they handle their own scrolling nsITreeFrame* treeFrame = nsnull; + nsCOMPtr outlinerBoxObject; nsIFrame* curFrame = aTargetFrame; while (curFrame) { if (NS_OK == curFrame->QueryInterface(NS_GET_IID(nsITreeFrame), (void**) &treeFrame)) break; + + outlinerBoxObject = do_QueryInterface(curFrame); + if (outlinerBoxObject) + break; + curFrame->GetParent(&curFrame); } - if (treeFrame) - return DoTreeScroll(aPresContext, numLines, scrollPage, treeFrame); + + if (treeFrame) { + PRInt32 scrollIndex, visibleRows; + treeFrame->GetIndexOfFirstVisibleRow(&scrollIndex); + treeFrame->GetNumberOfVisibleRows(&visibleRows); + + if (scrollPage) + scrollIndex += ((numLines > 0) ? visibleRows : -visibleRows); + else + scrollIndex += numLines; + + if (scrollIndex < 0) + scrollIndex = 0; + else { + PRInt32 numRows, lastPageTopRow; + treeFrame->GetRowCount(&numRows); + lastPageTopRow = numRows - visibleRows; + if (scrollIndex > lastPageTopRow) + scrollIndex = lastPageTopRow; + } + + treeFrame->ScrollToIndex(scrollIndex); + return NS_OK; + } + + if (outlinerBoxObject) { + if (scrollPage) + outlinerBoxObject->ScrollByPages((numLines > 0) ? 1 : -1); + else + outlinerBoxObject->ScrollByLines(numLines); + return NS_OK; + } nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 1633014050f..955e4538cd1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -169,6 +169,7 @@ static PRBool gNoisyInlineConstruction = PR_FALSE; #include "nsXULTreeCellFrame.h" #include "nsMenuFrame.h" #include "nsPopupSetFrame.h" +#include "nsOutlinerColFrame.h" //------------------------------------------------------------------ @@ -247,6 +248,9 @@ NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame ); nsresult NS_NewTreeScrollPortFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame ); +nsresult +NS_NewOutlinerBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame); + // grid nsresult NS_NewGridLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); @@ -5261,7 +5265,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, display->mDisplay == NS_STYLE_DISPLAY_BOX)) || aTag == nsXULAtoms::box || aTag == nsXULAtoms::vbox || aTag == nsXULAtoms::hbox || aTag == nsXULAtoms::tabbox || aTag == nsXULAtoms::tabpage || aTag == nsXULAtoms::tabcontrol - || aTag == nsXULAtoms::treecell + || aTag == nsXULAtoms::treecell || aTag == nsXULAtoms::outliner ) { processChildren = PR_TRUE; isReplaced = PR_TRUE; @@ -5404,7 +5408,15 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, isReplaced = PR_TRUE; rv = NS_NewSpringFrame(aPresShell, &newFrame); } - + else if (aTag == nsXULAtoms::outlinerbody) { + isReplaced = PR_TRUE; + rv = NS_NewOutlinerBodyFrame(aPresShell, &newFrame); + } + else if (aTag == nsXULAtoms::outlinercol) { + isReplaced = PR_TRUE; + processChildren = PR_TRUE; + rv = NS_NewOutlinerColFrame(aPresShell, &newFrame); + } // TEXT CONSTRUCTION else if (aTag == nsXULAtoms::text) { processChildren = PR_TRUE; diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index ba0cc0d1a47..a7e3b4a05e4 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -56,6 +56,7 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/libgkxulcon_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkxulbase_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkbase_s.$(LIB_SUFFIX) \ + $(DIST)/lib/libgkxuloutliner_s.$(LIB_SUFFIX) \ $(NULL) ifdef MOZ_PERF_METRICS diff --git a/layout/build/makefile.win b/layout/build/makefile.win index 7f31b010796..f29715f1eb6 100644 --- a/layout/build/makefile.win +++ b/layout/build/makefile.win @@ -73,6 +73,7 @@ LLIBS= \ $(DIST)\lib\layouthtmltable_s.lib \ $(DIST)\lib\layoutxulbase_s.lib \ $(DIST)\lib\layoutxulcontent_s.lib \ + $(DIST)\lib\raptorxuloutliner_s.lib \ !ifdef MOZ_MATHML $(DIST)\lib\layoutmathmlbase_s.lib \ $(DIST)\lib\layoutmathmlcontent_s.lib \ diff --git a/layout/build/nsLayoutCID.h b/layout/build/nsLayoutCID.h index ea2e99a9d97..7e03e06cea0 100644 --- a/layout/build/nsLayoutCID.h +++ b/layout/build/nsLayoutCID.h @@ -199,6 +199,10 @@ #define NS_IFRAMEBOXOBJECT_CID \ { 0x9580e69b, 0x8fd6, 0x414e, { 0x80, 0xcd, 0x3a, 0x18, 0x21, 0x1, 0x76, 0x46 } } +// {3B581FD4-3497-426c-8F61-3658B971CB80} +#define NS_OUTLINERBOXOBJECT_CID \ +{ 0x3b581fd4, 0x3497, 0x426c, { 0x8f, 0x61, 0x36, 0x58, 0xb9, 0x71, 0xcb, 0x80 } } + // {8775CA39-4072-4cc0-92D3-A7C2B820089C} #define NS_AUTOCOPYSERVICE_CID \ { 0x8775ca39, 0x4072, 0x4cc0, { 0x92, 0xd3, 0xa7, 0xc2, 0xb8, 0x20, 0x8, 0x9c } } diff --git a/layout/build/nsLayoutFactory.cpp b/layout/build/nsLayoutFactory.cpp index cd2cfbce4c0..c4305fe3bd3 100644 --- a/layout/build/nsLayoutFactory.cpp +++ b/layout/build/nsLayoutFactory.cpp @@ -85,6 +85,7 @@ static NS_DEFINE_CID(kPopupSetBoxObjectCID, NS_POPUPSETBOXOBJECT_CID); static NS_DEFINE_CID(kBrowserBoxObjectCID, NS_BROWSERBOXOBJECT_CID); static NS_DEFINE_CID(kEditorBoxObjectCID, NS_EDITORBOXOBJECT_CID); static NS_DEFINE_CID(kIFrameBoxObjectCID, NS_IFRAMEBOXOBJECT_CID); +static NS_DEFINE_CID(kOutlinerBoxObjectCID, NS_OUTLINERBOXOBJECT_CID); static NS_DEFINE_CID(kAutoCopyServiceCID, NS_AUTOCOPYSERVICE_CID); @@ -102,6 +103,7 @@ extern nsresult NS_NewEditorBoxObject(nsIBoxObject** aResult); extern nsresult NS_NewPopupSetBoxObject(nsIBoxObject** aResult); extern nsresult NS_NewBrowserBoxObject(nsIBoxObject** aResult); extern nsresult NS_NewIFrameBoxObject(nsIBoxObject** aResult); +extern nsresult NS_NewOutlinerBoxObject(nsIBoxObject** aResult); extern nsresult NS_NewAutoCopyService(nsIAutoCopyService** aResult); @@ -291,6 +293,13 @@ nsLayoutFactory::CreateInstance(nsISupports *aOuter, return res; } } + else if (mClassID.Equals(kOutlinerBoxObjectCID)) { + res = NS_NewOutlinerBoxObject((nsIBoxObject**) &inst); + if (NS_FAILED(res)) { + LOG_NEW_FAILURE("NS_NewOutlinerBoxObject", res); + return res; + } + } else if (mClassID.Equals(kAutoCopyServiceCID)) { res = NS_NewAutoCopyService((nsIAutoCopyService**) &inst); if (NS_FAILED(res)) { diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 49955d2dbcb..617486480d8 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -344,6 +344,7 @@ static Components gComponents[] = { { "XUL Editor Box Object", NS_EDITORBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-editor;1" }, { "XUL Iframe Object", NS_IFRAMEBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-iframe;1" }, { "XUL ScrollBox Object", NS_SCROLLBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-scrollbox;1" }, + { "XUL Outliner Box Object", NS_OUTLINERBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-outliner;1" }, { "AutoCopy Service", NS_AUTOCOPYSERVICE_CID, "@mozilla.org/autocopy;1" } }; diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 1633014050f..955e4538cd1 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -169,6 +169,7 @@ static PRBool gNoisyInlineConstruction = PR_FALSE; #include "nsXULTreeCellFrame.h" #include "nsMenuFrame.h" #include "nsPopupSetFrame.h" +#include "nsOutlinerColFrame.h" //------------------------------------------------------------------ @@ -247,6 +248,9 @@ NS_NewMenuBarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame ); nsresult NS_NewTreeScrollPortFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame ); +nsresult +NS_NewOutlinerBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame); + // grid nsresult NS_NewGridLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); @@ -5261,7 +5265,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, display->mDisplay == NS_STYLE_DISPLAY_BOX)) || aTag == nsXULAtoms::box || aTag == nsXULAtoms::vbox || aTag == nsXULAtoms::hbox || aTag == nsXULAtoms::tabbox || aTag == nsXULAtoms::tabpage || aTag == nsXULAtoms::tabcontrol - || aTag == nsXULAtoms::treecell + || aTag == nsXULAtoms::treecell || aTag == nsXULAtoms::outliner ) { processChildren = PR_TRUE; isReplaced = PR_TRUE; @@ -5404,7 +5408,15 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, isReplaced = PR_TRUE; rv = NS_NewSpringFrame(aPresShell, &newFrame); } - + else if (aTag == nsXULAtoms::outlinerbody) { + isReplaced = PR_TRUE; + rv = NS_NewOutlinerBodyFrame(aPresShell, &newFrame); + } + else if (aTag == nsXULAtoms::outlinercol) { + isReplaced = PR_TRUE; + processChildren = PR_TRUE; + rv = NS_NewOutlinerColFrame(aPresShell, &newFrame); + } // TEXT CONSTRUCTION else if (aTag == nsXULAtoms::text) { processChildren = PR_TRUE; diff --git a/layout/xul/base/src/Makefile.in b/layout/xul/base/src/Makefile.in index 39de68817d9..625a1a205b2 100644 --- a/layout/xul/base/src/Makefile.in +++ b/layout/xul/base/src/Makefile.in @@ -24,6 +24,8 @@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ +DIRS = outliner + include $(DEPTH)/config/autoconf.mk MODULE = layout diff --git a/layout/xul/base/src/makefile.win b/layout/xul/base/src/makefile.win index 777654bff20..37f74aff222 100644 --- a/layout/xul/base/src/makefile.win +++ b/layout/xul/base/src/makefile.win @@ -23,6 +23,7 @@ DEPTH=..\..\..\.. LIBRARY_NAME=layoutxulbase_s MODULE=raptor +DIRS=outliner DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/layout/xul/base/src/outliner/src/makefile.win b/layout/xul/base/src/outliner/src/makefile.win index eb738112bf1..9f53c57c34d 100644 --- a/layout/xul/base/src/outliner/src/makefile.win +++ b/layout/xul/base/src/outliner/src/makefile.win @@ -40,7 +40,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsOutlinerSelection.obj \ $(NULL) -EXPORTS = \ +EXPORTS = nsOutlinerColFrame.h \ $(NULL) LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \ diff --git a/themes/modern/global/global.css b/themes/modern/global/global.css index 365a9fc5e93..9b1325c083a 100644 --- a/themes/modern/global/global.css +++ b/themes/modern/global/global.css @@ -16,6 +16,7 @@ @import url(chrome://global/skin/checkbox.css); @import url(chrome://global/skin/radio.css); @import url(chrome://global/skin/tree.css); +@import url(chrome://global/skin/outliner.css); @import url(chrome://global/skin/splitter.css); @import url(chrome://global/skin/radio.css); @import url(chrome://global/skin/menubutton.css); diff --git a/themes/modern/jar.mn b/themes/modern/jar.mn index 19a222c63fb..3954825bdd8 100644 --- a/themes/modern/jar.mn +++ b/themes/modern/jar.mn @@ -179,6 +179,7 @@ modern.jar: skin/modern/global/toolbar-menu-arrow-hover.gif (global/toolbar-menu-arrow-hover.gif) skin/modern/global/toolbar-menu-arrow.gif (global/toolbar-menu-arrow.gif) skin/modern/global/toolbar.css (global/toolbar.css) + skin/modern/global/outliner.css (global/outliner.css) skin/modern/global/tree.css (global/tree.css) skin/modern/global/wizardOverlay.css (global/wizardOverlay.css) skin/modern/global/loading.gif (global/loading.gif)