Changing the GetAttribute and SetAttribute calls to properly use the namespace

of NONE (instead of XUL).
This commit is contained in:
hyatt%netscape.com 1999-03-02 02:04:45 +00:00
parent 29640df620
commit ae0fa30bb0
4 changed files with 27 additions and 24 deletions

View File

@ -29,6 +29,7 @@ static int STRIPE_WIDTH = 20; // pixels
static int ANIMATION_INCREMENT = 4; // pixels
static int ANIMATION_SPEED = 50; // miliseconds
#include "nsINameSpaceManager.h"
#include "nsProgressMeterFrame.h"
#include "nsIStyleContext.h"
#include "nsCSSRendering.h"
@ -210,7 +211,7 @@ nsProgressMeterFrame::Init(nsIPresContext& aPresContext,
// get the value
nsAutoString value;
if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::value, value)) &&
if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, value)) &&
(value.Length() > 0)) {
setProgress(value);
}
@ -218,12 +219,12 @@ nsProgressMeterFrame::Init(nsIPresContext& aPresContext,
// get the alignment
nsAutoString align;
mContent->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::align, align);
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, align);
setAlignment(align);
// get the mode
nsAutoString mode;
mContent->GetAttribute(nsXULAtoms::nameSpaceID, nsXULAtoms::mode, mode);
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::mode, mode);
setMode(mode);
@ -681,7 +682,7 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext,
nsAutoString newValue;
// get attribute and set it
aChild->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::value, newValue);
aChild->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, newValue);
setProgress(newValue);
// redraw

View File

@ -215,7 +215,7 @@ nsTitledButtonFrame::Init(nsIPresContext& aPresContext,
// get src
mHasImage = PR_FALSE;
nsAutoString src;
if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::src, src)) &&
if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::src, src)) &&
(src.Length() > 0)) {
mHasImage = PR_TRUE;
} else {
@ -252,12 +252,12 @@ nsTitledButtonFrame::Init(nsIPresContext& aPresContext,
// get the alignment
nsAutoString value;
mContent->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::value, value);
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, value);
setTitle(value);
// get the alignment
nsAutoString align;
mContent->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::align, align);
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, align);
setAlignment(align);
return rv;
@ -308,7 +308,7 @@ nsTitledButtonFrame::AttributeChanged(nsIPresContext* aPresContext,
mImageLoader.GetURLSpec(oldSRC);
nsAutoString newSRC;
aChild->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::src, newSRC);
aChild->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::src, newSRC);
if (newSRC.Equals("")) {
// if no src then get the list style image
@ -372,11 +372,11 @@ nsTitledButtonFrame::AttributeChanged(nsIPresContext* aPresContext,
}
} else if (nsHTMLAtoms::value == aAttribute) {
nsAutoString value;
aChild->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::value, value);
aChild->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, value);
setTitle(value);
} else if (nsHTMLAtoms::align == aAttribute) {
nsAutoString align;
aChild->GetAttribute(nsXULAtoms::nameSpaceID, nsHTMLAtoms::value, align);
aChild->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, align);
setAlignment(align);
}

View File

@ -33,6 +33,7 @@
#include "nsIPresContext.h"
#include "nsIWidget.h"
#include "nsXULAtoms.h"
#include "nsINameSpaceManager.h"
#if 0
//
@ -525,8 +526,8 @@ nsToolboxFrame :: CollapseToolbar ( TabInfo & inTab )
const nsCOMPtr<nsIAtom> kSelectedAtom ( dont_AddRef( NS_NewAtom("collapsed")) );
if ( inTab.mToolbar ) {
// inTab.mToolbar->SetAttribute ( nsXULAtoms::nameSpaceID, kSelectedAtom, "true", PR_TRUE );
inTab.mToolbar->SetAttribute ( nsnull, kSelectedAtom, "true", PR_TRUE );
// inTab.mToolbar->SetAttribute ( kNameSpaceID_None, kSelectedAtom, "true", PR_TRUE );
inTab.mToolbar->SetAttribute ( kNameSpaceID_None, kSelectedAtom, "true", PR_TRUE );
}
} // CollapseToolbar
@ -543,6 +544,6 @@ nsToolboxFrame :: ExpandToolbar ( TabInfo & inTab )
{
const nsCOMPtr<nsIAtom> kSelectedAtom ( dont_AddRef( NS_NewAtom("collapsed")) );
mContent->UnsetAttribute ( nsXULAtoms::nameSpaceID, kSelectedAtom, PR_TRUE );
mContent->UnsetAttribute ( kNameSpaceID_None, kSelectedAtom, PR_TRUE );
} // ExpandToolbar

