Landing the tree widget branch.

This commit is contained in:
hyatt%netscape.com 1999-06-23 03:02:21 +00:00
Родитель e37332e97d
Коммит b66c3c67f2
79 изменённых файлов: 2683 добавлений и 1775 удалений

Просмотреть файл

@ -58,7 +58,7 @@ public:
static nsIAtom* tree; // The start of a tree view
static nsIAtom* treecaption; // The caption of a tree view
static nsIAtom* treehead; // The header of the tree view
static nsIAtom* treebody; // The body of the tree view
static nsIAtom* treerow; // A row in the tree view
static nsIAtom* treeitem; // An item in the tree view
static nsIAtom* treecell; // A cell in the tree view
static nsIAtom* treechildren; // The children of an item in the tree viw

Просмотреть файл

@ -40,7 +40,7 @@ nsIAtom* nsXULAtoms::toolbox;
nsIAtom* nsXULAtoms::tree;
nsIAtom* nsXULAtoms::treecaption;
nsIAtom* nsXULAtoms::treehead;
nsIAtom* nsXULAtoms::treebody;
nsIAtom* nsXULAtoms::treerow;
nsIAtom* nsXULAtoms::treeitem;
nsIAtom* nsXULAtoms::treecell;
nsIAtom* nsXULAtoms::treechildren;
@ -105,7 +105,7 @@ void nsXULAtoms::AddrefAtoms() {
tree = NS_NewAtom("tree");
treecaption = NS_NewAtom("treecaption");
treehead = NS_NewAtom("treehead");
treebody = NS_NewAtom("treebody");
treerow = NS_NewAtom("treerow");
treecell = NS_NewAtom("treecell");
treeitem = NS_NewAtom("treeitem");
treechildren = NS_NewAtom("treechildren");
@ -161,7 +161,7 @@ void nsXULAtoms::ReleaseAtoms() {
NS_RELEASE(tree);
NS_RELEASE(treecaption);
NS_RELEASE(treehead);
NS_RELEASE(treebody);
NS_RELEASE(treerow);
NS_RELEASE(treecell);
NS_RELEASE(treeitem);
NS_RELEASE(treechildren);

Просмотреть файл

@ -1652,12 +1652,8 @@ RDFElementImpl::AppendChildTo(nsIContent* aKid, PRBool aNotify)
PRUint32 cnt;
nsresult rv = mChildren->Count(&cnt);
if (NS_FAILED(rv)) return rv;
#if 0
// XXX Can't do this because of the tree frame trickery, I think.
mDocument->ContentAppended(NS_STATIC_CAST(nsIStyledContent*, this), cnt - 1);
#else
mDocument->ContentInserted(NS_STATIC_CAST(nsIStyledContent*, this), aKid, cnt - 1);
#endif
}
}
return NS_OK;

Просмотреть файл

@ -2006,7 +2006,9 @@ RDFGenericBuilderImpl::EnsureElementHasGenericChild(nsIContent* parent,
if (NS_FAILED(rv = NS_NewRDFElement(nameSpaceID, tag, getter_AddRefs(element))))
return rv;
if (NS_FAILED(rv = parent->AppendChildTo(element, PR_FALSE)))
if (NS_FAILED(rv = parent->AppendChildTo(element, PR_TRUE)))
// XXX Note that the notification ensures we won't batch insertions! This could be bad! - Dave
return rv;
*result = element;
@ -2015,47 +2017,6 @@ RDFGenericBuilderImpl::EnsureElementHasGenericChild(nsIContent* parent,
return NS_OK;
}
nsresult
RDFGenericBuilderImpl::FindWidgetRootElement(nsIContent* aElement,
nsIContent** aWidgetElement)
{
nsresult rv;
nsCOMPtr<nsIAtom> rootAtom;
if (NS_FAILED(rv = GetRootWidgetAtom(getter_AddRefs(rootAtom)))) {
return rv;
}
// walk up the tree until you find rootAtom
nsCOMPtr<nsIContent> element(do_QueryInterface(aElement));
while (element) {
PRInt32 nameSpaceID;
if (NS_FAILED(rv = element->GetNameSpaceID(nameSpaceID)))
return rv; // XXX fatal
if (nameSpaceID == kNameSpaceID_XUL) {
nsCOMPtr<nsIAtom> tag;
if (NS_FAILED(rv = element->GetTag(*getter_AddRefs(tag))))
return rv;
if (tag == rootAtom) {
*aWidgetElement = element;
NS_ADDREF(*aWidgetElement);
return NS_OK;
}
}
// up to the parent...
nsCOMPtr<nsIContent> parent;
element->GetParent(*getter_AddRefs(parent));
element = parent;
}
//NS_ERROR("must not've started from within the XUL widget");
return NS_ERROR_FAILURE;
}
PRBool
RDFGenericBuilderImpl::IsItemOrFolder(nsIContent* aElement)
@ -2322,9 +2283,17 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement)
return rv;
}
// The insertion root is _always_ open.
if (tag == insertionAtom)
return PR_TRUE;
if (tag == insertionAtom) {
// Hack for the tree widget
nsCOMPtr<nsIContent> parent;
aElement->GetParent(*getter_AddRefs(parent));
nsCOMPtr<nsIAtom> parentTag;
parent->GetTag(*getter_AddRefs(parentTag));
nsString tagName;
parentTag->ToString(tagName);
if (tagName == "tree")
return PR_TRUE;
}
// If it's not a widget folder item, then it's not open.
if (tag != folderAtom)
@ -2341,6 +2310,7 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement)
return PR_TRUE;
}
return PR_FALSE;
}

Просмотреть файл

@ -65,6 +65,7 @@
#ifdef INCLUDE_XUL
#include "nsXULAtoms.h"
#include "nsTreeFrame.h"
#include "nsTreeRowGroupFrame.h"
#include "nsToolboxFrame.h"
#include "nsToolbarFrame.h"
#include "nsTreeIndentationFrame.h"
@ -321,6 +322,7 @@ nsTableCreator::CreateTableCellFrame(nsIFrame** aNewFrame) {
struct nsTreeCreator: public nsTableCreator {
nsresult CreateTableFrame(nsIFrame** aNewFrame);
nsresult CreateTableCellFrame(nsIFrame** aNewFrame);
nsresult CreateTableRowGroupFrame(nsIFrame** aNewFrame);
PRBool IsTreeCreator() { return PR_TRUE; };
};
@ -337,6 +339,12 @@ nsTreeCreator::CreateTableCellFrame(nsIFrame** aNewFrame)
return NS_NewTreeCellFrame(aNewFrame);
}
nsresult
nsTreeCreator::CreateTableRowGroupFrame(nsIFrame** aNewFrame)
{
return NS_NewTreeRowGroupFrame(aNewFrame);
}
#endif // INCLUDE_XUL
// -----------------------------------------------------------
@ -1244,6 +1252,7 @@ nsCSSFrameConstructor::ConstructTableGroupFrameOnly(nsIPresContext* aPr
// Create an area container for the frame
rv = (aIsRowGroup) ? aTableCreator.CreateTableRowGroupFrame(&aNewGroupFrame)
: aTableCreator.CreateTableColGroupFrame(&aNewGroupFrame);
if (NS_FAILED(rv)) return rv;
// Initialize the frame and force it to have a view
aNewGroupFrame->Init(*aPresContext, aContent, aNewTopFrame, scrolledPseudoStyle,
@ -1263,6 +1272,24 @@ nsCSSFrameConstructor::ConstructTableGroupFrameOnly(nsIPresContext* aPr
if (aProcessChildren) {
nsFrameItems childItems;
if (aIsRowGroup) {
// Create some anonymous extras within the tree body.
if (aTableCreator.IsTreeCreator()) {
nsCOMPtr<nsIAtom> tag;
aContent->GetTag(*getter_AddRefs(tag));
CreateAnonymousXULContent(aPresContext, tag, aState, aContent, aNewGroupFrame,
childItems);
if (styleDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW_GROUP) {
// We're the child of another row group. If it's lazy, we're lazy.
nsTreeRowGroupFrame* treeFrame = (nsTreeRowGroupFrame*)aParentFrame;
if (treeFrame->IsLazy()) {
((nsTreeRowGroupFrame*)aNewGroupFrame)->MakeLazy();
((nsTreeRowGroupFrame*)aNewGroupFrame)->SetFrameConstructor(this);
}
}
}
TableProcessChildren(aPresContext, aState, aContent, aNewGroupFrame,
childItems, aTableCreator);
} else {
@ -1582,10 +1609,19 @@ nsCSSFrameConstructor::TableProcessChildren(nsIPresContext* aPresContex
nsCOMPtr<nsIStyleContext> parentStyleContext;
aParentFrame->GetStyleContext(getter_AddRefs(parentStyleContext));
const nsStyleDisplay* display = (const nsStyleDisplay*)
parentStyleContext->GetStyleData(eStyleStruct_Display);
if (aTableCreator.IsTreeCreator() &&
(display->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW_GROUP)) {
// Stop the processing if we're lazy. The tree row group frame builds its children
// as needed.
if (((nsTreeRowGroupFrame*)aParentFrame)->IsLazy())
return NS_OK;
}
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> childContent;
aContent->ChildAt(i, *getter_AddRefs(childContent));
rv = TableProcessChild(aPresContext, aState, childContent, aParentFrame, parentStyleContext,
aChildItems, aTableCreator);
@ -1734,8 +1770,8 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
(nsXULAtoms::widget == tag.get()) ||
(nsXULAtoms::tree == tag.get()) ||
(nsXULAtoms::treechildren == tag.get()) ||
(nsXULAtoms::treebody == tag.get()) ||
(nsXULAtoms::treeitem == tag.get()) ||
(nsXULAtoms::treerow == tag.get()) ||
(nsXULAtoms::treecell == tag.get()) ||
(nsXULAtoms::treeindentation == tag.get()) ||
(nsXULAtoms::toolbox == tag.get()) ||
@ -2738,9 +2774,9 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
// TREE CONSTRUCTION
// The following code is used to construct a tree view from the XUL content
// model. It has to take the hierarchical tree content structure and build a flattened
// table row frame structure.
else if (aTag == nsXULAtoms::treebody) {
// model.
else if (aTag == nsXULAtoms::treeitem ||
aTag == nsXULAtoms::treechildren) {
nsIFrame* newTopFrame;
rv = ConstructTableGroupFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
PR_TRUE, newTopFrame, newFrame, treeCreator, nsnull);
@ -2784,12 +2820,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
}
return rv;
}
else if (aTag == nsXULAtoms::treechildren)
{
haltProcessing = PR_TRUE;
return rv; // This is actually handled by the treeitem node.
}
else if (aTag == nsXULAtoms::treeitem)
else if (aTag == nsXULAtoms::treerow)
{
// A tree item causes a table row to be constructed that is always
// slaved to the nearest enclosing table row group (regardless of how
@ -2797,60 +2828,29 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
rv = ConstructTableRowFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
newFrame, ignore, treeCreator);
aFrameItems.AddChild(newFrame);
// We need to find the treechildren node that is a child of this node
// and we need to construct new rows.
PRInt32 aChildCount;
aContent->ChildCount(aChildCount);
for (PRInt32 i = 0; i < aChildCount; i++)
{
nsCOMPtr<nsIContent> childContent;
if (NS_SUCCEEDED(aContent->ChildAt(i, *getter_AddRefs(childContent))))
{
// Construct a child frame
nsCOMPtr<nsIAtom> pTag;
childContent->GetTag(*getter_AddRefs(pTag));
if (pTag.get() == nsXULAtoms::treechildren)
{
// Always build rows. Rely on style rules to hide frames.
// Rely on RDF trickery to hide synthetic content from the content model.
nsFrameConstructorSaveState floaterSaveState;
aState.PushFloaterContainingBlock(nsnull, floaterSaveState);
rv = ProcessChildren(aPresContext, aState, childContent, aParentFrame,
PR_FALSE, aFrameItems);
NS_ASSERTION(!aState.mFloatedItems.childList, "floater in odd spot");
}
}
}
return rv;
// Note: See later in this method. More processing has to be done after the
// tree item has constructed its children and after this frame has been added
// to our list.
}
else if (aTag == nsXULAtoms::treecell)
{
// We make a tree cell frame and process the children.
// Find out what the attribute value for event allowance is.
nsString attrValue;
nsresult result = aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::treeallowevents, attrValue);
attrValue.ToLowerCase();
PRBool allowEvents = (result == NS_CONTENT_ATTR_NO_VALUE ||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue=="true"));
nsIFrame* ignore2;
rv = ConstructTableCellFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
newFrame, ignore, ignore2, treeCreator);
aFrameItems.AddChild(newFrame);
((nsTreeCellFrame*)newFrame)->SetAllowEvents(allowEvents);
return rv;
}
else if (aTag == nsXULAtoms::treeindentation)
{
rv = NS_NewTreeIndentationFrame(&newFrame);
}
// End of TREE CONSTRUCTION code here (there's more later on in the function)
}
else if (aTag == nsXULAtoms::treecell)
{
// We make a tree cell frame and process the children.
// Find out what the attribute value for event allowance is.
nsString attrValue;
nsresult result = aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::treeallowevents, attrValue);
attrValue.ToLowerCase();
PRBool allowEvents = (result == NS_CONTENT_ATTR_NO_VALUE ||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue=="true"));
nsIFrame* ignore2;
rv = ConstructTableCellFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
newFrame, ignore, ignore2, treeCreator);
aFrameItems.AddChild(newFrame);
((nsTreeCellFrame*)newFrame)->SetAllowEvents(allowEvents);
return rv;
}
else if (aTag == nsXULAtoms::treeindentation)
{
rv = NS_NewTreeIndentationFrame(&newFrame);
}
// End of TREE CONSTRUCTION code here (there's more later on in the function)
// TOOLBAR CONSTRUCTION
else if (aTag == nsXULAtoms::toolbox) {
@ -3003,9 +3003,43 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
nsIAtom* aTag,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aNewFrame,
nsIFrame* aParentFrame,
nsFrameItems& aChildItems)
{
if (aTag == nsXULAtoms::treechildren) {
// See if our parent is a tree.
nsCOMPtr<nsIContent> grandPappy;
aContent->GetParent(*getter_AddRefs(grandPappy));
nsCOMPtr<nsIAtom> tag;
grandPappy->GetTag(*getter_AddRefs(tag));
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(grandPappy);
nsString mode;
element->GetAttribute("mode", mode);
if (tag.get() == nsXULAtoms::tree && mode == "lazy") {
// Create an anonymous scrollbar node.
nsCOMPtr<nsIDocument> idocument;
aContent->GetDocument(*getter_AddRefs(idocument));
nsCOMPtr<nsIDOMDocument> document(do_QueryInterface(idocument));
nsCOMPtr<nsIDOMElement> node;
document->CreateElement("scrollbar",getter_AddRefs(node));
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
content->SetParent(aContent);
nsCOMPtr<nsIAtom> vertical = dont_AddRef(NS_NewAtom("align"));
nsCOMPtr<nsIAtom> style = dont_AddRef(NS_NewAtom("style"));
content->SetAttribute(kNameSpaceID_None, vertical, "vertical", PR_FALSE);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
((nsTreeRowGroupFrame*)aParentFrame)->SetScrollbarFrame(aChildItems.lastChild);
((nsTreeRowGroupFrame*)aParentFrame)->SetFrameConstructor(this);
}
}
// if we are creating a scrollbar
if (aTag == nsXULAtoms::scrollbar) {
@ -3031,7 +3065,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, "decrement", PR_TRUE);
content->SetParent(aContent);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
// a slider
document->CreateElement("slider",getter_AddRefs(node));
@ -3039,7 +3073,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, "100%", PR_TRUE);
content->SetParent(aContent);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
// make sure the slider's thumb is flexible.
nsIFrame* thumb;
@ -3061,7 +3095,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, "increment", PR_TRUE);
content->SetParent(aContent);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
}
} else if (aTag == nsXULAtoms::slider) {
@ -3083,7 +3117,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(node);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
}
}
@ -3969,6 +4003,20 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
}
}
#ifdef INCLUDE_XUL
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
if (tag == nsXULAtoms::treechildren ||
tag == nsXULAtoms::treeitem) {
// Convert to a tree row group frame.
nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame;
if (treeRowGroup->IsLazy() && !treeRowGroup->IsFull()) {
treeRowGroup->OnContentAdded(*aPresContext);
return NS_OK;
}
}
#endif // INCLUDE_XUL
// Create some new frames
PRInt32 count;
nsIFrame* firstAppendedFrame = nsnull;
@ -4190,47 +4238,9 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsIFrame* parentFrame;
if ((nsnull == prevSibling) && (nsnull == nextSibling)) {
#ifdef INCLUDE_XUL
// Need to (for XUL only) do a special check for the treechildren tag
PRInt32 nameSpaceID;
if (NS_SUCCEEDED(aContainer->GetNameSpaceID(nameSpaceID)) &&
nameSpaceID == nsXULAtoms::nameSpaceID) {
// See if we're the treechildren tag. This tag is treated differently,
// since it has no corresponding frame, but may have children that have
// frames (the whole hierarchical content model vs. flat table frame model
// problem).
nsIAtom* tag;
aContainer->GetTag(tag);
nsString tagName;
tag->ToString(tagName);
if (tagName == "treechildren")
{
// Retrieve the parent treeitem, and then obtain its frame. This is
// the prevSibling frame that we should use.
nsCOMPtr<nsIContent> parentItem;
aContainer->GetParent(*getter_AddRefs(parentItem));
shell->GetPrimaryFrameFor(parentItem, &prevSibling);
prevSibling->GetParent(&parentFrame);
// XXX: Optimize for the lazy frame instantiation case. Need to bail
// if our frame isn't visible
}
else
{
// No previous or next sibling so treat this like an appended frame.
isAppend = PR_TRUE;
shell->GetPrimaryFrameFor(aContainer, &parentFrame);
}
}
else {
#endif // INCLUDE_XUL
// No previous or next sibling so treat this like an appended frame.
isAppend = PR_TRUE;
shell->GetPrimaryFrameFor(aContainer, &parentFrame);
#ifdef INCLUDE_XUL
}
#endif
} else {
// Use the prev sibling if we have it; otherwise use the next sibling
if (nsnull != prevSibling) {
@ -4242,6 +4252,21 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
// Construct a new frame
if (nsnull != parentFrame) {
#ifdef INCLUDE_XUL
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
if (tag == nsXULAtoms::treechildren ||
tag == nsXULAtoms::treeitem) {
// Convert to a tree row group frame.
nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame;
if (treeRowGroup->IsLazy()) {
treeRowGroup->OnContentAdded(*aPresContext);
return NS_OK;
}
}
#endif // INCLUDE_XUL
nsFrameItems frameItems;
nsFrameConstructorState state(mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext, parentFrame),
@ -4484,41 +4509,6 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
nsIFrame* parentFrame;
childFrame->GetParent(&parentFrame);
rv = parentFrame->RemoveFrame(*aPresContext, *shell, nsnull, childFrame);
#ifdef INCLUDE_XUL
// Need to (for XUL only) do a special check for the treeitem tag
PRInt32 nameSpaceID;
if (aContainer &&
NS_SUCCEEDED(aContainer->GetNameSpaceID(nameSpaceID)) &&
nameSpaceID == nsXULAtoms::nameSpaceID) {
// See if we're the treeitem tag. This tag is treated differently,
// since the children of the content node are actually SIBLING frames.
// We've only removed the parent frame. Now we have to remove all of
// its children.
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
nsString tagName;
tag->ToString(tagName);
if (tagName == "treeitem")
{
// Calling content removed on each of our content node children
// should do the trick.
PRInt32 count = 0;
aContainer->ChildCount(count);
for (PRInt32 i = 0; i < count; i++)
{
nsCOMPtr<nsIContent> childContent;
aContainer->ChildAt(i, *getter_AddRefs(childContent));
if (childContent)
{
// Call ContentRemoved.
ContentRemoved(aPresContext, aContainer,
childContent, i);
}
}
}
}
#endif // INCLUDE_XUL
}
}
@ -6008,3 +5998,66 @@ nsCSSFrameConstructor::WrapTextFrame(nsIPresContext* aPresContext,
return NS_OK;
}
// Tree Widget Routines
NS_IMETHODIMP
nsCSSFrameConstructor::CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIContent* aChild,
nsIFrame** aNewFrame)
{
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsresult rv = NS_OK;
// Construct a new frame
if (nsnull != aParentFrame) {
nsFrameItems frameItems;
nsFrameConstructorState state(mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext, aParentFrame),
GetFloaterContainingBlock(aPresContext, aParentFrame));
rv = ConstructFrame(aPresContext, state, aChild, aParentFrame, PR_FALSE,
frameItems);
nsIFrame* newFrame = frameItems.childList;
*aNewFrame = newFrame;
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
// Notify the parent frame
rv = ((nsTreeRowGroupFrame*)aParentFrame)->TreeAppendFrames(newFrame);
// If there are new absolutely positioned child frames, then notify
// the parent
// XXX We can't just assume these frames are being appended, we need to
// determine where in the list they should be inserted...
if (state.mAbsoluteItems.childList) {
rv = state.mAbsoluteItems.containingBlock->AppendFrames(*aPresContext, *shell,
nsLayoutAtoms::absoluteList,
state.mAbsoluteItems.childList);
}
// If there are new fixed positioned child frames, then notify
// the parent
// XXX We can't just assume these frames are being appended, we need to
// determine where in the list they should be inserted...
if (state.mFixedItems.childList) {
rv = state.mFixedItems.containingBlock->AppendFrames(*aPresContext, *shell,
nsLayoutAtoms::fixedList,
state.mFixedItems.childList);
}
// If there are new floating child frames, then notify
// the parent
// XXX We can't just assume these frames are being appended, we need to
// determine where in the list they should be inserted...
if (state.mFloatedItems.childList) {
rv = state.mFloatedItems.containingBlock->AppendFrames(*aPresContext, *shell,
nsLayoutAtoms::floaterList,
state.mFloatedItems.childList);
}
}
}
return rv;
}

Просмотреть файл

@ -112,6 +112,11 @@ public:
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame);
NS_IMETHODIMP CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIContent* aChild,
nsIFrame** aResult);
protected:
nsresult ResolveStyleContext(nsIPresContext* aPresContext,
@ -422,7 +427,7 @@ protected:
nsIAtom* aTag,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aNewFrame,
nsIFrame* aParentFrame,
nsFrameItems& aChildItems);
#endif

Просмотреть файл

