зеркало из https://github.com/mozilla/pjs.git
making string conversions explicit
This commit is contained in:
Родитель
8f0bc85c7a
Коммит
8624ce5d67
|
@ -1453,7 +1453,7 @@ nsDOMSelection::ToString(nsString& aReturn)
|
|||
PRInt32 cnt;
|
||||
GetRangeCount(&cnt);
|
||||
aReturn.AssignWithConversion("nsSelection: ");
|
||||
aReturn += cnt;
|
||||
aReturn.AppendInt(cnt);
|
||||
aReturn.AppendWithConversion(" items\n");
|
||||
|
||||
// Get an iterator
|
||||
|
@ -1484,11 +1484,11 @@ nsDOMSelection::ToString(nsString& aReturn)
|
|||
PRInt32 theInt = (PRInt32)(nsIDOMNode*)FetchAnchorNode();
|
||||
aReturn.AppendWithConversion(theInt);
|
||||
aReturn.AppendWithConversion(", ");
|
||||
aReturn += FetchAnchorOffset();
|
||||
aReturn.AppendInt(FetchAnchorOffset());
|
||||
aReturn.AppendWithConversion("Focus is");
|
||||
aReturn.AppendWithConversion((long)(nsIDOMNode*)FetchFocusNode(), 16);
|
||||
aReturn.AppendInt((long)(nsIDOMNode*)FetchFocusNode(), 16);
|
||||
aReturn.AppendWithConversion(", ");
|
||||
aReturn += FetchFocusOffset();
|
||||
aReturn.AppendInt(FetchFocusOffset());
|
||||
aReturn.AppendWithConversion("\n ... end of selection\n");
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -460,7 +460,7 @@ nsAttributeContent::CopyText(nsString& aResult)
|
|||
aResult.Assign(mText.Get2b(), mText.GetLength());
|
||||
}
|
||||
else {
|
||||
aResult.Assign(mText.Get1b(), mText.GetLength());
|
||||
aResult.AssignWithConversion(mText.Get1b(), mText.GetLength());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -401,7 +401,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
|
|||
nsAutoString tag;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
tag = aNode.GetText();
|
||||
tag.Assign(aNode.GetText());
|
||||
if (tag.EqualsIgnoreCase(kSentinelStr)) {
|
||||
mHitSentinel = PR_TRUE;
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ nsHTMLFragmentContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
|
|||
}
|
||||
*cp = '\0';
|
||||
PRInt32 ch;
|
||||
nsAutoString str(cbuf);
|
||||
nsAutoString str; str.AssignWithConversion(cbuf);
|
||||
dtd->ConvertEntityToUnicode(str, &ch);
|
||||
|
||||
if (ch < 0) {
|
||||
|
|
|
@ -276,7 +276,9 @@ nsImageDocument::CreateSyntheticDocument()
|
|||
|
||||
char* src;
|
||||
mDocumentURL->GetSpec(&src);
|
||||
nsHTMLValue val(src);
|
||||
|
||||
nsString src_string; src_string.AssignWithConversion(src);
|
||||
nsHTMLValue val(src_string);
|
||||
delete[] src;
|
||||
image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE);
|
||||
image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE);
|
||||
|
|
|
@ -47,7 +47,7 @@ void nsXULAtoms::AddRefAtoms() {
|
|||
*/
|
||||
if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) {
|
||||
// gNameSpaceManager->CreateRootNameSpace(namespace);
|
||||
nsAutoString nameSpace(kXULNameSpace);
|
||||
nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace);
|
||||
gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID);
|
||||
} else {
|
||||
NS_ASSERTION(0, "failed to create xul atoms namespace manager");
|
||||
|
|
|
@ -495,7 +495,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
|
|||
// in the excludes list.
|
||||
nsAutoString excludes;
|
||||
content->GetAttribute(kNameSpaceID_None, kExcludesAtom, excludes);
|
||||
if (!excludes.Equals("*")) {
|
||||
if (!excludes.EqualsWithConversion("*")) {
|
||||
if (!excludes.IsEmpty()) {
|
||||
// Walk the children and ensure that all of them
|
||||
// are in the excludes array.
|
||||
|
@ -540,7 +540,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
|
|||
nsCOMPtr<nsIDOMAttr> attr(do_QueryInterface(attribute));
|
||||
nsAutoString name;
|
||||
attr->GetName(name);
|
||||
if (!name.Equals("excludes")) {
|
||||
if (!name.EqualsWithConversion("excludes")) {
|
||||
nsAutoString value;
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mBoundElement));
|
||||
element->GetAttribute(name, value);
|
||||
|
@ -616,7 +616,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement)
|
|||
PRBool useCapture = PR_FALSE;
|
||||
nsAutoString capturer;
|
||||
child->GetAttribute(kNameSpaceID_None, kCapturerAtom, capturer);
|
||||
if (capturer.Equals("true"))
|
||||
if (capturer.EqualsWithConversion("true"))
|
||||
useCapture = PR_TRUE;
|
||||
|
||||
// Add the event listener.
|
||||
|
@ -742,8 +742,9 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
// and then define it as a property.
|
||||
if (!body.IsEmpty()) {
|
||||
void* myFunc;
|
||||
nsCAutoString cname; cname.AssignWithConversion(name.GetUnicode());
|
||||
rv = context->CompileFunction(mScriptObject,
|
||||
name,
|
||||
cname,
|
||||
argCount,
|
||||
(const char**)args,
|
||||
body,
|
||||
|
@ -769,7 +770,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
void* setFunc = nsnull;
|
||||
uintN attrs = 0;
|
||||
|
||||
if (readOnly.Equals("true"))
|
||||
if (readOnly.EqualsWithConversion("true"))
|
||||
attrs |= JSPROP_READONLY;
|
||||
|
||||
if (!getter.IsEmpty()) {
|
||||
|
@ -1139,7 +1140,7 @@ nsXBLBinding::IsInExcludesList(nsIAtom* aTag, const nsString& aList)
|
|||
nsAutoString element;
|
||||
aTag->ToString(element);
|
||||
|
||||
if (aList.Equals("*"))
|
||||
if (aList.EqualsWithConversion("*"))
|
||||
return PR_TRUE; // match _everything_!
|
||||
|
||||
PRInt32 indx = aList.Find(element);
|
||||
|
@ -1185,7 +1186,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement)
|
|||
nsCOMPtr<nsIAtom> attribute;
|
||||
|
||||
// Figure out if this token contains a :.
|
||||
nsAutoString attr(token);
|
||||
nsAutoString attr; attr.AssignWithConversion(token);
|
||||
PRInt32 index = attr.Find(":", PR_TRUE);
|
||||
if (index != -1) {
|
||||
// This attribute maps to something different.
|
||||
|
@ -1281,21 +1282,21 @@ nsXBLBinding::GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound)
|
|||
PRBool
|
||||
nsXBLBinding::IsMouseHandler(const nsString& aName)
|
||||
{
|
||||
return ((aName.Equals("click")) || (aName.Equals("dblclick")) || (aName.Equals("mousedown")) ||
|
||||
(aName.Equals("mouseover")) || (aName.Equals("mouseout")) || (aName.Equals("mouseup")));
|
||||
return ((aName.EqualsWithConversion("click")) || (aName.EqualsWithConversion("dblclick")) || (aName.EqualsWithConversion("mousedown")) ||
|
||||
(aName.EqualsWithConversion("mouseover")) || (aName.EqualsWithConversion("mouseout")) || (aName.EqualsWithConversion("mouseup")));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXBLBinding::IsKeyHandler(const nsString& aName)
|
||||
{
|
||||
return ((aName.Equals("keypress")) || (aName.Equals("keydown")) || (aName.Equals("keyup")));
|
||||
return ((aName.EqualsWithConversion("keypress")) || (aName.EqualsWithConversion("keydown")) || (aName.EqualsWithConversion("keyup")));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXBLBinding::IsXULHandler(const nsString& aName)
|
||||
{
|
||||
return ((aName.Equals("create")) || (aName.Equals("destroy")) || (aName.Equals("broadcast")) ||
|
||||
(aName.Equals("command")) || (aName.Equals("commandupdate")) || (aName.Equals("close")));
|
||||
return ((aName.EqualsWithConversion("create")) || (aName.EqualsWithConversion("destroy")) || (aName.EqualsWithConversion("broadcast")) ||
|
||||
(aName.EqualsWithConversion("command")) || (aName.EqualsWithConversion("commandupdate")) || (aName.EqualsWithConversion("close")));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1304,7 +1305,7 @@ nsXBLBinding::AddScriptEventListener(nsIContent* aElement, nsIAtom* aName, const
|
|||
nsAutoString val;
|
||||
aName->ToString(val);
|
||||
|
||||
nsAutoString eventStr("on");
|
||||
nsAutoString eventStr; eventStr.AssignWithConversion("on");
|
||||
eventStr += val;
|
||||
|
||||
nsCOMPtr<nsIAtom> eventName = getter_AddRefs(NS_NewAtom(eventStr));
|
||||
|
|
|
@ -58,7 +58,7 @@ nsXBLEventHandler::nsXBLEventHandler(nsIContent* aBoundElement, nsIContent* aHan
|
|||
NS_INIT_REFCNT();
|
||||
mBoundElement = aBoundElement;
|
||||
mHandlerElement = aHandlerElement;
|
||||
mEventName = aEventName;
|
||||
mEventName.Assign(aEventName);
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1) {
|
||||
kKeyCodeAtom = NS_NewAtom("keycode");
|
||||
|
@ -101,154 +101,154 @@ nsresult nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent)
|
|||
|
||||
nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
if (!mEventName.Equals("keyup"))
|
||||
if (!mEventName.EqualsWithConversion("keyup"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
if (KeyEventMatched(keyEvent))
|
||||
ExecuteHandler(nsAutoString("keyup"), aKeyEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("keyup"), aKeyEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
if (!mEventName.Equals("keydown"))
|
||||
if (!mEventName.EqualsWithConversion("keydown"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
if (KeyEventMatched(keyEvent))
|
||||
ExecuteHandler(nsAutoString("keydown"), aKeyEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("keydown"), aKeyEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
if (!mEventName.Equals("keypress"))
|
||||
if (!mEventName.EqualsWithConversion("keypress"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
if (KeyEventMatched(keyEvent))
|
||||
ExecuteHandler(nsAutoString("keypress"), aKeyEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("keypress"), aKeyEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mousedown"))
|
||||
if (!mEventName.EqualsWithConversion("mousedown"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mousedown"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mousedown"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mouseup"))
|
||||
if (!mEventName.EqualsWithConversion("mouseup"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mouseup"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mouseup"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("click"))
|
||||
if (!mEventName.EqualsWithConversion("click"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("click"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("click"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("dblclick"))
|
||||
if (!mEventName.EqualsWithConversion("dblclick"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("dblclick"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("dblclick"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mouseover"))
|
||||
if (!mEventName.EqualsWithConversion("mouseover"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mouseover"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mouseover"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mouseout"))
|
||||
if (!mEventName.EqualsWithConversion("mouseout"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mouseout"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mouseout"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("command"))
|
||||
if (!mEventName.EqualsWithConversion("command"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("command"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("command"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("create"))
|
||||
if (!mEventName.EqualsWithConversion("create"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("create"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("create"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("close"))
|
||||
if (!mEventName.EqualsWithConversion("close"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("close"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("close"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("broadcast"))
|
||||
if (!mEventName.EqualsWithConversion("broadcast"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("broadcast"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("broadcast"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("commandupdate"))
|
||||
if (!mEventName.EqualsWithConversion("commandupdate"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("commandupdate"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("commandupdate"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("destroy"))
|
||||
if (!mEventName.EqualsWithConversion("destroy"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("destroy"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("destroy"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -257,8 +257,8 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
||||
{
|
||||
nsAutoString trueString = "true";
|
||||
nsAutoString falseString = "false";
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
// Get the keycode and charcode of the key event.
|
||||
PRUint32 keyCode, charCode;
|
||||
|
@ -272,12 +272,12 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
if (!key.IsEmpty())
|
||||
keyMatched = IsMatchingCharCode(charCode, key);
|
||||
|
||||
key = "";
|
||||
key.SetLength(0);
|
||||
mHandlerElement->GetAttribute(kNameSpaceID_None, kKeyCodeAtom, key);
|
||||
if (!key.IsEmpty())
|
||||
keyMatched = IsMatchingKeyCode(keyCode, key);
|
||||
|
||||
key = "";
|
||||
key.SetLength(0);
|
||||
mHandlerElement->GetAttribute(kNameSpaceID_None, kCharCodeAtom, key);
|
||||
if (!key.IsEmpty())
|
||||
keyMatched = IsMatchingCharCode(charCode, key);
|
||||
|
@ -374,8 +374,8 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::MouseEventMatched(nsIDOMUIEvent* aMouseEvent)
|
||||
{
|
||||
nsAutoString trueString = "true";
|
||||
nsAutoString falseString = "false";
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
// XXX Check for button and modifier keys.
|
||||
|
||||
|
@ -408,7 +408,7 @@ nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEven
|
|||
|
||||
// Look for a compiled handler on the element.
|
||||
// Should be compiled and bound with "on" in front of the name.
|
||||
nsAutoString onEvent = "onxbl";
|
||||
nsAutoString onEvent; onEvent.AssignWithConversion("onxbl");
|
||||
onEvent += aEventName;
|
||||
nsCOMPtr<nsIAtom> onEventAtom = getter_AddRefs(NS_NewAtom(onEvent));
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ nsXBLEventHandler::IsMatchingCharCode(const PRUint32 aChar, const nsString& aKey
|
|||
char tempChar[2];
|
||||
tempChar[0] = aChar;
|
||||
tempChar[1] = 0;
|
||||
nsAutoString tempChar2 = tempChar;
|
||||
nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar);
|
||||
|
||||
return tempChar2.EqualsIgnoreCase(aKeyName);
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ nsXBLService::nsXBLService(void)
|
|||
static const char kXBLNameSpaceURI[]
|
||||
= "http://www.mozilla.org/xbl";
|
||||
|
||||
rv = gNameSpaceManager->RegisterNameSpace(kXBLNameSpaceURI, kNameSpaceID_XBL);
|
||||
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXBLNameSpaceURI), kNameSpaceID_XBL);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XBL namespace");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
|
@ -272,7 +272,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL)
|
|||
|
||||
if (!binding) {
|
||||
nsCAutoString str = "Failed to locate XBL binding. The invalid binding name is: ";
|
||||
str += aURL;
|
||||
str.AppendWithConversion(aURL);
|
||||
NS_ERROR(str);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
|
|||
if (!root)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString bindingName(ref);
|
||||
nsAutoString bindingName; bindingName.AssignWithConversion( NS_STATIC_CAST(const char*, ref) );
|
||||
|
||||
PRInt32 count;
|
||||
root->ChildCount(count);
|
||||
|
|
|
@ -137,7 +137,7 @@ nsXMLCDATASection::GetTag(nsIAtom*& aResult) const
|
|||
NS_IMETHODIMP
|
||||
nsXMLCDATASection::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
aNodeName.Assign("#cdata-section");
|
||||
aNodeName.AssignWithConversion("#cdata-section");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
// to create an atom.
|
||||
if ((kNameSpaceID_XLink == aNameSpaceID) &&
|
||||
(kTypeAtom == aName)) {
|
||||
if (aValue.Equals(kSimpleAtom, PR_FALSE)) {
|
||||
if (aValue.EqualsAtom(kSimpleAtom, PR_FALSE)) {
|
||||
// NOTE: This really is a link according to the XLink spec,
|
||||
// we do not need to check other attributes. If there
|
||||
// is no href attribute, then this link is simply
|
||||
|
|
|
@ -266,19 +266,19 @@ nsXMLEntity::List(FILE* out, PRInt32 aIndent) const
|
|||
|
||||
nsAutoString tmp(mName);
|
||||
if (mPublicId.Length()) {
|
||||
tmp.Append(" PUBLIC \"");
|
||||
tmp.AppendWithConversion(" PUBLIC \"");
|
||||
tmp.Append(mPublicId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
if (mSystemId.Length()) {
|
||||
tmp.Append(" SYSTEM \"");
|
||||
tmp.AppendWithConversion(" SYSTEM \"");
|
||||
tmp.Append(mSystemId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
if (mNotationName.Length()) {
|
||||
tmp.Append(" NDATA ");
|
||||
tmp.AppendWithConversion(" NDATA ");
|
||||
tmp.Append(mNotationName);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,15 +254,15 @@ nsXMLNotation::List(FILE* out, PRInt32 aIndent) const
|
|||
|
||||
nsAutoString tmp(mName);
|
||||
if (mPublicId.Length()) {
|
||||
tmp.Append(" PUBLIC \"");
|
||||
tmp.AppendWithConversion(" PUBLIC \"");
|
||||
tmp.Append(mPublicId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
if (mSystemId.Length()) {
|
||||
tmp.Append(" SYSTEM \"");
|
||||
tmp.AppendWithConversion(" SYSTEM \"");
|
||||
tmp.Append(mSystemId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
fputs(tmp, out);
|
||||
|
|
|
@ -1342,7 +1342,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(document));
|
||||
nsresult result;
|
||||
result = domdoc->CreateElement("SPAN",getter_AddRefs(containerElement));//is the literal the correct way?
|
||||
result = domdoc->CreateElement(NS_ConvertASCIItoUCS2("SPAN"),getter_AddRefs(containerElement));//is the literal the correct way?
|
||||
if (NS_SUCCEEDED(result) && containerElement)
|
||||
{
|
||||
containerContent = do_QueryInterface(containerElement);
|
||||
|
|
|
@ -1453,7 +1453,7 @@ nsDOMSelection::ToString(nsString& aReturn)
|
|||
PRInt32 cnt;
|
||||
GetRangeCount(&cnt);
|
||||
aReturn.AssignWithConversion("nsSelection: ");
|
||||
aReturn += cnt;
|
||||
aReturn.AppendInt(cnt);
|
||||
aReturn.AppendWithConversion(" items\n");
|
||||
|
||||
// Get an iterator
|
||||
|
@ -1484,11 +1484,11 @@ nsDOMSelection::ToString(nsString& aReturn)
|
|||
PRInt32 theInt = (PRInt32)(nsIDOMNode*)FetchAnchorNode();
|
||||
aReturn.AppendWithConversion(theInt);
|
||||
aReturn.AppendWithConversion(", ");
|
||||
aReturn += FetchAnchorOffset();
|
||||
aReturn.AppendInt(FetchAnchorOffset());
|
||||
aReturn.AppendWithConversion("Focus is");
|
||||
aReturn.AppendWithConversion((long)(nsIDOMNode*)FetchFocusNode(), 16);
|
||||
aReturn.AppendInt((long)(nsIDOMNode*)FetchFocusNode(), 16);
|
||||
aReturn.AppendWithConversion(", ");
|
||||
aReturn += FetchFocusOffset();
|
||||
aReturn.AppendInt(FetchFocusOffset());
|
||||
aReturn.AppendWithConversion("\n ... end of selection\n");
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -424,7 +424,8 @@ nsLayoutModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
|||
void
|
||||
nsLayoutModule::SetUserAgent( void )
|
||||
{
|
||||
nsString productName(PRODUCT_NAME), productVersion(PRODUCT_VERSION);
|
||||
nsString productName; productName.AssignWithConversion(PRODUCT_NAME);
|
||||
nsString productVersion; productVersion.AssignWithConversion(PRODUCT_VERSION);
|
||||
nsresult rv = nsnull;
|
||||
|
||||
nsCOMPtr<nsIHTTPProtocolHandler> theService(do_GetService(kHTTPHandlerCID,
|
||||
|
|
|
@ -78,7 +78,7 @@ nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify)
|
|||
mFrame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (aDisabled)
|
||||
content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify);
|
||||
content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, nsAutoString(), notify);
|
||||
else
|
||||
content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify);
|
||||
|
||||
|
|
|
@ -223,7 +223,6 @@ nsComboboxControlFrame::nsComboboxControlFrame()
|
|||
mPresContext = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
mListControlFrame = nsnull;
|
||||
mTextStr = "";
|
||||
mButtonContent = nsnull;
|
||||
mDroppedDown = PR_FALSE;
|
||||
mDisplayFrame = nsnull;
|
||||
|
@ -337,7 +336,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext
|
|||
mListControlFrame->GetNumberOfOptions(&length);
|
||||
if (length > 0) {
|
||||
// Set listbox selection to first item in the list box
|
||||
rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0");
|
||||
rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, NS_ConvertASCIItoUCS2("0"));
|
||||
mSelectedIndex = 0;
|
||||
} else {
|
||||
UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option
|
||||
|
@ -494,7 +493,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
|
|||
|
||||
nsCOMPtr<nsIAtom> activeAtom ( dont_QueryInterface(NS_NewAtom(kMozDropdownActive)));
|
||||
if (PR_TRUE == aShowPopup) {
|
||||
mContent->SetAttribute(kNameSpaceID_None, activeAtom, "", PR_TRUE);
|
||||
mContent->SetAttribute(kNameSpaceID_None, activeAtom, nsAutoString(), PR_TRUE);
|
||||
} else {
|
||||
mContent->UnsetAttribute(kNameSpaceID_None, activeAtom, PR_TRUE);
|
||||
}
|
||||
|
@ -2085,7 +2084,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
// Add a child text content node for the label
|
||||
nsCOMPtr<nsIContent> labelContent;
|
||||
nsresult result = NS_NewTextNode(getter_AddRefs(labelContent));
|
||||
nsAutoString value="X";
|
||||
nsAutoString value; value.AssignWithConversion("X");
|
||||
if (NS_SUCCEEDED(result) && labelContent) {
|
||||
// set the value of the text node
|
||||
mDisplayContent = do_QueryInterface(labelContent);
|
||||
|
@ -2101,7 +2100,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
result = NS_NewHTMLInputElement(&mButtonContent, nsHTMLAtoms::input);
|
||||
//NS_ADDREF(mButtonContent);
|
||||
if (NS_SUCCEEDED(result) && mButtonContent) {
|
||||
mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE);
|
||||
mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
|
||||
aChildList.AppendElement(mButtonContent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,8 +249,8 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
|
||||
|
||||
if (fileWidget) {
|
||||
nsString titles[] = {"all files"};
|
||||
nsString filters[] = {"*.*"};
|
||||
nsString titles[1]; titles[0].AssignWithConversion("all files");
|
||||
nsString filters[1]; filters[0].AssignWithConversion("*.*");
|
||||
fileWidget->SetFilterList(1, titles, filters);
|
||||
|
||||
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
|
||||
|
|
|
@ -112,26 +112,20 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame
|
|||
void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString)
|
||||
{
|
||||
// Windows linebreaks: Map CRLF to LF:
|
||||
aString.ReplaceSubstring("\r\n", "\n");
|
||||
aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\n"));
|
||||
|
||||
// Mac linebreaks: Map any remaining CR to LF:
|
||||
aString.ReplaceSubstring("\r", "\n");
|
||||
aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n"));
|
||||
}
|
||||
|
||||
PRBool nsFormControlHelper::GetBool(const nsString& aValue)
|
||||
{
|
||||
if (aValue.Equals(NS_STRING_TRUE))
|
||||
return(PR_TRUE);
|
||||
else
|
||||
return (PR_FALSE);
|
||||
return aValue.EqualsWithConversion(NS_STRING_TRUE);
|
||||
}
|
||||
|
||||
void nsFormControlHelper::GetBoolString(const PRBool aValue, nsString& aResult)
|
||||
{
|
||||
if (PR_TRUE == aValue)
|
||||
aResult = NS_STRING_TRUE;
|
||||
else
|
||||
aResult = NS_STRING_FALSE;
|
||||
aResult.AssignWithConversion( aValue ? NS_STRING_TRUE : NS_STRING_FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,7 +166,7 @@ nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext,
|
|||
nsresult
|
||||
nsFormControlHelper::GetWrapProperty(nsIContent * aContent, nsString &aOutValue)
|
||||
{
|
||||
aOutValue = "";
|
||||
aOutValue.SetLength(0);
|
||||
nsresult result = NS_CONTENT_ATTR_NOT_THERE;
|
||||
nsIHTMLContent* content = nsnull;
|
||||
aContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
||||
|
@ -198,16 +192,16 @@ nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap&
|
|||
|
||||
if (NS_CONTENT_ATTR_NOT_THERE != result) {
|
||||
|
||||
nsAutoString wrapHard(kTextControl_Wrap_Hard);
|
||||
nsAutoString wrapPhysical(kTextControl_Wrap_Physical);
|
||||
nsAutoString wrapHard; wrapHard.AssignWithConversion(kTextControl_Wrap_Hard);
|
||||
nsAutoString wrapPhysical; wrapPhysical.AssignWithConversion(kTextControl_Wrap_Physical);
|
||||
if (wrap.EqualsIgnoreCase(wrapHard) ||
|
||||
wrap.EqualsIgnoreCase(wrapPhysical)) {
|
||||
aWrapProp = eHTMLTextWrap_Hard;
|
||||
return result;
|
||||
}
|
||||
|
||||
nsAutoString wrapSoft(kTextControl_Wrap_Soft);
|
||||
nsAutoString wrapVirtual(kTextControl_Wrap_Virtual);
|
||||
nsAutoString wrapSoft; wrapSoft.AssignWithConversion(kTextControl_Wrap_Soft);
|
||||
nsAutoString wrapVirtual; wrapVirtual.AssignWithConversion(kTextControl_Wrap_Virtual);
|
||||
if (wrap.EqualsIgnoreCase(wrapSoft) ||
|
||||
wrap.EqualsIgnoreCase(wrapVirtual)) {
|
||||
aWrapProp = eHTMLTextWrap_Soft;
|
||||
|
@ -384,10 +378,10 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
|
|||
GetRepChars(aPresContext, char1, char2);
|
||||
int i;
|
||||
for (i = 0; i < aNumChars; i+=2) {
|
||||
val += char1;
|
||||
val.AppendWithConversion(char1);
|
||||
}
|
||||
for (i = 1; i < aNumChars; i+=2) {
|
||||
val += char2;
|
||||
val.AppendWithConversion(char2);
|
||||
}
|
||||
return GetTextSize(aPresContext, aFrame, val, aSize, aRendContext);
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
|
|||
if (!textStyle->WhiteSpaceIsSignificant()) {
|
||||
value.CompressWhitespace();
|
||||
if (value.Length() == 0) {
|
||||
value = " ";
|
||||
value.AssignWithConversion(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
if (!textStyle->WhiteSpaceIsSignificant()) {
|
||||
value.CompressWhitespace();
|
||||
if (value.Length() == 0) {
|
||||
value = " ";
|
||||
value.AssignWithConversion(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString)
|
|||
rv = ButtonLocalize("Browse", aString);
|
||||
}
|
||||
else {
|
||||
aString = " ";
|
||||
aString.AssignWithConversion(" ");
|
||||
rv = NS_OK;
|
||||
}
|
||||
return rv;
|
||||
|
@ -478,7 +478,7 @@ nsGfxButtonControlFrame::ButtonLocalize(char* aKey, nsString& oVal)
|
|||
// Determine default label from string bundle
|
||||
if (NS_SUCCEEDED(rv) && bundle && aKey) {
|
||||
nsXPIDLString valUni;
|
||||
nsAutoString key(aKey);
|
||||
nsAutoString key; key.AssignWithConversion(aKey);
|
||||
rv = bundle->GetStringFromName(key.GetUnicode(), getter_Copies(valUni));
|
||||
if (NS_SUCCEEDED(rv) && valUni) {
|
||||
oVal.Assign(valUni);
|
||||
|
@ -503,7 +503,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
nsAutoString value;
|
||||
if (mTextContent && mContent) {
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE != mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, value)) {
|
||||
value = "";
|
||||
value.SetLength(0);
|
||||
}
|
||||
rv = mTextContent->SetText(value.GetUnicode(), value.Length(), PR_TRUE);
|
||||
} else {
|
||||
|
|
|
@ -119,7 +119,7 @@ nsGfxCheckboxControlFrame::Init(nsIPresContext* aPresContext,
|
|||
|
||||
// give the attribute a default value so it's always present, if we're a tristate
|
||||
if ( IsTristateCheckbox() )
|
||||
mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), "0", PR_FALSE );
|
||||
mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), NS_ConvertASCIItoUCS2("0"), PR_FALSE );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ nsGfxCheckboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumVa
|
|||
result = PR_FALSE;
|
||||
} else {
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE != valueResult) {
|
||||
aValues[0] = "on";
|
||||
aValues[0].AssignWithConversion("on");
|
||||
} else {
|
||||
aValues[0] = value;
|
||||
}
|
||||
|
@ -526,15 +526,15 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou
|
|||
{
|
||||
switch ( inState ) {
|
||||
case eOn:
|
||||
outStateAsString = NS_STRING_TRUE;
|
||||
outStateAsString.AssignWithConversion(NS_STRING_TRUE);
|
||||
break;
|
||||
|
||||
case eOff:
|
||||
outStateAsString = NS_STRING_FALSE;
|
||||
outStateAsString.AssignWithConversion(NS_STRING_FALSE);
|
||||
break;
|
||||
|
||||
case eMixed:
|
||||
outStateAsString = "2";
|
||||
outStateAsString.AssignWithConversion("2");
|
||||
break;
|
||||
}
|
||||
} // CheckStateToString
|
||||
|
@ -549,9 +549,9 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou
|
|||
nsGfxCheckboxControlFrame::CheckState
|
||||
nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString )
|
||||
{
|
||||
if ( aStateAsString.Equals(NS_STRING_TRUE) )
|
||||
if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) )
|
||||
return eOn;
|
||||
else if ( aStateAsString.Equals(NS_STRING_FALSE) )
|
||||
else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) )
|
||||
return eOff;
|
||||
|
||||
// not true and not false means mixed
|
||||
|
@ -614,7 +614,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::SaveState(nsIPresContext* aPresContext,
|
|||
// This string will hold a single item, whether or not we're checked.
|
||||
nsAutoString stateString;
|
||||
GetCheckboxControlFrameState(stateString);
|
||||
(*aState)->SetStateProperty("checked", stateString);
|
||||
(*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::RestoreState(nsIPresContext* aPresConte
|
|||
mDidInit = PR_TRUE;
|
||||
}
|
||||
nsAutoString string;
|
||||
aState->GetStateProperty("checked", string);
|
||||
aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string);
|
||||
SetCheckboxControlFrameState(aPresContext, string);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex,
|
|||
NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)
|
||||
{
|
||||
if (nsHTMLAtoms::checked == aName) {
|
||||
PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
PRBool state = (aValue.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
|
||||
// if there is no form than the radiobtn is an orphan
|
||||
|
@ -185,9 +185,9 @@ nsGfxRadioControlFrame::SetChecked(nsIPresContext* aPresContext, PRBool aValue,
|
|||
{
|
||||
if (aSetInitialValue) {
|
||||
if (aValue) {
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("1"), PR_FALSE); // XXX should be "empty" value
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("1"), PR_FALSE); // XXX should be "empty" value
|
||||
} else {
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("0"), PR_FALSE);
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("0"), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ nsGfxRadioControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValue
|
|||
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
||||
aValues[0] = value;
|
||||
} else {
|
||||
aValues[0] = "on";
|
||||
aValues[0].AssignWithConversion("on");
|
||||
}
|
||||
aNames[0] = name;
|
||||
aNumValues = 1;
|
||||
|
@ -345,7 +345,7 @@ nsGfxRadioControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** a
|
|||
// This string will hold a single item, whether or not we're checked.
|
||||
nsAutoString stateString;
|
||||
nsFormControlHelper::GetBoolString(GetRadioState(), stateString);
|
||||
(*aState)->SetStateProperty("checked", stateString);
|
||||
(*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -364,8 +364,8 @@ nsGfxRadioControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState*
|
|||
|
||||
mIsRestored = PR_TRUE;
|
||||
nsAutoString string;
|
||||
aState->GetStateProperty("checked", string);
|
||||
PRBool state = (string.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string);
|
||||
PRBool state = (string.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
SetRadioState(aPresContext, state); // sets mChecked
|
||||
mRestoredChecked = mChecked;
|
||||
|
|
|
@ -910,10 +910,10 @@ nsListControlFrame::DisplaySelected(nsIContent* aContent)
|
|||
// The event state manager supports selected states. KMM
|
||||
|
||||
if (PR_TRUE == mIsAllFramesHere) {
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_TRUE);
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_TRUE);
|
||||
//ForceRedraw();
|
||||
} else {
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_FALSE);
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1770,7 +1770,7 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
|
|||
// Ok, so we were restored, now set the last known selections from the restore state.
|
||||
if (hasBeenRestored) {
|
||||
nsCOMPtr<nsISupports> supp;
|
||||
mPresState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp));
|
||||
mPresState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp));
|
||||
|
||||
nsresult res = NS_ERROR_NULL_POINTER;
|
||||
if (!supp)
|
||||
|
@ -1949,7 +1949,7 @@ nsListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame)
|
|||
NS_IMETHODIMP
|
||||
nsListControlFrame::GetSelectedItem(nsString & aStr)
|
||||
{
|
||||
aStr = "";
|
||||
aStr.SetLength(0);
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options = getter_AddRefs(GetOptions(mContent));
|
||||
|
||||
|
@ -2429,7 +2429,7 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
|
|||
if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) {
|
||||
selectedIndex = 0;
|
||||
}
|
||||
aValue.Append(selectedIndex, 10);
|
||||
aValue.AppendInt(selectedIndex, 10);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3364,7 +3364,7 @@ nsListControlFrame::SaveStateInternal(nsIPresContext* aPresContext, nsIPresState
|
|||
}
|
||||
|
||||
NS_NewPresState(aState);
|
||||
(*aState)->SetStatePropertyAsSupports("selecteditems", value);
|
||||
(*aState)->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -289,12 +289,12 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
|
|||
case '7': case '8':
|
||||
addOn.AppendWithConversion(bchars[romanPos]);
|
||||
for(n=0;n<(*dp-'5');n++) {
|
||||
addOn.Append(achars[romanPos]);
|
||||
addOn.AppendWithConversion(achars[romanPos]);
|
||||
}
|
||||
break;
|
||||
case '9':
|
||||
addOn.Append(achars[romanPos]);
|
||||
addOn.Append(achars[romanPos+1]);
|
||||
addOn.AppendWithConversion(achars[romanPos]);
|
||||
addOn.AppendWithConversion(achars[romanPos+1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1453,7 +1453,7 @@ nsDOMSelection::ToString(nsString& aReturn)
|
|||
PRInt32 cnt;
|
||||
GetRangeCount(&cnt);
|
||||
aReturn.AssignWithConversion("nsSelection: ");
|
||||
aReturn += cnt;
|
||||
aReturn.AppendInt(cnt);
|
||||
aReturn.AppendWithConversion(" items\n");
|
||||
|
||||
// Get an iterator
|
||||
|
@ -1484,11 +1484,11 @@ nsDOMSelection::ToString(nsString& aReturn)
|
|||
PRInt32 theInt = (PRInt32)(nsIDOMNode*)FetchAnchorNode();
|
||||
aReturn.AppendWithConversion(theInt);
|
||||
aReturn.AppendWithConversion(", ");
|
||||
aReturn += FetchAnchorOffset();
|
||||
aReturn.AppendInt(FetchAnchorOffset());
|
||||
aReturn.AppendWithConversion("Focus is");
|
||||
aReturn.AppendWithConversion((long)(nsIDOMNode*)FetchFocusNode(), 16);
|
||||
aReturn.AppendInt((long)(nsIDOMNode*)FetchFocusNode(), 16);
|
||||
aReturn.AppendWithConversion(", ");
|
||||
aReturn += FetchFocusOffset();
|
||||
aReturn.AppendInt(FetchFocusOffset());
|
||||
aReturn.AppendWithConversion("\n ... end of selection\n");
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -289,12 +289,12 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
|
|||
case '7': case '8':
|
||||
addOn.AppendWithConversion(bchars[romanPos]);
|
||||
for(n=0;n<(*dp-'5');n++) {
|
||||
addOn.Append(achars[romanPos]);
|
||||
addOn.AppendWithConversion(achars[romanPos]);
|
||||
}
|
||||
break;
|
||||
case '9':
|
||||
addOn.Append(achars[romanPos]);
|
||||
addOn.Append(achars[romanPos+1]);
|
||||
addOn.AppendWithConversion(achars[romanPos]);
|
||||
addOn.AppendWithConversion(achars[romanPos+1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -460,7 +460,7 @@ nsAttributeContent::CopyText(nsString& aResult)
|
|||
aResult.Assign(mText.Get2b(), mText.GetLength());
|
||||
}
|
||||
else {
|
||||
aResult.Assign(mText.Get1b(), mText.GetLength());
|
||||
aResult.AssignWithConversion(mText.Get1b(), mText.GetLength());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -401,7 +401,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
|
|||
nsAutoString tag;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
tag = aNode.GetText();
|
||||
tag.Assign(aNode.GetText());
|
||||
if (tag.EqualsIgnoreCase(kSentinelStr)) {
|
||||
mHitSentinel = PR_TRUE;
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ nsHTMLFragmentContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
|
|||
}
|
||||
*cp = '\0';
|
||||
PRInt32 ch;
|
||||
nsAutoString str(cbuf);
|
||||
nsAutoString str; str.AssignWithConversion(cbuf);
|
||||
dtd->ConvertEntityToUnicode(str, &ch);
|
||||
|
||||
if (ch < 0) {
|
||||
|
|
|
@ -276,7 +276,9 @@ nsImageDocument::CreateSyntheticDocument()
|
|||
|
||||
char* src;
|
||||
mDocumentURL->GetSpec(&src);
|
||||
nsHTMLValue val(src);
|
||||
|
||||
nsString src_string; src_string.AssignWithConversion(src);
|
||||
nsHTMLValue val(src_string);
|
||||
delete[] src;
|
||||
image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE);
|
||||
image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE);
|
||||
|
|
|
@ -78,7 +78,7 @@ nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify)
|
|||
mFrame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (aDisabled)
|
||||
content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify);
|
||||
content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, nsAutoString(), notify);
|
||||
else
|
||||
content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify);
|
||||
|
||||
|
|
|
@ -223,7 +223,6 @@ nsComboboxControlFrame::nsComboboxControlFrame()
|
|||
mPresContext = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
mListControlFrame = nsnull;
|
||||
mTextStr = "";
|
||||
mButtonContent = nsnull;
|
||||
mDroppedDown = PR_FALSE;
|
||||
mDisplayFrame = nsnull;
|
||||
|
@ -337,7 +336,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext
|
|||
mListControlFrame->GetNumberOfOptions(&length);
|
||||
if (length > 0) {
|
||||
// Set listbox selection to first item in the list box
|
||||
rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0");
|
||||
rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, NS_ConvertASCIItoUCS2("0"));
|
||||
mSelectedIndex = 0;
|
||||
} else {
|
||||
UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option
|
||||
|
@ -494,7 +493,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
|
|||
|
||||
nsCOMPtr<nsIAtom> activeAtom ( dont_QueryInterface(NS_NewAtom(kMozDropdownActive)));
|
||||
if (PR_TRUE == aShowPopup) {
|
||||
mContent->SetAttribute(kNameSpaceID_None, activeAtom, "", PR_TRUE);
|
||||
mContent->SetAttribute(kNameSpaceID_None, activeAtom, nsAutoString(), PR_TRUE);
|
||||
} else {
|
||||
mContent->UnsetAttribute(kNameSpaceID_None, activeAtom, PR_TRUE);
|
||||
}
|
||||
|
@ -2085,7 +2084,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
// Add a child text content node for the label
|
||||
nsCOMPtr<nsIContent> labelContent;
|
||||
nsresult result = NS_NewTextNode(getter_AddRefs(labelContent));
|
||||
nsAutoString value="X";
|
||||
nsAutoString value; value.AssignWithConversion("X");
|
||||
if (NS_SUCCEEDED(result) && labelContent) {
|
||||
// set the value of the text node
|
||||
mDisplayContent = do_QueryInterface(labelContent);
|
||||
|
@ -2101,7 +2100,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
result = NS_NewHTMLInputElement(&mButtonContent, nsHTMLAtoms::input);
|
||||
//NS_ADDREF(mButtonContent);
|
||||
if (NS_SUCCEEDED(result) && mButtonContent) {
|
||||
mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE);
|
||||
mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
|
||||
aChildList.AppendElement(mButtonContent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,8 +249,8 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
|
||||
|
||||
if (fileWidget) {
|
||||
nsString titles[] = {"all files"};
|
||||
nsString filters[] = {"*.*"};
|
||||
nsString titles[1]; titles[0].AssignWithConversion("all files");
|
||||
nsString filters[1]; filters[0].AssignWithConversion("*.*");
|
||||
fileWidget->SetFilterList(1, titles, filters);
|
||||
|
||||
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
|
||||
|
|
|
@ -112,26 +112,20 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame
|
|||
void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString)
|
||||
{
|
||||
// Windows linebreaks: Map CRLF to LF:
|
||||
aString.ReplaceSubstring("\r\n", "\n");
|
||||
aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\n"));
|
||||
|
||||
// Mac linebreaks: Map any remaining CR to LF:
|
||||
aString.ReplaceSubstring("\r", "\n");
|
||||
aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n"));
|
||||
}
|
||||
|
||||
PRBool nsFormControlHelper::GetBool(const nsString& aValue)
|
||||
{
|
||||
if (aValue.Equals(NS_STRING_TRUE))
|
||||
return(PR_TRUE);
|
||||
else
|
||||
return (PR_FALSE);
|
||||
return aValue.EqualsWithConversion(NS_STRING_TRUE);
|
||||
}
|
||||
|
||||
void nsFormControlHelper::GetBoolString(const PRBool aValue, nsString& aResult)
|
||||
{
|
||||
if (PR_TRUE == aValue)
|
||||
aResult = NS_STRING_TRUE;
|
||||
else
|
||||
aResult = NS_STRING_FALSE;
|
||||
aResult.AssignWithConversion( aValue ? NS_STRING_TRUE : NS_STRING_FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,7 +166,7 @@ nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext,
|
|||
nsresult
|
||||
nsFormControlHelper::GetWrapProperty(nsIContent * aContent, nsString &aOutValue)
|
||||
{
|
||||
aOutValue = "";
|
||||
aOutValue.SetLength(0);
|
||||
nsresult result = NS_CONTENT_ATTR_NOT_THERE;
|
||||
nsIHTMLContent* content = nsnull;
|
||||
aContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
||||
|
@ -198,16 +192,16 @@ nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap&
|
|||
|
||||
if (NS_CONTENT_ATTR_NOT_THERE != result) {
|
||||
|
||||
nsAutoString wrapHard(kTextControl_Wrap_Hard);
|
||||
nsAutoString wrapPhysical(kTextControl_Wrap_Physical);
|
||||
nsAutoString wrapHard; wrapHard.AssignWithConversion(kTextControl_Wrap_Hard);
|
||||
nsAutoString wrapPhysical; wrapPhysical.AssignWithConversion(kTextControl_Wrap_Physical);
|
||||
if (wrap.EqualsIgnoreCase(wrapHard) ||
|
||||
wrap.EqualsIgnoreCase(wrapPhysical)) {
|
||||
aWrapProp = eHTMLTextWrap_Hard;
|
||||
return result;
|
||||
}
|
||||
|
||||
nsAutoString wrapSoft(kTextControl_Wrap_Soft);
|
||||
nsAutoString wrapVirtual(kTextControl_Wrap_Virtual);
|
||||
nsAutoString wrapSoft; wrapSoft.AssignWithConversion(kTextControl_Wrap_Soft);
|
||||
nsAutoString wrapVirtual; wrapVirtual.AssignWithConversion(kTextControl_Wrap_Virtual);
|
||||
if (wrap.EqualsIgnoreCase(wrapSoft) ||
|
||||
wrap.EqualsIgnoreCase(wrapVirtual)) {
|
||||
aWrapProp = eHTMLTextWrap_Soft;
|
||||
|
@ -384,10 +378,10 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
|
|||
GetRepChars(aPresContext, char1, char2);
|
||||
int i;
|
||||
for (i = 0; i < aNumChars; i+=2) {
|
||||
val += char1;
|
||||
val.AppendWithConversion(char1);
|
||||
}
|
||||
for (i = 1; i < aNumChars; i+=2) {
|
||||
val += char2;
|
||||
val.AppendWithConversion(char2);
|
||||
}
|
||||
return GetTextSize(aPresContext, aFrame, val, aSize, aRendContext);
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
|
|||
if (!textStyle->WhiteSpaceIsSignificant()) {
|
||||
value.CompressWhitespace();
|
||||
if (value.Length() == 0) {
|
||||
value = " ";
|
||||
value.AssignWithConversion(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
if (!textStyle->WhiteSpaceIsSignificant()) {
|
||||
value.CompressWhitespace();
|
||||
if (value.Length() == 0) {
|
||||
value = " ";
|
||||
value.AssignWithConversion(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString)
|
|||
rv = ButtonLocalize("Browse", aString);
|
||||
}
|
||||
else {
|
||||
aString = " ";
|
||||
aString.AssignWithConversion(" ");
|
||||
rv = NS_OK;
|
||||
}
|
||||
return rv;
|
||||
|
@ -478,7 +478,7 @@ nsGfxButtonControlFrame::ButtonLocalize(char* aKey, nsString& oVal)
|
|||
// Determine default label from string bundle
|
||||
if (NS_SUCCEEDED(rv) && bundle && aKey) {
|
||||
nsXPIDLString valUni;
|
||||
nsAutoString key(aKey);
|
||||
nsAutoString key; key.AssignWithConversion(aKey);
|
||||
rv = bundle->GetStringFromName(key.GetUnicode(), getter_Copies(valUni));
|
||||
if (NS_SUCCEEDED(rv) && valUni) {
|
||||
oVal.Assign(valUni);
|
||||
|
@ -503,7 +503,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
nsAutoString value;
|
||||
if (mTextContent && mContent) {
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE != mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, value)) {
|
||||
value = "";
|
||||
value.SetLength(0);
|
||||
}
|
||||
rv = mTextContent->SetText(value.GetUnicode(), value.Length(), PR_TRUE);
|
||||
} else {
|
||||
|
|
|
@ -119,7 +119,7 @@ nsGfxCheckboxControlFrame::Init(nsIPresContext* aPresContext,
|
|||
|
||||
// give the attribute a default value so it's always present, if we're a tristate
|
||||
if ( IsTristateCheckbox() )
|
||||
mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), "0", PR_FALSE );
|
||||
mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), NS_ConvertASCIItoUCS2("0"), PR_FALSE );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ nsGfxCheckboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumVa
|
|||
result = PR_FALSE;
|
||||
} else {
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE != valueResult) {
|
||||
aValues[0] = "on";
|
||||
aValues[0].AssignWithConversion("on");
|
||||
} else {
|
||||
aValues[0] = value;
|
||||
}
|
||||
|
@ -526,15 +526,15 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou
|
|||
{
|
||||
switch ( inState ) {
|
||||
case eOn:
|
||||
outStateAsString = NS_STRING_TRUE;
|
||||
outStateAsString.AssignWithConversion(NS_STRING_TRUE);
|
||||
break;
|
||||
|
||||
case eOff:
|
||||
outStateAsString = NS_STRING_FALSE;
|
||||
outStateAsString.AssignWithConversion(NS_STRING_FALSE);
|
||||
break;
|
||||
|
||||
case eMixed:
|
||||
outStateAsString = "2";
|
||||
outStateAsString.AssignWithConversion("2");
|
||||
break;
|
||||
}
|
||||
} // CheckStateToString
|
||||
|
@ -549,9 +549,9 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou
|
|||
nsGfxCheckboxControlFrame::CheckState
|
||||
nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString )
|
||||
{
|
||||
if ( aStateAsString.Equals(NS_STRING_TRUE) )
|
||||
if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) )
|
||||
return eOn;
|
||||
else if ( aStateAsString.Equals(NS_STRING_FALSE) )
|
||||
else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) )
|
||||
return eOff;
|
||||
|
||||
// not true and not false means mixed
|
||||
|
@ -614,7 +614,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::SaveState(nsIPresContext* aPresContext,
|
|||
// This string will hold a single item, whether or not we're checked.
|
||||
nsAutoString stateString;
|
||||
GetCheckboxControlFrameState(stateString);
|
||||
(*aState)->SetStateProperty("checked", stateString);
|
||||
(*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::RestoreState(nsIPresContext* aPresConte
|
|||
mDidInit = PR_TRUE;
|
||||
}
|
||||
nsAutoString string;
|
||||
aState->GetStateProperty("checked", string);
|
||||
aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string);
|
||||
SetCheckboxControlFrameState(aPresContext, string);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1343,10 +1343,10 @@ nsGfxListControlFrame::DisplaySelected(nsIContent* aContent)
|
|||
// The event state manager supports selected states. KMM
|
||||
|
||||
if (PR_TRUE == mIsAllFramesHere) {
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_TRUE);
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_TRUE);
|
||||
//ForceRedraw();
|
||||
} else {
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_FALSE);
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2229,7 +2229,7 @@ nsGfxListControlFrame::Reset(nsIPresContext* aPresContext)
|
|||
// Ok, so we were restored, now set the last known selections from the restore state.
|
||||
if (hasBeenRestored) {
|
||||
nsCOMPtr<nsISupports> supp;
|
||||
mPresState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp));
|
||||
mPresState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp));
|
||||
|
||||
nsresult res = NS_ERROR_NULL_POINTER;
|
||||
if (!supp)
|
||||
|
@ -2408,7 +2408,7 @@ nsGfxListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame)
|
|||
NS_IMETHODIMP
|
||||
nsGfxListControlFrame::GetSelectedItem(nsString & aStr)
|
||||
{
|
||||
aStr = "";
|
||||
aStr.SetLength(0);
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options = getter_AddRefs(GetOptions(mContent));
|
||||
|
||||
|
@ -2898,7 +2898,7 @@ nsGfxListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
|
|||
if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) {
|
||||
selectedIndex = 0;
|
||||
}
|
||||
aValue.Append(selectedIndex, 10);
|
||||
aValue.AppendInt(selectedIndex, 10);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3855,7 +3855,7 @@ nsGfxListControlFrame::SaveStateInternal(nsIPresContext* aPresContext, nsIPresSt
|
|||
}
|
||||
|
||||
NS_NewPresState(aState);
|
||||
(*aState)->SetStatePropertyAsSupports("selecteditems", value);
|
||||
(*aState)->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex,
|
|||
NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)
|
||||
{
|
||||
if (nsHTMLAtoms::checked == aName) {
|
||||
PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
PRBool state = (aValue.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
|
||||
// if there is no form than the radiobtn is an orphan
|
||||
|
@ -185,9 +185,9 @@ nsGfxRadioControlFrame::SetChecked(nsIPresContext* aPresContext, PRBool aValue,
|
|||
{
|
||||
if (aSetInitialValue) {
|
||||
if (aValue) {
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("1"), PR_FALSE); // XXX should be "empty" value
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("1"), PR_FALSE); // XXX should be "empty" value
|
||||
} else {
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("0"), PR_FALSE);
|
||||
mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("0"), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ nsGfxRadioControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValue
|
|||
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
||||
aValues[0] = value;
|
||||
} else {
|
||||
aValues[0] = "on";
|
||||
aValues[0].AssignWithConversion("on");
|
||||
}
|
||||
aNames[0] = name;
|
||||
aNumValues = 1;
|
||||
|
@ -345,7 +345,7 @@ nsGfxRadioControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** a
|
|||
// This string will hold a single item, whether or not we're checked.
|
||||
nsAutoString stateString;
|
||||
nsFormControlHelper::GetBoolString(GetRadioState(), stateString);
|
||||
(*aState)->SetStateProperty("checked", stateString);
|
||||
(*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -364,8 +364,8 @@ nsGfxRadioControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState*
|
|||
|
||||
mIsRestored = PR_TRUE;
|
||||
nsAutoString string;
|
||||
aState->GetStateProperty("checked", string);
|
||||
PRBool state = (string.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string);
|
||||
PRBool state = (string.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
SetRadioState(aPresContext, state); // sets mChecked
|
||||
mRestoredChecked = mChecked;
|
||||
|
|
|
@ -955,7 +955,7 @@ NS_METHOD nsGfxTextControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
break;
|
||||
|
||||
case NS_FORM_SELECTED:
|
||||
return UpdateTextControlCommands(nsAutoString("select"));
|
||||
return UpdateTextControlCommands(NS_ConvertASCIItoUCS2("select"));
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -1106,7 +1106,7 @@ nsGfxTextControlFrame::GetText(nsString* aText, PRBool aInitialValue)
|
|||
nsCOMPtr<nsIEditorIMESupport> imeSupport = do_QueryInterface(mEditor);
|
||||
if(imeSupport)
|
||||
imeSupport->ForceCompositionEnd();
|
||||
nsString format ("text/plain");
|
||||
nsString format; format.AssignWithConversion("text/plain");
|
||||
mEditor->OutputToString(*aText, format, 0);
|
||||
}
|
||||
// we've never built our editor, so the content attribute is the value
|
||||
|
@ -1494,7 +1494,7 @@ nsGfxTextControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
#endif
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer)
|
||||
{
|
||||
nsAutoString text(" ");
|
||||
nsAutoString text; text.AssignWithConversion(" ");
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
PaintTextControl(aPresContext, aRenderingContext, aDirtyRect,
|
||||
text, mStyleContext, rect);
|
||||
|
@ -1511,7 +1511,7 @@ nsGfxTextControlFrame::PaintTextControlBackground(nsIPresContext* aPresContext,
|
|||
// we paint our own border, but everything else is painted by the mDocshell
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer)
|
||||
{
|
||||
nsAutoString text(" ");
|
||||
nsAutoString text; text.AssignWithConversion(" ");
|
||||
nsRect rect(0, 0, mRect.width, mRect.height);
|
||||
PaintTextControl(aPresContext, aRenderingContext, aDirtyRect,
|
||||
text, mStyleContext, rect);
|
||||
|
@ -1629,11 +1629,11 @@ nsGfxTextControlFrame::PaintTextControl(nsIPresContext* aPresContext,
|
|||
//XXX: this needs to be fixed for HTML output
|
||||
void nsGfxTextControlFrame::GetTextControlFrameState(nsString& aValue)
|
||||
{
|
||||
aValue = ""; // initialize out param
|
||||
aValue.SetLength(0); // initialize out param
|
||||
|
||||
if (mEditor && PR_TRUE==IsInitialized())
|
||||
{
|
||||
nsString format ("text/plain");
|
||||
nsString format; format.AssignWithConversion("text/plain");
|
||||
PRUint32 flags = 0;
|
||||
|
||||
if (PR_TRUE==IsPlainTextControl()) {
|
||||
|
@ -1667,7 +1667,7 @@ void nsGfxTextControlFrame::SetTextControlFrameState(const nsString& aValue)
|
|||
if (mEditor && PR_TRUE==IsInitialized())
|
||||
{
|
||||
nsAutoString currentValue;
|
||||
nsAutoString format ("text/plain");
|
||||
nsAutoString format; format.AssignWithConversion("text/plain");
|
||||
nsresult result = mEditor->OutputToString(currentValue, format, 0);
|
||||
if (PR_TRUE==IsSingleLineTextControl()) {
|
||||
RemoveNewlines(currentValue);
|
||||
|
@ -1678,7 +1678,7 @@ void nsGfxTextControlFrame::SetTextControlFrameState(const nsString& aValue)
|
|||
// so convert windows and mac platform linebreaks to \n:
|
||||
// Unfortunately aValue is declared const, so we have to copy
|
||||
// in order to do this substitution.
|
||||
currentValue = aValue;
|
||||
currentValue.Assign(aValue);
|
||||
nsFormControlHelper::PlatformToDOMLineBreaks(currentValue);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument>domDoc;
|
||||
|
@ -2552,7 +2552,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// get the text value, either from input element attribute or cached state
|
||||
nsAutoString value;
|
||||
if (mCachedState) {
|
||||
value = *mCachedState;
|
||||
value.Assign(*mCachedState);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3301,7 +3301,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc
|
|||
// now that the style context is initialized, initialize the content
|
||||
nsAutoString value;
|
||||
if (mCachedState) {
|
||||
value = *mCachedState;
|
||||
value.Assign(*mCachedState);
|
||||
delete mCachedState;
|
||||
mCachedState = nsnull;
|
||||
} else {
|
||||
|
@ -3363,7 +3363,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc
|
|||
if (NS_FAILED(result)) { return result; }
|
||||
if (!selection) { return NS_ERROR_NULL_POINTER; }
|
||||
nsCOMPtr<nsIDOMNode>bodyNode;
|
||||
nsAutoString bodyTag = "body";
|
||||
nsAutoString bodyTag; bodyTag.AssignWithConversion("body");
|
||||
result = GetFirstNodeOfType(bodyTag, aDoc, getter_AddRefs(bodyNode));
|
||||
if (NS_SUCCEEDED(result) && bodyNode)
|
||||
{
|
||||
|
@ -3463,7 +3463,7 @@ nsresult nsGfxTextControlFrame::UpdateTextControlCommands(const nsString& aComma
|
|||
|
||||
if (mEditor)
|
||||
{
|
||||
if (aCommand == nsAutoString("select")) // optimize select updates
|
||||
if (aCommand == NS_ConvertASCIItoUCS2("select")) // optimize select updates
|
||||
{
|
||||
nsCOMPtr<nsIDOMSelection> domSelection;
|
||||
rv = mEditor->GetSelection(getter_AddRefs(domSelection));
|
||||
|
@ -3573,7 +3573,7 @@ nsGfxTextControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aS
|
|||
nsLinebreakConverter::eLinebreakPlatform, nsLinebreakConverter::eLinebreakContent);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "Converting linebreaks failed!");
|
||||
|
||||
(*aState)->SetStateProperty("value", theString);
|
||||
(*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("value"), theString);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -3581,7 +3581,7 @@ NS_IMETHODIMP
|
|||
nsGfxTextControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState)
|
||||
{
|
||||
nsAutoString stateString;
|
||||
aState->GetStateProperty("value", stateString);
|
||||
aState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), stateString);
|
||||
nsresult res = SetProperty(aPresContext, nsHTMLAtoms::value, stateString);
|
||||
return res;
|
||||
}
|
||||
|
@ -4419,7 +4419,7 @@ nsEnderEventListener::Focus(nsIDOMEvent* aEvent)
|
|||
nsGfxTextControlFrame *gfxFrame = mFrame.Reference();
|
||||
|
||||
if (gfxFrame && mContent && mView) {
|
||||
mTextValue = "";
|
||||
mTextValue.SetLength(0);
|
||||
gfxFrame->GetText(&mTextValue, PR_FALSE);
|
||||
}
|
||||
|
||||
|
@ -4594,7 +4594,7 @@ NS_IMETHODIMP nsEnderEventListener::DidDo(nsITransactionManager *aManager,
|
|||
if (undoCount == 1)
|
||||
{
|
||||
if (mFirstDoOfFirstUndo)
|
||||
gfxFrame->UpdateTextControlCommands(nsAutoString("undo"));
|
||||
gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
|
||||
mFirstDoOfFirstUndo = PR_FALSE;
|
||||
}
|
||||
|
@ -4621,7 +4621,7 @@ NS_IMETHODIMP nsEnderEventListener::DidUndo(nsITransactionManager *aManager,
|
|||
if (undoCount == 0)
|
||||
mFirstDoOfFirstUndo = PR_TRUE; // reset the state for the next do
|
||||
|
||||
gfxFrame->UpdateTextControlCommands(nsAutoString("undo"));
|
||||
gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -4640,7 +4640,7 @@ NS_IMETHODIMP nsEnderEventListener::DidRedo(nsITransactionManager *aManager,
|
|||
nsGfxTextControlFrame *gfxFrame = mFrame.Reference();
|
||||
if (gfxFrame)
|
||||
{
|
||||
gfxFrame->UpdateTextControlCommands(nsAutoString("undo"));
|
||||
gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -910,10 +910,10 @@ nsListControlFrame::DisplaySelected(nsIContent* aContent)
|
|||
// The event state manager supports selected states. KMM
|
||||
|
||||
if (PR_TRUE == mIsAllFramesHere) {
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_TRUE);
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_TRUE);
|
||||
//ForceRedraw();
|
||||
} else {
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_FALSE);
|
||||
aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1770,7 +1770,7 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
|
|||
// Ok, so we were restored, now set the last known selections from the restore state.
|
||||
if (hasBeenRestored) {
|
||||
nsCOMPtr<nsISupports> supp;
|
||||
mPresState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp));
|
||||
mPresState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp));
|
||||
|
||||
nsresult res = NS_ERROR_NULL_POINTER;
|
||||
if (!supp)
|
||||
|
@ -1949,7 +1949,7 @@ nsListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame)
|
|||
NS_IMETHODIMP
|
||||
nsListControlFrame::GetSelectedItem(nsString & aStr)
|
||||
{
|
||||
aStr = "";
|
||||
aStr.SetLength(0);
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options = getter_AddRefs(GetOptions(mContent));
|
||||
|
||||
|
@ -2429,7 +2429,7 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
|
|||
if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) {
|
||||
selectedIndex = 0;
|
||||
}
|
||||
aValue.Append(selectedIndex, 10);
|
||||
aValue.AppendInt(selectedIndex, 10);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3364,7 +3364,7 @@ nsListControlFrame::SaveStateInternal(nsIPresContext* aPresContext, nsIPresState
|
|||
}
|
||||
|
||||
NS_NewPresState(aState);
|
||||
(*aState)->SetStatePropertyAsSupports("selecteditems", value);
|
||||
(*aState)->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -1342,7 +1342,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(document));
|
||||
nsresult result;
|
||||
result = domdoc->CreateElement("SPAN",getter_AddRefs(containerElement));//is the literal the correct way?
|
||||
result = domdoc->CreateElement(NS_ConvertASCIItoUCS2("SPAN"),getter_AddRefs(containerElement));//is the literal the correct way?
|
||||
if (NS_SUCCEEDED(result) && containerElement)
|
||||
{
|
||||
containerContent = do_QueryInterface(containerElement);
|
||||
|
|
|
@ -495,7 +495,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
|
|||
// in the excludes list.
|
||||
nsAutoString excludes;
|
||||
content->GetAttribute(kNameSpaceID_None, kExcludesAtom, excludes);
|
||||
if (!excludes.Equals("*")) {
|
||||
if (!excludes.EqualsWithConversion("*")) {
|
||||
if (!excludes.IsEmpty()) {
|
||||
// Walk the children and ensure that all of them
|
||||
// are in the excludes array.
|
||||
|
@ -540,7 +540,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
|
|||
nsCOMPtr<nsIDOMAttr> attr(do_QueryInterface(attribute));
|
||||
nsAutoString name;
|
||||
attr->GetName(name);
|
||||
if (!name.Equals("excludes")) {
|
||||
if (!name.EqualsWithConversion("excludes")) {
|
||||
nsAutoString value;
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mBoundElement));
|
||||
element->GetAttribute(name, value);
|
||||
|
@ -616,7 +616,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement)
|
|||
PRBool useCapture = PR_FALSE;
|
||||
nsAutoString capturer;
|
||||
child->GetAttribute(kNameSpaceID_None, kCapturerAtom, capturer);
|
||||
if (capturer.Equals("true"))
|
||||
if (capturer.EqualsWithConversion("true"))
|
||||
useCapture = PR_TRUE;
|
||||
|
||||
// Add the event listener.
|
||||
|
@ -742,8 +742,9 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
// and then define it as a property.
|
||||
if (!body.IsEmpty()) {
|
||||
void* myFunc;
|
||||
nsCAutoString cname; cname.AssignWithConversion(name.GetUnicode());
|
||||
rv = context->CompileFunction(mScriptObject,
|
||||
name,
|
||||
cname,
|
||||
argCount,
|
||||
(const char**)args,
|
||||
body,
|
||||
|
@ -769,7 +770,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
void* setFunc = nsnull;
|
||||
uintN attrs = 0;
|
||||
|
||||
if (readOnly.Equals("true"))
|
||||
if (readOnly.EqualsWithConversion("true"))
|
||||
attrs |= JSPROP_READONLY;
|
||||
|
||||
if (!getter.IsEmpty()) {
|
||||
|
@ -1139,7 +1140,7 @@ nsXBLBinding::IsInExcludesList(nsIAtom* aTag, const nsString& aList)
|
|||
nsAutoString element;
|
||||
aTag->ToString(element);
|
||||
|
||||
if (aList.Equals("*"))
|
||||
if (aList.EqualsWithConversion("*"))
|
||||
return PR_TRUE; // match _everything_!
|
||||
|
||||
PRInt32 indx = aList.Find(element);
|
||||
|
@ -1185,7 +1186,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement)
|
|||
nsCOMPtr<nsIAtom> attribute;
|
||||
|
||||
// Figure out if this token contains a :.
|
||||
nsAutoString attr(token);
|
||||
nsAutoString attr; attr.AssignWithConversion(token);
|
||||
PRInt32 index = attr.Find(":", PR_TRUE);
|
||||
if (index != -1) {
|
||||
// This attribute maps to something different.
|
||||
|
@ -1281,21 +1282,21 @@ nsXBLBinding::GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound)
|
|||
PRBool
|
||||
nsXBLBinding::IsMouseHandler(const nsString& aName)
|
||||
{
|
||||
return ((aName.Equals("click")) || (aName.Equals("dblclick")) || (aName.Equals("mousedown")) ||
|
||||
(aName.Equals("mouseover")) || (aName.Equals("mouseout")) || (aName.Equals("mouseup")));
|
||||
return ((aName.EqualsWithConversion("click")) || (aName.EqualsWithConversion("dblclick")) || (aName.EqualsWithConversion("mousedown")) ||
|
||||
(aName.EqualsWithConversion("mouseover")) || (aName.EqualsWithConversion("mouseout")) || (aName.EqualsWithConversion("mouseup")));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXBLBinding::IsKeyHandler(const nsString& aName)
|
||||
{
|
||||
return ((aName.Equals("keypress")) || (aName.Equals("keydown")) || (aName.Equals("keyup")));
|
||||
return ((aName.EqualsWithConversion("keypress")) || (aName.EqualsWithConversion("keydown")) || (aName.EqualsWithConversion("keyup")));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXBLBinding::IsXULHandler(const nsString& aName)
|
||||
{
|
||||
return ((aName.Equals("create")) || (aName.Equals("destroy")) || (aName.Equals("broadcast")) ||
|
||||
(aName.Equals("command")) || (aName.Equals("commandupdate")) || (aName.Equals("close")));
|
||||
return ((aName.EqualsWithConversion("create")) || (aName.EqualsWithConversion("destroy")) || (aName.EqualsWithConversion("broadcast")) ||
|
||||
(aName.EqualsWithConversion("command")) || (aName.EqualsWithConversion("commandupdate")) || (aName.EqualsWithConversion("close")));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1304,7 +1305,7 @@ nsXBLBinding::AddScriptEventListener(nsIContent* aElement, nsIAtom* aName, const
|
|||
nsAutoString val;
|
||||
aName->ToString(val);
|
||||
|
||||
nsAutoString eventStr("on");
|
||||
nsAutoString eventStr; eventStr.AssignWithConversion("on");
|
||||
eventStr += val;
|
||||
|
||||
nsCOMPtr<nsIAtom> eventName = getter_AddRefs(NS_NewAtom(eventStr));
|
||||
|
|
|
@ -58,7 +58,7 @@ nsXBLEventHandler::nsXBLEventHandler(nsIContent* aBoundElement, nsIContent* aHan
|
|||
NS_INIT_REFCNT();
|
||||
mBoundElement = aBoundElement;
|
||||
mHandlerElement = aHandlerElement;
|
||||
mEventName = aEventName;
|
||||
mEventName.Assign(aEventName);
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1) {
|
||||
kKeyCodeAtom = NS_NewAtom("keycode");
|
||||
|
@ -101,154 +101,154 @@ nsresult nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent)
|
|||
|
||||
nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
if (!mEventName.Equals("keyup"))
|
||||
if (!mEventName.EqualsWithConversion("keyup"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
if (KeyEventMatched(keyEvent))
|
||||
ExecuteHandler(nsAutoString("keyup"), aKeyEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("keyup"), aKeyEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
if (!mEventName.Equals("keydown"))
|
||||
if (!mEventName.EqualsWithConversion("keydown"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
if (KeyEventMatched(keyEvent))
|
||||
ExecuteHandler(nsAutoString("keydown"), aKeyEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("keydown"), aKeyEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
if (!mEventName.Equals("keypress"))
|
||||
if (!mEventName.EqualsWithConversion("keypress"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
|
||||
if (KeyEventMatched(keyEvent))
|
||||
ExecuteHandler(nsAutoString("keypress"), aKeyEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("keypress"), aKeyEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mousedown"))
|
||||
if (!mEventName.EqualsWithConversion("mousedown"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mousedown"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mousedown"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mouseup"))
|
||||
if (!mEventName.EqualsWithConversion("mouseup"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mouseup"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mouseup"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("click"))
|
||||
if (!mEventName.EqualsWithConversion("click"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("click"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("click"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("dblclick"))
|
||||
if (!mEventName.EqualsWithConversion("dblclick"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("dblclick"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("dblclick"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mouseover"))
|
||||
if (!mEventName.EqualsWithConversion("mouseover"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mouseover"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mouseover"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
if (!mEventName.Equals("mouseout"))
|
||||
if (!mEventName.EqualsWithConversion("mouseout"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (MouseEventMatched(mouseEvent))
|
||||
ExecuteHandler(nsAutoString("mouseout"), aMouseEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("mouseout"), aMouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("command"))
|
||||
if (!mEventName.EqualsWithConversion("command"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("command"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("command"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("create"))
|
||||
if (!mEventName.EqualsWithConversion("create"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("create"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("create"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("close"))
|
||||
if (!mEventName.EqualsWithConversion("close"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("close"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("close"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("broadcast"))
|
||||
if (!mEventName.EqualsWithConversion("broadcast"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("broadcast"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("broadcast"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("commandupdate"))
|
||||
if (!mEventName.EqualsWithConversion("commandupdate"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("commandupdate"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("commandupdate"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mEventName.Equals("destroy"))
|
||||
if (!mEventName.EqualsWithConversion("destroy"))
|
||||
return NS_OK;
|
||||
|
||||
ExecuteHandler(nsAutoString("destroy"), aEvent);
|
||||
ExecuteHandler(NS_ConvertASCIItoUCS2("destroy"), aEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -257,8 +257,8 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
||||
{
|
||||
nsAutoString trueString = "true";
|
||||
nsAutoString falseString = "false";
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
// Get the keycode and charcode of the key event.
|
||||
PRUint32 keyCode, charCode;
|
||||
|
@ -272,12 +272,12 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
if (!key.IsEmpty())
|
||||
keyMatched = IsMatchingCharCode(charCode, key);
|
||||
|
||||
key = "";
|
||||
key.SetLength(0);
|
||||
mHandlerElement->GetAttribute(kNameSpaceID_None, kKeyCodeAtom, key);
|
||||
if (!key.IsEmpty())
|
||||
keyMatched = IsMatchingKeyCode(keyCode, key);
|
||||
|
||||
key = "";
|
||||
key.SetLength(0);
|
||||
mHandlerElement->GetAttribute(kNameSpaceID_None, kCharCodeAtom, key);
|
||||
if (!key.IsEmpty())
|
||||
keyMatched = IsMatchingCharCode(charCode, key);
|
||||
|
@ -374,8 +374,8 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
|
|||
PRBool
|
||||
nsXBLEventHandler::MouseEventMatched(nsIDOMUIEvent* aMouseEvent)
|
||||
{
|
||||
nsAutoString trueString = "true";
|
||||
nsAutoString falseString = "false";
|
||||
nsAutoString trueString; trueString.AssignWithConversion("true");
|
||||
nsAutoString falseString; falseString.AssignWithConversion("false");
|
||||
|
||||
// XXX Check for button and modifier keys.
|
||||
|
||||
|
@ -408,7 +408,7 @@ nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEven
|
|||
|
||||
// Look for a compiled handler on the element.
|
||||
// Should be compiled and bound with "on" in front of the name.
|
||||
nsAutoString onEvent = "onxbl";
|
||||
nsAutoString onEvent; onEvent.AssignWithConversion("onxbl");
|
||||
onEvent += aEventName;
|
||||
nsCOMPtr<nsIAtom> onEventAtom = getter_AddRefs(NS_NewAtom(onEvent));
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ nsXBLEventHandler::IsMatchingCharCode(const PRUint32 aChar, const nsString& aKey
|
|||
char tempChar[2];
|
||||
tempChar[0] = aChar;
|
||||
tempChar[1] = 0;
|
||||
nsAutoString tempChar2 = tempChar;
|
||||
nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar);
|
||||
|
||||
return tempChar2.EqualsIgnoreCase(aKeyName);
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ nsXBLService::nsXBLService(void)
|
|||
static const char kXBLNameSpaceURI[]
|
||||
= "http://www.mozilla.org/xbl";
|
||||
|
||||
rv = gNameSpaceManager->RegisterNameSpace(kXBLNameSpaceURI, kNameSpaceID_XBL);
|
||||
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXBLNameSpaceURI), kNameSpaceID_XBL);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XBL namespace");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
|
@ -272,7 +272,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL)
|
|||
|
||||
if (!binding) {
|
||||
nsCAutoString str = "Failed to locate XBL binding. The invalid binding name is: ";
|
||||
str += aURL;
|
||||
str.AppendWithConversion(aURL);
|
||||
NS_ERROR(str);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
|
|||
if (!root)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString bindingName(ref);
|
||||
nsAutoString bindingName; bindingName.AssignWithConversion( NS_STATIC_CAST(const char*, ref) );
|
||||
|
||||
PRInt32 count;
|
||||
root->ChildCount(count);
|
||||
|
|
|
@ -137,7 +137,7 @@ nsXMLCDATASection::GetTag(nsIAtom*& aResult) const
|
|||
NS_IMETHODIMP
|
||||
nsXMLCDATASection::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
aNodeName.Assign("#cdata-section");
|
||||
aNodeName.AssignWithConversion("#cdata-section");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
// to create an atom.
|
||||
if ((kNameSpaceID_XLink == aNameSpaceID) &&
|
||||
(kTypeAtom == aName)) {
|
||||
if (aValue.Equals(kSimpleAtom, PR_FALSE)) {
|
||||
if (aValue.EqualsAtom(kSimpleAtom, PR_FALSE)) {
|
||||
// NOTE: This really is a link according to the XLink spec,
|
||||
// we do not need to check other attributes. If there
|
||||
// is no href attribute, then this link is simply
|
||||
|
|
|
@ -266,19 +266,19 @@ nsXMLEntity::List(FILE* out, PRInt32 aIndent) const
|
|||
|
||||
nsAutoString tmp(mName);
|
||||
if (mPublicId.Length()) {
|
||||
tmp.Append(" PUBLIC \"");
|
||||
tmp.AppendWithConversion(" PUBLIC \"");
|
||||
tmp.Append(mPublicId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
if (mSystemId.Length()) {
|
||||
tmp.Append(" SYSTEM \"");
|
||||
tmp.AppendWithConversion(" SYSTEM \"");
|
||||
tmp.Append(mSystemId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
if (mNotationName.Length()) {
|
||||
tmp.Append(" NDATA ");
|
||||
tmp.AppendWithConversion(" NDATA ");
|
||||
tmp.Append(mNotationName);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,15 +254,15 @@ nsXMLNotation::List(FILE* out, PRInt32 aIndent) const
|
|||
|
||||
nsAutoString tmp(mName);
|
||||
if (mPublicId.Length()) {
|
||||
tmp.Append(" PUBLIC \"");
|
||||
tmp.AppendWithConversion(" PUBLIC \"");
|
||||
tmp.Append(mPublicId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
if (mSystemId.Length()) {
|
||||
tmp.Append(" SYSTEM \"");
|
||||
tmp.AppendWithConversion(" SYSTEM \"");
|
||||
tmp.Append(mSystemId);
|
||||
tmp.Append("\"");
|
||||
tmp.AppendWithConversion("\"");
|
||||
}
|
||||
|
||||
fputs(tmp, out);
|
||||
|
|
|
@ -1387,9 +1387,9 @@ nsBoxFrame::GetFrameName(nsString& aResult) const
|
|||
if (content)
|
||||
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);
|
||||
|
||||
aResult = "Box[id=";
|
||||
aResult.AssignWithConversion("Box[id=");
|
||||
aResult.Append(id);
|
||||
aResult.Append("]");
|
||||
aResult.AppendWithConversion("]");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1985,9 +1985,9 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox,
|
|||
childFrame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (content) {
|
||||
id = "";
|
||||
kClass = "";
|
||||
tagString = "";
|
||||
id.SetLength(0);
|
||||
kClass.SetLength(0);
|
||||
tagString.SetLength(0);
|
||||
|
||||
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);
|
||||
id.ToCString(idValue,100);
|
||||
|
|
|
@ -1,226 +0,0 @@
|
|||
/* -*- 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.1 (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.org 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
#include "nsColorPickerFrame.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsStdColorPicker.h"
|
||||
#include "nsColorPickerCID.h"
|
||||
#include "nsBoxLayoutState.h"
|
||||
//
|
||||
// NS_NewColorPickerFrame
|
||||
//
|
||||
// Wrapper for creating a new color picker
|
||||
//
|
||||
nsresult
|
||||
NS_NewColorPickerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsColorPickerFrame* it = new (aPresShell) nsColorPickerFrame (aPresShell);
|
||||
if ( !it )
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aNewFrame = it;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static NS_DEFINE_IID(kDefColorPickerCID, NS_DEFCOLORPICKER_CID);
|
||||
|
||||
//
|
||||
// nsColorPickerFrame cntr
|
||||
//
|
||||
|
||||
nsColorPickerFrame::~nsColorPickerFrame()
|
||||
{
|
||||
delete mColorPicker;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsColorPickerFrame::Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
|
||||
nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext,
|
||||
aPrevInFlow);
|
||||
|
||||
|
||||
nsAutoString type;
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, type);
|
||||
|
||||
if (type.EqualsIgnoreCase("swatch") || type.Equals(""))
|
||||
{
|
||||
mColorPicker = new nsStdColorPicker();
|
||||
mColorPicker->Init(mContent);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsColorPickerFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
*aEventStatus = nsEventStatus_eConsumeDoDefault;
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
HandleMouseDownEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsColorPickerFrame::HandleMouseDownEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
int x,y;
|
||||
char *color;
|
||||
// figure out what color we just picked
|
||||
#ifdef DEBUG_pavlov
|
||||
printf("got mouse down.. x = %i, y = %i\n", aEvent->refPoint.x, aEvent->refPoint.y);
|
||||
#endif
|
||||
x = aEvent->refPoint.x;
|
||||
y = aEvent->refPoint.y;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> node( do_QueryInterface(mContent) );
|
||||
|
||||
nsresult rv = mColorPicker->GetColor(x, y, &color);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
node->RemoveAttribute("color");
|
||||
else
|
||||
node->SetAttribute("color", color);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// Paint
|
||||
//
|
||||
//
|
||||
NS_METHOD
|
||||
nsColorPickerFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
float p2t;
|
||||
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
// if we aren't visible then we are done.
|
||||
if (!disp->IsVisibleOrCollapsed())
|
||||
return NS_OK;
|
||||
|
||||
// if we are visible then tell our superclass to paint
|
||||
nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
aWhichLayer);
|
||||
|
||||
// get our border
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
nsMargin border(0,0,0,0);
|
||||
spacing->CalcBorderFor(this, border);
|
||||
|
||||
/*
|
||||
const nsStyleColor* colorStyle = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
nscolor color = colorStyle->mColor;
|
||||
*/
|
||||
|
||||
aRenderingContext.PushState();
|
||||
|
||||
// set the clip region
|
||||
PRInt32 width, height;
|
||||
mColorPicker->GetSize(&width, &height);
|
||||
nsRect rect(0, 0, PRInt32(width*p2t), PRInt32(height*p2t));
|
||||
|
||||
PRBool clipState;
|
||||
|
||||
// Clip so we don't render outside the inner rect
|
||||
aRenderingContext.SetClipRect(rect, nsClipCombine_kIntersect, clipState);
|
||||
|
||||
// call the color picker's paint method
|
||||
mColorPicker->Paint(aPresContext, &aRenderingContext);
|
||||
|
||||
aRenderingContext.PopState(clipState);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsColorPickerFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
{
|
||||
float p2t;
|
||||
|
||||
nsIPresContext* presContext = aBoxLayoutState.GetPresContext();
|
||||
|
||||
presContext->GetScaledPixelsToTwips(&p2t);
|
||||
|
||||
nsSize pixelSize(0,0);
|
||||
mColorPicker->GetSize(&pixelSize.width, &pixelSize.height);
|
||||
|
||||
aSize.width = nscoord(pixelSize.width * p2t);
|
||||
aSize.height = nscoord(pixelSize.height * p2t);
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
//
|
||||
// GetDesiredSize
|
||||
//
|
||||
// For now, be as big as CSS wants us to be, or some small default size.
|
||||
//
|
||||
void
|
||||
nsColorPickerFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
|
||||
} // GetDesiredSize
|
||||
*/
|
|
@ -63,7 +63,7 @@ public:
|
|||
#ifdef NS_DEBUG
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Deck";
|
||||
aResult.AssignWithConversion("Deck");
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -87,12 +87,12 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext)
|
|||
nsCOMPtr<nsIContent> content;
|
||||
splitter->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsString a = "collapsed";
|
||||
nsString a; a.AssignWithConversion("collapsed");
|
||||
nsString value;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::state, value))
|
||||
{
|
||||
if (value.Equals("collapsed"))
|
||||
a = "open";
|
||||
if (value.EqualsWithConversion("collapsed"))
|
||||
a.AssignWithConversion("open");
|
||||
}
|
||||
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, a, PR_TRUE);
|
||||
|
@ -238,6 +238,6 @@ nsGrippyFrame::GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt3
|
|||
NS_IMETHODIMP
|
||||
nsGrippyFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Grippy";
|
||||
aResult.AssignWithConversion("Grippy");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ nsImageBoxFrame::Init(nsIPresContext* aPresContext,
|
|||
// that UpdateAttributes doesn't double start an image load.
|
||||
nsAutoString src;
|
||||
GetImageSource(src);
|
||||
if (!src.Equals("")) {
|
||||
if (!src.IsEmpty()) {
|
||||
mHasImage = PR_TRUE;
|
||||
}
|
||||
mImageLoader.Init(this, UpdateImageFrame, nsnull, baseURL, src);
|
||||
|
@ -215,7 +215,7 @@ nsImageBoxFrame::GetImageSource(nsString& aResult)
|
|||
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::src, aResult);
|
||||
|
||||
// if the new image is empty
|
||||
if (aResult.Equals("")) {
|
||||
if (aResult.IsEmpty()) {
|
||||
// get the list-style-image
|
||||
const nsStyleList* myList =
|
||||
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
|
||||
|
@ -244,7 +244,7 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize)
|
|||
|
||||
// see if the source changed
|
||||
// get the old image src
|
||||
nsAutoString oldSrc ="";
|
||||
nsAutoString oldSrc;
|
||||
mImageLoader.GetURLSpec(oldSrc);
|
||||
|
||||
// get the new image src
|
||||
|
@ -254,7 +254,7 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize)
|
|||
// see if the images are different
|
||||
if (!oldSrc.Equals(src)) {
|
||||
|
||||
if (!src.Equals("")) {
|
||||
if (!src.IsEmpty()) {
|
||||
mSizeFrozen = PR_FALSE;
|
||||
mHasImage = PR_TRUE;
|
||||
} else {
|
||||
|
@ -442,6 +442,6 @@ nsImageBoxFrame::CacheImageSize(nsBoxLayoutState& aState)
|
|||
NS_IMETHODIMP
|
||||
nsImageBoxFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "ImageBox";
|
||||
aResult.AssignWithConversion("ImageBox");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ nsLeafBoxFrame::Reflow(nsIPresContext* aPresContext,
|
|||
NS_IMETHODIMP
|
||||
nsLeafBoxFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "LeafBox";
|
||||
aResult.AssignWithConversion("LeafBox");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,12 +125,12 @@ nsMenuBarFrame::Init(nsIPresContext* aPresContext,
|
|||
// Also hook up the listener to the window listening for focus events. This is so we can keep proper
|
||||
// state as the user alt-tabs through processes.
|
||||
|
||||
target->AddEventListener("keypress", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
target->AddEventListener("keydown", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
target->AddEventListener("keyup", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
|
||||
target->AddEventListener("mousedown", (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE);
|
||||
target->AddEventListener("blur", (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("mousedown"), (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("blur"), (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -157,9 +157,9 @@ nsMenuBarFrame::SetActive(PRBool aActiveFlag)
|
|||
InstallKeyboardNavigator();
|
||||
}
|
||||
else if (mKeyboardNavigator) {
|
||||
mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
|
||||
NS_IF_RELEASE(mKeyboardNavigator);
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ nsMenuBarFrame::FindMenuWithShortcut(PRUint32 aLetter)
|
|||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
// Get the shortcut attribute.
|
||||
nsString shortcutKey = "";
|
||||
nsString shortcutKey;
|
||||
current->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey, shortcutKey);
|
||||
shortcutKey.ToUpperCase();
|
||||
if (shortcutKey.Length() > 0) {
|
||||
|
@ -228,7 +228,7 @@ nsMenuBarFrame::FindMenuWithShortcut(PRUint32 aLetter)
|
|||
char tempChar[2];
|
||||
tempChar[0] = aLetter;
|
||||
tempChar[1] = 0;
|
||||
nsAutoString tempChar2 = tempChar;
|
||||
nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar);
|
||||
|
||||
if (shortcutKey.EqualsIgnoreCase(tempChar2)) {
|
||||
// We match!
|
||||
|
@ -608,9 +608,9 @@ nsMenuBarFrame::InstallKeyboardNavigator()
|
|||
mKeyboardNavigator = new nsMenuListener(this);
|
||||
NS_IF_ADDREF(mKeyboardNavigator);
|
||||
|
||||
mTarget->AddEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->AddEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->AddEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->AddEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->AddEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->AddEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -621,9 +621,9 @@ nsMenuBarFrame::RemoveKeyboardNavigator()
|
|||
if (!mKeyboardNavigator || mIsActive)
|
||||
return NS_OK;
|
||||
|
||||
mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
|
||||
NS_IF_RELEASE(mKeyboardNavigator);
|
||||
|
||||
|
@ -648,9 +648,9 @@ nsMenuBarFrame::IsValidItem(nsIContent* aContent)
|
|||
PRBool
|
||||
nsMenuBarFrame::IsDisabled(nsIContent* aContent)
|
||||
{
|
||||
nsString disabled = "";
|
||||
nsString disabled;
|
||||
aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
|
||||
if (disabled.Equals("true"))
|
||||
if (disabled.EqualsWithConversion("true"))
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -658,12 +658,12 @@ nsMenuBarFrame::IsDisabled(nsIContent* aContent)
|
|||
NS_IMETHODIMP
|
||||
nsMenuBarFrame::Destroy(nsIPresContext* aPresContext)
|
||||
{
|
||||
mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);
|
||||
|
||||
mTarget->RemoveEventListener("mousedown", (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE);
|
||||
mTarget->RemoveEventListener("blur", (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("mousedown"), (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("blur"), (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE);
|
||||
|
||||
NS_IF_RELEASE(mMenuBarListener);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "MenuBar";
|
||||
aResult.AssignWithConversion("MenuBar");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,8 +119,7 @@ nsMenuFrame::nsMenuFrame(nsIPresShell* aShell):nsBoxFrame(aShell),
|
|||
mChecked(PR_FALSE),
|
||||
mType(eMenuType_Normal),
|
||||
mMenuParent(nsnull),
|
||||
mPresContext(nsnull),
|
||||
mGroupName("")
|
||||
mPresContext(nsnull)
|
||||
{
|
||||
|
||||
} // cntr
|
||||
|
@ -237,7 +236,7 @@ nsMenuFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
// This allows selective overriding for subcontent.
|
||||
nsAutoString value;
|
||||
content->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, value);
|
||||
if (value.Equals("true"))
|
||||
if (value.EqualsWithConversion("true"))
|
||||
return result;
|
||||
}
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
|
@ -302,7 +301,7 @@ nsMenuFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
PR_TRUE);
|
||||
}
|
||||
else {
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, nsAutoString("true"),
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("true"),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
|
@ -391,7 +390,7 @@ nsMenuFrame::SelectMenu(PRBool aActivateFlag)
|
|||
{
|
||||
if (aActivateFlag) {
|
||||
// Highlight the menu.
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE);
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, NS_ConvertASCIItoUCS2("true"), PR_TRUE);
|
||||
}
|
||||
else {
|
||||
// Unhighlight the menu.
|
||||
|
@ -432,7 +431,7 @@ nsMenuFrame::MarkAsGenerated()
|
|||
nsAutoString genVal;
|
||||
child->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, genVal);
|
||||
if (genVal.IsEmpty())
|
||||
child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, "true", PR_TRUE);
|
||||
child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, NS_ConvertASCIItoUCS2("true"), PR_TRUE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -452,7 +451,7 @@ nsMenuFrame::ActivateMenu(PRBool aActivateFlag)
|
|||
// We wait until the last possible moment to show to avoid flashing, but we can just go
|
||||
// ahead and hide it here if we're told to (no additional stages necessary).
|
||||
if (aActivateFlag)
|
||||
child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, "true", PR_TRUE);
|
||||
child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, NS_ConvertASCIItoUCS2("true"), PR_TRUE);
|
||||
else {
|
||||
child->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, PR_TRUE);
|
||||
child->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, PR_TRUE);
|
||||
|
@ -473,7 +472,7 @@ nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
if (aAttribute == nsXULAtoms::open) {
|
||||
aChild->GetAttribute(kNameSpaceID_None, aAttribute, value);
|
||||
if (value.Equals("true"))
|
||||
if (value.EqualsWithConversion("true"))
|
||||
OpenMenuInternal(PR_TRUE);
|
||||
else
|
||||
OpenMenuInternal(PR_FALSE);
|
||||
|
@ -495,9 +494,9 @@ nsMenuFrame::OpenMenu(PRBool aActivateFlag)
|
|||
// Mark it as generated, which ensures a frame gets built.
|
||||
MarkAsGenerated();
|
||||
|
||||
domElement->SetAttribute("open", "true");
|
||||
domElement->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true"));
|
||||
}
|
||||
else domElement->RemoveAttribute("open");
|
||||
else domElement->RemoveAttribute(NS_ConvertASCIItoUCS2("open"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -578,15 +577,15 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag)
|
|||
|
||||
if (onMenuBar) {
|
||||
if (popupAnchor.IsEmpty())
|
||||
popupAnchor = "bottomleft";
|
||||
popupAnchor.AssignWithConversion("bottomleft");
|
||||
if (popupAlign.IsEmpty())
|
||||
popupAlign = "topleft";
|
||||
popupAlign.AssignWithConversion("topleft");
|
||||
}
|
||||
else {
|
||||
if (popupAnchor.IsEmpty())
|
||||
popupAnchor = "topright";
|
||||
popupAnchor.AssignWithConversion("topright");
|
||||
if (popupAlign.IsEmpty())
|
||||
popupAlign = "topleft";
|
||||
popupAlign.AssignWithConversion("topleft");
|
||||
}
|
||||
|
||||
menuPopup->SyncViewWithFrame(mPresContext, popupAnchor, popupAlign, this, -1, -1);
|
||||
|
@ -887,15 +886,15 @@ nsMenuFrame::LayoutFinished(nsBoxLayoutState& aState)
|
|||
|
||||
if (onMenuBar) {
|
||||
if (popupAnchor.IsEmpty())
|
||||
popupAnchor = "bottomleft";
|
||||
popupAnchor.AssignWithConversion("bottomleft");
|
||||
if (popupAlign.IsEmpty())
|
||||
popupAlign = "topleft";
|
||||
popupAlign.AssignWithConversion("topleft");
|
||||
}
|
||||
else {
|
||||
if (popupAnchor.IsEmpty())
|
||||
popupAnchor = "topright";
|
||||
popupAnchor.AssignWithConversion("topright");
|
||||
if (popupAlign.IsEmpty())
|
||||
popupAlign = "topleft";
|
||||
popupAlign.AssignWithConversion("topleft");
|
||||
}
|
||||
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
|
@ -992,9 +991,9 @@ nsMenuFrame::Notify(nsITimer* aTimer)
|
|||
// Our timer has fired.
|
||||
if (aTimer == mOpenTimer.get()) {
|
||||
if (!mMenuOpen && mMenuParent) {
|
||||
nsAutoString active = "";
|
||||
nsAutoString active;
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, active);
|
||||
if (active.Equals("true")) {
|
||||
if (active.EqualsWithConversion("true")) {
|
||||
// We're still the active menu.
|
||||
OpenMenu(PR_TRUE);
|
||||
}
|
||||
|
@ -1011,7 +1010,7 @@ nsMenuFrame::IsDisabled()
|
|||
{
|
||||
nsAutoString disabled;
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
|
||||
if (disabled.Equals("true"))
|
||||
if (disabled.EqualsWithConversion("true"))
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -1021,9 +1020,9 @@ nsMenuFrame::UpdateMenuType(nsIPresContext* aPresContext)
|
|||
{
|
||||
nsAutoString value;
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, value);
|
||||
if (value.Equals("checkbox"))
|
||||
if (value.EqualsWithConversion("checkbox"))
|
||||
mType = eMenuType_Checkbox;
|
||||
else if (value.Equals("radio")) {
|
||||
else if (value.EqualsWithConversion("radio")) {
|
||||
mType = eMenuType_Radio;
|
||||
|
||||
nsAutoString valueName;
|
||||
|
@ -1048,7 +1047,7 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) {
|
|||
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked,
|
||||
value);
|
||||
newChecked = (value.Equals("true"));
|
||||
newChecked = (value.EqualsWithConversion("true"));
|
||||
|
||||
if (newChecked == mChecked) {
|
||||
/* checked state didn't change */
|
||||
|
@ -1172,17 +1171,17 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
|
|||
if (!keyElement)
|
||||
return;
|
||||
|
||||
nsAutoString keyAtom("key");
|
||||
nsAutoString shiftAtom("shift");
|
||||
nsAutoString altAtom("alt");
|
||||
nsAutoString commandAtom("command");
|
||||
nsAutoString controlAtom("control");
|
||||
nsAutoString keyAtom; keyAtom.AssignWithConversion("key");
|
||||
nsAutoString shiftAtom; shiftAtom.AssignWithConversion("shift");
|
||||
nsAutoString altAtom; altAtom.AssignWithConversion("alt");
|
||||
nsAutoString commandAtom; commandAtom.AssignWithConversion("command");
|
||||
nsAutoString controlAtom; controlAtom.AssignWithConversion("control");
|
||||
|
||||
nsAutoString shiftValue;
|
||||
nsAutoString altValue;
|
||||
nsAutoString commandValue;
|
||||
nsAutoString controlValue;
|
||||
nsAutoString keyChar = " ";
|
||||
nsAutoString keyChar; keyChar.AssignWithConversion(" ");
|
||||
|
||||
keyElement->GetAttribute(keyAtom, keyChar);
|
||||
keyElement->GetAttribute(shiftAtom, shiftValue);
|
||||
|
@ -1191,11 +1190,11 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
|
|||
keyElement->GetAttribute(controlAtom, controlValue);
|
||||
|
||||
nsAutoString xulkey;
|
||||
keyElement->GetAttribute(nsAutoString("xulkey"), xulkey);
|
||||
if (xulkey.Equals("true")) {
|
||||
keyElement->GetAttribute(NS_ConvertASCIItoUCS2("xulkey"), xulkey);
|
||||
if (xulkey.EqualsWithConversion("true")) {
|
||||
// Set the default for the xul key modifier
|
||||
#ifdef XP_MAC
|
||||
commandValue = "true";
|
||||
commandValue.AssignWithConversion("true");
|
||||
#elif defined(XP_PC) || defined(NTO)
|
||||
controlValue = "true";
|
||||
#else
|
||||
|
@ -1205,34 +1204,34 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
|
|||
|
||||
PRBool prependPlus = PR_FALSE;
|
||||
|
||||
if(!commandValue.IsEmpty() && !commandValue.Equals("false")) {
|
||||
if(!commandValue.IsEmpty() && !commandValue.EqualsWithConversion("false")) {
|
||||
prependPlus = PR_TRUE;
|
||||
aAccelString += "Ctrl"; // Hmmm. Kinda defeats the point of having an abstraction.
|
||||
aAccelString.AppendWithConversion("Ctrl"); // Hmmm. Kinda defeats the point of having an abstraction.
|
||||
}
|
||||
|
||||
if(!controlValue.IsEmpty() && !controlValue.Equals("false")) {
|
||||
if(!controlValue.IsEmpty() && !controlValue.EqualsWithConversion("false")) {
|
||||
prependPlus = PR_TRUE;
|
||||
aAccelString += "Ctrl";
|
||||
aAccelString.AppendWithConversion("Ctrl");
|
||||
}
|
||||
|
||||
if(!shiftValue.IsEmpty() && !shiftValue.Equals("false")) {
|
||||
if(!shiftValue.IsEmpty() && !shiftValue.EqualsWithConversion("false")) {
|
||||
if (prependPlus)
|
||||
aAccelString += "+";
|
||||
aAccelString.AppendWithConversion("+");
|
||||
prependPlus = PR_TRUE;
|
||||
aAccelString += "Shift";
|
||||
aAccelString.AppendWithConversion("Shift");
|
||||
}
|
||||
|
||||
if (!altValue.IsEmpty() && !altValue.Equals("false")) {
|
||||
if (!altValue.IsEmpty() && !altValue.EqualsWithConversion("false")) {
|
||||
if (prependPlus)
|
||||
aAccelString += "+";
|
||||
aAccelString.AppendWithConversion("+");
|
||||
prependPlus = PR_TRUE;
|
||||
aAccelString += "Alt";
|
||||
aAccelString.AppendWithConversion("Alt");
|
||||
}
|
||||
|
||||
keyChar.ToUpperCase();
|
||||
if (!keyChar.IsEmpty()) {
|
||||
if (prependPlus)
|
||||
aAccelString += "+";
|
||||
aAccelString.AppendWithConversion("+");
|
||||
prependPlus = PR_TRUE;
|
||||
aAccelString += keyChar;
|
||||
}
|
||||
|
@ -1450,7 +1449,7 @@ nsMenuFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
if (!element) {
|
||||
nsAutoString value;
|
||||
menulist->GetValue(value);
|
||||
if (value == "") {
|
||||
if (value.IsEmpty()) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
GetMenuChildrenElement(getter_AddRefs(child));
|
||||
if (child) {
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Menu";
|
||||
aResult.AssignWithConversion("Menu");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -319,35 +319,35 @@ nsMenuPopupFrame :: AdjustPositionForAnchorAlign ( PRInt32* ioXPos, PRInt32* ioY
|
|||
const nsString& aPopupAnchor, const nsString& aPopupAlign,
|
||||
PRBool* outFlushWithTopBottom )
|
||||
{
|
||||
if (aPopupAnchor.Equals("topright") && aPopupAlign.Equals("topleft")) {
|
||||
if (aPopupAnchor.EqualsWithConversion("topright") && aPopupAlign.EqualsWithConversion("topleft")) {
|
||||
*ioXPos += inParentRect.width;
|
||||
}
|
||||
else if (aPopupAnchor.Equals("topright") && aPopupAlign.Equals("bottomright")) {
|
||||
else if (aPopupAnchor.EqualsWithConversion("topright") && aPopupAlign.EqualsWithConversion("bottomright")) {
|
||||
*ioXPos -= (mRect.width - inParentRect.width);
|
||||
*ioYPos -= mRect.height;
|
||||
*outFlushWithTopBottom = PR_TRUE;
|
||||
}
|
||||
else if (aPopupAnchor.Equals("bottomright") && aPopupAlign.Equals("bottomleft")) {
|
||||
else if (aPopupAnchor.EqualsWithConversion("bottomright") && aPopupAlign.EqualsWithConversion("bottomleft")) {
|
||||
*ioXPos += inParentRect.width;
|
||||
*ioYPos -= (mRect.height - inParentRect.height);
|
||||
}
|
||||
else if (aPopupAnchor.Equals("bottomright") && aPopupAlign.Equals("topright")) {
|
||||
else if (aPopupAnchor.EqualsWithConversion("bottomright") && aPopupAlign.EqualsWithConversion("topright")) {
|
||||
*ioXPos -= (mRect.width - inParentRect.width);
|
||||
*ioYPos += inParentRect.height;
|
||||
*outFlushWithTopBottom = PR_TRUE;
|
||||
}
|
||||
else if (aPopupAnchor.Equals("topleft") && aPopupAlign.Equals("topright")) {
|
||||
else if (aPopupAnchor.EqualsWithConversion("topleft") && aPopupAlign.EqualsWithConversion("topright")) {
|
||||
*ioXPos -= mRect.width;
|
||||
}
|
||||
else if (aPopupAnchor.Equals("topleft") && aPopupAlign.Equals("bottomleft")) {
|
||||
else if (aPopupAnchor.EqualsWithConversion("topleft") && aPopupAlign.EqualsWithConversion("bottomleft")) {
|
||||
*ioYPos -= mRect.height;
|
||||
*outFlushWithTopBottom = PR_TRUE;
|
||||
}
|
||||
else if (aPopupAnchor.Equals("bottomleft") && aPopupAlign.Equals("bottomright")) {
|
||||
else if (aPopupAnchor.EqualsWithConversion("bottomleft") && aPopupAlign.EqualsWithConversion("bottomright")) {
|
||||
*ioXPos -= mRect.width;
|
||||
*ioYPos -= (mRect.height - inParentRect.height);
|
||||
}
|
||||
else if (aPopupAnchor.Equals("bottomleft") && aPopupAlign.Equals("topleft")) {
|
||||
else if (aPopupAnchor.EqualsWithConversion("bottomleft") && aPopupAlign.EqualsWithConversion("topleft")) {
|
||||
*ioYPos += inParentRect.height;
|
||||
*outFlushWithTopBottom = PR_TRUE;
|
||||
}
|
||||
|
@ -709,10 +709,10 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
|||
|
||||
nsAutoString shouldDisplay, menuActive;
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, menuActive);
|
||||
if (!menuActive.Equals("true")) {
|
||||
if (!menuActive.EqualsWithConversion("true")) {
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, shouldDisplay);
|
||||
if ( shouldDisplay.Equals("true") )
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE);
|
||||
if ( shouldDisplay.EqualsWithConversion("true") )
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, NS_ConvertASCIItoUCS2("true"), PR_TRUE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -972,14 +972,14 @@ nsMenuPopupFrame::FindMenuWithShortcut(PRUint32 aLetter)
|
|||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
// Get the shortcut attribute.
|
||||
nsAutoString shortcutKey = "";
|
||||
nsAutoString shortcutKey;
|
||||
current->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey, shortcutKey);
|
||||
if (shortcutKey.Length() > 0) {
|
||||
// We've got something.
|
||||
char tempChar[2];
|
||||
tempChar[0] = aLetter;
|
||||
tempChar[1] = 0;
|
||||
nsAutoString tempChar2 = tempChar;
|
||||
nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar);
|
||||
|
||||
if (shortcutKey.EqualsIgnoreCase(tempChar2)) {
|
||||
// We match!
|
||||
|
@ -1210,9 +1210,9 @@ nsMenuPopupFrame::InstallKeyboardNavigator()
|
|||
mKeyboardNavigator = new nsMenuListener(this);
|
||||
NS_IF_ADDREF(mKeyboardNavigator);
|
||||
|
||||
target->AddEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
target->AddEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
target->AddEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1223,9 +1223,9 @@ nsMenuPopupFrame::RemoveKeyboardNavigator()
|
|||
if (!mKeyboardNavigator)
|
||||
return NS_OK;
|
||||
|
||||
mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);
|
||||
|
||||
NS_IF_RELEASE(mKeyboardNavigator);
|
||||
|
||||
|
@ -1249,9 +1249,9 @@ nsMenuPopupFrame::IsValidItem(nsIContent* aContent)
|
|||
PRBool
|
||||
nsMenuPopupFrame::IsDisabled(nsIContent* aContent)
|
||||
{
|
||||
nsString disabled = "";
|
||||
nsString disabled;
|
||||
aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
|
||||
if (disabled.Equals("true"))
|
||||
if (disabled.EqualsWithConversion("true"))
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "MenuPopup";
|
||||
aResult.AssignWithConversion("MenuPopup");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -376,9 +376,9 @@ nsPopupSetFrame::LayoutFinished(nsBoxLayoutState& aState)
|
|||
menuPopupContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::popupalign, popupAlign);
|
||||
|
||||
if (popupAnchor.IsEmpty())
|
||||
popupAnchor = "bottomleft";
|
||||
popupAnchor.AssignWithConversion("bottomleft");
|
||||
if (popupAlign.IsEmpty())
|
||||
popupAlign = "topleft";
|
||||
popupAlign.AssignWithConversion("topleft");
|
||||
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
((nsMenuPopupFrame*)activeChild)->SyncViewWithFrame(presContext, popupAnchor, popupAlign, mElementFrame, mXPos, mYPos);
|
||||
|
@ -483,7 +483,7 @@ nsPopupSetFrame::CreatePopup(nsIFrame* aElementFrame, nsIContent* aPopupContent,
|
|||
// determine if this menu is a context menu and flag it
|
||||
nsIFrame* activeChild = GetActiveChild();
|
||||
nsCOMPtr<nsIMenuParent> childPopup ( do_QueryInterface(activeChild) );
|
||||
if ( childPopup && aPopupType.Equals("context") )
|
||||
if ( childPopup && aPopupType.EqualsWithConversion("context") )
|
||||
childPopup->SetIsContextMenu(PR_TRUE);
|
||||
|
||||
// Now we'll have it in our child frame list.
|
||||
|
@ -523,7 +523,7 @@ nsPopupSetFrame::MarkAsGenerated(nsIContent* aPopupContent)
|
|||
nsAutoString value;
|
||||
childContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated,
|
||||
value);
|
||||
if (value.Equals("true")) {
|
||||
if (value.EqualsWithConversion("true")) {
|
||||
// Ungenerate this element.
|
||||
childContent->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated,
|
||||
PR_TRUE);
|
||||
|
@ -535,9 +535,9 @@ nsPopupSetFrame::MarkAsGenerated(nsIContent* aPopupContent)
|
|||
nsAutoString value;
|
||||
aPopupContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated,
|
||||
value);
|
||||
if (!value.Equals("true")) {
|
||||
if (!value.EqualsWithConversion("true")) {
|
||||
// Generate this element.
|
||||
aPopupContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, "true",
|
||||
aPopupContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, NS_ConvertASCIItoUCS2("true"),
|
||||
PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ nsPopupSetFrame::ActivatePopup(PRBool aActivateFlag)
|
|||
// We wait until the last possible moment to show to avoid flashing, but we can just go
|
||||
// ahead and hide it here if we're told to (no additional stages necessary).
|
||||
if (aActivateFlag)
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, "true", PR_TRUE);
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, NS_ConvertASCIItoUCS2("true"), PR_TRUE);
|
||||
else {
|
||||
content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, PR_TRUE);
|
||||
content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, PR_TRUE);
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "PopupSet";
|
||||
aResult.AssignWithConversion("PopupSet");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,8 +122,8 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
PRInt32 remainder = 100 - flex;
|
||||
|
||||
nsAutoString leftFlex, rightFlex;
|
||||
leftFlex.Append(flex);
|
||||
rightFlex.Append(remainder);
|
||||
leftFlex.AppendInt(flex);
|
||||
rightFlex.AppendInt(remainder);
|
||||
progressBar->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, leftFlex, PR_TRUE);
|
||||
progressRemainder->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, rightFlex, PR_TRUE);
|
||||
}
|
||||
|
|
|
@ -156,9 +156,9 @@ nsScrollbarButtonFrame::MouseClicked()
|
|||
{
|
||||
// if our class is DecrementButton subtract the current pos by increment amount
|
||||
// if our class is IncrementButton increment the current pos by the decrement amount
|
||||
if (value.Equals("decrement"))
|
||||
if (value.EqualsWithConversion("decrement"))
|
||||
curpos -= increment;
|
||||
else if (value.Equals("increment"))
|
||||
else if (value.EqualsWithConversion("increment"))
|
||||
curpos += increment;
|
||||
|
||||
// make sure the current positon is between the current and max positions
|
||||
|
@ -171,7 +171,7 @@ nsScrollbarButtonFrame::MouseClicked()
|
|||
char v[100];
|
||||
sprintf(v, "%d", curpos);
|
||||
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, v, PR_TRUE);
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2(v), PR_TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
sprintf(ch,"%d", current);
|
||||
|
||||
// set the new position but don't notify anyone. We already know
|
||||
scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_FALSE);
|
||||
scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2(ch), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -614,7 +614,7 @@ nsSliderFrame::SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame,
|
|||
sprintf(ch,"%d", newpos);
|
||||
|
||||
// set the new position
|
||||
scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_TRUE);
|
||||
scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2(ch), PR_TRUE);
|
||||
|
||||
if (DEBUG_SLIDER)
|
||||
printf("Current Pos=%s\n",ch);
|
||||
|
|
|
@ -276,7 +276,7 @@ nsSplitterFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
// create a spring
|
||||
nsCOMPtr<nsIContent> content;
|
||||
NS_CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, content);
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, "100%", PR_FALSE);
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, NS_ConvertASCIItoUCS2("100%"), PR_FALSE);
|
||||
aAnonymousChildren.AppendElement(content);
|
||||
|
||||
// a grippy
|
||||
|
@ -285,7 +285,7 @@ nsSplitterFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|||
|
||||
// create a spring
|
||||
NS_CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, content);
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, "100%", PR_FALSE);
|
||||
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, NS_ConvertASCIItoUCS2("100%"), PR_FALSE);
|
||||
aAnonymousChildren.AppendElement(content);
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ nsSplitterFrameInner::MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent)
|
|||
State newState = GetState();
|
||||
// if the state is dragging then make it Open.
|
||||
if (newState == Dragging)
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "", PR_TRUE);
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, nsAutoString(), PR_TRUE);
|
||||
|
||||
mPressed = PR_FALSE;
|
||||
|
||||
|
@ -586,7 +586,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent
|
|||
//printf("Collapse right\n");
|
||||
if (GetCollapseDirection() == After)
|
||||
{
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE);
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("collapsed"), PR_TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
@ -595,7 +595,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent
|
|||
//printf("Collapse left\n");
|
||||
if (GetCollapseDirection() == Before)
|
||||
{
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE);
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("collapsed"), PR_TRUE);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent
|
|||
// if we are not in a collapsed position and we are not dragging make sure
|
||||
// we are dragging.
|
||||
if (currentState != Dragging)
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "dragging", PR_TRUE);
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("dragging"), PR_TRUE);
|
||||
|
||||
#ifdef REAL_TIME_DRAG
|
||||
AdjustChildren(aPresContext);
|
||||
|
@ -879,7 +879,7 @@ nsSplitterFrameInner::MouseMove(nsIDOMEvent* aMouseEvent)
|
|||
if (IsMouseCaptured(mOuter->mPresContext))
|
||||
return NS_OK;
|
||||
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "dragging", PR_TRUE);
|
||||
mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("dragging"), PR_TRUE);
|
||||
|
||||
RemoveListener();
|
||||
CaptureMouse(mOuter->mPresContext, PR_TRUE);
|
||||
|
@ -957,7 +957,7 @@ nsSplitterFrameInner::UpdateState()
|
|||
// Open -> Collapsed
|
||||
// Dragging -> Collapsed
|
||||
sibling->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed,
|
||||
"true", PR_TRUE);
|
||||
NS_ConvertASCIItoUCS2("true"), PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1144,10 +1144,10 @@ nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildB
|
|||
sprintf(ch,"%d",pref/aOnePixel);
|
||||
nsAutoString oldValue;
|
||||
content->GetAttribute(kNameSpaceID_None, attribute, oldValue);
|
||||
if (oldValue == ch)
|
||||
if (oldValue.EqualsWithConversion(ch))
|
||||
return;
|
||||
|
||||
content->SetAttribute(kNameSpaceID_None, attribute, ch, PR_FALSE);
|
||||
content->SetAttribute(kNameSpaceID_None, attribute, NS_ConvertASCIItoUCS2(ch), PR_FALSE);
|
||||
#ifndef REAL_TIME_DRAG
|
||||
aChildBox->MarkDirty(aState);
|
||||
#else
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Spring";
|
||||
aResult.AssignWithConversion("Spring");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
#ifdef NS_DEBUG
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Stack";
|
||||
aResult.AssignWithConversion("Stack");
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,256 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (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/MPL/
|
||||
*
|
||||
* 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 the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsStdColorPicker.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
static char *NosePalette[] = {
|
||||
"#00FF00","#00ED00","#00DB00","#00C900","#00B700","#00A500","#009300","#008100","#006F00","#005D00",
|
||||
"#FFFF00","#EDED00","#DBDB00","#C9C900","#B7B700","#A5A500","#939300","#818100","#6F6F00","#5D5D00",
|
||||
"#FFFF00","#F5ED00","#EBDB00","#E1C900","#D7B700","#CDA500","#C39300","#B98100","#AF6F00","#A55D00"
|
||||
};
|
||||
|
||||
static char* StandardPalette[] = {
|
||||
"#FFFFFF","#FFCCCC","#FFCC99","#FFFF99","#FFFFCC","#99FF99","#99FFFF","#CCFFFF","#CCCCFF","#FFCCFF",
|
||||
"#CCCCCC","#FF6666","#FFCC33","#FFFF66","#FFFF99","#66FF99","#33FFFF","#66FFFF","#9999FF","#FF99FF",
|
||||
"#C0C0C0","#FF0000","#FF9900","#FFCC66","#FFFF00","#33FF33","#66CCCC","#33CCFF","#6666CC","#CC66CC",
|
||||
"#999999","#CC0000","#FF6600","#FFCC33","#FFCC00","#33CC00","#00CCCC","#3366FF","#6633FF","#CC33CC",
|
||||
"#666666","#990000","#CC6600","#CC9933","#999900","#009900","#339999","#3333FF","#6600CC","#993399",
|
||||
"#333333","#660000","#993300","#996633","#666600","#006600","#336666","#000099","#333399","#663366",
|
||||
"#000000","#330000","#663300","#663333","#333300","#003300","#003333","#000066","#330099","#330033"
|
||||
};
|
||||
|
||||
static char *WebPalette[] = {
|
||||
"#FFFFFF", "#FFFFCC", "#FFFF99", "#FFFF66", "#FFFF33", "#FFFF00", "#FFCCFF", "#FFCCCC",
|
||||
"#FFCC99", "#FFCC66", "#FFCC33", "#FFCC00", "#FF99FF", "#FF99CC", "#FF9999", "#FF9966",
|
||||
"#FF9933", "#FF9900", "#FF66FF", "#FF66CC", "#FF6699", "#FF6666", "#FF6633", "#FF6600",
|
||||
"#FF33FF", "#FF33CC", "#FF3399", "#FF3366", "#FF3333", "#FF3300", "#FF00FF", "#FF00CC",
|
||||
"#FF0099", "#FF0066", "#FF0033", "#FF0000", "#CCFFFF", "#CCFFCC", "#CCFF99", "#CCFF66",
|
||||
"#CCFF33", "#CCFF00", "#CCCCFF", "#CCCCCC", "#CCCC99", "#CCCC66", "#CCCC33", "#CCCC00",
|
||||
"#CC99FF", "#CC99CC", "#CC9999", "#CC9966", "#CC9933", "#CC9900", "#CC66FF", "#CC66CC",
|
||||
"#CC6699", "#CC6666", "#CC6633", "#CC6600", "#CC33FF", "#CC33CC", "#CC3399", "#CC3366",
|
||||
"#CC3333", "#CC3300", "#CC00FF", "#CC00CC", "#CC0099", "#CC0066", "#CC0033", "#CC0000",
|
||||
"#99FFFF", "#99FFCC", "#99FF99", "#99FF66", "#99FF33", "#99FF00", "#99CCFF", "#99CCCC",
|
||||
"#99CC99", "#99CC66", "#99CC33", "#99CC00", "#9999FF", "#9999CC", "#999999", "#999966",
|
||||
"#999933", "#999900", "#9966FF", "#9966CC", "#996699", "#996666", "#996633", "#996600",
|
||||
"#9933FF", "#9933CC", "#993399", "#993366", "#993333", "#993300", "#9900FF", "#9900CC",
|
||||
"#990099", "#990066", "#990033", "#990000", "#66FFFF", "#66FFCC", "#66FF99", "#66FF66",
|
||||
"#66FF33", "#66FF00", "#66CCFF", "#66CCCC", "#66CC99", "#66CC66", "#66CC33", "#66CC00",
|
||||
"#6699FF", "#6699CC", "#669999", "#669966", "#669933", "#669900", "#6666FF", "#6666CC",
|
||||
"#666699", "#666666", "#666633", "#666600", "#6633FF", "#6633CC", "#663399", "#663366",
|
||||
"#663333", "#663300", "#6600FF", "#6600CC", "#660099", "#660066", "#660033", "#660000",
|
||||
"#33FFFF", "#33FFCC", "#33FF99", "#33FF66", "#33FF33", "#33FF00", "#33CCFF", "#33CCCC",
|
||||
"#33CC99", "#33CC66", "#33CC33", "#33CC00", "#3399FF", "#3399CC", "#339999", "#339966",
|
||||
"#339933", "#339900", "#3366FF", "#3366CC", "#336699", "#336666", "#336633", "#336600",
|
||||
"#3333FF", "#3333CC", "#333399", "#333366", "#333333", "#333300", "#3300FF", "#3300CC",
|
||||
"#330099", "#330066", "#330033", "#330000", "#00FFFF", "#00FFCC", "#00FF99", "#00FF66",
|
||||
"#00FF33", "#00FF00", "#00CCFF", "#00CCCC", "#00CC99", "#00CC66", "#00CC33", "#00CC00",
|
||||
"#0099FF", "#0099CC", "#009999", "#009966", "#009933", "#009900", "#0066FF", "#0066CC",
|
||||
"#006699", "#006666", "#006633", "#006600", "#0033FF", "#0033CC", "#003399", "#003366",
|
||||
"#003333", "#003300", "#0000FF", "#0000CC", "#000099", "#000066", "#000033", "#000000"
|
||||
};
|
||||
|
||||
static char *GrayPalette[] = {
|
||||
"#000000", "#010101", "#020202", "#030303", "#040404", "#050505", "#060606", "#070707",
|
||||
"#080808", "#090909", "#0A0A0A", "#0B0B0B", "#0C0C0C", "#0D0D0D", "#0E0E0E", "#0F0F0F",
|
||||
"#101010", "#111111", "#121212", "#131313", "#141414", "#151515", "#161616", "#171717",
|
||||
"#181818", "#191919", "#1A1A1A", "#1B1B1B", "#1C1C1C", "#1D1D1D", "#1E1E1E", "#1F1F1F",
|
||||
"#202020", "#212121", "#222222", "#232323", "#242424", "#252525", "#262626", "#272727",
|
||||
"#282828", "#292929", "#2A2A2A", "#2B2B2B", "#2C2C2C", "#2D2D2D", "#2E2E2E", "#2F2F2F",
|
||||
"#303030", "#313131", "#323232", "#333333", "#343434", "#353535", "#363636", "#373737",
|
||||
"#383838", "#393939", "#3A3A3A", "#3B3B3B", "#3C3C3C", "#3D3D3D", "#3E3E3E", "#3F3F3F",
|
||||
"#404040", "#414141", "#424242", "#434343", "#444444", "#454545", "#464646", "#474747",
|
||||
"#484848", "#494949", "#4A4A4A", "#4B4B4B", "#4C4C4C", "#4D4D4D", "#4E3E3E", "#4F4F4F",
|
||||
"#505050", "#515151", "#525252", "#534343", "#545454", "#555555", "#565656", "#575757",
|
||||
"#585858", "#595959", "#5A5A5A", "#5B5B5B", "#5C5C5C", "#5D5D5D", "#5E5E5E", "#5F5F5F",
|
||||
"#606060", "#616161", "#626262", "#636363", "#646464", "#656565", "#666666", "#676767",
|
||||
"#686868", "#696969", "#6A6A6A", "#6B6B6B", "#6C6C6C", "#6D6D6D", "#6E6E6E", "#6F6F6F",
|
||||
"#707070", "#717171", "#727272", "#737373", "#747474", "#757575", "#767676", "#777777",
|
||||
"#787878", "#797979", "#7A7A7A", "#7B7B7B", "#7C7C7C", "#7D7D7D", "#7E7E7E", "#7F7F7F",
|
||||
"#808080", "#818181", "#828282", "#838383", "#848484", "#858585", "#868686", "#878787",
|
||||
"#888888", "#898989", "#8A8A8A", "#8B8B8B", "#8C8C8C", "#8D8D8D", "#8E8E8E", "#8F8F8F",
|
||||
"#909090", "#919191", "#929292", "#939393", "#949494", "#959595", "#969696", "#979797",
|
||||
"#989898", "#999999", "#9A9A9A", "#9B9B9B", "#9C9C9C", "#9D9D9D", "#9E9E9E", "#9F9F9F",
|
||||
"#A0A0A0", "#A1A1A1", "#A2A2A2", "#A3A3A3", "#A4A4A4", "#A5A5A5", "#A6A6A6", "#A7A7A7",
|
||||
"#A8A8A8", "#A9A9A9", "#AAAAAA", "#ABABAB", "#ACACAC", "#ADADAD", "#AEAEAE", "#AFAFAF",
|
||||
"#B0B0B0", "#B1B1B1", "#B2B2B2", "#B3B3B3", "#B4B4B4", "#B5B5B5", "#B6B6B6", "#B7B7B7",
|
||||
"#B8B8B8", "#B9B9B9", "#BABABA", "#BBBBBB", "#BCBCBC", "#BDBDBD", "#BEBEBE", "#BFBFBF",
|
||||
"#C0C0C0", "#C1C1C1", "#C2C2C2", "#C3C3C3", "#C4C4C4", "#C5C5C5", "#C6C6C6", "#C7C7C7",
|
||||
"#C8C8C8", "#C9C9C9", "#CACACA", "#CBCBCB", "#CCCCCC", "#CDCDCD", "#CECECE", "#CFCFCF",
|
||||
"#D0D0D0", "#D1D1D1", "#D2D2D2", "#D3D3D3", "#D4D4D4", "#D5D5D5", "#D6D6D6", "#D7D7D7",
|
||||
"#D8D8D8", "#D9D9D9", "#DADADA", "#DBDBDB", "#DCDCDC", "#DDDDDD", "#DEDEDE", "#DFDFDF",
|
||||
"#E0E0E0", "#E1E1E1", "#E2E2E2", "#E3E3E3", "#E4E4E4", "#E5E5E5", "#E6E6E6", "#E7E7E7",
|
||||
"#E8E8E8", "#E9E9E9", "#EAEAEA", "#EBEBEB", "#ECECEC", "#EDEDED", "#EEEEEE", "#EFEFEF",
|
||||
"#F0F0F0", "#F1F1F1", "#F2F2F2", "#F3F3F3", "#F4F4F4", "#F5F5F5", "#F6F6F6", "#F7F7F7",
|
||||
"#F8F8F8", "#F9F9F9", "#FAFAFA", "#FBFBFB", "#FCFCFC", "#FDFDFD", "#FEFEFE", "#FFFFFF"
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsStdColorPicker, nsIColorPicker)
|
||||
|
||||
nsStdColorPicker::nsStdColorPicker()
|
||||
{
|
||||
mColors = 0;
|
||||
|
||||
mNumCols = 0;
|
||||
mNumRows = 0;
|
||||
|
||||
mFrameWidth = 0;
|
||||
mFrameHeight = 0;
|
||||
|
||||
mBlockWidth = 20;
|
||||
mBlockHeight = 20;
|
||||
}
|
||||
|
||||
nsStdColorPicker::~nsStdColorPicker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsStdColorPicker::Init(nsIContent *aContent)
|
||||
{
|
||||
nsAutoString palette;
|
||||
aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::palettename, palette);
|
||||
|
||||
if (palette.EqualsIgnoreCase("web"))
|
||||
{
|
||||
printf("web picked\n");
|
||||
mPalette = WebPalette;
|
||||
mNumCols = 12;
|
||||
mColors = sizeof(WebPalette) / sizeof(char *);
|
||||
}
|
||||
else if (palette.EqualsIgnoreCase("nose"))
|
||||
{
|
||||
printf("nose picked\n");
|
||||
mPalette = NosePalette;
|
||||
mNumCols = 10;
|
||||
mColors = sizeof(NosePalette) / sizeof(char *);
|
||||
}
|
||||
else if (palette.EqualsIgnoreCase("gray") || palette.EqualsIgnoreCase("grey"))
|
||||
{
|
||||
printf("gray picked\n");
|
||||
mPalette = GrayPalette;
|
||||
mNumCols = 10;
|
||||
mColors = sizeof(GrayPalette) / sizeof(char *);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("standard picked\n");
|
||||
mPalette = StandardPalette;
|
||||
mNumCols = 10;
|
||||
mColors = sizeof(StandardPalette) / sizeof(char *);
|
||||
}
|
||||
|
||||
mNumRows = NSToIntCeil(nscoord(mColors/mNumCols)) - 1;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsStdColorPicker::Paint(nsIPresContext * aPresContext, nsIRenderingContext * aRenderingContext)
|
||||
{
|
||||
int i = 0;
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
nscolor color = 0;
|
||||
float p2t;
|
||||
PRInt32 width, height;
|
||||
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
|
||||
width = NSToIntRound(mBlockWidth * p2t);
|
||||
height = NSToIntRound(mBlockHeight * p2t);
|
||||
|
||||
// aRenderingContext->SetColor(0);
|
||||
// aRenderingContext->FillRect(0, 0, (mNumCols)*width, mNumRows*height);
|
||||
|
||||
for (i=0;i<mColors;i++)
|
||||
{
|
||||
NS_LooseHexToRGB(mPalette[i], &color);
|
||||
|
||||
aRenderingContext->SetColor(color);
|
||||
aRenderingContext->FillRect(col*width, row*height, width, height);
|
||||
|
||||
if (col+1 == mNumCols)
|
||||
{
|
||||
col = 0;
|
||||
row++;
|
||||
}
|
||||
else
|
||||
col++;
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsStdColorPicker::GetColor(PRInt32 aX, PRInt32 aY, char **aColor)
|
||||
{
|
||||
int cur_col = aX / mBlockWidth;
|
||||
int cur_row = aY / mBlockHeight;
|
||||
|
||||
int f = mNumCols * cur_row + cur_col;
|
||||
|
||||
if (f >= mColors)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aColor = nsCRT::strdup(mPalette[f]);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsStdColorPicker::SetSize(PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
mFrameWidth = aWidth;
|
||||
mFrameHeight = aHeight;
|
||||
|
||||
if (aWidth != -1)
|
||||
mBlockWidth = NSToIntRound(nscoord(aWidth / mNumCols));
|
||||
|
||||
if (aWidth != -1)
|
||||
mBlockHeight = NSToIntRound(nscoord(aHeight / mNumRows));
|
||||
|
||||
mFrameWidth = NSToIntRound(nscoord((mNumCols) * mBlockWidth));
|
||||
mFrameHeight = NSToIntRound(nscoord((mNumRows) * mBlockHeight));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsStdColorPicker::GetSize(PRInt32 *aWidth, PRInt32 *aHeight)
|
||||
{
|
||||
*aWidth = mFrameWidth;
|
||||
*aHeight = mFrameHeight;
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
/* -*- 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.1 (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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//
|
||||
// Eric Vaughan
|
||||
// Netscape Communications
|
||||
//
|
||||
// See documentation in associated header file
|
||||
//
|
||||
|
||||
#include "nsTabFrame.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include <stdio.h>
|
||||
|
||||
//
|
||||
// NS_NewToolbarFrame
|
||||
//
|
||||
// Creates a new Toolbar frame and returns it in |aNewFrame|
|
||||
//
|
||||
nsresult
|
||||
NS_NewTabFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
||||
{
|
||||
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
||||
if (nsnull == aNewFrame) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTabFrame* it = new (aPresShell) nsTabFrame(aPresShell);
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aNewFrame = it;
|
||||
return NS_OK;
|
||||
|
||||
} // NS_NewTabFrame
|
||||
|
||||
nsTabFrame::nsTabFrame(nsIPresShell* aPresShell)
|
||||
:nsButtonBoxFrame(aPresShell)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
nsTabFrame::MouseClicked(nsIPresContext* aPresContext)
|
||||
{
|
||||
// get our index
|
||||
PRInt32 index = 0;
|
||||
GetIndexInParent(mContent, index);
|
||||
|
||||
// get the tab control
|
||||
nsCOMPtr<nsIContent> tabcontrol;
|
||||
GetTabControl(mContent, tabcontrol);
|
||||
|
||||
// get the tab panel
|
||||
nsCOMPtr<nsIContent> tabpanel;
|
||||
GetChildWithTag(nsXULAtoms::tabpanel, tabcontrol, tabpanel);
|
||||
|
||||
if (!tabpanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
// unselect the old tab
|
||||
|
||||
// get the current index
|
||||
nsAutoString v;
|
||||
PRInt32 error;
|
||||
tabpanel->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::index, v);
|
||||
PRInt32 oldIndex = v.ToInteger(&error);
|
||||
|
||||
if (oldIndex != index)
|
||||
{
|
||||
// get the tab box
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
mContent->GetParent(*getter_AddRefs(parent));
|
||||
|
||||
// get child
|
||||
nsCOMPtr<nsIContent> child;
|
||||
parent->ChildAt(oldIndex, *getter_AddRefs(child));
|
||||
|
||||
// set the old tab to be unselected
|
||||
child->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::selected, "false", PR_TRUE);
|
||||
|
||||
// set the new tab to be selected
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::selected, "true", PR_TRUE);
|
||||
}
|
||||
|
||||
// set the panels index
|
||||
char value[100];
|
||||
sprintf(value, "%d", index);
|
||||
|
||||
tabpanel->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::index, value, PR_TRUE);
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTabFrame::GetChildWithTag(nsIAtom* atom, nsCOMPtr<nsIContent> start, nsCOMPtr<nsIContent>& tabpanel)
|
||||
{
|
||||
// recursively search our children
|
||||
PRInt32 count = 0;
|
||||
start->ChildCount(count);
|
||||
for (PRInt32 i = 0; i < count; i++)
|
||||
{
|
||||
nsCOMPtr<nsIContent> child;
|
||||
start->ChildAt(i,*getter_AddRefs(child));
|
||||
|
||||
// see if it is the child
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
child->GetTag(*getter_AddRefs(tag));
|
||||
if (tag.get() == atom)
|
||||
{
|
||||
tabpanel = child;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// recursive search the child
|
||||
nsCOMPtr<nsIContent> found;
|
||||
GetChildWithTag(atom, child, found);
|
||||
if (found != nsnull) {
|
||||
tabpanel = found;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
tabpanel = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTabFrame::GetTabControl(nsCOMPtr<nsIContent> content, nsCOMPtr<nsIContent>& tabcontrol)
|
||||
{
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
|
||||
while(content != nsnull)
|
||||
{
|
||||
content->GetParent(*getter_AddRefs(parent));
|
||||
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
if (parent->GetTag(*getter_AddRefs(atom)) == NS_OK && atom.get() == nsXULAtoms::tabcontrol) {
|
||||
tabcontrol = parent;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
content = parent;
|
||||
}
|
||||
|
||||
tabcontrol = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTabFrame::GetIndexInParent(nsCOMPtr<nsIContent> content, PRInt32& index)
|
||||
{
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
content->GetParent(*getter_AddRefs(parent));
|
||||
return parent->IndexOf(content, index);
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ nsTextBoxFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTextBoxFrame::nsTextBoxFrame(nsIPresShell* aShell):nsLeafBoxFrame(aShell),mTitle(""), mCropType(CropRight),mAccessKeyInfo(nsnull)
|
||||
nsTextBoxFrame::nsTextBoxFrame(nsIPresShell* aShell):nsLeafBoxFrame(aShell), mCropType(CropRight),mAccessKeyInfo(nsnull)
|
||||
{
|
||||
mState |= NS_STATE_NEED_LAYOUT;
|
||||
NeedsRecalc();
|
||||
|
@ -140,17 +140,17 @@ nsTextBoxFrame::Init(nsIPresContext* aPresContext,
|
|||
nsAutoString accesskey;
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey,
|
||||
accesskey);
|
||||
if (accesskey != "") {
|
||||
if (!accesskey.IsEmpty()) {
|
||||
if (!mAccessKeyInfo)
|
||||
mAccessKeyInfo = new nsAccessKeyInfo();
|
||||
|
||||
mAccessKeyInfo->mAccesskeyIndex = -1;
|
||||
mAccessKeyInfo->mAccesskeyIndex = mTitle.Find(accesskey, PR_TRUE);
|
||||
if (mAccessKeyInfo->mAccesskeyIndex == -1) {
|
||||
nsString tmpstring = "(" ;
|
||||
nsString tmpstring; tmpstring.AssignWithConversion("(");
|
||||
accesskey.ToUpperCase();
|
||||
tmpstring += accesskey;
|
||||
tmpstring += ")";
|
||||
tmpstring.AppendWithConversion(")");
|
||||
PRUint32 offset = mTitle.RFind("...");
|
||||
if ( offset != kNotFound)
|
||||
mTitle.Insert(tmpstring,offset);
|
||||
|
@ -411,11 +411,11 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin
|
|||
mTitleWidth = aWidth;
|
||||
|
||||
if (aWidth <= elipsisWidth) {
|
||||
mCroppedTitle = "";
|
||||
mCroppedTitle.SetLength(0);
|
||||
return;
|
||||
}
|
||||
|
||||
mCroppedTitle = ELIPSIS;
|
||||
mCroppedTitle.AssignWithConversion(ELIPSIS);
|
||||
|
||||
aWidth -= elipsisWidth;
|
||||
|
||||
|
@ -468,7 +468,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin
|
|||
if (i == 0)
|
||||
break;
|
||||
|
||||
nsString copy = "";
|
||||
nsString copy;
|
||||
mTitle.Right(copy, length-i-1);
|
||||
mCroppedTitle = mCroppedTitle + copy;
|
||||
}
|
||||
|
@ -476,10 +476,10 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin
|
|||
|
||||
case CropCenter:
|
||||
|
||||
nsString elipsisLeft = ELIPSIS;
|
||||
nsString elipsisLeft; elipsisLeft.AssignWithConversion(ELIPSIS);
|
||||
|
||||
if (aWidth <= elipsisWidth)
|
||||
elipsisLeft = "";
|
||||
elipsisLeft.SetLength(0);
|
||||
else
|
||||
aWidth -= elipsisWidth;
|
||||
|
||||
|
@ -513,7 +513,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin
|
|||
}
|
||||
|
||||
|
||||
nsString copy = "";
|
||||
nsString copy;
|
||||
|
||||
if (i2 > i)
|
||||
mTitle.Mid(copy, i,i2-i);
|
||||
|
@ -541,7 +541,7 @@ nsTextBoxFrame::UpdateAccessUnderline()
|
|||
nsAutoString accesskey;
|
||||
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey,
|
||||
accesskey);
|
||||
if (accesskey == "") {
|
||||
if (accesskey.IsEmpty()) {
|
||||
if (mAccessKeyInfo) {
|
||||
delete mAccessKeyInfo;
|
||||
mAccessKeyInfo = nsnull;
|
||||
|
@ -650,8 +650,8 @@ nsTextBoxFrame::GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)
|
|||
NS_IMETHODIMP
|
||||
nsTextBoxFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Text[value=";
|
||||
aResult.AssignWithConversion("Text[value=");
|
||||
aResult += mTitle;
|
||||
aResult += "]";
|
||||
aResult.AppendWithConversion("]");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -221,7 +221,6 @@ nsTitledButtonFrame::nsTitledButtonFrame(nsIPresShell* aShell):nsLeafBoxFrame(aS
|
|||
mMinSize(0,0),
|
||||
mAscent(0)
|
||||
{
|
||||
mTitle = "";
|
||||
mAlign = GetDefaultAlignment();
|
||||
mCropType = CropRight;
|
||||
mNeedsLayout = PR_TRUE;
|
||||
|
@ -295,7 +294,7 @@ nsTitledButtonFrame::Init(nsIPresContext* aPresContext,
|
|||
// that UpdateAttributes doesn't double start an image load.
|
||||
nsAutoString src;
|
||||
GetImageSource(src);
|
||||
if (!src.Equals("")) {
|
||||
if (!src.IsEmpty()) {
|
||||
mHasImage = PR_TRUE;
|
||||
}
|
||||
mImageLoader.Init(this, UpdateImageFrame, nsnull, baseURL, src);
|
||||
|
@ -315,10 +314,10 @@ nsTitledButtonFrame::Init(nsIPresContext* aPresContext,
|
|||
if (!accesskey.IsEmpty()) {
|
||||
mAccesskeyIndex = mTitle.Find(accesskey, PR_TRUE);
|
||||
if (mAccesskeyIndex == -1) {
|
||||
nsString tmpstring = "(" ;
|
||||
nsString tmpstring; tmpstring.AssignWithConversion("(");
|
||||
accesskey.ToUpperCase();
|
||||
tmpstring += accesskey;
|
||||
tmpstring += ")";
|
||||
tmpstring.AppendWithConversion(")");
|
||||
PRUint32 offset = mTitle.RFind("...");
|
||||
if ( offset != kNotFound)
|
||||
mTitle.Insert(tmpstring,offset);
|
||||
|
@ -347,7 +346,7 @@ nsTitledButtonFrame::GetImageSource(nsString& aResult)
|
|||
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::src, aResult);
|
||||
|
||||
// if the new image is empty
|
||||
if (aResult.Equals("")) {
|
||||
if (aResult.IsEmpty()) {
|
||||
// get the list-style-image
|
||||
const nsStyleList* myList =
|
||||
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
|
||||
|
@ -447,7 +446,7 @@ nsTitledButtonFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize)
|
|||
|
||||
// see if the source changed
|
||||
// get the old image src
|
||||
nsAutoString oldSrc ="";
|
||||
nsAutoString oldSrc;
|
||||
mImageLoader.GetURLSpec(oldSrc);
|
||||
|
||||
// get the new image src
|
||||
|
@ -457,7 +456,7 @@ nsTitledButtonFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize)
|
|||
// see if the images are different
|
||||
if (!oldSrc.Equals(src)) {
|
||||
|
||||
if (!src.Equals("")) {
|
||||
if (!src.IsEmpty()) {
|
||||
mSizeFrozen = PR_FALSE;
|
||||
mHasImage = PR_TRUE;
|
||||
} else {
|
||||
|
@ -562,7 +561,7 @@ nsTitledButtonFrame::LayoutTitleAndImage(nsIPresContext* aPresContext,
|
|||
nscoord center_x = rect.x + rect.width/2;
|
||||
nscoord center_y = rect.y + rect.height/2;
|
||||
|
||||
mCroppedTitle = "";
|
||||
mCroppedTitle.SetLength(0);
|
||||
|
||||
nscoord spacing = 0;
|
||||
|
||||
|
@ -695,11 +694,11 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen
|
|||
mTitleRect.width = aWidth;
|
||||
|
||||
if (aWidth <= elipsisWidth) {
|
||||
mCroppedTitle = "";
|
||||
mCroppedTitle.SetLength(0);
|
||||
return;
|
||||
}
|
||||
|
||||
mCroppedTitle = ELIPSIS;
|
||||
mCroppedTitle.AssignWithConversion(ELIPSIS);
|
||||
|
||||
aWidth -= elipsisWidth;
|
||||
|
||||
|
@ -752,7 +751,7 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen
|
|||
if (i == 0)
|
||||
break;
|
||||
|
||||
nsString copy = "";
|
||||
nsString copy;
|
||||
mTitle.Right(copy, length-i-1);
|
||||
mCroppedTitle = mCroppedTitle + copy;
|
||||
}
|
||||
|
@ -760,10 +759,10 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen
|
|||
|
||||
case CropCenter:
|
||||
|
||||
nsString elipsisLeft = ELIPSIS;
|
||||
nsString elipsisLeft; elipsisLeft.AssignWithConversion(ELIPSIS);
|
||||
|
||||
if (aWidth <= elipsisWidth)
|
||||
elipsisLeft = "";
|
||||
elipsisLeft.SetLength(0);
|
||||
else
|
||||
aWidth -= elipsisWidth;
|
||||
|
||||
|
@ -797,7 +796,7 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen
|
|||
}
|
||||
|
||||
|
||||
nsString copy = "";
|
||||
nsString copy;
|
||||
|
||||
if (i2 > i)
|
||||
mTitle.Mid(copy, i,i2-i);
|
||||
|
@ -1283,9 +1282,9 @@ nsTitledButtonFrame::MouseClicked (nsIPresContext* aPresContext)
|
|||
nsTitledButtonFrame::CheckState
|
||||
nsTitledButtonFrame :: StringToCheckState ( const nsString & aStateAsString )
|
||||
{
|
||||
if ( aStateAsString.Equals(NS_STRING_TRUE) )
|
||||
if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) )
|
||||
return eOn;
|
||||
else if ( aStateAsString.Equals(NS_STRING_FALSE) )
|
||||
else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) )
|
||||
return eOff;
|
||||
|
||||
// not true and not false means mixed
|
||||
|
@ -1303,19 +1302,19 @@ nsTitledButtonFrame :: CheckStateToString ( CheckState inState, nsString& outSta
|
|||
{
|
||||
switch ( inState ) {
|
||||
case eOn:
|
||||
outStateAsString = NS_STRING_TRUE;
|
||||
outStateAsString.AssignWithConversion(NS_STRING_TRUE);
|
||||
break;
|
||||
|
||||
case eOff:
|
||||
outStateAsString = NS_STRING_FALSE;
|
||||
outStateAsString.AssignWithConversion(NS_STRING_FALSE);
|
||||
break;
|
||||
|
||||
case eMixed:
|
||||
outStateAsString = "2";
|
||||
outStateAsString.AssignWithConversion("2");
|
||||
break;
|
||||
|
||||
case eUnset:
|
||||
outStateAsString = "";
|
||||
outStateAsString.SetLength(0);
|
||||
}
|
||||
} // CheckStateToString
|
||||
|
||||
|
@ -1551,8 +1550,8 @@ nsTitledButtonFrame::CacheSizes(nsBoxLayoutState& aBoxLayoutState)
|
|||
NS_IMETHODIMP
|
||||
nsTitledButtonFrame::GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "TitledButton[value=";
|
||||
aResult.AssignWithConversion("TitledButton[value=");
|
||||
aResult += mTitle;
|
||||
aResult += "]";
|
||||
aResult.AppendWithConversion("]");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -201,8 +201,8 @@ nsToolbarDragListener :: ItemMouseIsOver ( nsIDOMEvent* aDragEvent, nscoord* out
|
|||
nsCOMPtr<nsIDOMElement> domElement ( do_QueryInterface(content) );
|
||||
if ( domElement ) {
|
||||
nsAutoString value;
|
||||
domElement->GetAttribute(nsAutoString("container"), value); // can't use an atom here =(
|
||||
isContainer = value.Equals("true");
|
||||
domElement->GetAttribute(NS_ConvertASCIItoUCS2("container"), value); // can't use an atom here =(
|
||||
isContainer = value.EqualsWithConversion("true");
|
||||
}
|
||||
else
|
||||
NS_WARNING("Not a DOM element");
|
||||
|
@ -292,10 +292,10 @@ nsToolbarDragListener::DragOver(nsIDOMEvent* aDragEvent)
|
|||
|
||||
// need the cast, because on some platforms, PR[U]int32 != long, but we're using "%ld"
|
||||
sprintf(buffer, "%ld", NS_STATIC_CAST(long, xLoc));
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE );
|
||||
sprintf(buffer, "%ld", NS_STATIC_CAST(long, beforeIndex));
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, buffer, PR_FALSE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, onChild ? "true" : "false", PR_FALSE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2(buffer), PR_FALSE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, NS_ConvertASCIItoUCS2(onChild ? "true" : "false"), PR_FALSE );
|
||||
}
|
||||
|
||||
// cache the current drop location
|
||||
|
@ -343,9 +343,9 @@ nsToolbarDragListener::DragExit(nsIDOMEvent* aDragEvent)
|
|||
// AttributeChanged() about that attribute.
|
||||
char buffer[10];
|
||||
sprintf(buffer, "%d", -1);
|
||||
myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE );
|
||||
myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, buffer, PR_FALSE );
|
||||
myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaint, "1", PR_TRUE );
|
||||
myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE );
|
||||
myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2(buffer), PR_FALSE );
|
||||
myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaint, NS_ConvertASCIItoUCS2("1"), PR_TRUE );
|
||||
|
||||
// reset the current drop location
|
||||
mCurrentDropLoc = -1;
|
||||
|
|
|
@ -175,8 +175,8 @@ nsToolbarFrame :: ~nsToolbarFrame ( )
|
|||
|
||||
// NOTE: the last Remove will delete the drag listener
|
||||
if ( receiver ) {
|
||||
receiver->RemoveEventListener("dragover", mDragListener, PR_TRUE);
|
||||
receiver->RemoveEventListener("dragexit", mDragListener, PR_TRUE);
|
||||
receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragListener, PR_TRUE);
|
||||
receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragListener, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,8 +205,8 @@ nsToolbarFrame::Init ( nsIPresContext* aPresContext, nsIContent* aContent,
|
|||
// with enough info to determine where the drop would happen so that JS down the
|
||||
// line can do the right thing.
|
||||
mDragListener = new nsToolbarDragListener(this, aPresContext);
|
||||
receiver->AddEventListener("dragover", mDragListener, PR_TRUE);
|
||||
receiver->AddEventListener("dragexit", mDragListener, PR_TRUE);
|
||||
receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragListener, PR_TRUE);
|
||||
receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragListener, PR_TRUE);
|
||||
|
||||
#if 0 //TEMP_HACK_FOR_BUG_11291
|
||||
// Ok, this is a hack until Ender lands. We need to have a mouse listener on text widgets
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
/* -*- 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.1 (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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//
|
||||
// Mike Pinkerton
|
||||
// Netscape Communications
|
||||
//
|
||||
// nsToolbarFrame is a layout object that contains items (specified as
|
||||
// children in the DOM). The layout for toolbars is a little complicated, but
|
||||
// it basically just lays out its children in as a box. Toolbars themselves
|
||||
// don't know anything about grippies (as in 4.x) but are associated with them
|
||||
// through toolboxes. This allows a developer to create a standalone toolbar
|
||||
// (for inclusion in a webpage), which obviously doesn't need to have a grippy.
|
||||
//
|
||||
// As mentioned above, the Toolbar expects its toolbars to be its children in
|
||||
// the DOM. The exact structure of the children is documented on:
|
||||
// http://www.mozilla.org/xpfe/DMWSpecNew.html
|
||||
//
|
||||
// This implementation of toolbars now uses evaughan's box code for layout
|
||||
// of its children and to determine its size.
|
||||
//
|
||||
|
||||
#ifndef nsToolbarFrame_h__
|
||||
#define nsToolbarFrame_h__
|
||||
|
||||
#define TOOLBARITEM_MIME "moz/toolbaritem"
|
||||
#define TOOLBAR_MIME "moz/toolbar"
|
||||
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsBoxFrame.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIPresContext;
|
||||
class nsIFrame;
|
||||
class nsToolbarDragListener;
|
||||
|
||||
|
||||
class nsToolbarFrame : public nsBoxFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewToolbarFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* asPrevInFlow);
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) ;
|
||||
|
||||
NS_IMETHOD HandleEvent ( nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
#if WTF_IS_THIS
|
||||
//¥¥¥ not sure at all where this comes from. I asked rods, no reply yet.
|
||||
virtual void ReResolveStyles(nsIPresContext* aPresContext,
|
||||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
void SetDropfeedbackLocation(nscoord aX) { mXDropLoc = aX; }
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Toolbar";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
nsToolbarFrame(nsIPresShell* aShell);
|
||||
virtual ~nsToolbarFrame();
|
||||
|
||||
// pass-by-value not allowed for a coordinator because it corresponds 1-to-1
|
||||
// with an element in the UI.
|
||||
nsToolbarFrame ( const nsToolbarFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
nsToolbarFrame& operator= ( const nsToolbarFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
|
||||
// our event handler registered with the content model. See the discussion
|
||||
// in Init() for why this is a weak ref.
|
||||
nsToolbarDragListener* mDragListener;
|
||||
|
||||
// only used during drag and drop for drop feedback. These are not
|
||||
// guaranteed to be meaningful when no drop is underway.
|
||||
PRInt32 mXDropLoc;
|
||||
nsCOMPtr<nsIStyleContext> mMarkerStyle;
|
||||
|
||||
}; // class nsToolbarFrame
|
||||
|
||||
#endif
|
|
@ -1,144 +0,0 @@
|
|||
/* -*- 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.1 (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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//
|
||||
// Mike Pinkerton
|
||||
// Netscape Communications
|
||||
//
|
||||
// nsToolboxFrame is a layout object that contains one or more toolbar frames
|
||||
// (specified as children in the DOM). These toolbars are laid out one on top
|
||||
// of the other, and can be of varying heights but are all of the same width
|
||||
// (the full width of the toolbox). Each toolbar is associated with a "grippy"
|
||||
// which can be used to either collapse a particular toolbar or as a handle to
|
||||
// pick up and move a toolbar to a new position within the toolbox. When toolbars
|
||||
// are collapsed, it's grippy is moved to the bottom of the box and laid on
|
||||
// its side. Clicking again on the grippy will reinstate the toolbar to its previous
|
||||
// position in the toolbox.
|
||||
//
|
||||
// As mentioned above, the toolbox expects its toolbars to be its children in
|
||||
// the DOM. The exact structure of the children is documented on:
|
||||
// http://www.mozilla.org/xpfe/DMWSpecNew.html
|
||||
//
|
||||
|
||||
#ifndef nsToolBoxFrame_h___
|
||||
#define nsToolBoxFrame_h___
|
||||
|
||||
#include "nsIDOMDragListener.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsBoxFrame.h"
|
||||
|
||||
class nsToolboxFrame : public nsBoxFrame
|
||||
{
|
||||
public:
|
||||
friend nsresult NS_NewToolboxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
/*BEGIN implementations of dragevent handler interface*/
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
|
||||
virtual nsresult DragEnter(nsIDOMEvent* aDragEvent);
|
||||
virtual nsresult DragOver(nsIDOMEvent* aDragEvent);
|
||||
virtual nsresult DragExit(nsIDOMEvent* aDragEvent);
|
||||
virtual nsresult DragDrop(nsIDOMEvent* aDragEvent);
|
||||
virtual nsresult DragGesture(nsIDOMEvent* aDragEvent) { return NS_OK; }
|
||||
/*END implementations of dragevent handler interface*/
|
||||
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const
|
||||
{
|
||||
aResult = "Toolbox";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
nsToolboxFrame(nsIPresShell* aShell);
|
||||
virtual ~nsToolboxFrame();
|
||||
|
||||
class DragListenerDelegate : public nsIDOMDragListener
|
||||
{
|
||||
protected:
|
||||
nsToolboxFrame* mFrame;
|
||||
|
||||
public:
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
// nsIDOMEventListener interface
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return mFrame ? mFrame->HandleEvent(aEvent) : NS_OK;
|
||||
}
|
||||
|
||||
virtual nsresult DragGesture(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return mFrame ? mFrame->DragGesture(aEvent) : NS_OK;
|
||||
}
|
||||
|
||||
// nsIDOMDragListener interface
|
||||
virtual nsresult DragEnter(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return mFrame ? mFrame->DragEnter(aMouseEvent) : NS_OK;
|
||||
}
|
||||
|
||||
virtual nsresult DragOver(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return mFrame ? mFrame->DragOver(aMouseEvent) : NS_OK;
|
||||
}
|
||||
|
||||
virtual nsresult DragExit(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return mFrame ? mFrame->DragExit(aMouseEvent) : NS_OK;
|
||||
}
|
||||
|
||||
virtual nsresult DragDrop(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return mFrame ? mFrame->DragDrop(aMouseEvent) : NS_OK;
|
||||
}
|
||||
|
||||
// Implementation methods
|
||||
DragListenerDelegate(nsToolboxFrame* aFrame) : mFrame(aFrame)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
virtual ~DragListenerDelegate() {}
|
||||
|
||||
void NotifyFrameDestroyed() { mFrame = nsnull; }
|
||||
};
|
||||
DragListenerDelegate* mDragListenerDelegate;
|
||||
|
||||
// pass-by-value not allowed for a toolbox because it corresponds 1-to-1
|
||||
// with an element in the UI.
|
||||
nsToolboxFrame ( const nsToolboxFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
nsToolboxFrame& operator= ( const nsToolboxFrame& aFrame ) ; // DO NOT IMPLEMENT
|
||||
}; // class nsToolboxFrame
|
||||
|
||||
#endif
|
|
@ -84,7 +84,7 @@ nsTreeCellFrame::Init(nsIPresContext* aPresContext,
|
|||
nsresult result = aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, attrValue);
|
||||
attrValue.ToLowerCase();
|
||||
PRBool allowEvents = (result == NS_CONTENT_ATTR_NO_VALUE ||
|
||||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue.Equals("true")));
|
||||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue.EqualsWithConversion("true")));
|
||||
SetAllowEvents(allowEvents);
|
||||
|
||||
// Determine if we're a column header or not.
|
||||
|
@ -171,7 +171,7 @@ nsTreeCellFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
// This allows selective overriding for subcontent.
|
||||
nsAutoString value;
|
||||
content->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, value);
|
||||
if (value.Equals("true"))
|
||||
if (value.EqualsWithConversion("true"))
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -354,18 +354,18 @@ nsTreeCellFrame::ToggleOpenClose()
|
|||
|
||||
// Take the tree item content and toggle the value of its open attribute.
|
||||
nsAutoString attrValue;
|
||||
treeItem->GetAttribute("open", attrValue);
|
||||
treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), attrValue);
|
||||
attrValue.ToLowerCase();
|
||||
PRBool isExpanded = (attrValue.Equals("true"));
|
||||
PRBool isExpanded = (attrValue.EqualsWithConversion("true"));
|
||||
if (isExpanded)
|
||||
{
|
||||
// We're collapsing and need to remove frames from the flow.
|
||||
treeItem->RemoveAttribute("open");
|
||||
treeItem->RemoveAttribute(NS_ConvertASCIItoUCS2("open"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're expanding and need to add frames to the flow.
|
||||
treeItem->SetAttribute("open", "true");
|
||||
treeItem->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -389,12 +389,12 @@ nsTreeCellFrame::Open()
|
|||
|
||||
// Take the tree item content and toggle the value of its open attribute.
|
||||
nsAutoString attrValue;
|
||||
treeItem->GetAttribute("open", attrValue);
|
||||
treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), attrValue);
|
||||
attrValue.ToLowerCase();
|
||||
PRBool isExpanded = (attrValue.Equals("true"));
|
||||
PRBool isExpanded = (attrValue.EqualsWithConversion("true"));
|
||||
if (!isExpanded) {
|
||||
// We're expanding and need to add frames to the flow.
|
||||
treeItem->SetAttribute("open", "true");
|
||||
treeItem->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -418,12 +418,12 @@ nsTreeCellFrame::Close()
|
|||
|
||||
// Take the tree item content and toggle the value of its open attribute.
|
||||
nsAutoString attrValue;
|
||||
treeItem->GetAttribute("open", attrValue);
|
||||
treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), attrValue);
|
||||
attrValue.ToLowerCase();
|
||||
PRBool isExpanded = (attrValue.Equals("true"));
|
||||
PRBool isExpanded = (attrValue.EqualsWithConversion("true"));
|
||||
if (isExpanded) {
|
||||
// We're expanding and need to add frames to the flow.
|
||||
treeItem->RemoveAttribute("open");
|
||||
treeItem->RemoveAttribute(NS_ConvertASCIItoUCS2("open"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,9 +449,9 @@ void nsTreeCellFrame::Hover(nsIPresContext* aPresContext, PRBool isHover, PRBool
|
|||
if (isHover)
|
||||
{
|
||||
// We're selecting the node.
|
||||
mContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow);
|
||||
rowContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow);
|
||||
itemContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow);
|
||||
mContent->SetAttribute(kNameSpaceID_None, kHoverAtom, NS_ConvertASCIItoUCS2("true"), notifyForReflow);
|
||||
rowContent->SetAttribute(kNameSpaceID_None, kHoverAtom, NS_ConvertASCIItoUCS2("true"), notifyForReflow);
|
||||
itemContent->SetAttribute(kNameSpaceID_None, kHoverAtom, NS_ConvertASCIItoUCS2("true"), notifyForReflow);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -139,7 +139,7 @@ void nsTreeFrame::SetSelection(nsIPresContext* aPresContext, nsTreeCellFrame* aF
|
|||
nsCOMPtr<nsIDOMXULElement> itemElement = do_QueryInterface(itemContent);
|
||||
|
||||
nsCOMPtr<nsIAtom> kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect"));
|
||||
mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, "true", PR_FALSE);
|
||||
mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, NS_ConvertASCIItoUCS2("true"), PR_FALSE);
|
||||
treeElement->SelectItem(itemElement);
|
||||
mContent->UnsetAttribute(kNameSpaceID_None, kSuppressSelectChange, PR_FALSE);
|
||||
treeElement->SelectCell(cellElement);
|
||||
|
@ -161,7 +161,7 @@ void nsTreeFrame::ToggleSelection(nsIPresContext* aPresContext, nsTreeCellFrame*
|
|||
nsCOMPtr<nsIDOMXULElement> itemElement = do_QueryInterface(itemContent);
|
||||
|
||||
nsCOMPtr<nsIAtom> kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect"));
|
||||
mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, "true", PR_FALSE);
|
||||
mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, NS_ConvertASCIItoUCS2("true"), PR_FALSE);
|
||||
treeElement->ToggleItemSelection(itemElement);
|
||||
mContent->UnsetAttribute(kNameSpaceID_None, kSuppressSelectChange, PR_FALSE);
|
||||
treeElement->ToggleCellSelection(cellElement);
|
||||
|
@ -380,7 +380,7 @@ NS_IMETHODIMP
|
|||
nsTreeFrame::Destroy(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventReceiver> target = do_QueryInterface(mContent);
|
||||
target->RemoveEventListener("mousedown", mTwistyListener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_ConvertASCIItoUCS2("mousedown"), mTwistyListener, PR_TRUE);
|
||||
mTwistyListener = nsnull;
|
||||
return nsTableFrame::Destroy(aPresContext);
|
||||
}
|
||||
|
@ -487,11 +487,11 @@ nsTreeFrame::Init(nsIPresContext* aPresContext,
|
|||
|
||||
nsCOMPtr<nsIDOMEventReceiver> target = do_QueryInterface(mContent);
|
||||
|
||||
target->AddEventListener("mousedown", mTwistyListener, PR_TRUE);
|
||||
target->AddEventListener(NS_ConvertASCIItoUCS2("mousedown"), mTwistyListener, PR_TRUE);
|
||||
|
||||
nsAutoString value;
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mContent);
|
||||
element->GetAttribute("rows", value);
|
||||
element->GetAttribute(NS_ConvertASCIItoUCS2("rows"), value);
|
||||
|
||||
if (!value.IsEmpty()) {
|
||||
PRInt32 dummy;
|
||||
|
@ -514,7 +514,7 @@ nsTreeFrame::ContainsFlexibleColumn(PRInt32 aStartIndex, PRInt32 aEndIndex,
|
|||
if (colContent) {
|
||||
nsAutoString fixedValue;
|
||||
colContent->GetAttribute(kNameSpaceID_None, fixedAtom, fixedValue);
|
||||
if (!fixedValue.Equals("true")) {
|
||||
if (!fixedValue.EqualsWithConversion("true")) {
|
||||
// We are a proportional column.
|
||||
if (aResult)
|
||||
*aResult = result;
|
||||
|
|
|
@ -164,8 +164,8 @@ nsTreeItemDragCapturer :: ComputeDropPosition ( nsIDOMEvent* aDragEvent, nscoord
|
|||
nsCOMPtr<nsIDOMElement> treeItemNode ( do_QueryInterface(treeItemContent) );
|
||||
if ( treeItemNode ) {
|
||||
nsAutoString value;
|
||||
treeItemNode->GetAttribute(nsAutoString("container"), value); // can't use an atom here =(
|
||||
isContainer = value.Equals("true");
|
||||
treeItemNode->GetAttribute(NS_ConvertASCIItoUCS2("container"), value); // can't use an atom here =(
|
||||
isContainer = value.EqualsWithConversion("true");
|
||||
}
|
||||
else
|
||||
NS_WARNING("Not a DOM element");
|
||||
|
@ -231,9 +231,9 @@ nsTreeItemDragCapturer::DragOver(nsIDOMEvent* aDragEvent)
|
|||
|
||||
// need the cast, because on some platforms, PR[U]int32 != long, but we're using "%ld"
|
||||
sprintf(buffer, "%d", yLoc);
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, beforeMe ? "true" : "false", PR_FALSE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, onMe ? "true" : "false", PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2(beforeMe ? "true" : "false"), PR_FALSE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, NS_ConvertASCIItoUCS2(onMe ? "true" : "false"), PR_TRUE );
|
||||
}
|
||||
|
||||
// cache the current drop location
|
||||
|
@ -264,10 +264,10 @@ nsTreeItemDragCapturer::DragExit(nsIDOMEvent* aDragEvent)
|
|||
// AttributeChanged() about that attribute.
|
||||
char buffer[10];
|
||||
sprintf(buffer, "%d", kNoDropLoc);
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, "false", PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, "false", PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaintRestore, "1", PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2("false"), PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, NS_ConvertASCIItoUCS2("false"), PR_TRUE );
|
||||
content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaintRestore, NS_ConvertASCIItoUCS2("1"), PR_TRUE );
|
||||
}
|
||||
|
||||
// cache the current drop location
|
||||
|
|
|
@ -309,7 +309,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext,
|
|||
if (colContent) {
|
||||
nsAutoString fixedValue;
|
||||
colContent->GetAttribute(kNameSpaceID_None, fixedAtom, fixedValue);
|
||||
if (!fixedValue.Equals("true")) {
|
||||
if (!fixedValue.EqualsWithConversion("true")) {
|
||||
// We are a proportional column and should be annotated with our current
|
||||
// width.
|
||||
PRInt32 colWidth = treeFrame->GetColumnWidth(i);
|
||||
|
@ -328,7 +328,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext,
|
|||
PRInt32 colWidth = colWidths[i];
|
||||
char ch[100];
|
||||
sprintf(ch,"%d*", colWidth);
|
||||
nsAutoString propColWidth(ch);
|
||||
nsAutoString propColWidth; propColWidth.AssignWithConversion(ch);
|
||||
colContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, propColWidth,
|
||||
PR_TRUE);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext,
|
|||
colWidth = colWidths[colX] + mod;
|
||||
|
||||
sprintf(ch,"%d*", colWidth);
|
||||
nsAutoString propColWidth(ch);
|
||||
nsAutoString propColWidth; propColWidth.AssignWithConversion(ch);
|
||||
|
||||
colFrame->GetContent(getter_AddRefs(colContent));
|
||||
if (colContent) {
|
||||
|
@ -395,7 +395,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext,
|
|||
if (remaining != 0 && colContent) {
|
||||
colWidth += remaining;
|
||||
sprintf(ch,"%d*", colWidth);
|
||||
nsAutoString propColWidth(ch);
|
||||
nsAutoString propColWidth; propColWidth.AssignWithConversion(ch);
|
||||
colContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, propColWidth,
|
||||
PR_TRUE);
|
||||
|
||||
|
@ -412,7 +412,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext,
|
|||
|
||||
colWidth = flexWidth - delta;
|
||||
sprintf(ch,"%d*", colWidth);
|
||||
nsAutoString propColWidth(ch);
|
||||
nsAutoString propColWidth; propColWidth.AssignWithConversion(ch);
|
||||
flexContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, propColWidth,
|
||||
PR_TRUE); // NOW we send the notification that causes the reflow.
|
||||
}
|
||||
|
|
|
@ -131,8 +131,8 @@ nsTreeRowGroupFrame::~nsTreeRowGroupFrame()
|
|||
|
||||
// NOTE: the last Remove will delete the drag capturer
|
||||
if ( receiver ) {
|
||||
receiver->RemoveEventListener("dragover", mDragCapturer, PR_TRUE);
|
||||
receiver->RemoveEventListener("dragexit", mDragCapturer, PR_TRUE);
|
||||
receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragCapturer, PR_TRUE);
|
||||
receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragCapturer, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mContentChain);
|
||||
|
@ -214,8 +214,8 @@ nsTreeRowGroupFrame::Init ( nsIPresContext* aPresContext, nsIContent* aContent,
|
|||
// with enough info to determine where the drop would happen so that JS down the
|
||||
// line can do the right thing.
|
||||
mDragCapturer = new nsTreeItemDragCapturer(this, aPresContext);
|
||||
receiver->AddEventListener("dragover", mDragCapturer, PR_TRUE);
|
||||
receiver->AddEventListener("dragexit", mDragCapturer, PR_TRUE);
|
||||
receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragCapturer, PR_TRUE);
|
||||
receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragCapturer, PR_TRUE);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -551,7 +551,7 @@ nsTreeRowGroupFrame::FindRowContentAtIndex(PRInt32& aIndex,
|
|||
nsCOMPtr<nsIAtom> openAtom = dont_AddRef(NS_NewAtom("open"));
|
||||
nsAutoString isOpen;
|
||||
childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
|
||||
if (isOpen.Equals("true")) {
|
||||
if (isOpen.EqualsWithConversion("true")) {
|
||||
// Find the <treechildren> node.
|
||||
PRInt32 childContentCount;
|
||||
nsCOMPtr<nsIContent> grandChild;
|
||||
|
@ -627,7 +627,7 @@ nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpward
|
|||
nsCOMPtr<nsIAtom> openAtom = dont_AddRef(NS_NewAtom("open"));
|
||||
nsAutoString isOpen;
|
||||
childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
|
||||
if (isOpen.Equals("true")) {
|
||||
if (isOpen.EqualsWithConversion("true")) {
|
||||
// Find the <treechildren> node.
|
||||
PRInt32 childContentCount;
|
||||
nsCOMPtr<nsIContent> grandChild;
|
||||
|
@ -695,7 +695,7 @@ nsTreeRowGroupFrame::ComputeTotalRowCount(PRInt32& aCount, nsIContent* aParent)
|
|||
nsCOMPtr<nsIContent> parent;
|
||||
childContent->GetParent(*getter_AddRefs(parent));
|
||||
parent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
|
||||
if (isOpen.Equals("true"))
|
||||
if (isOpen.EqualsWithConversion("true"))
|
||||
ComputeTotalRowCount(aCount, childContent);
|
||||
}
|
||||
}
|
||||
|
@ -828,7 +828,7 @@ nsTreeRowGroupFrame::PagedUpDown()
|
|||
#ifdef DEBUG_tree
|
||||
printf("PagedUpDown, setting increment to %d\n", rowGroupCount);
|
||||
#endif
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, nsAutoString(ch), PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, NS_ConvertASCIItoUCS2(ch), PR_FALSE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -847,12 +847,12 @@ nsTreeRowGroupFrame::SetScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* a
|
|||
aFrame->GetContent(getter_AddRefs(scrollbarContent));
|
||||
|
||||
nsAutoString scrollFactor;
|
||||
scrollFactor.Append(SCROLL_FACTOR);
|
||||
scrollFactor.AppendWithConversion(SCROLL_FACTOR);
|
||||
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, "0", PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2("0"), PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::increment, scrollFactor, PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, "1", PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::maxpos, "5000", PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, NS_ConvertASCIItoUCS2("1"), PR_FALSE);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::maxpos, NS_ConvertASCIItoUCS2("5000"), PR_FALSE);
|
||||
|
||||
nsIFrame* result;
|
||||
nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::slider, aFrame, result);
|
||||
|
@ -1496,7 +1496,7 @@ void nsTreeRowGroupFrame::OnContentRemoved(nsIPresContext* aPresContext,
|
|||
mCurrentIndex--;
|
||||
nsAutoString indexStr;
|
||||
PRInt32 pixelIndex = mCurrentIndex * SCROLL_FACTOR;
|
||||
indexStr.Append(pixelIndex);
|
||||
indexStr.AppendInt(pixelIndex);
|
||||
|
||||
nsCOMPtr<nsIContent> scrollbarContent;
|
||||
mScrollbar->GetContent(getter_AddRefs(scrollbarContent));
|
||||
|
@ -1564,7 +1564,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext)
|
|||
if (count < pageRowCount) {
|
||||
// first set the position to 0 so that all visible content
|
||||
// scrolls into view
|
||||
value.Append(0);
|
||||
value.AppendInt(0);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None,
|
||||
nsXULAtoms::curpos,
|
||||
value, PR_TRUE);
|
||||
|
@ -1578,7 +1578,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext)
|
|||
nsXULAtoms::curpos, value);
|
||||
}
|
||||
|
||||
if (nukeScrollbar || (value.Equals("0") && !mIsFull)) {
|
||||
if (nukeScrollbar || (value.EqualsWithConversion("0") && !mIsFull)) {
|
||||
|
||||
// clear the scrollbar out of the event state manager so that the
|
||||
// event manager doesn't send events to the destroyed scrollbar frames
|
||||
|
@ -1629,7 +1629,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext)
|
|||
rowCount *= SCROLL_FACTOR;
|
||||
char ch[100];
|
||||
sprintf(ch,"%d", rowCount);
|
||||
maxpos = ch;
|
||||
maxpos.AssignWithConversion(ch);
|
||||
}
|
||||
|
||||
// Make sure our position is accurate
|
||||
|
@ -1673,7 +1673,7 @@ void nsTreeRowGroupFrame::CreateScrollbar(nsIPresContext* aPresContext)
|
|||
nsCOMPtr<nsIDOMDocument> document(do_QueryInterface(idocument));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> node;
|
||||
document->CreateElement("scrollbar",getter_AddRefs(node));
|
||||
document->CreateElement(NS_ConvertASCIItoUCS2("scrollbar"),getter_AddRefs(node));
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
content->SetDocument(idocument, PR_FALSE);
|
||||
|
@ -1684,7 +1684,7 @@ void nsTreeRowGroupFrame::CreateScrollbar(nsIPresContext* aPresContext)
|
|||
xulContent->SetAnonymousState(PR_TRUE); // Mark as anonymous to keep events from getting out.
|
||||
|
||||
nsCOMPtr<nsIAtom> align = dont_AddRef(NS_NewAtom("align"));
|
||||
content->SetAttribute(kNameSpaceID_None, align, "vertical", PR_FALSE);
|
||||
content->SetAttribute(kNameSpaceID_None, align, NS_ConvertASCIItoUCS2("vertical"), PR_FALSE);
|
||||
|
||||
nsIFrame* aResult;
|
||||
mFrameConstructor->CreateTreeWidgetContent(aPresContext, this, nsnull, content,
|
||||
|
@ -1846,7 +1846,7 @@ nsTreeRowGroupFrame::EnsureRowIsVisible(PRInt32 aRowIndex)
|
|||
#endif
|
||||
|
||||
scrollTo *= SCROLL_FACTOR;
|
||||
value.Append(scrollTo);
|
||||
value.AppendInt(scrollTo);
|
||||
scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos,
|
||||
value, PR_TRUE);
|
||||
|
||||
|
@ -1913,7 +1913,7 @@ void nsTreeRowGroupFrame::ScrollByLines(nsIPresContext* aPresContext,
|
|||
|
||||
scrollTo *= SCROLL_FACTOR;
|
||||
nsAutoString value;
|
||||
value.Append(scrollTo);
|
||||
value.AppendInt(scrollTo);
|
||||
|
||||
nsCOMPtr<nsIContent> scrollbarContent;
|
||||
mScrollbar->GetContent(getter_AddRefs(scrollbarContent));
|
||||
|
@ -2136,7 +2136,7 @@ nsTreeRowGroupFrame :: AttributeChanged ( nsIPresContext* aPresContext, nsIConte
|
|||
nsAutoString attribute;
|
||||
aChild->GetAttribute ( kNameSpaceID_None, aAttribute, attribute );
|
||||
attribute.ToLowerCase();
|
||||
mDropOnContainer = attribute.Equals("true");
|
||||
mDropOnContainer = attribute.EqualsWithConversion("true");
|
||||
}
|
||||
else
|
||||
rv = nsTableRowGroupFrame::AttributeChanged ( aPresContext, aChild, aNameSpaceID, aAttribute, aHint );
|
||||
|
@ -2443,9 +2443,9 @@ nsTreeRowGroupFrame :: IsOpenContainer ( ) const
|
|||
nsCOMPtr<nsIDOMElement> me ( do_QueryInterface(mContent) );
|
||||
if ( me ) {
|
||||
nsAutoString isContainer, isOpen;
|
||||
me->GetAttribute(nsAutoString("container"), isContainer);
|
||||
me->GetAttribute(nsAutoString("open"), isOpen);
|
||||
isOpenContainer = (isContainer.Equals("true") && isOpen.Equals("true"));
|
||||
me->GetAttribute(NS_ConvertASCIItoUCS2("container"), isContainer);
|
||||
me->GetAttribute(NS_ConvertASCIItoUCS2("open"), isOpen);
|
||||
isOpenContainer = (isContainer.EqualsWithConversion("true") && isOpen.EqualsWithConversion("true"));
|
||||
}
|
||||
|
||||
return isOpenContainer;
|
||||
|
|
|
@ -88,11 +88,11 @@ nsTreeTwistyListener::MouseDown(nsIDOMEvent* aEvent)
|
|||
|
||||
nsAutoString tagName;
|
||||
element->GetTagName(tagName);
|
||||
if (tagName.Equals("titledbutton")) {
|
||||
if (tagName.EqualsWithConversion("titledbutton")) {
|
||||
// Find out if we're the twisty.
|
||||
nsAutoString classAttr;
|
||||
element->GetAttribute("class", classAttr);
|
||||
if (classAttr.Equals("twisty")) {
|
||||
element->GetAttribute(NS_ConvertASCIItoUCS2("class"), classAttr);
|
||||
if (classAttr.EqualsWithConversion("twisty")) {
|
||||
// Retrieve the parent treeitem.
|
||||
nsCOMPtr<nsIDOMElement> treeItem;
|
||||
GetTreeItem(element, getter_AddRefs(treeItem));
|
||||
|
@ -106,10 +106,10 @@ nsTreeTwistyListener::MouseDown(nsIDOMEvent* aEvent)
|
|||
aEvent->PreventDefault();
|
||||
|
||||
nsAutoString open;
|
||||
treeItem->GetAttribute("open", open);
|
||||
if (open.Equals("true"))
|
||||
treeItem->RemoveAttribute("open");
|
||||
else treeItem->SetAttribute("open", "true");
|
||||
treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), open);
|
||||
if (open.EqualsWithConversion("true"))
|
||||
treeItem->RemoveAttribute(NS_ConvertASCIItoUCS2("open"));
|
||||
else treeItem->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true"));
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -47,7 +47,7 @@ void nsXULAtoms::AddRefAtoms() {
|
|||
*/
|
||||
if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) {
|
||||
// gNameSpaceManager->CreateRootNameSpace(namespace);
|
||||
nsAutoString nameSpace(kXULNameSpace);
|
||||
nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace);
|
||||
gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID);
|
||||
} else {
|
||||
NS_ASSERTION(0, "failed to create xul atoms namespace manager");
|
||||
|
|
Загрузка…
Ссылка в новой задаче