View File

@ -30,6 +30,7 @@
#include "nsCSSRendering.h"
#include "nsXULAtoms.h"
#include "nsCOMPtr.h"
#include "nsINameSpaceManager.h"
static void ForceDrawFrame(nsIFrame * aFrame)
{
@ -234,19 +235,19 @@ nsTreeCellFrame::HandleDoubleClickEvent(nsIPresContext& aPresContext,
// Take the tree item content and toggle the value of its open attribute.
nsString attrValue;
nsCOMPtr<nsIAtom> kOpenAtom ( dont_AddRef(NS_NewAtom("open")) );
nsresult result = pTreeItemContent->GetAttribute(nsXULAtoms::nameSpaceID, kOpenAtom, attrValue);
nsresult result = pTreeItemContent->GetAttribute(kNameSpaceID_None, kOpenAtom, attrValue);
attrValue.ToLowerCase();
PRBool isExpanded = (result == NS_CONTENT_ATTR_NO_VALUE ||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue=="true"));
if (isExpanded)
{
// We're collapsing and need to remove frames from the flow.
pTreeItemContent->UnsetAttribute(nsXULAtoms::nameSpaceID, kOpenAtom, PR_TRUE);
pTreeItemContent->UnsetAttribute(kNameSpaceID_None, kOpenAtom, PR_TRUE);
}
else
{
// We're expanding and need to add frames to the flow.
pTreeItemContent->SetAttribute(nsXULAtoms::nameSpaceID, kOpenAtom, "true", PR_TRUE);
pTreeItemContent->SetAttribute(kNameSpaceID_None, kOpenAtom, "true", PR_TRUE);
}
}
return NS_OK;
@ -264,14 +265,14 @@ void nsTreeCellFrame::Select(nsIPresContext& aPresContext, PRBool isSelected, PR
if (isSelected)
{
// We're selecting the node.
mContent->SetAttribute(nsXULAtoms::nameSpaceID, kSelectedCellAtom, "true", notifyForReflow);
pParentContent->SetAttribute(nsXULAtoms::nameSpaceID, kSelectedAtom, "true", notifyForReflow);
mContent->SetAttribute(kNameSpaceID_None, kSelectedCellAtom, "true", notifyForReflow);
pParentContent->SetAttribute(kNameSpaceID_None, kSelectedAtom, "true", notifyForReflow);
}
else
{
// We're deselecting the node.
mContent->UnsetAttribute(nsXULAtoms::nameSpaceID, kSelectedCellAtom, notifyForReflow);
pParentContent->UnsetAttribute(nsXULAtoms::nameSpaceID, kSelectedAtom, notifyForReflow);
mContent->UnsetAttribute(kNameSpaceID_None, kSelectedCellAtom, notifyForReflow);
pParentContent->UnsetAttribute(kNameSpaceID_None, kSelectedAtom, notifyForReflow);
}
NS_IF_RELEASE(pParentContent);
@ -288,14 +289,14 @@ void nsTreeCellFrame::Hover(nsIPresContext& aPresContext, PRBool isHover, PRBool
if (isHover)
{
// We're hovering over the node.
mContent->SetAttribute(nsXULAtoms::nameSpaceID, kHoverCellAtom, "true", notifyForReflow);
pParentContent->SetAttribute(nsXULAtoms::nameSpaceID, kHoverAtom, "true", notifyForReflow);
mContent->SetAttribute(kNameSpaceID_None, kHoverCellAtom, "true", notifyForReflow);
pParentContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow);
}
else
{
// We're deselecting the node.
mContent->UnsetAttribute(nsXULAtoms::nameSpaceID, kHoverCellAtom, notifyForReflow);
pParentContent->UnsetAttribute(nsXULAtoms::nameSpaceID, kHoverAtom, notifyForReflow);
mContent->UnsetAttribute(kNameSpaceID_None, kHoverCellAtom, notifyForReflow);
pParentContent->UnsetAttribute(kNameSpaceID_None, kHoverAtom, notifyForReflow);
}
NS_IF_RELEASE(pParentContent);