@ -65,6 +65,7 @@
#ifdef INCLUDE_XUL
#include "nsXULAtoms.h"
#include "nsTreeFrame.h"
#include "nsTreeRowGroupFrame.h"
#include "nsToolboxFrame.h"
#include "nsToolbarFrame.h"
#include "nsTreeIndentationFrame.h"
@ -321,6 +322,7 @@ nsTableCreator::CreateTableCellFrame(nsIFrame** aNewFrame) {
struct nsTreeCreator: public nsTableCreator {
nsresult CreateTableFrame(nsIFrame** aNewFrame);
nsresult CreateTableCellFrame(nsIFrame** aNewFrame);
nsresult CreateTableRowGroupFrame(nsIFrame** aNewFrame);
PRBool IsTreeCreator() { return PR_TRUE; };
};
@ -337,6 +339,12 @@ nsTreeCreator::CreateTableCellFrame(nsIFrame** aNewFrame)
return NS_NewTreeCellFrame(aNewFrame);
}
nsresult
nsTreeCreator::CreateTableRowGroupFrame(nsIFrame** aNewFrame)
{
return NS_NewTreeRowGroupFrame(aNewFrame);
}
#endif // INCLUDE_XUL
// -----------------------------------------------------------
@ -1244,6 +1252,7 @@ nsCSSFrameConstructor::ConstructTableGroupFrameOnly(nsIPresContext* aPr
// Create an area container for the frame
rv = (aIsRowGroup) ? aTableCreator.CreateTableRowGroupFrame(&aNewGroupFrame)
: aTableCreator.CreateTableColGroupFrame(&aNewGroupFrame);
if (NS_FAILED(rv)) return rv;
// Initialize the frame and force it to have a view
aNewGroupFrame->Init(*aPresContext, aContent, aNewTopFrame, scrolledPseudoStyle,
@ -1263,6 +1272,24 @@ nsCSSFrameConstructor::ConstructTableGroupFrameOnly(nsIPresContext* aPr
if (aProcessChildren) {
nsFrameItems childItems;
if (aIsRowGroup) {
// Create some anonymous extras within the tree body.
if (aTableCreator.IsTreeCreator()) {
nsCOMPtr<nsIAtom> tag;
aContent->GetTag(*getter_AddRefs(tag));
CreateAnonymousXULContent(aPresContext, tag, aState, aContent, aNewGroupFrame,
childItems);
if (styleDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW_GROUP) {
// We're the child of another row group. If it's lazy, we're lazy.
nsTreeRowGroupFrame* treeFrame = (nsTreeRowGroupFrame*)aParentFrame;
if (treeFrame->IsLazy()) {
((nsTreeRowGroupFrame*)aNewGroupFrame)->MakeLazy();
((nsTreeRowGroupFrame*)aNewGroupFrame)->SetFrameConstructor(this);
}
}
}
TableProcessChildren(aPresContext, aState, aContent, aNewGroupFrame,
childItems, aTableCreator);
} else {
@ -1582,10 +1609,19 @@ nsCSSFrameConstructor::TableProcessChildren(nsIPresContext* aPresContex
nsCOMPtr<nsIStyleContext> parentStyleContext;
aParentFrame->GetStyleContext(getter_AddRefs(parentStyleContext));
const nsStyleDisplay* display = (const nsStyleDisplay*)
parentStyleContext->GetStyleData(eStyleStruct_Display);
if (aTableCreator.IsTreeCreator() &&
(display->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW_GROUP)) {
// Stop the processing if we're lazy. The tree row group frame builds its children
// as needed.
if (((nsTreeRowGroupFrame*)aParentFrame)->IsLazy())
return NS_OK;
}
aContent->ChildCount(count);
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIContent> childContent;
aContent->ChildAt(i, *getter_AddRefs(childContent));
rv = TableProcessChild(aPresContext, aState, childContent, aParentFrame, parentStyleContext,
aChildItems, aTableCreator);
@ -1734,8 +1770,8 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
(nsXULAtoms::widget == tag.get()) ||
(nsXULAtoms::tree == tag.get()) ||
(nsXULAtoms::treechildren == tag.get()) ||
(nsXULAtoms::treebody == tag.get()) ||
(nsXULAtoms::treeitem == tag.get()) ||
(nsXULAtoms::treerow == tag.get()) ||
(nsXULAtoms::treecell == tag.get()) ||
(nsXULAtoms::treeindentation == tag.get()) ||
(nsXULAtoms::toolbox == tag.get()) ||
@ -2738,9 +2774,9 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
// TREE CONSTRUCTION
// The following code is used to construct a tree view from the XUL content
// model. It has to take the hierarchical tree content structure and build a flattened
// table row frame structure.
else if (aTag == nsXULAtoms::treebody) {
// model.
else if (aTag == nsXULAtoms::treeitem ||
aTag == nsXULAtoms::treechildren) {
nsIFrame* newTopFrame;
rv = ConstructTableGroupFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
PR_TRUE, newTopFrame, newFrame, treeCreator, nsnull);
@ -2784,12 +2820,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
}
return rv;
}
else if (aTag == nsXULAtoms::treechildren)
{
haltProcessing = PR_TRUE;
return rv; // This is actually handled by the treeitem node.
}
else if (aTag == nsXULAtoms::treeitem)
else if (aTag == nsXULAtoms::treerow)
{
// A tree item causes a table row to be constructed that is always
// slaved to the nearest enclosing table row group (regardless of how
@ -2797,60 +2828,29 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
rv = ConstructTableRowFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
newFrame, ignore, treeCreator);
aFrameItems.AddChild(newFrame);
// We need to find the treechildren node that is a child of this node
// and we need to construct new rows.
PRInt32 aChildCount;
aContent->ChildCount(aChildCount);
for (PRInt32 i = 0; i < aChildCount; i++)
{
nsCOMPtr<nsIContent> childContent;
if (NS_SUCCEEDED(aContent->ChildAt(i, *getter_AddRefs(childContent))))
{
// Construct a child frame
nsCOMPtr<nsIAtom> pTag;
childContent->GetTag(*getter_AddRefs(pTag));
if (pTag.get() == nsXULAtoms::treechildren)
{
// Always build rows. Rely on style rules to hide frames.
// Rely on RDF trickery to hide synthetic content from the content model.
nsFrameConstructorSaveState floaterSaveState;
aState.PushFloaterContainingBlock(nsnull, floaterSaveState);
rv = ProcessChildren(aPresContext, aState, childContent, aParentFrame,
PR_FALSE, aFrameItems);
NS_ASSERTION(!aState.mFloatedItems.childList, "floater in odd spot");
}
}
}
return rv;
// Note: See later in this method. More processing has to be done after the
// tree item has constructed its children and after this frame has been added
// to our list.
}
else if (aTag == nsXULAtoms::treecell)
{
// We make a tree cell frame and process the children.
// Find out what the attribute value for event allowance is.
nsString attrValue;
nsresult result = aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::treeallowevents, attrValue);
attrValue.ToLowerCase();
PRBool allowEvents = (result == NS_CONTENT_ATTR_NO_VALUE ||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue=="true"));
nsIFrame* ignore2;
rv = ConstructTableCellFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
newFrame, ignore, ignore2, treeCreator);
aFrameItems.AddChild(newFrame);
((nsTreeCellFrame*)newFrame)->SetAllowEvents(allowEvents);
return rv;
}
else if (aTag == nsXULAtoms::treeindentation)
{
rv = NS_NewTreeIndentationFrame(&newFrame);
}
// End of TREE CONSTRUCTION code here (there's more later on in the function)
}
else if (aTag == nsXULAtoms::treecell)
{
// We make a tree cell frame and process the children.
// Find out what the attribute value for event allowance is.
nsString attrValue;
nsresult result = aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::treeallowevents, attrValue);
attrValue.ToLowerCase();
PRBool allowEvents = (result == NS_CONTENT_ATTR_NO_VALUE ||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue=="true"));
nsIFrame* ignore2;
rv = ConstructTableCellFrame(aPresContext, aState, aContent, aParentFrame, aStyleContext,
newFrame, ignore, ignore2, treeCreator);
aFrameItems.AddChild(newFrame);
((nsTreeCellFrame*)newFrame)->SetAllowEvents(allowEvents);
return rv;
}
else if (aTag == nsXULAtoms::treeindentation)
{
rv = NS_NewTreeIndentationFrame(&newFrame);
}
// End of TREE CONSTRUCTION code here (there's more later on in the function)
// TOOLBAR CONSTRUCTION
else if (aTag == nsXULAtoms::toolbox) {
@ -3003,9 +3003,43 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
nsIAtom* aTag,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aNewFrame,
nsIFrame* aParentFrame,
nsFrameItems& aChildItems)
{
if (aTag == nsXULAtoms::treechildren) {
// See if our parent is a tree.
nsCOMPtr<nsIContent> grandPappy;
aContent->GetParent(*getter_AddRefs(grandPappy));
nsCOMPtr<nsIAtom> tag;
grandPappy->GetTag(*getter_AddRefs(tag));
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(grandPappy);
nsString mode;
element->GetAttribute("mode", mode);
if (tag.get() == nsXULAtoms::tree && mode == "lazy") {
// Create an anonymous scrollbar node.
nsCOMPtr<nsIDocument> idocument;
aContent->GetDocument(*getter_AddRefs(idocument));
nsCOMPtr<nsIDOMDocument> document(do_QueryInterface(idocument));
nsCOMPtr<nsIDOMElement> node;
document->CreateElement("scrollbar",getter_AddRefs(node));
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
content->SetParent(aContent);
nsCOMPtr<nsIAtom> vertical = dont_AddRef(NS_NewAtom("align"));
nsCOMPtr<nsIAtom> style = dont_AddRef(NS_NewAtom("style"));
content->SetAttribute(kNameSpaceID_None, vertical, "vertical", PR_FALSE);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
((nsTreeRowGroupFrame*)aParentFrame)->SetScrollbarFrame(aChildItems.lastChild);
((nsTreeRowGroupFrame*)aParentFrame)->SetFrameConstructor(this);
}
}
// if we are creating a scrollbar
if (aTag == nsXULAtoms::scrollbar) {
@ -3031,7 +3065,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, "decrement", PR_TRUE);
content->SetParent(aContent);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
// a slider
document->CreateElement("slider",getter_AddRefs(node));
@ -3039,7 +3073,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, "100%", PR_TRUE);
content->SetParent(aContent);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
// make sure the slider's thumb is flexible.
nsIFrame* thumb;
@ -3061,7 +3095,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, "increment", PR_TRUE);
content->SetParent(aContent);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
}
} else if (aTag == nsXULAtoms::slider) {
@ -3083,7 +3117,7 @@ nsCSSFrameConstructor::CreateAnonymousXULContent(nsIPresContext* aPresContext,
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(node);
ConstructFrame(aPresContext, aState, content, aNewFrame, PR_FALSE, aChildItems);
ConstructFrame(aPresContext, aState, content, aParentFrame, PR_FALSE, aChildItems);
}
}
@ -3969,6 +4003,20 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
}
}
#ifdef INCLUDE_XUL
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
if (tag == nsXULAtoms::treechildren ||
tag == nsXULAtoms::treeitem) {
// Convert to a tree row group frame.
nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame;
if (treeRowGroup->IsLazy() && !treeRowGroup->IsFull()) {
treeRowGroup->OnContentAdded(*aPresContext);
return NS_OK;
}
}
#endif // INCLUDE_XUL
// Create some new frames
PRInt32 count;
nsIFrame* firstAppendedFrame = nsnull;
@ -4190,47 +4238,9 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsIFrame* parentFrame;
if ((nsnull == prevSibling) && (nsnull == nextSibling)) {
#ifdef INCLUDE_XUL
// Need to (for XUL only) do a special check for the treechildren tag
PRInt32 nameSpaceID;
if (NS_SUCCEEDED(aContainer->GetNameSpaceID(nameSpaceID)) &&
nameSpaceID == nsXULAtoms::nameSpaceID) {
// See if we're the treechildren tag. This tag is treated differently,
// since it has no corresponding frame, but may have children that have
// frames (the whole hierarchical content model vs. flat table frame model
// problem).
nsIAtom* tag;
aContainer->GetTag(tag);
nsString tagName;
tag->ToString(tagName);
if (tagName == "treechildren")
{
// Retrieve the parent treeitem, and then obtain its frame. This is
// the prevSibling frame that we should use.
nsCOMPtr<nsIContent> parentItem;
aContainer->GetParent(*getter_AddRefs(parentItem));
shell->GetPrimaryFrameFor(parentItem, &prevSibling);
prevSibling->GetParent(&parentFrame);
// XXX: Optimize for the lazy frame instantiation case. Need to bail
// if our frame isn't visible
}
else
{
// No previous or next sibling so treat this like an appended frame.
isAppend = PR_TRUE;
shell->GetPrimaryFrameFor(aContainer, &parentFrame);
}
}
else {
#endif // INCLUDE_XUL
// No previous or next sibling so treat this like an appended frame.
isAppend = PR_TRUE;
shell->GetPrimaryFrameFor(aContainer, &parentFrame);
#ifdef INCLUDE_XUL
}
#endif
} else {
// Use the prev sibling if we have it; otherwise use the next sibling
if (nsnull != prevSibling) {
@ -4242,6 +4252,21 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
// Construct a new frame
if (nsnull != parentFrame) {
#ifdef INCLUDE_XUL
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
if (tag == nsXULAtoms::treechildren ||
tag == nsXULAtoms::treeitem) {
// Convert to a tree row group frame.
nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame;
if (treeRowGroup->IsLazy()) {
treeRowGroup->OnContentAdded(*aPresContext);
return NS_OK;
}
}
#endif // INCLUDE_XUL
nsFrameItems frameItems;
nsFrameConstructorState state(mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext, parentFrame),
@ -4484,41 +4509,6 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
nsIFrame* parentFrame;
childFrame->GetParent(&parentFrame);
rv = parentFrame->RemoveFrame(*aPresContext, *shell, nsnull, childFrame);
#ifdef INCLUDE_XUL
// Need to (for XUL only) do a special check for the treeitem tag
PRInt32 nameSpaceID;
if (aContainer &&
NS_SUCCEEDED(aContainer->GetNameSpaceID(nameSpaceID)) &&
nameSpaceID == nsXULAtoms::nameSpaceID) {
// See if we're the treeitem tag. This tag is treated differently,
// since the children of the content node are actually SIBLING frames.
// We've only removed the parent frame. Now we have to remove all of
// its children.
nsCOMPtr<nsIAtom> tag;
aContainer->GetTag(*getter_AddRefs(tag));
nsString tagName;
tag->ToString(tagName);
if (tagName == "treeitem")
{
// Calling content removed on each of our content node children
// should do the trick.
PRInt32 count = 0;
aContainer->ChildCount(count);
for (PRInt32 i = 0; i < count; i++)
{
nsCOMPtr<nsIContent> childContent;
aContainer->ChildAt(i, *getter_AddRefs(childContent));
if (childContent)
{
// Call ContentRemoved.
ContentRemoved(aPresContext, aContainer,
childContent, i);
}
}
}
}
#endif // INCLUDE_XUL
}
}
@ -6008,3 +5998,66 @@ nsCSSFrameConstructor::WrapTextFrame(nsIPresContext* aPresContext,
return NS_OK;
}
// Tree Widget Routines
NS_IMETHODIMP
nsCSSFrameConstructor::CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIContent* aChild,
nsIFrame** aNewFrame)
{
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsresult rv = NS_OK;
// Construct a new frame
if (nsnull != aParentFrame) {
nsFrameItems frameItems;
nsFrameConstructorState state(mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext, aParentFrame),
GetFloaterContainingBlock(aPresContext, aParentFrame));
rv = ConstructFrame(aPresContext, state, aChild, aParentFrame, PR_FALSE,
frameItems);
nsIFrame* newFrame = frameItems.childList;
*aNewFrame = newFrame;
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
// Notify the parent frame
rv = ((nsTreeRowGroupFrame*)aParentFrame)->TreeAppendFrames(newFrame);
// If there are new absolutely positioned child frames, then notify
// the parent
// XXX We can't just assume these frames are being appended, we need to
// determine where in the list they should be inserted...
if (state.mAbsoluteItems.childList) {
rv = state.mAbsoluteItems.containingBlock->AppendFrames(*aPresContext, *shell,
nsLayoutAtoms::absoluteList,
state.mAbsoluteItems.childList);
}
// If there are new fixed positioned child frames, then notify
// the parent
// XXX We can't just assume these frames are being appended, we need to
// determine where in the list they should be inserted...
if (state.mFixedItems.childList) {
rv = state.mFixedItems.containingBlock->AppendFrames(*aPresContext, *shell,
nsLayoutAtoms::fixedList,
state.mFixedItems.childList);
}
// If there are new floating child frames, then notify
// the parent
// XXX We can't just assume these frames are being appended, we need to
// determine where in the list they should be inserted...
if (state.mFloatedItems.childList) {
rv = state.mFloatedItems.containingBlock->AppendFrames(*aPresContext, *shell,
nsLayoutAtoms::floaterList,
state.mFloatedItems.childList);
}
}
}
return rv;
}

Просмотреть файл

@ -112,6 +112,11 @@ public:
nsIFrame* aParentFrame,
nsIFrame** aContinuingFrame);
NS_IMETHODIMP CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIContent* aChild,
nsIFrame** aResult);
protected:
nsresult ResolveStyleContext(nsIPresContext* aPresContext,
@ -422,7 +427,7 @@ protected:
nsIAtom* aTag,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aNewFrame,
nsIFrame* aParentFrame,
nsFrameItems& aChildItems);
#endif

Просмотреть файл

@ -3249,8 +3249,9 @@ NS_METHOD nsTableFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
break;
case nsIReflowCommand::FrameAppended :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (!objectFrame)
break;
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
{
rv = IR_ColGroupAppended(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -3794,6 +3795,18 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext,
nscoord x = borderPadding.left;
nscoord y = borderPadding.top + aReflowState.y;
if (PR_TRUE==gsDebugIR) printf("\nTIF IR: Reflow Pass 2 of frame %p with reason=%d\n", kidFrame, reason);
if (RowGroupsShouldBeConstrained()) {
// Only applies to the tree widget.
nscoord tableSpecifiedHeight;
GetTableSpecifiedHeight(tableSpecifiedHeight, kidReflowState);
if (tableSpecifiedHeight != -1) {
kidReflowState.availableHeight = tableSpecifiedHeight - y;
if (kidReflowState.availableHeight < 0)
kidReflowState.availableHeight = 0;
}
}
rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, aStatus);
// Did the child fit?
if (desiredSize.height > kidAvailSize.height) {
@ -4249,6 +4262,13 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
y += excessForRow+rowRect.height;
aExcessForRowGroup += excessForRow;
}
else
{
nsRect rowRect;
rowFrame->GetRect(rowRect);
y += rowRect.height;
}
rowFrame = iter.Next();
}
nsRect rowGroupRect;
@ -4261,6 +4281,27 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
DistributeSpaceToCells(aPresContext, aReflowState, aRowGroupFrame);
}
NS_IMETHODIMP nsTableFrame::GetTableSpecifiedHeight(nscoord& aResult, const nsHTMLReflowState& aReflowState)
{
const nsStylePosition* tablePosition;
GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)tablePosition);
const nsStyleTable* tableStyle;
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
nscoord tableSpecifiedHeight=-1;
if (eStyleUnit_Coord == tablePosition->mHeight.GetUnit())
tableSpecifiedHeight = tablePosition->mHeight.GetCoordValue();
else if (eStyleUnit_Percent == tablePosition->mHeight.GetUnit())
{
float percent = tablePosition->mHeight.GetPercentValue();
nscoord parentHeight = GetEffectiveContainerHeight(aReflowState);
if (NS_UNCONSTRAINEDSIZE!=parentHeight && 0!=parentHeight)
tableSpecifiedHeight = NSToCoordRound((float)parentHeight * percent);
}
aResult = tableSpecifiedHeight;
return NS_OK;
}
nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nscoord aDefaultHeight)
@ -4297,7 +4338,8 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
{
const nsStyleDisplay *rowGroupDisplay;
rowGroupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowGroupDisplay));
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay))
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay) &&
((nsTableRowGroupFrame*)rowGroupFrame)->RowGroupReceivesExcessSpace())
{
((nsTableRowGroupFrame*)rowGroupFrame)->GetHeightOfRows(sumOfRowHeights);
}
@ -4310,11 +4352,19 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
{
const nsStyleDisplay *rowGroupDisplay;
rowGroupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowGroupDisplay));
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay))
{
nscoord excessForGroup = 0;
DistributeSpaceToRows(aPresContext, aReflowState, rowGroupFrame, sumOfRowHeights,
excess, tableStyle, excessForGroup, rowGroupYPos);
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay)) {
if (((nsTableRowGroupFrame*)rowGroupFrame)->RowGroupReceivesExcessSpace())
{
nscoord excessForGroup = 0;
DistributeSpaceToRows(aPresContext, aReflowState, rowGroupFrame, sumOfRowHeights,
excess, tableStyle, excessForGroup, rowGroupYPos);
}
else
{
nsRect rowGroupRect;
rowGroupFrame->GetRect(rowGroupRect);
rowGroupYPos += rowGroupRect.height;
}
}
rowGroupFrame->GetNextSibling(&rowGroupFrame);
}

Просмотреть файл

@ -453,6 +453,9 @@ public:
nsReflowReason aReason,
PRBool aDoSiblings);
NS_IMETHOD GetTableSpecifiedHeight(nscoord& aHeight, const nsHTMLReflowState& aReflowState);
virtual PRBool RowGroupsShouldBeConstrained() { return PR_FALSE; }
protected:
/** second pass of ResizeReflow.
* lays out all table content with aMaxSize(computed_table_width, given_table_height)

Просмотреть файл

@ -47,52 +47,6 @@ static const PRBool gsDebugIR = PR_FALSE;
NS_DEF_PTR(nsIStyleContext);
NS_DEF_PTR(nsIContent);
/* ----------- RowGroupReflowState ---------- */
struct RowGroupReflowState {
nsIPresContext& mPresContext; // Our pres context
const nsHTMLReflowState& reflowState; // Our reflow state
// The available size (computed from the parent)
nsSize availSize;
// Flags for whether the max size is unconstrained
PRBool unconstrainedWidth;
PRBool unconstrainedHeight;
// Running y-offset
nscoord y;
// Flag used to set maxElementSize to my first row
PRBool firstRow;
// Remember the height of the first row, because it's our maxElementHeight (plus header/footers)
nscoord firstRowHeight;
nsTableFrame *tableFrame;
RowGroupReflowState(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsTableFrame * aTableFrame)
: mPresContext(aPresContext),
reflowState(aReflowState)
{
availSize.width = reflowState.availableWidth;
availSize.height = reflowState.availableHeight;
y=0; // border/padding???
unconstrainedWidth = PRBool(reflowState.availableWidth == NS_UNCONSTRAINEDSIZE);
unconstrainedHeight = PRBool(reflowState.availableHeight == NS_UNCONSTRAINEDSIZE);
firstRow = PR_TRUE;
firstRowHeight=0;
tableFrame = aTableFrame;
}
~RowGroupReflowState() {
}
};
/* ----------- nsTableRowGroupFrame ---------- */
nsresult
@ -116,7 +70,7 @@ NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount, PRBool aDeepCount)
aCount=0;
// loop through children, adding one to aCount for every legit row
nsIFrame *childFrame = mFrames.FirstChild();
nsIFrame *childFrame = GetFirstFrame();
while (PR_TRUE)
{
if (nsnull==childFrame)
@ -130,7 +84,7 @@ NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount, PRBool aDeepCount)
((nsTableRowGroupFrame*)childFrame)->GetRowCount(childRowGroupCount);
aCount += childRowGroupCount;
}
childFrame->GetNextSibling(&childFrame);
GetNextFrame(childFrame, &childFrame);
}
return NS_OK;
}
@ -138,7 +92,7 @@ NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount, PRBool aDeepCount)
PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
{
PRInt32 result = -1;
nsIFrame *childFrame = mFrames.FirstChild();
nsIFrame *childFrame = GetFirstFrame();
while (PR_TRUE)
{
if (nsnull==childFrame)
@ -155,17 +109,17 @@ PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
if (result != -1)
break;
}
childFrame->GetNextSibling(&childFrame);
GetNextFrame(childFrame, &childFrame);
}
return result;
}
NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const
NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns)
{
aMaxColumns=0;
// loop through children, remembering the max of the columns in each row
nsIFrame *childFrame = mFrames.FirstChild();
nsIFrame *childFrame = GetFirstFrame();
while (PR_TRUE)
{
if (nsnull==childFrame)
@ -183,7 +137,7 @@ NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const
aMaxColumns = PR_MAX(aMaxColumns, rgColCount);
}
childFrame->GetNextSibling(&childFrame);
GetNextFrame(childFrame, &childFrame);
}
return NS_OK;
}
@ -192,7 +146,7 @@ nsresult
nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame)
{
nsIFrame* originalRowFrame;
nsIFrame* copyRowFrame = mFrames.FirstChild();
nsIFrame* copyRowFrame = GetFirstFrame();
aHeaderFooterFrame->FirstChild(nsnull, &originalRowFrame);
while (copyRowFrame) {
@ -231,8 +185,8 @@ nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame
}
// Move to the next row frame
originalRowFrame->GetNextSibling(&originalRowFrame);
copyRowFrame->GetNextSibling(&copyRowFrame);
GetNextFrame(originalRowFrame, &originalRowFrame);
GetNextFrame(copyRowFrame, &copyRowFrame);
}
return NS_OK;
@ -316,7 +270,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer)
{
nsIFrame* kid = mFrames.FirstChild();
nsIFrame* kid = GetFirstFrame();
while (nsnull != kid) {
nsIView *pView;
@ -339,7 +293,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
}
aRenderingContext.PopState(clipState);
}
kid->GetNextSibling(&kid);
GetNextFrame(kid, &kid);
}
}
@ -366,14 +320,14 @@ nsTableRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
return kid->GetFrameForPoint(tmp, aFrame);
}
}
else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay) {
else {
if (kidRect.Contains(aPoint)) {
tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
return kid->GetFrameForPoint(tmp, aFrame);
}
}
kid->GetNextSibling(&kid);
GetNextFrame(kid, &kid);
}
return NS_ERROR_FAILURE;
}
@ -440,16 +394,33 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC
nsSize kidMaxElementSize;
nsSize* pKidMaxElementSize = (nsnull != aDesiredSize.maxElementSize) ? &kidMaxElementSize : nsnull;
nsresult rv = NS_OK;
if (!ContinueReflow(aReflowState.y, aReflowState.availSize.height))
return rv;
nsIFrame* kidFrame;
if (nsnull==aStartFrame)
kidFrame = mFrames.FirstChild();
if (nsnull==aStartFrame) {
kidFrame = GetFirstFrameForReflow(aPresContext);
ReflowBeforeRowLayout(aPresContext, aDesiredSize, aReflowState, aStatus, aReason);
}
else
kidFrame = aStartFrame;
PRUint8 borderStyle = aReflowState.tableFrame->GetBorderCollapseStyle();
for ( ; nsnull != kidFrame; )
{
if (ExcludeFrameFromReflow(kidFrame)) {
// The tree widget has some frames that aren't reflowed by
// the normal row group reflow.
if (PR_FALSE==aDoSiblings)
break;
// Get the next child
GetNextFrameForReflow(aPresContext, kidFrame, &kidFrame);
continue;
}
nsSize kidAvailSize(aReflowState.availSize);
if (0>=kidAvailSize.height)
kidAvailSize.height = 1; // XXX: HaCk - we don't handle negative heights yet
@ -462,7 +433,18 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, kidFrame,
kidAvailSize, aReason);
if (kidFrame != mFrames.FirstChild()) {
if (aReflowState.tableFrame->RowGroupsShouldBeConstrained()) {
// Only applies to the tree widget.
const nsStyleDisplay *rowDisplay;
kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay));
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay &&
aReflowState.availSize.height != NS_UNCONSTRAINEDSIZE) {
kidReflowState.availableHeight = aReflowState.availSize.height;
}
}
if (kidFrame != GetFirstFrame()) {
// If this isn't the first row frame, then we can't be at the top of
// the page anymore...
kidReflowState.isTopOfPage = PR_FALSE;
@ -523,8 +505,11 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC
if (PR_FALSE==aDoSiblings)
break;
if (!ContinueReflow(aReflowState.y, aReflowState.availSize.height))
break;
// Get the next child
kidFrame->GetNextSibling(&kidFrame);
GetNextFrameForReflow(aPresContext, kidFrame, &kidFrame);
}
return rv;
@ -549,7 +534,7 @@ NS_METHOD nsTableRowGroupFrame::PullUpAllRowFrames(nsIPresContext& aPresContext)
if (nextInFlow->mFrames.NotEmpty()) {
// When pushing and pulling frames we need to check for whether any
// views need to be reparented.
for (nsIFrame* f = nextInFlow->mFrames.FirstChild(); f; f->GetNextSibling(&f)) {
for (nsIFrame* f = nextInFlow->GetFirstFrame(); f; GetNextFrame(f, &f)) {
nsHTMLContainerFrame::ReparentFrameView(f, nextInFlow, this);
}
// Append them to our child list
@ -564,16 +549,16 @@ NS_METHOD nsTableRowGroupFrame::PullUpAllRowFrames(nsIPresContext& aPresContext)
return NS_OK;
}
static void GetNextRowSibling(nsIFrame** aRowFrame)
void nsTableRowGroupFrame::GetNextRowSibling(nsIFrame** aRowFrame)
{
nsresult rv = (*aRowFrame)->GetNextSibling(aRowFrame);
while(*aRowFrame && (NS_SUCCEEDED(rv))) {
GetNextFrame(*aRowFrame, aRowFrame);
while(*aRowFrame) {
const nsStyleDisplay *display;
(*aRowFrame)->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW == display->mDisplay) {
return;
}
rv = (*aRowFrame)->GetNextSibling(aRowFrame);
GetNextFrame(*aRowFrame, aRowFrame);
}
}
@ -602,7 +587,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
/* Step 1: get the height of the tallest cell in the row and save it for
* pass 2
*/
nsIFrame* rowFrame = mFrames.FirstChild();
nsIFrame* rowFrame = GetFirstFrame();
PRInt32 rowIndex = 0;
// For row groups that are split across pages, the first row frame won't
@ -636,7 +621,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
rowIndex++;
}
// Get the next row
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
@ -661,19 +646,13 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
for (PRInt32 counter=0; counter<2; counter++)
{
rowGroupHeight = 0;
rowFrame = mFrames.FirstChild();
rowFrame = GetFirstFrame();
rowIndex = 0;
while (nsnull != rowFrame)
{
const nsStyleDisplay *childDisplay;
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay) {
// Only for the tree widget does this code fire.
nsSize rowGroupSize;
rowFrame->GetSize(rowGroupSize);
rowGroupHeight += rowGroupSize.height;
}
else if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay)
if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay)
{
if (gsDebug) printf("TRGF CalcRowH: Step 2 for row %d (%p)...\n",
rowIndex + startRowIndex, rowFrame);
@ -779,13 +758,20 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
rowGroupHeight += rowHeights[rowIndex];
rowIndex++;
}
else if (!ExcludeFrameFromReflow(rowFrame)) {
// Anything that isn't a row contributes to the row group's total height.
nsSize frameSize;
rowFrame->GetSize(frameSize);
rowGroupHeight += frameSize.height;
}
// Get the next rowgroup child (row frame)
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
}
/* step 3: finally, notify the rows of their new heights */
rowFrame = mFrames.FirstChild();
rowFrame = GetFirstFrame();
while (nsnull != rowFrame)
{
const nsStyleDisplay *childDisplay;
@ -795,7 +781,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
((nsTableRowFrame *)rowFrame)->DidResize(aPresContext, aReflowState);
}
// Get the next row
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
// Adjust our desired size
@ -817,7 +803,8 @@ nsresult nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext& aP
// Move the frames that follow aKidFrame by aDeltaY
nsIFrame* kidFrame;
aKidFrame->GetNextSibling(&kidFrame);
GetNextFrame(aKidFrame, &kidFrame);
while (nsnull != kidFrame) {
nsPoint origin;
@ -834,12 +821,12 @@ nsresult nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext& aP
// Get the next frame
lastKidFrame = kidFrame;
kidFrame->GetNextSibling(&kidFrame);
GetNextFrame(kidFrame, &kidFrame);
}
} else {
// Get the last frame
lastKidFrame = mFrames.LastChild();
lastKidFrame = GetLastFrame();
}
// XXX Deal with cells that have rowspans.
@ -864,7 +851,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext,
// Walk each of the row frames looking for the first row frame that
// doesn't fit in the available space
for (nsIFrame* rowFrame = mFrames.FirstChild(); rowFrame; rowFrame->GetNextSibling(&rowFrame)) {
for (nsIFrame* rowFrame = GetFirstFrame(); rowFrame; GetNextFrame(rowFrame, &rowFrame)) {
nsRect bounds;
rowFrame->GetRect(bounds);
@ -906,10 +893,10 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext,
// Add it to the child list
nsIFrame* nextRow;
rowFrame->GetNextSibling(&nextRow);
contRowFrame->SetNextSibling(nextRow);
rowFrame->SetNextSibling(contRowFrame);
GetNextFrame(rowFrame, &nextRow);
GetNextFrame(contRowFrame, &nextRow);
GetNextFrame(rowFrame, &contRowFrame);
// Push the continuing row frame and the frames that follow
PushChildren(contRowFrame, rowFrame);
aStatus = NS_FRAME_NOT_COMPLETE;
@ -920,7 +907,8 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext,
nsIFrame* nextRowFrame;
// Push the frame that follows
rowFrame->GetNextSibling(&nextRowFrame);
GetNextFrame(rowFrame, &nextRowFrame);
if (nextRowFrame) {
PushChildren(nextRowFrame, rowFrame);
}
@ -1038,10 +1026,8 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
// reflowing the frames we have, the problem is we don't know if we have
// room left until after we call CalculateRowHeights()...
PullUpAllRowFrames(aPresContext);
if (nsnull != mFrames.FirstChild()) {
rv = ReflowMappedChildren(aPresContext, aDesiredSize, state, aStatus,
rv = ReflowMappedChildren(aPresContext, aDesiredSize, state, aStatus,
nsnull, aReflowState.reason, PR_TRUE);
}
// Return our desired rect
aDesiredSize.width = aReflowState.availableWidth;
@ -1080,7 +1066,8 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
}
// See if all the frames fit
if (aDesiredSize.height > aReflowState.availableHeight) {
if (aDesiredSize.height > aReflowState.availableHeight &&
!tableFrame->RowGroupsShouldBeConstrained()) {
// Nope, find a place to split the row group
SplitRowGroup(aPresContext, aDesiredSize, aReflowState, tableFrame, aStatus);
}
@ -1318,6 +1305,7 @@ NS_METHOD nsTableRowGroupFrame::DidAppendRow(nsTableRowFrame *aRowFrame)
// returns PR_TRUE if there are no rows after ours
PRBool nsTableRowGroupFrame::NoRowsFollow()
{
// XXX This method doesn't play well with the tree widget.
PRBool result = PR_TRUE;
nsIFrame *nextSib=nsnull;
GetNextSibling(&nextSib);
@ -1340,6 +1328,7 @@ PRBool nsTableRowGroupFrame::NoRowsFollow()
result = PR_FALSE;
break;
}
childFrame->GetNextSibling(&childFrame);
}
}
nextSib->GetNextSibling(&nextSib);
@ -1368,7 +1357,7 @@ NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult)
{
((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aResult);
}
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
return NS_OK;
}

Просмотреть файл

@ -24,7 +24,50 @@
class nsTableFrame;
class nsTableRowFrame;
struct RowGroupReflowState;
/* ----------- RowGroupReflowState ---------- */
struct RowGroupReflowState {
nsIPresContext& mPresContext; // Our pres context
const nsHTMLReflowState& reflowState; // Our reflow state
// The available size (computed from the parent)
nsSize availSize;
// Flags for whether the max size is unconstrained
PRBool unconstrainedWidth;
PRBool unconstrainedHeight;
// Running y-offset
nscoord y;
// Flag used to set maxElementSize to my first row
PRBool firstRow;
// Remember the height of the first row, because it's our maxElementHeight (plus header/footers)
nscoord firstRowHeight;
nsTableFrame *tableFrame;
RowGroupReflowState(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsTableFrame * aTableFrame)
: mPresContext(aPresContext),
reflowState(aReflowState)
{
availSize.width = reflowState.availableWidth;
availSize.height = reflowState.availableHeight;
y=0; // border/padding???
unconstrainedWidth = PRBool(reflowState.availableWidth == NS_UNCONSTRAINEDSIZE);
unconstrainedHeight = PRBool(reflowState.availableHeight == NS_UNCONSTRAINEDSIZE);
firstRow = PR_TRUE;
firstRowHeight=0;
tableFrame = aTableFrame;
}
~RowGroupReflowState() {
}
};
#define NS_ITABLEROWGROUPFRAME_IID \
{ 0xe940e7bc, 0xb534, 0x11d2, \
@ -110,7 +153,7 @@ public:
PRInt32 GetStartRowIndex();
/** get the maximum number of columns taken up by any row in this rowgroup */
NS_METHOD GetMaxColumns(PRInt32 &aMaxColumns) const;
NS_METHOD GetMaxColumns(PRInt32 &aMaxColumns);
/**
* Used for header and footer row group frames that are repeated when
@ -129,6 +172,10 @@ public:
*/
NS_METHOD GetHeightOfRows(nscoord& aResult);
virtual PRBool RowGroupReceivesExcessSpace() { return PR_TRUE; }
virtual PRBool ContinueReflow(nscoord y, nscoord height) { return PR_TRUE; }
protected:
/** implement abstract method on nsHTMLContainerFrame */
@ -242,6 +289,20 @@ protected:
nsTableFrame* aTableFrame,
nsReflowStatus& aStatus);
NS_IMETHOD ReflowBeforeRowLayout(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
RowGroupReflowState& aReflowState,
nsReflowStatus& aStatus,
nsReflowReason aReason) { return NS_OK; };
virtual PRBool ExcludeFrameFromReflow(nsIFrame* aFrame) { return PR_FALSE; };
virtual nsIFrame* GetFirstFrameForReflow(nsIPresContext& aPresContext) { return mFrames.FirstChild(); };
virtual void GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); };
virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); };
virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
void GetNextRowSibling(nsIFrame** aRowFrame);
private:
nsIAtom *mType;

Двоичные данные
layout/macbuild/layout.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -3249,8 +3249,9 @@ NS_METHOD nsTableFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
break;
case nsIReflowCommand::FrameAppended :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (!objectFrame)
break;
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
{
rv = IR_ColGroupAppended(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -3794,6 +3795,18 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext& aPresContext,
nscoord x = borderPadding.left;
nscoord y = borderPadding.top + aReflowState.y;
if (PR_TRUE==gsDebugIR) printf("\nTIF IR: Reflow Pass 2 of frame %p with reason=%d\n", kidFrame, reason);
if (RowGroupsShouldBeConstrained()) {
// Only applies to the tree widget.
nscoord tableSpecifiedHeight;
GetTableSpecifiedHeight(tableSpecifiedHeight, kidReflowState);
if (tableSpecifiedHeight != -1) {
kidReflowState.availableHeight = tableSpecifiedHeight - y;
if (kidReflowState.availableHeight < 0)
kidReflowState.availableHeight = 0;
}
}
rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, aStatus);
// Did the child fit?
if (desiredSize.height > kidAvailSize.height) {
@ -4249,6 +4262,13 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
y += excessForRow+rowRect.height;
aExcessForRowGroup += excessForRow;
}
else
{
nsRect rowRect;
rowFrame->GetRect(rowRect);
y += rowRect.height;
}
rowFrame = iter.Next();
}
nsRect rowGroupRect;
@ -4261,6 +4281,27 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
DistributeSpaceToCells(aPresContext, aReflowState, aRowGroupFrame);
}
NS_IMETHODIMP nsTableFrame::GetTableSpecifiedHeight(nscoord& aResult, const nsHTMLReflowState& aReflowState)
{
const nsStylePosition* tablePosition;
GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)tablePosition);
const nsStyleTable* tableStyle;
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
nscoord tableSpecifiedHeight=-1;
if (eStyleUnit_Coord == tablePosition->mHeight.GetUnit())
tableSpecifiedHeight = tablePosition->mHeight.GetCoordValue();
else if (eStyleUnit_Percent == tablePosition->mHeight.GetUnit())
{
float percent = tablePosition->mHeight.GetPercentValue();
nscoord parentHeight = GetEffectiveContainerHeight(aReflowState);
if (NS_UNCONSTRAINEDSIZE!=parentHeight && 0!=parentHeight)
tableSpecifiedHeight = NSToCoordRound((float)parentHeight * percent);
}
aResult = tableSpecifiedHeight;
return NS_OK;
}
nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nscoord aDefaultHeight)
@ -4297,7 +4338,8 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
{
const nsStyleDisplay *rowGroupDisplay;
rowGroupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowGroupDisplay));
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay))
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay) &&
((nsTableRowGroupFrame*)rowGroupFrame)->RowGroupReceivesExcessSpace())
{
((nsTableRowGroupFrame*)rowGroupFrame)->GetHeightOfRows(sumOfRowHeights);
}
@ -4310,11 +4352,19 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
{
const nsStyleDisplay *rowGroupDisplay;
rowGroupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowGroupDisplay));
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay))
{
nscoord excessForGroup = 0;
DistributeSpaceToRows(aPresContext, aReflowState, rowGroupFrame, sumOfRowHeights,
excess, tableStyle, excessForGroup, rowGroupYPos);
if (PR_TRUE==IsRowGroup(rowGroupDisplay->mDisplay)) {
if (((nsTableRowGroupFrame*)rowGroupFrame)->RowGroupReceivesExcessSpace())
{
nscoord excessForGroup = 0;
DistributeSpaceToRows(aPresContext, aReflowState, rowGroupFrame, sumOfRowHeights,
excess, tableStyle, excessForGroup, rowGroupYPos);
}
else
{
nsRect rowGroupRect;
rowGroupFrame->GetRect(rowGroupRect);
rowGroupYPos += rowGroupRect.height;
}
}
rowGroupFrame->GetNextSibling(&rowGroupFrame);
}

Просмотреть файл

@ -453,6 +453,9 @@ public:
nsReflowReason aReason,
PRBool aDoSiblings);
NS_IMETHOD GetTableSpecifiedHeight(nscoord& aHeight, const nsHTMLReflowState& aReflowState);
virtual PRBool RowGroupsShouldBeConstrained() { return PR_FALSE; }
protected:
/** second pass of ResizeReflow.
* lays out all table content with aMaxSize(computed_table_width, given_table_height)

Просмотреть файл

@ -47,52 +47,6 @@ static const PRBool gsDebugIR = PR_FALSE;
NS_DEF_PTR(nsIStyleContext);
NS_DEF_PTR(nsIContent);
/* ----------- RowGroupReflowState ---------- */
struct RowGroupReflowState {
nsIPresContext& mPresContext; // Our pres context
const nsHTMLReflowState& reflowState; // Our reflow state
// The available size (computed from the parent)
nsSize availSize;
// Flags for whether the max size is unconstrained
PRBool unconstrainedWidth;
PRBool unconstrainedHeight;
// Running y-offset
nscoord y;
// Flag used to set maxElementSize to my first row
PRBool firstRow;
// Remember the height of the first row, because it's our maxElementHeight (plus header/footers)
nscoord firstRowHeight;
nsTableFrame *tableFrame;
RowGroupReflowState(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsTableFrame * aTableFrame)
: mPresContext(aPresContext),
reflowState(aReflowState)
{
availSize.width = reflowState.availableWidth;
availSize.height = reflowState.availableHeight;
y=0; // border/padding???
unconstrainedWidth = PRBool(reflowState.availableWidth == NS_UNCONSTRAINEDSIZE);
unconstrainedHeight = PRBool(reflowState.availableHeight == NS_UNCONSTRAINEDSIZE);
firstRow = PR_TRUE;
firstRowHeight=0;
tableFrame = aTableFrame;
}
~RowGroupReflowState() {
}
};
/* ----------- nsTableRowGroupFrame ---------- */
nsresult
@ -116,7 +70,7 @@ NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount, PRBool aDeepCount)
aCount=0;
// loop through children, adding one to aCount for every legit row
nsIFrame *childFrame = mFrames.FirstChild();
nsIFrame *childFrame = GetFirstFrame();
while (PR_TRUE)
{
if (nsnull==childFrame)
@ -130,7 +84,7 @@ NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount, PRBool aDeepCount)
((nsTableRowGroupFrame*)childFrame)->GetRowCount(childRowGroupCount);
aCount += childRowGroupCount;
}
childFrame->GetNextSibling(&childFrame);
GetNextFrame(childFrame, &childFrame);
}
return NS_OK;
}
@ -138,7 +92,7 @@ NS_METHOD nsTableRowGroupFrame::GetRowCount(PRInt32 &aCount, PRBool aDeepCount)
PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
{
PRInt32 result = -1;
nsIFrame *childFrame = mFrames.FirstChild();
nsIFrame *childFrame = GetFirstFrame();
while (PR_TRUE)
{
if (nsnull==childFrame)
@ -155,17 +109,17 @@ PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
if (result != -1)
break;
}
childFrame->GetNextSibling(&childFrame);
GetNextFrame(childFrame, &childFrame);
}
return result;
}
NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const
NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns)
{
aMaxColumns=0;
// loop through children, remembering the max of the columns in each row
nsIFrame *childFrame = mFrames.FirstChild();
nsIFrame *childFrame = GetFirstFrame();
while (PR_TRUE)
{
if (nsnull==childFrame)
@ -183,7 +137,7 @@ NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const
aMaxColumns = PR_MAX(aMaxColumns, rgColCount);
}
childFrame->GetNextSibling(&childFrame);
GetNextFrame(childFrame, &childFrame);
}
return NS_OK;
}
@ -192,7 +146,7 @@ nsresult
nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame)
{
nsIFrame* originalRowFrame;
nsIFrame* copyRowFrame = mFrames.FirstChild();
nsIFrame* copyRowFrame = GetFirstFrame();
aHeaderFooterFrame->FirstChild(nsnull, &originalRowFrame);
while (copyRowFrame) {
@ -231,8 +185,8 @@ nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame
}
// Move to the next row frame
originalRowFrame->GetNextSibling(&originalRowFrame);
copyRowFrame->GetNextSibling(&copyRowFrame);
GetNextFrame(originalRowFrame, &originalRowFrame);
GetNextFrame(copyRowFrame, &copyRowFrame);
}
return NS_OK;
@ -316,7 +270,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer)
{
nsIFrame* kid = mFrames.FirstChild();
nsIFrame* kid = GetFirstFrame();
while (nsnull != kid) {
nsIView *pView;
@ -339,7 +293,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext& aPresContext,
}
aRenderingContext.PopState(clipState);
}
kid->GetNextSibling(&kid);
GetNextFrame(kid, &kid);
}
}
@ -366,14 +320,14 @@ nsTableRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
return kid->GetFrameForPoint(tmp, aFrame);
}
}
else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay) {
else {
if (kidRect.Contains(aPoint)) {
tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
return kid->GetFrameForPoint(tmp, aFrame);
}
}
kid->GetNextSibling(&kid);
GetNextFrame(kid, &kid);
}
return NS_ERROR_FAILURE;
}
@ -440,16 +394,33 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC
nsSize kidMaxElementSize;
nsSize* pKidMaxElementSize = (nsnull != aDesiredSize.maxElementSize) ? &kidMaxElementSize : nsnull;
nsresult rv = NS_OK;
if (!ContinueReflow(aReflowState.y, aReflowState.availSize.height))
return rv;
nsIFrame* kidFrame;
if (nsnull==aStartFrame)
kidFrame = mFrames.FirstChild();
if (nsnull==aStartFrame) {
kidFrame = GetFirstFrameForReflow(aPresContext);
ReflowBeforeRowLayout(aPresContext, aDesiredSize, aReflowState, aStatus, aReason);
}
else
kidFrame = aStartFrame;
PRUint8 borderStyle = aReflowState.tableFrame->GetBorderCollapseStyle();
for ( ; nsnull != kidFrame; )
{
if (ExcludeFrameFromReflow(kidFrame)) {
// The tree widget has some frames that aren't reflowed by
// the normal row group reflow.
if (PR_FALSE==aDoSiblings)
break;
// Get the next child
GetNextFrameForReflow(aPresContext, kidFrame, &kidFrame);
continue;
}
nsSize kidAvailSize(aReflowState.availSize);
if (0>=kidAvailSize.height)
kidAvailSize.height = 1; // XXX: HaCk - we don't handle negative heights yet
@ -462,7 +433,18 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, kidFrame,
kidAvailSize, aReason);
if (kidFrame != mFrames.FirstChild()) {
if (aReflowState.tableFrame->RowGroupsShouldBeConstrained()) {
// Only applies to the tree widget.
const nsStyleDisplay *rowDisplay;
kidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay));
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay &&
aReflowState.availSize.height != NS_UNCONSTRAINEDSIZE) {
kidReflowState.availableHeight = aReflowState.availSize.height;
}
}
if (kidFrame != GetFirstFrame()) {
// If this isn't the first row frame, then we can't be at the top of
// the page anymore...
kidReflowState.isTopOfPage = PR_FALSE;
@ -523,8 +505,11 @@ NS_METHOD nsTableRowGroupFrame::ReflowMappedChildren(nsIPresContext& aPresC
if (PR_FALSE==aDoSiblings)
break;
if (!ContinueReflow(aReflowState.y, aReflowState.availSize.height))
break;
// Get the next child
kidFrame->GetNextSibling(&kidFrame);
GetNextFrameForReflow(aPresContext, kidFrame, &kidFrame);
}
return rv;
@ -549,7 +534,7 @@ NS_METHOD nsTableRowGroupFrame::PullUpAllRowFrames(nsIPresContext& aPresContext)
if (nextInFlow->mFrames.NotEmpty()) {
// When pushing and pulling frames we need to check for whether any
// views need to be reparented.
for (nsIFrame* f = nextInFlow->mFrames.FirstChild(); f; f->GetNextSibling(&f)) {
for (nsIFrame* f = nextInFlow->GetFirstFrame(); f; GetNextFrame(f, &f)) {
nsHTMLContainerFrame::ReparentFrameView(f, nextInFlow, this);
}
// Append them to our child list
@ -564,16 +549,16 @@ NS_METHOD nsTableRowGroupFrame::PullUpAllRowFrames(nsIPresContext& aPresContext)
return NS_OK;
}
static void GetNextRowSibling(nsIFrame** aRowFrame)
void nsTableRowGroupFrame::GetNextRowSibling(nsIFrame** aRowFrame)
{
nsresult rv = (*aRowFrame)->GetNextSibling(aRowFrame);
while(*aRowFrame && (NS_SUCCEEDED(rv))) {
GetNextFrame(*aRowFrame, aRowFrame);
while(*aRowFrame) {
const nsStyleDisplay *display;
(*aRowFrame)->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW == display->mDisplay) {
return;
}
rv = (*aRowFrame)->GetNextSibling(aRowFrame);
GetNextFrame(*aRowFrame, aRowFrame);
}
}
@ -602,7 +587,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
/* Step 1: get the height of the tallest cell in the row and save it for
* pass 2
*/
nsIFrame* rowFrame = mFrames.FirstChild();
nsIFrame* rowFrame = GetFirstFrame();
PRInt32 rowIndex = 0;
// For row groups that are split across pages, the first row frame won't
@ -636,7 +621,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
rowIndex++;
}
// Get the next row
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
@ -661,19 +646,13 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
for (PRInt32 counter=0; counter<2; counter++)
{
rowGroupHeight = 0;
rowFrame = mFrames.FirstChild();
rowFrame = GetFirstFrame();
rowIndex = 0;
while (nsnull != rowFrame)
{
const nsStyleDisplay *childDisplay;
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay) {
// Only for the tree widget does this code fire.
nsSize rowGroupSize;
rowFrame->GetSize(rowGroupSize);
rowGroupHeight += rowGroupSize.height;
}
else if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay)
if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay)
{
if (gsDebug) printf("TRGF CalcRowH: Step 2 for row %d (%p)...\n",
rowIndex + startRowIndex, rowFrame);
@ -779,13 +758,20 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
rowGroupHeight += rowHeights[rowIndex];
rowIndex++;
}
else if (!ExcludeFrameFromReflow(rowFrame)) {
// Anything that isn't a row contributes to the row group's total height.
nsSize frameSize;
rowFrame->GetSize(frameSize);
rowGroupHeight += frameSize.height;
}
// Get the next rowgroup child (row frame)
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
}
/* step 3: finally, notify the rows of their new heights */
rowFrame = mFrames.FirstChild();
rowFrame = GetFirstFrame();
while (nsnull != rowFrame)
{
const nsStyleDisplay *childDisplay;
@ -795,7 +781,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
((nsTableRowFrame *)rowFrame)->DidResize(aPresContext, aReflowState);
}
// Get the next row
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
// Adjust our desired size
@ -817,7 +803,8 @@ nsresult nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext& aP
// Move the frames that follow aKidFrame by aDeltaY
nsIFrame* kidFrame;
aKidFrame->GetNextSibling(&kidFrame);
GetNextFrame(aKidFrame, &kidFrame);
while (nsnull != kidFrame) {
nsPoint origin;
@ -834,12 +821,12 @@ nsresult nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext& aP
// Get the next frame
lastKidFrame = kidFrame;
kidFrame->GetNextSibling(&kidFrame);
GetNextFrame(kidFrame, &kidFrame);
}
} else {
// Get the last frame
lastKidFrame = mFrames.LastChild();
lastKidFrame = GetLastFrame();
}
// XXX Deal with cells that have rowspans.
@ -864,7 +851,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext,
// Walk each of the row frames looking for the first row frame that
// doesn't fit in the available space
for (nsIFrame* rowFrame = mFrames.FirstChild(); rowFrame; rowFrame->GetNextSibling(&rowFrame)) {
for (nsIFrame* rowFrame = GetFirstFrame(); rowFrame; GetNextFrame(rowFrame, &rowFrame)) {
nsRect bounds;
rowFrame->GetRect(bounds);
@ -906,10 +893,10 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext,
// Add it to the child list
nsIFrame* nextRow;
rowFrame->GetNextSibling(&nextRow);
contRowFrame->SetNextSibling(nextRow);
rowFrame->SetNextSibling(contRowFrame);
GetNextFrame(rowFrame, &nextRow);
GetNextFrame(contRowFrame, &nextRow);
GetNextFrame(rowFrame, &contRowFrame);
// Push the continuing row frame and the frames that follow
PushChildren(contRowFrame, rowFrame);
aStatus = NS_FRAME_NOT_COMPLETE;
@ -920,7 +907,8 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext& aPresContext,
nsIFrame* nextRowFrame;
// Push the frame that follows
rowFrame->GetNextSibling(&nextRowFrame);
GetNextFrame(rowFrame, &nextRowFrame);
if (nextRowFrame) {
PushChildren(nextRowFrame, rowFrame);
}
@ -1038,10 +1026,8 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
// reflowing the frames we have, the problem is we don't know if we have
// room left until after we call CalculateRowHeights()...
PullUpAllRowFrames(aPresContext);
if (nsnull != mFrames.FirstChild()) {
rv = ReflowMappedChildren(aPresContext, aDesiredSize, state, aStatus,
rv = ReflowMappedChildren(aPresContext, aDesiredSize, state, aStatus,
nsnull, aReflowState.reason, PR_TRUE);
}
// Return our desired rect
aDesiredSize.width = aReflowState.availableWidth;
@ -1080,7 +1066,8 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
}
// See if all the frames fit
if (aDesiredSize.height > aReflowState.availableHeight) {
if (aDesiredSize.height > aReflowState.availableHeight &&
!tableFrame->RowGroupsShouldBeConstrained()) {
// Nope, find a place to split the row group
SplitRowGroup(aPresContext, aDesiredSize, aReflowState, tableFrame, aStatus);
}
@ -1318,6 +1305,7 @@ NS_METHOD nsTableRowGroupFrame::DidAppendRow(nsTableRowFrame *aRowFrame)
// returns PR_TRUE if there are no rows after ours
PRBool nsTableRowGroupFrame::NoRowsFollow()
{
// XXX This method doesn't play well with the tree widget.
PRBool result = PR_TRUE;
nsIFrame *nextSib=nsnull;
GetNextSibling(&nextSib);
@ -1340,6 +1328,7 @@ PRBool nsTableRowGroupFrame::NoRowsFollow()
result = PR_FALSE;
break;
}
childFrame->GetNextSibling(&childFrame);
}
}
nextSib->GetNextSibling(&nextSib);
@ -1368,7 +1357,7 @@ NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult)
{
((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aResult);
}
rowFrame->GetNextSibling(&rowFrame);
GetNextFrame(rowFrame, &rowFrame);
}
return NS_OK;
}

Просмотреть файл

@ -24,7 +24,50 @@
class nsTableFrame;
class nsTableRowFrame;
struct RowGroupReflowState;
/* ----------- RowGroupReflowState ---------- */
struct RowGroupReflowState {
nsIPresContext& mPresContext; // Our pres context
const nsHTMLReflowState& reflowState; // Our reflow state
// The available size (computed from the parent)
nsSize availSize;
// Flags for whether the max size is unconstrained
PRBool unconstrainedWidth;
PRBool unconstrainedHeight;
// Running y-offset
nscoord y;
// Flag used to set maxElementSize to my first row
PRBool firstRow;
// Remember the height of the first row, because it's our maxElementHeight (plus header/footers)
nscoord firstRowHeight;
nsTableFrame *tableFrame;
RowGroupReflowState(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsTableFrame * aTableFrame)
: mPresContext(aPresContext),
reflowState(aReflowState)
{
availSize.width = reflowState.availableWidth;
availSize.height = reflowState.availableHeight;
y=0; // border/padding???
unconstrainedWidth = PRBool(reflowState.availableWidth == NS_UNCONSTRAINEDSIZE);
unconstrainedHeight = PRBool(reflowState.availableHeight == NS_UNCONSTRAINEDSIZE);
firstRow = PR_TRUE;
firstRowHeight=0;
tableFrame = aTableFrame;
}
~RowGroupReflowState() {
}
};
#define NS_ITABLEROWGROUPFRAME_IID \
{ 0xe940e7bc, 0xb534, 0x11d2, \
@ -110,7 +153,7 @@ public:
PRInt32 GetStartRowIndex();
/** get the maximum number of columns taken up by any row in this rowgroup */
NS_METHOD GetMaxColumns(PRInt32 &aMaxColumns) const;
NS_METHOD GetMaxColumns(PRInt32 &aMaxColumns);
/**
* Used for header and footer row group frames that are repeated when
@ -129,6 +172,10 @@ public:
*/
NS_METHOD GetHeightOfRows(nscoord& aResult);
virtual PRBool RowGroupReceivesExcessSpace() { return PR_TRUE; }
virtual PRBool ContinueReflow(nscoord y, nscoord height) { return PR_TRUE; }
protected:
/** implement abstract method on nsHTMLContainerFrame */
@ -242,6 +289,20 @@ protected:
nsTableFrame* aTableFrame,
nsReflowStatus& aStatus);
NS_IMETHOD ReflowBeforeRowLayout(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
RowGroupReflowState& aReflowState,
nsReflowStatus& aStatus,
nsReflowReason aReason) { return NS_OK; };
virtual PRBool ExcludeFrameFromReflow(nsIFrame* aFrame) { return PR_FALSE; };
virtual nsIFrame* GetFirstFrameForReflow(nsIPresContext& aPresContext) { return mFrames.FirstChild(); };
virtual void GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); };
virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); };
virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult) { aFrame->GetNextSibling(aResult); };
void GetNextRowSibling(nsIFrame** aRowFrame);
private:
nsIAtom *mType;

Просмотреть файл

@ -44,6 +44,7 @@ CPPSRCS = \
nsToolbarFrame.cpp \
nsToolboxFrame.cpp \
nsTreeFrame.cpp \
nsTreeRowGroupFrame.cpp \
nsTreeIndentationFrame.cpp \
nsTreeCellFrame.cpp \
nsTriStateCheckboxFrame.cpp \

Просмотреть файл

@ -32,6 +32,7 @@ CPPSRCS= \
nsToolboxFrame.cpp \
nsToolbarFrame.cpp \
nsTreeFrame.cpp \
nsTreeRowGroupFrame.cpp \
nsTreeIndentationFrame.cpp \
nsTreeCellFrame.cpp \
nsTriStateCheckboxFrame.cpp \
@ -52,6 +53,7 @@ CPP_OBJS= \
.\$(OBJDIR)\nsToolboxFrame.obj \
.\$(OBJDIR)\nsToolbarFrame.obj \
.\$(OBJDIR)\nsTreeFrame.obj \
.\$(OBJDIR)\nsTreeRowGroupFrame.obj \
.\$(OBJDIR)\nsTreeIndentationFrame.obj \
.\$(OBJDIR)\nsTreeCellFrame.obj \
.\$(OBJDIR)\nsTriStateCheckboxFrame.obj \

Просмотреть файл

@ -96,13 +96,13 @@ nsTreeCellFrame::Init(nsIPresContext& aPresContext,
// Determine if we're a column header or not.
// Get row group frame
nsIFrame* pRowGroupFrame = nsnull;
aParent->GetParent(&pRowGroupFrame);
if (pRowGroupFrame != nsnull)
nsIFrame* rowGroupFrame = nsnull;
aParent->GetParent(&rowGroupFrame);
if (rowGroupFrame != nsnull)
{
// Get the display type of the row group frame and see if it's a header or body
nsCOMPtr<nsIStyleContext> parentContext;
pRowGroupFrame->GetStyleContext(getter_AddRefs(parentContext));
rowGroupFrame->GetStyleContext(getter_AddRefs(parentContext));
if (parentContext)
{
const nsStyleDisplay* display = (const nsStyleDisplay*)
@ -114,7 +114,12 @@ nsTreeCellFrame::Init(nsIPresContext& aPresContext,
else mIsHeader = PR_FALSE;
// Get the table frame.
pRowGroupFrame->GetParent((nsIFrame**) &mTreeFrame);
nsTableFrame* tableFrame = nsnull;
nsresult rv = nsTableFrame::GetTableFrame(rowGroupFrame, tableFrame);
if (NS_FAILED(rv) || (nsnull == tableFrame)) {
return rv;
}
mTreeFrame = (nsTreeFrame*)tableFrame;
}
}
@ -235,27 +240,30 @@ nsTreeCellFrame::HandleDoubleClickEvent(nsIPresContext& aPresContext,
{
// Perform an expand/collapse
// Iterate up the chain to the row and then to the item.
nsCOMPtr<nsIContent> pTreeItemContent;
mContent->GetParent(*getter_AddRefs(pTreeItemContent));
nsCOMPtr<nsIDOMElement> pTreeItem( do_QueryInterface(pTreeItemContent) );
NS_ASSERTION(pTreeItem, "not a DOM element");
if (! pTreeItem)
nsCOMPtr<nsIContent> treeItemContent;
nsCOMPtr<nsIContent> treeRowContent;
mContent->GetParent(*getter_AddRefs(treeRowContent));
treeRowContent->GetParent(*getter_AddRefs(treeItemContent));
nsCOMPtr<nsIDOMElement> treeItem( do_QueryInterface(treeItemContent) );
NS_ASSERTION(treeItem, "not a DOM element");
if (! treeItem)
return NS_ERROR_UNEXPECTED;
// Take the tree item content and toggle the value of its open attribute.
nsAutoString attrValue;
nsresult result = pTreeItem->GetAttribute("open", attrValue);
nsresult result = treeItem->GetAttribute("open", attrValue);
attrValue.ToLowerCase();
PRBool isExpanded = (attrValue=="true");
if (isExpanded)
{
// We're collapsing and need to remove frames from the flow.
pTreeItem->RemoveAttribute("open");
treeItem->RemoveAttribute("open");
}
else
{
// We're expanding and need to add frames to the flow.
pTreeItem->SetAttribute("open", "true");
treeItem->SetAttribute("open", "true");
}
}
return NS_OK;
@ -265,74 +273,55 @@ nsTreeCellFrame::HandleDoubleClickEvent(nsIPresContext& aPresContext,
void nsTreeCellFrame::Select(nsIPresContext& aPresContext, PRBool isSelected, PRBool notifyForReflow)
{
nsCOMPtr<nsIAtom> kSelectedCellAtom(dont_AddRef(NS_NewAtom("selectedcell")));
nsCOMPtr<nsIAtom> kSelectedRowAtom(dont_AddRef(NS_NewAtom("selectedrow")));
nsCOMPtr<nsIAtom> kSelectedAtom(dont_AddRef(NS_NewAtom("selected")));
nsIContent* pParentContent = nsnull;
mContent->GetParent(pParentContent);
nsCOMPtr<nsIContent> rowContent;
nsCOMPtr<nsIContent> itemContent;
mContent->GetParent(*getter_AddRefs(rowContent));
rowContent->GetParent(*getter_AddRefs(itemContent));
if (isSelected)
{
// We're selecting the node.
mContent->SetAttribute(kNameSpaceID_None, kSelectedCellAtom, "true", notifyForReflow);
if(pParentContent) {
pParentContent->SetAttribute(kNameSpaceID_None, kSelectedAtom, "true", notifyForReflow);
}
rowContent->SetAttribute(kNameSpaceID_None, kSelectedRowAtom, "true", notifyForReflow);
itemContent->SetAttribute(kNameSpaceID_None, kSelectedAtom, "true", notifyForReflow);
}
else
{
// We're deselecting the node.
mContent->UnsetAttribute(kNameSpaceID_None, kSelectedCellAtom, notifyForReflow);
if(pParentContent) {
pParentContent->UnsetAttribute(kNameSpaceID_None, kSelectedAtom, notifyForReflow);
}
mContent->UnsetAttribute(kNameSpaceID_None, kSelectedCellAtom, notifyForReflow);
rowContent->UnsetAttribute(kNameSpaceID_None, kSelectedRowAtom, notifyForReflow);
itemContent->UnsetAttribute(kNameSpaceID_None, kSelectedAtom, notifyForReflow);
}
NS_IF_RELEASE(pParentContent);
}
void nsTreeCellFrame::Hover(nsIPresContext& aPresContext, PRBool isHover, PRBool notifyForReflow)
{
nsCOMPtr<nsIAtom> kHoverCellAtom(dont_AddRef(NS_NewAtom("hovercell")));
nsCOMPtr<nsIAtom> kHoverAtom(dont_AddRef(NS_NewAtom("hover")));
nsCOMPtr<nsIAtom> kHoverCellAtom(dont_AddRef(NS_NewAtom("Hovercell")));
nsCOMPtr<nsIAtom> kHoverRowAtom(dont_AddRef(NS_NewAtom("Hoverrow")));
nsCOMPtr<nsIAtom> kHoverAtom(dont_AddRef(NS_NewAtom("Hover")));
nsIContent* pParentContent = nsnull;
mContent->GetParent(pParentContent);
nsCOMPtr<nsIContent> rowContent;
nsCOMPtr<nsIContent> itemContent;
mContent->GetParent(*getter_AddRefs(rowContent));
rowContent->GetParent(*getter_AddRefs(itemContent));
if (isHover)
{
// We're hovering over the node.
// We're selecting the node.
mContent->SetAttribute(kNameSpaceID_None, kHoverCellAtom, "true", notifyForReflow);
if(pParentContent) {
pParentContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow);
}
rowContent->SetAttribute(kNameSpaceID_None, kHoverRowAtom, "true", notifyForReflow);
itemContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow);
}
else
{
// We're deselecting the node.
mContent->UnsetAttribute(kNameSpaceID_None, kHoverCellAtom, notifyForReflow);
if(pParentContent) {
pParentContent->UnsetAttribute(kNameSpaceID_None, kHoverAtom, notifyForReflow);
}
}
NS_IF_RELEASE(pParentContent);
}
// XXX This method will go away. I think it can
// actually go away now... ?
NS_IMETHODIMP
nsTreeCellFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint)
{
// redraw
nsRect frameRect;
GetRect(frameRect);
nsRect rect(0, 0, frameRect.width, frameRect.height);
Invalidate(rect, PR_TRUE);
return NS_OK;
mContent->UnsetAttribute(kNameSpaceID_None, kHoverCellAtom, notifyForReflow);
rowContent->UnsetAttribute(kNameSpaceID_None, kHoverRowAtom, notifyForReflow);
itemContent->UnsetAttribute(kNameSpaceID_None, kHoverAtom, notifyForReflow);
}
}
NS_IMETHODIMP

Просмотреть файл

@ -46,12 +46,6 @@ public:
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
NS_IMETHOD
AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint);
void Select(nsIPresContext& presContext, PRBool isSelected, PRBool notifyForReflow = PR_TRUE);
void Hover(nsIPresContext& presContext, PRBool isHover, PRBool notifyForReflow = PR_TRUE);

Просмотреть файл

@ -48,7 +48,7 @@ NS_NewTreeFrame (nsIFrame** aNewFrame)
// Constructor
nsTreeFrame::nsTreeFrame()
:nsTableFrame() { }
:nsTableFrame(),mSlatedForReflow(PR_FALSE) { }
// Destructor
nsTreeFrame::~nsTreeFrame()
@ -274,3 +274,13 @@ nsTreeFrame::DeleteFrame(nsIPresContext& aPresContext)
ClearSelection(aPresContext);
return nsTableFrame::DeleteFrame(aPresContext);
}
NS_IMETHODIMP
nsTreeFrame::Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
mSlatedForReflow = PR_FALSE;
return nsTableFrame::Reflow(aPresContext, aMetrics, aReflowState, aStatus);
}

Просмотреть файл

@ -41,7 +41,18 @@ public:
void FireChangeHandler(nsIPresContext& aPresContext);
PRBool IsSlatedForReflow() { return mSlatedForReflow; };
void SlateForReflow() { mSlatedForReflow = PR_TRUE; };
// Overridden methods
NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
PRBool RowGroupsShouldBeConstrained() { return PR_TRUE; }
NS_IMETHODIMP Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
protected:
nsTreeFrame();
@ -49,4 +60,7 @@ protected:
protected: // Data Members
nsVoidArray mSelectedItems; // The selected cell frames.
PRBool mSlatedForReflow; // If set, don't waste time scheduling excess reflows.
}; // class nsTreeFrame

Просмотреть файл

@ -77,7 +77,7 @@ nsTreeIndentationFrame::Reflow(nsIPresContext& aPresContext,
{
nscoord level = 0;
// First climb out to the tree row level.
// First climb out to the tree item level.
nsIFrame* aFrame = this;
nsCOMPtr<nsIContent> pContent;
aFrame->GetContent(getter_AddRefs(pContent));
@ -96,7 +96,7 @@ nsTreeIndentationFrame::Reflow(nsIPresContext& aPresContext,
// We now have a tree row content node. Start counting our level of nesting.
nsCOMPtr<nsIContent> pParentContent;
while (pTag.get() != nsXULAtoms::treebody && pTag.get() != nsXULAtoms::treehead)
while (pTag.get() != nsXULAtoms::tree && pTag.get() != nsXULAtoms::treehead)
{
pContent->GetParent(*getter_AddRefs(pParentContent));
@ -106,7 +106,8 @@ nsTreeIndentationFrame::Reflow(nsIPresContext& aPresContext,
++level;
}
level = (level-1)/2;
level = (level/2) - 1;
if (level < 0) level = 0;
width = level*16; // Hardcode an indentation of 16 pixels for now. TODO: Make this a parameter or something
}

Просмотреть файл

@ -0,0 +1,292 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsCOMPtr.h"
#include "nsIFrameReflow.h"
#include "nsTreeFrame.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsTreeRowGroupFrame.h"
#include "nsIStyleContext.h"
#include "nsCSSFrameConstructor.h"
#include "nsIContent.h"
#include "nsCSSRendering.h"
#include "nsTreeCellFrame.h"
#include "nsCellMap.h"
#include "nsIReflowCommand.h"
#include "nsHTMLParts.h"
//
// NS_NewTreeFrame
//
// Creates a new tree frame
//
nsresult
NS_NewTreeRowGroupFrame (nsIFrame** aNewFrame)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsTreeRowGroupFrame* it = new nsTreeRowGroupFrame;
if (!it)
return NS_ERROR_OUT_OF_MEMORY;
*aNewFrame = it;
return NS_OK;
} // NS_NewTreeFrame
// Constructor
nsTreeRowGroupFrame::nsTreeRowGroupFrame()
:nsTableRowGroupFrame(), mScrollbar(nsnull), mFrameConstructor(nsnull),
mTopFrame(nsnull), mBottomFrame(nsnull), mIsLazy(PR_FALSE), mIsFull(PR_FALSE)
{ }
// Destructor
nsTreeRowGroupFrame::~nsTreeRowGroupFrame()
{
}
NS_IMETHODIMP
nsTreeRowGroupFrame::ReflowBeforeRowLayout(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
RowGroupReflowState& aReflowState,
nsReflowStatus& aStatus,
nsReflowReason aReason)
{
nsresult rv = NS_OK;
// Reflow a scrollbar if we have one.
if (mScrollbar && (aReflowState.availSize.height != NS_UNCONSTRAINEDSIZE)) {
// We must be constrained, or a scrollbar makes no sense.
nsSize kidMaxElementSize;
nsSize* pKidMaxElementSize = (nsnull != aDesiredSize.maxElementSize) ? &kidMaxElementSize : nsnull;
nsSize kidAvailSize(aReflowState.availSize);
nsHTMLReflowMetrics desiredSize(pKidMaxElementSize);
desiredSize.width=desiredSize.height=desiredSize.ascent=desiredSize.descent=0;
// Reflow the child into the available space, giving it as much width as it
// wants, but constraining its height.
kidAvailSize.width = NS_UNCONSTRAINEDSIZE;
nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, mScrollbar,
kidAvailSize, aReason);
kidReflowState.computedHeight = kidAvailSize.height;
rv = ReflowChild(mScrollbar, aPresContext, desiredSize, kidReflowState, aStatus);
if (NS_FAILED(rv))
return rv;
nscoord xpos = 0;
// Lose the width of the scrollbar as far as the rows are concerned.
if (aReflowState.availSize.width != NS_UNCONSTRAINEDSIZE) {
xpos = aReflowState.availSize.width - desiredSize.width;
/*aReflowState.availSize.width -= desiredSize.width;
if (aReflowState.availSize.width < 0)
aReflowState.availSize.width = 0;*/
}
// Place the child
nsRect kidRect (xpos, 0, desiredSize.width, aReflowState.availSize.height);
mScrollbar->SetRect(kidRect);
}
return rv;
}
PRBool nsTreeRowGroupFrame::ExcludeFrameFromReflow(nsIFrame* aFrame)
{
if (aFrame == mScrollbar)
return PR_TRUE;
else return PR_FALSE;
}
void nsTreeRowGroupFrame::LocateFrame(nsIFrame* aStartFrame, nsIFrame** aResult)
{
if (aStartFrame == nsnull)
{
aStartFrame = mFrames.FirstChild();
}
else aStartFrame->GetNextSibling(&aStartFrame);
if (!aStartFrame) {
*aResult = nsnull;
} else if (aStartFrame != mScrollbar) {
*aResult = aStartFrame;
} else {
aStartFrame->GetNextSibling(&aStartFrame);
*aResult = aStartFrame;
}
}
nsIFrame*
nsTreeRowGroupFrame::GetFirstFrame()
{
// We may just be a normal row group.
if (!mIsLazy)
return mFrames.FirstChild();
LocateFrame(nsnull, &mTopFrame);
return mTopFrame;
}
nsIFrame*
nsTreeRowGroupFrame::GetLastFrame()
{
// For now just return the one on the end.
return mFrames.LastChild();
}
void
nsTreeRowGroupFrame::GetNextFrame(nsIFrame* aPrevFrame, nsIFrame** aResult)
{
if (!mIsLazy)
aPrevFrame->GetNextSibling(aResult);
else LocateFrame(aPrevFrame, aResult);
}
nsIFrame*
nsTreeRowGroupFrame::GetFirstFrameForReflow(nsIPresContext& aPresContext)
{
// Clear ourselves out.
mTopFrame = mBottomFrame = nsnull;
mIsFull = PR_FALSE;
// We may just be a normal row group.
if (!mIsLazy)
return mFrames.FirstChild();
// See if we have any frame whatsoever.
LocateFrame(nsnull, &mTopFrame);
mBottomFrame = mTopFrame;
if (mTopFrame)
return mTopFrame;
// We don't have a top frame instantiated. Let's
// try to make one.
PRInt32 count;
mContent->ChildCount(count);
nsCOMPtr<nsIContent> childContent;
for (PRInt32 i = 0; i < count; i++) {
mContent->ChildAt(i, *getter_AddRefs(childContent));
mFrameConstructor->CreateTreeWidgetContent(&aPresContext, this, childContent,
&mTopFrame);
printf("Created a frame\n");
mBottomFrame = mTopFrame;
const nsStyleDisplay *rowDisplay;
mTopFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)rowDisplay);
if (NS_STYLE_DISPLAY_TABLE_ROW==rowDisplay->mDisplay) {
((nsTableRowFrame *)mTopFrame)->InitChildren();
}
return mTopFrame;
}
return nsnull;
}
void
nsTreeRowGroupFrame::GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIFrame** aResult)
{
if (mIsLazy) {
// We're ultra-cool. We build our frames on the fly.
LocateFrame(aFrame, aResult);
if (!*aResult) {
// No result found. See if there's a content node that wants a frame.
PRInt32 i, childCount;
nsCOMPtr<nsIContent> prevContent;
aFrame->GetContent(getter_AddRefs(prevContent));
nsCOMPtr<nsIContent> parentContent;
mContent->IndexOf(prevContent, i);
mContent->ChildCount(childCount);
if (i+1 < childCount) {
// There is a content node that wants a frame.
nsCOMPtr<nsIContent> nextContent;
mContent->ChildAt(i+1, *getter_AddRefs(nextContent));
mFrameConstructor->CreateTreeWidgetContent(&aPresContext, this, nextContent,
aResult);
printf("Created a frame\n");
mBottomFrame = mFrames.FrameAt(i+1);
const nsStyleDisplay *rowDisplay;
mBottomFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)rowDisplay);
if (NS_STYLE_DISPLAY_TABLE_ROW==rowDisplay->mDisplay) {
((nsTableRowFrame *)mBottomFrame)->InitChildren();
}
}
}
return;
}
// Ho-hum. Move along, nothing to see here.
aFrame->GetNextSibling(aResult);
}
NS_IMETHODIMP
nsTreeRowGroupFrame::TreeInsertFrames(nsIFrame* aPrevFrame, nsIFrame* aFrameList)
{
mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
return NS_OK;
}
NS_IMETHODIMP
nsTreeRowGroupFrame::TreeAppendFrames(nsIFrame* aFrameList)
{
mFrames.AppendFrames(nsnull, aFrameList);
return NS_OK;
}
PRBool nsTreeRowGroupFrame::ContinueReflow(nscoord y, nscoord height)
{
//printf("Y is: %d\n", y);
//printf("Height is: %d\n", height);
if (height <= 0) {
mIsFull = PR_TRUE;
return PR_FALSE;
}
else
return PR_TRUE;
}
// Responses to changes
void nsTreeRowGroupFrame::OnContentAdded(nsIPresContext& aPresContext)
{
nsTableFrame* tableFrame;
nsTableFrame::GetTableFrame(this, tableFrame);
nsTreeFrame* treeFrame = (nsTreeFrame*)tableFrame;
if (IsLazy() && !treeFrame->IsSlatedForReflow()) {
treeFrame->SlateForReflow();
// Schedule a reflow for us.
nsCOMPtr<nsIReflowCommand> reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), treeFrame,
nsIReflowCommand::FrameAppended, nsnull);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPresShell> presShell;
aPresContext.GetShell(getter_AddRefs(presShell));
presShell->AppendReflowCommand(reflowCmd);
}
}
}

Просмотреть файл

@ -0,0 +1,82 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsTableRowGroupFrame.h"
#include "nsVoidArray.h"
class nsTreeFrame;
class nsCSSFrameConstructor;
class nsTreeRowGroupFrame : public nsTableRowGroupFrame
{
public:
friend nsresult NS_NewTreeRowGroupFrame(nsIFrame** aNewFrame);
virtual PRBool ExcludeFrameFromReflow(nsIFrame* aFrame);
void SetScrollbarFrame(nsIFrame* aFrame) { mIsLazy = PR_TRUE; mScrollbar = aFrame; };
void SetFrameConstructor(nsCSSFrameConstructor* aFrameConstructor) { mFrameConstructor = aFrameConstructor; };
void MakeLazy() { mIsLazy = PR_TRUE; };
PRBool IsLazy() { return mIsLazy; };
NS_IMETHOD TreeAppendFrames(nsIFrame* aFrameList);
NS_IMETHOD TreeInsertFrames(nsIFrame* aPrevFrame,
nsIFrame* aFrameList);
PRBool ContinueReflow(nscoord y, nscoord height);
PRBool IsFull() { return mIsFull; };
// Responses to changes
void OnContentAdded(nsIPresContext& aPresContext);
protected:
nsTreeRowGroupFrame();
virtual ~nsTreeRowGroupFrame();
virtual PRBool RowGroupReceivesExcessSpace() { return PR_FALSE; };
NS_IMETHOD ReflowBeforeRowLayout(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
RowGroupReflowState& aReflowState,
nsReflowStatus& aStatus,
nsReflowReason aReason);
virtual nsIFrame* GetFirstFrameForReflow(nsIPresContext& aPresContext);
virtual void GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIFrame** aResult);
virtual nsIFrame* GetFirstFrame();
virtual nsIFrame* GetLastFrame();
virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult);
void LocateFrame(nsIFrame* aStartFrame, nsIFrame** aResult);
protected: // Data Members
nsIFrame* mTopFrame; // The current topmost frame in the view.
nsIFrame* mBottomFrame; // The current bottom frame in the view.
PRBool mIsLazy; // Whether or not we're a lazily instantiated beast
PRBool mIsFull; // Whether or not we have any more room.
nsIFrame* mScrollbar; // Our scrollbar.
nsCSSFrameConstructor* mFrameConstructor; // We don't own this. (No addref/release allowed, punk.)
}; // class nsTreeRowGroupFrame

Просмотреть файл

@ -40,7 +40,7 @@ nsIAtom* nsXULAtoms::toolbox;
nsIAtom* nsXULAtoms::tree;
nsIAtom* nsXULAtoms::treecaption;
nsIAtom* nsXULAtoms::treehead;
nsIAtom* nsXULAtoms::treebody;
nsIAtom* nsXULAtoms::treerow;
nsIAtom* nsXULAtoms::treeitem;
nsIAtom* nsXULAtoms::treecell;
nsIAtom* nsXULAtoms::treechildren;
@ -105,7 +105,7 @@ void nsXULAtoms::AddrefAtoms() {
tree = NS_NewAtom("tree");
treecaption = NS_NewAtom("treecaption");
treehead = NS_NewAtom("treehead");
treebody = NS_NewAtom("treebody");
treerow = NS_NewAtom("treerow");
treecell = NS_NewAtom("treecell");
treeitem = NS_NewAtom("treeitem");
treechildren = NS_NewAtom("treechildren");
@ -161,7 +161,7 @@ void nsXULAtoms::ReleaseAtoms() {
NS_RELEASE(tree);
NS_RELEASE(treecaption);
NS_RELEASE(treehead);
NS_RELEASE(treebody);
NS_RELEASE(treerow);
NS_RELEASE(treecell);
NS_RELEASE(treeitem);
NS_RELEASE(treechildren);

Просмотреть файл

@ -58,7 +58,7 @@ public:
static nsIAtom* tree; // The start of a tree view
static nsIAtom* treecaption; // The caption of a tree view
static nsIAtom* treehead; // The header of the tree view
static nsIAtom* treebody; // The body of the tree view
static nsIAtom* treerow; // A row in the tree view
static nsIAtom* treeitem; // An item in the tree view
static nsIAtom* treecell; // A cell in the tree view
static nsIAtom* treechildren; // The children of an item in the tree viw

Просмотреть файл

@ -47,6 +47,7 @@ function OnLoadAddressBook()
function ChangeDirectoryByDOMNode(dirNode)
{
dump("-----------------ChangeDirectoryByDOMNode----------------\n");
var uri = dirNode.getAttribute('id');
dump(uri + "\n");
ChangeDirectoryByURI(uri);
@ -55,7 +56,15 @@ function ChangeDirectoryByDOMNode(dirNode)
function ChangeDirectoryByURI(uri)
{
var tree = frames[0].frames[1].document.getElementById('resultTree');
tree.childNodes[7].setAttribute('id', uri);
dump("tree = " + tree + "\n");
var treechildrenList = tree.getElementsByTagName('treechildren');
if ( treechildrenList.length == 1 )
{
var body = treechildrenList[0];
body.setAttribute('id', uri);// body no longer valid after setting id.
}
dump("------------end--ChangeDirectoryByDOMNode---end----------\n");
}
@ -70,9 +79,13 @@ function saChangeDirectoryByURI(uri)
{
var tree = frames["browser.selAddrResultPane"].document.getElementById('resultTree');
dump("tree = " + tree + "\n");
dump("tree.childNodes[7].id = " + tree.childNodes[7].getAttribute('id') + "\n");
tree.childNodes[7].setAttribute('id', uri);
dump("tree.childNodes[7].id = " + tree.childNodes[7].getAttribute('id') + "\n");
var treechildrenList = tree.getElementsByTagName('treechildren');
if ( treechildrenList.length == 1 )
{
var body = treechildrenList[0];
body.setAttribute('id', uri);// body no longer valid after setting id.
}
}
@ -309,16 +322,18 @@ function AddAddressIntoBucket(doc, address)
var body = doc.getElementById("bucketBody");
var newitem = doc.createElement('treeitem');
var item = doc.createElement('treeitem');
//newitem.setAttribute("rowID", num);
//newitem.setAttribute("rowName", name);
var elem = doc.createElement('treecell');
var cell = doc.createElement('treecell');
var row = doc.createElement('treerow');
var text = doc.createTextNode(address);
elem.appendChild(text);
newitem.appendChild(elem);
body.appendChild(newitem);
cell.appendChild(text);
row.appendChild(cell);
item.appendChild(row);
body.appendChild(item);
}
function RemoveSelectedFromBucket()
@ -336,3 +351,78 @@ function RemoveSelectedFromBucket()
}
}
}
// ----------------------
// DumpDOM(node)
// FIX ME!
// This code should be removed when we land in the tip, it has been replaced by DumpDOM.js
// ----------------------
function DumpDOM(node)
{
dump("--------------------- DumpDOM ---------------------\n");
DumpNodeAndChildren(node, "");
dump("------------------- End DumpDOM -------------------\n");
}
// This function does the work of DumpDOM by recursively calling itself to explore the tree
function DumpNodeAndChildren(node, prefix)
{
dump(prefix + "<" + node.nodeName);
if ( node.nodeType == 1 )
{
// id
var text = node.getAttribute('id');
if ( text && text[0] != '$' )
dump(" id=\"" + text + "\"");
DumpAttribute(node, "name");
DumpAttribute(node, "class");
DumpAttribute(node, "style");
DumpAttribute(node, "flex");
DumpAttribute(node, "value");
DumpAttribute(node, "src");
DumpAttribute(node, "onclick");
DumpAttribute(node, "onchange");
}
if ( node.nodeName == "#text" )
dump(" = \"" + node.data + "\"");
dump(">\n");
// dump IFRAME && FRAME DOM
if ( node.nodeName == "IFRAME" || node.nodeName == "FRAME" )
{
if ( node.name )
{
var wind = top.frames[node.name];
if ( wind && wind.document && wind.document.documentElement )
{
dump(prefix + "----------- " + node.nodeName + " -----------\n");
DumpNodeAndChildren(wind.document.documentElement, prefix + " ");
dump(prefix + "--------- End " + node.nodeName + " ---------\n");
}
}
}
// children of nodes (other than frames)
else
{
var child = 0;
while ( node.childNodes && child < node.childNodes.length )
{
DumpNodeAndChildren(node.childNodes[child], prefix + " ");
child++;
}
}
}
function DumpAttribute(node, attribute)
{
var text = node.getAttribute(attribute);
if ( text )
dump(" " + attribute + "=\"" + text + "\"");
}

Просмотреть файл

@ -103,10 +103,11 @@
<!ENTITY throbber.url "http://www.mozilla.org/">
]>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&addressbookWindow.title;"
style="width:100%;height:100%"
title="&addressbookWindow.title;"
onload="OnLoadAddressBook()">
<html:script language="JavaScript" src="chrome://addressbook/content/addressbook.js"/>
@ -223,8 +224,7 @@
<titledbutton src="&newmsgButton.img;" align="bottom" value="&newmsgButton.label;" onclick="AbNewMsg()"/>
<titledbutton src="&deleteButton.img;" align="bottom" value="&deleteButton.label;" onclick="AbDelete()"/>
<box align="vertical" flex="100%"> -->
<!-- <titledbutton align="left" value="&search.label;"/>-->
<box align="vertical" flex="100%">
<spring flex="100%"/>
<html:input id="searchtext" type="text" style="min-width: 100px; min-height: 25px"/>
<spring flex="100%"/>

Просмотреть файл

@ -17,11 +17,13 @@
<tree id="addressBucket" flex="100%">
<treecol style="width:100%"/>
<treebody id="bucketBody">
<treechildren id="bucketBody">
<treeitem>
<treecell/>
<treerow>
<treecell/>
</treerow>
</treeitem>
</treebody>
</treechildren>
</tree>
</window>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://addressbook/skin/dirPane.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://addressbook/skin/" type="text/css"?>
<!DOCTYPE window
[
@ -9,21 +10,41 @@
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="background-color:white">
<html:script language="javascript" src="chrome://addressbook/content/addressbook.js"/>
<tree rdf:datasources="rdf:addressdirectory" id="dirTree" onclick="return parent.parent.ChangeDirectoryByDOMNode(event.target.parentNode)">
<treecol rdf:resource="http://home.netscape.com/NC-rdf#DirName"/>
<treehead>
<treeitem>
<treecell>&directoryColumn.label;</treecell>
</treeitem>
</treehead>
<tree class="abDirectory" rdf:datasources="rdf:addressdirectory" id="dirTree" onclick="return parent.parent.ChangeDirectoryByDOMNode(event.target.parentNode.parentNode)">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow >
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#DirName" align="right" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treebody rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#CardChild">
<treeitem id="abdirectory:/" open="true">
<treecell/>
</treeitem>
</treebody>
<treecol rdf:resource="http://home.netscape.com/NC-rdf#DirName"/>
<treehead>
<treerow>
<treecell>&directoryColumn.label;</treecell>
</treerow>
</treehead>
<treechildren rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#CardChild">
<treeitem ref="abdirectory:/" open="true">
<treerow>
<treecell/>
</treerow>
</treeitem>
</treechildren>
</tree>
</window>

Просмотреть файл

@ -23,33 +23,64 @@
<tree class="abResults" flex="100%" id="resultTree"
rdf:datasources="rdf:addressdirectory rdf:addresscard"
onchange="ResultsPaneSelectionChange()" rdf:containment="http://home.netscape.com/NC-rdf#CardChild">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow >
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#PersonName" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Email" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#WorkPhone" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Organization" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Nickname" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#City" align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol style="width:13%" id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#PersonName"/>
<treecol style="width:21%" id="EmailColumn" rdf:resource="http://home.netscape.com/NC-rdf#Email"/>
<treecol style="width:13%" id="WorkPhoneColumn" rdf:resource="http://home.netscape.com/NC-rdf#WorkPhone"/>
<treecol style="width:20%" id="OrganizationColumn" rdf:resource="http://home.netscape.com/NC-rdf#Organization"/>
<treecol style="width:13%" id="NicknameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Nickname"/>
<treecol style="width:20%" id="CityColumn" rdf:resource="http://home.netscape.com/NC-rdf#City"/>
<treehead>
<treeitem>
<treerow>
<treecell>&nameColumn.label;</treecell>
<treecell>&emailColumn.label;</treecell>
<treecell>&phoneColumn.label;</treecell>
<treecell>&orgColumn.label;</treecell>
<treecell>&nicknameColumn.label;</treecell>
<treecell>&cityColumn.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody id="" name="cardTreeBody">
<treechildren id="" name="cardTreeBody">
<treeitem>
<treecell/>
<treecell/>
<treecell/>
<treecell/>
<treecell/>
<treecell/>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
<treerow><treecell/></treerow>
</treeitem>
</treebody>
</treechildren>
</tree>
</window>

Просмотреть файл

@ -55,7 +55,8 @@ Rights Reserved.
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&selectAddressWindow.title;"
style="width:100%; height:100%">
class="dialog"
style="width:100%; height:100%; padding:0px">
<html:script language="JavaScript" src="chrome://addressbook/content/addressbook.js"/>
@ -84,19 +85,21 @@ Rights Reserved.
<box align="vertical" style="width:190px; background-color:white">
<tree id="dirTree" class="abDirectory" flex="100%"
rdf:datasources="rdf:addressdirectory"
onclick="return saChangeDirectoryByDOMNode(event.target.parentNode)">
onclick="return saChangeDirectoryByDOMNode(event.target.parentNode.parentNode)">
<treecol style="width:100%" rdf:resource="http://home.netscape.com/NC-rdf#DirName" />
<treehead>
<treeitem>
<treerow>
<treecell>&directoryColumn.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#CardChild">
<treeitem id="abdirectory:/" open="true">
<treecell/>
<treechildren rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#CardChild">
<treeitem ref="abdirectory:/" open="true">
<treerow>
<treecell/>
</treerow>
</treeitem>
</treebody>
</treechildren>
</tree>
</box>

Просмотреть файл

@ -108,7 +108,7 @@ treecol {
/* Custom Trees */
tree[class="abDirectory"] treeitem > treecell > titledbutton {
tree[class="abDirectory"] treeitem > treerow > treecell > titledbutton {
vertical-align: bottom;
min-height: 1px;
min-width: 1px;
@ -116,10 +116,11 @@ tree[class="abDirectory"] treeitem > treecell > titledbutton {
width: 1em;
margin:0px;
padding:0px;
border:none;
list-style-image: url("chrome://addressbook/skin/myaddrbk.gif");
}
tree[class="abResults"] treeitem > treecell > titledbutton {
tree[class="abResults"] treeitem > treerow > treecell > titledbutton {
vertical-align: middle;
min-height: 1px;
min-width: 1px;
@ -127,6 +128,7 @@ tree[class="abResults"] treeitem > treecell > titledbutton {
width: 2em;
margin:0px;
padding:0px;
border:none;
list-style-image: url("chrome://addressbook/skin/person.gif");
}

Просмотреть файл

@ -347,14 +347,14 @@ NS_IMETHODIMP nsABCardDataSource::Assert(nsIRDFResource* source,
nsIRDFNode* target,
PRBool tv)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_RDF_ASSERTION_REJECTED;//NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsABCardDataSource::Unassert(nsIRDFResource* source,
nsIRDFResource* property,
nsIRDFNode* target)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_RDF_ASSERTION_REJECTED;//NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -375,14 +375,14 @@ NS_IMETHODIMP nsABDirectoryDataSource::Assert(nsIRDFResource* source,
nsIRDFNode* target,
PRBool tv)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_RDF_ASSERTION_REJECTED;//NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsABDirectoryDataSource::Unassert(nsIRDFResource* source,
nsIRDFResource* property,
nsIRDFNode* target)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_RDF_ASSERTION_REJECTED;//NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -14,14 +14,29 @@
<tree rdf:datasources="rdf:msgaccountmanager"
onclick="showPage(event)"
id="accounttree">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow >
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treehead>
<treecell>Name</treecell>
<treerow>
<treecell>Name</treecell>
</treerow>
</treehead>
<treebody rdf:containment="http://home.netscape.com/NC-rdf#Settings">
<treechildren rdf:containment="http://home.netscape.com/NC-rdf#Settings">
<treeitem id="msgaccounts:/" open="true"/>
</treebody>
</treechildren>
</tree>
<box align="vertical">

Просмотреть файл

@ -1,25 +1,11 @@
tree {
display: table;
background-color: white;
border: none;
border-spacing: 0px;
width: 100%;
}
treeitem {
display: table-row;
}
treehead {
/* display: table-header-group; */
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
color: black;
font-family: Veranda;
font-size: 12pt;
@ -30,9 +16,16 @@ treecell[selectedcell] {
color: white;
}
treehead treeitem treecell {
treehead treerow treecell {
font-size: 9pt;
background-color: #666699;
border: thin darkgray solid;
color: white;
}
treerow > treecell > titledbutton {
color: inherit;
border: none;
padding: 0px;
margin: 0px;
}

Просмотреть файл

@ -43,6 +43,18 @@ function GetFolderTree()
return folderTree;
}
function GetThreadTree()
{
var threadTree = frames[0].frames[1].document.getElementById('threadTree');
return threadTree;
}
function GetThreadTreeFolder()
{
var tree = GetThreadTree();
return tree.childNodes[6];
}
function FindMessenger()
{
return messenger;
@ -76,7 +88,7 @@ function ComposeMessage(type, format)
return;
}
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
if (tree)
{
var nodeList = tree.getElementsByAttribute("selected", "true");
@ -128,7 +140,7 @@ function NewMessage()
function GetNewMessages()
{
var folderTree = frames[0].frames[0].document.getElementById('folderTree');
var folderTree = GetFolderTree();;
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true");
if(selectedFolderList.length > 0)
{
@ -158,9 +170,9 @@ function ChangeFolderByDOMNode(folderNode)
function ChangeFolderByURI(uri)
{
var tree = frames[0].frames[1].document.getElementById('threadTree');
var folder = GetThreadTreeFolder();
var beforeTime = new Date();
tree.childNodes[5].setAttribute('id', uri);
folder.setAttribute('id', uri);
var afterTime = new Date();
var timeToLoad = (afterTime - beforeTime)/1000;
if(showPerformance)
@ -239,3 +251,10 @@ function SetFolderCharset(folderResource, aCharset)
db2.Assert(folderResource, charsetProperty, charsetResource, true);
}
function RefreshThreadTreeView()
{
var currentFolder = GetThreadTreeFolder();
var currentFolderID = currentFolder.getAttribute('id');
currentFolder.setAttribute('id', currentFolderID);
}

Просмотреть файл

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/folderPane.css" type="text/css"?>
<!--
The contents of this file are subject to the Netscape Public
@ -34,28 +35,51 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tree rdf:datasources="rdf:mailnewsfolders rdf:msgaccountmanager" id="folderTree" onclick="return parent.parent.ChangeFolderByDOMNode(event.target.parentNode)">
<tree style="height: 100%" rdf:datasources="rdf:mailnewsfolders rdf:msgaccountmanager" id="folderTree" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild" onclick="return parent.parent.ChangeFolderByDOMNode(event.target.parentNode.parentNode)">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow >
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#TotalUnreadMessages" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#TotalMessages" align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol style="width:70%" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol style="width:15%" rdf:resource="http://home.netscape.com/NC-rdf#TotalUnreadMessages"/>
<treecol style="width:15%" rdf:resource="http://home.netscape.com/NC-rdf#TotalMessages"/>
<treehead>
<treeitem>
<treerow>
<treecell>&nameColumn.label;</treecell>
<treecell>&unreadColumn.label;</treecell>
<treecell>&totalColumn.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild">
<treeitem id="msgaccounts:/" open="true">
<treecell>
<treeindentation/>
<html:img hspace="2" style="vertical-align: bottom" src="&accounts.img;"/>&accounts.label;
</treecell>
<treecell/>
<treecell/>
</treeitem>
</treebody>
<treechildren rdf:containment="http://home.netscape.com/NC-rdf#child" open="true">
<treeitem ref="msgaccounts:/" open="true">
<treerow>
<treecell>
<treeindentation/>
<html:img hspace="2" style="vertical-align: bottom" src="&accounts.img;"/>&accounts.label;
</treecell>
<treecell/>
<treecell/>
</treerow>
</treeitem>
</treechildren>
</tree>
</window>

Просмотреть файл

@ -504,10 +504,10 @@ Rights Reserved.
</menu>
<menuitem name="&editMsgAsNewCmd.label;" onclick="MsgEditMessageAsNew();"/>
<separator/>
<menu name="&moveMsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild" open="true"
<menu name="&moveMsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
onclick="MsgMoveMessage(event.target)">
</menu>
<menu name="&copyMsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild" open="true"
<menu name="&copyMsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
onclick="MsgCopyMessage(event.target)">
</menu>
<separator/>

Просмотреть файл

@ -111,22 +111,9 @@ function EditBookmark() {}
function Newsgroups() {}
function AddressBook()
{
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
if (!toolkitCore)
{
toolkitCore = new ToolkitCore();
if (toolkitCore)
{
toolkitCore.Init("ToolkitCore");
}
}
if (toolkitCore)
{
toolkitCore.ShowWindow("chrome://addressbook/content/",
window);
}
var wind = window.open("chrome://addressbook/content/addressbook.xul",
"addressbook", "chrome");
return wind;
}
function History() {}

Просмотреть файл

@ -174,27 +174,33 @@ Rights Reserved.
<box align="vertical" class="cleanborder">
<tree>
<treehead>
<treeitem>
<treerow>
<treecell>&nameColumn.label;</treecell>
<treecell><html:img src="chrome://messenger/skin/check.gif"/></treecell>
<treecell>&messagesColumn.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody rdf:containment="http://home.netscape.com/NC-rdf#child" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild">
<treeitem id="1">
<treecell><treeindentation/>1</treecell>
<treecell/>
<treecell/>
<treerow>
<treecell><treeindentation/>1</treecell>
<treecell/>
<treecell/>
</treerow>
</treeitem>
<treeitem id="2">
<treecell><treeindentation/>2</treecell>
<treecell/>
<treecell/>
<treerow>
<treecell><treeindentation/>2</treecell>
<treecell/>
<treecell/>
</treerow>
</treeitem>
<treeitem id="3">
<treecell><treeindentation/>3</treecell>
<treecell/>
<treecell/>
<treerow>
<treecell><treeindentation/>3</treecell>
<treecell/>
<treecell/>
</treerow>
</treeitem>
</treebody>
</tree>

Просмотреть файл

@ -36,24 +36,45 @@ Rights Reserved.
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tree datasources="rdf:mailnewsfolders rdf:mailnewsmessages" id="threadTree" onclick="return parent.parent.LoadMessage(event.target.parentNode)" containment="http://home.netscape.com/NC-rdf#MessageChild">
<tree style="height: 100%" datasources="rdf:mailnewsfolders rdf:mailnewsmessages" id="threadTree" onclick="return parent.parent.LoadMessage(event.target.parentNode.parentNode)" containment="http://home.netscape.com/NC-rdf#MessageChild">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow >
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Subject" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Sender" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Date" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Status" align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol style="width:47%" id="SubjectColumn" rdf:resource="http://home.netscape.com/NC-rdf#Subject"/>
<treecol style="width:30%" id="AuthorColumn" rdf:resource="http://home.netscape.com/NC-rdf#Sender"/>
<treecol style="width:15%" id="DateColumn" rdf:resource="http://home.netscape.com/NC-rdf#Date"/>
<treecol style="width:8%" id="StatusColumn" rdf:resource="http://home.netscape.com/NC-rdf#Status"/>
<treehead>
<treeitem>
<treerow>
<treecell onclick="return parent.parent.SortThreadPane('SubjectColumn', 'http://home.netscape.com/NC-rdf#Subject');">&subjectColumn.label;</treecell>
<treecell onclick="return parent.parent.SortThreadPane('AuthorColumn', 'http://home.netscape.com/NC-rdf#Sender');">&senderColumn.label;</treecell>
<treecell onclick="return parent.parent.SortThreadPane('DateColumn', 'http://home.netscape.com/NC-rdf#Date');">&dateColumn.label;</treecell>
<treecell onclick="return parent.parent.SortThreadPane('StatusColumn', 'http://home.netscape.com/NC-rdf#Status');">&statusColumn.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody id="" name="threadTreeBody">
</treebody>
<treechildren id="" name="threadTreeBody">
</treechildren>
</tree>
</window>

Просмотреть файл

@ -59,13 +59,13 @@ function MsgGetMessage()
function MsgDeleteMessage()
{
dump("\nMsgDeleteMessage from XUL\n");
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
if(tree) {
dump("tree is valid\n");
//get the selected elements
var messageList = tree.getElementsByAttribute("selected", "true");
//get the current folder
var srcFolder = tree.childNodes[5];
var srcFolder = GetThreadTreeFolder();
messenger.DeleteMessages(tree, srcFolder, messageList);
}
}
@ -73,7 +73,7 @@ function MsgDeleteMessage()
function MsgDeleteFolder()
{
//get the selected elements
var tree = frames[0].frames[0].document.getElementById('folderTree');
var tree = GetFolderTree();
var folderList = tree.getElementsByAttribute("selected", "true");
var i;
var folder, parent;
@ -132,13 +132,13 @@ function MsgCopyMessage(destFolder)
destUri = destFolder.getAttribute('id');
dump(destUri);
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
if(tree)
{
//Get the selected messages to copy
var messageList = tree.getElementsByAttribute("selected", "true");
//get the current folder
var srcFolder = tree.childNodes[5];
var srcFolder = GetThreadTreeFolder();
messenger.CopyMessages(srcFolder, destFolder, messageList, false);
}
}
@ -149,13 +149,13 @@ function MsgMoveMessage(destFolder)
destUri = destFolder.getAttribute('id');
dump(destUri);
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
if(tree)
{
//Get the selected messages to copy
var messageList = tree.getElementsByAttribute("selected", "true");
//get the current folder
var srcFolder = tree.childNodes[5];
var srcFolder = GetThreadTreeFolder();
messenger.CopyMessages(srcFolder, destFolder, messageList, true);
}
}
@ -164,42 +164,32 @@ function MsgViewAllMsgs()
{
dump("MsgViewAllMsgs");
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
messenger.ViewAllMessages(tree.database);
//hack to make it get new view.
var currentFolder = tree.childNodes[5].getAttribute('id');
tree.childNodes[5].setAttribute('id', currentFolder);
RefreshThreadTreeView();
}
function MsgViewUnreadMsg()
{
dump("MsgViewUnreadMsgs");
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
messenger.ViewUnreadMessages(tree.database);
//hack to make it get new view.
var currentFolder = tree.childNodes[5].getAttribute('id');
tree.childNodes[5].setAttribute('id', currentFolder);
RefreshThreadTreeView();
}
function MsgViewAllThreadMsgs()
{
dump("MsgViewAllMessagesThreaded");
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
messenger.ViewAllThreadMessages(tree.database);
//hack to make it get new view.
var currentFolder = tree.childNodes[5].getAttribute('id');
tree.childNodes[5].setAttribute('id', currentFolder);
RefreshThreadTreeView();
}
function MsgSortByDate()
@ -224,7 +214,7 @@ function MsgSortBySubject()
function MsgNewFolder()
{
var folderTree = frames[0].frames[0].document.getElementById('folderTree');
var folderTree = GetFolderTree();
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true");
var selectedFolder = selectedFolderList[0];
@ -341,7 +331,7 @@ function MsgAddAllToAddressBook() {}
function MsgMarkMsgAsRead(markRead)
{
dump("\MsgMarkMsgAsRead from XUL\n");
var tree = frames[0].frames[1].document.getElementById('threadTree');
var tree = GetThreadTree();
//get the selected elements
var messageList = tree.getElementsByAttribute("selected", "true");
messenger.MarkMessagesRead(tree.database, messageList, markRead);

Просмотреть файл

@ -24,7 +24,6 @@ window {
}
tree {
display: table;
background-color:white;
border: none;
border-spacing: 0px;
@ -33,76 +32,68 @@ tree {
}
treeitem {
display: table-row;
treerow {
color: black;
font-family: Verdana;
font-size: 10pt;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
white-space: nowrap;
}
treecol {
display: table-column;
}
treeitem[selected="true"] {
treerow[selectedrow="true"] {
background-color: #666699;
color: white;
}
treehead treeitem treecell {
treehead treerow treecell {
font-size: 9pt;
background-color: #666699;
border: thin darkgray solid;
color: white;
}
treeitem > treecell > titledbutton {
treerow > treecell > titledbutton {
height: 16px;
width: 16px;
list-style-image: url("chrome://messenger/skin/closedMailFolder.gif");
color: inherit;
border: none;
padding: 0px;
margin: 0px;
}
treeitem[open="true"] > treecell > titledbutton {
treeitem[open="true"] > treerow > treecell > titledbutton {
height: 16px;
width: 16px;
list-style-image: url("chrome://messenger/skin/openMailFolder.gif");
}
treeitem[SpecialFolder="Inbox"] > treecell > titledbutton {
treeitem[SpecialFolder="Inbox"] > treerow > treecell > titledbutton {
vertical-align: bottom;
height: 16px;
width: 16px;
list-style-image: url("chrome:/messenger/skin/closedInbox.gif");
}
treeitem[SpecialFolder="Trash"] > treecell > titledbutton {
treeitem[SpecialFolder="Trash"] > treerow > treecell > titledbutton {
vertical-align: bottom;
height: 16px;
width: 16px;
list-style-image: url("chrome://messenger/skin/closedTrash.gif");
}
treeitem[SpecialFolder="Unsent Messages"] > treecell > titledbutton {
treeitem[SpecialFolder="Unsent Messages"] > treerow > treecell > titledbutton {
vertical-align: bottom;
height: 16px;
width: 16px;
list-style-image: url("chrome://messenger/skin/closedOutbox.gif");
}
treeitem[BiffState="NewMail"] > treecell > titledbutton {
treeitem[BiffState="NewMail"] > treerow > treecell > titledbutton {
vertical-align: bottom;
height: 16px;
width: 16px;

Просмотреть файл

@ -25,7 +25,6 @@
}
tree {
display: table;
background-color:white;
border: none;
border-spacing: 0px;
@ -33,20 +32,9 @@ tree {
width: 100%
}
treeitem {
display: table-row;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
color: black;
font-family: Verdana;
font-size: 10pt;
@ -57,15 +45,21 @@ treecell[selectedcell] {
color: white;
}
treeitem > treecell > titledbutton {
treerow > treecell > titledbutton {
list-style-image: url("chrome://messenger/skin/dot.gif");
color: inherit;
border: none;
padding: 0px;
margin: 0px;
height: 16px;
width: 16px;
}
treeitem[subscribed="true"] > treecell > titledbutton {
treeitem[subscribed="true"] > treerow > treecell > titledbutton {
list-style-image: url("chrome://messenger/skin/check.gif");
}
treehead treeitem treecell {
treehead treerow treecell {
font-size: 9pt;
background-color: #666699;
border: thin darkgray solid;

Просмотреть файл

@ -25,7 +25,6 @@ window {
}
tree {
display: table;
background-color: white;
border: none;
border-spacing: 0px;
@ -34,54 +33,45 @@ tree {
table-layout: fixed;
}
treeitem {
display: table-row;
treerow {
font-family: Verdana;
font-size: 10pt;
color: black;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
white-space: nowrap;
}
treeitem[selected="true"] {
treerow[selectedrow="true"] {
background-color: #666699;
color: white;
}
treeitem[Status=""] {
treeitem[Status=""] > treerow {
font-weight: bold;
}
treeitem[Status="new"] {
treeitem[Status="new"] > treerow{
font-weight: bold;
}
treehead treeitem treecell {
treerow > treecell > titledbutton {
//list-style-image: url("chrome://messenger/skin/mailMessage.gif");
color: inherit;
border: none;
padding: 0px;
margin: 0px;
height: 16px;
width: 16px;
}
treehead treerow treecell {
font-size: 9pt;
background-color: #666699;
border: thin darkgray solid;
color: white;
}
icon {
display: list-item;
height: 16px;
width: 16px;
// list-style-image: url("chrome://messenger/skin/closedMailFolder.gif");
}
treecol {
display: table-column;
}

Просмотреть файл

@ -32,50 +32,62 @@
<treecol id="activeColumn" style="width: 10%"/>
<treehead>
<treeitem>
<treerow>
<treecell>&numberColumn.label;</treecell>
<treecell>&nameColumn.label;</treecell>
<treecell>&activeColumn.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody>
<treechildren>
<treeitem open="true">
<treecell/>
<treecell><treeindentation/>Sample Server 1</treecell>
<treecell/>
<treechildren>
<treeitem>
<treecell/>
<treecell><treeindentation/>People from work</treecell>
<treecell/>
</treeitem>
<treeitem>
<treecell/>
<treecell><treeindentation/>People from work</treecell>
<treecell/>
</treeitem>
</treechildren>
<treerow>
<treecell/>
<treecell><treeindentation/>Sample Server 1</treecell>
<treecell/>
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell/>
<treecell><treeindentation/>People from work</treecell>
<treecell/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell/>
<treecell><treeindentation/>People from work</treecell>
<treecell/>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem open="true">
<treecell/>
<treecell><treeindentation/>Sample Server 2</treecell>
<treecell/>
<treechildren>
<treeitem>
<treerow>
<treecell/>
<treecell><treeindentation/>People from college</treecell>
<treecell><treeindentation/>Sample Server 2</treecell>
<treecell/>
</treeitem>
<treeitem>
<treecell/>
<treecell><treeindentation/>SPAM</treecell>
<treecell/>
</treeitem>
</treechildren>
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell/>
<treecell><treeindentation/>People from college</treecell>
<treecell/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell/>
<treecell><treeindentation/>SPAM</treecell>
<treecell/>
</treerow>
</treeitem>
</treechildren>
</treeitem>
</treebody>
</treechildren>
</tree>
</box>

Просмотреть файл

@ -1652,12 +1652,8 @@ RDFElementImpl::AppendChildTo(nsIContent* aKid, PRBool aNotify)
PRUint32 cnt;
nsresult rv = mChildren->Count(&cnt);
if (NS_FAILED(rv)) return rv;
#if 0
// XXX Can't do this because of the tree frame trickery, I think.
mDocument->ContentAppended(NS_STATIC_CAST(nsIStyledContent*, this), cnt - 1);
#else
mDocument->ContentInserted(NS_STATIC_CAST(nsIStyledContent*, this), aKid, cnt - 1);
#endif
}
}
return NS_OK;

Просмотреть файл

@ -2006,7 +2006,9 @@ RDFGenericBuilderImpl::EnsureElementHasGenericChild(nsIContent* parent,
if (NS_FAILED(rv = NS_NewRDFElement(nameSpaceID, tag, getter_AddRefs(element))))
return rv;
if (NS_FAILED(rv = parent->AppendChildTo(element, PR_FALSE)))
if (NS_FAILED(rv = parent->AppendChildTo(element, PR_TRUE)))
// XXX Note that the notification ensures we won't batch insertions! This could be bad! - Dave
return rv;
*result = element;
@ -2015,47 +2017,6 @@ RDFGenericBuilderImpl::EnsureElementHasGenericChild(nsIContent* parent,
return NS_OK;
}
nsresult
RDFGenericBuilderImpl::FindWidgetRootElement(nsIContent* aElement,
nsIContent** aWidgetElement)
{
nsresult rv;
nsCOMPtr<nsIAtom> rootAtom;
if (NS_FAILED(rv = GetRootWidgetAtom(getter_AddRefs(rootAtom)))) {
return rv;
}
// walk up the tree until you find rootAtom
nsCOMPtr<nsIContent> element(do_QueryInterface(aElement));
while (element) {
PRInt32 nameSpaceID;
if (NS_FAILED(rv = element->GetNameSpaceID(nameSpaceID)))
return rv; // XXX fatal
if (nameSpaceID == kNameSpaceID_XUL) {
nsCOMPtr<nsIAtom> tag;
if (NS_FAILED(rv = element->GetTag(*getter_AddRefs(tag))))
return rv;
if (tag == rootAtom) {
*aWidgetElement = element;
NS_ADDREF(*aWidgetElement);
return NS_OK;
}
}
// up to the parent...
nsCOMPtr<nsIContent> parent;
element->GetParent(*getter_AddRefs(parent));
element = parent;
}
//NS_ERROR("must not've started from within the XUL widget");
return NS_ERROR_FAILURE;
}
PRBool
RDFGenericBuilderImpl::IsItemOrFolder(nsIContent* aElement)
@ -2322,9 +2283,17 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement)
return rv;
}
// The insertion root is _always_ open.
if (tag == insertionAtom)
return PR_TRUE;
if (tag == insertionAtom) {
// Hack for the tree widget
nsCOMPtr<nsIContent> parent;
aElement->GetParent(*getter_AddRefs(parent));
nsCOMPtr<nsIAtom> parentTag;
parent->GetTag(*getter_AddRefs(parentTag));
nsString tagName;
parentTag->ToString(tagName);
if (tagName == "tree")
return PR_TRUE;
}
// If it's not a widget folder item, then it's not open.
if (tag != folderAtom)
@ -2341,6 +2310,7 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement)
return PR_TRUE;
}
return PR_FALSE;
}

Просмотреть файл

@ -94,10 +94,6 @@ public:
nsIAtom* aTag,
nsIContent** aResult);
nsresult
FindWidgetRootElement(nsIContent* aElement,
nsIContent** aRootElement);
virtual nsresult
AddWidgetItem(nsIContent* aWidgetElement,
nsIRDFResource* aProperty,

Просмотреть файл

@ -186,8 +186,8 @@ public:
nsresult
GetInsertionRootAtom(nsIAtom** aResult) {
NS_ADDREF(kTreeBodyAtom);
*aResult = kTreeBodyAtom;
NS_ADDREF(kTreeChildrenAtom);
*aResult = kTreeChildrenAtom;
return NS_OK;
}
@ -212,7 +212,7 @@ public:
static nsIAtom* kPropertyAtom;
static nsIAtom* kTreeAtom;
static nsIAtom* kTreeBodyAtom;
static nsIAtom* kTreeRowAtom;
static nsIAtom* kTreeCellAtom;
static nsIAtom* kTreeChildrenAtom;
static nsIAtom* kTreeColAtom;
@ -235,7 +235,7 @@ nsIXULSortService* RDFTreeBuilderImpl::XULSortService = nsnull;
nsIAtom* RDFTreeBuilderImpl::kPropertyAtom;
nsIAtom* RDFTreeBuilderImpl::kTreeAtom;
nsIAtom* RDFTreeBuilderImpl::kTreeBodyAtom;
nsIAtom* RDFTreeBuilderImpl::kTreeRowAtom;
nsIAtom* RDFTreeBuilderImpl::kTreeCellAtom;
nsIAtom* RDFTreeBuilderImpl::kTreeChildrenAtom;
nsIAtom* RDFTreeBuilderImpl::kTreeColAtom;
@ -274,7 +274,7 @@ RDFTreeBuilderImpl::RDFTreeBuilderImpl(void)
if (gRefCnt == 0) {
kPropertyAtom = NS_NewAtom("property");
kTreeAtom = NS_NewAtom("tree");
kTreeBodyAtom = NS_NewAtom("treebody");
kTreeRowAtom = NS_NewAtom("treerow");
kTreeCellAtom = NS_NewAtom("treecell");
kTreeChildrenAtom = NS_NewAtom("treechildren");
kTreeColAtom = NS_NewAtom("treecol");
@ -304,7 +304,7 @@ RDFTreeBuilderImpl::~RDFTreeBuilderImpl(void)
if (gRefCnt == 0) {
NS_RELEASE(kPropertyAtom);
NS_RELEASE(kTreeAtom);
NS_RELEASE(kTreeBodyAtom);
NS_RELEASE(kTreeRowAtom);
NS_RELEASE(kTreeCellAtom);
NS_RELEASE(kTreeChildrenAtom);
NS_RELEASE(kTreeColAtom);
@ -666,12 +666,12 @@ RDFTreeBuilderImpl::Notify(nsITimer *timer)
}
}
#endif
nsIContent *treeBody;
if (NS_SUCCEEDED(rv = nsRDFContentUtils::FindChildByTag(mRoot, kNameSpaceID_XUL, kTreeBodyAtom, &treeBody)) &&
nsIContent *treeChildren;
if (NS_SUCCEEDED(rv = nsRDFContentUtils::FindChildByTag(mRoot, kNameSpaceID_XUL, kTreeChildrenAtom, &treeChildren)) &&
(rv != NS_RDF_NO_VALUE))
{
UpdateContainer(treeBody);
NS_RELEASE(treeBody);
UpdateContainer(treeChildren);
NS_RELEASE(treeChildren);
}
}
mTimer->Cancel();
@ -775,9 +775,8 @@ RDFTreeBuilderImpl::OnAppendChild(nsIDOMNode* aParent, nsIDOMNode* aNewChild)
// Now see if there's anything we can do about it.
if ((parentNameSpaceID == kNameSpaceID_XUL) &&
((parentNameAtom.get() == kTreeChildrenAtom) ||
(parentNameAtom.get() == kTreeBodyAtom))) {
// The parent is a xul:treechildren or xul:treebody...
(parentNameAtom.get() == kTreeChildrenAtom)) {
// The parent is a xul:treechildren
if ((childNameSpaceID == kNameSpaceID_XUL) &&
(childNameAtom.get() == kTreeItemAtom)) {
@ -932,9 +931,8 @@ RDFTreeBuilderImpl::OnRemoveChild(nsIDOMNode* aParent, nsIDOMNode* aOldChild)
// Now see if there's anything we can do about it.
if ((parentNameSpaceID == kNameSpaceID_XUL) &&
((parentNameAtom.get() == kTreeChildrenAtom) ||
(parentNameAtom.get() == kTreeBodyAtom))) {
// The parent is a xul:treechildren or xul:treebody...
(parentNameAtom.get() == kTreeChildrenAtom)) {
// The parent is a xul:treechildren
if ((childNameSpaceID == kNameSpaceID_XUL) &&
(childNameAtom.get() == kTreeItemAtom)) {
@ -1057,6 +1055,7 @@ RDFTreeBuilderImpl::AddWidgetItem(nsIContent* aElement,
// ...
// <xul:treechildren>
// <xul:treeitem id="value" rdf:property="property">
// <xul:treerow>
// <xul:treecell>
// <!-- value not specified until SetWidgetAttribute() -->
// </xul:treecell>
@ -1064,6 +1063,7 @@ RDFTreeBuilderImpl::AddWidgetItem(nsIContent* aElement,
// <xul:treecell>
// <!-- value not specified until SetWidgetAttribute() -->
// </xul:treecell>
// </xul:treerow>
//
// ...
//
@ -1284,9 +1284,9 @@ RDFTreeBuilderImpl::RemoveWidgetItem(nsIContent* aElement,
return NS_ERROR_UNEXPECTED;
aElement->GetTag(*getter_AddRefs(tag));
NS_ASSERTION((kTreeBodyAtom == tag.get()) || (kTreeChildrenAtom == tag.get()),
NS_ASSERTION((kTreeChildrenAtom == tag.get()),
"not a xul:treebody or xul:treechildren");
if ((kTreeBodyAtom != tag.get()) && (kTreeChildrenAtom != tag.get()))
if (kTreeChildrenAtom != tag.get())
return NS_ERROR_UNEXPECTED;
}
@ -1468,7 +1468,7 @@ RDFTreeBuilderImpl::FindTextElement(nsIContent* aElement,
}
nsresult
RDFTreeBuilderImpl::EnsureCell(nsIContent* aTreeItemElement,
RDFTreeBuilderImpl::EnsureCell(nsIContent* aTreeRowElement,
PRInt32 aIndex,
nsIContent** aCellElement)
{
@ -1488,15 +1488,15 @@ RDFTreeBuilderImpl::EnsureCell(nsIContent* aTreeItemElement,
// Iterate through the children of the <xul:treeitem>, counting
// <xul:treecell> tags until we get to the aIndex-th one.
PRInt32 count;
if (NS_FAILED(rv = aTreeItemElement->ChildCount(count))) {
NS_ERROR("unable to get xul:treeitem's child count");
if (NS_FAILED(rv = aTreeRowElement->ChildCount(count))) {
NS_ERROR("unable to get xul:treerow's child count");
return rv;
}
for (PRInt32 i = 0; i < count; ++i) {
nsCOMPtr<nsIContent> kid;
if (NS_FAILED(rv = aTreeItemElement->ChildAt(i, *getter_AddRefs(kid)))) {
NS_ERROR("unable to retrieve xul:treeitem's child");
if (NS_FAILED(rv = aTreeRowElement->ChildAt(i, *getter_AddRefs(kid)))) {
NS_ERROR("unable to retrieve xul:treerow's child");
return rv;
}
@ -1542,8 +1542,8 @@ RDFTreeBuilderImpl::EnsureCell(nsIContent* aTreeItemElement,
return rv;
}
if (NS_FAILED(rv = aTreeItemElement->AppendChildTo(cellElement, PR_FALSE))) {
NS_ERROR("unable to append xul:treecell to treeitem");
if (NS_FAILED(rv = aTreeRowElement->AppendChildTo(cellElement, PR_FALSE))) {
NS_ERROR("unable to append xul:treecell to treerow");
return rv;
}
}
@ -1557,14 +1557,25 @@ nsresult
RDFTreeBuilderImpl::CreateTreeItemCells(nsIContent* aTreeItemElement)
{
// <xul:treeitem>
// <xul:treerow>
// <xul:treecell RDF:ID="property">value</xul:treecell>
// ...
// </xul:treerow>
// </xul:treeitem>
nsresult rv;
// XXX at this point, we should probably ensure that aElement is
// actually a <xul:treeitem>...
nsCOMPtr<nsIContent> treeRowElement;
rv = NS_NewRDFElement(kNameSpaceID_XUL,
kTreeRowAtom,
getter_AddRefs(treeRowElement));
if (NS_FAILED(rv)) {
NS_ERROR("Unable to create a tree row.");
return rv;
}
aTreeItemElement->AppendChildTo(treeRowElement, PR_FALSE);
// Get the treeitem's resource so that we can generate cell
// values. We could QI for the nsIRDFResource here, but doing this
// via the nsIContent interface allows us to support generic nodes
@ -1612,7 +1623,7 @@ RDFTreeBuilderImpl::CreateTreeItemCells(nsIContent* aTreeItemElement)
// tree cell that lives beneath _this_ tree item for its
// value.
nsCOMPtr<nsIContent> cellElement;
if (NS_FAILED(rv = EnsureCell(aTreeItemElement, cellIndex, getter_AddRefs(cellElement)))) {
if (NS_FAILED(rv = EnsureCell(treeRowElement, cellIndex, getter_AddRefs(cellElement)))) {
NS_ERROR("unable to find/create cell element");
return rv;
}

Просмотреть файл

@ -1652,12 +1652,8 @@ RDFElementImpl::AppendChildTo(nsIContent* aKid, PRBool aNotify)
PRUint32 cnt;
nsresult rv = mChildren->Count(&cnt);
if (NS_FAILED(rv)) return rv;
#if 0
// XXX Can't do this because of the tree frame trickery, I think.
mDocument->ContentAppended(NS_STATIC_CAST(nsIStyledContent*, this), cnt - 1);
#else
mDocument->ContentInserted(NS_STATIC_CAST(nsIStyledContent*, this), aKid, cnt - 1);
#endif
}
}
return NS_OK;

Просмотреть файл

@ -2006,7 +2006,9 @@ RDFGenericBuilderImpl::EnsureElementHasGenericChild(nsIContent* parent,
if (NS_FAILED(rv = NS_NewRDFElement(nameSpaceID, tag, getter_AddRefs(element))))
return rv;
if (NS_FAILED(rv = parent->AppendChildTo(element, PR_FALSE)))
if (NS_FAILED(rv = parent->AppendChildTo(element, PR_TRUE)))
// XXX Note that the notification ensures we won't batch insertions! This could be bad! - Dave
return rv;
*result = element;
@ -2015,47 +2017,6 @@ RDFGenericBuilderImpl::EnsureElementHasGenericChild(nsIContent* parent,
return NS_OK;
}
nsresult
RDFGenericBuilderImpl::FindWidgetRootElement(nsIContent* aElement,
nsIContent** aWidgetElement)
{
nsresult rv;
nsCOMPtr<nsIAtom> rootAtom;
if (NS_FAILED(rv = GetRootWidgetAtom(getter_AddRefs(rootAtom)))) {
return rv;
}
// walk up the tree until you find rootAtom
nsCOMPtr<nsIContent> element(do_QueryInterface(aElement));
while (element) {
PRInt32 nameSpaceID;
if (NS_FAILED(rv = element->GetNameSpaceID(nameSpaceID)))
return rv; // XXX fatal
if (nameSpaceID == kNameSpaceID_XUL) {
nsCOMPtr<nsIAtom> tag;
if (NS_FAILED(rv = element->GetTag(*getter_AddRefs(tag))))
return rv;
if (tag == rootAtom) {
*aWidgetElement = element;
NS_ADDREF(*aWidgetElement);
return NS_OK;
}
}
// up to the parent...
nsCOMPtr<nsIContent> parent;
element->GetParent(*getter_AddRefs(parent));
element = parent;
}
//NS_ERROR("must not've started from within the XUL widget");
return NS_ERROR_FAILURE;
}
PRBool
RDFGenericBuilderImpl::IsItemOrFolder(nsIContent* aElement)
@ -2322,9 +2283,17 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement)
return rv;
}
// The insertion root is _always_ open.
if (tag == insertionAtom)
return PR_TRUE;
if (tag == insertionAtom) {
// Hack for the tree widget
nsCOMPtr<nsIContent> parent;
aElement->GetParent(*getter_AddRefs(parent));
nsCOMPtr<nsIAtom> parentTag;
parent->GetTag(*getter_AddRefs(parentTag));
nsString tagName;
parentTag->ToString(tagName);
if (tagName == "tree")
return PR_TRUE;
}
// If it's not a widget folder item, then it's not open.
if (tag != folderAtom)
@ -2341,6 +2310,7 @@ RDFGenericBuilderImpl::IsOpen(nsIContent* aElement)
return PR_TRUE;
}
return PR_FALSE;
}

Просмотреть файл

@ -4,10 +4,10 @@
*/
treeitem[type="http://www.mozilla.org/RDF#TinderboxFlash"] > treecell > titledbutton {
treeitem[type="http://www.mozilla.org/RDF#TinderboxFlash"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/flames.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#MsgNewMessages"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#MsgNewMessages"] > treerow > treecell > titledbutton {
list-style-image: url("chrome://messenger/skin/folderHasMail.gif");
}

Просмотреть файл

@ -1,4 +1,5 @@
<?xml version="1.0"?> <!-- -*- Mode: SGML -->
<?xml version="1.0"?> <!-- -*- Mode: SGML -*- -->
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/rdf/flash.css" type="text/css"?>
@ -19,9 +20,30 @@
<tree id="tree"
flex="100%"
datasources="rdf:bookmarks"
onclick="OpenURL(event.target.parentNode);">
onclick="OpenURL(event.target.parentNode.parentNode);">
<!-- XXX Write a template rule for this -->
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#source" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#description" align="right"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#timestamp" align="right"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol rdf:resource="http://home.netscape.com/NC-rdf#source" />
<treecol rdf:resource="http://home.netscape.com/NC-rdf#description" />
@ -29,13 +51,13 @@
<!-- XXX We probably won't have a treehead in the end, but we'll put it here for now... -->
<treehead>
<treeitem>
<treerow>
<treecell>&tree.header.source.label;</treecell>
<treecell>&tree.header.description.label;</treecell>
<treecell>&tree.header.time.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody id="NC:FlashRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" />
<treechildren id="NC:FlashRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" />
</tree>
</window>

Просмотреть файл

@ -1,123 +1,129 @@
window {
display: block;
background-color: white;
/* -*- Mode: C; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
}
/*
iframe {
Style rules specific to the Sidebar.
*/
iframe
{
height: 125px;
border: 0px;
}
tree {
display: table;
background-color: #FFFFFF;
border: none;
border-spacing: 0px;
width: 100%;
}
treeitem {
display: table-row;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecol {
display: table-column;
width: 200px;
}
treecell {
display: table-cell;
treecell
{
font-family: Verdana, Sans-Serif;
font-size: 8pt;
white-space: nowrap;
}
treeitem[selected] {
background-color: #000080;
color: white;
treecell[sortActive="true"][sortDirection="ascending"]
{
background-color: green;
}
treecell[sortActive="true"][sortDirection="ascending"] {
background-color: green;
}
treecell[sortActive="true"][sortDirection="descending"] {
treecell[sortActive="true"][sortDirection="descending"]
{
background-color: red;
}
}
treecol[sortActive="true"] {
treecol[sortActive="true"]
{
background-color: lightgreen;
}
treehead treeitem treecell {
treehead > treerow > treecell
{
background-color: #c0c0c0;
border: outset 1px;
border-color: white #707070 #707070 white;
vertical-align: middle;
}
treeitem[container="true"][open="true"][loading="true"] > treecell > titledbutton {
treeitem[container="true"][open="true"][loading="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/loading.gif") ! important ;
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/article.gif");
}
treeitem[container="true"][open="true"] > treecell > titledbutton {
treeitem[container="true"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[container="true"] > treecell > titledbutton {
treeitem[container="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-closed.gif");
}
treeitem > treecell > titledbutton {
treeitem > treerow > treecell > titledbutton
{
border: none;
font: inherit;
list-style-image: url("resource:/res/rdf/document.gif");
}
/*
* Sidebar and Panel title buttons
*/
box#sidebox {
box#sidebox
{
width: 100%;
height: 100%;
display:block;
}
box.sidebartitle {
box.sidebartitle
{
background-color: #505888;
font: 10pt sans-serif;
}
box.panelbar {
box.panelbar
{
background-color: #006870;
font: 10pt sans-serif;
}
div.sidebartitlelabel {
div.sidebartitlelabel
{
color: white;
padding: 5px;
}
titledbutton[class~=paneltitle] {
titledbutton[class~=paneltitle]
{
color: white;
}

Просмотреть файл

@ -18,10 +18,11 @@
-->
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/bookmarks.css" type="text/css"?>
<xul:window
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
@ -30,51 +31,53 @@
<tree id="bookmarksTree"
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
ondblclick="return OpenURL(event,event.target.parentNode);">
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
<!-- Commented out until new tree content model and template builder can play nice -->
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treebody" subcontainment="treechildren">
rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL"
align="right" style="list-style-image: none;" />
</treecell>
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL"
align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
<treehead>
<treeitem>
<treerow>
<treecell onclick="return doSort('NameColumn');">
<observes element="NameColumn" attribute="sortActive"/>
<observes element="NameColumn" attribute="sortDirection"/>
Name</treecell>
<observes element="NameColumn" attribute="sortActive"/>
<observes element="NameColumn" attribute="sortDirection"/>
Name</treecell>
<treecell onclick="return doSort('URLColumn');">
<observes element="URLColumn" attribute="sortActive"/>
<observes element="URLColumn" attribute="sortDirection"/>
URL</treecell>
</treeitem>
<observes element="URLColumn" attribute="sortActive"/>
<observes element="URLColumn" attribute="sortDirection"/>
URL</treecell>
</treerow>
</treehead>
<treebody id="NC:BookmarksRoot">
</treebody>
<treechildren id="NC:BookmarksRoot" />
</tree>
</xul:window>
</window>

Просмотреть файл

@ -1,126 +1,90 @@
window {
display: block;
background-color: #FFFFFF;
}
/* -*- Mode: C; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
menubar {
display: none;
}
/*
tree {
display: table;
background-color: #FFFFFF;
border: none;
border-spacing: 0px;
width: 100%;
}
Style rules specific to the bookmarks panel & pane.
treecol {
display: table-column;
width: 200px;
}
*/
treeitem {
display: table-row;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
font-family: Verdana, Sans-Serif;
font-size: 8pt;
}
treecell[selectedcell] {
background-color: yellow;
}
treecell[sortActive="true"][sortDirection="ascending"] {
background-color: green;
}
treecell[sortActive="true"][sortDirection="descending"] {
background-color: red;
}
treecol[sortActive="true"] {
background-color: lightgreen;
}
treehead treeitem treecell {
background-color: #c0c0c0;
border: outset 1px;
border-color: white #707070 #707070 white;
padding-left: 4px;
}
treecell[selectedcell] {
background-color: yellow;
}
treeitem[container="true"][open="true"][loading="true"] > treecell > titledbutton {
treeitem[container="true"][open="true"][loading="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/loading.gif") ! important ;
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/personal-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/personal-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#BookmarkSeparator"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#BookmarkSeparator"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-item.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#IEFavorite"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#IEFavorite"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/IEFavorite.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-item.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/article.gif");
}
treeitem[container="true"][open="true"] > treecell > titledbutton {
treeitem[container="true"][open="true"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[container="true"] > treecell > titledbutton {
treeitem[container="true"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/folder-closed.gif");
}
treeitem > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/document.gif");
}
titledbutton#bookmarks {
list-style-image:url("resource:/res/samples/bookmark-item.gif");
list-style-image:url("resource:/res/samples/bookmark-item.gif");
}

Просмотреть файл

@ -1,4 +1,24 @@
<?xml version="1.0"?>
<?xml version="1.0"?> <!-- -*- Mode: SGML -*- -->
<!--
The contents of this file are subject to the Netscape Public License
Version 1.0 (the "NPL"); you may not use this file except in
compliance with the NPL. You may obtain a copy of the NPL at
http://www.mozilla.org/NPL/
Software distributed under the NPL is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
for the specific language governing rights and limitations under the
NPL.
The Initial Developer of this code under the NPL is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998 Netscape Communications Corporation. All Rights
Reserved.
-->
<?xml-stylesheet href="xul.css" type="text/css"?>
<?xml-stylesheet href="history.css" type="text/css"?>
<!DOCTYPE window
@ -129,38 +149,51 @@ function doSort(sortColName)
</menu>
</menubar>
<tree rdf:datasources="rdf:history" ondblclick="return OpenURL(event,event.target.parentNode);">
<tree rdf:datasources="rdf:history"
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treeitem>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
<treecell></treecell>
<treecell></treecell>
</treerow>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right" style="list-style-image: none;" />
</treecell>
</treeitem>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
<treecol id="ShortcutURLColumn" rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL"/>
<treehead>
<treeitem>
<treerow>
<treecell onclick="return doSort('NameColumn');">
<xul:observes element="NameColumn" attribute="sortActive"/>
<xul:observes element="NameColumn" attribute="sortDirection"/>
@ -173,26 +206,26 @@ function doSort(sortColName)
<xul:observes element="ShortcutURLColumn" attribute="sortActive"/>
<xul:observes element="ShortcutURLColumn" attribute="sortDirection"/>
Shortcut URL</treecell>
</treeitem>
</treerow>
</treehead>
<treebody>
<treeitem id="NC:HistoryBySite" open="true">
<treecell>&historyBySite.label;</treecell>
<treecell></treecell>
<treecell></treecell>
<treecell></treecell>
<treechildren>
<treeitem ref="NC:HistoryBySite" open="true">
<treerow>
<treecell>&historyBySite.label;</treecell>
<treecell></treecell>
<treecell></treecell>
</treerow>
</treeitem>
<treeitem id="NC:HistoryByDate" open="true">
<treecell>&historyByDate.label;</treecell>
<treecell></treecell>
<treecell></treecell>
<treecell></treecell>
<treeitem ref="NC:HistoryByDate" open="true">
<treerow>
<treecell>&historyByDate.label;</treecell>
<treecell></treecell>
<treecell></treecell>
</treerow>
</treeitem>
</treebody>
</treechildren>
</tree>
</window>

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://pref/skin/preftree.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
<!DOCTYPE window
[
@ -31,9 +31,10 @@
<!ENTITY smart.label "Smart Update">
]>
<xul:window xmlns:html="http://www.w3.org/TR/REC-html40"
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload = "ChangePanelURL(pref-appearance.xul);">
onload="ChangePanelURL(pref-appearance.xul);"
style="overflow: visible;">
<html:script>
@ -70,125 +71,173 @@
<tree onclick="return ClickChangePanel(event.target);">
<treebody>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-appearance.xul"><treeindentation/>&appear.label;</treecell>
<treechildren>
<treerow>
<treecell name="chrome://pref/content/pref-appearance.xul"><treeindentation/>&appear.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-fonts.xul"><treeindentation/>&fonts.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-colors.xul"><treeindentation/>&colors.label;</treecell>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-fonts.xul"><treeindentation/>&fonts.label;</treecell>
</treerow>
</treeitem>
<treecell name="chrome://pref/content/pref-navigator.xul"><treeindentation/>&navigator.label;</treecell>
<treechildren>
<treeitem>
<treecell><treeindentation/>&languages.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-applications.xul"><treeindentation/>&applications.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-smart_browsing.xul"><treeindentation/>&smartBrowse.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-colors.xul"><treeindentation/>&colors.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-navigator.xul"><treeindentation/>&navigator.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell><treeindentation/>&languages.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-applications.xul"><treeindentation/>&applications.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-smart_browsing.xul"><treeindentation/>&smartBrowse.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-mailnews.html"><treeindentation/>&mail.label;</treecell>
<treechildren>
<treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-mailnews.html"><treeindentation/>&mail.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://messenger/content/pref-identity.html"><treeindentation/>&identity.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-identity.html"><treeindentation/>&identity.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-mailservers.html"><treeindentation/>&mailServer.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-mailservers.html"><treeindentation/>&mailServer.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-newsservers.html"><treeindentation/>&newsServer.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-newsservers.html"><treeindentation/>&newsServer.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://addressbook/content/pref-addressing.html"><treeindentation/>&address.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://addressbook/content/pref-addressing.html"><treeindentation/>&address.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messengercompose/content/pref-messages.html"><treeindentation/>&mess.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messengercompose/content/pref-messages.html"><treeindentation/>&mess.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-winsetting.html"><treeindentation/>&windowSet.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-winsetting.html"><treeindentation/>&windowSet.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messengercompose/content/pref-copiesfolders.html"><treeindentation/>&copyFolder.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messengercompose/content/pref-copiesfolders.html"><treeindentation/>&copyFolder.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messengercompose/content/pref-formatting.html"><treeindentation/>&format.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messengercompose/content/pref-formatting.html"><treeindentation/>&format.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-receipts.html"><treeindentation/>&return.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-receipts.html"><treeindentation/>&return.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-diskspace.html"><treeindentation/>&disk.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-diskspace.html"><treeindentation/>&disk.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-composer.xul"><treeindentation/>&compose.label;</treecell>
</treerow>
<treechildren>
<treerow>
<treeitem>
<treecell name="chrome://pref/content/pref-publish.xul"><treeindentation/>&publish.label;</treecell>
</treeitem>
</treerow>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-composer.xul"><treeindentation/>&compose.label;</treecell>
<treechildren>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-offline.xul"><treeindentation/>&offline.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-publish.xul"><treeindentation/>&publish.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-download.xul"><treeindentation/>&down.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-offline.xul"><treeindentation/>&offline.label;</treecell>
<treechildren>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-advanced.xul"><treeindentation/>&advance.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-download.xul"><treeindentation/>&down.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-cache.xul"><treeindentation/>&cache.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-proxies.xul"><treeindentation/>&proxies.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-smartupdate.html"><treeindentation/>&smart.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-advanced.xul"><treeindentation/>&advance.label;</treecell>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-cache.xul"><treeindentation/>&cache.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-proxies.xul"><treeindentation/>&proxies.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-smartupdate.html"><treeindentation/>&smart.label;</treecell>
</treeitem>
</treechildren>
</treeitem>
</treebody>
</treechildren>
</tree>
</xul:window>
</window>

Просмотреть файл

@ -18,8 +18,9 @@
-->
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
<?xml-stylesheet href="related-panel.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/related-panel.css" type="text/css"?>
<!DOCTYPE window
[
@ -43,49 +44,63 @@
<tree id="Tree"
flex="100%"
datasources="rdf:null"
ondblclick="return OnDblClick(event.target.parentNode);">
ondblclick="return OnDblClick(event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treebody" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren"
subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name" />
<treecol rdf:resource="http://home.netscape.com/NC-rdf#URL" />
<treehead>
<treeitem>
<treerow>
<treecell>&tree.header.name.label;</treecell>
<treecell>&tree.header.url.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody>
<treechildren>
<treeitem id="NC:RelatedLinks">
<treecell><treeindentation/><titledbutton />Related Links</treecell>
<treecell></treecell>
<treerow>
<treecell><treeindentation/><titledbutton />Related Links</treecell>
<treecell></treecell>
</treerow>
</treeitem>
<treeitem id="NC:SiteMapRoot">
<treecell><treeindentation/><titledbutton />Site Map</treecell>
<treecell></treecell>
<treerow>
<treecell><treeindentation/><titledbutton />Site Map</treecell>
<treecell></treecell>
</treerow>
</treeitem>
</treebody>
</treechildren>
</tree>
</window>
</window>

Просмотреть файл

@ -239,7 +239,7 @@
<!-- Statusbar -->
<!ENTITY notifCom.label "[Notification Component]">
<!ENTITY statusText.label "Document: Done">
<!ENTITY buildId.label "Build ID: 1999060717">
<!ENTITY buildId.label "Build ID: 1999062217">
<!ENTITY security-button.label "Secure Conn">
<!-- taskbar -->

Просмотреть файл

@ -559,22 +559,26 @@ tree {
}
treeitem {
display: table-row;
color: black;
display: table-row-group;
font: inherit;
}
treerow {
display: table-row;
font: inherit;
}
treehead {
display: table-header-group;
font: inherit;
}
treebody {
treechildren {
display: table-row-group;
font: inherit;
}
treeitem[selected="true"] {
treerow[selectedrow="true"] {
color: white;
background-color: #666699;
font: inherit;
@ -586,22 +590,25 @@ treecell {
font: inherit;
}
treehead treeitem treecell {
treehead treerow treecell {
font-size: 10pt;
background-color: #a0a0a0;
border: 1px white transparent;
color: black;
}
treeitem > treechildren {
visibility: collapse;
}
treeitem[open="true"] > treechildren {
visibility: visible;
}
treecol {
display: table-column;
}
/* tabs related stuff */
tab {

Просмотреть файл

@ -9,5 +9,6 @@ bookmarks.html
bookmarks.js
bookmarks.xul
iefavorite.gif
manage-bookmarks.css
personal-folder-closed.gif
personal-folder-open.gif

Просмотреть файл

@ -36,6 +36,7 @@ FILES = \
bookmarks.js \
bookmarks.xul \
iefavorite.gif \
manage-bookmarks.css \
personal-folder-closed.gif \
personal-folder-open.gif \
$(NULL)

Просмотреть файл

@ -18,10 +18,11 @@
-->
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/bookmarks.css" type="text/css"?>
<xul:window
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
@ -30,51 +31,53 @@
<tree id="bookmarksTree"
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
ondblclick="return OpenURL(event,event.target.parentNode);">
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
<!-- Commented out until new tree content model and template builder can play nice -->
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treebody" subcontainment="treechildren">
rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL"
align="right" style="list-style-image: none;" />
</treecell>
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL"
align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
<treehead>
<treeitem>
<treerow>
<treecell onclick="return doSort('NameColumn');">
<observes element="NameColumn" attribute="sortActive"/>
<observes element="NameColumn" attribute="sortDirection"/>
Name</treecell>
<observes element="NameColumn" attribute="sortActive"/>
<observes element="NameColumn" attribute="sortDirection"/>
Name</treecell>
<treecell onclick="return doSort('URLColumn');">
<observes element="URLColumn" attribute="sortActive"/>
<observes element="URLColumn" attribute="sortDirection"/>
URL</treecell>
</treeitem>
<observes element="URLColumn" attribute="sortActive"/>
<observes element="URLColumn" attribute="sortDirection"/>
URL</treecell>
</treerow>
</treehead>
<treebody id="NC:BookmarksRoot">
</treebody>
<treechildren id="NC:BookmarksRoot" />
</tree>
</xul:window>
</window>

Просмотреть файл

@ -1,126 +1,90 @@
window {
display: block;
background-color: #FFFFFF;
}
/* -*- Mode: C; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
menubar {
display: none;
}
/*
tree {
display: table;
background-color: #FFFFFF;
border: none;
border-spacing: 0px;
width: 100%;
}
Style rules specific to the bookmarks panel & pane.
treecol {
display: table-column;
width: 200px;
}
*/
treeitem {
display: table-row;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
font-family: Verdana, Sans-Serif;
font-size: 8pt;
}
treecell[selectedcell] {
background-color: yellow;
}
treecell[sortActive="true"][sortDirection="ascending"] {
background-color: green;
}
treecell[sortActive="true"][sortDirection="descending"] {
background-color: red;
}
treecol[sortActive="true"] {
background-color: lightgreen;
}
treehead treeitem treecell {
background-color: #c0c0c0;
border: outset 1px;
border-color: white #707070 #707070 white;
padding-left: 4px;
}
treecell[selectedcell] {
background-color: yellow;
}
treeitem[container="true"][open="true"][loading="true"] > treecell > titledbutton {
treeitem[container="true"][open="true"][loading="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/loading.gif") ! important ;
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/personal-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/personal-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#BookmarkSeparator"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#BookmarkSeparator"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-item.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#IEFavorite"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#IEFavorite"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/IEFavorite.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/samples/bookmark-item.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#FileSystemObject"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/article.gif");
}
treeitem[container="true"][open="true"] > treecell > titledbutton {
treeitem[container="true"][open="true"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/folder-open.gif");
}
treeitem[container="true"] > treecell > titledbutton {
treeitem[container="true"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/folder-closed.gif");
}
treeitem > treecell > titledbutton {
list-style-image: url("resource:/res/rdf/document.gif");
}
titledbutton#bookmarks {
list-style-image:url("resource:/res/samples/bookmark-item.gif");
list-style-image:url("resource:/res/samples/bookmark-item.gif");
}

Просмотреть файл

@ -18,6 +18,8 @@
-->
<?xml-stylesheet href="xul.css" type="text/css"?>
<?xml-stylesheet href="manage-bookmarks.css" type="text/css"?>
<?xml-stylesheet href="bookmarks.css" type="text/css"?>
<!DOCTYPE window
@ -82,39 +84,44 @@
<tree id="bookmarksTree"
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
ondblclick="return OpenURL(event,event.target.parentNode);"
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);"
flex="100%">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right" style="list-style-image: none;" />
</treecell>
</treeitem>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
<treecol id="ShortcutURLColumn" rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL"/>
<treehead>
<treeitem>
<treerow>
<treecell onclick="return doSort('NameColumn');">
<xul:observes element="NameColumn" attribute="sortActive"/>
<xul:observes element="NameColumn" attribute="sortDirection"/>
@ -127,10 +134,10 @@
<xul:observes element="ShortcutURLColumn" attribute="sortActive"/>
<xul:observes element="ShortcutURLColumn" attribute="sortDirection"/>
&tree.header.shortcut.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody id="NC:BookmarksRoot" />
<treechildren id="NC:BookmarksRoot" />
</tree>
</xul:window>

Просмотреть файл

@ -29,6 +29,7 @@ FILES=\
bookmarks.js \
bookmarks.xul \
iefavorite.gif \
manage-bookmarks.css \
personal-folder-closed.gif \
personal-folder-open.gif \
$(NULL)

Просмотреть файл

@ -0,0 +1,30 @@
/* -*- Mode: C; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
Style rules specific to the 'manage bookmarks' window.
*/
treeitem > treerow > treecell > titledbutton
{
border: none;
font: inherit;
list-style-image: url("resource:/res/rdf/document.gif");
}

Просмотреть файл

@ -1,87 +1,48 @@
window {
display: block;
}
/* -*- Mode: C; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
menubar {
display: none;
}
/*
tree {
display: table;
table-layout: fixed;
background-color: #FFFFFF;
border: none;
border-spacing: 0px;
// border-collapse: collapse;
// width: 100%;
}
Style rules specific to the 'Manage History' panel.
treecol {
display: table-column;
width: 200px;
}
*/
treeitem {
display: table-row;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treecell {
display: table-cell;
font-family: Verdana, Sans-Serif;
font-size: 8pt;
}
treecell[selectedcell] {
background-color: yellow;
}
treecell[sortActive="true"][sortDirection="ascending"] {
background-color: green;
}
treecell[sortActive="true"][sortDirection="descending"] {
background-color: red;
}
treecol[sortActive="true"] {
background-color: lightgreen;
}
treehead treeitem treecell {
background-color: #c0c0c0;
border: outset 1px;
border-color: white #707070 #707070 white;
padding-left: 4px;
}
treecell[selectedcell] {
background-color: yellow;
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/bookmark-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/bookmark-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/personal-folder-closed.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/personal-folder-open.gif");
}
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treecell > titledbutton {
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treerow > treecell > titledbutton
{
list-style-image: url("resource:/res/rdf/bookmark-item.gif");
}

Просмотреть файл

@ -1,4 +1,24 @@
<?xml version="1.0"?>
<?xml version="1.0"?> <!-- -*- Mode: SGML -*- -->
<!--
The contents of this file are subject to the Netscape Public License
Version 1.0 (the "NPL"); you may not use this file except in
compliance with the NPL. You may obtain a copy of the NPL at
http://www.mozilla.org/NPL/
Software distributed under the NPL is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
for the specific language governing rights and limitations under the
NPL.
The Initial Developer of this code under the NPL is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998 Netscape Communications Corporation. All Rights
Reserved.
-->
<?xml-stylesheet href="xul.css" type="text/css"?>
<?xml-stylesheet href="history.css" type="text/css"?>
<!DOCTYPE window
@ -129,38 +149,51 @@ function doSort(sortColName)
</menu>
</menubar>
<tree rdf:datasources="rdf:history" ondblclick="return OpenURL(event,event.target.parentNode);">
<tree rdf:datasources="rdf:history"
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treeitem>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
<treecell></treecell>
<treecell></treecell>
</treerow>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right" style="list-style-image: none;" />
</treecell>
</treeitem>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
<treecol id="ShortcutURLColumn" rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL"/>
<treehead>
<treeitem>
<treerow>
<treecell onclick="return doSort('NameColumn');">
<xul:observes element="NameColumn" attribute="sortActive"/>
<xul:observes element="NameColumn" attribute="sortDirection"/>
@ -173,26 +206,26 @@ function doSort(sortColName)
<xul:observes element="ShortcutURLColumn" attribute="sortActive"/>
<xul:observes element="ShortcutURLColumn" attribute="sortDirection"/>
Shortcut URL</treecell>
</treeitem>
</treerow>
</treehead>
<treebody>
<treeitem id="NC:HistoryBySite" open="true">
<treecell>&historyBySite.label;</treecell>
<treecell></treecell>
<treecell></treecell>
<treecell></treecell>
<treechildren>
<treeitem ref="NC:HistoryBySite" open="true">
<treerow>
<treecell>&historyBySite.label;</treecell>
<treecell></treecell>
<treecell></treecell>
</treerow>
</treeitem>
<treeitem id="NC:HistoryByDate" open="true">
<treecell>&historyByDate.label;</treecell>
<treecell></treecell>
<treecell></treecell>
<treecell></treecell>
<treeitem ref="NC:HistoryByDate" open="true">
<treerow>
<treecell>&historyByDate.label;</treecell>
<treecell></treecell>
<treecell></treecell>
</treerow>
</treeitem>
</treebody>
</treechildren>
</tree>
</window>

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://pref/skin/preftree.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
<!DOCTYPE window
[
@ -31,9 +31,10 @@
<!ENTITY smart.label "Smart Update">
]>
<xul:window xmlns:html="http://www.w3.org/TR/REC-html40"
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload = "ChangePanelURL(pref-appearance.xul);">
onload="ChangePanelURL(pref-appearance.xul);"
style="overflow: visible;">
<html:script>
@ -70,125 +71,173 @@
<tree onclick="return ClickChangePanel(event.target);">
<treebody>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-appearance.xul"><treeindentation/>&appear.label;</treecell>
<treechildren>
<treerow>
<treecell name="chrome://pref/content/pref-appearance.xul"><treeindentation/>&appear.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-fonts.xul"><treeindentation/>&fonts.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-colors.xul"><treeindentation/>&colors.label;</treecell>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-fonts.xul"><treeindentation/>&fonts.label;</treecell>
</treerow>
</treeitem>
<treecell name="chrome://pref/content/pref-navigator.xul"><treeindentation/>&navigator.label;</treecell>
<treechildren>
<treeitem>
<treecell><treeindentation/>&languages.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-applications.xul"><treeindentation/>&applications.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-smart_browsing.xul"><treeindentation/>&smartBrowse.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-colors.xul"><treeindentation/>&colors.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-navigator.xul"><treeindentation/>&navigator.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell><treeindentation/>&languages.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-applications.xul"><treeindentation/>&applications.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-smart_browsing.xul"><treeindentation/>&smartBrowse.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-mailnews.html"><treeindentation/>&mail.label;</treecell>
<treechildren>
<treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-mailnews.html"><treeindentation/>&mail.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://messenger/content/pref-identity.html"><treeindentation/>&identity.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-identity.html"><treeindentation/>&identity.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-mailservers.html"><treeindentation/>&mailServer.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-mailservers.html"><treeindentation/>&mailServer.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-newsservers.html"><treeindentation/>&newsServer.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-newsservers.html"><treeindentation/>&newsServer.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://addressbook/content/pref-addressing.html"><treeindentation/>&address.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://addressbook/content/pref-addressing.html"><treeindentation/>&address.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messengercompose/content/pref-messages.html"><treeindentation/>&mess.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messengercompose/content/pref-messages.html"><treeindentation/>&mess.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-winsetting.html"><treeindentation/>&windowSet.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-winsetting.html"><treeindentation/>&windowSet.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messengercompose/content/pref-copiesfolders.html"><treeindentation/>&copyFolder.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messengercompose/content/pref-copiesfolders.html"><treeindentation/>&copyFolder.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messengercompose/content/pref-formatting.html"><treeindentation/>&format.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messengercompose/content/pref-formatting.html"><treeindentation/>&format.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-receipts.html"><treeindentation/>&return.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-receipts.html"><treeindentation/>&return.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treecell name="chrome://messenger/content/pref-diskspace.html"><treeindentation/>&disk.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://messenger/content/pref-diskspace.html"><treeindentation/>&disk.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-composer.xul"><treeindentation/>&compose.label;</treecell>
</treerow>
<treechildren>
<treerow>
<treeitem>
<treecell name="chrome://pref/content/pref-publish.xul"><treeindentation/>&publish.label;</treecell>
</treeitem>
</treerow>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-composer.xul"><treeindentation/>&compose.label;</treecell>
<treechildren>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-offline.xul"><treeindentation/>&offline.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-publish.xul"><treeindentation/>&publish.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-download.xul"><treeindentation/>&down.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-offline.xul"><treeindentation/>&offline.label;</treecell>
<treechildren>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-advanced.xul"><treeindentation/>&advance.label;</treecell>
</treerow>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-download.xul"><treeindentation/>&down.label;</treecell>
</treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-cache.xul"><treeindentation/>&cache.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-proxies.xul"><treeindentation/>&proxies.label;</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell name="chrome://pref/content/pref-smartupdate.html"><treeindentation/>&smart.label;</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-advanced.xul"><treeindentation/>&advance.label;</treecell>
<treechildren>
<treeitem>
<treecell name="chrome://pref/content/pref-cache.xul"><treeindentation/>&cache.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-proxies.xul"><treeindentation/>&proxies.label;</treecell>
</treeitem>
<treeitem>
<treecell name="chrome://pref/content/pref-smartupdate.html"><treeindentation/>&smart.label;</treecell>
</treeitem>
</treechildren>
</treeitem>
</treebody>
</treechildren>
</tree>
</xul:window>
</window>

Просмотреть файл

@ -1,65 +0,0 @@
window {
display: block;
width: 100%;
border: thin black solid bottom;
}
tree {
display: table;
background-color: white;
border: none;
border-spacing: 0px;
border-collapse: collapse;
width: 100%;
}
treeitem {
display: table-row;
visibility: visible;
}
treehead {
display: table-header-group;
}
treebody {
display: table-row-group;
}
treehead > treeitem {
visibility: visible;
}
treeitem[open] > treechildren > treeitem {
visibility: visible;
}
treebody > treeitem {
visibility: visible;
}
treecell {
display: table-cell;
color: black;
font-family: Arial;
font-size: 8pt;
}
treehead treeitem treecell {
background-color: white;
border: thin black solid;
color: black;
}
treeicon {
display: list-item;
list-style-image: url("http://rava/~hyatt/ClosedRead.gif");
list-style-position: inside;
}
treecell[selectedcell] {
background-color: yellow;
}

Просмотреть файл

@ -16,6 +16,12 @@
* Reserved.
*/
treeitem[id="NC:SiteMapRoot"] > treecell > titledbutton {
/*
Style rules specific to the related links panel
*/
treeitem[id="NC:SiteMapRoot"] > treerow > treecell > titledbutton {
list-style-image: url("resource:/res/samples/sitemap.gif");
};

Просмотреть файл

@ -18,8 +18,9 @@
-->
<?xml-stylesheet href="resource:/res/samples/xul.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
<?xml-stylesheet href="related-panel.css" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/related-panel.css" type="text/css"?>
<!DOCTYPE window
[
@ -43,49 +44,63 @@
<tree id="Tree"
flex="100%"
datasources="rdf:null"
ondblclick="return OnDblClick(event.target.parentNode);">
ondblclick="return OnDblClick(event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treebody" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren"
subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
</template>
<treecol rdf:resource="http://home.netscape.com/NC-rdf#Name" />
<treecol rdf:resource="http://home.netscape.com/NC-rdf#URL" />
<treehead>
<treeitem>
<treerow>
<treecell>&tree.header.name.label;</treecell>
<treecell>&tree.header.url.label;</treecell>
</treeitem>
</treerow>
</treehead>
<treebody>
<treechildren>
<treeitem id="NC:RelatedLinks">
<treecell><treeindentation/><titledbutton />Related Links</treecell>
<treecell></treecell>
<treerow>
<treecell><treeindentation/><titledbutton />Related Links</treecell>
<treecell></treecell>
</treerow>
</treeitem>
<treeitem id="NC:SiteMapRoot">
<treecell><treeindentation/><titledbutton />Site Map</treecell>
<treecell></treecell>
<treerow>
<treecell><treeindentation/><titledbutton />Site Map</treecell>
<treecell></treecell>
</treerow>
</treeitem>
</treebody>
</treechildren>
</tree>
</window>
</window>