From 9abec73fbe89abf1f24a6ee6f4188d76211f2bd5 Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Wed, 23 Aug 2000 17:27:06 +0000 Subject: [PATCH] DOM string changes. All nsString& in DOM interfaces (and interfaces needed by DOM implementations) have been changed to nsAReadableString& and nsAWritableString&. String implementation additions (sanctioned by scc) to support DOM needs. Bug 49091. r=vidur,jst,scc --- content/base/public/nsIContent.h | 13 +- content/base/public/nsIDocument.h | 20 +- content/base/public/nsIDocumentEncoder.h | 6 +- content/base/public/nsINameSpace.h | 5 +- content/base/public/nsINameSpaceManager.h | 7 +- content/base/public/nsINodeInfo.h | 38 +- content/base/public/nsITextContent.h | 9 +- content/base/public/nsTextFragment.h | 7 +- content/base/src/nsCommentNode.cpp | 28 +- content/base/src/nsContentList.cpp | 2 +- content/base/src/nsContentList.h | 2 +- content/base/src/nsDOMAttribute.cpp | 24 +- content/base/src/nsDOMAttribute.h | 2 +- content/base/src/nsDOMAttributeMap.cpp | 12 +- content/base/src/nsDOMAttributeMap.h | 13 +- content/base/src/nsDOMDocumentType.cpp | 26 +- content/base/src/nsDOMDocumentType.h | 16 +- content/base/src/nsDocument.cpp | 144 +- content/base/src/nsDocument.h | 46 +- content/base/src/nsDocumentEncoder.cpp | 12 +- content/base/src/nsDocumentFragment.cpp | 44 +- content/base/src/nsGenericDOMDataNode.cpp | 91 +- content/base/src/nsGenericDOMDataNode.h | 89 +- content/base/src/nsGenericElement.cpp | 113 +- content/base/src/nsGenericElement.h | 194 +-- content/base/src/nsHTMLValue.cpp | 77 +- content/base/src/nsHTMLValue.h | 12 +- content/base/src/nsNameSpaceManager.cpp | 28 +- content/base/src/nsNodeInfo.cpp | 22 +- content/base/src/nsNodeInfo.h | 22 +- content/base/src/nsNodeInfoManager.cpp | 12 +- content/base/src/nsNodeInfoManager.h | 12 +- content/base/src/nsRange.cpp | 8 +- content/base/src/nsRange.h | 6 +- content/base/src/nsSelection.cpp | 10 +- content/base/src/nsTextFragment.cpp | 31 +- content/base/src/nsTextFragment.h | 7 +- content/base/src/nsTextNode.cpp | 4 +- .../events/public/nsIEventListenerManager.h | 8 +- content/events/public/nsIPrivateDOMEvent.h | 2 +- content/events/src/nsDOMEvent.cpp | 25 +- content/events/src/nsDOMEvent.h | 14 +- content/events/src/nsEventListenerManager.cpp | 17 +- content/events/src/nsEventListenerManager.h | 12 +- content/html/content/public/nsIForm.h | 4 +- content/html/content/public/nsIHTMLContent.h | 8 +- .../content/src/GenericElementCollection.cpp | 2 +- .../content/src/GenericElementCollection.h | 2 +- .../html/content/src/nsAttributeContent.cpp | 35 +- .../content/src/nsGenericDOMHTMLCollection.h | 2 +- .../html/content/src/nsGenericHTMLElement.cpp | 243 +-- .../html/content/src/nsGenericHTMLElement.h | 164 +- .../html/content/src/nsHTMLAnchorElement.cpp | 95 +- .../html/content/src/nsHTMLAppletElement.cpp | 27 +- .../html/content/src/nsHTMLAreaElement.cpp | 77 +- content/html/content/src/nsHTMLBRElement.cpp | 7 +- .../html/content/src/nsHTMLBaseElement.cpp | 9 +- .../content/src/nsHTMLBaseFontElement.cpp | 11 +- .../html/content/src/nsHTMLBodyElement.cpp | 21 +- .../html/content/src/nsHTMLButtonElement.cpp | 78 +- .../html/content/src/nsHTMLDListElement.cpp | 4 +- content/html/content/src/nsHTMLDelElement.cpp | 9 +- .../content/src/nsHTMLDirectoryElement.cpp | 4 +- content/html/content/src/nsHTMLDivElement.cpp | 7 +- .../html/content/src/nsHTMLEmbedElement.cpp | 4 +- .../content/src/nsHTMLFieldSetElement.cpp | 4 +- .../html/content/src/nsHTMLFontElement.cpp | 20 +- .../html/content/src/nsHTMLFormElement.cpp | 36 +- .../html/content/src/nsHTMLFrameElement.cpp | 23 +- .../content/src/nsHTMLFrameSetElement.cpp | 9 +- content/html/content/src/nsHTMLHRElement.cpp | 13 +- .../html/content/src/nsHTMLHeadElement.cpp | 7 +- .../html/content/src/nsHTMLHeadingElement.cpp | 7 +- .../html/content/src/nsHTMLHtmlElement.cpp | 7 +- .../html/content/src/nsHTMLIFrameElement.cpp | 27 +- .../html/content/src/nsHTMLImageElement.cpp | 63 +- .../html/content/src/nsHTMLInputElement.cpp | 60 +- content/html/content/src/nsHTMLInsElement.cpp | 9 +- .../html/content/src/nsHTMLIsIndexElement.cpp | 8 +- content/html/content/src/nsHTMLLIElement.cpp | 9 +- .../html/content/src/nsHTMLLabelElement.cpp | 74 +- .../html/content/src/nsHTMLLegendElement.cpp | 10 +- .../html/content/src/nsHTMLLinkElement.cpp | 29 +- content/html/content/src/nsHTMLMapElement.cpp | 18 +- .../html/content/src/nsHTMLMenuElement.cpp | 4 +- .../html/content/src/nsHTMLMetaElement.cpp | 13 +- content/html/content/src/nsHTMLModElement.cpp | 9 +- .../html/content/src/nsHTMLOListElement.cpp | 11 +- .../html/content/src/nsHTMLObjectElement.cpp | 4 +- .../content/src/nsHTMLOptGroupElement.cpp | 9 +- .../html/content/src/nsHTMLOptionElement.cpp | 14 +- .../content/src/nsHTMLParagraphElement.cpp | 7 +- .../html/content/src/nsHTMLParamElement.cpp | 13 +- content/html/content/src/nsHTMLPreElement.cpp | 7 +- .../html/content/src/nsHTMLQuoteElement.cpp | 7 +- .../html/content/src/nsHTMLScriptElement.cpp | 31 +- .../html/content/src/nsHTMLSelectElement.cpp | 55 +- .../content/src/nsHTMLSharedObjectElement.cpp | 4 +- .../html/content/src/nsHTMLSpacerElement.cpp | 4 +- .../html/content/src/nsHTMLSpanElement.cpp | 4 +- .../html/content/src/nsHTMLStyleElement.cpp | 11 +- .../content/src/nsHTMLTableCaptionElement.cpp | 7 +- .../content/src/nsHTMLTableCellElement.cpp | 35 +- .../content/src/nsHTMLTableColElement.cpp | 17 +- .../src/nsHTMLTableColGroupElement.cpp | 17 +- .../html/content/src/nsHTMLTableElement.cpp | 43 +- .../content/src/nsHTMLTableRowElement.cpp | 23 +- .../content/src/nsHTMLTableSectionElement.cpp | 16 +- .../content/src/nsHTMLTextAreaElement.cpp | 45 +- .../html/content/src/nsHTMLTitleElement.cpp | 20 +- .../html/content/src/nsHTMLUListElement.cpp | 9 +- .../html/content/src/nsHTMLUnknownElement.cpp | 18 +- content/html/content/src/nsHTMLWBRElement.cpp | 4 +- .../html/document/src/nsHTMLContentSink.cpp | 27 +- content/html/document/src/nsHTMLDocument.cpp | 165 +- content/html/document/src/nsHTMLDocument.h | 22 +- content/html/document/src/nsIHTMLDocument.h | 12 +- content/html/style/public/nsICSSParser.h | 22 +- .../html/style/public/nsIComputedDOMStyle.h | 2 +- content/html/style/src/nsCSSDeclaration.cpp | 333 ++-- content/html/style/src/nsCSSParser.cpp | 40 +- content/html/style/src/nsCSSProps.h | 6 +- content/html/style/src/nsCSSStruct.cpp | 333 ++-- content/html/style/src/nsCSSStyleRule.cpp | 24 +- content/html/style/src/nsCSSStyleSheet.cpp | 26 +- content/html/style/src/nsCSSValue.cpp | 161 +- content/html/style/src/nsCSSValue.h | 12 +- content/html/style/src/nsComputedDOMStyle.cpp | 255 +-- .../html/style/src/nsDOMCSSDeclaration.cpp | 522 +++--- content/html/style/src/nsDOMCSSDeclaration.h | 27 +- content/html/style/src/nsHTMLAttributes.cpp | 6 +- content/html/style/src/nsHTMLStyleSheet.cpp | 5 +- content/html/style/src/nsHTMLValue.cpp | 77 +- content/html/style/src/nsHTMLValue.h | 12 +- content/html/style/src/nsICSSDeclaration.h | 20 +- content/html/style/src/nsIHTMLAttributes.h | 2 +- .../html/style/src/nsROCSSPrimitiveValue.cpp | 28 +- content/shared/public/nsCSSProps.h | 6 +- content/shared/public/nsHTMLValue.h | 12 +- content/shared/public/nsTextFragment.h | 7 +- content/shared/src/nsCSSProps.cpp | 10 +- content/shared/src/nsHTMLValue.cpp | 77 +- content/shared/src/nsTextFragment.cpp | 31 +- content/xbl/public/nsIBindingManager.h | 6 +- content/xbl/public/nsIXBLService.h | 2 +- content/xbl/src/nsBindingManager.cpp | 14 +- content/xbl/src/nsXBLService.cpp | 4 +- content/xbl/src/nsXBLService.h | 2 +- content/xml/content/public/nsIXMLContent.h | 26 +- content/xml/content/src/nsXMLCDATASection.cpp | 4 +- content/xml/content/src/nsXMLElement.cpp | 12 +- content/xml/content/src/nsXMLElement.h | 10 +- content/xml/content/src/nsXMLEntity.cpp | 42 +- content/xml/content/src/nsXMLNamedNodeMap.cpp | 24 +- content/xml/content/src/nsXMLNotation.cpp | 34 +- .../src/nsXMLProcessingInstruction.cpp | 22 +- content/xml/document/src/nsXMLDocument.cpp | 36 +- content/xml/document/src/nsXMLDocument.h | 26 +- content/xul/content/public/nsIXULContent.h | 2 +- content/xul/content/src/nsXULAttributes.cpp | 62 +- content/xul/content/src/nsXULAttributes.h | 18 +- content/xul/content/src/nsXULElement.cpp | 181 +- content/xul/content/src/nsXULElement.h | 28 +- content/xul/document/public/nsIXULDocument.h | 6 +- .../document/public/nsIXULPrototypeDocument.h | 5 +- content/xul/document/src/nsElementMap.cpp | 34 +- content/xul/document/src/nsElementMap.h | 8 +- .../document/src/nsXULCommandDispatcher.cpp | 44 +- .../xul/document/src/nsXULCommandDispatcher.h | 7 +- content/xul/document/src/nsXULDocument.cpp | 228 +-- content/xul/document/src/nsXULDocument.h | 72 +- .../document/src/nsXULPrototypeDocument.cpp | 8 +- .../xul/templates/src/nsXULContentUtils.cpp | 66 +- docshell/base/nsDocShell.cpp | 9 +- docshell/base/nsWebShell.cpp | 7 +- dom/public/base/nsIDOMCRMFObject.h | 6 +- dom/public/base/nsIDOMCrypto.h | 36 +- dom/public/base/nsIDOMDOMException.h | 18 +- dom/public/base/nsIDOMHistory.h | 24 +- dom/public/base/nsIDOMLocation.h | 108 +- dom/public/base/nsIDOMMimeType.h | 18 +- dom/public/base/nsIDOMMimeTypeArray.h | 6 +- dom/public/base/nsIDOMNavigator.h | 72 +- dom/public/base/nsIDOMPkcs11.h | 12 +- dom/public/base/nsIDOMPlugin.h | 24 +- dom/public/base/nsIDOMPluginArray.h | 6 +- dom/public/base/nsIDOMViewCSS.h | 6 +- dom/public/base/nsIDOMWindow.h | 66 +- dom/public/base/nsIDOMWindowCollection.h | 6 +- dom/public/coreDom/nsIDOMAttr.h | 18 +- dom/public/coreDom/nsIDOMCharacterData.h | 36 +- dom/public/coreDom/nsIDOMDOMImplementation.h | 18 +- dom/public/coreDom/nsIDOMDocument.h | 72 +- dom/public/coreDom/nsIDOMDocumentCSS.h | 6 +- dom/public/coreDom/nsIDOMDocumentEvent.h | 6 +- dom/public/coreDom/nsIDOMDocumentType.h | 24 +- dom/public/coreDom/nsIDOMDocumentXBL.h | 18 +- dom/public/coreDom/nsIDOMElement.h | 78 +- dom/public/coreDom/nsIDOMEntity.h | 18 +- dom/public/coreDom/nsIDOMMediaList.h | 30 +- dom/public/coreDom/nsIDOMNSDocument.h | 18 +- dom/public/coreDom/nsIDOMNamedNodeMap.h | 24 +- dom/public/coreDom/nsIDOMNode.h | 48 +- dom/public/coreDom/nsIDOMNotation.h | 12 +- .../coreDom/nsIDOMProcessingInstruction.h | 18 +- dom/public/coreDom/nsIDOMStyleSheet.h | 18 +- dom/public/coreEvents/nsIDOMEvent.h | 12 +- dom/public/coreEvents/nsIDOMEventCapturer.h | 14 +- dom/public/coreEvents/nsIDOMEventTarget.h | 12 +- dom/public/coreEvents/nsIDOMKeyEvent.h | 6 +- dom/public/coreEvents/nsIDOMMouseEvent.h | 6 +- dom/public/coreEvents/nsIDOMUIEvent.h | 6 +- dom/public/css/nsIDOMCSS2Properties.h | 1488 ++++++++--------- dom/public/css/nsIDOMCSSImportRule.h | 6 +- dom/public/css/nsIDOMCSSMediaRule.h | 6 +- dom/public/css/nsIDOMCSSPageRule.h | 12 +- dom/public/css/nsIDOMCSSPrimitiveValue.h | 12 +- dom/public/css/nsIDOMCSSRule.h | 12 +- dom/public/css/nsIDOMCSSStyleDeclaration.h | 48 +- dom/public/css/nsIDOMCSSStyleRule.h | 12 +- dom/public/css/nsIDOMCSSStyleSheet.h | 6 +- dom/public/css/nsIDOMCSSValue.h | 12 +- dom/public/css/nsIDOMCounter.h | 18 +- dom/public/html/nsIDOMHTMLAnchorElement.h | 132 +- dom/public/html/nsIDOMHTMLAppletElement.h | 132 +- dom/public/html/nsIDOMHTMLAreaElement.h | 72 +- dom/public/html/nsIDOMHTMLBRElement.h | 12 +- dom/public/html/nsIDOMHTMLBaseElement.h | 24 +- dom/public/html/nsIDOMHTMLBaseFontElement.h | 36 +- dom/public/html/nsIDOMHTMLBodyElement.h | 72 +- dom/public/html/nsIDOMHTMLButtonElement.h | 42 +- dom/public/html/nsIDOMHTMLCollection.h | 6 +- dom/public/html/nsIDOMHTMLDivElement.h | 12 +- dom/public/html/nsIDOMHTMLDocument.h | 66 +- dom/public/html/nsIDOMHTMLElement.h | 72 +- dom/public/html/nsIDOMHTMLEmbedElement.h | 72 +- dom/public/html/nsIDOMHTMLFontElement.h | 36 +- dom/public/html/nsIDOMHTMLFormElement.h | 72 +- dom/public/html/nsIDOMHTMLFrameElement.h | 84 +- dom/public/html/nsIDOMHTMLFrameSetElement.h | 24 +- dom/public/html/nsIDOMHTMLHRElement.h | 36 +- dom/public/html/nsIDOMHTMLHeadElement.h | 12 +- dom/public/html/nsIDOMHTMLHeadingElement.h | 12 +- dom/public/html/nsIDOMHTMLHtmlElement.h | 12 +- dom/public/html/nsIDOMHTMLIFrameElement.h | 120 +- dom/public/html/nsIDOMHTMLImageElement.h | 144 +- dom/public/html/nsIDOMHTMLInputElement.h | 132 +- dom/public/html/nsIDOMHTMLIsIndexElement.h | 12 +- dom/public/html/nsIDOMHTMLLIElement.h | 12 +- dom/public/html/nsIDOMHTMLLabelElement.h | 24 +- dom/public/html/nsIDOMHTMLLayerElement.h | 48 +- dom/public/html/nsIDOMHTMLLegendElement.h | 24 +- dom/public/html/nsIDOMHTMLLinkElement.h | 96 +- dom/public/html/nsIDOMHTMLMapElement.h | 12 +- dom/public/html/nsIDOMHTMLMetaElement.h | 48 +- dom/public/html/nsIDOMHTMLModElement.h | 24 +- dom/public/html/nsIDOMHTMLOListElement.h | 12 +- dom/public/html/nsIDOMHTMLObjectElement.h | 180 +- dom/public/html/nsIDOMHTMLOptGroupElement.h | 12 +- dom/public/html/nsIDOMHTMLOptionElement.h | 36 +- dom/public/html/nsIDOMHTMLParagraphElement.h | 12 +- dom/public/html/nsIDOMHTMLParamElement.h | 48 +- dom/public/html/nsIDOMHTMLQuoteElement.h | 12 +- dom/public/html/nsIDOMHTMLScriptElement.h | 72 +- dom/public/html/nsIDOMHTMLSelectElement.h | 30 +- dom/public/html/nsIDOMHTMLStyleElement.h | 24 +- .../html/nsIDOMHTMLTableCaptionElement.h | 12 +- dom/public/html/nsIDOMHTMLTableCellElement.h | 132 +- dom/public/html/nsIDOMHTMLTableColElement.h | 60 +- dom/public/html/nsIDOMHTMLTableElement.h | 108 +- dom/public/html/nsIDOMHTMLTableRowElement.h | 60 +- .../html/nsIDOMHTMLTableSectionElement.h | 48 +- dom/public/html/nsIDOMHTMLTextAreaElement.h | 54 +- dom/public/html/nsIDOMHTMLTitleElement.h | 12 +- dom/public/html/nsIDOMHTMLUListElement.h | 12 +- dom/public/html/nsIDOMImage.h | 12 +- dom/public/html/nsIDOMNSHTMLAnchorElement.h | 48 +- dom/public/html/nsIDOMNSHTMLAreaElement.h | 42 +- dom/public/html/nsIDOMNSHTMLDocument.h | 72 +- dom/public/html/nsIDOMNSHTMLFormElement.h | 6 +- .../html/nsIDOMNSHTMLOptionCollection.h | 6 +- dom/public/html/nsIDOMNSHTMLSelectElement.h | 6 +- dom/public/idl/coreDom/DOMImplementation.idl | 1 + dom/public/nsIScriptContext.h | 12 +- dom/public/nsIScriptObjectOwner.h | 3 +- dom/public/range/nsIDOMNSRange.h | 12 +- dom/public/range/nsIDOMRange.h | 6 +- dom/public/range/nsIDOMSelection.h | 6 +- dom/public/xul/nsIDOMXULCommandDispatcher.h | 18 +- dom/public/xul/nsIDOMXULDocument.h | 12 +- dom/public/xul/nsIDOMXULElement.h | 42 +- dom/src/base/nsDOMException.cpp | 13 +- dom/src/base/nsDOMWindowList.cpp | 7 +- dom/src/base/nsDOMWindowList.h | 2 +- dom/src/base/nsFrameList.cpp | 2 +- dom/src/base/nsFrameList.h | 2 +- dom/src/base/nsGlobalWindow.cpp | 141 +- dom/src/base/nsGlobalWindow.h | 42 +- dom/src/base/nsHistory.cpp | 8 +- dom/src/base/nsHistory.h | 8 +- dom/src/base/nsJSEnvironment.cpp | 21 +- dom/src/base/nsJSEnvironment.h | 12 +- dom/src/base/nsJSUtils.cpp | 3 +- dom/src/base/nsJSUtils.h | 10 +- dom/src/base/nsLocation.cpp | 104 +- dom/src/base/nsMimeTypeArray.cpp | 8 +- dom/src/base/nsMimeTypeArray.h | 8 +- dom/src/base/nsPluginArray.cpp | 18 +- dom/src/base/nsPluginArray.h | 12 +- dom/src/events/nsJSKeyEvent.cpp | 3 + dom/tools/FileGen.cpp | 13 +- dom/tools/FileGen.h | 1 + dom/tools/XPCOMGen.cpp | 15 +- editor/base/nsEditor.cpp | 4 +- editor/base/nsEditor.h | 4 +- editor/base/nsHTMLEditor.cpp | 10 +- editor/base/nsHTMLEditor.h | 4 +- editor/libeditor/base/nsEditor.cpp | 4 +- editor/libeditor/base/nsEditor.h | 4 +- editor/libeditor/html/nsHTMLEditor.cpp | 10 +- editor/libeditor/html/nsHTMLEditor.h | 4 +- editor/public/nsIEditor.h | 7 +- extensions/psm-glue/src/nsCrypto.cpp | 45 +- htmlparser/src/nsHTMLContentSinkStream.cpp | 16 +- htmlparser/src/nsHTMLContentSinkStream.h | 17 +- htmlparser/src/nsHTMLToTXTSinkStream.cpp | 11 +- htmlparser/src/nsHTMLToTXTSinkStream.h | 19 +- htmlparser/src/nsIParser.h | 6 +- htmlparser/src/nsParser.cpp | 11 +- htmlparser/src/nsParser.h | 6 +- htmlparser/src/nsScanner.cpp | 4 +- htmlparser/src/nsScanner.h | 4 +- layout/base/nsIPresState.h | 12 +- layout/base/nsPresState.cpp | 36 +- layout/base/public/nsIContent.h | 13 +- layout/base/public/nsIDocument.h | 20 +- layout/base/public/nsIDocumentEncoder.h | 6 +- layout/base/public/nsINameSpace.h | 5 +- layout/base/public/nsINameSpaceManager.h | 7 +- layout/base/public/nsINodeInfo.h | 38 +- layout/base/public/nsIPresState.h | 12 +- layout/base/public/nsITextContent.h | 9 +- layout/base/public/nsIXIFConverter.h | 42 +- layout/base/public/nsTextFragment.h | 7 +- layout/base/src/nsCommentNode.cpp | 28 +- layout/base/src/nsContentList.cpp | 2 +- layout/base/src/nsContentList.h | 2 +- layout/base/src/nsDOMAttribute.cpp | 24 +- layout/base/src/nsDOMAttribute.h | 2 +- layout/base/src/nsDOMAttributeMap.cpp | 12 +- layout/base/src/nsDOMAttributeMap.h | 13 +- layout/base/src/nsDOMDocumentType.cpp | 26 +- layout/base/src/nsDOMDocumentType.h | 16 +- layout/base/src/nsDocument.cpp | 144 +- layout/base/src/nsDocument.h | 46 +- layout/base/src/nsDocumentEncoder.cpp | 12 +- layout/base/src/nsDocumentFragment.cpp | 44 +- layout/base/src/nsGenericDOMDataNode.cpp | 91 +- layout/base/src/nsGenericDOMDataNode.h | 89 +- layout/base/src/nsGenericElement.cpp | 113 +- layout/base/src/nsGenericElement.h | 194 +-- layout/base/src/nsNameSpaceManager.cpp | 28 +- layout/base/src/nsNodeInfo.cpp | 22 +- layout/base/src/nsNodeInfo.h | 22 +- layout/base/src/nsNodeInfoManager.cpp | 12 +- layout/base/src/nsNodeInfoManager.h | 12 +- layout/base/src/nsPresState.cpp | 36 +- layout/base/src/nsRange.cpp | 8 +- layout/base/src/nsRange.h | 6 +- layout/base/src/nsSelection.cpp | 10 +- layout/base/src/nsTextFragment.cpp | 31 +- layout/base/src/nsTextNode.cpp | 4 +- layout/base/src/nsXIFConverter.cpp | 63 +- layout/base/src/nsXIFConverter.h | 47 +- .../events/public/nsIEventListenerManager.h | 8 +- layout/events/public/nsIPrivateDOMEvent.h | 2 +- layout/events/src/nsDOMEvent.cpp | 25 +- layout/events/src/nsDOMEvent.h | 14 +- layout/events/src/nsEventListenerManager.cpp | 17 +- layout/events/src/nsEventListenerManager.h | 12 +- layout/forms/nsComboboxControlFrame.cpp | 4 +- layout/forms/nsComboboxControlFrame.h | 4 +- layout/forms/nsFileControlFrame.cpp | 4 +- layout/forms/nsFileControlFrame.h | 4 +- layout/forms/nsFormControlFrame.cpp | 5 +- layout/forms/nsFormControlFrame.h | 4 +- layout/forms/nsFormControlHelper.cpp | 10 +- layout/forms/nsFormControlHelper.h | 8 +- layout/forms/nsGfxCheckboxControlFrame.cpp | 22 +- layout/forms/nsGfxCheckboxControlFrame.h | 12 +- layout/forms/nsGfxRadioControlFrame.cpp | 6 +- layout/forms/nsGfxRadioControlFrame.h | 4 +- layout/forms/nsHTMLButtonControlFrame.cpp | 5 +- layout/forms/nsHTMLButtonControlFrame.h | 4 +- layout/forms/nsIFormControlFrame.h | 4 +- layout/forms/nsImageControlFrame.cpp | 11 +- layout/forms/nsListControlFrame.cpp | 14 +- layout/forms/nsListControlFrame.h | 4 +- layout/forms/nsTextControlFrame.h | 4 +- layout/generic/nsSelection.cpp | 10 +- layout/html/base/src/nsIHTMLContent.h | 8 +- layout/html/content/public/nsIForm.h | 4 +- .../content/src/GenericElementCollection.cpp | 2 +- .../content/src/GenericElementCollection.h | 2 +- .../html/content/src/nsAttributeContent.cpp | 35 +- .../content/src/nsGenericDOMHTMLCollection.h | 2 +- .../html/content/src/nsGenericHTMLElement.cpp | 243 +-- .../html/content/src/nsGenericHTMLElement.h | 164 +- .../html/content/src/nsHTMLAnchorElement.cpp | 95 +- .../html/content/src/nsHTMLAppletElement.cpp | 27 +- layout/html/content/src/nsHTMLAreaElement.cpp | 77 +- layout/html/content/src/nsHTMLBRElement.cpp | 7 +- layout/html/content/src/nsHTMLBaseElement.cpp | 9 +- .../content/src/nsHTMLBaseFontElement.cpp | 11 +- layout/html/content/src/nsHTMLBodyElement.cpp | 21 +- .../html/content/src/nsHTMLButtonElement.cpp | 78 +- .../html/content/src/nsHTMLDListElement.cpp | 4 +- layout/html/content/src/nsHTMLDelElement.cpp | 9 +- .../content/src/nsHTMLDirectoryElement.cpp | 4 +- layout/html/content/src/nsHTMLDivElement.cpp | 7 +- .../html/content/src/nsHTMLEmbedElement.cpp | 4 +- .../content/src/nsHTMLFieldSetElement.cpp | 4 +- layout/html/content/src/nsHTMLFontElement.cpp | 20 +- layout/html/content/src/nsHTMLFormElement.cpp | 36 +- .../html/content/src/nsHTMLFrameElement.cpp | 23 +- .../content/src/nsHTMLFrameSetElement.cpp | 9 +- layout/html/content/src/nsHTMLHRElement.cpp | 13 +- layout/html/content/src/nsHTMLHeadElement.cpp | 7 +- .../html/content/src/nsHTMLHeadingElement.cpp | 7 +- layout/html/content/src/nsHTMLHtmlElement.cpp | 7 +- .../html/content/src/nsHTMLIFrameElement.cpp | 27 +- .../html/content/src/nsHTMLImageElement.cpp | 63 +- .../html/content/src/nsHTMLInputElement.cpp | 60 +- layout/html/content/src/nsHTMLInsElement.cpp | 9 +- .../html/content/src/nsHTMLIsIndexElement.cpp | 8 +- layout/html/content/src/nsHTMLLIElement.cpp | 9 +- .../html/content/src/nsHTMLLabelElement.cpp | 74 +- .../html/content/src/nsHTMLLayerElement.cpp | 20 +- .../html/content/src/nsHTMLLegendElement.cpp | 10 +- layout/html/content/src/nsHTMLLinkElement.cpp | 29 +- layout/html/content/src/nsHTMLMapElement.cpp | 18 +- layout/html/content/src/nsHTMLMenuElement.cpp | 4 +- layout/html/content/src/nsHTMLMetaElement.cpp | 13 +- layout/html/content/src/nsHTMLModElement.cpp | 9 +- .../html/content/src/nsHTMLOListElement.cpp | 11 +- .../html/content/src/nsHTMLObjectElement.cpp | 4 +- .../content/src/nsHTMLOptGroupElement.cpp | 9 +- .../html/content/src/nsHTMLOptionElement.cpp | 14 +- .../content/src/nsHTMLParagraphElement.cpp | 7 +- .../html/content/src/nsHTMLParamElement.cpp | 13 +- layout/html/content/src/nsHTMLPreElement.cpp | 7 +- .../html/content/src/nsHTMLQuoteElement.cpp | 7 +- .../html/content/src/nsHTMLScriptElement.cpp | 31 +- .../html/content/src/nsHTMLSelectElement.cpp | 55 +- .../html/content/src/nsHTMLSpacerElement.cpp | 4 +- layout/html/content/src/nsHTMLSpanElement.cpp | 4 +- .../html/content/src/nsHTMLStyleElement.cpp | 11 +- .../content/src/nsHTMLTableCaptionElement.cpp | 7 +- .../content/src/nsHTMLTableCellElement.cpp | 35 +- .../content/src/nsHTMLTableColElement.cpp | 17 +- .../src/nsHTMLTableColGroupElement.cpp | 17 +- .../html/content/src/nsHTMLTableElement.cpp | 43 +- .../content/src/nsHTMLTableRowElement.cpp | 23 +- .../content/src/nsHTMLTableSectionElement.cpp | 16 +- .../content/src/nsHTMLTextAreaElement.cpp | 45 +- .../html/content/src/nsHTMLTitleElement.cpp | 20 +- .../html/content/src/nsHTMLUListElement.cpp | 9 +- .../html/content/src/nsHTMLUnknownElement.cpp | 18 +- layout/html/content/src/nsHTMLWBRElement.cpp | 4 +- .../html/document/src/nsHTMLContentSink.cpp | 27 +- layout/html/document/src/nsHTMLDocument.cpp | 165 +- layout/html/document/src/nsHTMLDocument.h | 22 +- layout/html/document/src/nsIHTMLDocument.h | 12 +- .../html/forms/public/nsIFormControlFrame.h | 4 +- layout/html/forms/src/nsButtonControlFrame.h | 4 +- .../html/forms/src/nsCheckboxControlFrame.cpp | 4 +- .../html/forms/src/nsCheckboxControlFrame.h | 4 +- .../html/forms/src/nsComboboxControlFrame.cpp | 4 +- .../html/forms/src/nsComboboxControlFrame.h | 4 +- layout/html/forms/src/nsFileControlFrame.cpp | 4 +- layout/html/forms/src/nsFileControlFrame.h | 4 +- layout/html/forms/src/nsFormControlFrame.cpp | 5 +- layout/html/forms/src/nsFormControlFrame.h | 4 +- layout/html/forms/src/nsFormControlHelper.cpp | 10 +- layout/html/forms/src/nsFormControlHelper.h | 8 +- .../forms/src/nsGfxCheckboxControlFrame.cpp | 22 +- .../forms/src/nsGfxCheckboxControlFrame.h | 12 +- .../html/forms/src/nsGfxListControlFrame.cpp | 13 +- layout/html/forms/src/nsGfxListControlFrame.h | 4 +- .../html/forms/src/nsGfxRadioControlFrame.cpp | 6 +- .../html/forms/src/nsGfxRadioControlFrame.h | 4 +- .../html/forms/src/nsGfxTextControlFrame.cpp | 2 +- layout/html/forms/src/nsGfxTextControlFrame.h | 4 +- .../html/forms/src/nsGfxTextControlFrame2.cpp | 10 +- .../html/forms/src/nsGfxTextControlFrame2.h | 8 +- .../forms/src/nsHTMLButtonControlFrame.cpp | 5 +- .../html/forms/src/nsHTMLButtonControlFrame.h | 4 +- layout/html/forms/src/nsImageControlFrame.cpp | 11 +- layout/html/forms/src/nsListControlFrame.cpp | 14 +- layout/html/forms/src/nsListControlFrame.h | 4 +- .../forms/src/nsNativeSelectControlFrame.cpp | 6 +- .../forms/src/nsNativeTextControlFrame.cpp | 4 +- .../html/forms/src/nsNativeTextControlFrame.h | 4 +- layout/html/forms/src/nsRadioControlFrame.cpp | 4 +- layout/html/forms/src/nsRadioControlFrame.h | 4 +- .../html/forms/src/nsSelectControlFrame.cpp | 8 +- layout/html/forms/src/nsTextControlFrame.h | 4 +- layout/html/style/public/nsICSSParser.h | 22 +- .../html/style/public/nsIComputedDOMStyle.h | 2 +- layout/html/style/src/nsCSSDeclaration.cpp | 333 ++-- layout/html/style/src/nsCSSParser.cpp | 40 +- layout/html/style/src/nsCSSProps.cpp | 10 +- layout/html/style/src/nsCSSProps.h | 6 +- layout/html/style/src/nsCSSStyleRule.cpp | 24 +- layout/html/style/src/nsCSSStyleSheet.cpp | 26 +- layout/html/style/src/nsCSSValue.cpp | 161 +- layout/html/style/src/nsCSSValue.h | 12 +- layout/html/style/src/nsComputedDOMStyle.cpp | 255 +-- layout/html/style/src/nsDOMCSSDeclaration.cpp | 522 +++--- layout/html/style/src/nsDOMCSSDeclaration.h | 27 +- layout/html/style/src/nsHTMLAttributes.cpp | 6 +- layout/html/style/src/nsHTMLStyleSheet.cpp | 5 +- layout/html/style/src/nsHTMLValue.cpp | 77 +- layout/html/style/src/nsHTMLValue.h | 12 +- layout/html/style/src/nsICSSDeclaration.h | 20 +- layout/html/style/src/nsIHTMLAttributes.h | 2 +- layout/html/style/src/nsIHTMLStyleSheet.h | 3 +- .../html/style/src/nsROCSSPrimitiveValue.cpp | 28 +- layout/html/tests/TestAttributes.cpp | 8 +- layout/style/nsCSSDeclaration.cpp | 333 ++-- layout/style/nsCSSParser.cpp | 40 +- layout/style/nsCSSProps.cpp | 10 +- layout/style/nsCSSProps.h | 6 +- layout/style/nsCSSStruct.cpp | 333 ++-- layout/style/nsCSSStyleRule.cpp | 24 +- layout/style/nsCSSStyleSheet.cpp | 26 +- layout/style/nsCSSValue.cpp | 161 +- layout/style/nsCSSValue.h | 12 +- layout/style/nsComputedDOMStyle.cpp | 255 +-- layout/style/nsDOMCSSDeclaration.cpp | 522 +++--- layout/style/nsDOMCSSDeclaration.h | 27 +- layout/style/nsHTMLStyleSheet.cpp | 5 +- layout/style/nsICSSParser.h | 22 +- layout/style/nsIComputedDOMStyle.h | 2 +- layout/style/nsROCSSPrimitiveValue.cpp | 28 +- layout/xbl/public/nsIBindingManager.h | 6 +- layout/xbl/public/nsIXBLService.h | 2 +- layout/xbl/src/nsBindingManager.cpp | 14 +- layout/xbl/src/nsXBLService.cpp | 4 +- layout/xbl/src/nsXBLService.h | 2 +- layout/xml/content/public/nsIXMLContent.h | 26 +- .../xml/content/src/nsGenericXMLElement.cpp | 10 +- layout/xml/content/src/nsGenericXMLElement.h | 18 +- layout/xml/content/src/nsXMLCDATASection.cpp | 4 +- layout/xml/content/src/nsXMLDocumentType.cpp | 44 +- layout/xml/content/src/nsXMLElement.cpp | 12 +- layout/xml/content/src/nsXMLElement.h | 10 +- layout/xml/content/src/nsXMLEntity.cpp | 42 +- layout/xml/content/src/nsXMLNamedNodeMap.cpp | 24 +- layout/xml/content/src/nsXMLNotation.cpp | 34 +- .../src/nsXMLProcessingInstruction.cpp | 22 +- layout/xml/document/src/nsXMLDocument.cpp | 36 +- layout/xml/document/src/nsXMLDocument.h | 26 +- layout/xul/base/src/nsTitledButtonFrame.cpp | 4 +- mailnews/base/src/nsMsgPrintEngine.cpp | 2 +- mailnews/mime/src/nsMimeTransition.cpp | 3 - modules/plugin/base/src/nsPluginHostImpl.cpp | 28 +- modules/plugin/nglsrc/nsPluginHostImpl.cpp | 28 +- netwerk/base/public/nsNetUtil.h | 11 +- .../converters/nsFTPDirListingConv.h | 2 +- .../src/nsHTMLContentSinkStream.cpp | 16 +- .../htmlparser/src/nsHTMLContentSinkStream.h | 17 +- .../htmlparser/src/nsHTMLToTXTSinkStream.cpp | 11 +- parser/htmlparser/src/nsHTMLToTXTSinkStream.h | 19 +- parser/htmlparser/src/nsIParser.h | 6 +- parser/htmlparser/src/nsParser.cpp | 11 +- parser/htmlparser/src/nsParser.h | 6 +- parser/htmlparser/src/nsScanner.cpp | 4 +- parser/htmlparser/src/nsScanner.h | 4 +- .../public/nsIDOMXULCommandDispatcher.h | 18 +- rdf/content/public/nsIDOMXULDocument.h | 12 +- rdf/content/public/nsIDOMXULElement.h | 42 +- rdf/content/public/nsIDOMXULMenuListElement.h | 48 +- rdf/content/public/nsIXULContent.h | 2 +- rdf/content/public/nsIXULContentUtils.h | 14 +- rdf/content/public/nsIXULDocument.h | 6 +- rdf/content/public/nsIXULPrototypeDocument.h | 5 +- rdf/content/src/nsElementMap.cpp | 34 +- rdf/content/src/nsElementMap.h | 8 +- rdf/content/src/nsXULAttributes.cpp | 62 +- rdf/content/src/nsXULAttributes.h | 18 +- rdf/content/src/nsXULCommandDispatcher.cpp | 44 +- rdf/content/src/nsXULCommandDispatcher.h | 7 +- rdf/content/src/nsXULContentUtils.cpp | 66 +- rdf/content/src/nsXULDocument.cpp | 228 +-- rdf/content/src/nsXULDocument.h | 72 +- rdf/content/src/nsXULElement.cpp | 181 +- rdf/content/src/nsXULElement.h | 28 +- rdf/content/src/nsXULMenuListElement.cpp | 16 +- rdf/content/src/nsXULPrototypeDocument.cpp | 8 +- string/obsolete/nsString.cpp | 80 +- string/obsolete/nsString.h | 21 +- string/obsolete/nsString2.cpp | 9 + string/obsolete/nsString2.h | 3 +- string/public/nsAReadableString.h | 115 +- string/public/nsReadableUtils.h | 79 + string/src/nsReadableUtils.cpp | 58 + xpcom/build/dlldeps.cpp | 7 + xpcom/ds/nsAReadableString.h | 115 +- xpcom/ds/nsAtomTable.cpp | 121 +- xpcom/ds/nsAtomTable.h | 2 +- xpcom/ds/nsCRT.cpp | 20 + xpcom/ds/nsCRT.h | 8 + xpcom/ds/nsHashtable.cpp | 4 +- xpcom/ds/nsHashtable.h | 3 +- xpcom/ds/nsIAtom.idl | 10 +- xpcom/ds/nsReadableUtils.cpp | 58 + xpcom/ds/nsReadableUtils.h | 79 + xpcom/ds/nsString.cpp | 80 +- xpcom/ds/nsString.h | 21 +- xpcom/ds/nsString2.cpp | 9 + xpcom/ds/nsString2.h | 3 +- xpcom/ds/nsVoidArray.cpp | 24 +- xpcom/ds/nsVoidArray.h | 17 +- xpcom/string/obsolete/nsString.cpp | 80 +- xpcom/string/obsolete/nsString.h | 21 +- xpcom/string/obsolete/nsString2.cpp | 9 + xpcom/string/obsolete/nsString2.h | 3 +- xpcom/string/public/nsAReadableString.h | 115 +- xpcom/string/public/nsReadableUtils.h | 79 + xpcom/string/src/nsReadableUtils.cpp | 58 + xpfe/bootstrap/nsDocLoadObserver.cpp | 2 +- 632 files changed, 11678 insertions(+), 10726 deletions(-) diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index 051e7f11b54c..f54ef6bf1ab8 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -26,13 +26,12 @@ #include "nslayout.h" #include "nsISupports.h" #include "nsGUIEvent.h" +#include "nsAWritableString.h" // Forward declarations class nsIAtom; class nsIDocument; class nsIPresContext; -class nsString; -class nsString; class nsVoidArray; class nsIXIFConverter; class nsIDOMEvent; @@ -107,7 +106,7 @@ public: * @param aNameSpaceID out parameter reprsenting the namespace * of the attribute */ - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) = 0; @@ -136,7 +135,7 @@ public: * notified of the attribute change. */ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) = 0; /** @@ -153,7 +152,7 @@ public: * @param aNotify specifies whether or not the document should be * notified of the attribute change. */ - NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) = 0; /** @@ -174,7 +173,7 @@ public: * */ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const = 0; + nsAWritableString& aResult) const = 0; /** * Get the current value and prefix of the attribute. This returns a form @@ -197,7 +196,7 @@ public: */ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const = 0; + nsIAtom*& aPrefix, nsAWritableString& aResult) const = 0; /** * Remove an attribute so that it is no longer explicitly specified. diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 13270667bb7c..94c446f6de4e 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -26,6 +26,7 @@ #include "nsISupports.h" #include "nsIUnicharInputStream.h" #include "nsGUIEvent.h" +#include "nsAWritableString.h" class nsIAtom; class nsIArena; @@ -43,7 +44,6 @@ class nsIStyleRule; class nsIURI; class nsILoadGroup; class nsIViewManager; -class nsString; class nsIScriptGlobalObject; class nsIDOMEvent; class nsIDeviceContext; @@ -130,14 +130,14 @@ public: /** * Return the content (mime) type of this document. */ - NS_IMETHOD GetContentType(nsString& aContentType) const = 0; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const = 0; /** * Return a standard name for the document's character set. This will * trigger a startDocumentLoad if necessary to answer the question. */ - NS_IMETHOD GetDocumentCharacterSet(nsString& oCharSetID) = 0; - NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID) = 0; + NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharSetID) = 0; + NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID) = 0; /** * Add an observer that gets notified whenever the charset changes. @@ -161,8 +161,8 @@ public: * Access HTTP header data (this may also get set from other sources, like * HTML META tags). */ - NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const = 0; - NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData) = 0; + NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const = 0; + NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData) = 0; /** * Create a new presentation shell that will use aContext for @@ -296,7 +296,7 @@ public: /** * Finds text in content */ - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0; + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0; /** * Converts the document or a selection of the @@ -306,7 +306,7 @@ public: * NOTE: we may way to place the result in a stream, * but we will use a string for now -- gpk */ - NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0; + NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0; NS_IMETHOD ToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0; virtual void BeginConvertToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0; virtual void ConvertChildrenToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0; @@ -348,8 +348,8 @@ extern NS_LAYOUT nsresult nsIDocument* aOwnerDocument); extern NS_LAYOUT nsresult NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult, - const nsString& aNamespaceURI, - const nsString& aQualifiedName, + const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIURI* aBaseURI); diff --git a/content/base/public/nsIDocumentEncoder.h b/content/base/public/nsIDocumentEncoder.h index d505c9001fa4..e9904a4b273f 100644 --- a/content/base/public/nsIDocumentEncoder.h +++ b/content/base/public/nsIDocumentEncoder.h @@ -112,7 +112,7 @@ public: /** * Initialize with a pointer to the document and the mime type. */ - NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 flags) = 0; + NS_IMETHOD Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 flags) = 0; /** * If the selection is set to a non-null value, then the @@ -130,7 +130,7 @@ public: * * Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER */ - NS_IMETHOD SetCharset(const nsString& aCharset) = 0; + NS_IMETHOD SetCharset(const nsAReadableString& aCharset) = 0; /** * Set a wrap column. This may have no effect in some types of encoders. @@ -145,7 +145,7 @@ public: * might have been encountered. */ NS_IMETHOD EncodeToStream(nsIOutputStream* aStream) = 0; - NS_IMETHOD EncodeToString(nsString& aOutputString) = 0; + NS_IMETHOD EncodeToString(nsAWritableString& aOutputString) = 0; }; // XXXXXXXXXXXXXXXX nsITextEncoder is going away! XXXXXXXXXXXXXXXXXXXXXX diff --git a/content/base/public/nsINameSpace.h b/content/base/public/nsINameSpace.h index b1fb8206ab0b..401f4c7037b5 100644 --- a/content/base/public/nsINameSpace.h +++ b/content/base/public/nsINameSpace.h @@ -54,7 +54,7 @@ public: // Get data of this name space NS_IMETHOD GetNameSpaceID(PRInt32& aID) const = 0; - NS_IMETHOD GetNameSpaceURI(nsString& aURI) const = 0; + NS_IMETHOD GetNameSpaceURI(nsAWritableString& aURI) const = 0; NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const = 0; NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const = 0; @@ -65,7 +65,8 @@ public: NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const = 0; // create new child name space - NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI, + NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, + const nsAReadableString& aURI, nsINameSpace*& aChildNameSpace) = 0; NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID, diff --git a/content/base/public/nsINameSpaceManager.h b/content/base/public/nsINameSpaceManager.h index f2407dcfa31b..726ffa9422af 100644 --- a/content/base/public/nsINameSpaceManager.h +++ b/content/base/public/nsINameSpaceManager.h @@ -25,6 +25,7 @@ #include "nsISupports.h" #include "nslayout.h" +#include "nsAWritableString.h" class nsIAtom; class nsString; @@ -70,11 +71,11 @@ public: NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace) = 0; - NS_IMETHOD RegisterNameSpace(const nsString& aURI, + NS_IMETHOD RegisterNameSpace(const nsAReadableString& aURI, PRInt32& aNameSpaceID) = 0; - NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) = 0; - NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID) = 0; + NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI) = 0; + NS_IMETHOD GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID) = 0; }; extern NS_LAYOUT nsresult diff --git a/content/base/public/nsINodeInfo.h b/content/base/public/nsINodeInfo.h index c52ac0bd4ac8..244324b435d0 100644 --- a/content/base/public/nsINodeInfo.h +++ b/content/base/public/nsINodeInfo.h @@ -41,6 +41,7 @@ #define nsINodeInfo_h___ #include "nsISupports.h" +#include "nsAWritableString.h" // Forward declarations class nsIAtom; @@ -73,7 +74,7 @@ public: * For the HTML element "" this will return "body" and for the XML * element "" this will return "body". */ - NS_IMETHOD GetName(nsString& aName) = 0; + NS_IMETHOD GetName(nsAWritableString& aName) = 0; /* * Get the name from this node as an atom, this does not include the prefix. @@ -91,7 +92,7 @@ public: * For the HTML element "" this will return "body" and for the XML * element "" this will return "html:body". */ - NS_IMETHOD GetQualifiedName(nsString& aQualifiedName) = 0; + NS_IMETHOD GetQualifiedName(nsAWritableString& aQualifiedName) = 0; /* * Get the local name from this node as a string, GetLocalName() gets the @@ -102,7 +103,7 @@ public: * For the HTML element "" in a HTML document this will return a null * string and for the XML element "" this will return "body". */ - NS_IMETHOD GetLocalName(nsString& aLocalName) = 0; + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) = 0; /* * Get the prefix from this node as a string. @@ -110,7 +111,7 @@ public: * For the HTML element "" this will return a null string and for * the XML element "" this will return the string "html". */ - NS_IMETHOD GetPrefix(nsString& aPrefix) = 0; + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) = 0; /* * Get the prefix from this node as an atom. @@ -129,7 +130,7 @@ public: * xmlns:html='http://www.w3.org/1999/xhtml' attribute) this will return * the string "http://www.w3.org/1999/xhtml". */ - NS_IMETHOD GetNamespaceURI(nsString& aNameSpaceURI) = 0; + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNameSpaceURI) = 0; /* * Get the namespace ID for a node if the node has a namespace, if not this @@ -154,18 +155,19 @@ public: * namespace ID. */ NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName) = 0; + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName) = 0; NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName, - const nsString& aPrefix) = 0; + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, + const nsAReadableString& aPrefix) = 0; NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID) = 0; + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, PRInt32 aNamespaceID) = 0; NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom, PRInt32 aNamespaceID) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, + const nsAReadableString& aPrefix, PRInt32 aNamespaceID) = 0; NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID) = 0; - NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI) = 0; + NS_IMETHOD_(PRBool) NamespaceEquals(const nsAReadableString& aNamespaceURI) = 0; /* * This is a convinience method that creates a new nsINodeInfo that differs @@ -197,15 +199,17 @@ public: */ NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, + const nsAReadableString& aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, + const nsAReadableString& aPrefix, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aQualifiedName, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aQualifiedName, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) = 0; /* diff --git a/content/base/public/nsITextContent.h b/content/base/public/nsITextContent.h index 46fb3099ee5b..108e94b5e6f9 100644 --- a/content/base/public/nsITextContent.h +++ b/content/base/public/nsITextContent.h @@ -52,7 +52,7 @@ public: /** * Make a copy of the text content in aResult. */ - NS_IMETHOD CopyText(nsString& aResult) = 0; + NS_IMETHOD CopyText(nsAWritableString& aResult) = 0; /** * Set the text to the given value. If aNotify is PR_TRUE then @@ -62,6 +62,13 @@ public: PRInt32 aLength, PRBool aNotify) = 0; + /** + * Set the text to the given value. If aNotify is PR_TRUE then + * the document is notified of the content change. + */ + NS_IMETHOD SetText(const nsAReadableString& aStr, + PRBool aNotify) = 0; + /** * Set the text to the given value. If aNotify is PR_TRUE then * the document is notified of the content change. diff --git a/content/base/public/nsTextFragment.h b/content/base/public/nsTextFragment.h index defc9f16aab2..52ccecd47637 100644 --- a/content/base/public/nsTextFragment.h +++ b/content/base/public/nsTextFragment.h @@ -23,6 +23,7 @@ #define nsTextFragment_h___ #include "nslayout.h" +#include "nsAWritableString.h" class nsString; // XXX should this normalize the code to keep a \u0000 at the end? @@ -112,7 +113,7 @@ public: * Change the contents of this fragment to be a copy of the * the argument string. */ - nsTextFragment& operator=(const nsString& aString); + nsTextFragment& operator=(const nsAReadableString& aString); /** * Return PR_TRUE if this fragment is represented by PRUnichar data @@ -166,8 +167,8 @@ public: /** * Change the contents of this fragment to be the given buffer and * length. The memory becomes owned by the fragment. In addition, - * the memory for aBuffer must have been allocated using the "new[]" - * because it will be released with "delete []". + * the memory for aBuffer must have been allocated using the + * nsIMemory interface. */ void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease); diff --git a/content/base/src/nsCommentNode.cpp b/content/base/src/nsCommentNode.cpp index 3f02aa9f5a93..29d13fe201ea 100644 --- a/content/base/src/nsCommentNode.cpp +++ b/content/base/src/nsCommentNode.cpp @@ -110,7 +110,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { aResult = nsnull; return NS_OK; } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -120,19 +120,19 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsString &aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aAttribute, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsIAtom*& aPrefix, nsString &aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNodeInfo, aValue, aNotify); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -215,12 +215,14 @@ public: NS_IMETHOD GetTextLength(PRInt32* aLengthResult) { return mInner.GetTextLength(aLengthResult); } - NS_IMETHOD CopyText(nsString& aResult) { + NS_IMETHOD CopyText(nsAWritableString& aResult) { return mInner.CopyText(aResult); } NS_IMETHOD SetText(const PRUnichar* aBuffer, PRInt32 aLength, PRBool aNotify); + NS_IMETHOD SetText(const nsAReadableString& aStr, + PRBool aNotify); NS_IMETHOD SetText(const char* aBuffer, PRInt32 aLength, PRBool aNotify); @@ -289,9 +291,9 @@ nsCommentNode::GetTag(nsIAtom*& aResult) const } NS_IMETHODIMP -nsCommentNode::GetNodeName(nsString& aNodeName) +nsCommentNode::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#comment"); + aNodeName.Assign(NS_LITERAL_STRING("#comment")); return NS_OK; } @@ -545,6 +547,16 @@ nsCommentNode::SetText(const PRUnichar* aBuffer, return mInner.SetText(this, str.GetUnicode(), str.Length(), aNotify); } +NS_IMETHODIMP +nsCommentNode::SetText(const nsAReadableString& aStr, + PRBool aNotify) +{ + nsAutoString str(aStr); + + StripCommentDelimiters(str); + return mInner.SetText(this, str.GetUnicode(), str.Length(), aNotify); +} + NS_IMETHODIMP nsCommentNode::SetText(const char* aBuffer, PRInt32 aLength, diff --git a/content/base/src/nsContentList.cpp b/content/base/src/nsContentList.cpp index 59aee5a87e57..b002486a18f3 100644 --- a/content/base/src/nsContentList.cpp +++ b/content/base/src/nsContentList.cpp @@ -180,7 +180,7 @@ nsContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsContentList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsContentList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { nsresult result = CheckDocumentExistence(); diff --git a/content/base/src/nsContentList.h b/content/base/src/nsContentList.h index 1a95a618f941..8d0d557e4bd0 100644 --- a/content/base/src/nsContentList.h +++ b/content/base/src/nsContentList.h @@ -57,7 +57,7 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); // nsIScriptObjectOwner NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp index 9421f550f633..98cd37736c6d 100644 --- a/content/base/src/nsDOMAttribute.cpp +++ b/content/base/src/nsDOMAttribute.cpp @@ -37,7 +37,7 @@ static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID); nsDOMAttribute::nsDOMAttribute(nsIContent* aContent, nsINodeInfo *aNodeInfo, - const nsString& aValue) + const nsAReadableString& aValue) : mNodeInfo(aNodeInfo), mValue(aValue) { NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!"); @@ -156,7 +156,7 @@ nsDOMAttribute::SetScriptObject(void *aScriptObject) } nsresult -nsDOMAttribute::GetName(nsString& aName) +nsDOMAttribute::GetName(nsAWritableString& aName) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -164,7 +164,7 @@ nsDOMAttribute::GetName(nsString& aName) } nsresult -nsDOMAttribute::GetValue(nsString& aValue) +nsDOMAttribute::GetValue(nsAWritableString& aValue) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -188,7 +188,7 @@ nsDOMAttribute::GetValue(nsString& aValue) } nsresult -nsDOMAttribute::SetValue(const nsString& aValue) +nsDOMAttribute::SetValue(const nsAReadableString& aValue) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -247,19 +247,19 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement) } NS_IMETHODIMP -nsDOMAttribute::GetNodeName(nsString& aNodeName) +nsDOMAttribute::GetNodeName(nsAWritableString& aNodeName) { return GetName(aNodeName); } NS_IMETHODIMP -nsDOMAttribute::GetNodeValue(nsString& aNodeValue) +nsDOMAttribute::GetNodeValue(nsAWritableString& aNodeValue) { return GetValue(aNodeValue); } NS_IMETHODIMP -nsDOMAttribute::SetNodeValue(const nsString& aNodeValue) +nsDOMAttribute::SetNodeValue(const nsAReadableString& aNodeValue) { return SetValue(aNodeValue); } @@ -449,7 +449,7 @@ nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } NS_IMETHODIMP -nsDOMAttribute::GetNamespaceURI(nsString& aNamespaceURI) +nsDOMAttribute::GetNamespaceURI(nsAWritableString& aNamespaceURI) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -457,7 +457,7 @@ nsDOMAttribute::GetNamespaceURI(nsString& aNamespaceURI) } NS_IMETHODIMP -nsDOMAttribute::GetPrefix(nsString& aPrefix) +nsDOMAttribute::GetPrefix(nsAWritableString& aPrefix) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -465,7 +465,7 @@ nsDOMAttribute::GetPrefix(nsString& aPrefix) } NS_IMETHODIMP -nsDOMAttribute::SetPrefix(const nsString& aPrefix) +nsDOMAttribute::SetPrefix(const nsAReadableString& aPrefix) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); nsCOMPtr newNodeInfo; @@ -500,7 +500,7 @@ nsDOMAttribute::SetPrefix(const nsString& aPrefix) } NS_IMETHODIMP -nsDOMAttribute::GetLocalName(nsString& aLocalName) +nsDOMAttribute::GetLocalName(nsAWritableString& aLocalName) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -515,7 +515,7 @@ nsDOMAttribute::Normalize() } NS_IMETHODIMP -nsDOMAttribute::Supports(const nsString& aFeature, const nsString& aVersion, +nsDOMAttribute::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); diff --git a/content/base/src/nsDOMAttribute.h b/content/base/src/nsDOMAttribute.h index a114d481a82c..6f26cd65eaa2 100644 --- a/content/base/src/nsDOMAttribute.h +++ b/content/base/src/nsDOMAttribute.h @@ -71,7 +71,7 @@ class nsDOMAttribute : public nsIDOMAttr, { public: nsDOMAttribute(nsIContent* aContent, nsINodeInfo *aNodeInfo, - const nsString& aValue); + const nsAReadableString& aValue); virtual ~nsDOMAttribute(); NS_DECL_ISUPPORTS diff --git a/content/base/src/nsDOMAttributeMap.cpp b/content/base/src/nsDOMAttributeMap.cpp index c062c4918388..0e7cb41610ff 100644 --- a/content/base/src/nsDOMAttributeMap.cpp +++ b/content/base/src/nsDOMAttributeMap.cpp @@ -90,7 +90,7 @@ nsDOMAttributeMap::SetScriptObject(void *aScriptObject) } nsresult -nsDOMAttributeMap::GetNamedItem(const nsString &aAttrName, +nsDOMAttributeMap::GetNamedItem(const nsAReadableString& aAttrName, nsIDOMNode** aAttribute) { NS_ENSURE_ARG_POINTER(aAttribute); @@ -213,7 +213,7 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn) } NS_IMETHODIMP -nsDOMAttributeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsDOMAttributeMap::RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; @@ -338,8 +338,8 @@ nsDOMAttributeMap::GetLength(PRUint32 *aLength) } nsresult -nsDOMAttributeMap::GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsDOMAttributeMap::GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -452,8 +452,8 @@ nsDOMAttributeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) } nsresult -nsDOMAttributeMap::RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsDOMAttributeMap::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); diff --git a/content/base/src/nsDOMAttributeMap.h b/content/base/src/nsDOMAttributeMap.h index 720a925d4e0e..32aeb4001861 100644 --- a/content/base/src/nsDOMAttributeMap.h +++ b/content/base/src/nsDOMAttributeMap.h @@ -45,15 +45,16 @@ public: // nsIDOMNamedNodeMap interface NS_IMETHOD GetLength(PRUint32* aSize); - NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItem(nsIDOMNode* aNode, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsIDOMNode** aReturn); + NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, nsIDOMNode** aReturn); + NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + nsIDOMNode** aReturn); void DropReference(); diff --git a/content/base/src/nsDOMDocumentType.cpp b/content/base/src/nsDOMDocumentType.cpp index 3472994d4f35..9032553e675b 100644 --- a/content/base/src/nsDOMDocumentType.cpp +++ b/content/base/src/nsDOMDocumentType.cpp @@ -29,12 +29,12 @@ nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType, - const nsString& aName, + const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset) + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset) { NS_ENSURE_ARG_POINTER(aDocType); @@ -49,12 +49,12 @@ NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType, return NS_OK; } -nsDOMDocumentType::nsDOMDocumentType(const nsString& aName, +nsDOMDocumentType::nsDOMDocumentType(const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset) : + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset) : mName(aName), mPublicId(aPublicId), mSystemId(aSystemId), @@ -87,7 +87,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMDocumentType) NS_INTERFACE_MAP_END_THREADSAFE NS_IMETHODIMP -nsDOMDocumentType::GetName(nsString& aName) +nsDOMDocumentType::GetName(nsAWritableString& aName) { aName=mName; @@ -119,7 +119,7 @@ nsDOMDocumentType::GetNotations(nsIDOMNamedNodeMap** aNotations) } NS_IMETHODIMP -nsDOMDocumentType::GetPublicId(nsString& aPublicId) +nsDOMDocumentType::GetPublicId(nsAWritableString& aPublicId) { aPublicId = mPublicId; @@ -127,7 +127,7 @@ nsDOMDocumentType::GetPublicId(nsString& aPublicId) } NS_IMETHODIMP -nsDOMDocumentType::GetSystemId(nsString& aSystemId) +nsDOMDocumentType::GetSystemId(nsAWritableString& aSystemId) { aSystemId = mSystemId; @@ -135,7 +135,7 @@ nsDOMDocumentType::GetSystemId(nsString& aSystemId) } NS_IMETHODIMP -nsDOMDocumentType::GetInternalSubset(nsString& aInternalSubset) +nsDOMDocumentType::GetInternalSubset(nsAWritableString& aInternalSubset) { aInternalSubset = mInternalSubset; @@ -158,7 +158,7 @@ nsDOMDocumentType::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsDOMDocumentType::GetNodeName(nsString& aNodeName) +nsDOMDocumentType::GetNodeName(nsAWritableString& aNodeName) { aNodeName=mName; diff --git a/content/base/src/nsDOMDocumentType.h b/content/base/src/nsDOMDocumentType.h index 729add67b0ec..def8ba0f6365 100644 --- a/content/base/src/nsDOMDocumentType.h +++ b/content/base/src/nsDOMDocumentType.h @@ -37,12 +37,12 @@ class nsDOMDocumentType : public nsIDOMDocumentType, public nsIContent { public: - nsDOMDocumentType(const nsString& aName, + nsDOMDocumentType(const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset); + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset); virtual ~nsDOMDocumentType(); @@ -78,11 +78,11 @@ protected: }; extern nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType, - const nsString& aName, + const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset); + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset); #endif // nsDOMDocument_h___ diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 254d67497ce4..8063d70d8042 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -368,16 +368,16 @@ public: NS_DECL_ISUPPORTS // nsIDOMDOMImplementation - NS_IMETHOD HasFeature(const nsString& aFeature, - const nsString& aVersion, + NS_IMETHOD HasFeature(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn); - NS_IMETHOD CreateDocumentType(const nsString& aQualifiedName, - const nsString& aPublicId, - const nsString& aSystemId, + NS_IMETHOD CreateDocumentType(const nsAReadableString& aQualifiedName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, nsIDOMDocumentType** aReturn); - NS_IMETHOD CreateDocument(const nsString& aNamespaceURI, - const nsString& aQualifiedName, + NS_IMETHOD CreateDocument(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn); @@ -418,28 +418,28 @@ NS_IMPL_ISUPPORTS4(nsDOMImplementation, nsIDOMDOMImplementation, nsIPrivateDOMIm NS_IMETHODIMP -nsDOMImplementation::HasFeature(const nsString& aFeature, - const nsString& aVersion, +nsDOMImplementation::HasFeature(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); } NS_IMETHODIMP -nsDOMImplementation::CreateDocumentType(const nsString& aQualifiedName, - const nsString& aPublicId, - const nsString& aSystemId, +nsDOMImplementation::CreateDocumentType(const nsAReadableString& aQualifiedName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, nsIDOMDocumentType** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); return NS_NewDOMDocumentType(aReturn, aQualifiedName, nsnull, nsnull, - aPublicId, aSystemId, nsAutoString()); + aPublicId, aSystemId, nsString()); } NS_IMETHODIMP -nsDOMImplementation::CreateDocument(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsDOMImplementation::CreateDocument(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn) { @@ -1043,7 +1043,7 @@ nsDocument::AddPrincipal(nsIPrincipal *aNewPrincipal) } NS_IMETHODIMP -nsDocument::GetContentType(nsString& aContentType) const +nsDocument::GetContentType(nsAWritableString& aContentType) const { // Must be implemented by derived class. return NS_ERROR_NOT_IMPLEMENTED; @@ -1067,23 +1067,21 @@ nsDocument::GetBaseURL(nsIURI*& aURL) const return NS_OK; } -NS_IMETHODIMP nsDocument::GetDocumentCharacterSet(nsString& oCharSetID) +NS_IMETHODIMP nsDocument::GetDocumentCharacterSet(nsAWritableString& oCharSetID) { oCharSetID = mCharacterSet; return NS_OK; } -NS_IMETHODIMP nsDocument::SetDocumentCharacterSet(const nsString& aCharSetID) +NS_IMETHODIMP nsDocument::SetDocumentCharacterSet(const nsAReadableString& aCharSetID) { - if (mCharacterSet != aCharSetID) { + if (!mCharacterSet.Equals(aCharSetID)) { mCharacterSet = aCharSetID; - nsAutoString charSetTopic; - charSetTopic.AssignWithConversion("charset"); PRInt32 n = mCharSetObservers.Count(); for (PRInt32 i = 0; i < n; i++) { nsIObserver* observer = (nsIObserver*) mCharSetObservers.ElementAt(i); - observer->Observe((nsIDocument*) this, charSetTopic.GetUnicode(), - aCharSetID.GetUnicode()); + observer->Observe((nsIDocument*) this, NS_LITERAL_STRING("charset"), + nsPromiseFlatString(aCharSetID)); } } return NS_OK; @@ -1165,7 +1163,7 @@ NS_IMETHODIMP nsDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker) } NS_IMETHODIMP -nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const +nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const { aData.Truncate(); const nsDocHeaderData* data = mHeaderData; @@ -1180,7 +1178,7 @@ nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const } NS_IMETHODIMP -nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) +nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData) { if (nsnull != aHeaderField) { if (nsnull == mHeaderData) { @@ -2162,7 +2160,7 @@ nsDocument::GetDocumentElement(nsIDOMElement** aDocumentElement) } NS_IMETHODIMP -nsDocument::CreateElement(const nsString& aTagName, +nsDocument::CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn) { // Should be implemented by subclass @@ -2170,7 +2168,7 @@ nsDocument::CreateElement(const nsString& aTagName, } NS_IMETHODIMP -nsDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) +nsDocument::CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn) { nsIContent* text = nsnull; nsresult rv = NS_NewTextNode(&text); @@ -2191,7 +2189,7 @@ nsDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) } NS_IMETHODIMP -nsDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) +nsDocument::CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn) { nsIContent* comment = nsnull; nsresult rv = NS_NewCommentNode(&comment); @@ -2206,15 +2204,15 @@ nsDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) } NS_IMETHODIMP -nsDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) +nsDocument::CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -nsDocument::CreateProcessingInstruction(const nsString& aTarget, - const nsString& aData, +nsDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn) { // Should be implemented by subclass @@ -2222,7 +2220,7 @@ nsDocument::CreateProcessingInstruction(const nsString& aTarget, } NS_IMETHODIMP -nsDocument::CreateAttribute(const nsString& aName, +nsDocument::CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -2243,7 +2241,7 @@ nsDocument::CreateAttribute(const nsString& aName, } NS_IMETHODIMP -nsDocument::CreateEntityReference(const nsString& aName, +nsDocument::CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn) { // Should be implemented by subclass @@ -2251,7 +2249,7 @@ nsDocument::CreateEntityReference(const nsString& aName, } NS_IMETHODIMP -nsDocument::GetElementsByTagName(const nsString& aTagname, +nsDocument::GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { nsCOMPtr nameAtom = dont_AddRef(NS_NewAtom(aTagname)); @@ -2263,8 +2261,8 @@ nsDocument::GetElementsByTagName(const nsString& aTagname, } NS_IMETHODIMP -nsDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsCOMPtr nameAtom; @@ -2274,7 +2272,7 @@ nsDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, nsContentList* list = nsnull; - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId); if (nameSpaceId == kNameSpaceID_Unknown) { @@ -2310,14 +2308,14 @@ nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets) } NS_IMETHODIMP -nsDocument::GetCharacterSet(nsString& aCharacterSet) +nsDocument::GetCharacterSet(nsAWritableString& aCharacterSet) { return GetDocumentCharacterSet(aCharacterSet); } NS_IMETHODIMP -nsDocument::CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, +nsDocument::CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn) { *aReturn = nsnull; @@ -2336,7 +2334,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) +nsDocument::AddBinding(nsIDOMElement* aContent, const nsAReadableString& aURL) { nsCOMPtr bm; GetBindingManager(getter_AddRefs(bm)); @@ -2346,7 +2344,7 @@ nsDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) +nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAReadableString& aURL) { if (mBindingManager) { nsCOMPtr content(do_QueryInterface(aContent)); @@ -2357,7 +2355,7 @@ nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsDocument::LoadBindingDocument(const nsString& aURL) +nsDocument::LoadBindingDocument(const nsAReadableString& aURL) { if (mBindingManager) return mBindingManager->LoadBindingDocument(this, aURL); @@ -2454,7 +2452,7 @@ nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView) NS_IMETHODIMP -nsDocument::Load (const nsString& aUrl) +nsDocument::Load (const nsAReadableString& aUrl) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; @@ -2497,21 +2495,21 @@ nsDocument::GetPlugins(nsIDOMPluginArray** aPlugins) // nsIDOMNode methods // NS_IMETHODIMP -nsDocument::GetNodeName(nsString& aNodeName) +nsDocument::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#document"); + aNodeName.Assign(NS_LITERAL_STRING("#document")); return NS_OK; } NS_IMETHODIMP -nsDocument::GetNodeValue(nsString& aNodeValue) +nsDocument::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocument::SetNodeValue(const nsString& aNodeValue) +nsDocument::SetNodeValue(const nsAReadableString& aNodeValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -2627,27 +2625,27 @@ nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes) } NS_IMETHODIMP -nsDocument::GetNamespaceURI(nsString& aNamespaceURI) +nsDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocument::GetPrefix(nsString& aPrefix) +nsDocument::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocument::SetPrefix(const nsString& aPrefix) +nsDocument::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsDocument::GetLocalName(nsString& aLocalName) +nsDocument::GetLocalName(nsAWritableString& aLocalName) { aLocalName.Truncate(); return NS_OK; @@ -2930,7 +2928,7 @@ nsDocument::Normalize() } NS_IMETHODIMP -nsDocument::Supports(const nsString& aFeature, const nsString& aVersion, +nsDocument::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); @@ -3044,7 +3042,7 @@ nsresult nsDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, co return NS_ERROR_FAILURE; } -nsresult nsDocument::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, +nsresult nsDocument::AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { nsIEventListenerManager *manager; @@ -3059,7 +3057,7 @@ nsresult nsDocument::AddEventListener(const nsString& aType, nsIDOMEventListener return NS_ERROR_FAILURE; } -nsresult nsDocument::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, +nsresult nsDocument::RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { if (nsnull != mListenerManager) { @@ -3094,7 +3092,7 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent) } NS_IMETHODIMP -nsDocument::CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn) +nsDocument::CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aReturn) { // Obtain a presentation context PRInt32 count = GetNumberOfShells(); @@ -3275,7 +3273,7 @@ void nsDocument::Finalize(JSContext *aContext, JSObject *aObj) /** * Finds text in content */ -NS_IMETHODIMP nsDocument::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) +NS_IMETHODIMP nsDocument::FindNext(const nsAReadableString& aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) { aIsFound = PR_FALSE; return NS_ERROR_FAILURE; @@ -3365,7 +3363,7 @@ nsDocument::ToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode) } NS_IMETHODIMP -nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) +nsDocument::CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection) { nsresult result=NS_OK; @@ -3380,25 +3378,25 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) if (aSelection) converter->SetSelection(aSelection); - converter->AddStartTag( NS_ConvertToString("section") , PR_TRUE); - converter->AddStartTag( NS_ConvertToString("section_head") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section_head") , PR_TRUE); - converter->BeginStartTag( NS_ConvertToString("document_info") ); - converter->AddAttribute(NS_ConvertToString("charset"),mCharacterSet); + converter->BeginStartTag( NS_LITERAL_STRING("document_info") ); + converter->AddAttribute(NS_LITERAL_STRING("charset"),mCharacterSet); nsCOMPtr uri (getter_AddRefs(GetDocumentURL())); if (uri) { char* spec = 0; if (NS_SUCCEEDED(uri->GetSpec(&spec)) && spec) { - converter->AddAttribute(NS_ConvertToString("uri"), NS_ConvertToString(spec)); + converter->AddAttribute(NS_LITERAL_STRING("uri"), NS_ConvertToString(spec)); Recycle(spec); } } - converter->FinishStartTag(NS_ConvertToString("document_info"),PR_TRUE,PR_TRUE); + converter->FinishStartTag(NS_LITERAL_STRING("document_info"),PR_TRUE,PR_TRUE); - converter->AddEndTag(NS_ConvertToString("section_head"), PR_TRUE, PR_TRUE); - converter->AddStartTag(NS_ConvertToString("section_body"), PR_TRUE); + converter->AddEndTag(NS_LITERAL_STRING("section_head"), PR_TRUE, PR_TRUE); + converter->AddStartTag(NS_LITERAL_STRING("section_body"), PR_TRUE); nsCOMPtr doctype; GetDoctype(getter_AddRefs(doctype)); @@ -3408,28 +3406,28 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) doctype->GetName(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion("DOCTYPE "); + docTypeStr.Append(NS_LITERAL_STRING("DOCTYPE ")); docTypeStr.Append(tmpStr); doctype->GetPublicId(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion(" PUBLIC \""); + docTypeStr.Append(NS_LITERAL_STRING(" PUBLIC \"")); docTypeStr.Append(tmpStr); - docTypeStr.AppendWithConversion('"'); + docTypeStr.Append(PRUnichar('"')); } doctype->GetSystemId(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion(" SYSTEM \""); + docTypeStr.Append(NS_LITERAL_STRING(" SYSTEM \"")); docTypeStr.Append(tmpStr); - docTypeStr.AppendWithConversion('"'); + docTypeStr.Append(PRUnichar('"')); } doctype->GetInternalSubset(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion(" [\n"); + docTypeStr.Append(NS_LITERAL_STRING(" [\n")); docTypeStr.Append(tmpStr); - docTypeStr.AppendWithConversion("\n]"); + docTypeStr.Append(NS_LITERAL_STRING("\n]")); } } if (docTypeStr.Length()) diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 1fb3cba71d5b..d29875f36c3f 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -74,7 +74,7 @@ protected: class nsDocHeaderData { public: - nsDocHeaderData(nsIAtom* aField, const nsString& aData) + nsDocHeaderData(nsIAtom* aField, const nsAReadableString& aData) { mField = aField; NS_IF_ADDREF(mField); @@ -177,7 +177,7 @@ public: /** * Return the content (mime) type of this document. */ - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; /** * Return the LoadGroup for the document. May return null. @@ -193,8 +193,8 @@ public: * Return a standard name for the document's character set. This will * trigger a startDocumentLoad if necessary to answer the question. */ - NS_IMETHOD GetDocumentCharacterSet(nsString& oCharsetID); - NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID); + NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharsetID); + NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID); /** * Add an observer that gets notified whenever the charset changes. @@ -218,8 +218,8 @@ public: * Access HTTP header data (this may also get set from other sources, like * HTML META tags). */ - NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const; - NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData); + NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const; + NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData); /** * Create a new presentation shell that will use aContext for @@ -350,14 +350,14 @@ public: /** * Finds text in content */ - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); /** * Converts the document or a selection of the * document to XIF (XML Interchange Format) * and places the result in aBuffer. */ - NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection); + NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection); NS_IMETHOD ToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode); virtual void BeginConvertToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode); virtual void ConvertChildrenToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode); @@ -378,26 +378,26 @@ public: NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation); NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement); - NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn); + NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn); NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn); - NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn); - NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn); - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); - NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn); - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn); - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn); + NS_IMETHOD CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn); + NS_IMETHOD CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn); + NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn); + NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn); + NS_IMETHOD CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn); + NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn); + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn); + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn); NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets); - NS_IMETHOD GetCharacterSet(nsString& aCharacterSet); + NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet); NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, + NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn); NS_IMETHOD CreateRange(nsIDOMRange** aReturn); - NS_IMETHOD Load (const nsString& aUrl); + NS_IMETHOD Load (const nsAReadableString& aUrl); NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); // nsIDOMNode interface @@ -434,9 +434,9 @@ public: NS_IMETHOD IncrementModCount(PRInt32 aNumMods); // nsIDOMEventTarget interface - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); diff --git a/content/base/src/nsDocumentEncoder.cpp b/content/base/src/nsDocumentEncoder.cpp index e2ca0c73c546..713f1a584f9e 100644 --- a/content/base/src/nsDocumentEncoder.cpp +++ b/content/base/src/nsDocumentEncoder.cpp @@ -54,7 +54,7 @@ public: nsTextEncoder(); virtual ~nsTextEncoder(); - NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags); + NS_IMETHOD Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 aFlags); /* Interfaces for addref and release and queryinterface */ NS_DECL_ISUPPORTS @@ -62,10 +62,10 @@ public: // Inherited methods from nsIDocumentEncoder NS_IMETHOD SetSelection(nsIDOMSelection* aSelection); NS_IMETHOD SetWrapColumn(PRUint32 aWC); - NS_IMETHOD SetCharset(const nsString& aCharset); + NS_IMETHOD SetCharset(const nsAReadableString& aCharset); NS_IMETHOD EncodeToStream(nsIOutputStream* aStream); - NS_IMETHOD EncodeToString(nsString& aOutputString); + NS_IMETHOD EncodeToString(nsAWritableString& aOutputString); protected: // Local methods to the text encoder -- used to be in nsITextEncoder, @@ -104,7 +104,7 @@ nsTextEncoder::~nsTextEncoder() } NS_IMETHODIMP -nsTextEncoder::Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags) +nsTextEncoder::Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 aFlags) { if (!aDocument) return NS_ERROR_INVALID_ARG; @@ -156,14 +156,14 @@ nsTextEncoder::SetSelection(nsIDOMSelection* aSelection) } NS_IMETHODIMP -nsTextEncoder::SetCharset(const nsString& aCharset) +nsTextEncoder::SetCharset(const nsAReadableString& aCharset) { mCharset = aCharset; return NS_OK; } NS_IMETHODIMP -nsTextEncoder::EncodeToString(nsString& aOutputString) +nsTextEncoder::EncodeToString(nsAWritableString& aOutputString) { nsresult rv; diff --git a/content/base/src/nsDocumentFragment.cpp b/content/base/src/nsDocumentFragment.cpp index 245f9239d119..04ac4313a283 100644 --- a/content/base/src/nsDocumentFragment.cpp +++ b/content/base/src/nsDocumentFragment.cpp @@ -49,9 +49,9 @@ public: NS_DECL_ISUPPORTS // interface nsIDOMDocumentFragment - NS_IMETHOD GetNodeName(nsString& aNodeName); - NS_IMETHOD GetNodeValue(nsString& aNodeValue); - NS_IMETHOD SetNodeValue(const nsString& aNodeValue); + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue); + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue); NS_IMETHOD GetNodeType(PRUint16* aNodeType); NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) { @@ -93,12 +93,12 @@ public: NS_IMETHOD HasChildNodes(PRBool* aReturn) { return mInner.HasChildNodes(aReturn); } NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD GetPrefix(nsString& aPrefix); - NS_IMETHOD SetPrefix(const nsString& aPrefix); - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI); - NS_IMETHOD GetLocalName(nsString& aLocalName); + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix); + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix); + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI); + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName); NS_IMETHOD Normalize(); - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion, + NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); // interface nsIScriptObjectOwner @@ -106,7 +106,7 @@ public: NS_IMETHOD SetScriptObject(void* aScriptObject); // interface nsIContent - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { aName = nsnull; @@ -166,18 +166,18 @@ public: NS_IMETHOD IsSynthetic(PRBool& aResult) { return mInner.IsSynthetic(aResult); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const + nsAWritableString& aResult) const { return NS_CONTENT_ATTR_NOT_THERE; } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return NS_CONTENT_ATTR_NOT_THERE; } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) @@ -352,21 +352,21 @@ nsDocumentFragment::QueryInterface(REFNSIID aIID, void** aInstancePtr) } NS_IMETHODIMP -nsDocumentFragment::GetNodeName(nsString& aNodeName) +nsDocumentFragment::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#document-fragment"); + aNodeName.Assign(NS_ConvertASCIItoUCS2("#document-fragment")); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::GetNodeValue(nsString& aNodeValue) +nsDocumentFragment::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::SetNodeValue(const nsString& aNodeValue) +nsDocumentFragment::SetNodeValue(const nsAReadableString& aNodeValue) { // The node value can't be modified return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; @@ -392,27 +392,27 @@ nsDocumentFragment::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } NS_IMETHODIMP -nsDocumentFragment::GetNamespaceURI(nsString& aNamespaceURI) +nsDocumentFragment::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::GetPrefix(nsString& aPrefix) +nsDocumentFragment::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::SetPrefix(const nsString& aPrefix) +nsDocumentFragment::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NAMESPACE_ERR; } NS_IMETHODIMP -nsDocumentFragment::GetLocalName(nsString& aLocalName) +nsDocumentFragment::GetLocalName(nsAWritableString& aLocalName) { return GetNodeName(aLocalName); } @@ -438,7 +438,7 @@ nsDocumentFragment::Normalize() NS_IMETHODIMP -nsDocumentFragment::Supports(const nsString& aFeature, const nsString& aVersion, +nsDocumentFragment::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 66f88f04831d..badbdaef5688 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -32,7 +32,7 @@ #include "nsTextContentChangeData.h" #include "nsIDOMSelection.h" #include "nsIEnumerator.h" - +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsIEventStateManager.h" @@ -79,14 +79,14 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode() } nsresult -nsGenericDOMDataNode::GetNodeValue(nsString& aNodeValue) +nsGenericDOMDataNode::GetNodeValue(nsAWritableString& aNodeValue) { return GetData(aNodeValue); } nsresult nsGenericDOMDataNode::SetNodeValue(nsIContent *aOuterContent, - const nsString& aNodeValue) + const nsAReadableString& aNodeValue) { return SetData(aOuterContent, aNodeValue); } @@ -215,21 +215,21 @@ nsGenericDOMDataNode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } nsresult -nsGenericDOMDataNode::GetNamespaceURI(nsString& aNamespaceURI) +nsGenericDOMDataNode::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; } nsresult -nsGenericDOMDataNode::GetPrefix(nsString& aPrefix) +nsGenericDOMDataNode::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; } nsresult -nsGenericDOMDataNode::SetPrefix(const nsString& aPrefix) +nsGenericDOMDataNode::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NAMESPACE_ERR; } @@ -241,8 +241,8 @@ nsGenericDOMDataNode::Normalize() } nsresult -nsGenericDOMDataNode::Supports(const nsString& aFeature, - const nsString& aVersion, +nsGenericDOMDataNode::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); @@ -268,19 +268,19 @@ nsGenericDOMDataNode::Equals(nsIDOMNode* aNode, PRBool aDeep, PRBool* aReturn) // Implementation of nsIDOMCharacterData nsresult -nsGenericDOMDataNode::GetData(nsString& aData) +nsGenericDOMDataNode::GetData(nsAWritableString& aData) { if (mText.Is2b()) { aData.Assign(mText.Get2b(), mText.GetLength()); } else { - aData.AssignWithConversion(mText.Get1b(), mText.GetLength()); + aData.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength())); } return NS_OK; } nsresult -nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsString& aData) +nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsAReadableString& aData) { // inform any enclosed ranges of change // we can lie and say we are deleting all the text, since in a total @@ -294,13 +294,10 @@ nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsString& aData) // If possible, let the container content object have a go at it. if (NS_SUCCEEDED(result)) { - result = textContent->SetText(aData.GetUnicode(), - aData.Length(), - PR_TRUE); + result = textContent->SetText(aData, PR_TRUE); } else { - result = SetText(aOuterContent, aData.GetUnicode(), aData.Length(), - PR_TRUE); + result = SetText(aOuterContent, aData, PR_TRUE); } return result; @@ -316,7 +313,7 @@ nsGenericDOMDataNode::GetLength(PRUint32* aLength) nsresult nsGenericDOMDataNode::SubstringData(PRUint32 aStart, PRUint32 aCount, - nsString& aReturn) + nsAWritableString& aReturn) { aReturn.Truncate(); @@ -334,7 +331,7 @@ nsGenericDOMDataNode::SubstringData(PRUint32 aStart, aReturn.Assign(mText.Get2b() + aStart, amount); } else { - aReturn.AssignWithConversion(mText.Get1b() + aStart, amount); + aReturn.Assign(NS_ConvertASCIItoUCS2(mText.Get1b() + aStart, amount), amount); } return NS_OK; @@ -344,12 +341,12 @@ nsGenericDOMDataNode::SubstringData(PRUint32 aStart, nsresult nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent, - const nsString& aData) + const nsAReadableString& aData) { #if 1 // Allocate new buffer nsresult result = NS_OK; - PRInt32 dataLength = aData.Length(); + PRUint32 dataLength = aData.Length(); PRInt32 textLength = mText.GetLength(); PRInt32 newSize = textLength + dataLength; PRUnichar* to = new PRUnichar[newSize + 1]; @@ -363,8 +360,7 @@ nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent, if (textLength) { mText.CopyTo(to, 0, textLength); } - nsCRT::memcpy(to + textLength, aData.GetUnicode(), - sizeof(PRUnichar) * dataLength); + CopyUnicodeTo(aData, to + textLength, dataLength); // Null terminate the new buffer... to[newSize] = (PRUnichar)0; @@ -405,7 +401,7 @@ nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent, nsresult nsGenericDOMDataNode::InsertData(nsIContent *aOuterContent, PRUint32 aOffset, - const nsString& aData) + const nsAReadableString& aData) { return ReplaceData(aOuterContent, aOffset, 0, aData); } @@ -420,7 +416,7 @@ nsGenericDOMDataNode::DeleteData(nsIContent *aOuterContent, PRUint32 aOffset, nsresult nsGenericDOMDataNode::ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset, - PRUint32 aCount, const nsString& aData) + PRUint32 aCount, const nsAReadableString& aData) { nsresult result = NS_OK; @@ -452,8 +448,7 @@ nsGenericDOMDataNode::ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset, mText.CopyTo(to, 0, aOffset); } if (0 != dataLength) { - nsCRT::memcpy(to + aOffset, aData.GetUnicode(), - sizeof(PRUnichar) * dataLength); + CopyUnicodeTo(aData, to+aOffset, dataLength); } if (endOffset != textLength) { mText.CopyTo(to + aOffset + dataLength, endOffset, textLength - endOffset); @@ -599,7 +594,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, continue; // This range doesn't intersect the node at all // Put all of our text into the buffer, initially: - nsString buffer; + nsAutoString buffer; mText.AppendTo(buffer); // Clip to whatever is inside the range: @@ -640,7 +635,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, } else { - nsString buffer; + nsAutoString buffer; mText.AppendTo(buffer); aConverter->AddContent(buffer); } @@ -648,7 +643,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, } void -nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset, +nsGenericDOMDataNode::ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const { if (mText.Is2b()) { @@ -657,15 +652,15 @@ nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset, while (cp < end) { PRUnichar ch = *cp++; if (ch == '\r') { - aBuf.AppendWithConversion("\\r"); + aBuf.Append(NS_LITERAL_STRING("\\r")); } else if (ch == '\n') { - aBuf.AppendWithConversion("\\n"); + aBuf.Append(NS_LITERAL_STRING("\\n")); } else if (ch == '\t') { - aBuf.AppendWithConversion("\\t"); + aBuf.Append(NS_LITERAL_STRING("\\t")); } else if ((ch < ' ') || (ch >= 127)) { char buf[10]; PR_snprintf(buf, sizeof(buf), "\\u%04x", ch); - aBuf.AppendWithConversion(buf); + aBuf.Append(NS_ConvertASCIItoUCS2(buf)); } else { aBuf.Append(ch); } @@ -677,15 +672,15 @@ nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset, while (cp < end) { PRUnichar ch = *cp++; if (ch == '\r') { - aBuf.AppendWithConversion("\\r"); + aBuf.Append(NS_LITERAL_STRING("\\r")); } else if (ch == '\n') { - aBuf.AppendWithConversion("\\n"); + aBuf.Append(NS_LITERAL_STRING("\\n")); } else if (ch == '\t') { - aBuf.AppendWithConversion("\\t"); + aBuf.Append(NS_LITERAL_STRING("\\t")); } else if ((ch < ' ') || (ch >= 127)) { char buf[10]; PR_snprintf(buf, sizeof(buf), "\\u%04x", ch); - aBuf.AppendWithConversion(buf); + aBuf.Append(NS_ConvertASCIItoUCS2(buf)); } else { aBuf.Append(ch); } @@ -1008,13 +1003,14 @@ nsGenericDOMDataNode::GetTextLength(PRInt32* aLengthResult) } nsresult -nsGenericDOMDataNode::CopyText(nsString& aResult) +nsGenericDOMDataNode::CopyText(nsAWritableString& aResult) { if (mText.Is2b()) { aResult.Assign(mText.Get2b(), mText.GetLength()); } else { - aResult.AssignWithConversion(mText.Get1b(), mText.GetLength()); + aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()), + mText.GetLength()); } return NS_OK; } @@ -1069,6 +1065,23 @@ nsGenericDOMDataNode::SetText(nsIContent *aOuterContent, const char* aBuffer, return NS_OK; } +nsresult +nsGenericDOMDataNode::SetText(nsIContent *aOuterContent, + const nsAReadableString& aStr, + PRBool aNotify) +{ + if (aNotify && (nsnull != mDocument)) { + mDocument->BeginUpdate(); + } + mText = aStr; + + // Trigger a reflow + if (aNotify && (nsnull != mDocument)) { + mDocument->ContentChanged(aOuterContent, nsnull); + mDocument->EndUpdate(); + } + return NS_OK; +} nsresult nsGenericDOMDataNode::IsOnlyWhitespace(PRBool* aResult) diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index c77415f11ec0..ff365f896a14 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -57,9 +57,9 @@ struct nsGenericDOMDataNode { virtual ~nsGenericDOMDataNode(); // Implementation for nsIDOMNode - nsresult GetNodeValue(nsString& aNodeValue); + nsresult GetNodeValue(nsAWritableString& aNodeValue); nsresult SetNodeValue(nsIContent *aOuterContent, - const nsString& aNodeValue); + const nsAReadableString& aNodeValue); nsresult GetParentNode(nsIDOMNode** aParentNode); nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes) { NS_ENSURE_ARG_POINTER(aAttributes); @@ -119,25 +119,25 @@ struct nsGenericDOMDataNode { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument); - nsresult GetNamespaceURI(nsString& aNamespaceURI); - nsresult GetPrefix(nsString& aPrefix); - nsresult SetPrefix(const nsString& aPrefix); + nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI); + nsresult GetPrefix(nsAWritableString& aPrefix); + nsresult SetPrefix(const nsAReadableString& aPrefix); nsresult Normalize(); - nsresult Supports(const nsString& aFeature, const nsString& aVersion, + nsresult Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); // Implementation for nsIDOMCharacterData - nsresult GetData(nsString& aData); - nsresult SetData(nsIContent *aOuterContent, const nsString& aData); + nsresult GetData(nsAWritableString& aData); + nsresult SetData(nsIContent *aOuterContent, const nsAReadableString& aData); nsresult GetLength(PRUint32* aLength); - nsresult SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn); - nsresult AppendData(nsIContent *aOuterContent, const nsString& aArg); + nsresult SubstringData(PRUint32 aOffset, PRUint32 aCount, nsAWritableString& aReturn); + nsresult AppendData(nsIContent *aOuterContent, const nsAReadableString& aArg); nsresult InsertData(nsIContent *aOuterContent, PRUint32 aOffset, - const nsString& aArg); + const nsAReadableString& aArg); nsresult DeleteData(nsIContent *aOuterContent, PRUint32 aOffset, PRUint32 aCount); nsresult ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset, - PRUint32 aCount, const nsString& aArg); + PRUint32 aCount, const nsAReadableString& aArg); // nsIScriptObjectOwner interface @@ -158,7 +158,7 @@ struct nsGenericDOMDataNode { aID = kNameSpaceID_None; return NS_OK; } - nsresult ParseAttributeString(const nsString& aStr, + nsresult ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { aName = nsnull; @@ -170,21 +170,21 @@ struct nsGenericDOMDataNode { aPrefix = nsnull; return NS_OK; } - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } - nsresult SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; } - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const { + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAWritableString& aResult) const { return NS_CONTENT_ATTR_NOT_THERE; } - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const { + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsAWritableString& aResult) const { aPrefix = nsnull; return NS_CONTENT_ATTR_NOT_THERE; } @@ -257,11 +257,14 @@ struct nsGenericDOMDataNode { nsresult GetText(const nsTextFragment** aFragmentsResult); nsresult GetTextLength(PRInt32* aLengthResult); - nsresult CopyText(nsString& aResult); + nsresult CopyText(nsAWritableString& aResult); nsresult SetText(nsIContent *aOuterContent, const PRUnichar* aBuffer, PRInt32 aLength, PRBool aNotify); + nsresult SetText(nsIContent *aOuterContent, + const nsAReadableString& aStr, + PRBool aNotify); nsresult SetText(nsIContent *aOuterContent, const char* aBuffer, PRInt32 aLength, @@ -272,7 +275,7 @@ struct nsGenericDOMDataNode { nsresult GetListenerManager(nsIContent* aOuterContent, nsIEventListenerManager** aInstancePtrResult); - void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; + void ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; nsIDocument* mDocument; nsIContent* mParent; @@ -296,14 +299,14 @@ struct nsGenericDOMDataNode { * NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); */ #define NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(_g) \ - NS_IMETHOD GetNodeName(nsString& aNodeName); \ - NS_IMETHOD GetLocalName(nsString& aLocalName) { \ + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); \ + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \ return GetNodeName(aLocalName); \ } \ - NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \ + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \ return _g.GetNodeValue(aNodeValue); \ } \ - NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \ + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { \ return _g.SetNodeValue(this, aNodeValue); \ } \ NS_IMETHOD GetNodeType(PRUint16* aNodeType); \ @@ -348,48 +351,48 @@ struct nsGenericDOMDataNode { NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { \ return _g.GetOwnerDocument(aOwnerDocument); \ } \ - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI) { \ + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI) { \ return _g.GetNamespaceURI(aNamespaceURI); \ } \ - NS_IMETHOD GetPrefix(nsString& aPrefix) { \ + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { \ return _g.GetPrefix(aPrefix); \ } \ - NS_IMETHOD SetPrefix(const nsString& aPrefix) { \ + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { \ return _g.SetPrefix(aPrefix); \ } \ NS_IMETHOD Normalize() { \ return NS_OK; \ } \ - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion,\ + NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,\ PRBool* aReturn) { \ return _g.Supports(aFeature, aVersion, aReturn); \ } \ NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); #define NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(_g) \ - NS_IMETHOD GetData(nsString& aData) { \ + NS_IMETHOD GetData(nsAWritableString& aData) { \ return _g.GetData(aData); \ } \ - NS_IMETHOD SetData(const nsString& aData) { \ + NS_IMETHOD SetData(const nsAReadableString& aData) { \ return _g.SetData(this, aData); \ } \ NS_IMETHOD GetLength(PRUint32* aLength) { \ return _g.GetLength(aLength); \ } \ - NS_IMETHOD SubstringData(PRUint32 aStart, PRUint32 aEnd, nsString& aReturn) { \ + NS_IMETHOD SubstringData(PRUint32 aStart, PRUint32 aEnd, nsAWritableString& aReturn) { \ return _g.SubstringData(aStart, aEnd, aReturn); \ } \ - NS_IMETHOD AppendData(const nsString& aData) { \ + NS_IMETHOD AppendData(const nsAReadableString& aData) { \ return _g.AppendData(this, aData); \ } \ - NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aData) { \ + NS_IMETHOD InsertData(PRUint32 aOffset, const nsAReadableString& aData) { \ return _g.InsertData(this, aOffset, aData); \ } \ NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount) { \ return _g.DeleteData(this, aOffset, aCount); \ } \ NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, \ - const nsString& aData) { \ + const nsAReadableString& aData) { \ return _g.ReplaceData(this, aOffset, aCount, aData); \ } @@ -417,12 +420,12 @@ struct nsGenericDOMDataNode { NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent) { \ return _g.HandleEvent(aEvent); \ } \ - NS_IMETHOD AddEventListener(const nsString& aType, \ + NS_IMETHOD AddEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.AddEventListener(aType, aListener, aUseCapture); \ } \ - NS_IMETHOD RemoveEventListener(const nsString& aType, \ + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.RemoveEventListener(aType, aListener, aUseCapture); \ @@ -489,7 +492,7 @@ struct nsGenericDOMDataNode { } \ NS_IMETHOD GetTag(nsIAtom*& aResult) const; \ NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const; \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -499,19 +502,19 @@ struct nsGenericDOMDataNode { return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \ - nsString &aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aAttribute, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \ - nsIAtom*& aPrefix, nsString &aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -589,7 +592,7 @@ struct nsGenericDOMDataNode { NS_IMETHOD GetTextLength(PRInt32* aLengthResult) { \ return mInner.GetTextLength(aLengthResult); \ } \ - NS_IMETHOD CopyText(nsString& aResult) { \ + NS_IMETHOD CopyText(nsAWritableString& aResult) { \ return mInner.CopyText(aResult); \ } \ NS_IMETHOD SetText(const PRUnichar* aBuffer, \ @@ -597,6 +600,10 @@ struct nsGenericDOMDataNode { PRBool aNotify){ \ return mInner.SetText(this, aBuffer, aLength, aNotify); \ } \ + NS_IMETHOD SetText(const nsAReadableString& aStr, \ + PRBool aNotify){ \ + return mInner.SetText(this, aStr, aNotify); \ + } \ NS_IMETHOD SetText(const char* aBuffer, \ PRInt32 aLength, \ PRBool aNotify){ \ diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index eabed3eccfb7..c0538a919d23 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -486,14 +486,14 @@ nsGenericElement::Init(nsIContent* aOuterContentObject, } nsresult -nsGenericElement::GetNodeValue(nsString& aNodeValue) +nsGenericElement::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } nsresult -nsGenericElement::SetNodeValue(const nsString& aNodeValue) +nsGenericElement::SetNodeValue(const nsAReadableString& aNodeValue) { // The node value can't be modified return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; @@ -614,19 +614,19 @@ nsGenericElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } nsresult -nsGenericElement::GetNamespaceURI(nsString& aNamespaceURI) +nsGenericElement::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return mNodeInfo->GetNamespaceURI(aNamespaceURI); } nsresult -nsGenericElement::GetPrefix(nsString& aPrefix) +nsGenericElement::GetPrefix(nsAWritableString& aPrefix) { return mNodeInfo->GetPrefix(aPrefix); } nsresult -nsGenericElement::SetPrefix(const nsString& aPrefix) +nsGenericElement::SetPrefix(const nsAReadableString& aPrefix) { // XXX: Validate the prefix string! @@ -649,30 +649,31 @@ nsGenericElement::SetPrefix(const nsString& aPrefix) } nsresult -nsGenericElement::InternalSupports(const nsString& aFeature, - const nsString& aVersion, +nsGenericElement::InternalSupports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = PR_FALSE; + nsAutoString feature(aFeature); - if (aFeature.EqualsWithConversion("XML", PR_TRUE) || - aFeature.EqualsWithConversion("HTML", PR_TRUE)) { + if (feature.EqualsWithConversion("XML", PR_TRUE) || + feature.EqualsWithConversion("HTML", PR_TRUE)) { if (!aVersion.Length() || - aVersion.EqualsWithConversion("1.0") || - aVersion.EqualsWithConversion("2.0")) { + aVersion.Equals(NS_LITERAL_STRING("1.0")) || + aVersion.Equals(NS_LITERAL_STRING("2.0"))) { *aReturn = PR_TRUE; } - } else if (aFeature.EqualsWithConversion("Views", PR_TRUE) || - aFeature.EqualsWithConversion("StyleSheets", PR_TRUE) || - aFeature.EqualsWithConversion("CSS", PR_TRUE) || -// aFeature.EqualsWithConversion("CSS2", PR_TRUE) || - aFeature.EqualsWithConversion("Events", PR_TRUE) || -// aFeature.EqualsWithConversion("UIEvents", PR_TRUE) || - aFeature.EqualsWithConversion("MouseEvents", PR_TRUE) || - aFeature.EqualsWithConversion("HTMLEvents", PR_TRUE) || - aFeature.EqualsWithConversion("Range", PR_TRUE)) { - if (!aVersion.Length() || aVersion.EqualsWithConversion("2.0")) { + } else if (feature.EqualsWithConversion("Views", PR_TRUE) || + feature.EqualsWithConversion("StyleSheets", PR_TRUE) || + feature.EqualsWithConversion("CSS", PR_TRUE) || +// feature.EqualsWithConversion("CSS2", PR_TRUE) || + feature.EqualsWithConversion("Events", PR_TRUE) || +// feature.EqualsWithConversion("UIEvents", PR_TRUE) || + feature.EqualsWithConversion("MouseEvents", PR_TRUE) || + feature.EqualsWithConversion("HTMLEvents", PR_TRUE) || + feature.EqualsWithConversion("Range", PR_TRUE)) { + if (!aVersion.Length() || aVersion.Equals(NS_LITERAL_STRING("2.0"))) { *aReturn = PR_TRUE; } } @@ -681,7 +682,7 @@ nsGenericElement::InternalSupports(const nsString& aFeature, } nsresult -nsGenericElement::Supports(const nsString& aFeature, const nsString& aVersion, +nsGenericElement::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return InternalSupports(aFeature, aVersion, aReturn); @@ -706,7 +707,7 @@ nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes) } nsresult -nsGenericElement::GetTagName(nsString& aTagName) +nsGenericElement::GetTagName(nsAWritableString& aTagName) { aTagName.Truncate(); if (mNodeInfo) { @@ -716,7 +717,7 @@ nsGenericElement::GetTagName(nsString& aTagName) } nsresult -nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn) +nsGenericElement::GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { nsCOMPtr nameAtom(dont_AddRef(NS_NewAtom(aName))); @@ -726,13 +727,13 @@ nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn) } nsresult -nsGenericElement::SetAttribute(const nsString& aName, - const nsString& aValue) +nsGenericElement::SetAttribute(const nsAReadableString& aName, + const nsAReadableString& aValue) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp); } @@ -755,12 +756,12 @@ nsGenericElement::SetAttribute(const nsString& aName, } nsresult -nsGenericElement::RemoveAttribute(const nsString& aName) +nsGenericElement::RemoveAttribute(const nsAReadableString& aName) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp); } @@ -783,7 +784,7 @@ nsGenericElement::RemoveAttribute(const nsString& aName) } nsresult -nsGenericElement::GetAttributeNode(const nsString& aName, +nsGenericElement::GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { if (nsnull == aReturn) { @@ -864,7 +865,7 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute, } nsresult -nsGenericElement::GetElementsByTagName(const nsString& aTagname, +nsGenericElement::GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { nsIAtom* nameAtom; @@ -874,7 +875,7 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname, if (kStrictDOMLevel2) { PRInt32 pos = aTagname.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aTagname); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aTagname)); printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp); } @@ -901,8 +902,8 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname, } nsresult -nsGenericElement::GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) +nsGenericElement::GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { nsCOMPtr name(dont_AddRef(NS_NewAtom(aLocalName))); PRInt32 nsid; @@ -930,9 +931,9 @@ nsGenericElement::GetAttributeNS(const nsString& aNamespaceURI, } nsresult -nsGenericElement::SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) +nsGenericElement::SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { nsCOMPtr nimgr; mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); @@ -948,8 +949,8 @@ nsGenericElement::SetAttributeNS(const nsString& aNamespaceURI, nsresult -nsGenericElement::RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) +nsGenericElement::RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { nsCOMPtr name(dont_AddRef(NS_NewAtom(aLocalName))); PRInt32 nsid; @@ -977,8 +978,8 @@ nsGenericElement::RemoveAttributeNS(const nsString& aNamespaceURI, } nsresult -nsGenericElement::GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsGenericElement::GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1029,8 +1030,8 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr, } nsresult -nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsGenericElement::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsCOMPtr nameAtom(dont_AddRef(NS_NewAtom(aLocalName))); @@ -1038,7 +1039,7 @@ nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, nsContentList* list = nsnull; - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { nsCOMPtr nimgr; mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE); @@ -1065,7 +1066,7 @@ nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, } nsresult -nsGenericElement::HasAttribute(const nsString& aName, PRBool* aReturn) +nsGenericElement::HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1080,8 +1081,8 @@ nsGenericElement::HasAttribute(const nsString& aName, PRBool* aReturn) } nsresult -nsGenericElement::HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) +nsGenericElement::HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1679,7 +1680,7 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext, nsCOMPtr elt(do_QueryInterface(mContent)); viewCSS->GetComputedStyle(elt, empty, getter_AddRefs(cssDecl)); if (cssDecl) { - nsAutoString behavior; behavior.AssignWithConversion("behavior"); + nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("behavior")); nsAutoString value; cssDecl->GetPropertyValue(behavior, value); if (!value.IsEmpty()) { @@ -1777,7 +1778,7 @@ nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, js propName.Assign(NS_REINTERPRET_CAST(const PRUnichar*, JS_GetStringChars(JS_ValueToString(aContext, aID)))); if (propName.Length() > 2) prefix.Assign(propName.GetUnicode(), 2); - if (prefix.EqualsWithConversion("on")) { + if (prefix.Equals(NS_LITERAL_STRING("on"))) { nsCOMPtr atom = getter_AddRefs(NS_NewAtom(propName)); nsIEventListenerManager *manager = nsnull; @@ -2423,7 +2424,7 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext, nsresult nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, REFNSIID aIID) { nsresult ret = NS_OK; @@ -2504,7 +2505,7 @@ nsGenericElement::CutNameSpacePrefix(nsString& aString) struct nsGenericAttribute { - nsGenericAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue) + nsGenericAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue) : mNodeInfo(aNodeInfo), mValue(aValue) { @@ -2671,7 +2672,7 @@ nsGenericContainerElement::GetLastChild(nsIDOMNode** aNode) nsresult nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult rv; @@ -2689,7 +2690,7 @@ nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsresult nsGenericContainerElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -2750,7 +2751,7 @@ nsGenericContainerElement::SetAttribute(nsINodeInfo* aNodeInfo, nsresult nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const + nsAWritableString& aResult) const { nsCOMPtr prefix; return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult); @@ -2759,7 +2760,7 @@ nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsresult nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, - nsString& aResult) const + nsAWritableString& aResult) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); if (nsnull == aName) { @@ -2777,7 +2778,7 @@ nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, attr->mNodeInfo->NamespaceEquals(aNameSpaceID)) && (attr->mNodeInfo->Equals(aName))) { attr->mNodeInfo->GetPrefixAtom(aPrefix); - aResult = attr->mValue; + aResult.Assign(attr->mValue); if (0 < aResult.Length()) { rv = NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 1b4f42295eef..b189263a0002 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -131,49 +131,49 @@ public: void Init(nsIContent* aOuterContentObject, nsINodeInfo *aNodeInfo); // Implementation for nsIDOMNode - nsresult GetNodeValue(nsString& aNodeValue); - nsresult SetNodeValue(const nsString& aNodeValue); + nsresult GetNodeValue(nsAWritableString& aNodeValue); + nsresult SetNodeValue(const nsAReadableString& aNodeValue); nsresult GetNodeType(PRUint16* aNodeType); nsresult GetParentNode(nsIDOMNode** aParentNode); nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes); nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling); nsresult GetNextSibling(nsIDOMNode** aNextSibling); nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument); - nsresult GetNamespaceURI(nsString& aNamespaceURI); - nsresult GetPrefix(nsString& aPrefix); - nsresult SetPrefix(const nsString& aPrefix); + nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI); + nsresult GetPrefix(nsAWritableString& aPrefix); + nsresult SetPrefix(const nsAReadableString& aPrefix); nsresult Normalize(); - nsresult Supports(const nsString& aFeature, - const nsString& aVersion, PRBool* aReturn); + nsresult Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn); // Implementation for nsIDOMElement - nsresult GetTagName(nsString& aTagName); - nsresult GetAttribute(const nsString& aName, nsString& aReturn); - nsresult SetAttribute(const nsString& aName, const nsString& aValue); - nsresult RemoveAttribute(const nsString& aName); - nsresult GetAttributeNode(const nsString& aName, + nsresult GetTagName(nsAWritableString& aTagName); + nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn); + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue); + nsresult RemoveAttribute(const nsAReadableString& aName); + nsresult GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn); nsresult SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); nsresult RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn); - nsresult GetElementsByTagName(const nsString& aTagname, + nsresult GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn); - nsresult GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn); - nsresult SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue); - nsresult RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName); - nsresult GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + nsresult GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn); + nsresult SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue); + nsresult RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName); + nsresult GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn); nsresult SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); - nsresult GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + nsresult GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn); - nsresult HasAttribute(const nsString& aName, PRBool* aReturn); - nsresult HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn); + nsresult HasAttribute(const nsAReadableString& aName, PRBool* aReturn); + nsresult HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn); // nsIScriptObjectOwner interface nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -251,7 +251,7 @@ public: nsresult RenderFrame(nsIPresContext*); nsresult AddScriptEventListener(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, REFNSIID aIID); nsresult TriggerLink(nsIPresContext* aPresContext, @@ -273,8 +273,8 @@ public: static nsIAtom* CutNameSpacePrefix(nsString& aString); - static nsresult InternalSupports(const nsString& aFeature, - const nsString& aVersion, PRBool* aReturn); + static nsresult InternalSupports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn); nsDOMSlots *GetDOMSlots(); void MaybeClearDOMSlots(); @@ -303,11 +303,11 @@ public: PRBool aDeep); // Remainder of nsIDOMHTMLElement (and nsIDOMNode) - nsresult GetAttribute(const nsString& aName, nsString& aReturn) + nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return nsGenericElement::GetAttribute(aName, aReturn); } - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericElement::SetAttribute(aName, aValue); } @@ -337,14 +337,14 @@ public: // Remainder of nsIContent nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const; + nsAWritableString& aResult) const; nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const; + nsIAtom*& aPrefix, nsAWritableString& aResult) const; nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify); nsresult GetAttributeNameAt(PRInt32 aIndex, @@ -386,13 +386,13 @@ public: * NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); */ #define NS_IMPL_IDOMNODE_USING_GENERIC(_g) \ - NS_IMETHOD GetNodeName(nsString& aNodeName) { \ + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName) { \ return _g.GetNodeName(aNodeName); \ } \ - NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \ + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \ return _g.GetNodeValue(aNodeValue); \ } \ - NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \ + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { \ return _g.SetNodeValue(aNodeValue); \ } \ NS_IMETHOD GetNodeType(PRUint16* aNodeType) { \ @@ -422,16 +422,16 @@ public: NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { \ return _g.GetAttributes(aAttributes); \ } \ - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI) { \ + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI) { \ return _g.GetNamespaceURI(aNamespaceURI); \ } \ - NS_IMETHOD GetPrefix(nsString& aPrefix) { \ + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { \ return _g.GetPrefix(aPrefix); \ } \ - NS_IMETHOD SetPrefix(const nsString& aPrefix) { \ + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { \ return _g.SetPrefix(aPrefix); \ } \ - NS_IMETHOD GetLocalName(nsString& aLocalName) { \ + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \ return _g.GetLocalName(aLocalName); \ } \ NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, \ @@ -455,8 +455,8 @@ public: NS_IMETHOD Normalize() { \ return _g.Normalize(); \ } \ - NS_IMETHOD Supports(const nsString& aFeature, \ - const nsString& aVersion, PRBool* aReturn) { \ + NS_IMETHOD Supports(const nsAReadableString& aFeature, \ + const nsAReadableString& aVersion, PRBool* aReturn) { \ return _g.Supports(aFeature, aVersion, aReturn); \ } @@ -466,19 +466,19 @@ public: * nsGenericHTMLContainerContent) */ #define NS_IMPL_IDOMELEMENT_USING_GENERIC(_g) \ - NS_IMETHOD GetTagName(nsString& aTagName) { \ + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { \ return _g.GetTagName(aTagName); \ } \ - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { \ + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { \ return _g.GetAttribute(aName, aReturn); \ } \ - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { \ + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { \ return _g.SetAttribute(aName, aValue); \ } \ - NS_IMETHOD RemoveAttribute(const nsString& aName) { \ + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { \ return _g.RemoveAttribute(aName); \ } \ - NS_IMETHOD GetAttributeNode(const nsString& aName, \ + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, \ nsIDOMAttr** aReturn) { \ return _g.GetAttributeNode(aName, aReturn); \ } \ @@ -488,41 +488,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {\ return _g.RemoveAttributeNode(aOldAttr, aReturn); \ } \ - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, \ + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, \ nsIDOMNodeList** aReturn) { \ return _g.GetElementsByTagName(aTagname, aReturn); \ } \ - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, nsString& aReturn) { \ + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { \ return _g.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); \ } \ - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aQualifiedName, \ - const nsString& aValue) { \ + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aQualifiedName, \ + const nsAReadableString& aValue) { \ return _g.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); \ } \ - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName) { \ + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName) { \ return _g.RemoveAttributeNS(aNamespaceURI, aLocalName); \ } \ - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, \ + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, \ nsIDOMAttr** aReturn) { \ return _g.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); \ } \ NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { \ return _g.SetAttributeNodeNS(aNewAttr, aReturn); \ } \ - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, \ + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, \ nsIDOMNodeList** aReturn) { \ return _g.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); \ } \ - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { \ + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { \ return _g.HasAttribute(aName, aReturn); \ } \ - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, PRBool* aReturn) { \ + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, PRBool* aReturn) { \ return _g.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); \ } @@ -549,12 +549,12 @@ public: NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent) { \ return _g.HandleEvent(aEvent); \ } \ - NS_IMETHOD AddEventListener(const nsString& aType, \ + NS_IMETHOD AddEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.AddEventListener(aType, aListener, aUseCapture); \ } \ - NS_IMETHOD RemoveEventListener(const nsString& aType, \ + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.RemoveEventListener(aType, aListener, aUseCapture); \ @@ -611,7 +611,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -621,19 +621,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -750,7 +750,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -760,19 +760,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -889,7 +889,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -899,19 +899,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -1026,7 +1026,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -1036,19 +1036,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -1167,7 +1167,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -1177,19 +1177,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -1300,7 +1300,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -1310,19 +1310,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ diff --git a/content/base/src/nsHTMLValue.cpp b/content/base/src/nsHTMLValue.cpp index 86a8b2d6c687..6e7c540d03cc 100644 --- a/content/base/src/nsHTMLValue.cpp +++ b/content/base/src/nsHTMLValue.cpp @@ -22,6 +22,7 @@ #include "nsHTMLValue.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsISizeOfHandler.h" @@ -60,14 +61,14 @@ nsHTMLValue::nsHTMLValue(float aValue) mValue.mFloat = aValue; } -nsHTMLValue::nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit) +nsHTMLValue::nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit) : mUnit(aUnit) { NS_ASSERTION((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit), "not a string value"); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } else { mUnit = eHTMLUnit_Null; @@ -226,12 +227,13 @@ void nsHTMLValue::SetPercentValue(float aValue) mValue.mFloat = aValue; } -void nsHTMLValue::SetStringValue(const nsString& aValue, nsHTMLUnit aUnit) +void nsHTMLValue::SetStringValue(const nsAReadableString& aValue, + nsHTMLUnit aUnit) { Reset(); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { mUnit = aUnit; - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } } @@ -256,7 +258,7 @@ void nsHTMLValue::SetEmptyValue(void) mUnit = eHTMLUnit_Empty; } -void nsHTMLValue::AppendToString(nsString& aBuffer) const +void nsHTMLValue::AppendToString(nsAWritableString& aBuffer) const { if (eHTMLUnit_Null == mUnit) { return; @@ -266,37 +268,48 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); aBuffer.Append(mValue.mString); - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); } else { - aBuffer.AppendWithConversion("null str"); + aBuffer.Append(NS_LITERAL_STRING("null str")); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.AppendWithConversion("0x"); - aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(NS_LITERAL_STRING("0x")); + nsAutoString intStr; + intStr.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(intStr); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.AppendWithConversion("(0x"); - aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); - aBuffer.AppendWithConversion(')'); + nsAutoString intStr; + intStr.Append(NS_LITERAL_STRING("(0x")); + intStr.AppendInt(NS_GET_R(mValue.mColor), 16); + intStr.Append(intStr); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_G(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_B(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_A(mValue.mColor), 16); + intStr.Append(PRUnichar(')')); + + aBuffer.Append(intStr); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.AppendFloat(mValue.mFloat * 100.0f); + nsAutoString floatStr; + floatStr.AppendFloat(mValue.mFloat * 100.0f); + aBuffer.Append(floatStr); } else { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); + nsAutoString intStr; + intStr.AppendInt(mValue.mInt, 10); + intStr.Append(NS_LITERAL_STRING("[0x")); + intStr.AppendInt(mValue.mInt, 16); + intStr.Append(PRUnichar(']')); + + aBuffer.Append(intStr); } switch (mUnit) { @@ -304,18 +317,18 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.Append(NS_LITERAL_STRING("ptr")); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; - case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; - case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; + case eHTMLUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; + case eHTMLUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break; + case eHTMLUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; + case eHTMLUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; + case eHTMLUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; } - aBuffer.AppendWithConversion(' '); + aBuffer.Append(PRUnichar(' ')); } -void nsHTMLValue::ToString(nsString& aBuffer) const +void nsHTMLValue::ToString(nsAWritableString& aBuffer) const { aBuffer.Truncate(); AppendToString(aBuffer); diff --git a/content/base/src/nsHTMLValue.h b/content/base/src/nsHTMLValue.h index cfd8018c71ab..1c7ed08306f3 100644 --- a/content/base/src/nsHTMLValue.h +++ b/content/base/src/nsHTMLValue.h @@ -48,7 +48,7 @@ public: nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null); nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit); nsHTMLValue(float aValue); - nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); nsHTMLValue(nsISupports* aValue); nsHTMLValue(nscolor aValue); nsHTMLValue(const nsHTMLValue& aCopy); @@ -63,7 +63,7 @@ public: PRInt32 GetIntValue(void) const; PRInt32 GetPixelValue(void) const; float GetPercentValue(void) const; - nsString& GetStringValue(nsString& aBuffer) const; + nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; nsISupports* GetISupportsValue(void) const; nscolor GetColorValue(void) const; @@ -71,13 +71,13 @@ public: void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit); void SetPixelValue(PRInt32 aValue); void SetPercentValue(float aValue); - void SetStringValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + void SetStringValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); void SetISupportsValue(nsISupports* aValue); void SetColorValue(nscolor aValue); void SetEmptyValue(void); - void AppendToString(nsString& aBuffer) const; - void ToString(nsString& aBuffer) const; + void AppendToString(nsAWritableString& aBuffer) const; + void ToString(nsAWritableString& aBuffer) const; protected: nsHTMLUnit mUnit; @@ -129,7 +129,7 @@ inline float nsHTMLValue::GetPercentValue(void) const return 0.0f; } -inline nsString& nsHTMLValue::GetStringValue(nsString& aBuffer) const +inline nsAWritableString& nsHTMLValue::GetStringValue(nsAWritableString& aBuffer) const { NS_ASSERTION((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName) || (mUnit == eHTMLUnit_Null), "not a string value"); diff --git a/content/base/src/nsNameSpaceManager.cpp b/content/base/src/nsNameSpaceManager.cpp index 34844cf646d8..70e09972ec44 100644 --- a/content/base/src/nsNameSpaceManager.cpp +++ b/content/base/src/nsNameSpaceManager.cpp @@ -45,8 +45,6 @@ static PRInt32 gNameSpaceTableRefs; static nsHashtable* gURIToIDTable; static nsVoidArray* gURIArray; -MOZ_DECL_CTOR_COUNTER(NameSpaceURIKey); - static void AddRefTable() { if (0 == gNameSpaceTableRefs++) { @@ -96,7 +94,7 @@ static void ReleaseTable() } } -static PRInt32 FindNameSpaceID(const nsString& aURI) +static PRInt32 FindNameSpaceID(const nsAReadableString& aURI) { NS_ASSERTION(nsnull != gURIToIDTable, "no URI table"); nsStringKey key(aURI); @@ -121,7 +119,7 @@ public: NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, - const nsString& aURI); + const nsAReadableString& aURI); NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, @@ -133,7 +131,7 @@ public: NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const; NS_IMETHOD GetNameSpaceID(PRInt32& aID) const; - NS_IMETHOD GetNameSpaceURI(nsString& aURI) const; + NS_IMETHOD GetNameSpaceURI(nsAWritableString& aURI) const; NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const; NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const; @@ -142,7 +140,7 @@ public: NS_IMETHOD FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const; NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const; - NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI, + NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsAReadableString& aURI, nsINameSpace*& aChildNameSpace); NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID, nsINameSpace*& aChildNameSpace); @@ -162,7 +160,7 @@ public: NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, - const nsString& aURI) + const nsAReadableString& aURI) : mManager(aManager), mParent(aParent), mPrefix(aPrefix) @@ -217,7 +215,7 @@ NameSpaceImpl::GetNameSpaceID(PRInt32& aID) const } NS_IMETHODIMP -NameSpaceImpl::GetNameSpaceURI(nsString& aURI) const +NameSpaceImpl::GetNameSpaceURI(nsAWritableString& aURI) const { NS_ASSERTION(nsnull != mManager, "null namespace manager"); return mManager->GetNameSpaceURI(mID, aURI); @@ -295,7 +293,7 @@ NameSpaceImpl::FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) cons } NS_IMETHODIMP -NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI, +NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsAReadableString& aURI, nsINameSpace*& aChildNameSpace) { NameSpaceImpl* child = new NameSpaceImpl(mManager, this, aPrefix, aURI); @@ -335,11 +333,11 @@ public: NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace); - NS_IMETHOD RegisterNameSpace(const nsString& aURI, + NS_IMETHOD RegisterNameSpace(const nsAReadableString& aURI, PRInt32& aNameSpaceID); - NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI); - NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID); + NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI); + NS_IMETHOD GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID); private: // These are not supported and are not implemented! @@ -384,7 +382,7 @@ NameSpaceManagerImpl::CreateRootNameSpace(nsINameSpace*& aRootNameSpace) } NS_IMETHODIMP -NameSpaceManagerImpl::RegisterNameSpace(const nsString& aURI, +NameSpaceManagerImpl::RegisterNameSpace(const nsAReadableString& aURI, PRInt32& aNameSpaceID) { PRInt32 id = FindNameSpaceID(aURI); @@ -401,7 +399,7 @@ NameSpaceManagerImpl::RegisterNameSpace(const nsString& aURI, } NS_IMETHODIMP -NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) +NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI) { const nsString* result = FindNameSpaceURI(aNameSpaceID); if (nsnull != result) { @@ -413,7 +411,7 @@ NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) } NS_IMETHODIMP -NameSpaceManagerImpl::GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID) +NameSpaceManagerImpl::GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID) { aNameSpaceID = FindNameSpaceID(aURI); return NS_OK; diff --git a/content/base/src/nsNodeInfo.cpp b/content/base/src/nsNodeInfo.cpp index 076ac291a3e2..77617097d61b 100644 --- a/content/base/src/nsNodeInfo.cpp +++ b/content/base/src/nsNodeInfo.cpp @@ -96,7 +96,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS(nsNodeInfo, NS_GET_IID(nsINodeInfo)); // nsINodeInfo NS_IMETHODIMP -nsNodeInfo::GetName(nsString& aName) +nsNodeInfo::GetName(nsAWritableString& aName) { NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED); @@ -117,7 +117,7 @@ nsNodeInfo::GetNameAtom(nsIAtom*& aAtom) NS_IMETHODIMP -nsNodeInfo::GetQualifiedName(nsString& aQualifiedName) +nsNodeInfo::GetQualifiedName(nsAWritableString& aQualifiedName) { NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED); @@ -133,7 +133,7 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName) aQualifiedName.Append(name); if (kStrictDOMLevel2 && mInner.mPrefix) { - nsCAutoString tmp; tmp.AssignWithConversion(aQualifiedName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aQualifiedName)); printf ("Possible DOM Error: .name, .nodeName or .tagName requested on a namespace element/attribute with the qulaified name '%s', is this OK?\n", (const char *)tmp); } @@ -142,7 +142,7 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName) NS_IMETHODIMP -nsNodeInfo::GetLocalName(nsString& aLocalName) +nsNodeInfo::GetLocalName(nsAWritableString& aLocalName) { NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED); @@ -161,7 +161,7 @@ nsNodeInfo::GetLocalName(nsString& aLocalName) NS_IMETHODIMP -nsNodeInfo::GetPrefix(nsString& aPrefix) +nsNodeInfo::GetPrefix(nsAWritableString& aPrefix) { if (mInner.mPrefix) { mInner.mPrefix->ToString(aPrefix); @@ -184,7 +184,7 @@ nsNodeInfo::GetPrefixAtom(nsIAtom*& aAtom) NS_IMETHODIMP -nsNodeInfo::GetNamespaceURI(nsString& aNameSpaceURI) +nsNodeInfo::GetNamespaceURI(nsAWritableString& aNameSpaceURI) { NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED); nsresult rv = NS_OK; @@ -234,7 +234,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom) NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName) +nsNodeInfo::Equals(const nsAReadableString& aName) { if (!mInner.mName) return PR_FALSE; @@ -253,7 +253,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix) +nsNodeInfo::Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix) { if (!mInner.mName) return PR_FALSE; @@ -275,7 +275,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName, PRInt32 aNamespaceID) +nsNodeInfo::Equals(const nsAReadableString& aName, PRInt32 aNamespaceID) { if (!mInner.mName) return PR_FALSE; @@ -297,7 +297,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom, NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix, +nsNodeInfo::Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID) { if (!mInner.mName) return PR_FALSE; @@ -321,7 +321,7 @@ nsNodeInfo::NamespaceEquals(PRInt32 aNamespaceID) NS_IMETHODIMP_(PRBool) -nsNodeInfo::NamespaceEquals(const nsString& aNamespaceURI) +nsNodeInfo::NamespaceEquals(const nsAReadableString& aNamespaceURI) { NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED); nsCOMPtr nsmgr; diff --git a/content/base/src/nsNodeInfo.h b/content/base/src/nsNodeInfo.h index dc2730481528..db5ee44452a9 100644 --- a/content/base/src/nsNodeInfo.h +++ b/content/base/src/nsNodeInfo.h @@ -65,29 +65,29 @@ public: NS_DECL_ISUPPORTS // nsINodeInfo - NS_IMETHOD GetName(nsString& aName); + NS_IMETHOD GetName(nsAWritableString& aName); NS_IMETHOD GetNameAtom(nsIAtom*& aAtom); - NS_IMETHOD GetQualifiedName(nsString& aQualifiedName); - NS_IMETHOD GetLocalName(nsString& aLocalName); - NS_IMETHOD GetPrefix(nsString& aPrefix); + NS_IMETHOD GetQualifiedName(nsAWritableString& aQualifiedName); + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName); + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix); NS_IMETHOD GetPrefixAtom(nsIAtom*& aAtom); - NS_IMETHOD GetNamespaceURI(nsString& aNameSpaceURI); + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNameSpaceURI); NS_IMETHOD GetNamespaceID(PRInt32& aResult); NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom); - NS_IMETHOD_(PRBool) Equals(const nsString& aName); + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom); - NS_IMETHOD_(PRBool) Equals(const nsString& aName, - const nsString& aPrefix); + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, + const nsAReadableString& aPrefix); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID); - NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID); + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, PRInt32 aNamespaceID); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom, PRInt32 aNamespaceID); - NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID); NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID); - NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI); + NS_IMETHOD_(PRBool) NamespaceEquals(const nsAReadableString& aNamespaceURI); NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult); NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult); diff --git a/content/base/src/nsNodeInfoManager.cpp b/content/base/src/nsNodeInfoManager.cpp index 702a8f7da1a0..392dc58ebdce 100644 --- a/content/base/src/nsNodeInfoManager.cpp +++ b/content/base/src/nsNodeInfoManager.cpp @@ -149,7 +149,7 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aName.Length()); @@ -162,7 +162,7 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aName.Length()); @@ -182,8 +182,8 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, - const nsString& aNamespaceURI, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aName.Length()); @@ -214,8 +214,8 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aQualifiedName, - const nsString& aNamespaceURI, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aQualifiedName, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aQualifiedName.Length()); diff --git a/content/base/src/nsNodeInfoManager.h b/content/base/src/nsNodeInfoManager.h index f8585b59ccb6..131200be872f 100644 --- a/content/base/src/nsNodeInfoManager.h +++ b/content/base/src/nsNodeInfoManager.h @@ -40,15 +40,15 @@ public: NS_IMETHOD Init(nsINameSpaceManager *aNameSpaceManager); NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aQualifiedName, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aQualifiedName, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo); NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager); diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index 7c7ec19457b2..c115374aa1a8 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -1559,7 +1559,7 @@ nsresult nsRange::InsertNode(nsIDOMNode* aN) nsresult nsRange::SurroundContents(nsIDOMNode* aN) { return NS_ERROR_NOT_IMPLEMENTED; } -nsresult nsRange::ToString(nsString& aReturn) +nsresult nsRange::ToString(nsAWritableString& aReturn) { nsCOMPtr cStart( do_QueryInterface(mStartParent) ); nsCOMPtr cEnd( do_QueryInterface(mEndParent) ); @@ -1851,7 +1851,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged, // nsIDOMNSRange interface NS_IMETHODIMP -nsRange::CreateContextualFragment(const nsString& aFragment, +nsRange::CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn) { nsresult result = NS_OK; @@ -1924,7 +1924,7 @@ nsRange::CreateContextualFragment(const nsString& aFragment, } else { // Who're we kidding. This only works for html. - contentType.AssignWithConversion("text/html"); + contentType.Assign(NS_LITERAL_STRING("text/html")); } result = parser->ParseFragment(aFragment, (void*)0, @@ -1957,7 +1957,7 @@ nsRange::CreateContextualFragment(const nsString& aFragment, } NS_IMETHODIMP -nsRange::IsValidFragment(const nsString& aFragment, PRBool* aReturn) +nsRange::IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn) { nsresult result = NS_OK; nsCOMPtr parser; diff --git a/content/base/src/nsRange.h b/content/base/src/nsRange.h index 709bd1187b2f..c9089e13c7b8 100644 --- a/content/base/src/nsRange.h +++ b/content/base/src/nsRange.h @@ -88,12 +88,12 @@ public: NS_IMETHOD Clone(nsIDOMRange** aReturn); - NS_IMETHOD ToString(nsString& aReturn); + NS_IMETHOD ToString(nsAWritableString& aReturn); /*BEGIN nsIDOMNSRange interface implementations*/ - NS_IMETHOD CreateContextualFragment(const nsString& aFragment, + NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn); - NS_IMETHOD IsValidFragment(const nsString& aFragment, PRBool* aReturn); + NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn); NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aResult); diff --git a/content/base/src/nsSelection.cpp b/content/base/src/nsSelection.cpp index 264f88a06d90..04d32e04d117 100644 --- a/content/base/src/nsSelection.cpp +++ b/content/base/src/nsSelection.cpp @@ -147,7 +147,7 @@ public: NS_IMETHOD RemoveSelectionListener(nsIDOMSelectionListener* aListenerToRemove); NS_IMETHOD GetEnumerator(nsIEnumerator **aIterator); - NS_IMETHOD ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn); + NS_IMETHOD ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn); NS_IMETHOD SetHint(PRBool aHintRight); NS_IMETHOD GetHint(PRBool *aHintRight); @@ -1528,10 +1528,10 @@ nsSelection::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) //BEGIN nsIFrameSelection methods NS_IMETHODIMP -nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn) +nsDOMSelection::ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn) { nsresult rv = NS_OK; - + nsCOMPtr encoder; nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE ); formatType.AppendWithConversion(aFormatType); @@ -4342,7 +4342,7 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) content->GetTag(tag); if (tag) { - nsString tagString; + nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); @@ -5158,7 +5158,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) content->GetTag(tag); if (tag) { - nsString tagString; + nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); diff --git a/content/base/src/nsTextFragment.cpp b/content/base/src/nsTextFragment.cpp index 43ea0a63c3b9..fad38cd3065c 100644 --- a/content/base/src/nsTextFragment.cpp +++ b/content/base/src/nsTextFragment.cpp @@ -22,6 +22,8 @@ #include "nsTextFragment.h" #include "nsString.h" #include "nsCRT.h" +#include "nsReadableUtils.h" +#include "nsMemory.h" nsTextFragment::~nsTextFragment() { @@ -33,10 +35,10 @@ nsTextFragment::ReleaseText() { if (mState.mLength && m1b && mState.mInHeap) { if (mState.mIs2b) { - delete [] m2b; + nsMemory::Free(m2b); } else { - delete [] m1b; + nsMemory::Free(m1b); } } m1b = nsnull; @@ -105,9 +107,24 @@ nsTextFragment::operator=(const PRUnichar* aString) } nsTextFragment& -nsTextFragment::operator=(const nsString& aString) +nsTextFragment::operator=(const nsAReadableString& aString) { - SetTo(aString.GetUnicode(), aString.Length()); + ReleaseText(); + + PRUint32 length = aString.Length(); + if (length > 0) { + if (IsASCII(aString)) { + m1b = NS_REINTERPRET_CAST(unsigned char *, ToNewCString(aString)); + mState.mIs2b = 0; + } + else { + m2b = ToNewUnicode(aString); + mState.mIs2b = 1; + } + mState.mInHeap = 1; + mState.mLength = (PRInt32)length; + } + return *this; } @@ -141,7 +158,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength) if (need2) { // Use ucs2 storage because we have to - PRUnichar* nt = new PRUnichar[aLength]; + PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar)); if (nsnull != nt) { // Copy data nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength); @@ -155,7 +172,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength) } else { // Use 1 byte storage because we can - unsigned char* nt = new unsigned char[aLength]; + unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); if (nsnull != nt) { // Copy data unsigned char* cp = nt; @@ -179,7 +196,7 @@ nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength) { ReleaseText(); if (0 != aLength) { - unsigned char* nt = new unsigned char[aLength]; + unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); if (nsnull != nt) { nsCRT::memcpy(nt, aBuffer, sizeof(unsigned char) * aLength); diff --git a/content/base/src/nsTextFragment.h b/content/base/src/nsTextFragment.h index defc9f16aab2..52ccecd47637 100644 --- a/content/base/src/nsTextFragment.h +++ b/content/base/src/nsTextFragment.h @@ -23,6 +23,7 @@ #define nsTextFragment_h___ #include "nslayout.h" +#include "nsAWritableString.h" class nsString; // XXX should this normalize the code to keep a \u0000 at the end? @@ -112,7 +113,7 @@ public: * Change the contents of this fragment to be a copy of the * the argument string. */ - nsTextFragment& operator=(const nsString& aString); + nsTextFragment& operator=(const nsAReadableString& aString); /** * Return PR_TRUE if this fragment is represented by PRUnichar data @@ -166,8 +167,8 @@ public: /** * Change the contents of this fragment to be the given buffer and * length. The memory becomes owned by the fragment. In addition, - * the memory for aBuffer must have been allocated using the "new[]" - * because it will be released with "delete []". + * the memory for aBuffer must have been allocated using the + * nsIMemory interface. */ void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease); diff --git a/content/base/src/nsTextNode.cpp b/content/base/src/nsTextNode.cpp index e480b9669434..35419ac60d41 100644 --- a/content/base/src/nsTextNode.cpp +++ b/content/base/src/nsTextNode.cpp @@ -135,9 +135,9 @@ nsTextNode::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsTextNode::GetNodeName(nsString& aNodeName) +nsTextNode::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#text"); + aNodeName.Assign(NS_LITERAL_STRING("#text")); return NS_OK; } diff --git a/content/events/public/nsIEventListenerManager.h b/content/events/public/nsIEventListenerManager.h index 81a2113843f2..8fd308bbe4d9 100644 --- a/content/events/public/nsIEventListenerManager.h +++ b/content/events/public/nsIEventListenerManager.h @@ -67,13 +67,13 @@ public: * Sets events listeners of all types. * @param an event listener */ - virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0; + virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0; /** * Removes events listeners of all types. * @param an event listener */ - virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0; + virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0; /** * Creates a script event listener for the given script object with name mName and function @@ -83,7 +83,7 @@ public: virtual nsresult AddScriptEventListener(nsIScriptContext*aContext, nsIScriptObjectOwner *aScriptObjectOwner, nsIAtom *aName, - const nsString& aFunc, + const nsAReadableString& aFunc, REFNSIID aIID, PRBool aDeferCompilation) = 0; @@ -116,7 +116,7 @@ public: */ virtual nsresult CreateEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - const nsString& aEventType, + const nsAReadableString& aEventType, nsIDOMEvent** aDOMEvent) = 0; /** diff --git a/content/events/public/nsIPrivateDOMEvent.h b/content/events/public/nsIPrivateDOMEvent.h index de3bf0e88387..14f97f280f94 100644 --- a/content/events/public/nsIPrivateDOMEvent.h +++ b/content/events/public/nsIPrivateDOMEvent.h @@ -55,7 +55,7 @@ public: extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent); extern nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, - const nsString& aEventType, + const nsAReadableString& aEventType, nsEvent *aEvent); #endif // nsIPrivateDOMEvent_h__ diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index c8a2881f1a58..74a6cc26ad04 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -53,7 +53,7 @@ static char* mEventNames[] = { "scroll","overflow", "underflow", "overflowchanged" }; -nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsString& aEventType) { +nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType) { mPresContext = aPresContext; if (mPresContext) NS_ADDREF(mPresContext); @@ -63,15 +63,16 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsSt } else { //Allocate internal event - if (aEventType.EqualsIgnoreCase("MouseEvent")) { + nsAutoString eventType(aEventType); + if (eventType.EqualsIgnoreCase("MouseEvent")) { mEvent = PR_NEWZAP(nsMouseEvent); mEvent->eventStructType = NS_MOUSE_EVENT; } - else if (aEventType.EqualsIgnoreCase("KeyEvent")) { + else if (eventType.EqualsIgnoreCase("KeyEvent")) { mEvent = PR_NEWZAP(nsKeyEvent); mEvent->eventStructType = NS_KEY_EVENT; } - else if (aEventType.EqualsIgnoreCase("HTMLEvent")) { + else if (eventType.EqualsIgnoreCase("HTMLEvent")) { mEvent = PR_NEWZAP(nsEvent); mEvent->eventStructType = NS_EVENT; } @@ -144,12 +145,12 @@ NS_INTERFACE_MAP_BEGIN(nsDOMEvent) NS_INTERFACE_MAP_END // nsIDOMEventInterface -NS_METHOD nsDOMEvent::GetType(nsString& aType) +NS_METHOD nsDOMEvent::GetType(nsAWritableString& aType) { const char* mName = GetEventName(mEvent->message); if (nsnull != mName) { - aType.AssignWithConversion(mName); + aType.Assign(NS_ConvertASCIItoUCS2(mName)); return NS_OK; } @@ -886,7 +887,7 @@ NS_METHOD nsDOMEvent::GetPreventDefault(PRBool* aReturn) } nsresult -nsDOMEvent::SetEventType(const nsString& aEventTypeArg) +nsDOMEvent::SetEventType(const nsAReadableString& aEventTypeArg) { nsAutoString str; str.AssignWithConversion("on"); nsIAtom* atom; @@ -958,7 +959,7 @@ nsDOMEvent::SetEventType(const nsString& aEventTypeArg) } NS_IMETHODIMP -nsDOMEvent::InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg) +nsDOMEvent::InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg) { NS_ENSURE_SUCCESS(SetEventType(aEventTypeArg), NS_ERROR_FAILURE); mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE; @@ -968,13 +969,13 @@ nsDOMEvent::InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBoo } NS_IMETHODIMP -nsDOMEvent::InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg) +nsDOMEvent::InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg) { return NS_ERROR_FAILURE; } NS_IMETHODIMP -nsDOMEvent::InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg) +nsDOMEvent::InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg) { NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE); //mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE; @@ -983,7 +984,7 @@ nsDOMEvent::InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool } NS_IMETHODIMP -nsDOMEvent::InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg) +nsDOMEvent::InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg) { NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE); mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE; @@ -1166,7 +1167,7 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType) nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, - const nsString& aEventType, + const nsAReadableString& aEventType, nsEvent *aEvent) { nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent, aEventType); diff --git a/content/events/src/nsDOMEvent.h b/content/events/src/nsDOMEvent.h index 2a81f574be51..dcf6d6652348 100644 --- a/content/events/src/nsDOMEvent.h +++ b/content/events/src/nsDOMEvent.h @@ -90,13 +90,13 @@ public: eDOMEvents_overflowchanged }; - nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsString& aEventType); + nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType); virtual ~nsDOMEvent(); NS_DECL_ISUPPORTS // nsIDOMEvent Interface - NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD GetType(nsAWritableString& aType); NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget); NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget); NS_IMETHOD GetEventPhase(PRUint16* aEventPhase); @@ -107,12 +107,12 @@ public: NS_IMETHOD PreventBubble(); NS_IMETHOD PreventCapture(); NS_IMETHOD PreventDefault(); - NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg); + NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg); // nsIDOMUIEvent Interface NS_IMETHOD GetView(nsIDOMAbstractView** aView); NS_IMETHOD GetDetail(PRInt32* aDetail); - NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg); + NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg); // nsIDOMMouseEvent Interface and nsIDOMKeyEvent Interface NS_IMETHOD GetScreenX(PRInt32* aScreenX); @@ -127,8 +127,8 @@ public: NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget); NS_IMETHOD GetCharCode(PRUint32* aCharCode); NS_IMETHOD GetKeyCode(PRUint32* aKeyCode); - NS_IMETHOD InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg); - NS_IMETHOD InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg); + NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg); + NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg); // nsIDOMNSUIEvent interface NS_IMETHOD GetLayerX(PRInt32* aLayerX); @@ -166,7 +166,7 @@ protected: //Internal helper funcs nsresult GetScrollInfo(nsIScrollableView** aScrollableView, float* aP2T, float* aT2P); - nsresult SetEventType(const nsString& aEventTypeArg); + nsresult SetEventType(const nsAReadableString& aEventTypeArg); nsEvent* mEvent; PRBool mEventIsInternal; diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index cc88385e1252..d69b78bfdc1d 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -511,7 +511,7 @@ nsresult nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType, nsIID& aI } nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener, - const nsString& aType, PRInt32 aFlags) + const nsAReadableString& aType, PRInt32 aFlags) { PRInt32 subType; nsIID iid; @@ -531,7 +531,7 @@ nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aLi } nsresult nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener, - const nsString& aType, PRInt32 aFlags) + const nsAReadableString& aType, PRInt32 aFlags) { PRInt32 subType; nsIID iid; @@ -620,7 +620,7 @@ nsresult nsEventListenerManager::AddScriptEventListener(nsIScriptContext* aContext, nsIScriptObjectOwner *aScriptObjectOwner, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, REFNSIID aIID, PRBool aDeferCompilation) { @@ -1694,11 +1694,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, nsresult nsEventListenerManager::CreateEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - const nsString& aEventType, + const nsAReadableString& aEventType, nsIDOMEvent** aDOMEvent) { - if (!aEvent && !aEventType.EqualsIgnoreCase("MouseEvent") && !aEventType.EqualsIgnoreCase("KeyEvent") && - !aEventType.EqualsIgnoreCase("HTMLEvent")) { + nsAutoString str(aEventType); + if (!aEvent && !str.EqualsIgnoreCase("MouseEvent") && !str.EqualsIgnoreCase("KeyEvent") && + !str.EqualsIgnoreCase("HTMLEvent")) { return NS_ERROR_FAILURE; } @@ -1975,7 +1976,7 @@ nsresult nsEventListenerManager::SetListenerTarget(nsISupports* aTarget) // nsIDOMEventTarget interface NS_IMETHODIMP -nsEventListenerManager::AddEventListener(const nsString& aType, +nsEventListenerManager::AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { @@ -1985,7 +1986,7 @@ nsEventListenerManager::AddEventListener(const nsString& aType, } NS_IMETHODIMP -nsEventListenerManager::RemoveEventListener(const nsString& aType, +nsEventListenerManager::RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { diff --git a/content/events/src/nsEventListenerManager.h b/content/events/src/nsEventListenerManager.h index 27b0afc724ad..9c5b38b134fe 100644 --- a/content/events/src/nsEventListenerManager.h +++ b/content/events/src/nsEventListenerManager.h @@ -73,13 +73,13 @@ public: virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags); virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags); - virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags); - virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags) ; + virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags); + virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags) ; virtual nsresult AddScriptEventListener(nsIScriptContext*aContext, nsIScriptObjectOwner *aScriptObjectOwner, nsIAtom *aName, - const nsString& aFunc, + const nsAReadableString& aFunc, REFNSIID aIID, PRBool aDeferCompilation); virtual nsresult RegisterScriptEventListener(nsIScriptContext *aContext, @@ -100,7 +100,7 @@ public: virtual nsresult CreateEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - const nsString& aEventType, + const nsAReadableString& aEventType, nsIDOMEvent** aDOMEvent); virtual nsresult RemoveAllListeners(PRBool aScriptOnly); @@ -110,10 +110,10 @@ public: static nsresult GetIdentifiersForType(nsIAtom* aType, nsIID& aIID, PRInt32* aSubType); // nsIDOMEventTarget interface - NS_IMETHOD AddEventListener(const nsString& aType, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); diff --git a/content/html/content/public/nsIForm.h b/content/html/content/public/nsIForm.h index 7d81714a9dfa..336c35c7ad22 100644 --- a/content/html/content/public/nsIForm.h +++ b/content/html/content/public/nsIForm.h @@ -60,7 +60,7 @@ public: * attributes. The name or id attributes of the form control * are used as a key into the table. */ - NS_IMETHOD AddElementToTable(nsIFormControl* aElement, const nsString& aName) = 0; + NS_IMETHOD AddElementToTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0; /** * Get the element at a specified index position @@ -95,7 +95,7 @@ public: * @param aName the name or id of the element to remove * @return NS_OK if the element was successfully removed. */ - NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsString& aName) = 0; + NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; }; diff --git a/content/html/content/public/nsIHTMLContent.h b/content/html/content/public/nsIHTMLContent.h index 81c7aa38749c..b2afaa32deb8 100644 --- a/content/html/content/public/nsIHTMLContent.h +++ b/content/html/content/public/nsIHTMLContent.h @@ -64,10 +64,10 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const = 0; + nsAWritableString& aResult) const = 0; NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) = 0; /** @@ -84,7 +84,7 @@ public: * but certain content carries a local base for backward * compatibility. */ - NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const = 0; + NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const = 0; /** * Translate this piece of content to html. Note that this only @@ -94,7 +94,7 @@ public: */ // XXX add in output character set information so that we know how // to encode non 7 bit characters - NS_IMETHOD ToHTMLString(nsString& aResult) const = 0; + NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const = 0; NS_IMETHOD ToHTML(FILE* out) const = 0; }; diff --git a/content/html/content/src/GenericElementCollection.cpp b/content/html/content/src/GenericElementCollection.cpp index cc030cf043b3..b7536b6869b6 100644 --- a/content/html/content/src/GenericElementCollection.cpp +++ b/content/html/content/src/GenericElementCollection.cpp @@ -112,7 +112,7 @@ GenericElementCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -GenericElementCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +GenericElementCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; diff --git a/content/html/content/src/GenericElementCollection.h b/content/html/content/src/GenericElementCollection.h index d522604f2ddd..267376892c33 100644 --- a/content/html/content/src/GenericElementCollection.h +++ b/content/html/content/src/GenericElementCollection.h @@ -42,7 +42,7 @@ public: NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD ParentDestroyed(); diff --git a/content/html/content/src/nsAttributeContent.cpp b/content/html/content/src/nsAttributeContent.cpp index ac162bdccc47..9087969cd35f 100644 --- a/content/html/content/src/nsAttributeContent.cpp +++ b/content/html/content/src/nsAttributeContent.cpp @@ -113,7 +113,7 @@ public: } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { aName = nsnull; @@ -138,13 +138,13 @@ public: return NS_OK; } - NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } - NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, + NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; } - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const { aName = nsnull; aPrefix = nsnull; @@ -194,10 +194,12 @@ public: // Implementation for nsITextContent NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult); NS_IMETHOD GetTextLength(PRInt32* aLengthResult); - NS_IMETHOD CopyText(nsString& aResult); + NS_IMETHOD CopyText(nsAWritableString& aResult); NS_IMETHOD SetText(const PRUnichar* aBuffer, PRInt32 aLength, PRBool aNotify); + NS_IMETHOD SetText(const nsAReadableString& aStr, + PRBool aNotify); NS_IMETHOD SetText(const char* aBuffer, PRInt32 aLength, PRBool aNotify); @@ -208,7 +210,7 @@ public: void ValidateTextFragment(); - void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; + void ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; // Up pointer to the real content object that we are // supporting. Sometimes there is work that we just can't do @@ -353,7 +355,7 @@ nsAttributeContent::ConvertContentToXIF(nsIXIFConverter* ) const } void -nsAttributeContent::ToCString(nsString& aBuf, PRInt32 aOffset, +nsAttributeContent::ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const { } @@ -471,14 +473,14 @@ nsAttributeContent::GetTextLength(PRInt32* aLengthResult) } nsresult -nsAttributeContent::CopyText(nsString& aResult) +nsAttributeContent::CopyText(nsAWritableString& aResult) { ValidateTextFragment(); if (mText.Is2b()) { aResult.Assign(mText.Get2b(), mText.GetLength()); } else { - aResult.AssignWithConversion(mText.Get1b(), mText.GetLength()); + aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()), mText.GetLength()); } return NS_OK; } @@ -504,6 +506,19 @@ nsAttributeContent::SetText(const PRUnichar* aBuffer, PRInt32 aLength, return NS_OK; } +NS_IMETHODIMP +nsAttributeContent::SetText(const nsAReadableString& aStr, + PRBool aNotify) +{ + mText = aStr; + + // Trigger a reflow + if (aNotify && (nsnull != mDocument)) { + mDocument->ContentChanged(mContent, nsnull); + } + return NS_OK; +} + // XXX shouldn't these update mContent's attribute? nsresult nsAttributeContent::SetText(const char* aBuffer, diff --git a/content/html/content/src/nsGenericDOMHTMLCollection.h b/content/html/content/src/nsGenericDOMHTMLCollection.h index 031181b33d2f..838ef1ff79bc 100644 --- a/content/html/content/src/nsGenericDOMHTMLCollection.h +++ b/content/html/content/src/nsGenericDOMHTMLCollection.h @@ -53,7 +53,7 @@ public: // nsIDOMHTMLCollection interface NS_IMETHOD GetLength(PRUint32* aLength)=0; NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0; protected: void* mScriptObject; diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index acd72beb112d..17e077703e44 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -123,14 +123,14 @@ public: nsDOMCSSAttributeDeclaration(nsIHTMLContent *aContent); ~nsDOMCSSAttributeDeclaration(); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); virtual void DropReference(); virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl, PRBool aAllocate); virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl); - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl); virtual nsresult GetParent(nsISupports **aParent); @@ -156,8 +156,8 @@ nsDOMCSSAttributeDeclaration::~nsDOMCSSAttributeDeclaration() } NS_IMETHODIMP -nsDOMCSSAttributeDeclaration::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCOMPtr decl; nsresult rv = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE); @@ -272,7 +272,7 @@ nsDOMCSSAttributeDeclaration::SetCSSDeclaration(nsICSSDeclaration *aDecl) } nsresult -nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsString& aDecl, +nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) { @@ -471,13 +471,13 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent, } nsresult -nsGenericHTMLElement::GetTagName(nsString& aTagName) +nsGenericHTMLElement::GetTagName(nsAWritableString& aTagName) { return GetNodeName(aTagName); } nsresult -nsGenericHTMLElement::GetNodeName(nsString& aNodeName) +nsGenericHTMLElement::GetNodeName(nsAWritableString& aNodeName) { if (kStrictDOMLevel2) { mNodeInfo->GetPrefix(aNodeName); @@ -503,14 +503,14 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName) if (NS_SUCCEEDED(mNodeInfo->GetNamespaceID(id)) && id == kNameSpaceID_None) { // Only fold to uppercase if the HTML element has no namespace, i.e., // it was created as part of an HTML document. - aNodeName.ToUpperCase(); + ToUpperCase(aNodeName); } } if (kStrictDOMLevel2) { PRInt32 pos = aNodeName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aNodeName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aNodeName)); printf ("Possible DOM Error: .nodeName or .tagName requested on the HTML element '%s', is this OK?\n", (const char *)tmp); } } @@ -519,54 +519,54 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName) } nsresult -nsGenericHTMLElement::GetLocalName(nsString& aLocalName) +nsGenericHTMLElement::GetLocalName(nsAWritableString& aLocalName) { mNodeInfo->GetLocalName(aLocalName); // This doesn't work for XHTML - aLocalName.ToUpperCase(); + ToUpperCase(aLocalName); return NS_OK; } // Implementation for nsIDOMHTMLElement nsresult -nsGenericHTMLElement::GetId(nsString& aId) +nsGenericHTMLElement::GetId(nsAWritableString& aId) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, aId); return NS_OK; } nsresult -nsGenericHTMLElement::SetId(const nsString& aId) +nsGenericHTMLElement::SetId(const nsAReadableString& aId) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, aId, PR_TRUE); return NS_OK; } nsresult -nsGenericHTMLElement::GetTitle(nsString& aTitle) +nsGenericHTMLElement::GetTitle(nsAWritableString& aTitle) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::title, aTitle); return NS_OK; } nsresult -nsGenericHTMLElement::SetTitle(const nsString& aTitle) +nsGenericHTMLElement::SetTitle(const nsAReadableString& aTitle) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::title, aTitle, PR_TRUE); return NS_OK; } nsresult -nsGenericHTMLElement::GetLang(nsString& aLang) +nsGenericHTMLElement::GetLang(nsAWritableString& aLang) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::lang, aLang); return NS_OK; } nsresult -nsGenericHTMLElement::SetLang(const nsString& aLang) +nsGenericHTMLElement::SetLang(const nsAReadableString& aLang) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::lang, aLang, PR_TRUE); return NS_OK; @@ -579,7 +579,7 @@ static nsGenericHTMLElement::EnumTable kDirTable[] = { }; nsresult -nsGenericHTMLElement::GetDir(nsString& aDir) +nsGenericHTMLElement::GetDir(nsAWritableString& aDir) { nsHTMLValue value; nsresult result = GetHTMLAttribute(nsHTMLAtoms::dir, value); @@ -592,21 +592,21 @@ nsGenericHTMLElement::GetDir(nsString& aDir) } nsresult -nsGenericHTMLElement::SetDir(const nsString& aDir) +nsGenericHTMLElement::SetDir(const nsAReadableString& aDir) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::dir, aDir, PR_TRUE); return NS_OK; } nsresult -nsGenericHTMLElement::GetClassName(nsString& aClassName) +nsGenericHTMLElement::GetClassName(nsAWritableString& aClassName) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, aClassName); return NS_OK; } nsresult -nsGenericHTMLElement::SetClassName(const nsString& aClassName) +nsGenericHTMLElement::SetClassName(const nsAReadableString& aClassName) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, aClassName, PR_TRUE); return NS_OK; @@ -852,7 +852,7 @@ nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent) } nsresult -nsGenericHTMLElement::GetInnerHTML(nsString& aInnerHTML) +nsGenericHTMLElement::GetInnerHTML(nsAWritableString& aInnerHTML) { aInnerHTML.Truncate(); @@ -910,7 +910,7 @@ nsGenericHTMLElement::GetInnerHTML(nsString& aInnerHTML) } nsresult -nsGenericHTMLElement::SetInnerHTML(const nsString& aInnerHTML) +nsGenericHTMLElement::SetInnerHTML(const nsAReadableString& aInnerHTML) { nsresult rv = NS_OK; @@ -1252,13 +1252,13 @@ nsGenericHTMLElement::GetNameSpaceID(PRInt32& aID) const } nsresult -nsGenericHTMLElement::ParseAttributeString(const nsString& aStr, +nsGenericHTMLElement::ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { // XXX need to validate/strip namespace prefix - nsAutoString lower; - aStr.ToLowerCase(lower); + nsAutoString lower(aStr); + lower.ToLowerCase(); aName = NS_NewAtom(lower); aNameSpaceID = kNameSpaceID_None; @@ -1276,7 +1276,7 @@ nsGenericHTMLElement::GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, nsresult nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult result = NS_OK; @@ -1417,7 +1417,7 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, nsresult nsGenericHTMLElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -1574,7 +1574,7 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsresult nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsIAtom*& aPrefix, nsString &aResult) const + nsIAtom*& aPrefix, nsAWritableString& aResult) const { aPrefix = nsnull; @@ -1583,7 +1583,7 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsresult nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsString &aResult) const + nsAWritableString& aResult) const { #if 0 NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) || @@ -1602,7 +1602,6 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsresult result = mAttributes ? mAttributes->GetAttribute(aAttribute, &value) : NS_CONTENT_ATTR_NOT_THERE; - char cbuf[20]; nscolor color; if (NS_CONTENT_ATTR_HAS_VALUE == result) { nsIHTMLContent* htmlContent; @@ -1631,26 +1630,39 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, break; case eHTMLUnit_Integer: - aResult.Truncate(); - aResult.AppendInt(value->GetIntValue(), 10); - break; + { + nsAutoString intStr; + intStr.AppendInt(value->GetIntValue()); + + aResult.Assign(intStr); + break; + } case eHTMLUnit_Pixel: - aResult.Truncate(); - aResult.AppendInt(value->GetPixelValue(), 10); - break; + { + nsAutoString intStr; + intStr.AppendInt(value->GetPixelValue()); + + aResult.Assign(intStr); + break; + } case eHTMLUnit_Percent: - aResult.Truncate(); - aResult.AppendInt(PRInt32(value->GetPercentValue() * 100.0f), 10); - aResult.AppendWithConversion('%'); - break; + { + nsAutoString intStr; + intStr.AppendInt(PRInt32(value->GetPercentValue() * 100.0f)); + + aResult.Assign(intStr); + aResult.Append(PRUnichar('%')); + break; + } case eHTMLUnit_Color: + char cbuf[20]; color = nscolor(value->GetColorValue()); PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", NS_GET_R(color), NS_GET_G(color), NS_GET_B(color)); - aResult.AssignWithConversion(cbuf); + aResult.Assign(NS_ConvertASCIItoUCS2(cbuf)); break; default: @@ -1807,7 +1819,7 @@ nsGenericHTMLElement::GetBaseURL(const nsHTMLValue& aBaseHref, } nsresult -nsGenericHTMLElement::GetBaseTarget(nsString& aBaseTarget) const +nsGenericHTMLElement::GetBaseTarget(nsAWritableString& aBaseTarget) const { nsresult result = NS_OK; @@ -1989,7 +2001,7 @@ NS_QuoteForHTML(const nsString& aValue, nsString& aResult) { const PRUnichar* cp = aValue.GetUnicode(); const PRUnichar* end = aValue.GetUnicode() + aValue.Length(); - aResult.AssignWithConversion('"'); + aResult.Assign(NS_LITERAL_STRING("\"")); while (cp < end) { PRUnichar ch = *cp++; if ((ch >= 0x20) && (ch <= 0x7f)) { @@ -2010,16 +2022,16 @@ NS_QuoteForHTML(const nsString& aValue, nsString& aResult) } nsresult -nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const +nsGenericHTMLElement::ToHTMLString(nsAWritableString& aBuf) const { - aBuf.AssignWithConversion('<'); + aBuf.Assign(NS_LITERAL_STRING("<")); if (mNodeInfo) { nsAutoString tmp; mNodeInfo->GetQualifiedName(tmp); aBuf.Append(tmp); } else { - aBuf.AppendWithConversion("?NULL"); + aBuf.Append(NS_LITERAL_STRING("?NULL")); } if (nsnull != mAttributes) { @@ -2030,20 +2042,20 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const nsIAtom* atom = nsnull; mAttributes->GetAttributeNameAt(index, atom); atom->ToString(name); - aBuf.AppendWithConversion(' '); + aBuf.Append(NS_LITERAL_STRING(" ")); aBuf.Append(name); value.Truncate(); GetAttribute(kNameSpaceID_None, atom, value); NS_RELEASE(atom); if (value.Length() > 0) { - aBuf.AppendWithConversion('='); + aBuf.Append(NS_LITERAL_STRING("=")); NS_QuoteForHTML(value, quotedValue); aBuf.Append(quotedValue); } } } - aBuf.AppendWithConversion('>'); + aBuf.Append(NS_LITERAL_STRING(">")); return NS_OK; } @@ -2053,7 +2065,7 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const nsresult nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (nsHTMLAtoms::style == aAttribute) { if (eHTMLUnit_ISupports == aValue.GetUnit()) { @@ -2069,7 +2081,7 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, NS_RELEASE(cssRule); } else { - aResult.AssignWithConversion("Unknown rule type"); + aResult.Assign(NS_LITERAL_STRING("Unknown rule type")); } NS_RELEASE(rule); } @@ -2090,12 +2102,13 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, } PRBool -nsGenericHTMLElement::ParseEnumValue(const nsString& aValue, +nsGenericHTMLElement::ParseEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult) { + nsAutoString val(aValue); while (nsnull != aTable->tag) { - if (aValue.EqualsIgnoreCase(aTable->tag)) { + if (val.EqualsIgnoreCase(aTable->tag)) { aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated); return PR_TRUE; } @@ -2105,12 +2118,13 @@ nsGenericHTMLElement::ParseEnumValue(const nsString& aValue, } PRBool -nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue, +nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult) { + nsAutoString val(aValue); while (nsnull != aTable->tag) { - if (aValue.EqualsWithConversion(aTable->tag)) { + if (val.EqualsWithConversion(aTable->tag)) { aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated); return PR_TRUE; } @@ -2122,7 +2136,7 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue, PRBool nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, EnumTable* aTable, - nsString& aResult, + nsAWritableString& aResult, PRBool aFoldCase) { aResult.Truncate(0); @@ -2130,9 +2144,10 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, PRInt32 v = aValue.GetIntValue(); while (nsnull != aTable->tag) { if (aTable->value == v) { - aResult.AppendWithConversion(aTable->tag); + aResult.Append(NS_ConvertASCIItoUCS2(aTable->tag)); if (aFoldCase) { - aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0); + nsWritingIterator start(aResult.BeginWriting()); + *start.get() = nsCRT::ToUpper(*start.get()); } return PR_TRUE; } @@ -2143,7 +2158,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, } PRBool -nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString, +nsGenericHTMLElement::ParseValueOrPercent(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { @@ -2175,7 +2190,7 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString, * or proportional (n*) */ PRBool -nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString, +nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { @@ -2210,19 +2225,23 @@ nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString, PRBool nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { + nsAutoString intStr; aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.AppendInt(aValue.GetIntValue(), 10); + intStr.AppendInt(aValue.GetIntValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.AppendInt(aValue.GetPixelValue(), 10); + intStr.AppendInt(aValue.GetPixelValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Percent: - aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.AppendWithConversion('%'); + intStr.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f)); + aResult.Append(intStr); + aResult.Append(PRUnichar('%')); return PR_TRUE; default: break; @@ -2232,23 +2251,28 @@ nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue, PRBool nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { + nsAutoString intStr; aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.AppendInt(aValue.GetIntValue(), 10); + intStr.AppendInt(aValue.GetIntValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.AppendInt(aValue.GetPixelValue(), 10); + intStr.AppendInt(aValue.GetPixelValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Percent: - aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.AppendWithConversion('%'); + intStr.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f)); + aResult.Append(intStr); + aResult.Append(NS_LITERAL_STRING("%")); return PR_TRUE; case eHTMLUnit_Proportional: - aResult.AppendInt(aValue.GetIntValue(), 10); - aResult.AppendWithConversion('*'); + intStr.AppendInt(aValue.GetIntValue()); + aResult.Append(intStr); + aResult.Append(NS_LITERAL_STRING("*")); return PR_TRUE; default: break; @@ -2257,10 +2281,11 @@ nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aV } PRBool -nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, +nsGenericHTMLElement::ParseValue(const nsAReadableString& aString, PRInt32 aMin, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { - PRInt32 ec, val = aString.ToInteger(&ec); + nsAutoString str(aString); + PRInt32 ec, val = str.ToInteger(&ec); if (NS_OK == ec) { if (val < aMin) val = aMin; if (eHTMLUnit_Pixel == aValueUnit) { @@ -2276,11 +2301,12 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, } PRBool -nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, +nsGenericHTMLElement::ParseValue(const nsAReadableString& aString, PRInt32 aMin, PRInt32 aMax, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { - PRInt32 ec, val = aString.ToInteger(&ec); + nsAutoString str(aString); + PRInt32 ec, val = str.ToInteger(&ec); if (NS_OK == ec) { if (val < aMin) val = aMin; if (val > aMax) val = aMax; @@ -2297,7 +2323,7 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, } PRBool -nsGenericHTMLElement::ParseColor(const nsString& aString, +nsGenericHTMLElement::ParseColor(const nsAReadableString& aString, nsIDocument* aDocument, nsHTMLValue& aResult) { @@ -2320,7 +2346,8 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, } } else { - if (NS_LooseHexToRGB(aString, &color)) { // no space compression + nsAutoString str(aString); + if (NS_LooseHexToRGB(str, &color)) { // no space compression aResult.SetColorValue(color); return PR_TRUE; } @@ -2332,14 +2359,14 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, PRBool nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if (aValue.GetUnit() == eHTMLUnit_Color) { nscolor v = aValue.GetColorValue(); char buf[10]; PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x", NS_GET_R(v), NS_GET_G(v), NS_GET_B(v)); - aResult.AssignWithConversion(buf); + aResult.Assign(NS_ConvertASCIItoUCS2(buf)); return PR_TRUE; } if ((aValue.GetUnit() == eHTMLUnit_ColorName) || @@ -2511,7 +2538,7 @@ static nsGenericHTMLElement::EnumTable kTableVAlignTable[] = { PRBool nsGenericHTMLElement::ParseCommonAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (nsHTMLAtoms::dir == aAttribute) { @@ -2525,7 +2552,7 @@ nsGenericHTMLElement::ParseCommonAttribute(nsIAtom* aAttribute, } PRBool -nsGenericHTMLElement::ParseAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) { return ParseEnumValue(aString, kAlignTable, aResult); @@ -2555,7 +2582,7 @@ static nsGenericHTMLElement::EnumTable kCompatTableHAlignTable[] = { }; PRBool -nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseTableHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const { if (InNavQuirksMode(mDocument)) { @@ -2566,7 +2593,7 @@ nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (InNavQuirksMode(mDocument)) { return EnumValueToString(aValue, kCompatTableHAlignTable, aResult); @@ -2604,7 +2631,7 @@ static nsGenericHTMLElement::EnumTable kCompatTableCellHAlignTable[] = { }; PRBool -nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseTableCellHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const { if (InNavQuirksMode(mDocument)) { @@ -2615,7 +2642,7 @@ nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (InNavQuirksMode(mDocument)) { return EnumValueToString(aValue, kCompatTableCellHAlignTable, aResult); @@ -2626,7 +2653,7 @@ nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue, //---------------------------------------- PRBool -nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseTableVAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) { return ParseEnumValue(aString, kTableVAlignTable, aResult); @@ -2634,20 +2661,20 @@ nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::AlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { return EnumValueToString(aValue, kAlignTable, aResult); } PRBool nsGenericHTMLElement::TableVAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { return EnumValueToString(aValue, kTableVAlignTable, aResult); } PRBool -nsGenericHTMLElement::ParseDivAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseDivAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const { return ParseEnumValue(aString, kDivAlignTable, aResult); @@ -2655,14 +2682,14 @@ nsGenericHTMLElement::ParseDivAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::DivAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return EnumValueToString(aValue, kDivAlignTable, aResult); } PRBool nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult) { if ((aAttribute == nsHTMLAtoms::width) || @@ -2680,7 +2707,7 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute, PRBool nsGenericHTMLElement::ImageAttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if ((aAttribute == nsHTMLAtoms::width) || (aAttribute == nsHTMLAtoms::height) || @@ -2694,7 +2721,7 @@ nsGenericHTMLElement::ImageAttributeToString(nsIAtom* aAttribute, PRBool nsGenericHTMLElement::ParseFrameborderValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult) { if (aStandardMode) { @@ -2707,7 +2734,7 @@ nsGenericHTMLElement::ParseFrameborderValue(PRBool aStandardMode, PRBool nsGenericHTMLElement::FrameborderValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if (aStandardMode) { return EnumValueToString(aValue, kFrameborderStandardTable, aResult); @@ -2718,7 +2745,7 @@ nsGenericHTMLElement::FrameborderValueToString(PRBool aStandardMode, PRBool nsGenericHTMLElement::ParseScrollingValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult) { if (aStandardMode) { @@ -2731,7 +2758,7 @@ nsGenericHTMLElement::ParseScrollingValue(PRBool aStandardMode, PRBool nsGenericHTMLElement::ScrollingValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if (aStandardMode) { return EnumValueToString(aValue, kScrollingStandardTable, aResult); @@ -2759,7 +2786,7 @@ nsGenericHTMLElement::ReparseStyleAttribute(void) } nsresult -nsGenericHTMLElement::ParseStyleAttribute(const nsString& aValue, nsHTMLValue& aResult) +nsGenericHTMLElement::ParseStyleAttribute(const nsAReadableString& aValue, nsHTMLValue& aResult) { nsresult result = NS_OK; @@ -3128,10 +3155,9 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aPresContext->GetCompatibilityMode(&mode); if (eCompatibility_NavQuirks == mode && eHTMLUnit_Empty == value.GetUnit()) { - nsAutoString spec; nsStyleColor* color; color = (nsStyleColor*)aContext->GetMutableStyleData(eStyleStruct_Color); - color->mBackgroundImage = spec; + color->mBackgroundImage.Truncate(); color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE; color->mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY; } @@ -3626,7 +3652,7 @@ nsGenericHTMLContainerFormElement::SetForm(nsIForm* aForm) } nsresult -nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, +nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify) { // Add the control to the hash table @@ -3641,7 +3667,7 @@ nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* a nsresult nsGenericHTMLContainerFormElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -3713,7 +3739,9 @@ nsGenericHTMLLeafFormElement::SetForm(nsIForm* aForm) } nsresult -nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, +nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, + nsIAtom* aName, + const nsAReadableString& aValue, PRBool aNotify) { // Add the control to the hash table @@ -3728,12 +3756,13 @@ nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, mForm->AddElementToTable(control, aValue); } - return nsGenericHTMLElement::SetAttribute(aNameSpaceID, aName, aValue, aNotify); + return nsGenericHTMLElement::SetAttribute(aNameSpaceID, aName, aValue, + aNotify); } nsresult nsGenericHTMLLeafFormElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 842b2cf585de..5caff717e4ac 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -67,39 +67,39 @@ public: PRBool aDeep); // Implementation for nsIDOMNode - nsresult GetNodeName(nsString& aNodeName); - nsresult GetLocalName(nsString& aLocalName); + nsresult GetNodeName(nsAWritableString& aNodeName); + nsresult GetLocalName(nsAWritableString& aLocalName); // Implementation for nsIDOMElement - nsresult GetAttribute(const nsString& aName, nsString& aReturn) + nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return nsGenericElement::GetAttribute(aName, aReturn); } - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericElement::SetAttribute(aName, aValue); } - nsresult GetTagName(nsString& aTagName); + nsresult GetTagName(nsAWritableString& aTagName); // Implementation for nsIDOMHTMLElement - nsresult GetId(nsString& aId); - nsresult SetId(const nsString& aId); - nsresult GetTitle(nsString& aTitle); - nsresult SetTitle(const nsString& aTitle); - nsresult GetLang(nsString& aLang); - nsresult SetLang(const nsString& aLang); - nsresult GetDir(nsString& aDir); - nsresult SetDir(const nsString& aDir); - nsresult GetClassName(nsString& aClassName); - nsresult SetClassName(const nsString& aClassName); + nsresult GetId(nsAWritableString& aId); + nsresult SetId(const nsAReadableString& aId); + nsresult GetTitle(nsAWritableString& aTitle); + nsresult SetTitle(const nsAReadableString& aTitle); + nsresult GetLang(nsAWritableString& aLang); + nsresult SetLang(const nsAReadableString& aLang); + nsresult GetDir(nsAWritableString& aDir); + nsresult SetDir(const nsAReadableString& aDir); + nsresult GetClassName(nsAWritableString& aClassName); + nsresult SetClassName(const nsAReadableString& aClassName); nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle); nsresult GetOffsetTop(PRInt32* aOffsetTop); nsresult GetOffsetLeft(PRInt32* aOffsetLeft); nsresult GetOffsetWidth(PRInt32* aOffsetWidth); nsresult GetOffsetHeight(PRInt32* aOffsetHeight); nsresult GetOffsetParent(nsIDOMElement** aOffsetParent); - nsresult GetInnerHTML(nsString& aInnerHTML); - nsresult SetInnerHTML(const nsString& aInnerHTML); + nsresult GetInnerHTML(nsAWritableString& aInnerHTML); + nsresult SetInnerHTML(const nsAReadableString& aInnerHTML); nsresult GetOffsetRect(nsRect& aRect, nsIAtom* aOffsetParentTag, nsIContent** aOffsetParent); @@ -108,17 +108,17 @@ public: // Implementation for nsIContent nsresult GetNameSpaceID(PRInt32& aNameSpaceID) const; nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers); - nsresult ParseAttributeString(const nsString& aStr, + nsresult ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID); nsresult GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, nsIAtom*& aPrefix); - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const; - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const; + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aResult) const; + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsAWritableString& aResult) const; nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify); nsresult GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, @@ -153,8 +153,8 @@ public: nsresult GetContentStyleRules(nsISupportsArray* aRules); nsresult GetInlineStyleRules(nsISupportsArray* aRules); nsresult GetBaseURL(nsIURI*& aBaseURL) const; - nsresult GetBaseTarget(nsString& aBaseTarget) const; - nsresult ToHTMLString(nsString& aResult) const; + nsresult GetBaseTarget(nsAWritableString& aBaseTarget) const; + nsresult ToHTMLString(nsAWritableString& aResult) const; nsresult ToHTML(FILE* out) const; nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult, size_t aInstanceSize) const; @@ -162,7 +162,7 @@ public: //---------------------------------------- nsresult AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; void ListAttributes(FILE* out) const; @@ -176,100 +176,100 @@ public: PRInt32 value; }; - static PRBool ParseEnumValue(const nsString& aValue, + static PRBool ParseEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult); - static PRBool ParseCaseSensitiveEnumValue(const nsString& aValue, + static PRBool ParseCaseSensitiveEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult); static PRBool EnumValueToString(const nsHTMLValue& aValue, EnumTable* aTable, - nsString& aResult, + nsAWritableString& aResult, PRBool aFoldCase=PR_TRUE); - static PRBool ParseValueOrPercent(const nsString& aString, + static PRBool ParseValueOrPercent(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); - static PRBool ParseValueOrPercentOrProportional(const nsString& aString, + static PRBool ParseValueOrPercentOrProportional(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); static PRBool ValueOrPercentToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); - static PRBool ParseValue(const nsString& aString, PRInt32 aMin, + static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); - static PRBool ParseValue(const nsString& aString, PRInt32 aMin, PRInt32 aMax, + static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin, PRInt32 aMax, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); - static PRBool ParseColor(const nsString& aString, nsIDocument* aDocument, + static PRBool ParseColor(const nsAReadableString& aString, nsIDocument* aDocument, nsHTMLValue& aResult); static PRBool ColorToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseCommonAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult); - static PRBool ParseAlignValue(const nsString& aString, nsHTMLValue& aResult); + static PRBool ParseAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult); - PRBool ParseDivAlignValue(const nsString& aString, + PRBool ParseDivAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const; PRBool DivAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; - PRBool ParseTableHAlignValue(const nsString& aString, + PRBool ParseTableHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const; PRBool TableHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; - PRBool ParseTableCellHAlignValue(const nsString& aString, + PRBool ParseTableCellHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const; PRBool TableCellHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; - static PRBool ParseTableVAlignValue(const nsString& aString, + static PRBool ParseTableVAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool TableVAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool AlignValueToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseImageAttribute(nsIAtom* aAttribute, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool ImageAttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseFrameborderValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool FrameborderValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseScrollingValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool ScrollingValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); nsresult ReparseStyleAttribute(void); - nsresult ParseStyleAttribute(const nsString& aValue, nsHTMLValue& aResult); + nsresult ParseStyleAttribute(const nsAReadableString& aValue, nsHTMLValue& aResult); /** Attribute Mapping Helpers * @@ -466,11 +466,11 @@ public: ~nsGenericHTMLContainerFormElement(); nsresult SetForm(nsIForm* aForm); - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericHTMLElement::SetAttribute(aName, aValue); } @@ -487,11 +487,11 @@ public: ~nsGenericHTMLLeafFormElement(); nsresult SetForm(nsIForm* aForm); - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericHTMLElement::SetAttribute(aName, aValue); } @@ -508,34 +508,34 @@ public: * nsGenericHTMLContainerContent) */ #define NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(_g) \ - NS_IMETHOD GetId(nsString& aId) { \ + NS_IMETHOD GetId(nsAWritableString& aId) { \ return _g.GetId(aId); \ } \ - NS_IMETHOD SetId(const nsString& aId) { \ + NS_IMETHOD SetId(const nsAReadableString& aId) { \ return _g.SetId(aId); \ } \ - NS_IMETHOD GetTitle(nsString& aTitle) { \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle) { \ return _g.GetTitle(aTitle); \ } \ - NS_IMETHOD SetTitle(const nsString& aTitle) { \ + NS_IMETHOD SetTitle(const nsAReadableString& aTitle) { \ return _g.SetTitle(aTitle); \ } \ - NS_IMETHOD GetLang(nsString& aLang) { \ + NS_IMETHOD GetLang(nsAWritableString& aLang) { \ return _g.GetLang(aLang); \ } \ - NS_IMETHOD SetLang(const nsString& aLang) { \ + NS_IMETHOD SetLang(const nsAReadableString& aLang) { \ return _g.SetLang(aLang); \ } \ - NS_IMETHOD GetDir(nsString& aDir) { \ + NS_IMETHOD GetDir(nsAWritableString& aDir) { \ return _g.GetDir(aDir); \ } \ - NS_IMETHOD SetDir(const nsString& aDir) { \ + NS_IMETHOD SetDir(const nsAReadableString& aDir) { \ return _g.SetDir(aDir); \ } \ - NS_IMETHOD GetClassName(nsString& aClassName) { \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName) { \ return _g.GetClassName(aClassName); \ } \ - NS_IMETHOD SetClassName(const nsString& aClassName) { \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName) { \ return _g.SetClassName(aClassName); \ } \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { \ @@ -556,10 +556,10 @@ public: NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) { \ return _g.GetOffsetParent(aOffsetParent); \ } \ - NS_IMETHOD GetInnerHTML(nsString& aInnerHTML) { \ + NS_IMETHOD GetInnerHTML(nsAWritableString& aInnerHTML) { \ return _g.GetInnerHTML(aInnerHTML); \ } \ - NS_IMETHOD SetInnerHTML(const nsString& aInnerHTML) { \ + NS_IMETHOD SetInnerHTML(const nsAReadableString& aInnerHTML) { \ return _g.SetInnerHTML(aInnerHTML); \ } @@ -594,21 +594,21 @@ public: NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \ return _g.GetBaseURL(aBaseURL); \ } \ - NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \ + NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const { \ return _g.GetBaseTarget(aBaseTarget); \ } \ - NS_IMETHOD ToHTMLString(nsString& aResult) const { \ + NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const { \ return _g.ToHTMLString(aResult); \ } \ NS_IMETHOD ToHTML(FILE* out) const { \ return _g.ToHTML(out); \ } \ NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \ - const nsString& aValue, \ + const nsAReadableString& aValue, \ nsHTMLValue& aResult); \ NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ - nsString& aResult) const; \ + nsAWritableString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ @@ -640,21 +640,21 @@ public: NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \ return _g.GetBaseURL(aBaseURL); \ } \ - NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \ + NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const { \ return _g.GetBaseTarget(aBaseTarget); \ } \ - NS_IMETHOD ToHTMLString(nsString& aResult) const { \ + NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const { \ return _g.ToHTMLString(aResult); \ } \ NS_IMETHOD ToHTML(FILE* out) const { \ return _g.ToHTML(out); \ } \ NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \ - const nsString& aValue, \ + const nsAReadableString& aValue, \ nsHTMLValue& aResult); \ NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ - nsString& aResult) const; \ + nsAWritableString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ @@ -692,13 +692,13 @@ public: */ #define NS_IMPL_STRING_ATTR(_class, _method, _atom) \ NS_IMETHODIMP \ - _class::Get##_method(nsString& aValue) \ + _class::Get##_method(nsAWritableString& aValue) \ { \ mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue); \ return NS_OK; \ } \ NS_IMETHODIMP \ - _class::Set##_method(const nsString& aValue) \ + _class::Set##_method(const nsAReadableString& aValue) \ { \ return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue, PR_TRUE); \ } diff --git a/content/html/content/src/nsHTMLAnchorElement.cpp b/content/html/content/src/nsHTMLAnchorElement.cpp index 7d526bb3e081..123286f93bd8 100644 --- a/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/content/html/content/src/nsHTMLAnchorElement.cpp @@ -46,6 +46,7 @@ #include "nsIPresShell.h" #include "nsIDocument.h" #include "nsIHTMLAttributes.h" +#include "prprf.h" // XXX suppress @@ -77,42 +78,10 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLAnchorElement - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetCharset(nsString& aCharset); - NS_IMETHOD SetCharset(const nsString& aCharset); - NS_IMETHOD GetCoords(nsString& aCoords); - NS_IMETHOD SetCoords(const nsString& aCoords); - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetHreflang(nsString& aHreflang); - NS_IMETHOD SetHreflang(const nsString& aHreflang); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetRel(nsString& aRel); - NS_IMETHOD SetRel(const nsString& aRel); - NS_IMETHOD GetRev(nsString& aRev); - NS_IMETHOD SetRev(const nsString& aRev); - NS_IMETHOD GetShape(nsString& aShape); - NS_IMETHOD SetShape(const nsString& aShape); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); - NS_IMETHOD Blur(); - NS_IMETHOD Focus(); + NS_DECL_IDOMHTMLANCHORELEMENT // nsIDOMNSHTMLAnchorElement - NS_IMETHOD GetProtocol(nsString& aProtocol); - NS_IMETHOD GetHost(nsString& aHost); - NS_IMETHOD GetHostname(nsString& aHostname); - NS_IMETHOD GetPathname(nsString& aPathname); - NS_IMETHOD GetSearch(nsString& aSearch); - NS_IMETHOD GetPort(nsString& aPort); - NS_IMETHOD GetHash(nsString& aHash); - NS_IMETHOD GetText(nsString& aText); + NS_DECL_IDOMNSHTMLANCHORELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -351,7 +320,7 @@ nsHTMLAnchorElement::RemoveFocus(nsIPresContext* aPresContext) NS_IMETHODIMP nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::tabindex) { @@ -361,7 +330,7 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::suppress) { - if (aValue.EqualsIgnoreCase("true")) { + if (nsCRT::strcasecmp(nsPromiseFlatString(aValue), NS_LITERAL_STRING("true"))) { aResult.SetEmptyValue(); // XXX? shouldn't just leave "true" return NS_CONTENT_ATTR_HAS_VALUE; } @@ -372,7 +341,7 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLAnchorElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -421,13 +390,13 @@ nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsHTMLAnchorElement::GetHref(nsString& aValue) +nsHTMLAnchorElement::GetHref(nsAWritableString& aValue) { char *buf; nsresult rv = GetHrefCString(buf); if (NS_FAILED(rv)) return rv; if (buf) { - aValue.AssignWithConversion(buf); + aValue.Assign(NS_ConvertASCIItoUCS2(buf)); nsCRT::free(buf); } // NS_IMPL_STRING_ATTR does nothing where we have (buf == null) @@ -435,7 +404,7 @@ nsHTMLAnchorElement::GetHref(nsString& aValue) } NS_IMETHODIMP -nsHTMLAnchorElement::SetHref(const nsString& aValue) +nsHTMLAnchorElement::SetHref(const nsAReadableString& aValue) { // Clobber our "cache", so we'll recompute it the next time // somebody asks for it. @@ -451,7 +420,7 @@ nsHTMLAnchorElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const } NS_IMETHODIMP -nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) +nsHTMLAnchorElement::GetProtocol(nsAWritableString& aProtocol) { nsAutoString href; nsIURI *url; @@ -464,8 +433,8 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.AssignWithConversion(protocol); - aProtocol.AppendWithConversion(":"); + aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol)); + aProtocol.Append(NS_LITERAL_STRING(":")); nsCRT::free(protocol); } NS_RELEASE(url); @@ -476,7 +445,7 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) } NS_IMETHODIMP -nsHTMLAnchorElement::GetHost(nsString& aHost) +nsHTMLAnchorElement::GetHost(nsAWritableString& aHost) { nsAutoString href; nsIURI *url; @@ -489,13 +458,15 @@ nsHTMLAnchorElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.AssignWithConversion(host); + aHost.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.AppendWithConversion(":"); - aHost.AppendInt(port, 10); + aHost.Append(NS_LITERAL_STRING(":")); + nsAutoString portStr; + portStr.AppendInt(port); + aHost.Append(portStr); } } NS_RELEASE(url); @@ -506,7 +477,7 @@ nsHTMLAnchorElement::GetHost(nsString& aHost) } NS_IMETHODIMP -nsHTMLAnchorElement::GetHostname(nsString& aHostname) +nsHTMLAnchorElement::GetHostname(nsAWritableString& aHostname) { nsAutoString href; nsIURI *url; @@ -519,7 +490,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.AssignWithConversion(host); + aHostname.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); } NS_RELEASE(url); @@ -530,7 +501,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname) } NS_IMETHODIMP -nsHTMLAnchorElement::GetPathname(nsString& aPathname) +nsHTMLAnchorElement::GetPathname(nsAWritableString& aPathname) { nsAutoString href; nsCOMPtr uri; @@ -560,14 +531,14 @@ nsHTMLAnchorElement::GetPathname(nsString& aPathname) return result; } - aPathname.AssignWithConversion(file); + aPathname.Assign(NS_ConvertASCIItoUCS2(file)); nsCRT::free(file); return result; } NS_IMETHODIMP -nsHTMLAnchorElement::GetSearch(nsString& aSearch) +nsHTMLAnchorElement::GetSearch(nsAWritableString& aSearch) { nsAutoString href; nsIURI *uri; @@ -585,8 +556,8 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.AssignWithConversion("?"); - aSearch.AppendWithConversion(search); + aSearch.Assign(NS_LITERAL_STRING("?")); + aSearch.Append(NS_ConvertASCIItoUCS2(search)); nsCRT::free(search); } else { @@ -600,7 +571,7 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch) } NS_IMETHODIMP -nsHTMLAnchorElement::GetPort(nsString& aPort) +nsHTMLAnchorElement::GetPort(nsAWritableString& aPort) { nsAutoString href; nsIURI *url; @@ -610,11 +581,13 @@ nsHTMLAnchorElement::GetPort(nsString& aPort) if (NS_OK == result) { result = NS_NewURI(&url, href); if (NS_OK == result) { - aPort.SetLength(0); + aPort.Truncate(0); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.AppendInt(port, 10); + nsAutoString portStr; + portStr.AppendInt(port); + aPort.Append(portStr); } NS_RELEASE(url); } @@ -624,7 +597,7 @@ nsHTMLAnchorElement::GetPort(nsString& aPort) } NS_IMETHODIMP -nsHTMLAnchorElement::GetHash(nsString& aHash) +nsHTMLAnchorElement::GetHash(nsAWritableString& aHash) { nsAutoString href; nsIURI *uri; @@ -643,8 +616,8 @@ nsHTMLAnchorElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.AssignWithConversion("#"); - aHash.AppendWithConversion(ref); + aHash.Assign(NS_LITERAL_STRING("#")); + aHash.Append(NS_ConvertASCIItoUCS2(ref)); nsCRT::free(ref); } else { @@ -658,7 +631,7 @@ nsHTMLAnchorElement::GetHash(nsString& aHash) } NS_IMETHODIMP -nsHTMLAnchorElement::GetText(nsString& aText) +nsHTMLAnchorElement::GetText(nsAWritableString& aText) { aText.Truncate(); diff --git a/content/html/content/src/nsHTMLAppletElement.cpp b/content/html/content/src/nsHTMLAppletElement.cpp index 4db86f67d363..d65a74db4df0 100644 --- a/content/html/content/src/nsHTMLAppletElement.cpp +++ b/content/html/content/src/nsHTMLAppletElement.cpp @@ -72,28 +72,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLAppletElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetAlt(nsString& aAlt); - NS_IMETHOD SetAlt(const nsString& aAlt); - NS_IMETHOD GetArchive(nsString& aArchive); - NS_IMETHOD SetArchive(const nsString& aArchive); - NS_IMETHOD GetCode(nsString& aCode); - NS_IMETHOD SetCode(const nsString& aCode); - NS_IMETHOD GetCodeBase(nsString& aCodeBase); - NS_IMETHOD SetCodeBase(const nsString& aCodeBase); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetHspace(nsString& aHspace); - NS_IMETHOD SetHspace(const nsString& aHspace); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetObject(nsString& aObject); - NS_IMETHOD SetObject(const nsString& aObject); - NS_IMETHOD GetVspace(nsString& aVspace); - NS_IMETHOD SetVspace(const nsString& aVspace); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLAPPLETELEMENT // nsIJSScriptObject virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, @@ -209,7 +188,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Width, width) NS_IMETHODIMP nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -227,7 +206,7 @@ nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLAreaElement.cpp b/content/html/content/src/nsHTMLAreaElement.cpp index 25874c0cc1e8..e0b6ce7875e4 100644 --- a/content/html/content/src/nsHTMLAreaElement.cpp +++ b/content/html/content/src/nsHTMLAreaElement.cpp @@ -62,31 +62,10 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLAreaElement - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetAlt(nsString& aAlt); - NS_IMETHOD SetAlt(const nsString& aAlt); - NS_IMETHOD GetCoords(nsString& aCoords); - NS_IMETHOD SetCoords(const nsString& aCoords); - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetNoHref(PRBool* aNoHref); - NS_IMETHOD SetNoHref(PRBool aNoHref); - NS_IMETHOD GetShape(nsString& aShape); - NS_IMETHOD SetShape(const nsString& aShape); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); + NS_DECL_IDOMHTMLAREAELEMENT // nsIDOMNSHTMLAreaElement - NS_IMETHOD GetProtocol(nsString& aProtocol); - NS_IMETHOD GetHost(nsString& aHost); - NS_IMETHOD GetHostname(nsString& aHostname); - NS_IMETHOD GetPathname(nsString& aPathname); - NS_IMETHOD GetSearch(nsString& aSearch); - NS_IMETHOD GetPort(nsString& aPort); - NS_IMETHOD GetHash(nsString& aHash); + NS_DECL_IDOMNSHTMLAREAELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -187,7 +166,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Target, target) NS_IMETHODIMP nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::nohref) { @@ -206,7 +185,7 @@ nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLAreaElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -279,13 +258,13 @@ nsHTMLAreaElement::RemoveFocus(nsIPresContext* aPresContext) } NS_IMETHODIMP -nsHTMLAreaElement::GetHref(nsString& aValue) +nsHTMLAreaElement::GetHref(nsAWritableString& aValue) { char *buf; nsresult rv = GetHrefCString(buf); if (NS_FAILED(rv)) return rv; if (buf) { - aValue.AssignWithConversion(buf); + aValue.Assign(NS_ConvertASCIItoUCS2(buf)); nsCRT::free(buf); } // NS_IMPL_STRING_ATTR does nothing where we have (buf == null) @@ -293,7 +272,7 @@ nsHTMLAreaElement::GetHref(nsString& aValue) } NS_IMETHODIMP -nsHTMLAreaElement::SetHref(const nsString& aValue) +nsHTMLAreaElement::SetHref(const nsAReadableString& aValue) { // Clobber our "cache", so we'll recompute it the next time // somebody asks for it. @@ -309,7 +288,7 @@ nsHTMLAreaElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const } NS_IMETHODIMP -nsHTMLAreaElement::GetProtocol(nsString& aProtocol) +nsHTMLAreaElement::GetProtocol(nsAWritableString& aProtocol) { nsAutoString href; nsIURI *url; @@ -322,8 +301,8 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.AssignWithConversion(protocol); - aProtocol.AppendWithConversion(":"); + aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol)); + aProtocol.Append(NS_LITERAL_STRING(":")); nsCRT::free(protocol); } NS_RELEASE(url); @@ -334,7 +313,7 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol) } NS_IMETHODIMP -nsHTMLAreaElement::GetHost(nsString& aHost) +nsHTMLAreaElement::GetHost(nsAWritableString& aHost) { nsAutoString href; nsIURI *url; @@ -347,13 +326,15 @@ nsHTMLAreaElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.AssignWithConversion(host); + aHost.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.AppendWithConversion(":"); - aHost.AppendInt(port, 10); + aHost.Append(NS_LITERAL_STRING(":")); + nsAutoString portStr; + portStr.AppendInt(port, 10); + aHost.Append(portStr); } } NS_RELEASE(url); @@ -364,7 +345,7 @@ nsHTMLAreaElement::GetHost(nsString& aHost) } NS_IMETHODIMP -nsHTMLAreaElement::GetHostname(nsString& aHostname) +nsHTMLAreaElement::GetHostname(nsAWritableString& aHostname) { nsAutoString href; nsIURI *url; @@ -377,7 +358,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.AssignWithConversion(host); + aHostname.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); } NS_RELEASE(url); @@ -388,7 +369,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname) } NS_IMETHODIMP -nsHTMLAreaElement::GetPathname(nsString& aPathname) +nsHTMLAreaElement::GetPathname(nsAWritableString& aPathname) { nsAutoString href; nsCOMPtr uri; @@ -409,14 +390,14 @@ nsHTMLAreaElement::GetPathname(nsString& aPathname) result = url->GetFilePath(&file); NS_ENSURE_SUCCESS(result, result); - aPathname.AssignWithConversion(file); + aPathname.Assign(NS_ConvertASCIItoUCS2(file)); nsCRT::free(file); return result; } NS_IMETHODIMP -nsHTMLAreaElement::GetSearch(nsString& aSearch) +nsHTMLAreaElement::GetSearch(nsAWritableString& aSearch) { nsAutoString href; nsIURI *uri; @@ -434,8 +415,8 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.AssignWithConversion("?"); - aSearch.AppendWithConversion(search); + aSearch.Assign(NS_LITERAL_STRING("?")); + aSearch.Append(NS_ConvertASCIItoUCS2(search)); nsCRT::free(search); } else { @@ -449,7 +430,7 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch) } NS_IMETHODIMP -nsHTMLAreaElement::GetPort(nsString& aPort) +nsHTMLAreaElement::GetPort(nsAWritableString& aPort) { nsAutoString href; nsIURI *url; @@ -463,7 +444,9 @@ nsHTMLAreaElement::GetPort(nsString& aPort) PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.AppendInt(port, 10); + nsAutoString portStr; + portStr.AppendInt(port, 10); + aPort.Append(portStr); } NS_RELEASE(url); } @@ -473,7 +456,7 @@ nsHTMLAreaElement::GetPort(nsString& aPort) } NS_IMETHODIMP -nsHTMLAreaElement::GetHash(nsString& aHash) +nsHTMLAreaElement::GetHash(nsAWritableString& aHash) { nsAutoString href; nsIURI *uri; @@ -492,8 +475,8 @@ nsHTMLAreaElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.AssignWithConversion("#"); - aHash.AppendWithConversion(ref); + aHash.Assign(NS_LITERAL_STRING("#")); + aHash.Append(NS_ConvertASCIItoUCS2(ref)); nsCRT::free(ref); } else { diff --git a/content/html/content/src/nsHTMLBRElement.cpp b/content/html/content/src/nsHTMLBRElement.cpp index 75f5dbc0fcf5..4b49cdb82a05 100644 --- a/content/html/content/src/nsHTMLBRElement.cpp +++ b/content/html/content/src/nsHTMLBRElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBRElement - NS_IMETHOD GetClear(nsString& aClear); - NS_IMETHOD SetClear(const nsString& aClear); + NS_DECL_IDOMHTMLBRELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +136,7 @@ static nsGenericHTMLElement::EnumTable kClearTable[] = { NS_IMETHODIMP nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::clear) { @@ -151,7 +150,7 @@ nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBRElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::clear) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLBaseElement.cpp b/content/html/content/src/nsHTMLBaseElement.cpp index b62883b1df20..f8fc9a137f34 100644 --- a/content/html/content/src/nsHTMLBaseElement.cpp +++ b/content/html/content/src/nsHTMLBaseElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBaseElement - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); + NS_DECL_IDOMHTMLBASEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBaseElement, Target, target) NS_IMETHODIMP nsHTMLBaseElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -140,7 +137,7 @@ nsHTMLBaseElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBaseElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLBaseFontElement.cpp b/content/html/content/src/nsHTMLBaseFontElement.cpp index ccd45cda02c0..354957a740cd 100644 --- a/content/html/content/src/nsHTMLBaseFontElement.cpp +++ b/content/html/content/src/nsHTMLBaseFontElement.cpp @@ -54,12 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBaseElement - NS_IMETHOD GetColor(nsString& aColor); - NS_IMETHOD SetColor(const nsString& aColor); - NS_IMETHOD GetFace(nsString& aFace); - NS_IMETHOD SetFace(const nsString& aFace); - NS_IMETHOD GetSize(nsString& aSize); - NS_IMETHOD SetSize(const nsString& aSize); + NS_DECL_IDOMHTMLBASEFONTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -134,7 +129,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Size, size) NS_IMETHODIMP nsHTMLBaseFontElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -144,7 +139,7 @@ nsHTMLBaseFontElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLBodyElement.cpp b/content/html/content/src/nsHTMLBodyElement.cpp index b3471aa7d13d..07b460b34e7e 100644 --- a/content/html/content/src/nsHTMLBodyElement.cpp +++ b/content/html/content/src/nsHTMLBodyElement.cpp @@ -193,18 +193,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBodyElement - NS_IMETHOD GetALink(nsString& aALink); - NS_IMETHOD SetALink(const nsString& aALink); - NS_IMETHOD GetBackground(nsString& aBackground); - NS_IMETHOD SetBackground(const nsString& aBackground); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetLink(nsString& aLink); - NS_IMETHOD SetLink(const nsString& aLink); - NS_IMETHOD GetText(nsString& aText); - NS_IMETHOD SetText(const nsString& aText); - NS_IMETHOD GetVLink(nsString& aVLink); - NS_IMETHOD SetVLink(const nsString& aVLink); + NS_DECL_IDOMHTMLBODYELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -756,7 +745,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Text, text) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, VLink, vlink) NS_IMETHODIMP -nsHTMLBodyElement::GetBgColor(nsString& aBgColor) +nsHTMLBodyElement::GetBgColor(nsAWritableString& aBgColor) { // If we don't have an attribute, find the actual color used for // (generally from the user agent style sheet) for compatibility @@ -805,14 +794,14 @@ nsHTMLBodyElement::GetBgColor(nsString& aBgColor) } NS_IMETHODIMP -nsHTMLBodyElement::SetBgColor(const nsString& aBgColor) +nsHTMLBodyElement::SetBgColor(const nsAReadableString& aBgColor) { return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor, PR_TRUE); } NS_IMETHODIMP nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if ((aAttribute == nsHTMLAtoms::bgcolor) || @@ -836,7 +825,7 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBodyElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index 184cea0f03ea..28081d8ae86b 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -60,15 +60,15 @@ public: // nsIDOMElement // NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) - NS_IMETHOD GetTagName(nsString& aTagName) { + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { return mInner.GetTagName(aTagName); } - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn); - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue); - NS_IMETHOD RemoveAttribute(const nsString& aName) { + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn); + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue); + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { return mInner.RemoveAttribute(aName); } - NS_IMETHOD GetAttributeNode(const nsString& aName, + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNode(aName, aReturn); } @@ -78,41 +78,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return mInner.RemoveAttributeNode(aOldAttr, aReturn); } - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagName(aTagname, aReturn); } - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) { + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) { + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) { + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName); } - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return mInner.SetAttributeNodeNS(aNewAttr, aReturn); } - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { return mInner.HasAttribute(aName, aReturn); } - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) { + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } @@ -120,18 +120,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLButtonElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); + NS_DECL_IDOMHTMLBUTTONELEMENT // nsIDOMHTMLButtonElement NS_IMETHOD Blur(); @@ -215,14 +204,15 @@ nsHTMLButtonElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) } NS_IMETHODIMP -nsHTMLButtonElement::GetAttribute(const nsString& aName, nsString& aReturn) +nsHTMLButtonElement::GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { - if (aName.EqualsWithConversion("disabled", PR_TRUE)) { + nsAutoString name(aName); + if (name.EqualsWithConversion("disabled", PR_TRUE)) { nsresult rv = GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, aReturn); if (rv == NS_CONTENT_ATTR_NOT_THERE) { - aReturn.AssignWithConversion("false"); + aReturn.Assign(NS_LITERAL_STRING("false")); } else { - aReturn.AssignWithConversion("true"); + aReturn.Assign(NS_LITERAL_STRING("true")); } return NS_OK; @@ -232,10 +222,11 @@ nsHTMLButtonElement::GetAttribute(const nsString& aName, nsString& aReturn) } NS_IMETHODIMP -nsHTMLButtonElement::SetAttribute(const nsString& aName, const nsString& aValue) +nsHTMLButtonElement::SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { - if (aName.EqualsWithConversion("disabled", PR_TRUE) && - aValue.EqualsWithConversion("false", PR_TRUE)) { + nsAutoString name(aName), value(aValue); + if (name.EqualsWithConversion("disabled", PR_TRUE) && + value.EqualsWithConversion("false", PR_TRUE)) { return mInner.RemoveAttribute(aName); } @@ -285,7 +276,7 @@ nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm) return result; } NS_IMETHODIMP -nsHTMLButtonElement::GetType(nsString& aType) +nsHTMLButtonElement::GetType(nsAWritableString& aType) { return AttributeToString(nsHTMLAtoms::type, nsHTMLValue(mType, eHTMLUnit_Enumerated), @@ -387,7 +378,7 @@ static nsGenericHTMLElement::EnumTable kButtonTypeTable[] = { NS_IMETHODIMP nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::tabindex) { @@ -398,8 +389,9 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute, } else if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumTable *table = kButtonTypeTable; + nsAutoString val(aValue); while (nsnull != table->tag) { - if (aValue.EqualsIgnoreCase(table->tag)) { + if (val.EqualsIgnoreCase(table->tag)) { aResult.SetIntValue(table->value, eHTMLUnit_Enumerated); mType = table->value; return NS_CONTENT_ATTR_HAS_VALUE; @@ -417,7 +409,7 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLDListElement.cpp b/content/html/content/src/nsHTMLDListElement.cpp index a6baf2a863ec..70b7819be8fa 100644 --- a/content/html/content/src/nsHTMLDListElement.cpp +++ b/content/html/content/src/nsHTMLDListElement.cpp @@ -129,7 +129,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLDListElement, Compact, compact) NS_IMETHODIMP nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::compact) { @@ -142,7 +142,7 @@ nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDListElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLDelElement.cpp b/content/html/content/src/nsHTMLDelElement.cpp index a44dce8d4a48..d34dfb53e9e2 100644 --- a/content/html/content/src/nsHTMLDelElement.cpp +++ b/content/html/content/src/nsHTMLDelElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLModElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); - NS_IMETHOD GetDateTime(nsString& aDateTime); - NS_IMETHOD SetDateTime(const nsString& aDateTime); + NS_DECL_IDOMHTMLMODELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLDelElement, DateTime, datetime) NS_IMETHODIMP nsHTMLDelElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -141,7 +138,7 @@ nsHTMLDelElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDelElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLDirectoryElement.cpp b/content/html/content/src/nsHTMLDirectoryElement.cpp index e0c3b8d51a87..60d9b0b0fbb1 100644 --- a/content/html/content/src/nsHTMLDirectoryElement.cpp +++ b/content/html/content/src/nsHTMLDirectoryElement.cpp @@ -133,7 +133,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLDirectoryElement, Compact, compact) NS_IMETHODIMP nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -157,7 +157,7 @@ nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDirectoryElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable, aResult); diff --git a/content/html/content/src/nsHTMLDivElement.cpp b/content/html/content/src/nsHTMLDivElement.cpp index b77d8134dba4..6571b1e0f398 100644 --- a/content/html/content/src/nsHTMLDivElement.cpp +++ b/content/html/content/src/nsHTMLDivElement.cpp @@ -57,8 +57,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLDivElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLDIVELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -130,7 +129,7 @@ NS_IMPL_STRING_ATTR(nsHTMLDivElement, Align, align) NS_IMETHODIMP nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -160,7 +159,7 @@ nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDivElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLEmbedElement.cpp b/content/html/content/src/nsHTMLEmbedElement.cpp index e84693d42fc1..d280ca1f4b63 100644 --- a/content/html/content/src/nsHTMLEmbedElement.cpp +++ b/content/html/content/src/nsHTMLEmbedElement.cpp @@ -155,7 +155,7 @@ nsHTMLEmbedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLEmbedElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -173,7 +173,7 @@ nsHTMLEmbedElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLEmbedElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp index e7d07fca0f7f..ff6d850f9d2a 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -224,7 +224,7 @@ nsHTMLFieldSetElement::SetForm(nsIDOMHTMLFormElement* aForm) NS_IMETHODIMP nsHTMLFieldSetElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -233,7 +233,7 @@ nsHTMLFieldSetElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFieldSetElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLFontElement.cpp b/content/html/content/src/nsHTMLFontElement.cpp index 170e0fd2bb46..5b1bd7bab4c0 100644 --- a/content/html/content/src/nsHTMLFontElement.cpp +++ b/content/html/content/src/nsHTMLFontElement.cpp @@ -58,12 +58,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLFontElement - NS_IMETHOD GetColor(nsString& aColor); - NS_IMETHOD SetColor(const nsString& aColor); - NS_IMETHOD GetFace(nsString& aFace); - NS_IMETHOD SetFace(const nsString& aFace); - NS_IMETHOD GetSize(nsString& aSize); - NS_IMETHOD SetSize(const nsString& aSize); + NS_DECL_IDOMHTMLFONTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -138,7 +133,7 @@ NS_IMPL_STRING_ATTR(nsHTMLFontElement, Size, size) NS_IMETHODIMP nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if ((aAttribute == nsHTMLAtoms::size) || @@ -167,22 +162,25 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if ((aAttribute == nsHTMLAtoms::size) || (aAttribute == nsHTMLAtoms::pointSize) || (aAttribute == nsHTMLAtoms::fontWeight)) { aResult.Truncate(); + nsAutoString intVal; if (aValue.GetUnit() == eHTMLUnit_Enumerated) { - aResult.AppendInt(aValue.GetIntValue(), 10); + intVal.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(intVal); return NS_CONTENT_ATTR_HAS_VALUE; } else if (aValue.GetUnit() == eHTMLUnit_Integer) { PRInt32 value = aValue.GetIntValue(); if (value >= 0) { - aResult.AppendWithConversion('+'); + aResult.Append(NS_LITERAL_STRING("+")); } - aResult.AppendInt(value, 10); + intVal.AppendInt(value, 10); + aResult.Append(intVal); return NS_CONTENT_ATTR_HAS_VALUE; } return NS_CONTENT_ATTR_NOT_THERE; diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 705ea80bfa11..b8afa802a830 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -85,10 +85,7 @@ public: NS_DECL_IDOMHTMLFORMELEMENT // nsIDOMNSHTMLFormElement - NS_IMETHOD GetEncoding(nsString& aEncoding); - NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn); - NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); - + NS_DECL_IDOMNSHTMLFORMELEMENT // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -113,11 +110,11 @@ public: // nsIForm NS_IMETHOD AddElement(nsIFormControl* aElement); - NS_IMETHOD AddElementToTable(nsIFormControl* aChild, const nsString& aName); + NS_IMETHOD AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName); NS_IMETHOD GetElementAt(PRInt32 aIndex, nsIFormControl** aElement) const; NS_IMETHOD GetElementCount(PRUint32* aCount) const; NS_IMETHOD RemoveElement(nsIFormControl* aElement); - NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsString& aName); + NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsAReadableString& aName); protected: nsFormControlList* mControls; @@ -145,8 +142,8 @@ public: nsresult GetNamedObject(JSContext* aContext, jsval aID, JSObject** aObj); - nsresult AddElementToTable(nsIFormControl* aChild, const nsString& aName); - nsresult RemoveElementFromTable(nsIFormControl* aChild, const nsString& aName); + nsresult AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName); + nsresult RemoveElementFromTable(nsIFormControl* aChild, const nsAReadableString& aName); #ifdef DEBUG nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; @@ -261,13 +258,13 @@ nsHTMLFormElement::GetElements(nsIDOMHTMLCollection** aElements) } NS_IMETHODIMP -nsHTMLFormElement::GetName(nsString& aValue) +nsHTMLFormElement::GetName(nsAWritableString& aValue) { return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, aValue); } NS_IMETHODIMP -nsHTMLFormElement::SetName(const nsString& aValue) +nsHTMLFormElement::SetName(const nsAReadableString& aValue) { return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, aValue, PR_TRUE); } @@ -361,7 +358,7 @@ static nsGenericHTMLElement::EnumTable kFormEnctypeTable[] = { NS_IMETHODIMP nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::method) { @@ -380,7 +377,7 @@ nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFormElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::method) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { @@ -500,7 +497,7 @@ nsHTMLFormElement::AddElement(nsIFormControl* aChild) } NS_IMETHODIMP -nsHTMLFormElement::AddElementToTable(nsIFormControl* aChild, const nsString& aName) +nsHTMLFormElement::AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName) { return mControls->AddElementToTable(aChild, aName); } @@ -516,13 +513,13 @@ nsHTMLFormElement::RemoveElement(nsIFormControl* aChild) NS_IMETHODIMP nsHTMLFormElement::RemoveElementFromTable(nsIFormControl* aElement, - const nsString& aName) + const nsAReadableString& aName) { return mControls->RemoveElementFromTable(aElement, aName); } NS_IMETHODIMP -nsHTMLFormElement::GetEncoding(nsString& aEncoding) +nsHTMLFormElement::GetEncoding(nsAWritableString& aEncoding) { return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::enctype, aEncoding); } @@ -888,7 +885,7 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID, JSObject** aOb if (mLookupTable) { // Get the hash entry - nsString ustr; ustr.AssignWithConversion(str); + nsAutoString ustr; ustr.AssignWithConversion(str); nsStringKey key(ustr); nsCOMPtr tmp = dont_AddRef((nsISupports *)mLookupTable->Get(&key)); @@ -952,7 +949,7 @@ nsFormControlList::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* a } NS_IMETHODIMP -nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsFormControlList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -985,7 +982,7 @@ nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) } nsresult -nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsString& aName) +nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName) { nsStringKey key(aName); if (!mLookupTable) { @@ -1054,9 +1051,8 @@ nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsString& aNa nsresult nsFormControlList::RemoveElementFromTable(nsIFormControl* aChild, - const nsString& aName) + const nsAReadableString& aName) { - nsAutoString name; nsCOMPtr content = do_QueryInterface(aChild); if (mLookupTable && content) { nsStringKey key(aName); diff --git a/content/html/content/src/nsHTMLFrameElement.cpp b/content/html/content/src/nsHTMLFrameElement.cpp index cdfe3d5654f3..c472fa0c3bec 100644 --- a/content/html/content/src/nsHTMLFrameElement.cpp +++ b/content/html/content/src/nsHTMLFrameElement.cpp @@ -61,24 +61,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLFrameElement - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder); - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder); - NS_IMETHOD GetLongDesc(nsString& aLongDesc); - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight); - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight); - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth); - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetNoResize(PRBool* aNoResize); - NS_IMETHOD SetNoResize(PRBool aNoResize); - NS_IMETHOD GetScrolling(nsString& aScrolling); - NS_IMETHOD SetScrolling(const nsString& aScrolling); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); - NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); + NS_DECL_IDOMHTMLFRAMEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -206,7 +189,7 @@ nsHTMLFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument) NS_IMETHODIMP nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::bordercolor) { @@ -247,7 +230,7 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFrameElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { nsGenericHTMLElement::FrameborderValueToString(PR_FALSE, aValue, aResult); diff --git a/content/html/content/src/nsHTMLFrameSetElement.cpp b/content/html/content/src/nsHTMLFrameSetElement.cpp index 36559dd8d333..a4bba4d811a2 100644 --- a/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLFrameSetElement - NS_IMETHOD GetCols(nsString& aCols); - NS_IMETHOD SetCols(const nsString& aCols); - NS_IMETHOD GetRows(nsString& aRows); - NS_IMETHOD SetRows(const nsString& aRows); + NS_DECL_IDOMHTMLFRAMESETELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Rows, rows) NS_IMETHODIMP nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::bordercolor) { @@ -156,7 +153,7 @@ nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { // XXX need to check for correct mode diff --git a/content/html/content/src/nsHTMLHRElement.cpp b/content/html/content/src/nsHTMLHRElement.cpp index b98d9df918f4..56d07809802d 100644 --- a/content/html/content/src/nsHTMLHRElement.cpp +++ b/content/html/content/src/nsHTMLHRElement.cpp @@ -55,14 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHRElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetNoShade(PRBool* aNoShade); - NS_IMETHOD SetNoShade(PRBool aNoShade); - NS_IMETHOD GetSize(nsString& aSize); - NS_IMETHOD SetSize(const nsString& aSize); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLHRELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -170,7 +163,7 @@ static nsGenericHTMLElement::EnumTable kAlignTable[] = { NS_IMETHODIMP nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::width) { @@ -199,7 +192,7 @@ nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHRElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLHeadElement.cpp b/content/html/content/src/nsHTMLHeadElement.cpp index 63836516d5d9..9bd2350088a5 100644 --- a/content/html/content/src/nsHTMLHeadElement.cpp +++ b/content/html/content/src/nsHTMLHeadElement.cpp @@ -54,8 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHeadElement - NS_IMETHOD GetProfile(nsString& aProfile); - NS_IMETHOD SetProfile(const nsString& aProfile); + NS_DECL_IDOMHTMLHEADELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -128,7 +127,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHeadElement, Profile, profile) NS_IMETHODIMP nsHTMLHeadElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -137,7 +136,7 @@ nsHTMLHeadElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHeadElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLHeadingElement.cpp b/content/html/content/src/nsHTMLHeadingElement.cpp index 76ca3a5ce226..d13e146a6961 100644 --- a/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/content/html/content/src/nsHTMLHeadingElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHeadingElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLHEADINGELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -129,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHeadingElement, Align, align) NS_IMETHODIMP nsHTMLHeadingElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -143,7 +142,7 @@ nsHTMLHeadingElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHeadingElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLHtmlElement.cpp b/content/html/content/src/nsHTMLHtmlElement.cpp index ebdddd43de78..cdc9f3624931 100644 --- a/content/html/content/src/nsHTMLHtmlElement.cpp +++ b/content/html/content/src/nsHTMLHtmlElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHtmlElement - NS_IMETHOD GetVersion(nsString& aVersion); - NS_IMETHOD SetVersion(const nsString& aVersion); + NS_DECL_IDOMHTMLHTMLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -134,7 +133,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHtmlElement, Version, version) NS_IMETHODIMP nsHTMLHtmlElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -143,7 +142,7 @@ nsHTMLHtmlElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHtmlElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLIFrameElement.cpp b/content/html/content/src/nsHTMLIFrameElement.cpp index de8d285ff6f4..417f4a54158b 100644 --- a/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/content/html/content/src/nsHTMLIFrameElement.cpp @@ -62,28 +62,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLIFrameElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder); - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetLongDesc(nsString& aLongDesc); - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight); - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight); - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth); - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetScrolling(nsString& aScrolling); - NS_IMETHOD SetScrolling(const nsString& aScrolling); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); - NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); - NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); + NS_DECL_IDOMHTMLIFRAMEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -213,7 +192,7 @@ nsHTMLIFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument) NS_IMETHODIMP nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::marginwidth) { @@ -261,7 +240,7 @@ nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLIFrameElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { nsGenericHTMLElement::FrameborderValueToString(PR_TRUE, aValue, aResult); diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp index 75718e5afc76..7cf729fb62aa 100644 --- a/content/html/content/src/nsHTMLImageElement.cpp +++ b/content/html/content/src/nsHTMLImageElement.cpp @@ -86,37 +86,12 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLImageElement - NS_IMETHOD GetLowSrc(nsString& aLowSrc); - NS_IMETHOD SetLowSrc(const nsString& aLowSrc); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetAlt(nsString& aAlt); - NS_IMETHOD SetAlt(const nsString& aAlt); - NS_IMETHOD GetBorder(nsString& aBorder); - NS_IMETHOD SetBorder(const nsString& aBorder); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetHspace(nsString& aHspace); - NS_IMETHOD SetHspace(const nsString& aHspace); - NS_IMETHOD GetIsMap(PRBool* aIsMap); - NS_IMETHOD SetIsMap(PRBool aIsMap); - NS_IMETHOD GetLongDesc(nsString& aLongDesc); - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetUseMap(nsString& aUseMap); - NS_IMETHOD SetUseMap(const nsString& aUseMap); - NS_IMETHOD GetVspace(nsString& aVspace); - NS_IMETHOD SetVspace(const nsString& aVspace); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLIMAGEELEMENT // nsIDOMImage // XXX Casing is different for backward compatibility - NS_IMETHOD GetLowsrc(nsString& aLowsrc); - NS_IMETHOD SetLowsrc(const nsString& aLowsrc); + NS_IMETHOD GetLowsrc(nsAWritableString& aLowsrc); + NS_IMETHOD SetLowsrc(const nsAReadableString& aLowsrc); NS_IMETHOD GetComplete(PRBool* aComplete); NS_IMETHOD GetBorder(PRInt32* aBorder); NS_IMETHOD SetBorder(PRInt32 aBorder); @@ -154,7 +129,7 @@ public: // nsIJSNativeInitializer NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj, PRUint32 argc, jsval *argv); - nsresult SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc); + nsresult SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc); nsresult GetCallerSourceURL(JSContext* cx, nsIURI** sourceURL); nsresult GetImageFrame(nsImageFrame** aImageFrame); @@ -342,7 +317,7 @@ nsHTMLImageElement::GetComplete(PRBool* aComplete) } NS_IMETHODIMP -nsHTMLImageElement::GetHeight(nsString& aValue) +nsHTMLImageElement::GetHeight(nsAWritableString& aValue) { nsresult rv = mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, aValue); @@ -354,8 +329,10 @@ nsHTMLImageElement::GetHeight(nsString& aValue) // A zero height most likely means that the image is not loaded yet. if (NS_SUCCEEDED(GetHeight(&height)) && height) { - aValue.AppendInt(height); - aValue.AppendWithConversion("px"); + nsAutoString heightStr; + heightStr.AppendInt(height); + aValue.Append(heightStr); + aValue.Append(NS_LITERAL_STRING("px")); } } @@ -363,7 +340,7 @@ nsHTMLImageElement::GetHeight(nsString& aValue) } NS_IMETHODIMP -nsHTMLImageElement::SetHeight(const nsString& aValue) +nsHTMLImageElement::SetHeight(const nsAReadableString& aValue) { return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, aValue, PR_TRUE); @@ -416,7 +393,7 @@ nsHTMLImageElement::SetHeight(PRInt32 aHeight) } NS_IMETHODIMP -nsHTMLImageElement::GetWidth(nsString& aValue) +nsHTMLImageElement::GetWidth(nsAWritableString& aValue) { nsresult rv = mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, aValue); @@ -428,8 +405,10 @@ nsHTMLImageElement::GetWidth(nsString& aValue) // A zero width most likely means that the image is not loaded yet. if (NS_SUCCEEDED(GetWidth(&width)) && width) { - aValue.AppendInt(width); - aValue.AppendWithConversion("px"); + nsAutoString widthStr; + widthStr.AppendInt(width); + aValue.Append(widthStr); + aValue.Append(NS_LITERAL_STRING("px")); } } @@ -437,7 +416,7 @@ nsHTMLImageElement::GetWidth(nsString& aValue) } NS_IMETHODIMP -nsHTMLImageElement::SetWidth(const nsString& aValue) +nsHTMLImageElement::SetWidth(const nsAReadableString& aValue) { return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, aValue, PR_TRUE); @@ -491,7 +470,7 @@ nsHTMLImageElement::SetWidth(PRInt32 aWidth) NS_IMETHODIMP nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -513,7 +492,7 @@ nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLImageElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { @@ -843,7 +822,7 @@ nsHTMLImageElement::SetDocument(nsIDocument* aDocument, } NS_IMETHODIMP -nsHTMLImageElement::GetSrc(nsString& aSrc) +nsHTMLImageElement::GetSrc(nsAWritableString& aSrc) { // Resolve url to an absolute url nsresult rv = NS_OK; @@ -869,7 +848,7 @@ nsHTMLImageElement::GetSrc(nsString& aSrc) } nsresult -nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc) +nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc) { nsresult result = NS_OK; @@ -947,7 +926,7 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc) } NS_IMETHODIMP -nsHTMLImageElement::SetSrc(const nsString& aSrc) +nsHTMLImageElement::SetSrc(const nsAReadableString& aSrc) { nsIURI* baseURL = nsnull; nsresult result = NS_OK; diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index fbbf8363bffa..4a727ff6f59a 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -97,13 +97,13 @@ public: // nsIDOMElement // can't use the macro here because input type=text needs to notify up to // frame system on SetAttribute("value"); - NS_IMETHOD GetTagName(nsString& aTagName) { + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { return mInner.GetTagName(aTagName); } - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return mInner.GetAttribute(aName, aReturn); } - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { nsAutoString valueAttribute; nsHTMLAtoms::value->ToString(valueAttribute); if (PR_TRUE==valueAttribute.Equals(aName)) { @@ -112,10 +112,10 @@ public: } return mInner.SetAttribute(aName, aValue); } - NS_IMETHOD RemoveAttribute(const nsString& aName) { + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { return mInner.RemoveAttribute(aName); } - NS_IMETHOD GetAttributeNode(const nsString& aName, + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNode(aName, aReturn); } @@ -125,41 +125,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return mInner.RemoveAttributeNode(aOldAttr, aReturn); } - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagName(aTagname, aReturn); } - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) { + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) { + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) { + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName); } - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return mInner.SetAttributeNodeNS(aNewAttr, aReturn); } - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { return mInner.HasAttribute(aName, aReturn); } - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) { + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } @@ -318,13 +318,13 @@ nsHTMLInputElement::GetForm(nsIDOMHTMLFormElement** aForm) } NS_IMETHODIMP -nsHTMLInputElement::GetDefaultValue(nsString& aDefaultValue) +nsHTMLInputElement::GetDefaultValue(nsAWritableString& aDefaultValue) { return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aDefaultValue); } NS_IMETHODIMP -nsHTMLInputElement::SetDefaultValue(const nsString& aDefaultValue) +nsHTMLInputElement::SetDefaultValue(const nsAReadableString& aDefaultValue) { return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aDefaultValue, PR_TRUE); } @@ -374,7 +374,7 @@ NS_IMPL_STRING_ATTR(nsHTMLInputElement, Type, type) //NS_IMPL_STRING_ATTR(nsHTMLInputElement, Value, value) NS_IMETHODIMP -nsHTMLInputElement::GetValue(nsString& aValue) +nsHTMLInputElement::GetValue(nsAWritableString& aValue) { PRInt32 type; GetType(&type); @@ -392,8 +392,7 @@ nsHTMLInputElement::GetValue(nsString& aValue) // Obtain the value property from the presentation state. if (presState) { - nsAutoString value; - presState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue); + presState->GetStateProperty(NS_LITERAL_STRING("value"), aValue); } } @@ -405,7 +404,7 @@ nsHTMLInputElement::GetValue(nsString& aValue) NS_IMETHODIMP -nsHTMLInputElement::SetValue(const nsString& aValue) +nsHTMLInputElement::SetValue(const nsAReadableString& aValue) { PRInt32 type; GetType(&type); @@ -444,7 +443,7 @@ nsHTMLInputElement::SetValue(const nsString& aValue) // Obtain the value property from the presentation state. if (presState) { - presState->SetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue); + presState->SetStateProperty(NS_LITERAL_STRING("value"), aValue); } } return NS_OK; @@ -1026,13 +1025,14 @@ static nsGenericHTMLElement::EnumTable kInputTypeTable[] = { NS_IMETHODIMP nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumTable *table = kInputTypeTable; + nsAutoString valueStr(aValue); while (nsnull != table->tag) { - if (aValue.EqualsIgnoreCase(table->tag)) { + if (valueStr.EqualsIgnoreCase(table->tag)) { aResult.SetIntValue(table->value, eHTMLUnit_Enumerated); mType = table->value; // set the type of this input return NS_CONTENT_ATTR_HAS_VALUE; @@ -1101,7 +1101,7 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLInputElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLInsElement.cpp b/content/html/content/src/nsHTMLInsElement.cpp index 56aa6b1aac89..30d245dd6d73 100644 --- a/content/html/content/src/nsHTMLInsElement.cpp +++ b/content/html/content/src/nsHTMLInsElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLModElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); - NS_IMETHOD GetDateTime(nsString& aDateTime); - NS_IMETHOD SetDateTime(const nsString& aDateTime); + NS_DECL_IDOMHTMLMODELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLInsElement, DateTime, datetime) NS_IMETHODIMP nsHTMLInsElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -141,7 +138,7 @@ nsHTMLInsElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLInsElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLIsIndexElement.cpp b/content/html/content/src/nsHTMLIsIndexElement.cpp index ac911b53d3fe..27a9b5ccc32f 100644 --- a/content/html/content/src/nsHTMLIsIndexElement.cpp +++ b/content/html/content/src/nsHTMLIsIndexElement.cpp @@ -54,9 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLIsIndexElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetPrompt(nsString& aPrompt); - NS_IMETHOD SetPrompt(const nsString& aPrompt); + NS_DECL_IDOMHTMLISINDEXELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +135,7 @@ NS_IMPL_STRING_ATTR(nsHTMLIsIndexElement, Prompt, prompt) NS_IMETHODIMP nsHTMLIsIndexElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -147,7 +145,7 @@ nsHTMLIsIndexElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLIsIndexElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLLIElement.cpp b/content/html/content/src/nsHTMLLIElement.cpp index 6a89d5f1b237..784c9df4585e 100644 --- a/content/html/content/src/nsHTMLLIElement.cpp +++ b/content/html/content/src/nsHTMLLIElement.cpp @@ -55,10 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLIElement - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); - NS_IMETHOD GetValue(PRInt32* aValue); - NS_IMETHOD SetValue(PRInt32 aValue); + NS_DECL_IDOMHTMLLIELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -145,7 +142,7 @@ static nsGenericHTMLElement::EnumTable kListItemTypeTable[] = { NS_IMETHODIMP nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -166,7 +163,7 @@ nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLIElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { PRInt32 v = aValue.GetIntValue(); diff --git a/content/html/content/src/nsHTMLLabelElement.cpp b/content/html/content/src/nsHTMLLabelElement.cpp index 9dbd66cefb4f..29d287453eaf 100644 --- a/content/html/content/src/nsHTMLLabelElement.cpp +++ b/content/html/content/src/nsHTMLLabelElement.cpp @@ -64,31 +64,35 @@ public: // nsIDOMElement, because of the "htmlFor" attribute handling we can't // use the NS_IMPL_IDOMELEMENT_USING_GENERIC macro here... - NS_IMETHOD GetTagName(nsString& aTagName) { + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { return mInner.GetTagName(aTagName); } - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.GetAttribute(NS_ConvertASCIItoUCS2("for"), aReturn); + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.GetAttribute(NS_LITERAL_STRING("for"), aReturn); } return mInner.GetAttribute(aName, aReturn); } - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.SetAttribute(NS_ConvertASCIItoUCS2("for"), aValue); + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.SetAttribute(NS_LITERAL_STRING("for"), aValue); } return mInner.SetAttribute(aName, aValue); } - NS_IMETHOD RemoveAttribute(const nsString& aName) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.RemoveAttribute(NS_ConvertASCIItoUCS2("for")); + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.RemoveAttribute(NS_LITERAL_STRING("for")); } return mInner.RemoveAttribute(aName); } - NS_IMETHOD GetAttributeNode(const nsString& aName, + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.GetAttributeNode(NS_ConvertASCIItoUCS2("for"), aReturn); + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.GetAttributeNode(NS_LITERAL_STRING("for"), aReturn); } return mInner.GetAttributeNode(aName, aReturn); } @@ -98,41 +102,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return mInner.RemoveAttributeNode(aOldAttr, aReturn); } - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagName(aTagname, aReturn); } - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) { + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) { + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) { + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName); } - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return mInner.SetAttributeNodeNS(aNewAttr, aReturn); } - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { return HasAttribute(aName, aReturn); } - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) { + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } @@ -140,12 +144,8 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLabelElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); + NS_DECL_IDOMHTMLLABELELEMENT NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -307,14 +307,14 @@ NS_IMPL_STRING_ATTR(nsHTMLLabelElement, AccessKey, accesskey) //NS_IMPL_STRING_ATTR(nsHTMLLabelElement, HtmlFor, _for) NS_IMETHODIMP -nsHTMLLabelElement::GetHtmlFor(nsString& aValue) +nsHTMLLabelElement::GetHtmlFor(nsAWritableString& aValue) { mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_for, aValue); return NS_OK; } NS_IMETHODIMP -nsHTMLLabelElement::SetHtmlFor(const nsString& aValue) +nsHTMLLabelElement::SetHtmlFor(const nsAReadableString& aValue) { // trim leading and trailing whitespace static char whitespace[] = " \r\n\t"; @@ -325,7 +325,7 @@ nsHTMLLabelElement::SetHtmlFor(const nsString& aValue) NS_IMETHODIMP nsHTMLLabelElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -334,7 +334,7 @@ nsHTMLLabelElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLabelElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLLegendElement.cpp b/content/html/content/src/nsHTMLLegendElement.cpp index 18db6c42a796..54a181334a97 100644 --- a/content/html/content/src/nsHTMLLegendElement.cpp +++ b/content/html/content/src/nsHTMLLegendElement.cpp @@ -61,11 +61,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLegendElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLLEGENDELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -251,7 +247,7 @@ static nsGenericHTMLElement::EnumTable kAlignTable[] = { NS_IMETHODIMP nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -265,7 +261,7 @@ nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLegendElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLLinkElement.cpp b/content/html/content/src/nsHTMLLinkElement.cpp index b3f4d5f15e58..701edd03dd41 100644 --- a/content/html/content/src/nsHTMLLinkElement.cpp +++ b/content/html/content/src/nsHTMLLinkElement.cpp @@ -66,24 +66,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLinkElement - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetCharset(nsString& aCharset); - NS_IMETHOD SetCharset(const nsString& aCharset); - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetHreflang(nsString& aHreflang); - NS_IMETHOD SetHreflang(const nsString& aHreflang); - NS_IMETHOD GetMedia(nsString& aMedia); - NS_IMETHOD SetMedia(const nsString& aMedia); - NS_IMETHOD GetRel(nsString& aRel); - NS_IMETHOD SetRel(const nsString& aRel); - NS_IMETHOD GetRev(nsString& aRev); - NS_IMETHOD SetRev(const nsString& aRev); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLLINKELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -237,13 +220,13 @@ NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Target, target) NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Type, type) NS_IMETHODIMP -nsHTMLLinkElement::GetHref(nsString& aValue) +nsHTMLLinkElement::GetHref(nsAWritableString& aValue) { char *buf; nsresult rv = GetHrefCString(buf); if (NS_FAILED(rv)) return rv; if (buf) { - aValue.AssignWithConversion(buf); + aValue.Assign(NS_ConvertASCIItoUCS2(buf)); nsCRT::free(buf); } // NS_IMPL_STRING_ATTR does nothing where we have (buf == null) @@ -251,7 +234,7 @@ nsHTMLLinkElement::GetHref(nsString& aValue) } NS_IMETHODIMP -nsHTMLLinkElement::SetHref(const nsString& aValue) +nsHTMLLinkElement::SetHref(const nsAReadableString& aValue) { // Clobber our "cache", so we'll recompute it the next time // somebody asks for it. @@ -282,7 +265,7 @@ nsHTMLLinkElement::GetStyleSheet(nsIStyleSheet*& aStyleSheet) NS_IMETHODIMP nsHTMLLinkElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -291,7 +274,7 @@ nsHTMLLinkElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLinkElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLMapElement.cpp b/content/html/content/src/nsHTMLMapElement.cpp index b0159871d523..d1debf13cfcd 100644 --- a/content/html/content/src/nsHTMLMapElement.cpp +++ b/content/html/content/src/nsHTMLMapElement.cpp @@ -59,9 +59,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLMapElement - NS_IMETHOD GetAreas(nsIDOMHTMLCollection** aAreas); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); + NS_DECL_IDOMHTMLMAPELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -115,7 +113,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -125,19 +123,19 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNameSpaceID, aName, aValue, aNotify); } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNodeInfo, aValue, aNotify); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -330,7 +328,7 @@ NS_IMPL_STRING_ATTR(nsHTMLMapElement, Name, name) NS_IMETHODIMP nsHTMLMapElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -339,7 +337,7 @@ nsHTMLMapElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLMapElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLMenuElement.cpp b/content/html/content/src/nsHTMLMenuElement.cpp index 1a097bbab71d..309e41065dda 100644 --- a/content/html/content/src/nsHTMLMenuElement.cpp +++ b/content/html/content/src/nsHTMLMenuElement.cpp @@ -133,7 +133,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLMenuElement, Compact, compact) NS_IMETHODIMP nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -153,7 +153,7 @@ nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLMenuElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable, aResult); diff --git a/content/html/content/src/nsHTMLMetaElement.cpp b/content/html/content/src/nsHTMLMetaElement.cpp index 271740d70a51..cd6d887c8070 100644 --- a/content/html/content/src/nsHTMLMetaElement.cpp +++ b/content/html/content/src/nsHTMLMetaElement.cpp @@ -54,14 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLMetaElement - NS_IMETHOD GetContent(nsString& aContent); - NS_IMETHOD SetContent(const nsString& aContent); - NS_IMETHOD GetHttpEquiv(nsString& aHttpEquiv); - NS_IMETHOD SetHttpEquiv(const nsString& aHttpEquiv); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetScheme(nsString& aScheme); - NS_IMETHOD SetScheme(const nsString& aScheme); + NS_DECL_IDOMHTMLMETAELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -138,7 +131,7 @@ NS_IMPL_STRING_ATTR(nsHTMLMetaElement, Scheme, scheme) NS_IMETHODIMP nsHTMLMetaElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -147,7 +140,7 @@ nsHTMLMetaElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLMetaElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLModElement.cpp b/content/html/content/src/nsHTMLModElement.cpp index e90abbf0384d..ad82f9d20894 100644 --- a/content/html/content/src/nsHTMLModElement.cpp +++ b/content/html/content/src/nsHTMLModElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLModElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); - NS_IMETHOD GetDateTime(nsString& aDateTime); - NS_IMETHOD SetDateTime(const nsString& aDateTime); + NS_DECL_IDOMHTMLMODELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLModElement, DateTime, datetime) NS_IMETHODIMP nsHTMLModElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -141,7 +138,7 @@ nsHTMLModElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLModElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLOListElement.cpp b/content/html/content/src/nsHTMLOListElement.cpp index ad2fb2b2e134..51aa6d3b41c4 100644 --- a/content/html/content/src/nsHTMLOListElement.cpp +++ b/content/html/content/src/nsHTMLOListElement.cpp @@ -55,12 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLOListElement - NS_IMETHOD GetCompact(PRBool* aCompact); - NS_IMETHOD SetCompact(PRBool aCompact); - NS_IMETHOD GetStart(PRInt32* aStart); - NS_IMETHOD SetStart(PRInt32 aStart); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLOLISTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -158,7 +153,7 @@ nsGenericHTMLElement::EnumTable kOldListTypeTable[] = { NS_IMETHODIMP nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -182,7 +177,7 @@ nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { PRInt32 v = aValue.GetIntValue(); diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index 3cbb866ffcdc..0b508e3f9e24 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -166,7 +166,7 @@ nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument) NS_IMETHODIMP nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -184,7 +184,7 @@ nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLOptGroupElement.cpp b/content/html/content/src/nsHTMLOptGroupElement.cpp index 60fbdeb1d917..6cfeb327280f 100644 --- a/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -57,10 +57,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLOptGroupElement - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetLabel(nsString& aLabel); - NS_IMETHOD SetLabel(const nsString& aLabel); + NS_DECL_IDOMHTMLOPTGROUPELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -134,7 +131,7 @@ NS_IMPL_STRING_ATTR(nsHTMLOptGroupElement, Label, label) NS_IMETHODIMP nsHTMLOptGroupElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -144,7 +141,7 @@ nsHTMLOptGroupElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLOptGroupElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLOptionElement.cpp b/content/html/content/src/nsHTMLOptionElement.cpp index 59ad9b450086..9360333e2e84 100644 --- a/content/html/content/src/nsHTMLOptionElement.cpp +++ b/content/html/content/src/nsHTMLOptionElement.cpp @@ -305,14 +305,14 @@ nsHTMLOptionElement::SetDisabled(PRBool aDisabled) #endif NS_IMETHODIMP -nsHTMLOptionElement::GetLabel(nsString& aValue) +nsHTMLOptionElement::GetLabel(nsAWritableString& aValue) { mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::label, aValue); return NS_OK; } NS_IMETHODIMP -nsHTMLOptionElement::SetLabel(const nsString& aValue) +nsHTMLOptionElement::SetLabel(const nsAReadableString& aValue) { nsresult result = mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::label, aValue, PR_TRUE); if (NS_SUCCEEDED(result)) { @@ -398,7 +398,7 @@ nsHTMLOptionElement::GetIndex(PRInt32* aIndex) NS_IMETHODIMP nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::selected) { @@ -415,7 +415,7 @@ nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLOptionElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -466,7 +466,7 @@ nsHTMLOptionElement::HandleDOMEvent(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsHTMLOptionElement::GetText(nsString& aText) +nsHTMLOptionElement::GetText(nsAWritableString& aText) { aText.SetLength(0); PRInt32 numNodes; @@ -488,7 +488,7 @@ nsHTMLOptionElement::GetText(nsString& aText) nsAutoString compressText(aText); compressText.CompressWhitespace(PR_TRUE, PR_TRUE); if (compressText.Length() != 0) { - aText = compressText; + aText.Assign(compressText); } } NS_RELEASE(node); @@ -502,7 +502,7 @@ nsHTMLOptionElement::GetText(nsString& aText) } NS_IMETHODIMP -nsHTMLOptionElement::SetText(const nsString& aText) +nsHTMLOptionElement::SetText(const nsAReadableString& aText) { PRInt32 numNodes; PRBool usedExistingTextNode = PR_FALSE; // Do we need to create a text node? diff --git a/content/html/content/src/nsHTMLParagraphElement.cpp b/content/html/content/src/nsHTMLParagraphElement.cpp index f7852eac3e0d..5f826b9e4729 100644 --- a/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/content/html/content/src/nsHTMLParagraphElement.cpp @@ -57,8 +57,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLParagraphElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLPARAGRAPHELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -136,7 +135,7 @@ NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align) NS_IMETHODIMP nsHTMLParagraphElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -150,7 +149,7 @@ nsHTMLParagraphElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLParagraphElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLParamElement.cpp b/content/html/content/src/nsHTMLParamElement.cpp index 312b354312ca..cfe3667f99f7 100644 --- a/content/html/content/src/nsHTMLParamElement.cpp +++ b/content/html/content/src/nsHTMLParamElement.cpp @@ -54,14 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLParamElement - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); - NS_IMETHOD GetValueType(nsString& aValueType); - NS_IMETHOD SetValueType(const nsString& aValueType); + NS_DECL_IDOMHTMLPARAMELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +130,7 @@ NS_IMPL_STRING_ATTR(nsHTMLParamElement, ValueType, valuetype) NS_IMETHODIMP nsHTMLParamElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -147,7 +140,7 @@ nsHTMLParamElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLParamElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLPreElement.cpp b/content/html/content/src/nsHTMLPreElement.cpp index 2a628d7474e6..0be5ed531881 100644 --- a/content/html/content/src/nsHTMLPreElement.cpp +++ b/content/html/content/src/nsHTMLPreElement.cpp @@ -131,7 +131,7 @@ NS_IMPL_INT_ATTR(nsHTMLPreElement, Width, width) NS_IMETHODIMP nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::cols) { @@ -147,7 +147,8 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::tabstop) { - PRInt32 ec, tabstop = aValue.ToInteger(&ec); + nsAutoString val(aValue); + PRInt32 ec, tabstop = val.ToInteger(&ec); if (tabstop <= 0) { tabstop = 8; } @@ -160,7 +161,7 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLPreElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLQuoteElement.cpp b/content/html/content/src/nsHTMLQuoteElement.cpp index 01426593ee19..166cea4ea28a 100644 --- a/content/html/content/src/nsHTMLQuoteElement.cpp +++ b/content/html/content/src/nsHTMLQuoteElement.cpp @@ -54,8 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLQuoteElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); + NS_DECL_IDOMHTMLQUOTEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -128,7 +127,7 @@ NS_IMPL_STRING_ATTR(nsHTMLQuoteElement, Cite, cite) NS_IMETHODIMP nsHTMLQuoteElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -138,7 +137,7 @@ nsHTMLQuoteElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLQuoteElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLScriptElement.cpp b/content/html/content/src/nsHTMLScriptElement.cpp index 11784c27c736..8768781a8ca7 100644 --- a/content/html/content/src/nsHTMLScriptElement.cpp +++ b/content/html/content/src/nsHTMLScriptElement.cpp @@ -55,20 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLScriptElement - NS_IMETHOD GetText(nsString& aText); - NS_IMETHOD SetText(const nsString& aText); - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); - NS_IMETHOD GetEvent(nsString& aEvent); - NS_IMETHOD SetEvent(const nsString& aEvent); - NS_IMETHOD GetCharset(nsString& aCharset); - NS_IMETHOD SetCharset(const nsString& aCharset); - NS_IMETHOD GetDefer(PRBool* aDefer); - NS_IMETHOD SetDefer(PRBool aDefer); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLSCRIPTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -138,7 +125,7 @@ nsHTMLScriptElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsHTMLScriptElement::GetText(nsString& aValue) +nsHTMLScriptElement::GetText(nsAWritableString& aValue) { PRInt32 i, count = 0; nsresult rv = NS_OK; @@ -167,7 +154,7 @@ nsHTMLScriptElement::GetText(nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::SetText(const nsString& aValue) +nsHTMLScriptElement::SetText(const nsAReadableString& aValue) { nsCOMPtr content; PRInt32 i, count = 0; @@ -202,7 +189,7 @@ nsHTMLScriptElement::SetText(const nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::GetHtmlFor(nsString& aValue) +nsHTMLScriptElement::GetHtmlFor(nsAWritableString& aValue) { // XXX write me // mInner.GetAttribute(nsHTMLAtoms::charset, aValue); @@ -210,7 +197,7 @@ nsHTMLScriptElement::GetHtmlFor(nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::SetHtmlFor(const nsString& aValue) +nsHTMLScriptElement::SetHtmlFor(const nsAReadableString& aValue) { // XXX write me // return mInner.SetAttr(nsHTMLAtoms::charset, aValue); @@ -218,7 +205,7 @@ nsHTMLScriptElement::SetHtmlFor(const nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::GetEvent(nsString& aValue) +nsHTMLScriptElement::GetEvent(nsAWritableString& aValue) { // XXX write me // mInner.GetAttribute(nsHTMLAtoms::charset, aValue); @@ -226,7 +213,7 @@ nsHTMLScriptElement::GetEvent(nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::SetEvent(const nsString& aValue) +nsHTMLScriptElement::SetEvent(const nsAReadableString& aValue) { // XXX write me // return mInner.SetAttr(nsHTMLAtoms::charset, aValue); @@ -240,7 +227,7 @@ NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Type, type) NS_IMETHODIMP nsHTMLScriptElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -249,7 +236,7 @@ nsHTMLScriptElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLScriptElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index 932b7a3f8f96..0282ba3910b9 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -147,33 +147,10 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLSelectElement - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex); - NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); - NS_IMETHOD GetLength(PRUint32* aLength); - NS_IMETHOD SetLength(PRUint32 aLength); - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetOptions(nsIDOMNSHTMLOptionCollection** aOptions); - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetMultiple(PRBool* aMultiple); - NS_IMETHOD SetMultiple(PRBool aMultiple); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetSize(PRInt32* aSize); - NS_IMETHOD SetSize(PRInt32 aSize); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore); - NS_IMETHOD Remove(PRInt32 aIndex); - NS_IMETHOD Blur(); - NS_IMETHOD Focus(); + NS_DECL_IDOMHTMLSELECTELEMENT // nsIDOMNSHTMLSelectElement - NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_DECL_IDOMNSHTMLSELECTELEMENT // nsIContent //NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_NO_FOCUS_USING_GENERIC(mInner) @@ -215,7 +192,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -225,19 +202,19 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNameSpaceID, aName, aValue, aNotify); } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNodeInfo, aValue, aNotify); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -580,7 +557,7 @@ nsHTMLSelectElement::GetOptions(nsIDOMNSHTMLOptionCollection** aValue) } NS_IMETHODIMP -nsHTMLSelectElement::GetType(nsString& aType) +nsHTMLSelectElement::GetType(nsAWritableString& aType) { PRBool isMultiple; nsresult result = NS_OK; @@ -588,10 +565,10 @@ nsHTMLSelectElement::GetType(nsString& aType) result = GetMultiple(&isMultiple); if (NS_OK == result) { if (isMultiple) { - aType.AssignWithConversion("select-multiple"); + aType.Assign(NS_LITERAL_STRING("select-multiple")); } else { - aType.AssignWithConversion("select-one"); + aType.Assign(NS_LITERAL_STRING("select-one")); } } @@ -854,7 +831,7 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex) //NS_IMPL_STRING_ATTR(nsHTMLSelectElement, Value, value) NS_IMETHODIMP -nsHTMLSelectElement::GetValue(nsString& aValue) +nsHTMLSelectElement::GetValue(nsAWritableString& aValue) { nsresult result = NS_OK; PRInt32 selectedIndex; @@ -911,7 +888,7 @@ nsHTMLSelectElement::GetValue(nsString& aValue) } NS_IMETHODIMP -nsHTMLSelectElement::SetValue(const nsString& aValue) +nsHTMLSelectElement::SetValue(const nsAReadableString& aValue) { nsresult result = NS_OK; nsCOMPtr options; @@ -1013,7 +990,7 @@ nsHTMLSelectElement::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsHTMLSelectElement::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsHTMLSelectElement::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (!mOptions) { Init(); @@ -1188,7 +1165,7 @@ nsHTMLSelectElement::DoneAddingContent(PRBool aIsDone) NS_IMETHODIMP nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::disabled) { @@ -1215,7 +1192,7 @@ nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLSelectElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -1603,7 +1580,7 @@ nsHTMLOptionCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsHTMLOptionCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsHTMLOptionCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (mDirty && (nsnull != mSelect)) { GetOptions(); diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp index 3cbb866ffcdc..0b508e3f9e24 100644 --- a/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -166,7 +166,7 @@ nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument) NS_IMETHODIMP nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -184,7 +184,7 @@ nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLSpacerElement.cpp b/content/html/content/src/nsHTMLSpacerElement.cpp index 4874b5932aef..e0d264e965e0 100644 --- a/content/html/content/src/nsHTMLSpacerElement.cpp +++ b/content/html/content/src/nsHTMLSpacerElement.cpp @@ -161,7 +161,7 @@ nsHTMLSpacerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::size) { @@ -187,7 +187,7 @@ nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLSpacerElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLSpanElement.cpp b/content/html/content/src/nsHTMLSpanElement.cpp index a2ac1d60413b..d3ad7e052b79 100644 --- a/content/html/content/src/nsHTMLSpanElement.cpp +++ b/content/html/content/src/nsHTMLSpanElement.cpp @@ -114,7 +114,7 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLSpanElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -124,7 +124,7 @@ nsHTMLSpanElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLSpanElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/content/html/content/src/nsHTMLStyleElement.cpp b/content/html/content/src/nsHTMLStyleElement.cpp index ec2cf64349ed..3b2736514e5b 100644 --- a/content/html/content/src/nsHTMLStyleElement.cpp +++ b/content/html/content/src/nsHTMLStyleElement.cpp @@ -64,12 +64,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLStyleElement - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetMedia(nsString& aMedia); - NS_IMETHOD SetMedia(const nsString& aMedia); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLSTYLEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -223,7 +218,7 @@ nsHTMLStyleElement::GetStyleSheet(nsIStyleSheet*& aStyleSheet) NS_IMETHODIMP nsHTMLStyleElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -232,7 +227,7 @@ nsHTMLStyleElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLStyleElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLTableCaptionElement.cpp b/content/html/content/src/nsHTMLTableCaptionElement.cpp index d4f69a0429c5..ccb82ff87284 100644 --- a/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableCaptionElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLTABLECAPTIONELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +136,7 @@ static nsGenericHTMLElement::EnumTable kCaptionAlignTable[] = { NS_IMETHODIMP nsHTMLTableCaptionElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -151,7 +150,7 @@ nsHTMLTableCaptionElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableCaptionElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/content/html/content/src/nsHTMLTableCellElement.cpp b/content/html/content/src/nsHTMLTableCellElement.cpp index d47faea6a934..81ba1e1e1711 100644 --- a/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/content/html/content/src/nsHTMLTableCellElement.cpp @@ -70,36 +70,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableCellElement - NS_IMETHOD GetCellIndex(PRInt32* aCellIndex); - NS_IMETHOD SetCellIndex(PRInt32 aCellIndex); - NS_IMETHOD GetAbbr(nsString& aAbbr); - NS_IMETHOD SetAbbr(const nsString& aAbbr); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetAxis(nsString& aAxis); - NS_IMETHOD SetAxis(const nsString& aAxis); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetColSpan(PRInt32* aColSpan); - NS_IMETHOD SetColSpan(PRInt32 aColSpan); - NS_IMETHOD GetHeaders(nsString& aHeaders); - NS_IMETHOD SetHeaders(const nsString& aHeaders); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetNoWrap(PRBool* aNoWrap); - NS_IMETHOD SetNoWrap(PRBool aNoWrap); - NS_IMETHOD GetRowSpan(PRInt32* aRowSpan); - NS_IMETHOD SetRowSpan(PRInt32 aRowSpan); - NS_IMETHOD GetScope(nsString& aScope); - NS_IMETHOD SetScope(const nsString& aScope); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLTABLECELLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -333,7 +304,7 @@ static nsGenericHTMLElement::EnumTable kCellScopeTable[] = { NS_IMETHODIMP nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -401,7 +372,7 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableCellElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings abbr, axis, ch, headers diff --git a/content/html/content/src/nsHTMLTableColElement.cpp b/content/html/content/src/nsHTMLTableColElement.cpp index b2cd73133deb..85b02ab5dcba 100644 --- a/content/html/content/src/nsHTMLTableColElement.cpp +++ b/content/html/content/src/nsHTMLTableColElement.cpp @@ -58,18 +58,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableColElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetSpan(PRInt32* aSpan); - NS_IMETHOD SetSpan(PRInt32 aSpan); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLTABLECOLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -156,7 +145,7 @@ NS_IMPL_STRING_ATTR(nsHTMLTableColElement, Width, width) NS_IMETHODIMP nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -198,7 +187,7 @@ nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableColElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/content/html/content/src/nsHTMLTableColGroupElement.cpp b/content/html/content/src/nsHTMLTableColGroupElement.cpp index e2b69c6a3b42..74e34103d88a 100644 --- a/content/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/content/html/content/src/nsHTMLTableColGroupElement.cpp @@ -55,18 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableColElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetSpan(PRInt32* aSpan); - NS_IMETHOD SetSpan(PRInt32 aSpan); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLTABLECOLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -145,7 +134,7 @@ NS_IMPL_STRING_ATTR(nsHTMLTableColGroupElement, Width, width) NS_IMETHODIMP nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -187,7 +176,7 @@ nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableColGroupElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/content/html/content/src/nsHTMLTableElement.cpp b/content/html/content/src/nsHTMLTableElement.cpp index 904229c40347..3d481ae05609 100644 --- a/content/html/content/src/nsHTMLTableElement.cpp +++ b/content/html/content/src/nsHTMLTableElement.cpp @@ -72,40 +72,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableElement - NS_IMETHOD GetCaption(nsIDOMHTMLTableCaptionElement** aCaption); - NS_IMETHOD SetCaption(nsIDOMHTMLTableCaptionElement* aCaption); - NS_IMETHOD GetTHead(nsIDOMHTMLTableSectionElement** aTHead); - NS_IMETHOD SetTHead(nsIDOMHTMLTableSectionElement* aTHead); - NS_IMETHOD GetTFoot(nsIDOMHTMLTableSectionElement** aTFoot); - NS_IMETHOD SetTFoot(nsIDOMHTMLTableSectionElement* aTFoot); - NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); - NS_IMETHOD GetTBodies(nsIDOMHTMLCollection** aTBodies); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetBorder(nsString& aBorder); - NS_IMETHOD SetBorder(const nsString& aBorder); - NS_IMETHOD GetCellPadding(nsString& aCellPadding); - NS_IMETHOD SetCellPadding(const nsString& aCellPadding); - NS_IMETHOD GetCellSpacing(nsString& aCellSpacing); - NS_IMETHOD SetCellSpacing(const nsString& aCellSpacing); - NS_IMETHOD GetFrame(nsString& aFrame); - NS_IMETHOD SetFrame(const nsString& aFrame); - NS_IMETHOD GetRules(nsString& aRules); - NS_IMETHOD SetRules(const nsString& aRules); - NS_IMETHOD GetSummary(nsString& aSummary); - NS_IMETHOD SetSummary(const nsString& aSummary); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); - NS_IMETHOD CreateTHead(nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteTHead(); - NS_IMETHOD CreateTFoot(nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteTFoot(); - NS_IMETHOD CreateCaption(nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteCaption(); - NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteRow(PRInt32 aIndex); + NS_DECL_IDOMHTMLTABLEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -136,7 +103,7 @@ public: NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD ParentDestroyed(); @@ -299,7 +266,7 @@ TableRowsCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -TableRowsCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +TableRowsCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -868,7 +835,7 @@ static nsGenericHTMLElement::EnumTable kLayoutTable[] = { NS_IMETHODIMP nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore summary, just a string */ @@ -962,7 +929,7 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore summary, just a string */ /* ignore attributes that are of standard types diff --git a/content/html/content/src/nsHTMLTableRowElement.cpp b/content/html/content/src/nsHTMLTableRowElement.cpp index 55b95e34ecde..6ebb9747552c 100644 --- a/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/content/html/content/src/nsHTMLTableRowElement.cpp @@ -158,24 +158,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableRowElement - NS_IMETHOD GetRowIndex(PRInt32* aRowIndex); - NS_IMETHOD SetRowIndex(PRInt32 aRowIndex); - NS_IMETHOD GetSectionRowIndex(PRInt32* aSectionRowIndex); - NS_IMETHOD SetSectionRowIndex(PRInt32 aSectionRowIndex); - NS_IMETHOD GetCells(nsIDOMHTMLCollection** aCells); - NS_IMETHOD SetCells(nsIDOMHTMLCollection* aCells); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteCell(PRInt32 aIndex); + NS_DECL_IDOMHTMLTABLEROWELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -580,7 +563,7 @@ NS_IMPL_STRING_ATTR(nsHTMLTableRowElement, VAlign, valign) NS_IMETHODIMP nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -629,7 +612,7 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableRowElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/content/html/content/src/nsHTMLTableSectionElement.cpp b/content/html/content/src/nsHTMLTableSectionElement.cpp index 035f7a7e5314..8232d746f0f2 100644 --- a/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -60,17 +60,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableSectionElement - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); - NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteRow(PRInt32 aIndex); + NS_DECL_IDOMHTMLTABLESECTIONELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -216,7 +206,7 @@ nsHTMLTableSectionElement::DeleteRow(PRInt32 aValue) NS_IMETHODIMP nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -259,7 +249,7 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableSectionElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index d2635a418e2f..21eb31664edb 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -80,29 +80,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTextAreaElement - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue); - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue); - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetCols(PRInt32* aCols); - NS_IMETHOD SetCols(PRInt32 aCols); - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetReadOnly(PRBool* aReadOnly); - NS_IMETHOD SetReadOnly(PRBool aReadOnly); - NS_IMETHOD GetRows(PRInt32* aRows); - NS_IMETHOD SetRows(PRInt32 aRows); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); - NS_IMETHOD Blur(); - NS_IMETHOD Focus(); - NS_IMETHOD Select(); + NS_DECL_IDOMHTMLTEXTAREAELEMENT // nsIDOMNSHTMLTextAreaElement NS_DECL_IDOMNSHTMLTEXTAREAELEMENT @@ -364,19 +342,20 @@ NS_IMPL_INT_ATTR(nsHTMLTextAreaElement, TabIndex, tabindex) NS_IMETHODIMP -nsHTMLTextAreaElement::GetType(nsString& aType) +nsHTMLTextAreaElement::GetType(nsAWritableString& aType) { - aType.AssignWithConversion("textarea"); + aType.Assign(NS_LITERAL_STRING("textarea")); return NS_OK; } NS_IMETHODIMP -nsHTMLTextAreaElement::GetValue(nsString& aValue) +nsHTMLTextAreaElement::GetValue(nsAWritableString& aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { - formControlFrame->GetProperty(nsHTMLAtoms::value, aValue); - return NS_OK; + formControlFrame->GetProperty(nsHTMLAtoms::value, aValue); + + return NS_OK; } //XXX: Should this ASSERT instead of getting the default value here? return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue); @@ -384,7 +363,7 @@ nsHTMLTextAreaElement::GetValue(nsString& aValue) NS_IMETHODIMP -nsHTMLTextAreaElement::SetValue(const nsString& aValue) +nsHTMLTextAreaElement::SetValue(const nsAReadableString& aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { @@ -400,7 +379,7 @@ nsHTMLTextAreaElement::SetValue(const nsString& aValue) } NS_IMETHODIMP -nsHTMLTextAreaElement::GetDefaultValue(nsString& aDefaultValue) +nsHTMLTextAreaElement::GetDefaultValue(nsAWritableString& aDefaultValue) { mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::defaultvalue, aDefaultValue); @@ -409,7 +388,7 @@ nsHTMLTextAreaElement::GetDefaultValue(nsString& aDefaultValue) } NS_IMETHODIMP -nsHTMLTextAreaElement::SetDefaultValue(const nsString& aDefaultValue) +nsHTMLTextAreaElement::SetDefaultValue(const nsAReadableString& aDefaultValue) { nsAutoString defaultValue(aDefaultValue); @@ -431,7 +410,7 @@ nsHTMLTextAreaElement::SetDefaultValue(const nsString& aDefaultValue) NS_IMETHODIMP nsHTMLTextAreaElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::disabled) { @@ -463,7 +442,7 @@ nsHTMLTextAreaElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTextAreaElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/content/src/nsHTMLTitleElement.cpp b/content/html/content/src/nsHTMLTitleElement.cpp index 1ad5edd453e5..6e946a78d184 100644 --- a/content/html/content/src/nsHTMLTitleElement.cpp +++ b/content/html/content/src/nsHTMLTitleElement.cpp @@ -33,11 +33,10 @@ #include "nsIXIFConverter.h" #include "nsIDOMText.h" #include "nsIDocument.h" -#include "nsIHTMLDocument.h" +#include "nsIDOMHTMLDocument.h" static NS_DEFINE_IID(kIDOMHTMLTitleElementIID, NS_IDOMHTMLTITLEELEMENT_IID); static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); -static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); class nsHTMLTitleElement : public nsIDOMHTMLTitleElement, public nsIJSScriptObject, @@ -60,8 +59,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTitleElement - NS_IMETHOD GetText(nsString& aType); - NS_IMETHOD SetText(const nsString& aType); + NS_DECL_IDOMHTMLTITLEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -132,7 +130,7 @@ nsHTMLTitleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLTitleElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -141,7 +139,7 @@ nsHTMLTitleElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTitleElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -176,7 +174,7 @@ nsHTMLTitleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFu NS_IMETHODIMP -nsHTMLTitleElement::GetText(nsString& aTitle) +nsHTMLTitleElement::GetText(nsAWritableString& aTitle) { nsresult result = NS_OK; nsIDOMNode* child; @@ -197,7 +195,7 @@ nsHTMLTitleElement::GetText(nsString& aTitle) } NS_IMETHODIMP -nsHTMLTitleElement::SetText(const nsString& aTitle) +nsHTMLTitleElement::SetText(const nsAReadableString& aTitle) { nsresult result = NS_OK; nsIDOMNode* child; @@ -205,11 +203,9 @@ nsHTMLTitleElement::SetText(const nsString& aTitle) result = GetDocument(document); if (NS_OK == result) { - nsIHTMLDocument* htmlDoc; - result = document->QueryInterface(kIHTMLDocumentIID, (void**)&htmlDoc); - if (NS_OK == result) { + nsCOMPtr htmlDoc(do_QueryInterface(document)); + if (htmlDoc) { htmlDoc->SetTitle(aTitle); - NS_RELEASE(htmlDoc); } NS_RELEASE(document); } diff --git a/content/html/content/src/nsHTMLUListElement.cpp b/content/html/content/src/nsHTMLUListElement.cpp index 4aec9fbc0e98..6d1bf3324a9b 100644 --- a/content/html/content/src/nsHTMLUListElement.cpp +++ b/content/html/content/src/nsHTMLUListElement.cpp @@ -58,10 +58,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLUListElement - NS_IMETHOD GetCompact(PRBool* aCompact); - NS_IMETHOD SetCompact(PRBool aCompact); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLULISTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -135,7 +132,7 @@ NS_IMPL_STRING_ATTR(nsHTMLUListElement, Type, type) NS_IMETHODIMP nsHTMLUListElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -159,7 +156,7 @@ nsHTMLUListElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLUListElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { PRInt32 v = aValue.GetIntValue(); diff --git a/content/html/content/src/nsHTMLUnknownElement.cpp b/content/html/content/src/nsHTMLUnknownElement.cpp index 97205d2bf75a..ef8e0c293316 100644 --- a/content/html/content/src/nsHTMLUnknownElement.cpp +++ b/content/html/content/src/nsHTMLUnknownElement.cpp @@ -114,7 +114,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -124,15 +124,15 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, PRBool aNotify); + const nsAReadableString& aValue, PRBool aNotify); NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify); + const nsAReadableString& aValue, PRBool aNotify); NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -256,7 +256,7 @@ nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLUnknownElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -266,7 +266,7 @@ nsHTMLUnknownElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLUnknownElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); @@ -342,7 +342,7 @@ static void ReleaseAttributes(nsIHTMLAttributes*& aAttributes) NS_IMETHODIMP nsHTMLUnknownElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult result = NS_OK; @@ -449,7 +449,7 @@ nsHTMLUnknownElement::SetAttribute(PRInt32 aNameSpaceID, NS_IMETHODIMP nsHTMLUnknownElement::SetAttribute(nsINodeInfo *aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); diff --git a/content/html/content/src/nsHTMLWBRElement.cpp b/content/html/content/src/nsHTMLWBRElement.cpp index eb53b2d49908..a1492245f876 100644 --- a/content/html/content/src/nsHTMLWBRElement.cpp +++ b/content/html/content/src/nsHTMLWBRElement.cpp @@ -126,7 +126,7 @@ nsHTMLWBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLWBRElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -135,7 +135,7 @@ nsHTMLWBRElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLWBRElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index 02e52ce47f44..cb64b375bfa0 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -52,7 +52,7 @@ #include "nsIDOMText.h" #include "nsIDOMComment.h" -#include "nsIDOMDocument.h" +#include "nsIDOMHTMLDocument.h" #include "nsIDOMDOMImplementation.h" #include "nsIDOMDocumentType.h" @@ -2358,7 +2358,9 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel) } if (nsnull == mTitle) { - mHTMLDocument->SetTitle(nsString()); + nsCOMPtr domDoc(do_QueryInterface(mHTMLDocument)); + if (domDoc) + domDoc->SetTitle(nsString()); } // XXX this is silly; who cares? RickG cares. It's part of the regression test. So don't bug me. @@ -2618,7 +2620,10 @@ HTMLContentSink::SetTitle(const nsString& aValue) } ReduceEntities(*mTitle); mTitle->CompressWhitespace(PR_TRUE, PR_TRUE); - mHTMLDocument->SetTitle(*mTitle); + + nsCOMPtr domDoc(do_QueryInterface(mHTMLDocument)); + if (domDoc) + domDoc->SetTitle(*mTitle); nsCOMPtr nodeInfo; nsresult rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::title, nsnull, @@ -4178,15 +4183,15 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (NS_FAILED(rv)) return rv; PRInt32 millis = -1; - PRUnichar *uriAttrib = nsnull; - + nsAutoString uriAttrib; + PRInt32 semiColon = result.FindCharInSet(";,"); nsAutoString token; if (semiColon > -1) result.Left(token, semiColon); else token = result; - + PRBool done = PR_FALSE; while (!done && !token.IsEmpty()) { token.CompressWhitespace(); @@ -4205,7 +4210,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) break; ++iter; } - + if (tokenIsANumber) { PRInt32 err; millis = token.ToInteger(&err) * 1000; @@ -4220,7 +4225,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (loc > -1) token.Cut(0, loc+1); token.Trim(" \"'"); - uriAttrib = token.ToNewUnicode(); + uriAttrib.Assign(token); } else { // Increment to the next token. if (semiColon > -1) { @@ -4236,11 +4241,11 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) } // end while nsCOMPtr uri; - if (!uriAttrib) { + if (uriAttrib.Length() == 0) { uri = baseURI; } else { - rv = NS_NewURI(getter_AddRefs(uri), nsAutoString(uriAttrib), baseURI); - nsMemory::Free(uriAttrib); + rv = NS_NewURI(getter_AddRefs(uri), + uriAttrib, baseURI); } if (NS_SUCCEEDED(rv)) { diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 8ffce7c91da9..2724a8009b2a 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -445,9 +445,9 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) } NS_IMETHODIMP -nsHTMLDocument::GetContentType(nsString& aContentType) const +nsHTMLDocument::GetContentType(nsAWritableString& aContentType) const { - aContentType.AssignWithConversion("text/html"); + aContentType.Assign(NS_LITERAL_STRING("text/html")); return NS_OK; } @@ -972,13 +972,13 @@ nsHTMLDocument::EndLoad() return nsDocument::EndLoad(); } -NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle) +NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsAReadableString& aTitle) { if (nsnull == mDocumentTitle) { mDocumentTitle = new nsString(aTitle); } else { - *mDocumentTitle = aTitle; + mDocumentTitle->Assign(aTitle); } // Pass on to any interested containers @@ -992,7 +992,7 @@ NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle) if (container) { nsCOMPtr docShell(do_QueryInterface(container)); if(docShell) { - docShell->SetTitle(aTitle.GetUnicode()); + docShell->SetTitle(mDocumentTitle->GetUnicode()); } } } @@ -1125,7 +1125,7 @@ nsHTMLDocument::GetBaseURL(nsIURI*& aURL) const } NS_IMETHODIMP -nsHTMLDocument:: SetBaseURL(const nsString& aURLSpec) +nsHTMLDocument:: SetBaseURL(const nsAReadableString& aURLSpec) { nsresult result = NS_OK; @@ -1139,10 +1139,10 @@ nsHTMLDocument:: SetBaseURL(const nsString& aURLSpec) } NS_IMETHODIMP -nsHTMLDocument:: GetBaseTarget(nsString& aTarget) const +nsHTMLDocument:: GetBaseTarget(nsAWritableString& aTarget) const { if (nsnull != mBaseTarget) { - aTarget = *mBaseTarget; + aTarget.Assign(*mBaseTarget); } else { aTarget.Truncate(); @@ -1151,14 +1151,14 @@ nsHTMLDocument:: GetBaseTarget(nsString& aTarget) const } NS_IMETHODIMP -nsHTMLDocument:: SetBaseTarget(const nsString& aTarget) +nsHTMLDocument:: SetBaseTarget(const nsAReadableString& aTarget) { if (0 < aTarget.Length()) { if (nsnull != mBaseTarget) { *mBaseTarget = aTarget; } else { - mBaseTarget = aTarget.ToNewString(); + mBaseTarget = new nsString(aTarget); } } else { @@ -1171,14 +1171,14 @@ nsHTMLDocument:: SetBaseTarget(const nsString& aTarget) } NS_IMETHODIMP -nsHTMLDocument::SetLastModified(const nsString& aLastModified) +nsHTMLDocument::SetLastModified(const nsAReadableString& aLastModified) { if (0 < aLastModified.Length()) { if (nsnull != mLastModified) { *mLastModified = aLastModified; } else { - mLastModified = aLastModified.ToNewString(); + mLastModified = new nsString(aLastModified); } } else if (nsnull != mLastModified) { @@ -1190,14 +1190,14 @@ nsHTMLDocument::SetLastModified(const nsString& aLastModified) } NS_IMETHODIMP -nsHTMLDocument::SetReferrer(const nsString& aReferrer) +nsHTMLDocument::SetReferrer(const nsAReadableString& aReferrer) { if (0 < aReferrer.Length()) { if (nsnull != mReferrer) { *mReferrer = aReferrer; } else { - mReferrer = aReferrer.ToNewString(); + mReferrer = new nsString(aReferrer); } } else if (nsnull != mReferrer) { @@ -1255,7 +1255,8 @@ nsHTMLDocument::SetDTDMode(nsDTDMode aMode) } NS_IMETHODIMP -nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) +nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, + const nsAReadableString& aData) { nsresult result = nsMarkupDocument::SetHeaderData(aHeaderField, aData); @@ -1273,8 +1274,9 @@ nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) if (PR_FALSE == type.Equals(textHtml)) { sheet->GetTitle(title); if (0 < title.Length()) { // if sheet has title + nsAutoString data(aData); PRBool disabled = ((0 == aData.Length()) || - (PR_FALSE == aData.EqualsIgnoreCase(title))); + (PR_FALSE == title.EqualsIgnoreCase(data))); SetStyleSheetDisabledState(sheet, disabled); } } @@ -1381,9 +1383,9 @@ nsHTMLDocument::FlushPendingNotifications() } NS_IMETHODIMP -nsHTMLDocument::CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - nsIDOMElement** aReturn) +nsHTMLDocument::CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + nsIDOMElement** aReturn) { nsresult rv = NS_OK; @@ -1420,7 +1422,7 @@ nsHTMLDocument::CreateElementNS(const nsString& aNamespaceURI, // nsIDOMDocument interface implementation // NS_IMETHODIMP -nsHTMLDocument::CreateElement(const nsString& aTagName, +nsHTMLDocument::CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1443,8 +1445,8 @@ nsHTMLDocument::CreateElement(const nsString& aTagName, } NS_IMETHODIMP -nsHTMLDocument::CreateProcessingInstruction(const nsString& aTarget, - const nsString& aData, +nsHTMLDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn) { // There are no PIs for HTML @@ -1454,7 +1456,7 @@ nsHTMLDocument::CreateProcessingInstruction(const nsString& aTarget, } NS_IMETHODIMP -nsHTMLDocument::CreateCDATASection(const nsString& aData, +nsHTMLDocument::CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn) { // There are no CDATASections in HTML @@ -1464,7 +1466,7 @@ nsHTMLDocument::CreateCDATASection(const nsString& aData, } NS_IMETHODIMP -nsHTMLDocument::CreateEntityReference(const nsString& aName, +nsHTMLDocument::CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn) { // There are no EntityReferences in HTML @@ -1499,25 +1501,25 @@ nsHTMLDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) } NS_IMETHODIMP -nsHTMLDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) +nsHTMLDocument::CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn) { return nsDocument::CreateComment(aData, aReturn); } NS_IMETHODIMP -nsHTMLDocument::CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) +nsHTMLDocument::CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return nsDocument::CreateAttribute(aName, aReturn); } NS_IMETHODIMP -nsHTMLDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) +nsHTMLDocument::CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn) { return nsDocument::CreateTextNode(aData, aReturn); } NS_IMETHODIMP -nsHTMLDocument::GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn) +nsHTMLDocument::GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { nsAutoString tmp(aTagname); tmp.ToLowerCase(); // HTML elements are lower case internally. @@ -1580,19 +1582,19 @@ nsHTMLDocument::HasChildNodes(PRBool* aReturn) } NS_IMETHODIMP -nsHTMLDocument::GetNodeName(nsString& aNodeName) +nsHTMLDocument::GetNodeName(nsAWritableString& aNodeName) { return nsDocument::GetNodeName(aNodeName); } NS_IMETHODIMP -nsHTMLDocument::GetNodeValue(nsString& aNodeValue) +nsHTMLDocument::GetNodeValue(nsAWritableString& aNodeValue) { return nsDocument::GetNodeValue(aNodeValue); } NS_IMETHODIMP -nsHTMLDocument::SetNodeValue(const nsString& aNodeValue) +nsHTMLDocument::SetNodeValue(const nsAReadableString& aNodeValue) { return nsDocument::SetNodeValue(aNodeValue); } @@ -1604,25 +1606,25 @@ nsHTMLDocument::GetNodeType(PRUint16* aNodeType) } NS_IMETHODIMP -nsHTMLDocument::GetNamespaceURI(nsString& aNamespaceURI) +nsHTMLDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return nsDocument::GetNamespaceURI(aNamespaceURI); } NS_IMETHODIMP -nsHTMLDocument::GetPrefix(nsString& aPrefix) +nsHTMLDocument::GetPrefix(nsAWritableString& aPrefix) { return nsDocument::GetPrefix(aPrefix); } NS_IMETHODIMP -nsHTMLDocument::SetPrefix(const nsString& aPrefix) +nsHTMLDocument::SetPrefix(const nsAReadableString& aPrefix) { return nsDocument::SetPrefix(aPrefix); } NS_IMETHODIMP -nsHTMLDocument::GetLocalName(nsString& aLocalName) +nsHTMLDocument::GetLocalName(nsAWritableString& aLocalName) { return nsDocument::GetLocalName(aLocalName); } @@ -1670,7 +1672,7 @@ nsHTMLDocument::Normalize() } NS_IMETHODIMP -nsHTMLDocument::Supports(const nsString& aFeature, const nsString& aVersion, +nsHTMLDocument::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsDocument::Supports(aFeature, aVersion, aReturn); @@ -1684,19 +1686,21 @@ nsHTMLDocument::Supports(const nsString& aFeature, const nsString& aVersion, // for full specification. // NS_IMETHODIMP -nsHTMLDocument::GetTitle(nsString& aTitle) +nsHTMLDocument::GetTitle(nsAWritableString& aTitle) { if (nsnull != mDocumentTitle) { - aTitle=*mDocumentTitle; + aTitle.Assign(*mDocumentTitle); + } else { + aTitle.Truncate(); } return NS_OK; } NS_IMETHODIMP -nsHTMLDocument::GetReferrer(nsString& aReferrer) +nsHTMLDocument::GetReferrer(nsAWritableString& aReferrer) { if (nsnull != mReferrer) { - aReferrer = *mReferrer; + aReferrer.Assign(*mReferrer); } else { aReferrer.Truncate(); @@ -1719,7 +1723,7 @@ nsHTMLDocument::GetDomainURI(nsIURI **uri) NS_IMETHODIMP -nsHTMLDocument::GetDomain(nsString& aDomain) +nsHTMLDocument::GetDomain(nsAWritableString& aDomain) { nsCOMPtr uri; if (NS_FAILED(GetDomainURI(getter_AddRefs(uri)))) @@ -1728,14 +1732,14 @@ nsHTMLDocument::GetDomain(nsString& aDomain) char *hostName; if (NS_FAILED(uri->GetHost(&hostName))) return NS_ERROR_FAILURE; - aDomain.AssignWithConversion(hostName); + aDomain.Assign(NS_ConvertASCIItoUCS2(hostName)); nsCRT::free(hostName); return NS_OK; } NS_IMETHODIMP -nsHTMLDocument::SetDomain(const nsString& aDomain) +nsHTMLDocument::SetDomain(const nsAReadableString& aDomain) { // Check new domain @@ -1749,7 +1753,8 @@ nsHTMLDocument::SetDomain(const nsString& aDomain) nsAutoString suffix; current.Right(suffix, aDomain.Length()); PRUnichar c = current.CharAt(current.Length() - aDomain.Length() - 1); - if (aDomain.EqualsIgnoreCase(suffix) && (c == '.' || c == '/')) + if (suffix.EqualsIgnoreCase((const PRUnichar*)nsPromiseFlatString(aDomain)) && + (c == '.' || c == '/')) ok = PR_TRUE; } if (!ok) { @@ -1793,12 +1798,12 @@ nsHTMLDocument::SetDomain(const nsString& aDomain) } NS_IMETHODIMP -nsHTMLDocument::GetURL(nsString& aURL) +nsHTMLDocument::GetURL(nsAWritableString& aURL) { if (nsnull != mDocumentURL) { char* str; mDocumentURL->GetSpec(&str); - aURL.AssignWithConversion(str); + aURL.Assign(NS_ConvertASCIItoUCS2(str)); nsCRT::free(str); } return NS_OK; @@ -1960,23 +1965,25 @@ nsHTMLDocument::GetAnchors(nsIDOMHTMLCollection** aAnchors) } NS_IMETHODIMP -nsHTMLDocument::GetCookie(nsString& aCookie) +nsHTMLDocument::GetCookie(nsAWritableString& aCookie) { nsresult result = NS_OK; + nsAutoString str; NS_WITH_SERVICE(nsICookieService, service, kCookieServiceCID, &result); if ((NS_OK == result) && (nsnull != service) && (nsnull != mDocumentURL)) { - result = service->GetCookieString(mDocumentURL, aCookie); + result = service->GetCookieString(mDocumentURL, str); } + aCookie.Assign(str); return result; } NS_IMETHODIMP -nsHTMLDocument::SetCookie(const nsString& aCookie) +nsHTMLDocument::SetCookie(const nsAReadableString& aCookie) { nsresult result = NS_OK; NS_WITH_SERVICE(nsICookieService, service, kCookieServiceCID, &result); if ((NS_OK == result) && (nsnull != service) && (nsnull != mDocumentURL)) { - result = service->SetCookieString(mDocumentURL, aCookie); + result = service->SetCookieString(mDocumentURL, nsAutoString(aCookie)); } return result; } @@ -2166,7 +2173,7 @@ nsHTMLDocument::Close() } nsresult -nsHTMLDocument::WriteCommon(const nsString& aText, +nsHTMLDocument::WriteCommon(const nsAReadableString& aText, PRBool aNewlineTerminate) { nsresult result = NS_OK; @@ -2197,13 +2204,13 @@ nsHTMLDocument::WriteCommon(const nsString& aText, } NS_IMETHODIMP -nsHTMLDocument::Write(const nsString& aText) +nsHTMLDocument::Write(const nsAReadableString& aText) { return WriteCommon(aText, PR_FALSE); } NS_IMETHODIMP -nsHTMLDocument::Writeln(const nsString& aText) +nsHTMLDocument::Writeln(const nsAReadableString& aText) { return WriteCommon(aText, PR_TRUE); } @@ -2304,7 +2311,7 @@ nsHTMLDocument::Writeln(JSContext *cx, jsval *argv, PRUint32 argc) } nsIContent * -nsHTMLDocument::MatchName(nsIContent *aContent, const nsString& aName) +nsHTMLDocument::MatchName(nsIContent *aContent, const nsAReadableString& aName) { nsAutoString value; nsIContent *result = nsnull; @@ -2331,7 +2338,7 @@ nsHTMLDocument::MatchName(nsIContent *aContent, const nsString& aName) } NS_IMETHODIMP -nsHTMLDocument::GetElementById(const nsString& aElementId, nsIDOMElement** aReturn) +nsHTMLDocument::GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; @@ -2361,8 +2368,8 @@ nsHTMLDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsHTMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsHTMLDocument::CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -2370,8 +2377,8 @@ nsHTMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsHTMLDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsHTMLDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsAutoString tmp(aLocalName); @@ -2398,12 +2405,14 @@ nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, nsString* aData) } NS_IMETHODIMP -nsHTMLDocument::GetElementsByName(const nsString& aElementName, +nsHTMLDocument::GetElementsByName(const nsAReadableString& aElementName, nsIDOMNodeList** aReturn) { + nsAutoString name(aElementName); + nsContentList* elements = new nsContentList(this, MatchNameAttribute, - &aElementName); + &name); if (nsnull == elements) { return NS_ERROR_OUT_OF_MEMORY; } @@ -2523,7 +2532,7 @@ nsHTMLDocument::GetHeight(PRInt32* aHeight) } NS_IMETHODIMP -nsHTMLDocument::GetAlinkColor(nsString& aAlinkColor) +nsHTMLDocument::GetAlinkColor(nsAWritableString& aAlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2547,7 +2556,7 @@ nsHTMLDocument::GetAlinkColor(nsString& aAlinkColor) } NS_IMETHODIMP -nsHTMLDocument::SetAlinkColor(const nsString& aAlinkColor) +nsHTMLDocument::SetAlinkColor(const nsAReadableString& aAlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2569,7 +2578,7 @@ nsHTMLDocument::SetAlinkColor(const nsString& aAlinkColor) } NS_IMETHODIMP -nsHTMLDocument::GetLinkColor(nsString& aLinkColor) +nsHTMLDocument::GetLinkColor(nsAWritableString& aLinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2593,7 +2602,7 @@ nsHTMLDocument::GetLinkColor(nsString& aLinkColor) } NS_IMETHODIMP -nsHTMLDocument::SetLinkColor(const nsString& aLinkColor) +nsHTMLDocument::SetLinkColor(const nsAReadableString& aLinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2614,7 +2623,7 @@ nsHTMLDocument::SetLinkColor(const nsString& aLinkColor) } NS_IMETHODIMP -nsHTMLDocument::GetVlinkColor(nsString& aVlinkColor) +nsHTMLDocument::GetVlinkColor(nsAWritableString& aVlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2638,7 +2647,7 @@ nsHTMLDocument::GetVlinkColor(nsString& aVlinkColor) } NS_IMETHODIMP -nsHTMLDocument::SetVlinkColor(const nsString& aVlinkColor) +nsHTMLDocument::SetVlinkColor(const nsAReadableString& aVlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2659,7 +2668,7 @@ nsHTMLDocument::SetVlinkColor(const nsString& aVlinkColor) } NS_IMETHODIMP -nsHTMLDocument::GetBgColor(nsString& aBgColor) +nsHTMLDocument::GetBgColor(nsAWritableString& aBgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2683,7 +2692,7 @@ nsHTMLDocument::GetBgColor(nsString& aBgColor) } NS_IMETHODIMP -nsHTMLDocument::SetBgColor(const nsString& aBgColor) +nsHTMLDocument::SetBgColor(const nsAReadableString& aBgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2704,7 +2713,7 @@ nsHTMLDocument::SetBgColor(const nsString& aBgColor) } NS_IMETHODIMP -nsHTMLDocument::GetFgColor(nsString& aFgColor) +nsHTMLDocument::GetFgColor(nsAWritableString& aFgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2728,7 +2737,7 @@ nsHTMLDocument::GetFgColor(nsString& aFgColor) } NS_IMETHODIMP -nsHTMLDocument::SetFgColor(const nsString& aFgColor) +nsHTMLDocument::SetFgColor(const nsAReadableString& aFgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2750,13 +2759,13 @@ nsHTMLDocument::SetFgColor(const nsString& aFgColor) } NS_IMETHODIMP -nsHTMLDocument::GetLastModified(nsString& aLastModified) +nsHTMLDocument::GetLastModified(nsAWritableString& aLastModified) { if (nsnull != mLastModified) { - aLastModified = *mLastModified; + aLastModified.Assign(*mLastModified); } else { - aLastModified.AssignWithConversion("January 1, 1970 GMT"); + aLastModified.Assign(NS_LITERAL_STRING("January 1, 1970 GMT")); } return NS_OK; @@ -2818,7 +2827,7 @@ nsHTMLDocument::GetLayers(nsIDOMHTMLCollection** aLayers) #endif NS_IMETHODIMP -nsHTMLDocument::GetSelection(nsString& aReturn) +nsHTMLDocument::GetSelection(nsAWritableString& aReturn) { aReturn.Truncate(); @@ -2845,7 +2854,7 @@ nsHTMLDocument::GetSelection(nsString& aReturn) (do_GetService("mozilla.consoleservice.1")); if (consoleService) { - consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Deprecated method document.getSelection() called. Please use window.getSelection() instead.").GetUnicode()); + consoleService->LogStringMessage(NS_LITERAL_STRING("Deprecated method document.getSelection() called. Please use window.getSelection() instead.")); } return domSelection->ToString(NS_ConvertASCIItoUCS2("text/plain"), nsIDocumentEncoder::OutputFormatted |nsIDocumentEncoder::OutputSelectionOnly, 0, aReturn); @@ -3785,7 +3794,9 @@ static nsIDOMNode * FindDOMNode(nsIDOMNode * aNode, nsIContent * aContent) /** * Finds text in content */ -NS_IMETHODIMP nsHTMLDocument::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) +NS_IMETHODIMP nsHTMLDocument::FindNext(const nsAReadableString &aSearchStr, + PRBool aMatchCase, PRBool aSearchDown, + PRBool &aIsFound) { #if 0 aIsFound = PR_FALSE; diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index fc70f99571a0..dd7fc1d2fd6f 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -61,7 +61,7 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; NS_IMETHOD CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, @@ -91,17 +91,18 @@ public: NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader); NS_IMETHOD GetBaseURL(nsIURI*& aURL) const; - NS_IMETHOD SetBaseURL(const nsString& aURLSpec); - NS_IMETHOD GetBaseTarget(nsString& aTarget) const; - NS_IMETHOD SetBaseTarget(const nsString& aTarget); + NS_IMETHOD SetBaseURL(const nsAReadableString& aURLSpec); + NS_IMETHOD GetBaseTarget(nsAWritableString& aTarget) const; + NS_IMETHOD SetBaseTarget(const nsAReadableString& aTarget); - NS_IMETHOD SetLastModified(const nsString& aLastModified); - NS_IMETHOD SetReferrer(const nsString& aReferrer); + NS_IMETHOD SetLastModified(const nsAReadableString& aLastModified); + NS_IMETHOD SetReferrer(const nsAReadableString& aReferrer); NS_IMETHOD GetDTDMode(nsDTDMode& aMode); NS_IMETHOD SetDTDMode(nsDTDMode aMode); - NS_IMETHOD SetHeaderData(nsIAtom* aHeaderField, const nsString& aData); + NS_IMETHOD SetHeaderData(nsIAtom* aHeaderField, + const nsAReadableString& aData); NS_IMETHOD ContentAppended(nsIContent* aContainer, PRInt32 aNewIndexInContainer); @@ -138,7 +139,8 @@ public: /** * Finds text in content */ - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, + PRBool aSearchDown, PRBool &aIsFound); /* * Like nsDocument::IsInSelection except it always includes the body node @@ -196,7 +198,7 @@ protected: PRBool aInForm); void DeleteNamedItems(); - nsIContent *MatchName(nsIContent *aContent, const nsString& aName); + nsIContent *MatchName(nsIContent *aContent, const nsAReadableString& aName); virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex); @@ -212,7 +214,7 @@ protected: NS_IMETHOD GetDomainURI(nsIURI **uri); - nsresult WriteCommon(const nsString& aText, + nsresult WriteCommon(const nsAReadableString& aText, PRBool aNewlineTerminate); nsresult ScriptWriteCommon(JSContext *cx, jsval *argv, diff --git a/content/html/document/src/nsIHTMLDocument.h b/content/html/document/src/nsIHTMLDocument.h index 659789172bb8..800cd28792f1 100644 --- a/content/html/document/src/nsIHTMLDocument.h +++ b/content/html/document/src/nsIHTMLDocument.h @@ -46,8 +46,6 @@ class nsIHTMLDocument : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IHTMLDOCUMENT_IID; return iid; } - NS_IMETHOD SetTitle(const nsString& aTitle) = 0; - NS_IMETHOD AddImageMap(nsIDOMHTMLMapElement* aMap) = 0; NS_IMETHOD GetImageMap(const nsString& aMapName, @@ -59,13 +57,13 @@ public: NS_IMETHOD GetForms(nsIDOMHTMLCollection** aForms) = 0; - NS_IMETHOD SetBaseURL(const nsString& aURLSpec) = 0; + NS_IMETHOD SetBaseURL(const nsAReadableString& aURLSpec) = 0; - NS_IMETHOD GetBaseTarget(nsString& aTarget) const = 0; - NS_IMETHOD SetBaseTarget(const nsString& aTarget) = 0; + NS_IMETHOD GetBaseTarget(nsAWritableString& aTarget) const = 0; + NS_IMETHOD SetBaseTarget(const nsAReadableString& aTarget) = 0; - NS_IMETHOD SetLastModified(const nsString& aLastModified) = 0; - NS_IMETHOD SetReferrer(const nsString& aReferrer) = 0; + NS_IMETHOD SetLastModified(const nsAReadableString& aLastModified) = 0; + NS_IMETHOD SetReferrer(const nsAReadableString& aReferrer) = 0; /** * Access DTD compatibility mode for this document diff --git a/content/html/style/public/nsICSSParser.h b/content/html/style/public/nsICSSParser.h index 349cb71529ba..e7ff6cc15418 100644 --- a/content/html/style/public/nsICSSParser.h +++ b/content/html/style/public/nsICSSParser.h @@ -24,11 +24,11 @@ #include "nslayout.h" #include "nsISupports.h" +#include "nsAWritableString.h" class nsIStyleRule; class nsICSSStyleSheet; class nsIUnicharInputStream; class nsIURI; -class nsString; class nsICSSDeclaration; class nsICSSLoader; @@ -65,26 +65,26 @@ public: // Parse declarations assuming that the outer curly braces have // already been accounted for. aBaseURL is the base url to use for // relative links in the declaration. - NS_IMETHOD ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult) = 0; + NS_IMETHOD ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult) = 0; - NS_IMETHOD ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint) = 0; + NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint) = 0; // Charset management method: // Set the charset before calling any of the Parse emthods if you want the // charset to be anything other than the default // sets the out-param to the current charset, as set by SetCharset - NS_IMETHOD GetCharset(/*out*/nsString &aCharsetDest) const = 0; + NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const = 0; // SetCharset expects the charset to be the preferred charset // and it just records the string exactly as passed in (no alias resolution) - NS_IMETHOD SetCharset(/*in*/ const nsString &aCharsetSrc) = 0; + NS_IMETHOD SetCharset(/*in*/ const nsAReadableString &aCharsetSrc) = 0; }; // Values or'd in the GetInfoMask; other bits are reserved diff --git a/content/html/style/public/nsIComputedDOMStyle.h b/content/html/style/public/nsIComputedDOMStyle.h index 206a1b149018..9ee1025e1aa4 100644 --- a/content/html/style/public/nsIComputedDOMStyle.h +++ b/content/html/style/public/nsIComputedDOMStyle.h @@ -37,7 +37,7 @@ class nsIComputedDOMStyle : public nsIDOMCSSStyleDeclaration public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMPUTEDDOMSTYLE_IID) - NS_IMETHOD Init(nsIDOMElement *aElement, const nsString& aPseudoElt, + NS_IMETHOD Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell) = 0; }; diff --git a/content/html/style/src/nsCSSDeclaration.cpp b/content/html/style/src/nsCSSDeclaration.cpp index 39f7adef9f7e..395e93399870 100644 --- a/content/html/style/src/nsCSSDeclaration.cpp +++ b/content/html/style/src/nsCSSDeclaration.cpp @@ -995,21 +995,21 @@ public: NS_IMETHOD AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue); NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct); NS_IMETHOD SetValueImportant(nsCSSProperty aProperty); - NS_IMETHOD AppendComment(const nsString& aComment); + NS_IMETHOD AppendComment(const nsAReadableString& aComment); NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue); NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue); - NS_IMETHOD GetValue(nsCSSProperty aProperty, nsString& aValue); - NS_IMETHOD GetValue(const nsString& aProperty, nsString& aValue); + NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue); + NS_IMETHOD GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue); NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult); NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, PRBool& aIsImportant); - NS_IMETHOD GetValueIsImportant(const nsString& aProperty, PRBool& aIsImportant); + NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant); - PRBool AppendValueToString(nsCSSProperty aProperty, nsString& aResult); - PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult); - NS_IMETHOD ToString(nsString& aString); + NS_IMETHOD ToString(nsAWritableString& aString); NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const; @@ -1018,7 +1018,7 @@ public: virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize); NS_IMETHOD Count(PRUint32* aCount); - NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn); NS_IMETHOD GetStyleImpact(PRInt32* aHint) const; @@ -3313,7 +3313,7 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) } NS_IMETHODIMP -CSSDeclarationImpl::AppendComment(const nsString& aComment) +CSSDeclarationImpl::AppendComment(const nsAReadableString& aComment) { nsresult result = NS_ERROR_OUT_OF_MEMORY; @@ -3913,20 +3913,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(const nsString& aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(const nsAReadableString& aProperty, + nsAWritableString& aValue) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); return GetValue(propID, aValue); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult) { nsCSSValue value; GetValue(aProperty, value); return AppendValueToString(aProperty, value, aResult); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult) { nsCSSUnit unit = aValue.GetUnit(); @@ -3936,10 +3937,14 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aResult.Append(NS_LITERAL_STRING("url(")); + break; + case eCSSUnit_Attr: aResult.Append(NS_LITERAL_STRING("attr(")); + break; + case eCSSUnit_Counter: aResult.Append(NS_LITERAL_STRING("counter(")); + break; + case eCSSUnit_Counters: aResult.Append(NS_LITERAL_STRING("counters(")); + break; default: break; } nsAutoString buffer; @@ -3952,17 +3957,23 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns case eCSSProperty_background_color: { // we can lookup the property in the ColorTable and then // get a string mapping the name - nsCString str; + nsAutoString tmpStr; + nsCAutoString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.AppendWithConversion(str); + aResult.Append(NS_ConvertASCIItoUCS2(str)); } else { - aResult.AppendInt(aValue.GetIntValue(), 10); + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); } } break; default: - aResult.AppendInt(aValue.GetIntValue(), 10); + { + nsAutoString tmpStr; + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); + } } } else if (eCSSUnit_Enumerated == unit) { @@ -3974,119 +3985,136 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, mask))); intValue &= ~mask; if (0 != intValue) { // more left - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } } } } else { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE))); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND)))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.AppendWithConversion(' '); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.Append(PRUnichar(' ')); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND))); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX))); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT))); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP))); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER))); } } else { const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.AppendWithConversion(name); + aResult.Append(NS_ConvertASCIItoUCS2(name)); } } else if (eCSSUnit_Color == unit){ + nsAutoString tmpStr; nscolor color = aValue.GetColorValue(); - aResult.AppendWithConversion("rgb("); - aResult.AppendInt(NS_GET_R(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_G(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_B(color), 10); - aResult.AppendWithConversion(')'); + + aResult.Append(NS_LITERAL_STRING("rgb(")); + + tmpStr.AppendInt(NS_GET_R(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_G(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_B(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == unit) { - aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetPercentValue() * 100.0f); + aResult.Append(tmpStr); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.AppendFloat(aValue.GetFloatValue()); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetFloatValue()); + aResult.Append(tmpStr); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aResult.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aResult.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aResult.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aResult.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aResult.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; + case eCSSUnit_Counters: aResult.Append(PRUnichar(')')); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; + case eCSSUnit_Percent: aResult.Append(PRUnichar('%')); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; - case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; + case eCSSUnit_Inch: aResult.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aResult.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aResult.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aResult.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aResult.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aResult.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aResult.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aResult.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aResult.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aResult.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aResult.Append(NS_LITERAL_STRING("cc")); break; - case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; - case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; + case eCSSUnit_EM: aResult.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aResult.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aResult.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aResult.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aResult.Append(NS_LITERAL_STRING("ch")); break; - case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; + case eCSSUnit_Pixel: aResult.Append(NS_LITERAL_STRING("px")); break; - case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; + case eCSSUnit_Degree: aResult.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aResult.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aResult.Append(NS_LITERAL_STRING("rad")); break; - case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; + case eCSSUnit_Hertz: aResult.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aResult.Append(NS_LITERAL_STRING("kHz")); break; - case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; + case eCSSUnit_Seconds: aResult.Append(PRUnichar('s')); break; + case eCSSUnit_Milliseconds: aResult.Append(NS_LITERAL_STRING("ms")); break; } return PR_TRUE; @@ -4102,7 +4130,8 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns (eCSSUnit_Null != strct->rect->mLeft.GetUnit())) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, + nsAWritableString& aValue) { PRBool isImportant = PR_FALSE; GetValueIsImportant(aProperty, isImportant); @@ -4115,41 +4144,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(PRUnichar(' ')); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.AppendWithConversion("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); + aValue.Append(NS_LITERAL_STRING("rect(")); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.AppendWithConversion(")"); + aValue.Append(PRUnichar(')')); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -4160,62 +4189,62 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.AppendWithConversion('/'); + aValue.Append(PRUnichar('/')); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_pause_before, aValue); } break; case eCSSProperty_size: if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { AppendValueToString(eCSSProperty_size_width, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_size_height, aValue); } break; @@ -4224,13 +4253,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(PRUnichar(' ')); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(PRUnichar(' ')); shadow = shadow->mNext; } } @@ -4242,67 +4271,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -4313,7 +4342,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != content); } @@ -4324,13 +4353,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4341,13 +4370,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4356,7 +4385,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -4366,11 +4395,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != quotes); } @@ -4382,7 +4411,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != keyEquiv); } @@ -4408,7 +4437,7 @@ CSSDeclarationImpl::GetImportantValues(nsICSSDeclaration*& aResult) } NS_IMETHODIMP -CSSDeclarationImpl::GetValueIsImportant(const nsString& aProperty, +CSSDeclarationImpl::GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); @@ -4438,7 +4467,7 @@ CSSDeclarationImpl::GetValueIsImportant(nsCSSProperty aProperty, } NS_IMETHODIMP -CSSDeclarationImpl::ToString(nsString& aString) +CSSDeclarationImpl::ToString(nsAWritableString& aString) { if (nsnull != mOrder) { PRInt32 count = mOrder->Count(); @@ -4446,21 +4475,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); - aString.AppendWithConversion(": "); + aString.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); + aString.Append(NS_LITERAL_STRING(": ")); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.AppendWithConversion("; "); + aString.Append(NS_LITERAL_STRING("; ")); } } else { // is comment - aString.AppendWithConversion("/* "); + aString.Append(NS_LITERAL_STRING("/* ")); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.AppendWithConversion(" */ "); + aString.Append(NS_LITERAL_STRING(" */ ")); } } } @@ -4607,13 +4636,13 @@ CSSDeclarationImpl::Count(PRUint32* aCount) } NS_IMETHODIMP -CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) +CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) { - aReturn.SetLength(0); + aReturn.Truncate(); if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aReturn.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); } } diff --git a/content/html/style/src/nsCSSParser.cpp b/content/html/style/src/nsCSSParser.cpp index d8c4e957cf1c..4d5936ae3167 100644 --- a/content/html/style/src/nsCSSParser.cpp +++ b/content/html/style/src/nsCSSParser.cpp @@ -142,19 +142,19 @@ public: nsIURI* aInputURL, nsICSSStyleSheet*& aResult); - NS_IMETHOD ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult); + NS_IMETHOD ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult); - NS_IMETHOD ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint); + NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint); - NS_IMETHOD GetCharset(/*out*/nsString &aCharsetDest) const; + NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const; // sets the out-param to the current charset, as set by SetCharset - NS_IMETHOD SetCharset(/*in*/ const nsString &aCharsetSrc); + NS_IMETHOD SetCharset(/*in*/ const nsAReadableString &aCharsetSrc); // NOTE: SetCharset expects the charset to be the preferred charset // and it just records the string exactly as passed in (no alias resolution) @@ -517,9 +517,9 @@ CSSParserImpl::Parse(nsIUnicharInputStream* aInput, } NS_IMETHODIMP -CSSParserImpl::ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult) +CSSParserImpl::ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult) { NS_ASSERTION(nsnull != aBaseURL, "need base URL"); @@ -562,11 +562,11 @@ CSSParserImpl::ParseDeclarations(const nsString& aDeclaration, } NS_IMETHODIMP -CSSParserImpl::ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint) +CSSParserImpl::ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint) { // NS_ASSERTION(nsnull != aBaseURL, "need base URL"); @@ -4354,13 +4354,13 @@ PRBool CSSParserImpl::ParseTextShadow(PRInt32& aErrorCode, return PR_FALSE; } -NS_IMETHODIMP CSSParserImpl::GetCharset(/*out*/nsString &aCharsetDest) const +NS_IMETHODIMP CSSParserImpl::GetCharset(/*out*/nsAWritableString &aCharsetDest) const { aCharsetDest = mCharset; return NS_OK; } -NS_IMETHODIMP CSSParserImpl::SetCharset(/*in*/ const nsString &aCharsetSrc) +NS_IMETHODIMP CSSParserImpl::SetCharset(/*in*/ const nsAReadableString &aCharsetSrc) { mCharset = aCharsetSrc; return NS_OK; diff --git a/content/html/style/src/nsCSSProps.h b/content/html/style/src/nsCSSProps.h index 316d3506d38b..4456b7bb82f5 100644 --- a/content/html/style/src/nsCSSProps.h +++ b/content/html/style/src/nsCSSProps.h @@ -23,9 +23,7 @@ #define nsCSSProps_h___ #include "nslayout.h" - -class nsCString; -class nsString; +#include "nsString.h" /* Declare the enum list using the magic of preprocessing @@ -49,7 +47,7 @@ public: static void ReleaseTable(void); // Given a property string, return the enum value - static nsCSSProperty LookupProperty(const nsString& aProperty); + static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); static nsCSSProperty LookupProperty(const nsCString& aProperty); // Given a property enum, get the string value diff --git a/content/html/style/src/nsCSSStruct.cpp b/content/html/style/src/nsCSSStruct.cpp index 39f7adef9f7e..395e93399870 100644 --- a/content/html/style/src/nsCSSStruct.cpp +++ b/content/html/style/src/nsCSSStruct.cpp @@ -995,21 +995,21 @@ public: NS_IMETHOD AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue); NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct); NS_IMETHOD SetValueImportant(nsCSSProperty aProperty); - NS_IMETHOD AppendComment(const nsString& aComment); + NS_IMETHOD AppendComment(const nsAReadableString& aComment); NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue); NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue); - NS_IMETHOD GetValue(nsCSSProperty aProperty, nsString& aValue); - NS_IMETHOD GetValue(const nsString& aProperty, nsString& aValue); + NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue); + NS_IMETHOD GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue); NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult); NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, PRBool& aIsImportant); - NS_IMETHOD GetValueIsImportant(const nsString& aProperty, PRBool& aIsImportant); + NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant); - PRBool AppendValueToString(nsCSSProperty aProperty, nsString& aResult); - PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult); - NS_IMETHOD ToString(nsString& aString); + NS_IMETHOD ToString(nsAWritableString& aString); NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const; @@ -1018,7 +1018,7 @@ public: virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize); NS_IMETHOD Count(PRUint32* aCount); - NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn); NS_IMETHOD GetStyleImpact(PRInt32* aHint) const; @@ -3313,7 +3313,7 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) } NS_IMETHODIMP -CSSDeclarationImpl::AppendComment(const nsString& aComment) +CSSDeclarationImpl::AppendComment(const nsAReadableString& aComment) { nsresult result = NS_ERROR_OUT_OF_MEMORY; @@ -3913,20 +3913,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(const nsString& aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(const nsAReadableString& aProperty, + nsAWritableString& aValue) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); return GetValue(propID, aValue); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult) { nsCSSValue value; GetValue(aProperty, value); return AppendValueToString(aProperty, value, aResult); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult) { nsCSSUnit unit = aValue.GetUnit(); @@ -3936,10 +3937,14 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aResult.Append(NS_LITERAL_STRING("url(")); + break; + case eCSSUnit_Attr: aResult.Append(NS_LITERAL_STRING("attr(")); + break; + case eCSSUnit_Counter: aResult.Append(NS_LITERAL_STRING("counter(")); + break; + case eCSSUnit_Counters: aResult.Append(NS_LITERAL_STRING("counters(")); + break; default: break; } nsAutoString buffer; @@ -3952,17 +3957,23 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns case eCSSProperty_background_color: { // we can lookup the property in the ColorTable and then // get a string mapping the name - nsCString str; + nsAutoString tmpStr; + nsCAutoString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.AppendWithConversion(str); + aResult.Append(NS_ConvertASCIItoUCS2(str)); } else { - aResult.AppendInt(aValue.GetIntValue(), 10); + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); } } break; default: - aResult.AppendInt(aValue.GetIntValue(), 10); + { + nsAutoString tmpStr; + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); + } } } else if (eCSSUnit_Enumerated == unit) { @@ -3974,119 +3985,136 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, mask))); intValue &= ~mask; if (0 != intValue) { // more left - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } } } } else { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE))); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND)))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.AppendWithConversion(' '); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.Append(PRUnichar(' ')); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND))); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX))); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT))); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP))); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER))); } } else { const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.AppendWithConversion(name); + aResult.Append(NS_ConvertASCIItoUCS2(name)); } } else if (eCSSUnit_Color == unit){ + nsAutoString tmpStr; nscolor color = aValue.GetColorValue(); - aResult.AppendWithConversion("rgb("); - aResult.AppendInt(NS_GET_R(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_G(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_B(color), 10); - aResult.AppendWithConversion(')'); + + aResult.Append(NS_LITERAL_STRING("rgb(")); + + tmpStr.AppendInt(NS_GET_R(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_G(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_B(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == unit) { - aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetPercentValue() * 100.0f); + aResult.Append(tmpStr); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.AppendFloat(aValue.GetFloatValue()); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetFloatValue()); + aResult.Append(tmpStr); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aResult.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aResult.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aResult.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aResult.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aResult.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; + case eCSSUnit_Counters: aResult.Append(PRUnichar(')')); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; + case eCSSUnit_Percent: aResult.Append(PRUnichar('%')); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; - case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; + case eCSSUnit_Inch: aResult.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aResult.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aResult.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aResult.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aResult.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aResult.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aResult.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aResult.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aResult.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aResult.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aResult.Append(NS_LITERAL_STRING("cc")); break; - case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; - case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; + case eCSSUnit_EM: aResult.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aResult.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aResult.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aResult.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aResult.Append(NS_LITERAL_STRING("ch")); break; - case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; + case eCSSUnit_Pixel: aResult.Append(NS_LITERAL_STRING("px")); break; - case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; + case eCSSUnit_Degree: aResult.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aResult.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aResult.Append(NS_LITERAL_STRING("rad")); break; - case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; + case eCSSUnit_Hertz: aResult.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aResult.Append(NS_LITERAL_STRING("kHz")); break; - case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; + case eCSSUnit_Seconds: aResult.Append(PRUnichar('s')); break; + case eCSSUnit_Milliseconds: aResult.Append(NS_LITERAL_STRING("ms")); break; } return PR_TRUE; @@ -4102,7 +4130,8 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns (eCSSUnit_Null != strct->rect->mLeft.GetUnit())) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, + nsAWritableString& aValue) { PRBool isImportant = PR_FALSE; GetValueIsImportant(aProperty, isImportant); @@ -4115,41 +4144,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(PRUnichar(' ')); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.AppendWithConversion("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); + aValue.Append(NS_LITERAL_STRING("rect(")); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.AppendWithConversion(")"); + aValue.Append(PRUnichar(')')); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -4160,62 +4189,62 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.AppendWithConversion('/'); + aValue.Append(PRUnichar('/')); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_pause_before, aValue); } break; case eCSSProperty_size: if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { AppendValueToString(eCSSProperty_size_width, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_size_height, aValue); } break; @@ -4224,13 +4253,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(PRUnichar(' ')); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(PRUnichar(' ')); shadow = shadow->mNext; } } @@ -4242,67 +4271,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -4313,7 +4342,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != content); } @@ -4324,13 +4353,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4341,13 +4370,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4356,7 +4385,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -4366,11 +4395,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != quotes); } @@ -4382,7 +4411,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != keyEquiv); } @@ -4408,7 +4437,7 @@ CSSDeclarationImpl::GetImportantValues(nsICSSDeclaration*& aResult) } NS_IMETHODIMP -CSSDeclarationImpl::GetValueIsImportant(const nsString& aProperty, +CSSDeclarationImpl::GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); @@ -4438,7 +4467,7 @@ CSSDeclarationImpl::GetValueIsImportant(nsCSSProperty aProperty, } NS_IMETHODIMP -CSSDeclarationImpl::ToString(nsString& aString) +CSSDeclarationImpl::ToString(nsAWritableString& aString) { if (nsnull != mOrder) { PRInt32 count = mOrder->Count(); @@ -4446,21 +4475,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); - aString.AppendWithConversion(": "); + aString.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); + aString.Append(NS_LITERAL_STRING(": ")); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.AppendWithConversion("; "); + aString.Append(NS_LITERAL_STRING("; ")); } } else { // is comment - aString.AppendWithConversion("/* "); + aString.Append(NS_LITERAL_STRING("/* ")); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.AppendWithConversion(" */ "); + aString.Append(NS_LITERAL_STRING(" */ ")); } } } @@ -4607,13 +4636,13 @@ CSSDeclarationImpl::Count(PRUint32* aCount) } NS_IMETHODIMP -CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) +CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) { - aReturn.SetLength(0); + aReturn.Truncate(); if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aReturn.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); } } diff --git a/content/html/style/src/nsCSSStyleRule.cpp b/content/html/style/src/nsCSSStyleRule.cpp index c4308979ab61..45dfc60e2565 100644 --- a/content/html/style/src/nsCSSStyleRule.cpp +++ b/content/html/style/src/nsCSSStyleRule.cpp @@ -793,14 +793,14 @@ public: DOMCSSDeclarationImpl(nsICSSStyleRule *aRule); ~DOMCSSDeclarationImpl(void); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); virtual void DropReference(void); virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl, PRBool aAllocate); virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl); - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl); virtual nsresult GetParent(nsISupports **aParent); @@ -826,8 +826,8 @@ DOMCSSDeclarationImpl::~DOMCSSDeclarationImpl(void) } NS_IMETHODIMP -DOMCSSDeclarationImpl::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +DOMCSSDeclarationImpl::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { aReturn.Truncate(); @@ -885,7 +885,7 @@ DOMCSSDeclarationImpl::SetCSSDeclaration(nsICSSDeclaration *aDecl) } nsresult -DOMCSSDeclarationImpl::ParseDeclaration(const nsString& aDecl, +DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) { @@ -3335,15 +3335,15 @@ CSSStyleRuleImpl::GetType(PRUint16* aType) } NS_IMETHODIMP -CSSStyleRuleImpl::GetCssText(nsString& aCssText) +CSSStyleRuleImpl::GetCssText(nsAWritableString& aCssText) { - aCssText = mSelectorText; + aCssText.Assign(mSelectorText); // XXX TBI append declaration too return NS_OK; } NS_IMETHODIMP -CSSStyleRuleImpl::SetCssText(const nsString& aCssText) +CSSStyleRuleImpl::SetCssText(const nsAReadableString& aCssText) { // XXX TBI - need to re-parse rule & declaration return NS_OK; @@ -3366,14 +3366,14 @@ CSSStyleRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule) } NS_IMETHODIMP -CSSStyleRuleImpl::GetSelectorText(nsString& aSelectorText) +CSSStyleRuleImpl::GetSelectorText(nsAWritableString& aSelectorText) { - aSelectorText = mSelectorText; + aSelectorText.Assign(mSelectorText); return NS_OK; } NS_IMETHODIMP -CSSStyleRuleImpl::SetSelectorText(const nsString& aSelectorText) +CSSStyleRuleImpl::SetSelectorText(const nsAReadableString& aSelectorText) { // XXX TBI - get a parser and re-parse the selectors, // XXX then need to re-compute the cascade diff --git a/content/html/style/src/nsCSSStyleSheet.cpp b/content/html/style/src/nsCSSStyleSheet.cpp index f06ad1af8249..2f0d70b0b1ca 100644 --- a/content/html/style/src/nsCSSStyleSheet.cpp +++ b/content/html/style/src/nsCSSStyleSheet.cpp @@ -793,7 +793,7 @@ DOMMediaListImpl::SetScriptObject(void* aScriptObject) } NS_IMETHODIMP -DOMMediaListImpl::GetMediaText(nsString& aMediaText) +DOMMediaListImpl::GetMediaText(nsAWritableString& aMediaText) { aMediaText.Truncate(); @@ -814,7 +814,7 @@ DOMMediaListImpl::GetMediaText(nsString& aMediaText) medium->GetUnicode(&buffer); aMediaText.Append(buffer); if (index < count) { - aMediaText.AppendWithConversion(", "); + aMediaText.Append(NS_LITERAL_STRING(", ")); } } @@ -822,7 +822,7 @@ DOMMediaListImpl::GetMediaText(nsString& aMediaText) } NS_IMETHODIMP -DOMMediaListImpl::SetMediaText(const nsString& aMediaText) +DOMMediaListImpl::SetMediaText(const nsAReadableString& aMediaText) { nsresult rv = Clear(); NS_ENSURE_SUCCESS(rv, rv); @@ -869,7 +869,7 @@ DOMMediaListImpl::GetLength(PRUint32* aLength) } NS_IMETHODIMP -DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn) +DOMMediaListImpl::Item(PRUint32 aIndex, nsAWritableString& aReturn) { nsCOMPtr tmp(dont_AddRef(ElementAt(aIndex))); @@ -888,7 +888,7 @@ DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn) } NS_IMETHODIMP -DOMMediaListImpl::Delete(const nsString& aOldMedium) +DOMMediaListImpl::Delete(const nsAReadableString& aOldMedium) { if (!aOldMedium.Length()) return NS_ERROR_DOM_NOT_FOUND_ERR; @@ -908,7 +908,7 @@ DOMMediaListImpl::Delete(const nsString& aOldMedium) } NS_IMETHODIMP -DOMMediaListImpl::Append(const nsString& aNewMedium) +DOMMediaListImpl::Append(const nsAReadableString& aNewMedium) { if (!aNewMedium.Length()) return NS_ERROR_DOM_NOT_FOUND_ERR; @@ -2302,9 +2302,9 @@ CSSStyleSheetImpl::SetModified(PRBool aModified) // nsIDOMStyleSheet interface NS_IMETHODIMP -CSSStyleSheetImpl::GetType(nsString& aType) +CSSStyleSheetImpl::GetType(nsAWritableString& aType) { - aType.AssignWithConversion("text/css"); + aType.Assign(NS_LITERAL_STRING("text/css")); return NS_OK; } @@ -2354,12 +2354,12 @@ CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) } NS_IMETHODIMP -CSSStyleSheetImpl::GetHref(nsString& aHref) +CSSStyleSheetImpl::GetHref(nsAWritableString& aHref) { if (mInner && mInner->mURL) { char* str = nsnull; mInner->mURL->GetSpec(&str); - aHref.AssignWithConversion(str); + aHref.Assign(NS_ConvertASCIItoUCS2(str)); if (str) { nsCRT::free(str); } @@ -2379,9 +2379,9 @@ CSSStyleSheetImpl::GetTitle(nsString& aTitle) const } NS_IMETHODIMP -CSSStyleSheetImpl::GetTitle(nsString& aTitle) +CSSStyleSheetImpl::GetTitle(nsAWritableString& aTitle) { - aTitle = mTitle; + aTitle.Assign(mTitle); return NS_OK; } @@ -2436,7 +2436,7 @@ CSSStyleSheetImpl::GetCssRules(nsIDOMCSSRuleList** aCssRules) } NS_IMETHODIMP -CSSStyleSheetImpl::InsertRule(const nsString& aRule, +CSSStyleSheetImpl::InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn) { diff --git a/content/html/style/src/nsCSSValue.cpp b/content/html/style/src/nsCSSValue.cpp index 9c7f317d1e8c..0ddd9b70e290 100644 --- a/content/html/style/src/nsCSSValue.cpp +++ b/content/html/style/src/nsCSSValue.cpp @@ -23,6 +23,7 @@ #include "nsString.h" #include "nsCSSProps.h" #include "nsUnitConversion.h" +#include "nsReadableUtils.h" //#include "nsStyleConsts.h" @@ -65,12 +66,12 @@ nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit) } } -nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit) +nsCSSValue::nsCSSValue(const nsAReadableString& aValue, nsCSSUnit aUnit) : mUnit(aUnit) { NS_ASSERTION((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters), "not a string value"); if ((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters)) { - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } else { mUnit = eCSSUnit_Null; @@ -235,13 +236,14 @@ void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit) } } -void nsCSSValue::SetStringValue(const nsString& aValue, nsCSSUnit aUnit) +void nsCSSValue::SetStringValue(const nsAReadableString& aValue, + nsCSSUnit aUnit) { NS_ASSERTION((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters), "not a string unit"); Reset(); if ((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters)) { mUnit = aUnit; - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } } @@ -276,103 +278,132 @@ void nsCSSValue::SetNormalValue(void) mUnit = eCSSUnit_Normal; } -void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const +void nsCSSValue::AppendToString(nsAWritableString& aBuffer, + nsCSSProperty aPropID) const { if (eCSSUnit_Null == mUnit) { return; } if (-1 < aPropID) { - aBuffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); - aBuffer.AppendWithConversion(": "); + aBuffer.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(aPropID))); + aBuffer.Append(NS_LITERAL_STRING(": ")); } if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) { switch (mUnit) { - case eCSSUnit_URL: aBuffer.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aBuffer.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aBuffer.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aBuffer.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aBuffer.Append(NS_LITERAL_STRING("url(")); break; + case eCSSUnit_Attr: aBuffer.Append(NS_LITERAL_STRING("attr(")); break; + case eCSSUnit_Counter: aBuffer.Append(NS_LITERAL_STRING("counter(")); break; + case eCSSUnit_Counters: aBuffer.Append(NS_LITERAL_STRING("counters(")); break; default: break; } if (nsnull != mValue.mString) { - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); aBuffer.Append(mValue.mString); - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); } else { - aBuffer.AppendWithConversion("null str"); + aBuffer.Append(NS_LITERAL_STRING("null str")); } } else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); + nsAutoString intStr; + intStr.AppendInt(mValue.mInt, 10); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING("[0x")); + + intStr.Truncate(); + intStr.AppendInt(mValue.mInt, 16); + aBuffer.Append(intStr); + + aBuffer.Append(PRUnichar(']')); } else if (eCSSUnit_Color == mUnit){ - aBuffer.AppendWithConversion("(0x"); - aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); - aBuffer.AppendWithConversion(')'); + aBuffer.Append(NS_LITERAL_STRING("(0x")); + + nsAutoString intStr; + intStr.AppendInt(NS_GET_R(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_G(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_B(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_A(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == mUnit) { - aBuffer.AppendFloat(mValue.mFloat * 100.0f); + nsAutoString floatString; + floatString.AppendFloat(mValue.mFloat * 100.0f); + aBuffer.Append(floatString); } else if (eCSSUnit_Percent < mUnit) { - aBuffer.AppendFloat(mValue.mFloat); + nsAutoString floatString; + floatString.AppendFloat(mValue.mFloat); + aBuffer.Append(floatString); } switch (mUnit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aBuffer.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aBuffer.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aBuffer.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aBuffer.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aBuffer.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aBuffer.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aBuffer.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aBuffer.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aBuffer.AppendWithConversion(')'); break; - case eCSSUnit_Integer: aBuffer.AppendWithConversion("int"); break; - case eCSSUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eCSSUnit_Color: aBuffer.AppendWithConversion("rbga"); break; - case eCSSUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eCSSUnit_Number: aBuffer.AppendWithConversion("#"); break; - case eCSSUnit_Inch: aBuffer.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aBuffer.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aBuffer.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aBuffer.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aBuffer.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aBuffer.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aBuffer.AppendWithConversion("km"); break; - case eCSSUnit_Point: aBuffer.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aBuffer.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aBuffer.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aBuffer.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aBuffer.AppendWithConversion("em"); break; - case eCSSUnit_EN: aBuffer.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aBuffer.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aBuffer.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aBuffer.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aBuffer.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aBuffer.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aBuffer.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aBuffer.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aBuffer.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aBuffer.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aBuffer.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aBuffer.AppendWithConversion("ms"); break; + case eCSSUnit_Counters: aBuffer.Append(NS_LITERAL_STRING(")")); break; + case eCSSUnit_Integer: aBuffer.Append(NS_LITERAL_STRING("int")); break; + case eCSSUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; + case eCSSUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; + case eCSSUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; + case eCSSUnit_Number: aBuffer.Append(NS_LITERAL_STRING("#")); break; + case eCSSUnit_Inch: aBuffer.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aBuffer.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aBuffer.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aBuffer.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aBuffer.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aBuffer.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aBuffer.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aBuffer.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aBuffer.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aBuffer.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aBuffer.Append(NS_LITERAL_STRING("cc")); break; + case eCSSUnit_EM: aBuffer.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aBuffer.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aBuffer.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aBuffer.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aBuffer.Append(NS_LITERAL_STRING("ch")); break; + case eCSSUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; + case eCSSUnit_Degree: aBuffer.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aBuffer.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aBuffer.Append(NS_LITERAL_STRING("rad")); break; + case eCSSUnit_Hertz: aBuffer.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aBuffer.Append(NS_LITERAL_STRING("kHz")); break; + case eCSSUnit_Seconds: aBuffer.Append(NS_LITERAL_STRING("s")); break; + case eCSSUnit_Milliseconds: aBuffer.Append(NS_LITERAL_STRING("ms")); break; } - aBuffer.AppendWithConversion(' '); + aBuffer.Append(NS_LITERAL_STRING(" ")); } -void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const +void nsCSSValue::ToString(nsAWritableString& aBuffer, + nsCSSProperty aPropID) const { aBuffer.Truncate(); AppendToString(aBuffer, aPropID); diff --git a/content/html/style/src/nsCSSValue.h b/content/html/style/src/nsCSSValue.h index 70f11fe34f08..0079fc41bcf9 100644 --- a/content/html/style/src/nsCSSValue.h +++ b/content/html/style/src/nsCSSValue.h @@ -96,7 +96,7 @@ public: nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null); // for valueless units only (null, auto, inherit, none, normal) nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit); nsCSSValue(float aValue, nsCSSUnit aUnit); - nsCSSValue(const nsString& aValue, nsCSSUnit aUnit); + nsCSSValue(const nsAReadableString& aValue, nsCSSUnit aUnit); nsCSSValue(nscolor aValue); nsCSSValue(const nsCSSValue& aCopy); ~nsCSSValue(void); @@ -122,7 +122,7 @@ public: PRInt32 GetIntValue(void) const; float GetPercentValue(void) const; float GetFloatValue(void) const; - nsString& GetStringValue(nsString& aBuffer) const; + nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; nscolor GetColorValue(void) const; nscoord GetLengthTwips(void) const; @@ -130,7 +130,7 @@ public: void SetIntValue(PRInt32 aValue, nsCSSUnit aUnit); void SetPercentValue(float aValue); void SetFloatValue(float aValue, nsCSSUnit aUnit); - void SetStringValue(const nsString& aValue, nsCSSUnit aUnit); + void SetStringValue(const nsAReadableString& aValue, nsCSSUnit aUnit); void SetColorValue(nscolor aValue); void SetAutoValue(void); void SetInheritValue(void); @@ -138,8 +138,8 @@ public: void SetNormalValue(void); // debugging methods only - void AppendToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; - void ToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; + void AppendToString(nsAWritableString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; + void ToString(nsAWritableString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; protected: nsCSSUnit mUnit; @@ -180,7 +180,7 @@ inline float nsCSSValue::GetFloatValue(void) const return 0.0f; } -inline nsString& nsCSSValue::GetStringValue(nsString& aBuffer) const +inline nsAWritableString& nsCSSValue::GetStringValue(nsAWritableString& aBuffer) const { NS_ASSERTION((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters), "not a string value"); aBuffer.Truncate(); diff --git a/content/html/style/src/nsComputedDOMStyle.cpp b/content/html/style/src/nsComputedDOMStyle.cpp index 1377424eb13a..102170bf8b34 100644 --- a/content/html/style/src/nsComputedDOMStyle.cpp +++ b/content/html/style/src/nsComputedDOMStyle.cpp @@ -50,7 +50,7 @@ public: NS_DECL_ISUPPORTS // nsIComputedDOMStyle - NS_IMETHOD Init(nsIDOMElement *aElement, const nsString& aPseudoElt, + NS_IMETHOD Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell); // nsIDOMCSSStyleDeclaration @@ -155,7 +155,7 @@ nsComputedDOMStyle::SetScriptObject(void* aScriptObject) NS_IMETHODIMP -nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsString& aPseudoElt, +nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell) { NS_ENSURE_ARG_POINTER(aElement); @@ -181,7 +181,7 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsString& aPseudoElt, } NS_IMETHODIMP -nsComputedDOMStyle::GetCssText(nsString& aCssText) +nsComputedDOMStyle::GetCssText(nsAWritableString& aCssText) { aCssText.Truncate(); return NS_OK; @@ -189,7 +189,7 @@ nsComputedDOMStyle::GetCssText(nsString& aCssText) NS_IMETHODIMP -nsComputedDOMStyle::SetCssText(const nsString& aCssText) +nsComputedDOMStyle::SetCssText(const nsAReadableString& aCssText) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -215,8 +215,8 @@ nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule) NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCOMPtr val; @@ -234,7 +234,7 @@ nsComputedDOMStyle::GetPropertyValue(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, +nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -246,6 +246,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, nsCOMPtr val; nsresult rv = NS_OK; + // XXX FIX THIS!!! nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName); switch (prop) { @@ -278,16 +279,16 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { aReturn.Truncate(); return NS_OK; @@ -295,16 +296,16 @@ nsComputedDOMStyle::GetPropertyPriority(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::SetProperty(const nsString& aPropertyName, - const nsString& aValue, - const nsString& aPriority) +nsComputedDOMStyle::SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, + const nsAReadableString& aPriority) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::Item(PRUint32 aIndex, nsString& aReturn) +nsComputedDOMStyle::Item(PRUint32 aIndex, nsAWritableString& aReturn) { aReturn.Truncate(); return NS_OK; @@ -316,43 +317,43 @@ nsComputedDOMStyle::Item(PRUint32 aIndex, nsString& aReturn) #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetAzimuth(nsString& aAzimuth) +nsComputedDOMStyle::GetAzimuth(nsAWritableString& aAzimuth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackground(nsString& aBackground) +nsComputedDOMStyle::GetBackground(nsAWritableString& aBackground) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundAttachment(nsString& aBackgroundAttachment) +nsComputedDOMStyle::GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundColor(nsString& aBackgroundColor) +nsComputedDOMStyle::GetBackgroundColor(nsAWritableString& aBackgroundColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundImage(nsString& aBackgroundImage) +nsComputedDOMStyle::GetBackgroundImage(nsAWritableString& aBackgroundImage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundPosition(nsString& aBackgroundPosition) +nsComputedDOMStyle::GetBackgroundPosition(nsAWritableString& aBackgroundPosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundRepeat(nsString& aBackgroundRepeat) +nsComputedDOMStyle::GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -400,133 +401,133 @@ nsComputedDOMStyle::GetBehavior(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetBorder(nsString& aBorder) +nsComputedDOMStyle::GetBorder(nsAWritableString& aBorder) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderCollapse(nsString& aBorderCollapse) +nsComputedDOMStyle::GetBorderCollapse(nsAWritableString& aBorderCollapse) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderColor(nsString& aBorderColor) +nsComputedDOMStyle::GetBorderColor(nsAWritableString& aBorderColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderSpacing(nsString& aBorderSpacing) +nsComputedDOMStyle::GetBorderSpacing(nsAWritableString& aBorderSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderStyle(nsString& aBorderStyle) +nsComputedDOMStyle::GetBorderStyle(nsAWritableString& aBorderStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTop(nsString& aBorderTop) +nsComputedDOMStyle::GetBorderTop(nsAWritableString& aBorderTop) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRight(nsString& aBorderRight) +nsComputedDOMStyle::GetBorderRight(nsAWritableString& aBorderRight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottom(nsString& aBorderBottom) +nsComputedDOMStyle::GetBorderBottom(nsAWritableString& aBorderBottom) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeft(nsString& aBorderLeft) +nsComputedDOMStyle::GetBorderLeft(nsAWritableString& aBorderLeft) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopColor(nsString& aBorderTopColor) +nsComputedDOMStyle::GetBorderTopColor(nsAWritableString& aBorderTopColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightColor(nsString& aBorderRightColor) +nsComputedDOMStyle::GetBorderRightColor(nsAWritableString& aBorderRightColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomColor(nsString& aBorderBottomColor) +nsComputedDOMStyle::GetBorderBottomColor(nsAWritableString& aBorderBottomColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftColor(nsString& aBorderLeftColor) +nsComputedDOMStyle::GetBorderLeftColor(nsAWritableString& aBorderLeftColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopStyle(nsString& aBorderTopStyle) +nsComputedDOMStyle::GetBorderTopStyle(nsAWritableString& aBorderTopStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightStyle(nsString& aBorderRightStyle) +nsComputedDOMStyle::GetBorderRightStyle(nsAWritableString& aBorderRightStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomStyle(nsString& aBorderBottomStyle) +nsComputedDOMStyle::GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftStyle(nsString& aBorderLeftStyle) +nsComputedDOMStyle::GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopWidth(nsString& aBorderTopWidth) +nsComputedDOMStyle::GetBorderTopWidth(nsAWritableString& aBorderTopWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightWidth(nsString& aBorderRightWidth) +nsComputedDOMStyle::GetBorderRightWidth(nsAWritableString& aBorderRightWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomWidth(nsString& aBorderBottomWidth) +nsComputedDOMStyle::GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftWidth(nsString& aBorderLeftWidth) +nsComputedDOMStyle::GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderWidth(nsString& aBorderWidth) +nsComputedDOMStyle::GetBorderWidth(nsAWritableString& aBorderWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -552,79 +553,79 @@ nsComputedDOMStyle::GetBottom(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetCaptionSide(nsString& aCaptionSide) +nsComputedDOMStyle::GetCaptionSide(nsAWritableString& aCaptionSide) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetClear(nsString& aClear) +nsComputedDOMStyle::GetClear(nsAWritableString& aClear) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetClip(nsString& aClip) +nsComputedDOMStyle::GetClip(nsAWritableString& aClip) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetColor(nsString& aColor) +nsComputedDOMStyle::GetColor(nsAWritableString& aColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetContent(nsString& aContent) +nsComputedDOMStyle::GetContent(nsAWritableString& aContent) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCounterIncrement(nsString& aCounterIncrement) +nsComputedDOMStyle::GetCounterIncrement(nsAWritableString& aCounterIncrement) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCounterReset(nsString& aCounterReset) +nsComputedDOMStyle::GetCounterReset(nsAWritableString& aCounterReset) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCssFloat(nsString& aCssFloat) +nsComputedDOMStyle::GetCssFloat(nsAWritableString& aCssFloat) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCue(nsString& aCue) +nsComputedDOMStyle::GetCue(nsAWritableString& aCue) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCueAfter(nsString& aCueAfter) +nsComputedDOMStyle::GetCueAfter(nsAWritableString& aCueAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCueBefore(nsString& aCueBefore) +nsComputedDOMStyle::GetCueBefore(nsAWritableString& aCueBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCursor(nsString& aCursor) +nsComputedDOMStyle::GetCursor(nsAWritableString& aCursor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetDirection(nsString& aDirection) +nsComputedDOMStyle::GetDirection(nsAWritableString& aDirection) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -700,61 +701,61 @@ nsComputedDOMStyle::GetDisplay(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetElevation(nsString& aElevation) +nsComputedDOMStyle::GetElevation(nsAWritableString& aElevation) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetEmptyCells(nsString& aEmptyCells) +nsComputedDOMStyle::GetEmptyCells(nsAWritableString& aEmptyCells) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFont(nsString& aFont) +nsComputedDOMStyle::GetFont(nsAWritableString& aFont) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontFamily(nsString& aFontFamily) +nsComputedDOMStyle::GetFontFamily(nsAWritableString& aFontFamily) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontSize(nsString& aFontSize) +nsComputedDOMStyle::GetFontSize(nsAWritableString& aFontSize) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontSizeAdjust(nsString& aFontSizeAdjust) +nsComputedDOMStyle::GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontStretch(nsString& aFontStretch) +nsComputedDOMStyle::GetFontStretch(nsAWritableString& aFontStretch) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontStyle(nsString& aFontStyle) +nsComputedDOMStyle::GetFontStyle(nsAWritableString& aFontStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontVariant(nsString& aFontVariant) +nsComputedDOMStyle::GetFontVariant(nsAWritableString& aFontVariant) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontWeight(nsString& aFontWeight) +nsComputedDOMStyle::GetFontWeight(nsAWritableString& aFontWeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -799,43 +800,43 @@ nsComputedDOMStyle::GetLeft(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetLetterSpacing(nsString& aLetterSpacing) +nsComputedDOMStyle::GetLetterSpacing(nsAWritableString& aLetterSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetLineHeight(nsString& aLineHeight) +nsComputedDOMStyle::GetLineHeight(nsAWritableString& aLineHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyle(nsString& aListStyle) +nsComputedDOMStyle::GetListStyle(nsAWritableString& aListStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyleImage(nsString& aListStyleImage) +nsComputedDOMStyle::GetListStyleImage(nsAWritableString& aListStyleImage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStylePosition(nsString& aListStylePosition) +nsComputedDOMStyle::GetListStylePosition(nsAWritableString& aListStylePosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyleType(nsString& aListStyleType) +nsComputedDOMStyle::GetListStyleType(nsAWritableString& aListStyleType) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMargin(nsString& aMargin) +nsComputedDOMStyle::GetMargin(nsAWritableString& aMargin) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -885,181 +886,181 @@ nsComputedDOMStyle::GetMarginLeft(nsIFrame *aFrame, } NS_IMETHODIMP -nsComputedDOMStyle::GetMarkerOffset(nsString& aMarkerOffset) +nsComputedDOMStyle::GetMarkerOffset(nsAWritableString& aMarkerOffset) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMarks(nsString& aMarks) +nsComputedDOMStyle::GetMarks(nsAWritableString& aMarks) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMaxHeight(nsString& aMaxHeight) +nsComputedDOMStyle::GetMaxHeight(nsAWritableString& aMaxHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMaxWidth(nsString& aMaxWidth) +nsComputedDOMStyle::GetMaxWidth(nsAWritableString& aMaxWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMinHeight(nsString& aMinHeight) +nsComputedDOMStyle::GetMinHeight(nsAWritableString& aMinHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMinWidth(nsString& aMinWidth) +nsComputedDOMStyle::GetMinWidth(nsAWritableString& aMinWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOrphans(nsString& aOrphans) +nsComputedDOMStyle::GetOrphans(nsAWritableString& aOrphans) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutline(nsString& aOutline) +nsComputedDOMStyle::GetOutline(nsAWritableString& aOutline) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineColor(nsString& aOutlineColor) +nsComputedDOMStyle::GetOutlineColor(nsAWritableString& aOutlineColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineStyle(nsString& aOutlineStyle) +nsComputedDOMStyle::GetOutlineStyle(nsAWritableString& aOutlineStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineWidth(nsString& aOutlineWidth) +nsComputedDOMStyle::GetOutlineWidth(nsAWritableString& aOutlineWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOverflow(nsString& aOverflow) +nsComputedDOMStyle::GetOverflow(nsAWritableString& aOverflow) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPadding(nsString& aPadding) +nsComputedDOMStyle::GetPadding(nsAWritableString& aPadding) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingTop(nsString& aPaddingTop) +nsComputedDOMStyle::GetPaddingTop(nsAWritableString& aPaddingTop) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingRight(nsString& aPaddingRight) +nsComputedDOMStyle::GetPaddingRight(nsAWritableString& aPaddingRight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingBottom(nsString& aPaddingBottom) +nsComputedDOMStyle::GetPaddingBottom(nsAWritableString& aPaddingBottom) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingLeft(nsString& aPaddingLeft) +nsComputedDOMStyle::GetPaddingLeft(nsAWritableString& aPaddingLeft) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPage(nsString& aPage) +nsComputedDOMStyle::GetPage(nsAWritableString& aPage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakAfter(nsString& aPageBreakAfter) +nsComputedDOMStyle::GetPageBreakAfter(nsAWritableString& aPageBreakAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakBefore(nsString& aPageBreakBefore) +nsComputedDOMStyle::GetPageBreakBefore(nsAWritableString& aPageBreakBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakInside(nsString& aPageBreakInside) +nsComputedDOMStyle::GetPageBreakInside(nsAWritableString& aPageBreakInside) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPause(nsString& aPause) +nsComputedDOMStyle::GetPause(nsAWritableString& aPause) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPauseAfter(nsString& aPauseAfter) +nsComputedDOMStyle::GetPauseAfter(nsAWritableString& aPauseAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPauseBefore(nsString& aPauseBefore) +nsComputedDOMStyle::GetPauseBefore(nsAWritableString& aPauseBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPitch(nsString& aPitch) +nsComputedDOMStyle::GetPitch(nsAWritableString& aPitch) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPitchRange(nsString& aPitchRange) +nsComputedDOMStyle::GetPitchRange(nsAWritableString& aPitchRange) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPlayDuring(nsString& aPlayDuring) +nsComputedDOMStyle::GetPlayDuring(nsAWritableString& aPlayDuring) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPosition(nsString& aPosition) +nsComputedDOMStyle::GetPosition(nsAWritableString& aPosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetQuotes(nsString& aQuotes) +nsComputedDOMStyle::GetQuotes(nsAWritableString& aQuotes) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetRichness(nsString& aRichness) +nsComputedDOMStyle::GetRichness(nsAWritableString& aRichness) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1085,79 +1086,79 @@ nsComputedDOMStyle::GetRight(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetSize(nsString& aSize) +nsComputedDOMStyle::GetSize(nsAWritableString& aSize) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeak(nsString& aSpeak) +nsComputedDOMStyle::GetSpeak(nsAWritableString& aSpeak) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakHeader(nsString& aSpeakHeader) +nsComputedDOMStyle::GetSpeakHeader(nsAWritableString& aSpeakHeader) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakNumeral(nsString& aSpeakNumeral) +nsComputedDOMStyle::GetSpeakNumeral(nsAWritableString& aSpeakNumeral) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakPunctuation(nsString& aSpeakPunctuation) +nsComputedDOMStyle::GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeechRate(nsString& aSpeechRate) +nsComputedDOMStyle::GetSpeechRate(nsAWritableString& aSpeechRate) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetStress(nsString& aStress) +nsComputedDOMStyle::GetStress(nsAWritableString& aStress) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTableLayout(nsString& aTableLayout) +nsComputedDOMStyle::GetTableLayout(nsAWritableString& aTableLayout) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextAlign(nsString& aTextAlign) +nsComputedDOMStyle::GetTextAlign(nsAWritableString& aTextAlign) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextDecoration(nsString& aTextDecoration) +nsComputedDOMStyle::GetTextDecoration(nsAWritableString& aTextDecoration) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextIndent(nsString& aTextIndent) +nsComputedDOMStyle::GetTextIndent(nsAWritableString& aTextIndent) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextShadow(nsString& aTextShadow) +nsComputedDOMStyle::GetTextShadow(nsAWritableString& aTextShadow) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextTransform(nsString& aTextTransform) +nsComputedDOMStyle::GetTextTransform(nsAWritableString& aTextTransform) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1183,43 +1184,43 @@ nsComputedDOMStyle::GetTop(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetUnicodeBidi(nsString& aUnicodeBidi) +nsComputedDOMStyle::GetUnicodeBidi(nsAWritableString& aUnicodeBidi) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVerticalAlign(nsString& aVerticalAlign) +nsComputedDOMStyle::GetVerticalAlign(nsAWritableString& aVerticalAlign) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVisibility(nsString& aVisibility) +nsComputedDOMStyle::GetVisibility(nsAWritableString& aVisibility) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVoiceFamily(nsString& aVoiceFamily) +nsComputedDOMStyle::GetVoiceFamily(nsAWritableString& aVoiceFamily) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVolume(nsString& aVolume) +nsComputedDOMStyle::GetVolume(nsAWritableString& aVolume) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetWhiteSpace(nsString& aWhiteSpace) +nsComputedDOMStyle::GetWhiteSpace(nsAWritableString& aWhiteSpace) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetWidows(nsString& aWidows) +nsComputedDOMStyle::GetWidows(nsAWritableString& aWidows) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1322,19 +1323,19 @@ nsComputedDOMStyle::GetWidth(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetWordSpacing(nsString& aWordSpacing) +nsComputedDOMStyle::GetWordSpacing(nsAWritableString& aWordSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetZIndex(nsString& aZIndex) +nsComputedDOMStyle::GetZIndex(nsAWritableString& aZIndex) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOpacity(nsString& aOpacity) +nsComputedDOMStyle::GetOpacity(nsAWritableString& aOpacity) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } diff --git a/content/html/style/src/nsDOMCSSDeclaration.cpp b/content/html/style/src/nsDOMCSSDeclaration.cpp index 702fde9fb2b9..d51295653546 100644 --- a/content/html/style/src/nsDOMCSSDeclaration.cpp +++ b/content/html/style/src/nsDOMCSSDeclaration.cpp @@ -115,7 +115,7 @@ nsDOMCSSDeclaration::SetScriptObject(void* aScriptObject) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCssText(nsString& aCssText) +nsDOMCSSDeclaration::GetCssText(nsAWritableString& aCssText) { aCssText.Truncate(); // XXX TBI @@ -123,7 +123,7 @@ nsDOMCSSDeclaration::GetCssText(nsString& aCssText) } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCssText(const nsString& aCssText) +nsDOMCSSDeclaration::SetCssText(const nsAReadableString& aCssText) { // XXX TBI return NS_OK; @@ -162,7 +162,7 @@ nsDOMCSSDeclaration::GetParentRule(nsIDOMCSSRule** aParentRule) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyCSSValue(const nsString& aPropertyName, +nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -174,7 +174,7 @@ nsDOMCSSDeclaration::GetPropertyCSSValue(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsString& aReturn) +nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsAWritableString& aReturn) { nsICSSDeclaration *decl; nsresult result = GetCSSDeclaration(&decl, PR_FALSE); @@ -189,8 +189,8 @@ nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsString& aReturn) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSDeclaration::GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCSSValue val; nsICSSDeclaration *decl; @@ -206,8 +206,8 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSDeclaration::GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsICSSDeclaration *decl; nsresult result = GetCSSDeclaration(&decl, PR_FALSE); @@ -219,7 +219,7 @@ nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, } if ((NS_OK == result) && isImportant) { - aReturn.AssignWithConversion("!important"); + aReturn.Assign(NS_LITERAL_STRING("!important")); } else { aReturn.SetLength(0); @@ -229,9 +229,9 @@ nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, - const nsString& aValue, - const nsString& aPriority) +nsDOMCSSDeclaration::SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, + const nsAReadableString& aPriority) { if (!aValue.Length()) { // If the new value of the property is an empty string we remove the @@ -243,7 +243,7 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, nsAutoString declString; declString.Assign(aPropertyName); - declString.AppendWithConversion(":"); + declString.Append(PRUnichar(':')); declString.Append(aValue); declString.Append(aPriority); @@ -251,1490 +251,1490 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::GetAzimuth(nsString& aAzimuth) +nsDOMCSSDeclaration::GetAzimuth(nsAWritableString& aAzimuth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("azimuth"), aAzimuth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetAzimuth(const nsString& aAzimuth) +nsDOMCSSDeclaration::SetAzimuth(const nsAReadableString& aAzimuth) { return SetProperty(NS_ConvertASCIItoUCS2("azimuth"), aAzimuth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackground(nsString& aBackground) +nsDOMCSSDeclaration::GetBackground(nsAWritableString& aBackground) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background"), aBackground); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackground(const nsString& aBackground) +nsDOMCSSDeclaration::SetBackground(const nsAReadableString& aBackground) { return SetProperty(NS_ConvertASCIItoUCS2("background"), aBackground, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundAttachment(nsString& aBackgroundAttachment) +nsDOMCSSDeclaration::GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-attachment"), aBackgroundAttachment); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundAttachment(const nsString& aBackgroundAttachment) +nsDOMCSSDeclaration::SetBackgroundAttachment(const nsAReadableString& aBackgroundAttachment) { return SetProperty(NS_ConvertASCIItoUCS2("background-attachment"), aBackgroundAttachment, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundColor(nsString& aBackgroundColor) +nsDOMCSSDeclaration::GetBackgroundColor(nsAWritableString& aBackgroundColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-color"), aBackgroundColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundColor(const nsString& aBackgroundColor) +nsDOMCSSDeclaration::SetBackgroundColor(const nsAReadableString& aBackgroundColor) { return SetProperty(NS_ConvertASCIItoUCS2("background-color"), aBackgroundColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundImage(nsString& aBackgroundImage) +nsDOMCSSDeclaration::GetBackgroundImage(nsAWritableString& aBackgroundImage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-image"), aBackgroundImage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundImage(const nsString& aBackgroundImage) +nsDOMCSSDeclaration::SetBackgroundImage(const nsAReadableString& aBackgroundImage) { return SetProperty(NS_ConvertASCIItoUCS2("background-image"), aBackgroundImage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundPosition(nsString& aBackgroundPosition) +nsDOMCSSDeclaration::GetBackgroundPosition(nsAWritableString& aBackgroundPosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-position"), aBackgroundPosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundPosition(const nsString& aBackgroundPosition) +nsDOMCSSDeclaration::SetBackgroundPosition(const nsAReadableString& aBackgroundPosition) { return SetProperty(NS_ConvertASCIItoUCS2("background-position"), aBackgroundPosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundRepeat(nsString& aBackgroundRepeat) +nsDOMCSSDeclaration::GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-repeat"), aBackgroundRepeat); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundRepeat(const nsString& aBackgroundRepeat) +nsDOMCSSDeclaration::SetBackgroundRepeat(const nsAReadableString& aBackgroundRepeat) { return SetProperty(NS_ConvertASCIItoUCS2("background-repeat"), aBackgroundRepeat, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBehavior(nsString& aBehavior) +nsDOMCSSDeclaration::GetBehavior(nsAWritableString& aBehavior) { return GetPropertyValue(NS_ConvertASCIItoUCS2("behavior"), aBehavior); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBehavior(const nsString& aBehavior) +nsDOMCSSDeclaration::SetBehavior(const nsAReadableString& aBehavior) { return SetProperty(NS_ConvertASCIItoUCS2("behavior"), aBehavior, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorder(nsString& aBorder) +nsDOMCSSDeclaration::GetBorder(nsAWritableString& aBorder) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border"), aBorder); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorder(const nsString& aBorder) +nsDOMCSSDeclaration::SetBorder(const nsAReadableString& aBorder) { return SetProperty(NS_ConvertASCIItoUCS2("border"), aBorder, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderCollapse(nsString& aBorderCollapse) +nsDOMCSSDeclaration::GetBorderCollapse(nsAWritableString& aBorderCollapse) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-collapse"), aBorderCollapse); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderCollapse(const nsString& aBorderCollapse) +nsDOMCSSDeclaration::SetBorderCollapse(const nsAReadableString& aBorderCollapse) { return SetProperty(NS_ConvertASCIItoUCS2("border-collapse"), aBorderCollapse, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderColor(nsString& aBorderColor) +nsDOMCSSDeclaration::GetBorderColor(nsAWritableString& aBorderColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-color"), aBorderColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderColor(const nsString& aBorderColor) +nsDOMCSSDeclaration::SetBorderColor(const nsAReadableString& aBorderColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-color"), aBorderColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderSpacing(nsString& aBorderSpacing) +nsDOMCSSDeclaration::GetBorderSpacing(nsAWritableString& aBorderSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-spacing"), aBorderSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderSpacing(const nsString& aBorderSpacing) +nsDOMCSSDeclaration::SetBorderSpacing(const nsAReadableString& aBorderSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("border-spacing"), aBorderSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderStyle(nsString& aBorderStyle) +nsDOMCSSDeclaration::GetBorderStyle(nsAWritableString& aBorderStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-style"), aBorderStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderStyle(const nsString& aBorderStyle) +nsDOMCSSDeclaration::SetBorderStyle(const nsAReadableString& aBorderStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-style"), aBorderStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTop(nsString& aBorderTop) +nsDOMCSSDeclaration::GetBorderTop(nsAWritableString& aBorderTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top"), aBorderTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTop(const nsString& aBorderTop) +nsDOMCSSDeclaration::SetBorderTop(const nsAReadableString& aBorderTop) { return SetProperty(NS_ConvertASCIItoUCS2("border-top"), aBorderTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRight(nsString& aBorderRight) +nsDOMCSSDeclaration::GetBorderRight(nsAWritableString& aBorderRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right"), aBorderRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRight(const nsString& aBorderRight) +nsDOMCSSDeclaration::SetBorderRight(const nsAReadableString& aBorderRight) { return SetProperty(NS_ConvertASCIItoUCS2("border-right"), aBorderRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottom(nsString& aBorderBottom) +nsDOMCSSDeclaration::GetBorderBottom(nsAWritableString& aBorderBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom"), aBorderBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottom(const nsString& aBorderBottom) +nsDOMCSSDeclaration::SetBorderBottom(const nsAReadableString& aBorderBottom) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom"), aBorderBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeft(nsString& aBorderLeft) +nsDOMCSSDeclaration::GetBorderLeft(nsAWritableString& aBorderLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left"), aBorderLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeft(const nsString& aBorderLeft) +nsDOMCSSDeclaration::SetBorderLeft(const nsAReadableString& aBorderLeft) { return SetProperty(NS_ConvertASCIItoUCS2("border-left"), aBorderLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopColor(nsString& aBorderTopColor) +nsDOMCSSDeclaration::GetBorderTopColor(nsAWritableString& aBorderTopColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-color"), aBorderTopColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopColor(const nsString& aBorderTopColor) +nsDOMCSSDeclaration::SetBorderTopColor(const nsAReadableString& aBorderTopColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-color"), aBorderTopColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightColor(nsString& aBorderRightColor) +nsDOMCSSDeclaration::GetBorderRightColor(nsAWritableString& aBorderRightColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-color"), aBorderRightColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightColor(const nsString& aBorderRightColor) +nsDOMCSSDeclaration::SetBorderRightColor(const nsAReadableString& aBorderRightColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-color"), aBorderRightColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomColor(nsString& aBorderBottomColor) +nsDOMCSSDeclaration::GetBorderBottomColor(nsAWritableString& aBorderBottomColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-color"), aBorderBottomColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomColor(const nsString& aBorderBottomColor) +nsDOMCSSDeclaration::SetBorderBottomColor(const nsAReadableString& aBorderBottomColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-color"), aBorderBottomColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftColor(nsString& aBorderLeftColor) +nsDOMCSSDeclaration::GetBorderLeftColor(nsAWritableString& aBorderLeftColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-color"), aBorderLeftColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftColor(const nsString& aBorderLeftColor) +nsDOMCSSDeclaration::SetBorderLeftColor(const nsAReadableString& aBorderLeftColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-color"), aBorderLeftColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopStyle(nsString& aBorderTopStyle) +nsDOMCSSDeclaration::GetBorderTopStyle(nsAWritableString& aBorderTopStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-style"), aBorderTopStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopStyle(const nsString& aBorderTopStyle) +nsDOMCSSDeclaration::SetBorderTopStyle(const nsAReadableString& aBorderTopStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-style"), aBorderTopStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightStyle(nsString& aBorderRightStyle) +nsDOMCSSDeclaration::GetBorderRightStyle(nsAWritableString& aBorderRightStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-style"), aBorderRightStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightStyle(const nsString& aBorderRightStyle) +nsDOMCSSDeclaration::SetBorderRightStyle(const nsAReadableString& aBorderRightStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-style"), aBorderRightStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomStyle(nsString& aBorderBottomStyle) +nsDOMCSSDeclaration::GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-style"), aBorderBottomStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomStyle(const nsString& aBorderBottomStyle) +nsDOMCSSDeclaration::SetBorderBottomStyle(const nsAReadableString& aBorderBottomStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-style"), aBorderBottomStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftStyle(nsString& aBorderLeftStyle) +nsDOMCSSDeclaration::GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-style"), aBorderLeftStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftStyle(const nsString& aBorderLeftStyle) +nsDOMCSSDeclaration::SetBorderLeftStyle(const nsAReadableString& aBorderLeftStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-style"), aBorderLeftStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopWidth(nsString& aBorderTopWidth) +nsDOMCSSDeclaration::GetBorderTopWidth(nsAWritableString& aBorderTopWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-width"), aBorderTopWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopWidth(const nsString& aBorderTopWidth) +nsDOMCSSDeclaration::SetBorderTopWidth(const nsAReadableString& aBorderTopWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-width"), aBorderTopWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightWidth(nsString& aBorderRightWidth) +nsDOMCSSDeclaration::GetBorderRightWidth(nsAWritableString& aBorderRightWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-width"), aBorderRightWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightWidth(const nsString& aBorderRightWidth) +nsDOMCSSDeclaration::SetBorderRightWidth(const nsAReadableString& aBorderRightWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-width"), aBorderRightWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomWidth(nsString& aBorderBottomWidth) +nsDOMCSSDeclaration::GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-width"), aBorderBottomWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomWidth(const nsString& aBorderBottomWidth) +nsDOMCSSDeclaration::SetBorderBottomWidth(const nsAReadableString& aBorderBottomWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-width"), aBorderBottomWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftWidth(nsString& aBorderLeftWidth) +nsDOMCSSDeclaration::GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-width"), aBorderLeftWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftWidth(const nsString& aBorderLeftWidth) +nsDOMCSSDeclaration::SetBorderLeftWidth(const nsAReadableString& aBorderLeftWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-width"), aBorderLeftWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderWidth(nsString& aBorderWidth) +nsDOMCSSDeclaration::GetBorderWidth(nsAWritableString& aBorderWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-width"), aBorderWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderWidth(const nsString& aBorderWidth) +nsDOMCSSDeclaration::SetBorderWidth(const nsAReadableString& aBorderWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-width"), aBorderWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBottom(nsString& aBottom) +nsDOMCSSDeclaration::GetBottom(nsAWritableString& aBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("bottom"), aBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBottom(const nsString& aBottom) +nsDOMCSSDeclaration::SetBottom(const nsAReadableString& aBottom) { return SetProperty(NS_ConvertASCIItoUCS2("bottom"), aBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCaptionSide(nsString& aCaptionSide) +nsDOMCSSDeclaration::GetCaptionSide(nsAWritableString& aCaptionSide) { return GetPropertyValue(NS_ConvertASCIItoUCS2("caption-side"), aCaptionSide); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCaptionSide(const nsString& aCaptionSide) +nsDOMCSSDeclaration::SetCaptionSide(const nsAReadableString& aCaptionSide) { return SetProperty(NS_ConvertASCIItoUCS2("caption-side"), aCaptionSide, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetClear(nsString& aClear) +nsDOMCSSDeclaration::GetClear(nsAWritableString& aClear) { return GetPropertyValue(NS_ConvertASCIItoUCS2("clear"), aClear); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetClear(const nsString& aClear) +nsDOMCSSDeclaration::SetClear(const nsAReadableString& aClear) { return SetProperty(NS_ConvertASCIItoUCS2("clear"), aClear, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetClip(nsString& aClip) +nsDOMCSSDeclaration::GetClip(nsAWritableString& aClip) { return GetPropertyValue(NS_ConvertASCIItoUCS2("clip"), aClip); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetClip(const nsString& aClip) +nsDOMCSSDeclaration::SetClip(const nsAReadableString& aClip) { return SetProperty(NS_ConvertASCIItoUCS2("clip"), aClip, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetColor(nsString& aColor) +nsDOMCSSDeclaration::GetColor(nsAWritableString& aColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("color"), aColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetColor(const nsString& aColor) +nsDOMCSSDeclaration::SetColor(const nsAReadableString& aColor) { return SetProperty(NS_ConvertASCIItoUCS2("color"), aColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetContent(nsString& aContent) +nsDOMCSSDeclaration::GetContent(nsAWritableString& aContent) { return GetPropertyValue(NS_ConvertASCIItoUCS2("content"), aContent); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetContent(const nsString& aContent) +nsDOMCSSDeclaration::SetContent(const nsAReadableString& aContent) { return SetProperty(NS_ConvertASCIItoUCS2("content"), aContent, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCounterIncrement(nsString& aCounterIncrement) +nsDOMCSSDeclaration::GetCounterIncrement(nsAWritableString& aCounterIncrement) { return GetPropertyValue(NS_ConvertASCIItoUCS2("counter-increment"), aCounterIncrement); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCounterIncrement(const nsString& aCounterIncrement) +nsDOMCSSDeclaration::SetCounterIncrement(const nsAReadableString& aCounterIncrement) { return SetProperty(NS_ConvertASCIItoUCS2("counter-increment"), aCounterIncrement, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCounterReset(nsString& aCounterReset) +nsDOMCSSDeclaration::GetCounterReset(nsAWritableString& aCounterReset) { return GetPropertyValue(NS_ConvertASCIItoUCS2("counter-reset"), aCounterReset); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCounterReset(const nsString& aCounterReset) +nsDOMCSSDeclaration::SetCounterReset(const nsAReadableString& aCounterReset) { return SetProperty(NS_ConvertASCIItoUCS2("counter-reset"), aCounterReset, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCssFloat(nsString& aCssFloat) +nsDOMCSSDeclaration::GetCssFloat(nsAWritableString& aCssFloat) { return GetPropertyValue(NS_ConvertASCIItoUCS2("float"), aCssFloat); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCssFloat(const nsString& aCssFloat) +nsDOMCSSDeclaration::SetCssFloat(const nsAReadableString& aCssFloat) { return SetProperty(NS_ConvertASCIItoUCS2("float"), aCssFloat, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCue(nsString& aCue) +nsDOMCSSDeclaration::GetCue(nsAWritableString& aCue) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue"), aCue); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCue(const nsString& aCue) +nsDOMCSSDeclaration::SetCue(const nsAReadableString& aCue) { return SetProperty(NS_ConvertASCIItoUCS2("cue"), aCue, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCueAfter(nsString& aCueAfter) +nsDOMCSSDeclaration::GetCueAfter(nsAWritableString& aCueAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue-after"), aCueAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCueAfter(const nsString& aCueAfter) +nsDOMCSSDeclaration::SetCueAfter(const nsAReadableString& aCueAfter) { return SetProperty(NS_ConvertASCIItoUCS2("cue-after"), aCueAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCueBefore(nsString& aCueBefore) +nsDOMCSSDeclaration::GetCueBefore(nsAWritableString& aCueBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue-before"), aCueBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCueBefore(const nsString& aCueBefore) +nsDOMCSSDeclaration::SetCueBefore(const nsAReadableString& aCueBefore) { return SetProperty(NS_ConvertASCIItoUCS2("cue-before"), aCueBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCursor(nsString& aCursor) +nsDOMCSSDeclaration::GetCursor(nsAWritableString& aCursor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cursor"), aCursor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCursor(const nsString& aCursor) +nsDOMCSSDeclaration::SetCursor(const nsAReadableString& aCursor) { return SetProperty(NS_ConvertASCIItoUCS2("cursor"), aCursor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetDirection(nsString& aDirection) +nsDOMCSSDeclaration::GetDirection(nsAWritableString& aDirection) { return GetPropertyValue(NS_ConvertASCIItoUCS2("direction"), aDirection); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetDirection(const nsString& aDirection) +nsDOMCSSDeclaration::SetDirection(const nsAReadableString& aDirection) { return SetProperty(NS_ConvertASCIItoUCS2("direction"), aDirection, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetDisplay(nsString& aDisplay) +nsDOMCSSDeclaration::GetDisplay(nsAWritableString& aDisplay) { return GetPropertyValue(NS_ConvertASCIItoUCS2("display"), aDisplay); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetDisplay(const nsString& aDisplay) +nsDOMCSSDeclaration::SetDisplay(const nsAReadableString& aDisplay) { return SetProperty(NS_ConvertASCIItoUCS2("display"), aDisplay, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetElevation(nsString& aElevation) +nsDOMCSSDeclaration::GetElevation(nsAWritableString& aElevation) { return GetPropertyValue(NS_ConvertASCIItoUCS2("elevation"), aElevation); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetElevation(const nsString& aElevation) +nsDOMCSSDeclaration::SetElevation(const nsAReadableString& aElevation) { return SetProperty(NS_ConvertASCIItoUCS2("elevation"), aElevation, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetEmptyCells(nsString& aEmptyCells) +nsDOMCSSDeclaration::GetEmptyCells(nsAWritableString& aEmptyCells) { return GetPropertyValue(NS_ConvertASCIItoUCS2("empty-cells"), aEmptyCells); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetEmptyCells(const nsString& aEmptyCells) +nsDOMCSSDeclaration::SetEmptyCells(const nsAReadableString& aEmptyCells) { return SetProperty(NS_ConvertASCIItoUCS2("empty-cells"), aEmptyCells, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFont(nsString& aFont) +nsDOMCSSDeclaration::GetFont(nsAWritableString& aFont) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font"), aFont); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFont(const nsString& aFont) +nsDOMCSSDeclaration::SetFont(const nsAReadableString& aFont) { return SetProperty(NS_ConvertASCIItoUCS2("font"), aFont, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontFamily(nsString& aFontFamily) +nsDOMCSSDeclaration::GetFontFamily(nsAWritableString& aFontFamily) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-family"), aFontFamily); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontFamily(const nsString& aFontFamily) +nsDOMCSSDeclaration::SetFontFamily(const nsAReadableString& aFontFamily) { return SetProperty(NS_ConvertASCIItoUCS2("font-family"), aFontFamily, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontSize(nsString& aFontSize) +nsDOMCSSDeclaration::GetFontSize(nsAWritableString& aFontSize) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-size"), aFontSize); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontSize(const nsString& aFontSize) +nsDOMCSSDeclaration::SetFontSize(const nsAReadableString& aFontSize) { return SetProperty(NS_ConvertASCIItoUCS2("font-size"), aFontSize, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontSizeAdjust(nsString& aFontSizeAdjust) +nsDOMCSSDeclaration::GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-size-adjust"), aFontSizeAdjust); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontSizeAdjust(const nsString& aFontSizeAdjust) +nsDOMCSSDeclaration::SetFontSizeAdjust(const nsAReadableString& aFontSizeAdjust) { return SetProperty(NS_ConvertASCIItoUCS2("font-size-adjust"), aFontSizeAdjust, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontStretch(nsString& aFontStretch) +nsDOMCSSDeclaration::GetFontStretch(nsAWritableString& aFontStretch) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-stretch"), aFontStretch); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontStretch(const nsString& aFontStretch) +nsDOMCSSDeclaration::SetFontStretch(const nsAReadableString& aFontStretch) { return SetProperty(NS_ConvertASCIItoUCS2("font-stretch"), aFontStretch, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontStyle(nsString& aFontStyle) +nsDOMCSSDeclaration::GetFontStyle(nsAWritableString& aFontStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-style"), aFontStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontStyle(const nsString& aFontStyle) +nsDOMCSSDeclaration::SetFontStyle(const nsAReadableString& aFontStyle) { return SetProperty(NS_ConvertASCIItoUCS2("font-style"), aFontStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontVariant(nsString& aFontVariant) +nsDOMCSSDeclaration::GetFontVariant(nsAWritableString& aFontVariant) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-variant"), aFontVariant); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontVariant(const nsString& aFontVariant) +nsDOMCSSDeclaration::SetFontVariant(const nsAReadableString& aFontVariant) { return SetProperty(NS_ConvertASCIItoUCS2("font-variant"), aFontVariant, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontWeight(nsString& aFontWeight) +nsDOMCSSDeclaration::GetFontWeight(nsAWritableString& aFontWeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-weight"), aFontWeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontWeight(const nsString& aFontWeight) +nsDOMCSSDeclaration::SetFontWeight(const nsAReadableString& aFontWeight) { return SetProperty(NS_ConvertASCIItoUCS2("font-weight"), aFontWeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetHeight(nsString& aHeight) +nsDOMCSSDeclaration::GetHeight(nsAWritableString& aHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("height"), aHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetHeight(const nsString& aHeight) +nsDOMCSSDeclaration::SetHeight(const nsAReadableString& aHeight) { return SetProperty(NS_ConvertASCIItoUCS2("height"), aHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLeft(nsString& aLeft) +nsDOMCSSDeclaration::GetLeft(nsAWritableString& aLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("left"), aLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLeft(const nsString& aLeft) +nsDOMCSSDeclaration::SetLeft(const nsAReadableString& aLeft) { return SetProperty(NS_ConvertASCIItoUCS2("left"), aLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLetterSpacing(nsString& aLetterSpacing) +nsDOMCSSDeclaration::GetLetterSpacing(nsAWritableString& aLetterSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("letter-spacing"), aLetterSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLetterSpacing(const nsString& aLetterSpacing) +nsDOMCSSDeclaration::SetLetterSpacing(const nsAReadableString& aLetterSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("letter-spacing"), aLetterSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLineHeight(nsString& aLineHeight) +nsDOMCSSDeclaration::GetLineHeight(nsAWritableString& aLineHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("line-height"), aLineHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLineHeight(const nsString& aLineHeight) +nsDOMCSSDeclaration::SetLineHeight(const nsAReadableString& aLineHeight) { return SetProperty(NS_ConvertASCIItoUCS2("line-height"), aLineHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyle(nsString& aListStyle) +nsDOMCSSDeclaration::GetListStyle(nsAWritableString& aListStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style"), aListStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyle(const nsString& aListStyle) +nsDOMCSSDeclaration::SetListStyle(const nsAReadableString& aListStyle) { return SetProperty(NS_ConvertASCIItoUCS2("list-style"), aListStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyleImage(nsString& aListStyleImage) +nsDOMCSSDeclaration::GetListStyleImage(nsAWritableString& aListStyleImage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-image"), aListStyleImage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyleImage(const nsString& aListStyleImage) +nsDOMCSSDeclaration::SetListStyleImage(const nsAReadableString& aListStyleImage) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-image"), aListStyleImage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStylePosition(nsString& aListStylePosition) +nsDOMCSSDeclaration::GetListStylePosition(nsAWritableString& aListStylePosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-position"), aListStylePosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStylePosition(const nsString& aListStylePosition) +nsDOMCSSDeclaration::SetListStylePosition(const nsAReadableString& aListStylePosition) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-position"), aListStylePosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyleType(nsString& aListStyleType) +nsDOMCSSDeclaration::GetListStyleType(nsAWritableString& aListStyleType) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-type"), aListStyleType); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyleType(const nsString& aListStyleType) +nsDOMCSSDeclaration::SetListStyleType(const nsAReadableString& aListStyleType) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-type"), aListStyleType, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMargin(nsString& aMargin) +nsDOMCSSDeclaration::GetMargin(nsAWritableString& aMargin) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin"), aMargin); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMargin(const nsString& aMargin) +nsDOMCSSDeclaration::SetMargin(const nsAReadableString& aMargin) { return SetProperty(NS_ConvertASCIItoUCS2("margin"), aMargin, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginTop(nsString& aMarginTop) +nsDOMCSSDeclaration::GetMarginTop(nsAWritableString& aMarginTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-top"), aMarginTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginTop(const nsString& aMarginTop) +nsDOMCSSDeclaration::SetMarginTop(const nsAReadableString& aMarginTop) { return SetProperty(NS_ConvertASCIItoUCS2("margin-top"), aMarginTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginRight(nsString& aMarginRight) +nsDOMCSSDeclaration::GetMarginRight(nsAWritableString& aMarginRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-right"), aMarginRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginRight(const nsString& aMarginRight) +nsDOMCSSDeclaration::SetMarginRight(const nsAReadableString& aMarginRight) { return SetProperty(NS_ConvertASCIItoUCS2("margin-right"), aMarginRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginBottom(nsString& aMarginBottom) +nsDOMCSSDeclaration::GetMarginBottom(nsAWritableString& aMarginBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-bottom"), aMarginBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginBottom(const nsString& aMarginBottom) +nsDOMCSSDeclaration::SetMarginBottom(const nsAReadableString& aMarginBottom) { return SetProperty(NS_ConvertASCIItoUCS2("margin-bottom"), aMarginBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginLeft(nsString& aMarginLeft) +nsDOMCSSDeclaration::GetMarginLeft(nsAWritableString& aMarginLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-left"), aMarginLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginLeft(const nsString& aMarginLeft) +nsDOMCSSDeclaration::SetMarginLeft(const nsAReadableString& aMarginLeft) { return SetProperty(NS_ConvertASCIItoUCS2("margin-left"), aMarginLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarkerOffset(nsString& aMarkerOffset) +nsDOMCSSDeclaration::GetMarkerOffset(nsAWritableString& aMarkerOffset) { return GetPropertyValue(NS_ConvertASCIItoUCS2("marker-offset"), aMarkerOffset); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarkerOffset(const nsString& aMarkerOffset) +nsDOMCSSDeclaration::SetMarkerOffset(const nsAReadableString& aMarkerOffset) { return SetProperty(NS_ConvertASCIItoUCS2("marker-offset"), aMarkerOffset, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarks(nsString& aMarks) +nsDOMCSSDeclaration::GetMarks(nsAWritableString& aMarks) { return GetPropertyValue(NS_ConvertASCIItoUCS2("marks"), aMarks); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarks(const nsString& aMarks) +nsDOMCSSDeclaration::SetMarks(const nsAReadableString& aMarks) { return SetProperty(NS_ConvertASCIItoUCS2("marks"), aMarks, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMaxHeight(nsString& aMaxHeight) +nsDOMCSSDeclaration::GetMaxHeight(nsAWritableString& aMaxHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("max-height"), aMaxHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMaxHeight(const nsString& aMaxHeight) +nsDOMCSSDeclaration::SetMaxHeight(const nsAReadableString& aMaxHeight) { return SetProperty(NS_ConvertASCIItoUCS2("max-height"), aMaxHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMaxWidth(nsString& aMaxWidth) +nsDOMCSSDeclaration::GetMaxWidth(nsAWritableString& aMaxWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("max-width"), aMaxWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMaxWidth(const nsString& aMaxWidth) +nsDOMCSSDeclaration::SetMaxWidth(const nsAReadableString& aMaxWidth) { return SetProperty(NS_ConvertASCIItoUCS2("max-width"), aMaxWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMinHeight(nsString& aMinHeight) +nsDOMCSSDeclaration::GetMinHeight(nsAWritableString& aMinHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("min-height"), aMinHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMinHeight(const nsString& aMinHeight) +nsDOMCSSDeclaration::SetMinHeight(const nsAReadableString& aMinHeight) { return SetProperty(NS_ConvertASCIItoUCS2("min-height"), aMinHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMinWidth(nsString& aMinWidth) +nsDOMCSSDeclaration::GetMinWidth(nsAWritableString& aMinWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("min-width"), aMinWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMinWidth(const nsString& aMinWidth) +nsDOMCSSDeclaration::SetMinWidth(const nsAReadableString& aMinWidth) { return SetProperty(NS_ConvertASCIItoUCS2("min-width"), aMinWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOrphans(nsString& aOrphans) +nsDOMCSSDeclaration::GetOrphans(nsAWritableString& aOrphans) { return GetPropertyValue(NS_ConvertASCIItoUCS2("orphans"), aOrphans); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOrphans(const nsString& aOrphans) +nsDOMCSSDeclaration::SetOrphans(const nsAReadableString& aOrphans) { return SetProperty(NS_ConvertASCIItoUCS2("orphans"), aOrphans, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutline(nsString& aOutline) +nsDOMCSSDeclaration::GetOutline(nsAWritableString& aOutline) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline"), aOutline); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutline(const nsString& aOutline) +nsDOMCSSDeclaration::SetOutline(const nsAReadableString& aOutline) { return SetProperty(NS_ConvertASCIItoUCS2("outline"), aOutline, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineColor(nsString& aOutlineColor) +nsDOMCSSDeclaration::GetOutlineColor(nsAWritableString& aOutlineColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-color"), aOutlineColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineColor(const nsString& aOutlineColor) +nsDOMCSSDeclaration::SetOutlineColor(const nsAReadableString& aOutlineColor) { return SetProperty(NS_ConvertASCIItoUCS2("outline-color"), aOutlineColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineStyle(nsString& aOutlineStyle) +nsDOMCSSDeclaration::GetOutlineStyle(nsAWritableString& aOutlineStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-style"), aOutlineStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineStyle(const nsString& aOutlineStyle) +nsDOMCSSDeclaration::SetOutlineStyle(const nsAReadableString& aOutlineStyle) { return SetProperty(NS_ConvertASCIItoUCS2("outline-style"), aOutlineStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineWidth(nsString& aOutlineWidth) +nsDOMCSSDeclaration::GetOutlineWidth(nsAWritableString& aOutlineWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-width"), aOutlineWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineWidth(const nsString& aOutlineWidth) +nsDOMCSSDeclaration::SetOutlineWidth(const nsAReadableString& aOutlineWidth) { return SetProperty(NS_ConvertASCIItoUCS2("outline-width"), aOutlineWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOverflow(nsString& aOverflow) +nsDOMCSSDeclaration::GetOverflow(nsAWritableString& aOverflow) { return GetPropertyValue(NS_ConvertASCIItoUCS2("overflow"), aOverflow); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOverflow(const nsString& aOverflow) +nsDOMCSSDeclaration::SetOverflow(const nsAReadableString& aOverflow) { return SetProperty(NS_ConvertASCIItoUCS2("overflow"), aOverflow, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPadding(nsString& aPadding) +nsDOMCSSDeclaration::GetPadding(nsAWritableString& aPadding) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding"), aPadding); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPadding(const nsString& aPadding) +nsDOMCSSDeclaration::SetPadding(const nsAReadableString& aPadding) { return SetProperty(NS_ConvertASCIItoUCS2("padding"), aPadding, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingTop(nsString& aPaddingTop) +nsDOMCSSDeclaration::GetPaddingTop(nsAWritableString& aPaddingTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-top"), aPaddingTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingTop(const nsString& aPaddingTop) +nsDOMCSSDeclaration::SetPaddingTop(const nsAReadableString& aPaddingTop) { return SetProperty(NS_ConvertASCIItoUCS2("padding-top"), aPaddingTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingRight(nsString& aPaddingRight) +nsDOMCSSDeclaration::GetPaddingRight(nsAWritableString& aPaddingRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-right"), aPaddingRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingRight(const nsString& aPaddingRight) +nsDOMCSSDeclaration::SetPaddingRight(const nsAReadableString& aPaddingRight) { return SetProperty(NS_ConvertASCIItoUCS2("padding-right"), aPaddingRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingBottom(nsString& aPaddingBottom) +nsDOMCSSDeclaration::GetPaddingBottom(nsAWritableString& aPaddingBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-bottom"), aPaddingBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingBottom(const nsString& aPaddingBottom) +nsDOMCSSDeclaration::SetPaddingBottom(const nsAReadableString& aPaddingBottom) { return SetProperty(NS_ConvertASCIItoUCS2("padding-bottom"), aPaddingBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingLeft(nsString& aPaddingLeft) +nsDOMCSSDeclaration::GetPaddingLeft(nsAWritableString& aPaddingLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-left"), aPaddingLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingLeft(const nsString& aPaddingLeft) +nsDOMCSSDeclaration::SetPaddingLeft(const nsAReadableString& aPaddingLeft) { return SetProperty(NS_ConvertASCIItoUCS2("padding-left"), aPaddingLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPage(nsString& aPage) +nsDOMCSSDeclaration::GetPage(nsAWritableString& aPage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page"), aPage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPage(const nsString& aPage) +nsDOMCSSDeclaration::SetPage(const nsAReadableString& aPage) { return SetProperty(NS_ConvertASCIItoUCS2("page"), aPage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakAfter(nsString& aPageBreakAfter) +nsDOMCSSDeclaration::GetPageBreakAfter(nsAWritableString& aPageBreakAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-after"), aPageBreakAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakAfter(const nsString& aPageBreakAfter) +nsDOMCSSDeclaration::SetPageBreakAfter(const nsAReadableString& aPageBreakAfter) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-after"), aPageBreakAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakBefore(nsString& aPageBreakBefore) +nsDOMCSSDeclaration::GetPageBreakBefore(nsAWritableString& aPageBreakBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-before"), aPageBreakBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakBefore(const nsString& aPageBreakBefore) +nsDOMCSSDeclaration::SetPageBreakBefore(const nsAReadableString& aPageBreakBefore) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-before"), aPageBreakBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakInside(nsString& aPageBreakInside) +nsDOMCSSDeclaration::GetPageBreakInside(nsAWritableString& aPageBreakInside) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-inside"), aPageBreakInside); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakInside(const nsString& aPageBreakInside) +nsDOMCSSDeclaration::SetPageBreakInside(const nsAReadableString& aPageBreakInside) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-inside"), aPageBreakInside, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPause(nsString& aPause) +nsDOMCSSDeclaration::GetPause(nsAWritableString& aPause) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause"), aPause); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPause(const nsString& aPause) +nsDOMCSSDeclaration::SetPause(const nsAReadableString& aPause) { return SetProperty(NS_ConvertASCIItoUCS2("pause"), aPause, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPauseAfter(nsString& aPauseAfter) +nsDOMCSSDeclaration::GetPauseAfter(nsAWritableString& aPauseAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause-after"), aPauseAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPauseAfter(const nsString& aPauseAfter) +nsDOMCSSDeclaration::SetPauseAfter(const nsAReadableString& aPauseAfter) { return SetProperty(NS_ConvertASCIItoUCS2("pause-after"), aPauseAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPauseBefore(nsString& aPauseBefore) +nsDOMCSSDeclaration::GetPauseBefore(nsAWritableString& aPauseBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause-before"), aPauseBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPauseBefore(const nsString& aPauseBefore) +nsDOMCSSDeclaration::SetPauseBefore(const nsAReadableString& aPauseBefore) { return SetProperty(NS_ConvertASCIItoUCS2("pause-before"), aPauseBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPitch(nsString& aPitch) +nsDOMCSSDeclaration::GetPitch(nsAWritableString& aPitch) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pitch"), aPitch); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPitch(const nsString& aPitch) +nsDOMCSSDeclaration::SetPitch(const nsAReadableString& aPitch) { return SetProperty(NS_ConvertASCIItoUCS2("pitch"), aPitch, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPitchRange(nsString& aPitchRange) +nsDOMCSSDeclaration::GetPitchRange(nsAWritableString& aPitchRange) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pitch-range"), aPitchRange); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPitchRange(const nsString& aPitchRange) +nsDOMCSSDeclaration::SetPitchRange(const nsAReadableString& aPitchRange) { return SetProperty(NS_ConvertASCIItoUCS2("pitch-range"), aPitchRange, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPlayDuring(nsString& aPlayDuring) +nsDOMCSSDeclaration::GetPlayDuring(nsAWritableString& aPlayDuring) { return GetPropertyValue(NS_ConvertASCIItoUCS2("play-during"), aPlayDuring); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPlayDuring(const nsString& aPlayDuring) +nsDOMCSSDeclaration::SetPlayDuring(const nsAReadableString& aPlayDuring) { return SetProperty(NS_ConvertASCIItoUCS2("play-during"), aPlayDuring, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPosition(nsString& aPosition) +nsDOMCSSDeclaration::GetPosition(nsAWritableString& aPosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("position"), aPosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPosition(const nsString& aPosition) +nsDOMCSSDeclaration::SetPosition(const nsAReadableString& aPosition) { return SetProperty(NS_ConvertASCIItoUCS2("position"), aPosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetQuotes(nsString& aQuotes) +nsDOMCSSDeclaration::GetQuotes(nsAWritableString& aQuotes) { return GetPropertyValue(NS_ConvertASCIItoUCS2("quotes"), aQuotes); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetQuotes(const nsString& aQuotes) +nsDOMCSSDeclaration::SetQuotes(const nsAReadableString& aQuotes) { return SetProperty(NS_ConvertASCIItoUCS2("quotes"), aQuotes, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetRichness(nsString& aRichness) +nsDOMCSSDeclaration::GetRichness(nsAWritableString& aRichness) { return GetPropertyValue(NS_ConvertASCIItoUCS2("richness"), aRichness); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetRichness(const nsString& aRichness) +nsDOMCSSDeclaration::SetRichness(const nsAReadableString& aRichness) { return SetProperty(NS_ConvertASCIItoUCS2("richness"), aRichness, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetRight(nsString& aRight) +nsDOMCSSDeclaration::GetRight(nsAWritableString& aRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("right"), aRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetRight(const nsString& aRight) +nsDOMCSSDeclaration::SetRight(const nsAReadableString& aRight) { return SetProperty(NS_ConvertASCIItoUCS2("right"), aRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSize(nsString& aSize) +nsDOMCSSDeclaration::GetSize(nsAWritableString& aSize) { return GetPropertyValue(NS_ConvertASCIItoUCS2("size"), aSize); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSize(const nsString& aSize) +nsDOMCSSDeclaration::SetSize(const nsAReadableString& aSize) { return SetProperty(NS_ConvertASCIItoUCS2("size"), aSize, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeak(nsString& aSpeak) +nsDOMCSSDeclaration::GetSpeak(nsAWritableString& aSpeak) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak"), aSpeak); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeak(const nsString& aSpeak) +nsDOMCSSDeclaration::SetSpeak(const nsAReadableString& aSpeak) { return SetProperty(NS_ConvertASCIItoUCS2("speak"), aSpeak, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakHeader(nsString& aSpeakHeader) +nsDOMCSSDeclaration::GetSpeakHeader(nsAWritableString& aSpeakHeader) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-header"), aSpeakHeader); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakHeader(const nsString& aSpeakHeader) +nsDOMCSSDeclaration::SetSpeakHeader(const nsAReadableString& aSpeakHeader) { return SetProperty(NS_ConvertASCIItoUCS2("speak-header"), aSpeakHeader, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakNumeral(nsString& aSpeakNumeral) +nsDOMCSSDeclaration::GetSpeakNumeral(nsAWritableString& aSpeakNumeral) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-numeral"), aSpeakNumeral); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakNumeral(const nsString& aSpeakNumeral) +nsDOMCSSDeclaration::SetSpeakNumeral(const nsAReadableString& aSpeakNumeral) { return SetProperty(NS_ConvertASCIItoUCS2("speak-numeral"), aSpeakNumeral, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakPunctuation(nsString& aSpeakPunctuation) +nsDOMCSSDeclaration::GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-punctuation"), aSpeakPunctuation); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakPunctuation(const nsString& aSpeakPunctuation) +nsDOMCSSDeclaration::SetSpeakPunctuation(const nsAReadableString& aSpeakPunctuation) { return SetProperty(NS_ConvertASCIItoUCS2("speak-punctuation"), aSpeakPunctuation, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeechRate(nsString& aSpeechRate) +nsDOMCSSDeclaration::GetSpeechRate(nsAWritableString& aSpeechRate) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speech-rate"), aSpeechRate); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeechRate(const nsString& aSpeechRate) +nsDOMCSSDeclaration::SetSpeechRate(const nsAReadableString& aSpeechRate) { return SetProperty(NS_ConvertASCIItoUCS2("speech-rate"), aSpeechRate, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetStress(nsString& aStress) +nsDOMCSSDeclaration::GetStress(nsAWritableString& aStress) { return GetPropertyValue(NS_ConvertASCIItoUCS2("stress"), aStress); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetStress(const nsString& aStress) +nsDOMCSSDeclaration::SetStress(const nsAReadableString& aStress) { return SetProperty(NS_ConvertASCIItoUCS2("stress"), aStress, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTableLayout(nsString& aTableLayout) +nsDOMCSSDeclaration::GetTableLayout(nsAWritableString& aTableLayout) { return GetPropertyValue(NS_ConvertASCIItoUCS2("table-layout"), aTableLayout); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTableLayout(const nsString& aTableLayout) +nsDOMCSSDeclaration::SetTableLayout(const nsAReadableString& aTableLayout) { return SetProperty(NS_ConvertASCIItoUCS2("table-layout"), aTableLayout, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextAlign(nsString& aTextAlign) +nsDOMCSSDeclaration::GetTextAlign(nsAWritableString& aTextAlign) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-align"), aTextAlign); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextAlign(const nsString& aTextAlign) +nsDOMCSSDeclaration::SetTextAlign(const nsAReadableString& aTextAlign) { return SetProperty(NS_ConvertASCIItoUCS2("text-align"), aTextAlign, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextDecoration(nsString& aTextDecoration) +nsDOMCSSDeclaration::GetTextDecoration(nsAWritableString& aTextDecoration) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-decoration"), aTextDecoration); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextDecoration(const nsString& aTextDecoration) +nsDOMCSSDeclaration::SetTextDecoration(const nsAReadableString& aTextDecoration) { return SetProperty(NS_ConvertASCIItoUCS2("text-decoration"), aTextDecoration, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextIndent(nsString& aTextIndent) +nsDOMCSSDeclaration::GetTextIndent(nsAWritableString& aTextIndent) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-indent"), aTextIndent); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextIndent(const nsString& aTextIndent) +nsDOMCSSDeclaration::SetTextIndent(const nsAReadableString& aTextIndent) { return SetProperty(NS_ConvertASCIItoUCS2("text-indent"), aTextIndent, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextShadow(nsString& aTextShadow) +nsDOMCSSDeclaration::GetTextShadow(nsAWritableString& aTextShadow) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-shadow"), aTextShadow); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextShadow(const nsString& aTextShadow) +nsDOMCSSDeclaration::SetTextShadow(const nsAReadableString& aTextShadow) { return SetProperty(NS_ConvertASCIItoUCS2("text-shadow"), aTextShadow, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextTransform(nsString& aTextTransform) +nsDOMCSSDeclaration::GetTextTransform(nsAWritableString& aTextTransform) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-transform"), aTextTransform); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextTransform(const nsString& aTextTransform) +nsDOMCSSDeclaration::SetTextTransform(const nsAReadableString& aTextTransform) { return SetProperty(NS_ConvertASCIItoUCS2("text-transform"), aTextTransform, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTop(nsString& aTop) +nsDOMCSSDeclaration::GetTop(nsAWritableString& aTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("top"), aTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTop(const nsString& aTop) +nsDOMCSSDeclaration::SetTop(const nsAReadableString& aTop) { return SetProperty(NS_ConvertASCIItoUCS2("top"), aTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetUnicodeBidi(nsString& aUnicodeBidi) +nsDOMCSSDeclaration::GetUnicodeBidi(nsAWritableString& aUnicodeBidi) { return GetPropertyValue(NS_ConvertASCIItoUCS2("unicode-bidi"), aUnicodeBidi); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetUnicodeBidi(const nsString& aUnicodeBidi) +nsDOMCSSDeclaration::SetUnicodeBidi(const nsAReadableString& aUnicodeBidi) { return SetProperty(NS_ConvertASCIItoUCS2("unicode-bidi"), aUnicodeBidi, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVerticalAlign(nsString& aVerticalAlign) +nsDOMCSSDeclaration::GetVerticalAlign(nsAWritableString& aVerticalAlign) { return GetPropertyValue(NS_ConvertASCIItoUCS2("vertical-align"), aVerticalAlign); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVerticalAlign(const nsString& aVerticalAlign) +nsDOMCSSDeclaration::SetVerticalAlign(const nsAReadableString& aVerticalAlign) { return SetProperty(NS_ConvertASCIItoUCS2("vertical-align"), aVerticalAlign, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVisibility(nsString& aVisibility) +nsDOMCSSDeclaration::GetVisibility(nsAWritableString& aVisibility) { return GetPropertyValue(NS_ConvertASCIItoUCS2("visibility"), aVisibility); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVisibility(const nsString& aVisibility) +nsDOMCSSDeclaration::SetVisibility(const nsAReadableString& aVisibility) { return SetProperty(NS_ConvertASCIItoUCS2("visibility"), aVisibility, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVoiceFamily(nsString& aVoiceFamily) +nsDOMCSSDeclaration::GetVoiceFamily(nsAWritableString& aVoiceFamily) { return GetPropertyValue(NS_ConvertASCIItoUCS2("voice-family"), aVoiceFamily); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVoiceFamily(const nsString& aVoiceFamily) +nsDOMCSSDeclaration::SetVoiceFamily(const nsAReadableString& aVoiceFamily) { return SetProperty(NS_ConvertASCIItoUCS2("voice-family"), aVoiceFamily, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVolume(nsString& aVolume) +nsDOMCSSDeclaration::GetVolume(nsAWritableString& aVolume) { return GetPropertyValue(NS_ConvertASCIItoUCS2("volume"), aVolume); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVolume(const nsString& aVolume) +nsDOMCSSDeclaration::SetVolume(const nsAReadableString& aVolume) { return SetProperty(NS_ConvertASCIItoUCS2("volume"), aVolume, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWhiteSpace(nsString& aWhiteSpace) +nsDOMCSSDeclaration::GetWhiteSpace(nsAWritableString& aWhiteSpace) { return GetPropertyValue(NS_ConvertASCIItoUCS2("white-space"), aWhiteSpace); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWhiteSpace(const nsString& aWhiteSpace) +nsDOMCSSDeclaration::SetWhiteSpace(const nsAReadableString& aWhiteSpace) { return SetProperty(NS_ConvertASCIItoUCS2("white-space"), aWhiteSpace, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWidows(nsString& aWidows) +nsDOMCSSDeclaration::GetWidows(nsAWritableString& aWidows) { return GetPropertyValue(NS_ConvertASCIItoUCS2("widows"), aWidows); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWidows(const nsString& aWidows) +nsDOMCSSDeclaration::SetWidows(const nsAReadableString& aWidows) { return SetProperty(NS_ConvertASCIItoUCS2("widows"), aWidows, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWidth(nsString& aWidth) +nsDOMCSSDeclaration::GetWidth(nsAWritableString& aWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("width"), aWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWidth(const nsString& aWidth) +nsDOMCSSDeclaration::SetWidth(const nsAReadableString& aWidth) { return SetProperty(NS_ConvertASCIItoUCS2("width"), aWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWordSpacing(nsString& aWordSpacing) +nsDOMCSSDeclaration::GetWordSpacing(nsAWritableString& aWordSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("word-spacing"), aWordSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWordSpacing(const nsString& aWordSpacing) +nsDOMCSSDeclaration::SetWordSpacing(const nsAReadableString& aWordSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("word-spacing"), aWordSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetZIndex(nsString& aZIndex) +nsDOMCSSDeclaration::GetZIndex(nsAWritableString& aZIndex) { return GetPropertyValue(NS_ConvertASCIItoUCS2("z-index"), aZIndex); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetZIndex(const nsString& aZIndex) +nsDOMCSSDeclaration::SetZIndex(const nsAReadableString& aZIndex) { return SetProperty(NS_ConvertASCIItoUCS2("z-index"), aZIndex, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOpacity(nsString& aOpacity) +nsDOMCSSDeclaration::GetOpacity(nsAWritableString& aOpacity) { return GetPropertyValue(NS_ConvertASCIItoUCS2("opacity"), aOpacity); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOpacity(const nsString& aOpacity) +nsDOMCSSDeclaration::SetOpacity(const nsAReadableString& aOpacity) { return SetProperty(NS_ConvertASCIItoUCS2("opacity"), aOpacity, nsAutoString()); } diff --git a/content/html/style/src/nsDOMCSSDeclaration.h b/content/html/style/src/nsDOMCSSDeclaration.h index 7f51d0bbe0b6..d9fbc15d9606 100644 --- a/content/html/style/src/nsDOMCSSDeclaration.h +++ b/content/html/style/src/nsDOMCSSDeclaration.h @@ -39,21 +39,22 @@ public: NS_DECL_ISUPPORTS // NS_DECL_IDOMCSSSTYLEDECLARATION - NS_IMETHOD GetCssText(nsString& aCssText); - NS_IMETHOD SetCssText(const nsString& aCssText); + NS_IMETHOD GetCssText(nsAWritableString& aCssText); + NS_IMETHOD SetCssText(const nsAReadableString& aCssText); NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule); - NS_IMETHOD GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn); - NS_IMETHOD GetPropertyCSSValue(const nsString& aPropertyName, + NS_IMETHOD GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); + NS_IMETHOD GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) = 0; - NS_IMETHOD GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn); - NS_IMETHOD SetProperty(const nsString& aPropertyName, - const nsString& aValue, const nsString& aPriority); - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) = 0; + NS_IMETHOD GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); + NS_IMETHOD SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, const nsAReadableString& aPriority); + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn); + NS_DECL_IDOMCSS2PROPERTIES @@ -67,7 +68,7 @@ public: // Note! This will only set the declaration if a style rule already exists virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl) = 0; - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) = 0; virtual nsresult GetParent(nsISupports **aParent) = 0; diff --git a/content/html/style/src/nsHTMLAttributes.cpp b/content/html/style/src/nsHTMLAttributes.cpp index 8a902412cfba..2fc2c087ef20 100644 --- a/content/html/style/src/nsHTMLAttributes.cpp +++ b/content/html/style/src/nsHTMLAttributes.cpp @@ -823,7 +823,7 @@ public: nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet, PRInt32& aAttrCount); - NS_IMETHOD SetAttributeFor(nsIAtom* aAttrName, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttrName, const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet); @@ -987,7 +987,7 @@ NS_IMPL_QUERY_INTERFACE(HTMLAttributesImpl, kIHTMLAttributesIID); const PRUnichar kNullCh = PRUnichar('\0'); -static void ParseClasses(const nsString& aClassString, nsClassList& aClassList) +static void ParseClasses(const nsAReadableString& aClassString, nsClassList& aClassList) { nsAutoString classStr(aClassString); // copy to work buffer classStr.Append(kNullCh); // put an extra null at the end @@ -1154,7 +1154,7 @@ HTMLAttributesImpl::UniqueMapped(nsIHTMLStyleSheet* aSheet) } NS_IMETHODIMP -HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName, const nsString& aValue, +HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName, const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet) { diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index c877aa8dec07..f0970abff9dd 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -631,7 +631,8 @@ public: // Attribute management methods, aAttributes is an in/out param NS_IMETHOD SetAttributesFor(nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes); - NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, + const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes); @@ -1232,7 +1233,7 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent, nsI } NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes) diff --git a/content/html/style/src/nsHTMLValue.cpp b/content/html/style/src/nsHTMLValue.cpp index 86a8b2d6c687..6e7c540d03cc 100644 --- a/content/html/style/src/nsHTMLValue.cpp +++ b/content/html/style/src/nsHTMLValue.cpp @@ -22,6 +22,7 @@ #include "nsHTMLValue.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsISizeOfHandler.h" @@ -60,14 +61,14 @@ nsHTMLValue::nsHTMLValue(float aValue) mValue.mFloat = aValue; } -nsHTMLValue::nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit) +nsHTMLValue::nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit) : mUnit(aUnit) { NS_ASSERTION((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit), "not a string value"); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } else { mUnit = eHTMLUnit_Null; @@ -226,12 +227,13 @@ void nsHTMLValue::SetPercentValue(float aValue) mValue.mFloat = aValue; } -void nsHTMLValue::SetStringValue(const nsString& aValue, nsHTMLUnit aUnit) +void nsHTMLValue::SetStringValue(const nsAReadableString& aValue, + nsHTMLUnit aUnit) { Reset(); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { mUnit = aUnit; - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } } @@ -256,7 +258,7 @@ void nsHTMLValue::SetEmptyValue(void) mUnit = eHTMLUnit_Empty; } -void nsHTMLValue::AppendToString(nsString& aBuffer) const +void nsHTMLValue::AppendToString(nsAWritableString& aBuffer) const { if (eHTMLUnit_Null == mUnit) { return; @@ -266,37 +268,48 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); aBuffer.Append(mValue.mString); - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); } else { - aBuffer.AppendWithConversion("null str"); + aBuffer.Append(NS_LITERAL_STRING("null str")); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.AppendWithConversion("0x"); - aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(NS_LITERAL_STRING("0x")); + nsAutoString intStr; + intStr.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(intStr); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.AppendWithConversion("(0x"); - aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); - aBuffer.AppendWithConversion(')'); + nsAutoString intStr; + intStr.Append(NS_LITERAL_STRING("(0x")); + intStr.AppendInt(NS_GET_R(mValue.mColor), 16); + intStr.Append(intStr); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_G(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_B(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_A(mValue.mColor), 16); + intStr.Append(PRUnichar(')')); + + aBuffer.Append(intStr); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.AppendFloat(mValue.mFloat * 100.0f); + nsAutoString floatStr; + floatStr.AppendFloat(mValue.mFloat * 100.0f); + aBuffer.Append(floatStr); } else { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); + nsAutoString intStr; + intStr.AppendInt(mValue.mInt, 10); + intStr.Append(NS_LITERAL_STRING("[0x")); + intStr.AppendInt(mValue.mInt, 16); + intStr.Append(PRUnichar(']')); + + aBuffer.Append(intStr); } switch (mUnit) { @@ -304,18 +317,18 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.Append(NS_LITERAL_STRING("ptr")); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; - case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; - case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; + case eHTMLUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; + case eHTMLUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break; + case eHTMLUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; + case eHTMLUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; + case eHTMLUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; } - aBuffer.AppendWithConversion(' '); + aBuffer.Append(PRUnichar(' ')); } -void nsHTMLValue::ToString(nsString& aBuffer) const +void nsHTMLValue::ToString(nsAWritableString& aBuffer) const { aBuffer.Truncate(); AppendToString(aBuffer); diff --git a/content/html/style/src/nsHTMLValue.h b/content/html/style/src/nsHTMLValue.h index cfd8018c71ab..1c7ed08306f3 100644 --- a/content/html/style/src/nsHTMLValue.h +++ b/content/html/style/src/nsHTMLValue.h @@ -48,7 +48,7 @@ public: nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null); nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit); nsHTMLValue(float aValue); - nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); nsHTMLValue(nsISupports* aValue); nsHTMLValue(nscolor aValue); nsHTMLValue(const nsHTMLValue& aCopy); @@ -63,7 +63,7 @@ public: PRInt32 GetIntValue(void) const; PRInt32 GetPixelValue(void) const; float GetPercentValue(void) const; - nsString& GetStringValue(nsString& aBuffer) const; + nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; nsISupports* GetISupportsValue(void) const; nscolor GetColorValue(void) const; @@ -71,13 +71,13 @@ public: void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit); void SetPixelValue(PRInt32 aValue); void SetPercentValue(float aValue); - void SetStringValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + void SetStringValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); void SetISupportsValue(nsISupports* aValue); void SetColorValue(nscolor aValue); void SetEmptyValue(void); - void AppendToString(nsString& aBuffer) const; - void ToString(nsString& aBuffer) const; + void AppendToString(nsAWritableString& aBuffer) const; + void ToString(nsAWritableString& aBuffer) const; protected: nsHTMLUnit mUnit; @@ -129,7 +129,7 @@ inline float nsHTMLValue::GetPercentValue(void) const return 0.0f; } -inline nsString& nsHTMLValue::GetStringValue(nsString& aBuffer) const +inline nsAWritableString& nsHTMLValue::GetStringValue(nsAWritableString& aBuffer) const { NS_ASSERTION((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName) || (mUnit == eHTMLUnit_Null), "not a string value"); diff --git a/content/html/style/src/nsICSSDeclaration.h b/content/html/style/src/nsICSSDeclaration.h index be9e031275fd..6af7d069f699 100644 --- a/content/html/style/src/nsICSSDeclaration.h +++ b/content/html/style/src/nsICSSDeclaration.h @@ -391,28 +391,32 @@ public: NS_IMETHOD GetData(const nsID& aIID, nsCSSStruct** aData) = 0; NS_IMETHOD EnsureData(const nsID& aSID, nsCSSStruct** aData) = 0; - NS_IMETHOD AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue) = 0; + NS_IMETHOD AppendValue(nsCSSProperty aProperty, + const nsCSSValue& aValue) = 0; NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct) = 0; NS_IMETHOD SetValueImportant(nsCSSProperty aProperty) = 0; - NS_IMETHOD AppendComment(const nsString& aComment) = 0; + NS_IMETHOD AppendComment(const nsAReadableString& aComment) = 0; NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) = 0; // XXX make nscolor a struct to avoid type conflicts NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) = 0; - NS_IMETHOD GetValue(nsCSSProperty aProperty, nsString& aValue) = 0; - NS_IMETHOD GetValue(const nsString& aProperty, nsString& aValue) = 0; + NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue) = 0; + NS_IMETHOD GetValue(const nsAReadableString& aProperty, + nsAWritableString& aValue) = 0; NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult) = 0; - NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, PRBool& aIsImportant) = 0; - NS_IMETHOD GetValueIsImportant(const nsString& aProperty, PRBool& aIsImportant) = 0; + NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, + PRBool& aIsImportant) = 0; + NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty, + PRBool& aIsImportant) = 0; NS_IMETHOD Count(PRUint32* aCount) = 0; - NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsString& aReturn) = 0; + NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) = 0; NS_IMETHOD GetStyleImpact(PRInt32* aHint) const = 0; - NS_IMETHOD ToString(nsString& aString) = 0; + NS_IMETHOD ToString(nsAWritableString& aString) = 0; NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const = 0; diff --git a/content/html/style/src/nsIHTMLAttributes.h b/content/html/style/src/nsIHTMLAttributes.h index e270e77b7ea5..f1a2fa21abc8 100644 --- a/content/html/style/src/nsIHTMLAttributes.h +++ b/content/html/style/src/nsIHTMLAttributes.h @@ -51,7 +51,7 @@ public: PRInt32& aAttrCount) = 0; // this string value version lets you avoid an extra string copy, // the value is still stored in a nsHTMLValue - NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet) = 0; diff --git a/content/html/style/src/nsROCSSPrimitiveValue.cpp b/content/html/style/src/nsROCSSPrimitiveValue.cpp index 0c669e8a9c60..ae69759a2bae 100644 --- a/content/html/style/src/nsROCSSPrimitiveValue.cpp +++ b/content/html/style/src/nsROCSSPrimitiveValue.cpp @@ -85,16 +85,18 @@ nsROCSSPrimitiveValue::SetScriptObject(void* aScriptObject) NS_IMETHODIMP -nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) +nsROCSSPrimitiveValue::GetCssText(nsAWritableString& aCssText) { + nsAutoString tmpStr; + aCssText.Truncate(); switch (mType) { case CSS_PX : { PRInt32 px = NSTwipsToIntPixels(mTwips, mT2P); - aCssText.AppendInt(px); - aCssText.AppendWithConversion("px"); + tmpStr.AppendInt(px); + tmpStr.AppendWithConversion("px"); break; } @@ -103,7 +105,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_CENTIMETERS(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("cm"); + tmpStr.AppendWithConversion("cm"); break; } case CSS_MM : @@ -111,7 +113,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_MILLIMETERS(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("mm"); + tmpStr.AppendWithConversion("mm"); break; } case CSS_IN : @@ -119,7 +121,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_INCHES(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("in"); + tmpStr.AppendWithConversion("in"); break; } case CSS_PT : @@ -127,12 +129,12 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NSTwipsToFloatPoints(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("pt"); + tmpStr.AppendWithConversion("pt"); break; } case CSS_STRING : { - aCssText.Append(mString); + tmpStr.Append(mString); break; } case CSS_PC : @@ -158,12 +160,14 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) return NS_ERROR_DOM_INVALID_ACCESS_ERR; } + aCssText.Assign(tmpStr); + return NS_OK; } NS_IMETHODIMP -nsROCSSPrimitiveValue::SetCssText(const nsString& aCssText) +nsROCSSPrimitiveValue::SetCssText(const nsAReadableString& aCssText) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -253,16 +257,16 @@ nsROCSSPrimitiveValue::GetFloatValue(PRUint16 aUnitType, float* aReturn) NS_IMETHODIMP nsROCSSPrimitiveValue::SetStringValue(PRUint16 aStringType, - const nsString& aStringValue) + const nsAReadableString& aStringValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsROCSSPrimitiveValue::GetStringValue(nsString& aReturn) +nsROCSSPrimitiveValue::GetStringValue(nsAWritableString& aReturn) { - aReturn = mString; + aReturn.Assign(mString); return NS_OK; } diff --git a/content/shared/public/nsCSSProps.h b/content/shared/public/nsCSSProps.h index 316d3506d38b..4456b7bb82f5 100644 --- a/content/shared/public/nsCSSProps.h +++ b/content/shared/public/nsCSSProps.h @@ -23,9 +23,7 @@ #define nsCSSProps_h___ #include "nslayout.h" - -class nsCString; -class nsString; +#include "nsString.h" /* Declare the enum list using the magic of preprocessing @@ -49,7 +47,7 @@ public: static void ReleaseTable(void); // Given a property string, return the enum value - static nsCSSProperty LookupProperty(const nsString& aProperty); + static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); static nsCSSProperty LookupProperty(const nsCString& aProperty); // Given a property enum, get the string value diff --git a/content/shared/public/nsHTMLValue.h b/content/shared/public/nsHTMLValue.h index cfd8018c71ab..1c7ed08306f3 100644 --- a/content/shared/public/nsHTMLValue.h +++ b/content/shared/public/nsHTMLValue.h @@ -48,7 +48,7 @@ public: nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null); nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit); nsHTMLValue(float aValue); - nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); nsHTMLValue(nsISupports* aValue); nsHTMLValue(nscolor aValue); nsHTMLValue(const nsHTMLValue& aCopy); @@ -63,7 +63,7 @@ public: PRInt32 GetIntValue(void) const; PRInt32 GetPixelValue(void) const; float GetPercentValue(void) const; - nsString& GetStringValue(nsString& aBuffer) const; + nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; nsISupports* GetISupportsValue(void) const; nscolor GetColorValue(void) const; @@ -71,13 +71,13 @@ public: void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit); void SetPixelValue(PRInt32 aValue); void SetPercentValue(float aValue); - void SetStringValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + void SetStringValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); void SetISupportsValue(nsISupports* aValue); void SetColorValue(nscolor aValue); void SetEmptyValue(void); - void AppendToString(nsString& aBuffer) const; - void ToString(nsString& aBuffer) const; + void AppendToString(nsAWritableString& aBuffer) const; + void ToString(nsAWritableString& aBuffer) const; protected: nsHTMLUnit mUnit; @@ -129,7 +129,7 @@ inline float nsHTMLValue::GetPercentValue(void) const return 0.0f; } -inline nsString& nsHTMLValue::GetStringValue(nsString& aBuffer) const +inline nsAWritableString& nsHTMLValue::GetStringValue(nsAWritableString& aBuffer) const { NS_ASSERTION((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName) || (mUnit == eHTMLUnit_Null), "not a string value"); diff --git a/content/shared/public/nsTextFragment.h b/content/shared/public/nsTextFragment.h index defc9f16aab2..52ccecd47637 100644 --- a/content/shared/public/nsTextFragment.h +++ b/content/shared/public/nsTextFragment.h @@ -23,6 +23,7 @@ #define nsTextFragment_h___ #include "nslayout.h" +#include "nsAWritableString.h" class nsString; // XXX should this normalize the code to keep a \u0000 at the end? @@ -112,7 +113,7 @@ public: * Change the contents of this fragment to be a copy of the * the argument string. */ - nsTextFragment& operator=(const nsString& aString); + nsTextFragment& operator=(const nsAReadableString& aString); /** * Return PR_TRUE if this fragment is represented by PRUnichar data @@ -166,8 +167,8 @@ public: /** * Change the contents of this fragment to be the given buffer and * length. The memory becomes owned by the fragment. In addition, - * the memory for aBuffer must have been allocated using the "new[]" - * because it will be released with "delete []". + * the memory for aBuffer must have been allocated using the + * nsIMemory interface. */ void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease); diff --git a/content/shared/src/nsCSSProps.cpp b/content/shared/src/nsCSSProps.cpp index 8b4c3180d963..cbff90538574 100644 --- a/content/shared/src/nsCSSProps.cpp +++ b/content/shared/src/nsCSSProps.cpp @@ -86,13 +86,9 @@ nsCSSProps::LookupProperty(const nsCString& aProperty) } nsCSSProperty -nsCSSProps::LookupProperty(const nsString& aProperty) -{ - NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); - if (gPropertyTable) { - return nsCSSProperty(gPropertyTable->Lookup(aProperty)); - } - return eCSSProperty_UNKNOWN; +nsCSSProps::LookupProperty(const nsAReadableString& aProperty) { + nsCAutoString theProp; theProp.AssignWithConversion(aProperty); + return LookupProperty(theProp); } const nsCString& diff --git a/content/shared/src/nsHTMLValue.cpp b/content/shared/src/nsHTMLValue.cpp index 86a8b2d6c687..6e7c540d03cc 100644 --- a/content/shared/src/nsHTMLValue.cpp +++ b/content/shared/src/nsHTMLValue.cpp @@ -22,6 +22,7 @@ #include "nsHTMLValue.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsISizeOfHandler.h" @@ -60,14 +61,14 @@ nsHTMLValue::nsHTMLValue(float aValue) mValue.mFloat = aValue; } -nsHTMLValue::nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit) +nsHTMLValue::nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit) : mUnit(aUnit) { NS_ASSERTION((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit), "not a string value"); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } else { mUnit = eHTMLUnit_Null; @@ -226,12 +227,13 @@ void nsHTMLValue::SetPercentValue(float aValue) mValue.mFloat = aValue; } -void nsHTMLValue::SetStringValue(const nsString& aValue, nsHTMLUnit aUnit) +void nsHTMLValue::SetStringValue(const nsAReadableString& aValue, + nsHTMLUnit aUnit) { Reset(); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { mUnit = aUnit; - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } } @@ -256,7 +258,7 @@ void nsHTMLValue::SetEmptyValue(void) mUnit = eHTMLUnit_Empty; } -void nsHTMLValue::AppendToString(nsString& aBuffer) const +void nsHTMLValue::AppendToString(nsAWritableString& aBuffer) const { if (eHTMLUnit_Null == mUnit) { return; @@ -266,37 +268,48 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); aBuffer.Append(mValue.mString); - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); } else { - aBuffer.AppendWithConversion("null str"); + aBuffer.Append(NS_LITERAL_STRING("null str")); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.AppendWithConversion("0x"); - aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(NS_LITERAL_STRING("0x")); + nsAutoString intStr; + intStr.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(intStr); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.AppendWithConversion("(0x"); - aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); - aBuffer.AppendWithConversion(')'); + nsAutoString intStr; + intStr.Append(NS_LITERAL_STRING("(0x")); + intStr.AppendInt(NS_GET_R(mValue.mColor), 16); + intStr.Append(intStr); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_G(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_B(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_A(mValue.mColor), 16); + intStr.Append(PRUnichar(')')); + + aBuffer.Append(intStr); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.AppendFloat(mValue.mFloat * 100.0f); + nsAutoString floatStr; + floatStr.AppendFloat(mValue.mFloat * 100.0f); + aBuffer.Append(floatStr); } else { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); + nsAutoString intStr; + intStr.AppendInt(mValue.mInt, 10); + intStr.Append(NS_LITERAL_STRING("[0x")); + intStr.AppendInt(mValue.mInt, 16); + intStr.Append(PRUnichar(']')); + + aBuffer.Append(intStr); } switch (mUnit) { @@ -304,18 +317,18 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.Append(NS_LITERAL_STRING("ptr")); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; - case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; - case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; + case eHTMLUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; + case eHTMLUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break; + case eHTMLUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; + case eHTMLUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; + case eHTMLUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; } - aBuffer.AppendWithConversion(' '); + aBuffer.Append(PRUnichar(' ')); } -void nsHTMLValue::ToString(nsString& aBuffer) const +void nsHTMLValue::ToString(nsAWritableString& aBuffer) const { aBuffer.Truncate(); AppendToString(aBuffer); diff --git a/content/shared/src/nsTextFragment.cpp b/content/shared/src/nsTextFragment.cpp index 43ea0a63c3b9..fad38cd3065c 100644 --- a/content/shared/src/nsTextFragment.cpp +++ b/content/shared/src/nsTextFragment.cpp @@ -22,6 +22,8 @@ #include "nsTextFragment.h" #include "nsString.h" #include "nsCRT.h" +#include "nsReadableUtils.h" +#include "nsMemory.h" nsTextFragment::~nsTextFragment() { @@ -33,10 +35,10 @@ nsTextFragment::ReleaseText() { if (mState.mLength && m1b && mState.mInHeap) { if (mState.mIs2b) { - delete [] m2b; + nsMemory::Free(m2b); } else { - delete [] m1b; + nsMemory::Free(m1b); } } m1b = nsnull; @@ -105,9 +107,24 @@ nsTextFragment::operator=(const PRUnichar* aString) } nsTextFragment& -nsTextFragment::operator=(const nsString& aString) +nsTextFragment::operator=(const nsAReadableString& aString) { - SetTo(aString.GetUnicode(), aString.Length()); + ReleaseText(); + + PRUint32 length = aString.Length(); + if (length > 0) { + if (IsASCII(aString)) { + m1b = NS_REINTERPRET_CAST(unsigned char *, ToNewCString(aString)); + mState.mIs2b = 0; + } + else { + m2b = ToNewUnicode(aString); + mState.mIs2b = 1; + } + mState.mInHeap = 1; + mState.mLength = (PRInt32)length; + } + return *this; } @@ -141,7 +158,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength) if (need2) { // Use ucs2 storage because we have to - PRUnichar* nt = new PRUnichar[aLength]; + PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar)); if (nsnull != nt) { // Copy data nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength); @@ -155,7 +172,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength) } else { // Use 1 byte storage because we can - unsigned char* nt = new unsigned char[aLength]; + unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); if (nsnull != nt) { // Copy data unsigned char* cp = nt; @@ -179,7 +196,7 @@ nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength) { ReleaseText(); if (0 != aLength) { - unsigned char* nt = new unsigned char[aLength]; + unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); if (nsnull != nt) { nsCRT::memcpy(nt, aBuffer, sizeof(unsigned char) * aLength); diff --git a/content/xbl/public/nsIBindingManager.h b/content/xbl/public/nsIBindingManager.h index 985b21d298bd..e33153fc7b5f 100644 --- a/content/xbl/public/nsIBindingManager.h +++ b/content/xbl/public/nsIBindingManager.h @@ -59,9 +59,9 @@ public: NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult, PRBool* aMultipleInsertionPoints) = 0; - NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsString& aURL) = 0; - NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsString& aURL) = 0; - NS_IMETHOD LoadBindingDocument(nsIDocument* aDocument, const nsString& aURL) = 0; + NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) = 0; + NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) = 0; + NS_IMETHOD LoadBindingDocument(nsIDocument* aDocument, const nsAReadableString& aURL) = 0; NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding)=0; NS_IMETHOD ClearAttachedQueue()=0; diff --git a/content/xbl/public/nsIXBLService.h b/content/xbl/public/nsIXBLService.h index 045973e809c4..ae94b4915399 100644 --- a/content/xbl/public/nsIXBLService.h +++ b/content/xbl/public/nsIXBLService.h @@ -51,7 +51,7 @@ public: // This function loads a particular XBL file and installs all of the bindings // onto the element. - NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aAugmentFlag, + NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag, nsIXBLBinding** aBinding) = 0; // This function clears out the bindings on a given content node. diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index 89d3a7e87cbf..4b3e86b4d130 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -163,9 +163,9 @@ public: NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult, PRBool* aMultipleInsertionPoints); - NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsString& aURL); - NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsString& aURL); - NS_IMETHOD LoadBindingDocument(nsIDocument* aBoundDoc, const nsString& aURL); + NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL); + NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL); + NS_IMETHOD LoadBindingDocument(nsIDocument* aBoundDoc, const nsAReadableString& aURL); NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding); NS_IMETHOD ClearAttachedQueue(); @@ -314,7 +314,7 @@ nsBindingManager::GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aRes } NS_IMETHODIMP -nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsString& aURL) +nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) { // First we need to load our binding. nsresult rv; @@ -334,7 +334,7 @@ nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsString& aURL) } NS_IMETHODIMP -nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, const nsString& aURL) +nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) { /* nsCOMPtr binding; @@ -371,7 +371,7 @@ nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, const nsString& aUR } NS_IMETHODIMP -nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, const nsString& aURL) +nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, const nsAReadableString& aURL) { // First we need to load our binding. nsresult rv; @@ -380,7 +380,7 @@ nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, const nsString& aU return rv; // Load the binding doc. - nsCString url; url.AssignWithConversion(aURL); + nsCString url; url.AssignWithConversion((const PRUnichar*)nsPromiseFlatString(aURL)); nsCOMPtr info; xblService->LoadBindingDocumentInfo(nsnull, aBoundDoc, url, nsCAutoString(), PR_TRUE, getter_AddRefs(info)); if (!info) diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index 374329928f24..0f2e0e4fce1a 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -577,7 +577,7 @@ nsXBLService::~nsXBLService(void) // This function loads a particular XBL file and installs all of the bindings // onto the element. NS_IMETHODIMP -nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aAugmentFlag, +nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag, nsIXBLBinding** aBinding) { *aBinding = nsnull; @@ -605,7 +605,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aA // See if the URIs match. nsCAutoString uri; styleBinding->GetBindingURI(uri); - if (uri.EqualsWithConversion(aURL)) + if (uri.EqualsWithConversion(nsPromiseFlatString(aURL))) return NS_OK; else { FlushStyleBindings(aContent); diff --git a/content/xbl/src/nsXBLService.h b/content/xbl/src/nsXBLService.h index 259324efad13..961cc3c504d4 100644 --- a/content/xbl/src/nsXBLService.h +++ b/content/xbl/src/nsXBLService.h @@ -49,7 +49,7 @@ class nsXBLService : public nsIXBLService, public nsIMemoryPressureObserver // This function loads a particular XBL file and installs all of the bindings // onto the element. - NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aAugmentFlag, + NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag, nsIXBLBinding** aBinding); // This method loads a binding doc and then builds the specific binding required. diff --git a/content/xml/content/public/nsIXMLContent.h b/content/xml/content/public/nsIXMLContent.h index 1c228c13dbb2..fb45ddc00021 100644 --- a/content/xml/content/public/nsIXMLContent.h +++ b/content/xml/content/public/nsIXMLContent.h @@ -75,32 +75,32 @@ NS_NewXMLElement(nsIXMLContent** aResult, nsINodeInfo* aNodeInfo); // XXX These belongs elsewhere extern nsresult NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult, - const nsString& aTarget, - const nsString& aData); + const nsAReadableString& aTarget, + const nsAReadableString& aData); extern nsresult NS_NewXMLEntity(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString aNotationName); + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aNotationName); extern nsresult NS_NewXMLNotation(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId); + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId); class nsIDOMNamedNodeMap; extern nsresult NS_NewXMLDocumentType(nsIContent** aInstancePtrResult, - const nsString& aName, + const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset); + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset); extern nsresult NS_NewXMLNamedNodeMap(nsIDOMNamedNodeMap** aInstancePtrResult, diff --git a/content/xml/content/src/nsXMLCDATASection.cpp b/content/xml/content/src/nsXMLCDATASection.cpp index 2829406d0ec2..7b02459bbcb2 100644 --- a/content/xml/content/src/nsXMLCDATASection.cpp +++ b/content/xml/content/src/nsXMLCDATASection.cpp @@ -142,9 +142,9 @@ nsXMLCDATASection::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLCDATASection::GetNodeName(nsString& aNodeName) +nsXMLCDATASection::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#cdata-section"); + aNodeName.Assign(NS_LITERAL_STRING("#cdata-section")); return NS_OK; } diff --git a/content/xml/content/src/nsXMLElement.cpp b/content/xml/content/src/nsXMLElement.cpp index 2010ebcd54b6..9a20c7a21d9a 100644 --- a/content/xml/content/src/nsXMLElement.cpp +++ b/content/xml/content/src/nsXMLElement.cpp @@ -216,7 +216,7 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI) NS_IMETHODIMP nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult rv; @@ -233,13 +233,15 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, } NS_IMETHODIMP -nsXMLElement::SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, +nsXMLElement::SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); if (aNodeInfo->Equals(kTypeAtom, kNameSpaceID_XLink)) { - if (aValue.EqualsAtom(kSimpleAtom, PR_FALSE)) { + const PRUnichar* simpleStr; + kSimpleAtom->GetUnicode(&simpleStr); + if (aValue.Equals(simpleStr)) { // 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 @@ -271,10 +273,10 @@ static nsresult WebShellToPresContext(nsIWebShell *aShell, nsIPresContext **aPre } -static nsresult CheckLoadURI(nsIURI *aBaseURI, const nsString& aURI, nsIURI **aAbsURI) +static nsresult CheckLoadURI(nsIURI *aBaseURI, const nsAReadableString& aURI, nsIURI **aAbsURI) { // XXX URL escape? - nsCAutoString str; str.AssignWithConversion(aURI); + nsCAutoString str; str.Assign(NS_ConvertUCS2toUTF8(aURI)); *aAbsURI = nsnull; diff --git a/content/xml/content/src/nsXMLElement.h b/content/xml/content/src/nsXMLElement.h index 0de3db5cac21..d221eee50c81 100644 --- a/content/xml/content/src/nsXMLElement.h +++ b/content/xml/content/src/nsXMLElement.h @@ -110,7 +110,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -119,16 +119,16 @@ public: nsIAtom*& aPrefix) { return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } - NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, + NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) { diff --git a/content/xml/content/src/nsXMLEntity.cpp b/content/xml/content/src/nsXMLEntity.cpp index aaa27524343c..0f93b97dd466 100644 --- a/content/xml/content/src/nsXMLEntity.cpp +++ b/content/xml/content/src/nsXMLEntity.cpp @@ -39,8 +39,10 @@ class nsXMLEntity : public nsIDOMEntity, public nsIContent { public: - nsXMLEntity(const nsString& aName, const nsString& aPublicId, - const nsString& aSystemId, const nsString aNotationName); + nsXMLEntity(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aNotationName); virtual ~nsXMLEntity(); // nsISupports @@ -50,9 +52,9 @@ public: NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner) // nsIDOMEntity - NS_IMETHOD GetPublicId(nsString& aPublicId); - NS_IMETHOD GetSystemId(nsString& aSystemId); - NS_IMETHOD GetNotationName(nsString& aNotationName); + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId); + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId); + NS_IMETHOD GetNotationName(nsAWritableString& aNotationName); // nsIScriptObjectOwner interface NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -78,9 +80,9 @@ protected: nsresult NS_NewXMLEntity(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId, + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, const nsString aNotationName) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); @@ -95,10 +97,10 @@ NS_NewXMLEntity(nsIContent** aInstancePtrResult, return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -nsXMLEntity::nsXMLEntity(const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString aNotationName) : +nsXMLEntity::nsXMLEntity(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aNotationName) : mName(aName), mPublicId(aPublicId), mSystemId(aSystemId), mNotationName(aNotationName) { NS_INIT_REFCNT(); @@ -161,25 +163,25 @@ nsXMLEntity::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_IMETHODIMP -nsXMLEntity::GetPublicId(nsString& aPublicId) +nsXMLEntity::GetPublicId(nsAWritableString& aPublicId) { - aPublicId=mPublicId; + aPublicId.Assign(mPublicId); return NS_OK; } NS_IMETHODIMP -nsXMLEntity::GetSystemId(nsString& aSystemId) +nsXMLEntity::GetSystemId(nsAWritableString& aSystemId) { - aSystemId=mSystemId; + aSystemId.Assign(mSystemId); return NS_OK; } NS_IMETHODIMP -nsXMLEntity::GetNotationName(nsString& aNotationName) +nsXMLEntity::GetNotationName(nsAWritableString& aNotationName) { - aNotationName=mNotationName; + aNotationName.Assign(mNotationName); return NS_OK; } @@ -235,9 +237,9 @@ nsXMLEntity::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLEntity::GetNodeName(nsString& aNodeName) +nsXMLEntity::GetNodeName(nsAWritableString& aNodeName) { - aNodeName=mName; + aNodeName.Assign(mName); return NS_OK; } diff --git a/content/xml/content/src/nsXMLNamedNodeMap.cpp b/content/xml/content/src/nsXMLNamedNodeMap.cpp index 7061c410a852..389a79224624 100644 --- a/content/xml/content/src/nsXMLNamedNodeMap.cpp +++ b/content/xml/content/src/nsXMLNamedNodeMap.cpp @@ -49,16 +49,16 @@ public: // nsIDOMNamedNodeMap NS_IMETHOD GetLength(PRUint32* aLength); - NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, + NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString&aLocalName, nsIDOMNode** aReturn); // nsIScriptObjectOwner interface @@ -145,7 +145,7 @@ nsXMLNamedNodeMap::GetLength(PRUint32* aLength) } NS_IMETHODIMP -nsXMLNamedNodeMap::GetNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXMLNamedNodeMap::GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (!aReturn) return NS_ERROR_NULL_POINTER; @@ -225,7 +225,7 @@ nsXMLNamedNodeMap::SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsXMLNamedNodeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXMLNamedNodeMap::RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (!aReturn) return NS_ERROR_NULL_POINTER; @@ -280,8 +280,8 @@ nsXMLNamedNodeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } nsresult -nsXMLNamedNodeMap::GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXMLNamedNodeMap::GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { return NS_ERROR_NOT_IMPLEMENTED; @@ -294,8 +294,8 @@ nsXMLNamedNodeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) } nsresult -nsXMLNamedNodeMap::RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, +nsXMLNamedNodeMap::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString&aLocalName, nsIDOMNode** aReturn) { return NS_ERROR_NOT_IMPLEMENTED; diff --git a/content/xml/content/src/nsXMLNotation.cpp b/content/xml/content/src/nsXMLNotation.cpp index 08ef59da9d37..83b52c098d1f 100644 --- a/content/xml/content/src/nsXMLNotation.cpp +++ b/content/xml/content/src/nsXMLNotation.cpp @@ -39,9 +39,9 @@ class nsXMLNotation : public nsIDOMNotation, public nsIContent { public: - nsXMLNotation(const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId); + nsXMLNotation(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId); virtual ~nsXMLNotation(); // nsISupports @@ -51,8 +51,8 @@ public: NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner) // nsIDOMNotation - NS_IMETHOD GetPublicId(nsString& aPublicId); - NS_IMETHOD GetSystemId(nsString& aSystemId); + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId); + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId); // nsIScriptObjectOwner interface NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -77,9 +77,9 @@ protected: nsresult NS_NewXMLNotation(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId) + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { @@ -93,9 +93,9 @@ NS_NewXMLNotation(nsIContent** aInstancePtrResult, return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -nsXMLNotation::nsXMLNotation(const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId) : +nsXMLNotation::nsXMLNotation(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId) : mName(aName), mPublicId(aPublicId), mSystemId(aSystemId) { NS_INIT_REFCNT(); @@ -158,17 +158,17 @@ nsXMLNotation::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_IMETHODIMP -nsXMLNotation::GetPublicId(nsString& aPublicId) +nsXMLNotation::GetPublicId(nsAWritableString& aPublicId) { - aPublicId=mPublicId; + aPublicId.Assign(mPublicId); return NS_OK; } NS_IMETHODIMP -nsXMLNotation::GetSystemId(nsString& aSystemId) +nsXMLNotation::GetSystemId(nsAWritableString& aSystemId) { - aSystemId=mSystemId; + aSystemId.Assign(mSystemId); return NS_OK; } @@ -224,9 +224,9 @@ nsXMLNotation::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLNotation::GetNodeName(nsString& aNodeName) +nsXMLNotation::GetNodeName(nsAWritableString& aNodeName) { - aNodeName=mName; + aNodeName.Assign(mName); return NS_OK; } diff --git a/content/xml/content/src/nsXMLProcessingInstruction.cpp b/content/xml/content/src/nsXMLProcessingInstruction.cpp index 75c2a435c8d3..0caaff1ffe3a 100644 --- a/content/xml/content/src/nsXMLProcessingInstruction.cpp +++ b/content/xml/content/src/nsXMLProcessingInstruction.cpp @@ -47,7 +47,7 @@ class nsXMLProcessingInstruction : public nsIDOMProcessingInstruction, public nsIContent { public: - nsXMLProcessingInstruction(const nsString& aTarget, const nsString& aData); + nsXMLProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData); virtual ~nsXMLProcessingInstruction(); // nsISupports @@ -85,8 +85,8 @@ protected: nsresult NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult, - const nsString& aTarget, - const nsString& aData) + const nsAReadableString& aTarget, + const nsAReadableString& aData) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { @@ -99,8 +99,8 @@ NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult, return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -nsXMLProcessingInstruction::nsXMLProcessingInstruction(const nsString& aTarget, - const nsString& aData) : +nsXMLProcessingInstruction::nsXMLProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData) : mTarget(aTarget) { NS_INIT_REFCNT(); @@ -170,21 +170,21 @@ nsXMLProcessingInstruction::QueryInterface(REFNSIID aIID, void** aInstancePtrRes } NS_IMETHODIMP -nsXMLProcessingInstruction::GetTarget(nsString& aTarget) +nsXMLProcessingInstruction::GetTarget(nsAWritableString& aTarget) { - aTarget=mTarget; + aTarget.Assign(mTarget); return NS_OK; } NS_IMETHODIMP -nsXMLProcessingInstruction::GetData(nsString& aData) +nsXMLProcessingInstruction::GetData(nsAWritableString& aData) { return mInner.GetData(aData); } NS_IMETHODIMP -nsXMLProcessingInstruction::SetData(const nsString& aData) +nsXMLProcessingInstruction::SetData(const nsAReadableString& aData) { // XXX Check if this is a stylesheet PI. If so, we may need // to parse the contents and see if anything has changed. @@ -344,9 +344,9 @@ nsXMLProcessingInstruction::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLProcessingInstruction::GetNodeName(nsString& aNodeName) +nsXMLProcessingInstruction::GetNodeName(nsAWritableString& aNodeName) { - aNodeName=mTarget; + aNodeName.Assign(mTarget); return NS_OK; } diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index 9633309212bb..bdd4eeb4bf46 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -128,8 +128,8 @@ MyPrefChangedCallback(const char*aPrefName, void* instance_data) NS_LAYOUT nsresult NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult, - const nsString& aNamespaceURI, - const nsString& aQualifiedName, + const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIURI* aBaseURI) { @@ -274,15 +274,15 @@ nsXMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) } NS_IMETHODIMP -nsXMLDocument::GetContentType(nsString& aContentType) const +nsXMLDocument::GetContentType(nsAWritableString& aContentType) const { // XXX Should get document type from incoming stream - aContentType.AssignWithConversion("text/xml"); + aContentType.Assign(NS_LITERAL_STRING("text/xml")); return NS_OK; } NS_IMETHODIMP -nsXMLDocument::Load(const nsString& aUrl) +nsXMLDocument::Load(const nsAReadableString& aUrl) { nsCOMPtr channel; nsCOMPtr uri; @@ -685,7 +685,7 @@ nsXMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType) } NS_IMETHODIMP -nsXMLDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) +nsXMLDocument::CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn) { nsIContent* content; nsresult rv = NS_NewXMLCDATASection(&content); @@ -700,15 +700,15 @@ nsXMLDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aR } NS_IMETHODIMP -nsXMLDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn) +nsXMLDocument::CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn) { *aReturn = nsnull; return NS_OK; } NS_IMETHODIMP -nsXMLDocument::CreateProcessingInstruction(const nsString& aTarget, - const nsString& aData, +nsXMLDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn) { nsIContent* content; @@ -725,7 +725,7 @@ nsXMLDocument::CreateProcessingInstruction(const nsString& aTarget, } NS_IMETHODIMP -nsXMLDocument::CreateElement(const nsString& aTagName, +nsXMLDocument::CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -749,8 +749,8 @@ nsXMLDocument::CreateElement(const nsString& aTagName, } NS_IMETHODIMP -nsXMLDocument::CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, +nsXMLDocument::CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn) { printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n"); @@ -864,8 +864,8 @@ nsXMLDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsXMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXMLDocument::CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -873,8 +873,8 @@ nsXMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXMLDocument::CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXMLDocument::CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn) { nsresult rv = NS_OK; @@ -908,7 +908,7 @@ nsXMLDocument::CreateElementNS(const nsString& aNamespaceURI, } static nsIContent * -MatchName(nsIContent *aContent, const nsString& aName) +MatchName(nsIContent *aContent, const nsAReadableString& aName) { nsAutoString value; nsIContent *result = nsnull; @@ -939,7 +939,7 @@ MatchName(nsIContent *aContent, const nsString& aName) } NS_IMETHODIMP -nsXMLDocument::GetElementById(const nsString& aElementId, +nsXMLDocument::GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn) { // XXX Since we don't have a validating parser, the only content diff --git a/content/xml/document/src/nsXMLDocument.h b/content/xml/document/src/nsXMLDocument.h index 9a8761859b9b..b02e770b253e 100644 --- a/content/xml/document/src/nsXMLDocument.h +++ b/content/xml/document/src/nsXMLDocument.h @@ -48,7 +48,7 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, @@ -64,26 +64,26 @@ public: // nsIDOMDocument interface NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType); - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); - NS_IMETHOD CreateElement(const nsString& aTagName, + NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn); + NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn); + NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn); + NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn); - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, + NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn); NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, + NS_IMETHOD CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn); - NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, + NS_IMETHOD CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn); - NS_IMETHOD GetElementById(const nsString& aElementId, + NS_IMETHOD GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn); - NS_IMETHOD Load(const nsString& aUrl); + NS_IMETHOD Load(const nsAReadableString& aUrl); // nsIXMLDocument interface #ifdef MOZ_XSL diff --git a/content/xul/content/public/nsIXULContent.h b/content/xul/content/public/nsIXULContent.h index d0832f301820..ccd463116259 100644 --- a/content/xul/content/public/nsIXULContent.h +++ b/content/xul/content/public/nsIXULContent.h @@ -95,7 +95,7 @@ public: /** * Add a script event listener to the element. */ - NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID) = 0; + NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsAReadableString& aValue, REFNSIID aIID) = 0; /** * Evil rotten hack to make mailnews work. They assume that we diff --git a/content/xul/content/src/nsXULAttributes.cpp b/content/xul/content/src/nsXULAttributes.cpp index 635979b29bb3..8a131e96146f 100644 --- a/content/xul/content/src/nsXULAttributes.cpp +++ b/content/xul/content/src/nsXULAttributes.cpp @@ -50,6 +50,7 @@ #include "nsIURL.h" #include "nsXULAttributes.h" #include "nsLayoutCID.h" +#include "nsReadableUtils.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); @@ -93,7 +94,7 @@ nsClassList::GetClasses(nsClassList* aList, nsVoidArray& aArray) nsresult -nsClassList::ParseClasses(nsClassList** aList, const nsString& aClassString) +nsClassList::ParseClasses(nsClassList** aList, const nsAReadableString& aClassString) { static const PRUnichar kNullCh = PRUnichar('\0'); @@ -205,7 +206,7 @@ nsXULAttribute::operator delete(void* aObject, size_t aSize) nsXULAttribute::nsXULAttribute(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue) + const nsAReadableString& aValue) : mContent(aContent), mScriptObject(nsnull), mNodeInfo(aNodeInfo), @@ -234,7 +235,7 @@ nsXULAttribute::~nsXULAttribute() nsresult nsXULAttribute::Create(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, nsXULAttribute** aResult) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -281,20 +282,20 @@ nsXULAttribute::QueryInterface(REFNSIID aIID, void** aResult) // nsIDOMNode interface NS_IMETHODIMP -nsXULAttribute::GetNodeName(nsString& aNodeName) +nsXULAttribute::GetNodeName(nsAWritableString& aNodeName) { GetQualifiedName(aNodeName); return NS_OK; } NS_IMETHODIMP -nsXULAttribute::GetNodeValue(nsString& aNodeValue) +nsXULAttribute::GetNodeValue(nsAWritableString& aNodeValue) { return GetValueInternal(aNodeValue); } NS_IMETHODIMP -nsXULAttribute::SetNodeValue(const nsString& aNodeValue) +nsXULAttribute::SetNodeValue(const nsAReadableString& aNodeValue) { return SetValue(aNodeValue); } @@ -363,19 +364,19 @@ nsXULAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } NS_IMETHODIMP -nsXULAttribute::GetNamespaceURI(nsString& aNamespaceURI) +nsXULAttribute::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return mNodeInfo->GetNamespaceURI(aNamespaceURI); } NS_IMETHODIMP -nsXULAttribute::GetPrefix(nsString& aPrefix) +nsXULAttribute::GetPrefix(nsAWritableString& aPrefix) { return mNodeInfo->GetPrefix(aPrefix); } NS_IMETHODIMP -nsXULAttribute::SetPrefix(const nsString& aPrefix) +nsXULAttribute::SetPrefix(const nsAReadableString& aPrefix) { // XXX: Validate the prefix string! @@ -397,7 +398,7 @@ nsXULAttribute::SetPrefix(const nsString& aPrefix) } NS_IMETHODIMP -nsXULAttribute::GetLocalName(nsString& aLocalName) +nsXULAttribute::GetLocalName(nsAWritableString& aLocalName) { return mNodeInfo->GetLocalName(aLocalName); } @@ -448,8 +449,9 @@ nsXULAttribute::Normalize() } NS_IMETHODIMP -nsXULAttribute::Supports(const nsString& aFeature, const nsString& aVersion, - PRBool* aReturn) +nsXULAttribute::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, + PRBool* aReturn) { NS_NOTYETIMPLEMENTED("write me"); return NS_ERROR_NOT_IMPLEMENTED; @@ -459,7 +461,7 @@ nsXULAttribute::Supports(const nsString& aFeature, const nsString& aVersion, // nsIDOMAttr interface NS_IMETHODIMP -nsXULAttribute::GetName(nsString& aName) +nsXULAttribute::GetName(nsAWritableString& aName) { GetQualifiedName(aName); return NS_OK; @@ -474,13 +476,13 @@ nsXULAttribute::GetSpecified(PRBool* aSpecified) } NS_IMETHODIMP -nsXULAttribute::GetValue(nsString& aValue) +nsXULAttribute::GetValue(nsAWritableString& aValue) { return GetValueInternal(aValue); } NS_IMETHODIMP -nsXULAttribute::SetValue(const nsString& aValue) +nsXULAttribute::SetValue(const nsAReadableString& aValue) { // We call back to the content node's SetValue() method so we can // share all of the work that it does. @@ -537,7 +539,7 @@ nsXULAttribute::SetScriptObject(void *aScriptObject) // Implementation methods void -nsXULAttribute::GetQualifiedName(nsString& aQualifiedName) +nsXULAttribute::GetQualifiedName(nsAWritableString& aQualifiedName) { // This should be removed, call sites should be replaced with mNodeInfo->Get... aQualifiedName.Truncate(); @@ -553,7 +555,7 @@ nsXULAttribute::GetQualifiedName(nsString& aQualifiedName) const PRUnichar *unicodeString; prefix->GetUnicode(&unicodeString); aQualifiedName.Append(unicodeString); - aQualifiedName.AppendWithConversion(':'); + aQualifiedName.Append(PRUnichar(':')); NS_RELEASE(prefix); } } @@ -572,7 +574,7 @@ nsXULAttribute::GetQualifiedName(nsString& aQualifiedName) nsresult -nsXULAttribute::SetValueInternal(const nsString& aValue) +nsXULAttribute::SetValueInternal(const nsAReadableString& aValue) { nsCOMPtr newAtom; @@ -582,7 +584,7 @@ nsXULAttribute::SetValueInternal(const nsString& aValue) // table is "unprimed" we see quite a bit of thrashing as the 'id' // value is repeatedly added and then removed from the atom table. if ((aValue.Length() <= kMaxAtomValueLength) || mNodeInfo->Equals(kIdAtom)) { - newAtom = getter_AddRefs( NS_NewAtom(aValue.GetUnicode()) ); + newAtom = getter_AddRefs( NS_NewAtom(aValue) ); } if (mValue) { @@ -597,12 +599,10 @@ nsXULAttribute::SetValueInternal(const nsString& aValue) } else { PRInt32 len = aValue.Length(); - PRUnichar* str = new PRUnichar[len + 1]; + PRUnichar* str = ToNewUnicode(aValue); if (! str) return NS_ERROR_OUT_OF_MEMORY; - nsCRT::memcpy(str, aValue.GetUnicode(), len * sizeof(PRUnichar)); - str[len] = PRUnichar(0); mValue = str; } @@ -711,7 +711,8 @@ nsXULAttributes::GetLength(PRUint32* aLength) } NS_IMETHODIMP -nsXULAttributes::GetNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXULAttributes::GetNamedItem(const nsAReadableString& aName, + nsIDOMNode** aReturn) { NS_PRECONDITION(aReturn != nsnull, "null ptr"); if (! aReturn) @@ -758,7 +759,8 @@ nsXULAttributes::SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsXULAttributes::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXULAttributes::RemoveNamedItem(const nsAReadableString& aName, + nsIDOMNode** aReturn) { nsCOMPtr element( do_QueryInterface(mContent) ); if (element) { @@ -780,8 +782,8 @@ nsXULAttributes::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } nsresult -nsXULAttributes::GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULAttributes::GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -796,8 +798,8 @@ nsXULAttributes::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) } nsresult -nsXULAttributes::RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, +nsXULAttributes::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -867,12 +869,12 @@ nsresult nsXULAttributes::SetClassList(nsClassList* aClassList) return NS_OK; } -nsresult nsXULAttributes::UpdateClassList(const nsString& aValue) +nsresult nsXULAttributes::UpdateClassList(const nsAReadableString& aValue) { return nsClassList::ParseClasses(&mClassList, aValue); } -nsresult nsXULAttributes::UpdateStyleRule(nsIURI* aDocURL, const nsString& aValue) +nsresult nsXULAttributes::UpdateStyleRule(nsIURI* aDocURL, const nsAReadableString& aValue) { if (aValue.IsEmpty()) { diff --git a/content/xul/content/src/nsXULAttributes.h b/content/xul/content/src/nsXULAttributes.h index 7819f771107e..dbcc92f333ba 100644 --- a/content/xul/content/src/nsXULAttributes.h +++ b/content/xul/content/src/nsXULAttributes.h @@ -89,7 +89,7 @@ public: GetClasses(nsClassList* aList, nsVoidArray& aArray); static nsresult - ParseClasses(nsClassList** aList, const nsString& aValue); + ParseClasses(nsClassList** aList, const nsAReadableString& aValue); }; //////////////////////////////////////////////////////////////////////// @@ -114,7 +114,7 @@ protected: nsXULAttribute(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue); + const nsAReadableString& aValue); virtual ~nsXULAttribute(); @@ -122,7 +122,7 @@ public: static nsresult Create(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, nsXULAttribute** aResult); // nsISupports interface @@ -139,10 +139,10 @@ public: NS_IMETHOD SetScriptObject(void *aScriptObject); // Implementation methods - void GetQualifiedName(nsString& aAttributeName); + void GetQualifiedName(nsAWritableString& aAttributeName); nsINodeInfo* GetNodeInfo() const { return mNodeInfo; } - nsresult SetValueInternal(const nsString& aValue); + nsresult SetValueInternal(const nsAReadableString& aValue); nsresult GetValueAsAtom(nsIAtom** aResult); protected: @@ -168,7 +168,7 @@ protected: return (PRWord(mValue) & kTypeMask) == kStringType; } - nsresult GetValueInternal(nsString& aResult) { + nsresult GetValueInternal(nsAWritableString& aResult) { nsresult rv = NS_OK; if (! mValue) { aResult.Truncate(); @@ -185,7 +185,7 @@ protected: void ReleaseValue() { if (IsStringValue()) { - delete[] (PRUnichar*)(mValue); + nsMemory::Free(mValue); } else { nsIAtom* atom = (nsIAtom*)(PRWord(mValue) & ~PRWord(kTypeMask)); @@ -226,8 +226,8 @@ public: nsresult HasClass(nsIAtom* aClass) const; nsresult SetClassList(nsClassList* aClassList); - nsresult UpdateClassList(const nsString& aValue); - nsresult UpdateStyleRule(nsIURI* aDocURL, const nsString& aValue); + nsresult UpdateClassList(const nsAReadableString& aValue); + nsresult UpdateStyleRule(nsIURI* aDocURL, const nsAReadableString& aValue); nsresult SetInlineStyleRule(nsIStyleRule* aRule); nsresult GetInlineStyleRule(nsIStyleRule*& aRule); diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index d8070ff75aee..928edbf1a982 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -220,11 +220,12 @@ struct XULBroadcastListener nsVoidArray* mAttributeList; nsIDOMElement* mListener; - XULBroadcastListener(const nsString& aAttribute, nsIDOMElement* aListener) + XULBroadcastListener(const nsAReadableString& aAttribute, + nsIDOMElement* aListener) : mAttributeList(nsnull) { mListener = aListener; // WEAK REFERENCE - if (!aAttribute.EqualsWithConversion("*")) { + if (!aAttribute.Equals(NS_LITERAL_STRING("*"))) { mAttributeList = new nsVoidArray(); mAttributeList->AppendElement((void*)(new nsString(aAttribute))); } @@ -256,7 +257,7 @@ struct XULBroadcastListener return (count == 0); } - void RemoveAttribute(const nsString& aString) + void RemoveAttribute(const nsAReadableString& aString) { if (ObservingEverything()) return; @@ -265,7 +266,7 @@ struct XULBroadcastListener PRInt32 count = mAttributeList->Count(); for (PRInt32 i = 0; i < count; i++) { nsString* str = (nsString*)(mAttributeList->ElementAt(i)); - if (*str == aString) { + if (str->Equals(aString)) { mAttributeList->RemoveElementAt(i); delete str; break; @@ -279,7 +280,7 @@ struct XULBroadcastListener return (mAttributeList == nsnull); } - PRBool ObservingAttribute(const nsString& aString) + PRBool ObservingAttribute(const nsAReadableString& aString) { if (ObservingEverything()) return PR_TRUE; @@ -288,7 +289,7 @@ struct XULBroadcastListener PRInt32 count = mAttributeList->Count(); for (PRInt32 i = 0; i < count; i++) { nsString* str = (nsString*)(mAttributeList->ElementAt(i)); - if (*str == aString) + if (str->Equals(aString)) return PR_TRUE; } } @@ -626,21 +627,21 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result) // nsIDOMNode interface NS_IMETHODIMP -nsXULElement::GetNodeName(nsString& aNodeName) +nsXULElement::GetNodeName(nsAWritableString& aNodeName) { return NodeInfo()->GetQualifiedName(aNodeName); } NS_IMETHODIMP -nsXULElement::GetNodeValue(nsString& aNodeValue) +nsXULElement::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } NS_IMETHODIMP -nsXULElement::SetNodeValue(const nsString& aNodeValue) +nsXULElement::SetNodeValue(const nsAReadableString& aNodeValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -847,21 +848,21 @@ nsXULElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) NS_IMETHODIMP -nsXULElement::GetNamespaceURI(nsString& aNamespaceURI) +nsXULElement::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return NodeInfo()->GetNamespaceURI(aNamespaceURI); } NS_IMETHODIMP -nsXULElement::GetPrefix(nsString& aPrefix) +nsXULElement::GetPrefix(nsAWritableString& aPrefix) { return NodeInfo()->GetPrefix(aPrefix); } NS_IMETHODIMP -nsXULElement::SetPrefix(const nsString& aPrefix) +nsXULElement::SetPrefix(const nsAReadableString& aPrefix) { // XXX: Validate the prefix string! @@ -886,14 +887,15 @@ nsXULElement::SetPrefix(const nsString& aPrefix) NS_IMETHODIMP -nsXULElement::GetLocalName(nsString& aLocalName) +nsXULElement::GetLocalName(nsAWritableString& aLocalName) { return NodeInfo()->GetLocalName(aLocalName); } NS_IMETHODIMP -nsXULElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) +nsXULElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, + nsIDOMNode** aReturn) { NS_PRECONDITION(aNewChild != nsnull, "null ptr"); if (! aNewChild) @@ -980,7 +982,8 @@ nsXULElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMN NS_IMETHODIMP -nsXULElement::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) +nsXULElement::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, + nsIDOMNode** aReturn) { NS_PRECONDITION(aNewChild != nsnull, "null ptr"); if (! aNewChild) @@ -1173,7 +1176,8 @@ nsXULElement::Normalize() NS_IMETHODIMP -nsXULElement::Supports(const nsString& aFeature, const nsString& aVersion, +nsXULElement::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { NS_NOTYETIMPLEMENTED("write me!"); @@ -1185,7 +1189,7 @@ nsXULElement::Supports(const nsString& aFeature, const nsString& aVersion, // nsIDOMElement interface NS_IMETHODIMP -nsXULElement::GetTagName(nsString& aTagName) +nsXULElement::GetTagName(nsAWritableString& aTagName) { return NodeInfo()->GetQualifiedName(aTagName); } @@ -1200,7 +1204,8 @@ nsXULElement::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXULElement::GetAttribute(const nsString& aName, nsString& aReturn) +nsXULElement::GetAttribute(const nsAReadableString& aName, + nsAWritableString& aReturn) { nsresult rv; PRInt32 nameSpaceID; @@ -1221,12 +1226,13 @@ nsXULElement::GetAttribute(const nsString& aName, nsString& aReturn) NS_IMETHODIMP -nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue) +nsXULElement::SetAttribute(const nsAReadableString& aName, + const nsAReadableString& aValue) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp); } @@ -1251,12 +1257,12 @@ nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue) NS_IMETHODIMP -nsXULElement::RemoveAttribute(const nsString& aName) +nsXULElement::RemoveAttribute(const nsAReadableString& aName) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp); } @@ -1282,12 +1288,13 @@ nsXULElement::RemoveAttribute(const nsString& aName) NS_IMETHODIMP -nsXULElement::GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn) +nsXULElement::GetAttributeNode(const nsAReadableString& aName, + nsIDOMAttr** aReturn) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: GetAttributeNode(\"%s\") called, use GetAttributeNodeNS() in stead!\n", (const char *)tmp); } } @@ -1349,12 +1356,13 @@ nsXULElement::RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) NS_IMETHODIMP -nsXULElement::GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn) +nsXULElement::GetElementsByTagName(const nsAReadableString& aName, + nsIDOMNodeList** aReturn) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp); } } @@ -1378,8 +1386,9 @@ nsXULElement::GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aRetu } NS_IMETHODIMP -nsXULElement::GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) +nsXULElement::GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + nsAWritableString& aReturn) { nsCOMPtr name(dont_AddRef(NS_NewAtom(aLocalName))); PRInt32 nsid; @@ -1399,9 +1408,9 @@ nsXULElement::GetAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) +nsXULElement::SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { nsCOMPtr nimgr; nsresult rv = NodeInfo()->GetNodeInfoManager(*getter_AddRefs(nimgr)); @@ -1415,8 +1424,8 @@ nsXULElement::SetAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) +nsXULElement::RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { PRInt32 nameSpaceId; nsCOMPtr tag = dont_AddRef(NS_NewAtom(aLocalName)); @@ -1430,8 +1439,8 @@ nsXULElement::RemoveAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULElement::GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1466,8 +1475,8 @@ nsXULElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr, } NS_IMETHODIMP -nsXULElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULElement::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1481,7 +1490,7 @@ nsXULElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, nsCOMPtr kungFuGrip; kungFuGrip = dont_AddRef(NS_STATIC_CAST(nsIDOMNodeList *, elements)); - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { gNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId); if (nameSpaceId == kNameSpaceID_Unknown) { @@ -1506,7 +1515,7 @@ nsXULElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::HasAttribute(const nsString& aName, PRBool* aReturn) +nsXULElement::HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1525,8 +1534,9 @@ nsXULElement::HasAttribute(const nsString& aName, PRBool* aReturn) } NS_IMETHODIMP -nsXULElement::HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) +nsXULElement::HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1551,9 +1561,9 @@ nsXULElement::HasAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::GetElementsByAttribute(const nsString& aAttribute, - const nsString& aValue, - nsIDOMNodeList** aReturn) +nsXULElement::GetElementsByAttribute(const nsAReadableString& aAttribute, + const nsAReadableString& aValue, + nsIDOMNodeList** aReturn) { nsresult rv; nsRDFDOMNodeList* elements; @@ -1698,7 +1708,7 @@ nsXULElement::GetLazyState(PRInt32 aFlag, PRBool& aResult) NS_IMETHODIMP -nsXULElement::AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID) +nsXULElement::AddScriptEventListener(nsIAtom* aName, const nsAReadableString& aValue, REFNSIID aIID) { if (! mDocument) return NS_OK; // XXX @@ -1728,14 +1738,16 @@ nsXULElement::AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REF nsCOMPtr owner = do_QueryInterface(global); - rv = manager->AddScriptEventListener(context, owner, aName, aValue, aIID, PR_FALSE); + rv = manager->AddScriptEventListener(context, owner, aName, + aValue, aIID, PR_FALSE); } else { nsCOMPtr manager; rv = GetListenerManager(getter_AddRefs(manager)); if (NS_FAILED(rv)) return rv; - rv = manager->AddScriptEventListener(context, this, aName, aValue, aIID, PR_TRUE); + rv = manager->AddScriptEventListener(context, this, aName, + aValue, aIID, PR_TRUE); } return rv; @@ -1809,8 +1821,9 @@ nsXULElement::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsI } NS_IMETHODIMP -nsXULElement::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULElement::AddEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { nsIEventListenerManager *manager; @@ -1825,8 +1838,9 @@ nsXULElement::AddEventListener(const nsString& aType, nsIDOMEventListener* aList } NS_IMETHODIMP -nsXULElement::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULElement::RemoveEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { if (mListenerManager) { PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; @@ -1956,7 +1970,7 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject) nsAutoString empty; viewCSS->GetComputedStyle(this, empty, getter_AddRefs(cssDecl)); if (cssDecl) { - nsAutoString behavior; behavior.AssignWithConversion("behavior"); + nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("behavior")); nsAutoString value; cssDecl->GetPropertyValue(behavior, value); if (!value.IsEmpty()) { @@ -2015,7 +2029,7 @@ NS_IMETHODIMP nsXULElement::CompileEventHandler(nsIScriptContext* aContext, void* aTarget, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, void** aHandler) { nsresult rv; @@ -2579,9 +2593,9 @@ nsXULElement::GetTag(nsIAtom*& aResult) const } NS_IMETHODIMP -nsXULElement::ParseAttributeString(const nsString& aStr, - nsIAtom*& aName, - PRInt32& aNameSpaceID) +nsXULElement::ParseAttributeString(const nsAReadableString& aStr, + nsIAtom*& aName, + PRInt32& aNameSpaceID) { static char kNameSpaceSeparator = ':'; @@ -2642,7 +2656,7 @@ nsXULElement::GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, NS_IMETHODIMP nsXULElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ASSERTION(kNameSpaceID_Unknown != aNameSpaceID, "must have name space ID"); @@ -2815,7 +2829,7 @@ nsXULElement::SetAttribute(PRInt32 aNameSpaceID, NS_IMETHODIMP nsXULElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -2834,7 +2848,7 @@ nsXULElement::SetAttribute(nsINodeInfo* aNodeInfo, NS_IMETHODIMP nsXULElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const + nsAWritableString& aResult) const { nsCOMPtr prefix; return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult); @@ -2844,7 +2858,7 @@ NS_IMETHODIMP nsXULElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, - nsString& aResult) const + nsAWritableString& aResult) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); if (nsnull == aName) { @@ -2877,7 +2891,7 @@ nsXULElement::GetAttribute(PRInt32 aNameSpaceID, (aNameSpaceID == kNameSpaceID_Unknown) || (aNameSpaceID == kNameSpaceID_None)) && ni->Equals(aName)) { ni->GetPrefixAtom(aPrefix); - aResult = attr->mValue; + aResult.Assign(attr->mValue); rv = aResult.Length() ? NS_CONTENT_ATTR_HAS_VALUE : NS_CONTENT_ATTR_NO_VALUE; break; } @@ -2891,7 +2905,8 @@ nsXULElement::GetAttribute(PRInt32 aNameSpaceID, } NS_IMETHODIMP -nsXULElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) +nsXULElement::UnsetAttribute(PRInt32 aNameSpaceID, + nsIAtom* aName, PRBool aNotify) { NS_ASSERTION(nsnull != aName, "must have attribute name"); if (nsnull == aName) @@ -3386,7 +3401,8 @@ nsXULElement::DoCommand() } NS_IMETHODIMP -nsXULElement::AddBroadcastListener(const nsString& attr, nsIDOMElement* anElement) +nsXULElement::AddBroadcastListener(const nsAReadableString& attr, + nsIDOMElement* anElement) { // Add ourselves to the array. nsresult rv; @@ -3405,7 +3421,7 @@ nsXULElement::AddBroadcastListener(const nsString& attr, nsIDOMElement* anElemen // We need to sync up the initial attribute value. nsCOMPtr listener( do_QueryInterface(anElement) ); - if (attr.EqualsWithConversion("*")) { + if (attr.Equals(NS_LITERAL_STRING("*"))) { // All of the attributes found on this node should be set on the // listener. if (Attributes()) { @@ -3446,7 +3462,8 @@ nsXULElement::AddBroadcastListener(const nsString& attr, nsIDOMElement* anElemen NS_IMETHODIMP -nsXULElement::RemoveBroadcastListener(const nsString& attr, nsIDOMElement* anElement) +nsXULElement::RemoveBroadcastListener(const nsAReadableString& attr, + nsIDOMElement* anElement) { if (BroadcastListeners()) { // Find the element. @@ -3456,7 +3473,7 @@ nsXULElement::RemoveBroadcastListener(const nsString& attr, nsIDOMElement* anEle NS_REINTERPRET_CAST(XULBroadcastListener*, BroadcastListeners()->ElementAt(i)); if (xulListener->mListener == anElement) { - if (xulListener->ObservingEverything() || attr.EqualsWithConversion("*")) { + if (xulListener->ObservingEverything() || attr.Equals(NS_LITERAL_STRING("*"))) { // Do the removal. BroadcastListeners()->RemoveElementAt(i); delete xulListener; @@ -3560,7 +3577,7 @@ nsXULElement::EnsureContentsGenerated(void) const nsresult -nsXULElement::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName) +nsXULElement::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsAReadableString& attrName) { // Now we execute the onchange handler in the context of the // observer. We need to find the observer in order to @@ -3587,7 +3604,7 @@ nsXULElement::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString // attribute? nsAutoString listeningToAttribute; domElement->GetAttribute(NS_ConvertASCIItoUCS2("attribute"), listeningToAttribute); - if (listeningToAttribute == attrName) { + if (listeningToAttribute.Equals(attrName)) { // This is the right observes node. // Execute the onchange event handler nsEvent event; @@ -3645,7 +3662,7 @@ nsXULElement::ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent) nsresult nsXULElement::GetElementsByTagName(nsIDOMNode* aNode, - const nsString& aTagName, + const nsAReadableString& aTagName, nsRDFDOMNodeList* aElements) { nsresult rv; @@ -3678,7 +3695,7 @@ nsXULElement::GetElementsByTagName(nsIDOMNode* aNode, if (!element) continue; - if (aTagName.EqualsWithConversion("*")) { + if (aTagName.Equals(NS_LITERAL_STRING("*"))) { if (NS_FAILED(rv = aElements->AppendNode(child))) { NS_ERROR("unable to append element to node list"); return rv; @@ -3711,8 +3728,8 @@ nsXULElement::GetElementsByTagName(nsIDOMNode* aNode, nsresult nsXULElement::GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttribute, - const nsString& aValue, + const nsAReadableString& aAttribute, + const nsAReadableString& aValue, nsRDFDOMNodeList* aElements) { nsresult rv; @@ -3751,7 +3768,7 @@ nsXULElement::GetElementsByAttribute(nsIDOMNode* aNode, return rv; } - if ((attrValue == aValue) || (attrValue.Length() > 0 && aValue.EqualsWithConversion("*"))) { + if ((attrValue.Equals(aValue)) || (attrValue.Length() > 0 && aValue.Equals(NS_LITERAL_STRING("*")))) { if (NS_FAILED(rv = aElements->AppendNode(child))) { NS_ERROR("unable to append element to node list"); return rv; @@ -3990,30 +4007,30 @@ nsXULElement::GetBoxObject(nsIBoxObject** aResult) // Methods for setting/getting attributes from nsIDOMXULElement nsresult -nsXULElement::GetId(nsString& aId) +nsXULElement::GetId(nsAWritableString& aId) { - GetAttribute(NS_ConvertASCIItoUCS2("id"), aId); + GetAttribute(NS_LITERAL_STRING("id"), aId); return NS_OK; } nsresult -nsXULElement::SetId(const nsString& aId) +nsXULElement::SetId(const nsAReadableString& aId) { - SetAttribute(NS_ConvertASCIItoUCS2("id"), aId); + SetAttribute(NS_LITERAL_STRING("id"), aId); return NS_OK; } nsresult -nsXULElement::GetClassName(nsString& aClassName) +nsXULElement::GetClassName(nsAWritableString& aClassName) { - GetAttribute(NS_ConvertASCIItoUCS2("class"), aClassName); + GetAttribute(NS_LITERAL_STRING("class"), aClassName); return NS_OK; } nsresult -nsXULElement::SetClassName(const nsString& aClassName) +nsXULElement::SetClassName(const nsAReadableString& aClassName) { - SetAttribute(NS_ConvertASCIItoUCS2("class"), aClassName); + SetAttribute(NS_LITERAL_STRING("class"), aClassName); return NS_OK; } @@ -4370,7 +4387,7 @@ nsXULPrototypeAttribute::~nsXULPrototypeAttribute() // nsresult -nsXULPrototypeElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aValue) +nsXULPrototypeElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aValue) { for (PRInt32 i = 0; i < mNumAttributes; ++i) { if (mAttributes[i].mNodeInfo->Equals(aName, aNameSpaceID)) { diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 7b29a574760f..da24dc371ed1 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -225,7 +225,7 @@ public: nsCOMPtr mInlineStyleRule; // [OWNER] nsClassList* mClassList; - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aValue); + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aValue); }; struct JSRuntime; @@ -358,12 +358,12 @@ public: NS_IMETHOD GetNameSpaceID(PRInt32& aNameSpeceID) const; NS_IMETHOD GetTag(nsIAtom*& aResult) const; NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const; - NS_IMETHOD ParseAttributeString(const nsString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID); + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID); NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, nsIAtom*& aPrefix); - NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, PRBool aNotify); - NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, PRBool aNotify); - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const; - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const; + NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); + NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aResult) const; + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsAWritableString& aResult) const; NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify); NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const; @@ -414,7 +414,7 @@ public: NS_IMETHOD SetLazyState(PRInt32 aFlags); NS_IMETHOD ClearLazyState(PRInt32 aFlags); NS_IMETHOD GetLazyState(PRInt32 aFlag, PRBool& aValue); - NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID); + NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsAReadableString& aValue, REFNSIID aIID); NS_IMETHOD ForceElementToOwnResource(PRBool aForce); NS_IMETHOD InitTemplateRoot(nsIRDFCompositeDataSource* aDatabase, nsIXULTemplateBuilder* aBuilder); @@ -429,9 +429,9 @@ public: NS_DECL_IDOMXULELEMENT // nsIDOMEventTarget interface (from nsIDOMEventReceiver) - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); @@ -450,7 +450,7 @@ public: NS_IMETHOD CompileEventHandler(nsIScriptContext* aContext, void* aTarget, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, void** aHandler); NS_IMETHOD GetCompiledEventHandler(nsIAtom *aName, void** aHandler); @@ -483,7 +483,7 @@ protected: // Implementation methods nsresult EnsureContentsGenerated(void) const; - nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName); + nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsAReadableString& attrName); static nsresult ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent); @@ -491,13 +491,13 @@ protected: // Static helpers static nsresult GetElementsByTagName(nsIDOMNode* aNode, - const nsString& aTagName, + const nsAReadableString& aTagName, nsRDFDOMNodeList* aElements); static nsresult GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttributeName, - const nsString& aAttributeValue, + const nsAReadableString& aAttributeName, + const nsAReadableString& aAttributeValue, nsRDFDOMNodeList* aElements); static PRBool IsAncestor(nsIDOMNode* aParentNode, nsIDOMNode* aChildNode); diff --git a/content/xul/document/public/nsIXULDocument.h b/content/xul/document/public/nsIXULDocument.h index ea38ca876396..d5e7c68ae4f6 100644 --- a/content/xul/document/public/nsIXULDocument.h +++ b/content/xul/document/public/nsIXULDocument.h @@ -70,19 +70,19 @@ public: /** * Add an entry to the ID-to-element map. */ - NS_IMETHOD AddElementForID(const nsString& aID, nsIContent* aElement) = 0; + NS_IMETHOD AddElementForID(const nsAReadableString& aID, nsIContent* aElement) = 0; /** * Remove an entry from the ID-to-element map. */ - NS_IMETHOD RemoveElementForID(const nsString& aID, nsIContent* aElement) = 0; + NS_IMETHOD RemoveElementForID(const nsAReadableString& aID, nsIContent* aElement) = 0; /** * Get the elements for a particular resource in the resource-to-element * map. The nsISupportsArray will be truncated and filled in with * nsIContent pointers. */ - NS_IMETHOD GetElementsForID(const nsString& aID, nsISupportsArray* aElements) = 0; + NS_IMETHOD GetElementsForID(const nsAReadableString& aID, nsISupportsArray* aElements) = 0; NS_IMETHOD CreateContents(nsIContent* aElement) = 0; diff --git a/content/xul/document/public/nsIXULPrototypeDocument.h b/content/xul/document/public/nsIXULPrototypeDocument.h index 487dd9be4018..c0c25419e132 100644 --- a/content/xul/document/public/nsIXULPrototypeDocument.h +++ b/content/xul/document/public/nsIXULPrototypeDocument.h @@ -30,6 +30,7 @@ #define nsIXULPrototypeDocument_h__ #include "nsISupports.h" +#include "nsAWritableString.h" class nsIAtom; class nsIPrincipal; @@ -67,8 +68,8 @@ public: NS_IMETHOD AddOverlayReference(nsIURI* aURI) = 0; NS_IMETHOD GetOverlayReferences(nsISupportsArray** aResult) = 0; - NS_IMETHOD GetHeaderData(nsIAtom* aField, nsString& aData) const = 0; - NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsString& aData) = 0; + NS_IMETHOD GetHeaderData(nsIAtom* aField, nsAWritableString& aData) const = 0; + NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsAReadableString& aData) = 0; NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aResult) = 0; NS_IMETHOD SetDocumentPrincipal(nsIPrincipal* aPrincipal) = 0; diff --git a/content/xul/document/src/nsElementMap.cpp b/content/xul/document/src/nsElementMap.cpp index 60bfe64496ba..bb0e660428c5 100644 --- a/content/xul/document/src/nsElementMap.cpp +++ b/content/xul/document/src/nsElementMap.cpp @@ -39,6 +39,7 @@ #include "nsElementMap.h" #include "nsISupportsArray.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "prlog.h" #ifdef PR_LOGGING @@ -146,27 +147,26 @@ nsElementMap::ReleaseContentList(PLHashEntry* aHashEntry, PRIntn aIndex, void* a nsresult -nsElementMap::Add(const nsString& aID, nsIContent* aContent) +nsElementMap::Add(const nsAReadableString& aID, nsIContent* aContent) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) return NS_ERROR_NOT_INITIALIZED; + const PRUnichar *id = nsPromiseFlatString(aID); + ContentListItem* head = - NS_STATIC_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode())); + NS_STATIC_CAST(ContentListItem*, PL_HashTableLookup(mMap, id)); if (! head) { head = new (mPool) ContentListItem(aContent); if (! head) return NS_ERROR_OUT_OF_MEMORY; - PRUnichar* key = new PRUnichar[aID.Length() + 1]; + PRUnichar* key = ToNewUnicode(aID); if (! key) return NS_ERROR_OUT_OF_MEMORY; - nsCRT::memcpy(key, aID.GetUnicode(), aID.Length() * sizeof(PRUnichar)); - key[aID.Length()] = PRUnichar(0); - PL_HashTableAdd(mMap, key, head); } else { @@ -193,7 +193,7 @@ nsElementMap::Add(const nsString& aID, nsIContent* aContent) nsCAutoString tagnameC, aidC; tagnameC.AssignWithConversion(tagname); - aidC.AssignWithConversion(aID); + aidC.AssignWithConversion(id, aID.Length()); PR_LOG(gMapLog, PR_LOG_ALWAYS, ("xulelemap(%p) dup %s[%p] <-- %s\n", this, @@ -230,7 +230,7 @@ nsElementMap::Add(const nsString& aID, nsIContent* aContent) nsCAutoString tagnameC, aidC; tagnameC.AssignWithConversion(tagname); - aidC.AssignWithConversion(aID); + aidC.AssignWithConversion(id, aID.Length()); PR_LOG(gMapLog, PR_LOG_ALWAYS, ("xulelemap(%p) add %s[%p] <-- %s\n", this, @@ -245,12 +245,14 @@ nsElementMap::Add(const nsString& aID, nsIContent* aContent) nsresult -nsElementMap::Remove(const nsString& aID, nsIContent* aContent) +nsElementMap::Remove(const nsAReadableString& aID, nsIContent* aContent) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) return NS_ERROR_NOT_INITIALIZED; + const PRUnichar *id = nsPromiseFlatString(aID); + #ifdef PR_LOGGING if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) { nsresult rv; @@ -265,7 +267,7 @@ nsElementMap::Remove(const nsString& aID, nsIContent* aContent) nsCAutoString tagnameC, aidC; tagnameC.AssignWithConversion(tagname); - aidC.AssignWithConversion(aID); + aidC.AssignWithConversion(id); PR_LOG(gMapLog, PR_LOG_ALWAYS, ("xulelemap(%p) remove %s[%p] <-- %s\n", this, @@ -276,8 +278,8 @@ nsElementMap::Remove(const nsString& aID, nsIContent* aContent) #endif PLHashEntry** hep = PL_HashTableRawLookup(mMap, - Hash(aID.GetUnicode()), - aID.GetUnicode()); + Hash(id), + id); // XXX Don't comment out this assert: if you get here, something // has gone dreadfully, horribly wrong. Curse. Scream. File a bug @@ -320,7 +322,7 @@ nsElementMap::Remove(const nsString& aID, nsIContent* aContent) nsresult -nsElementMap::Find(const nsString& aID, nsISupportsArray* aResults) +nsElementMap::Find(const nsAReadableString& aID, nsISupportsArray* aResults) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) @@ -328,7 +330,7 @@ nsElementMap::Find(const nsString& aID, nsISupportsArray* aResults) aResults->Clear(); ContentListItem* item = - NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode())); + NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, (const PRUnichar *)nsPromiseFlatString(aID))); while (item) { aResults->AppendElement(item->mContent); @@ -339,14 +341,14 @@ nsElementMap::Find(const nsString& aID, nsISupportsArray* aResults) nsresult -nsElementMap::FindFirst(const nsString& aID, nsIContent** aResult) +nsElementMap::FindFirst(const nsAReadableString& aID, nsIContent** aResult) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) return NS_ERROR_NOT_INITIALIZED; ContentListItem* item = - NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode())); + NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, (const PRUnichar *)nsPromiseFlatString(aID))); if (item) { *aResult = item->mContent; diff --git a/content/xul/document/src/nsElementMap.h b/content/xul/document/src/nsElementMap.h index c8adc15d884f..252b218a0699 100644 --- a/content/xul/document/src/nsElementMap.h +++ b/content/xul/document/src/nsElementMap.h @@ -97,16 +97,16 @@ public: virtual ~nsElementMap(); nsresult - Add(const nsString& aID, nsIContent* aContent); + Add(const nsAReadableString& aID, nsIContent* aContent); nsresult - Remove(const nsString& aID, nsIContent* aContent); + Remove(const nsAReadableString& aID, nsIContent* aContent); nsresult - Find(const nsString& aID, nsISupportsArray* aResults); + Find(const nsAReadableString& aID, nsISupportsArray* aResults); nsresult - FindFirst(const nsString& aID, nsIContent** aContent); + FindFirst(const nsAReadableString& aID, nsIContent** aContent); typedef PRIntn (*nsElementMapEnumerator)(const PRUnichar* aID, nsIContent* aElement, diff --git a/content/xul/document/src/nsXULCommandDispatcher.cpp b/content/xul/document/src/nsXULCommandDispatcher.cpp index a12de2ee4077..f2ce3d1ae7b7 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.cpp +++ b/content/xul/document/src/nsXULCommandDispatcher.cpp @@ -148,7 +148,7 @@ nsXULCommandDispatcher::SetFocusedElement(nsIDOMElement* aElement) // Need to update focus commands when focus switches from // an element to no element, so don't test mCurrentElement // before updating. - UpdateCommands(NS_ConvertASCIItoUCS2("focus")); + UpdateCommands(NS_LITERAL_STRING("focus")); return NS_OK; } @@ -161,8 +161,8 @@ nsXULCommandDispatcher::SetFocusedWindow(nsIDOMWindow* aWindow) NS_IMETHODIMP nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, - const nsString& aEvents, - const nsString& aTargets) + const nsAReadableString& aEvents, + const nsAReadableString& aTargets) { NS_PRECONDITION(aElement != nsnull, "null ptr"); if (! aElement) @@ -174,11 +174,12 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, while (updater) { if (updater->mElement == aElement) { +#ifdef NS_DEBUG nsCAutoString eventsC, targetsC, aeventsC, atargetsC; eventsC.AssignWithConversion(updater->mEvents); targetsC.AssignWithConversion(updater->mTargets); - aeventsC.AssignWithConversion(aEvents); - atargetsC.AssignWithConversion(aTargets); + aeventsC.Assign(NS_ConvertUCS2toUTF8(aEvents)); + atargetsC.Assign(NS_ConvertUCS2toUTF8(aTargets)); PR_LOG(gLog, PR_LOG_ALWAYS, ("xulcmd[%p] replace %p(events=%s targets=%s) with (events=%s targets=%s)", this, aElement, @@ -186,6 +187,7 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, (const char*) targetsC, (const char*) aeventsC, (const char*) atargetsC)); +#endif // If the updater was already in the list, then replace // (?) the 'events' and 'targets' filters with the new @@ -198,15 +200,17 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, link = &(updater->mNext); updater = updater->mNext; } +#ifdef NS_DEBUG nsCAutoString aeventsC, atargetsC; - aeventsC.AssignWithConversion(aEvents); - atargetsC.AssignWithConversion(aTargets); + aeventsC.Assign(NS_ConvertUCS2toUTF8(aEvents)); + atargetsC.Assign(NS_ConvertUCS2toUTF8(aTargets)); PR_LOG(gLog, PR_LOG_ALWAYS, ("xulcmd[%p] add %p(events=%s targets=%s)", this, aElement, (const char*) aeventsC, (const char*) atargetsC)); +#endif // If we get here, this is a new updater. Append it to the list. updater = new Updater(aElement, aEvents, aTargets); @@ -229,6 +233,7 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement) while (updater) { if (updater->mElement == aElement) { +#ifdef NS_DEBUG nsCAutoString eventsC, targetsC; eventsC.AssignWithConversion(updater->mEvents); targetsC.AssignWithConversion(updater->mTargets); @@ -237,6 +242,7 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement) this, aElement, (const char*) eventsC, (const char*) targetsC)); +#endif *link = updater->mNext; delete updater; @@ -252,7 +258,7 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement) } NS_IMETHODIMP -nsXULCommandDispatcher::UpdateCommands(const nsString& aEventName) +nsXULCommandDispatcher::UpdateCommands(const nsAReadableString& aEventName) { nsresult rv; @@ -294,12 +300,14 @@ nsXULCommandDispatcher::UpdateCommands(const nsString& aEventName) if (! document) continue; +#ifdef NS_DEBUG nsCAutoString aeventnameC; - aeventnameC.AssignWithConversion(aEventName); + aeventnameC.Assign(NS_ConvertUCS2toUTF8(aEventName)); PR_LOG(gLog, PR_LOG_ALWAYS, ("xulcmd[%p] update %p event=%s", this, updater->mElement, (const char*) aeventnameC)); +#endif PRInt32 count = document->GetNumberOfShells(); for (PRInt32 i = 0; i < count; i++) { @@ -416,7 +424,7 @@ nsXULCommandDispatcher::Focus(nsIDOMEvent* aEvent) } if (!mCurrentElement) - UpdateCommands(NS_ConvertASCIItoUCS2("focus")); + UpdateCommands(NS_LITERAL_STRING("focus")); } } } @@ -493,12 +501,13 @@ nsXULCommandDispatcher::SetScriptObject(void *aScriptObject) PRBool -nsXULCommandDispatcher::Matches(const nsString& aList, const nsString& aElement) +nsXULCommandDispatcher::Matches(const nsString& aList, + const nsAReadableString& aElement) { - if (aList.EqualsWithConversion("*")) + if (aList.Equals(NS_LITERAL_STRING("*"))) return PR_TRUE; // match _everything_! - PRInt32 indx = aList.Find(aElement); + PRInt32 indx = aList.Find(nsPromiseFlatString(aElement)); if (indx == -1) return PR_FALSE; // not in the list at all @@ -537,15 +546,16 @@ nsXULCommandDispatcher::GetParentWindowFromDocument(nsIDOMDocument* aDocument, n } NS_IMETHODIMP -nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsIController** _retval) +nsXULCommandDispatcher::GetControllerForCommand(const nsAReadableString& aCommand, nsIController** _retval) { + const PRUnichar *command = nsPromiseFlatString(aCommand); *_retval = nsnull; nsCOMPtr controllers; GetControllers(getter_AddRefs(controllers)); if(controllers) { nsCOMPtr controller; - controllers->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller)); + controllers->GetControllerForCommand(command, getter_AddRefs(controller)); if(controller) { *_retval = controller; NS_ADDREF(*_retval); @@ -575,7 +585,7 @@ nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsICont domWindow->GetControllers(getter_AddRefs(controllers2)); if(controllers2) { nsCOMPtr controller; - controllers2->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller)); + controllers2->GetControllerForCommand(command, getter_AddRefs(controller)); if(controller) { *_retval = controller; NS_ADDREF(*_retval); @@ -619,7 +629,7 @@ nsXULCommandDispatcher::SetSuppressFocus(PRBool aSuppressFocus) // we are unsuppressing after activating, so update focus-related commands // we need this to update commands in the case where an element is focussed. if (!aSuppressFocus && mCurrentElement) - UpdateCommands(NS_ConvertASCIItoUCS2("focus")); + UpdateCommands(NS_LITERAL_STRING("focus")); return NS_OK; } diff --git a/content/xul/document/src/nsXULCommandDispatcher.h b/content/xul/document/src/nsXULCommandDispatcher.h index a7a6594c2bad..3758d3d1cfab 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.h +++ b/content/xul/document/src/nsXULCommandDispatcher.h @@ -95,8 +95,8 @@ protected: class Updater { public: Updater(nsIDOMElement* aElement, - const nsString& aEvents, - const nsString& aTargets) + const nsAReadableString& aEvents, + const nsAReadableString& aTargets) : mElement(aElement), mEvents(aEvents), mTargets(aTargets), @@ -111,7 +111,8 @@ protected: Updater* mUpdaters; - PRBool Matches(const nsString& aList, const nsString& aElement); + PRBool Matches(const nsString& aList, + const nsAReadableString& aElement); }; #endif // nsXULCommandDispatcher_h__ diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 59beb1b039c7..b639716d4e4d 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -129,7 +129,7 @@ #include "nsINodeInfo.h" #include "nsIDOMDocumentType.h" #include "nsIXBLService.h" - +#include "nsReadableUtils.h" #include "nsIXIFConverter.h" // Used for the temporary DOM Level2 hack @@ -679,9 +679,9 @@ nsXULDocument::GetArena() } NS_IMETHODIMP -nsXULDocument::GetContentType(nsString& aContentType) const +nsXULDocument::GetContentType(nsAWritableString& aContentType) const { - aContentType.AssignWithConversion("text/xul"); + aContentType.Assign(NS_LITERAL_STRING("text/xul")); return NS_OK; } @@ -873,24 +873,22 @@ nsXULDocument::GetBaseURL(nsIURI*& aURL) const } NS_IMETHODIMP -nsXULDocument::GetDocumentCharacterSet(nsString& oCharSetID) +nsXULDocument::GetDocumentCharacterSet(nsAWritableString& oCharSetID) { - oCharSetID = mCharSetID; + oCharSetID.Assign(mCharSetID); return NS_OK; } NS_IMETHODIMP -nsXULDocument::SetDocumentCharacterSet(const nsString& aCharSetID) +nsXULDocument::SetDocumentCharacterSet(const nsAReadableString& aCharSetID) { - if (mCharSetID != aCharSetID) { - mCharSetID = aCharSetID; - nsAutoString charSetTopic; - charSetTopic.AssignWithConversion("charset"); + if (!mCharSetID.Equals(aCharSetID)) { + mCharSetID.Assign(aCharSetID); PRInt32 n = mCharSetObservers.Count(); for (PRInt32 i = 0; i < n; i++) { nsIObserver* observer = (nsIObserver*) mCharSetObservers.ElementAt(i); - observer->Observe((nsIDocument*) this, charSetTopic.GetUnicode(), - aCharSetID.GetUnicode()); + observer->Observe((nsIDocument*) this, NS_LITERAL_STRING("charset"), + nsPromiseFlatString(aCharSetID)); } } return NS_OK; @@ -978,13 +976,16 @@ nsXULDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker) NS_IMETHODIMP -nsXULDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const +nsXULDocument::GetHeaderData(nsIAtom* aHeaderField, + nsAWritableString& aData) const { + aData.Truncate(); return NS_OK; } NS_IMETHODIMP -nsXULDocument:: SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) +nsXULDocument:: SetHeaderData(nsIAtom* aHeaderField, + const nsAReadableString& aData) { return NS_OK; } @@ -992,9 +993,9 @@ nsXULDocument:: SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) NS_IMETHODIMP nsXULDocument::CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, - nsIStyleSet* aStyleSet, - nsIPresShell** aInstancePtrResult) + nsIViewManager* aViewManager, + nsIStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult) { NS_PRECONDITION(aInstancePtrResult, "null ptr"); if (! aInstancePtrResult) @@ -1872,7 +1873,7 @@ nsXULDocument::SelectAll() nsIContent * end = nsnull; nsIContent * body = nsnull; - nsAutoString bodyStr; bodyStr.AssignWithConversion("BODY"); + nsAutoString bodyStr; bodyStr.Assign(NS_LITERAL_STRING("BODY")); PRInt32 i, n; mRootContent->ChildCount(n); for (i=0;i= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aTagName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aTagName)); printf ("Possible DOM Error: CreateElement(\"%s\") called, use CreateElementNS() in stead!\n", (const char *)tmp); } @@ -2482,7 +2486,7 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) *getter_AddRefs(prefix)); if (NS_FAILED(rv)) { #ifdef PR_LOGGING - char* tagNameStr = aTagName.ToNewCString(); + char* tagNameStr = ToNewCString(aTagName); PR_LOG(gXULLog, PR_LOG_ERROR, ("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr)); nsCRT::free(tagNameStr); @@ -2493,7 +2497,7 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) #ifdef PR_LOGGING if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { - char* tagCStr = aTagName.ToNewCString(); + char* tagCStr = ToNewCString(aTagName); PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul[CreateElement] %s", tagCStr)); @@ -2532,7 +2536,8 @@ nsXULDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) NS_IMETHODIMP -nsXULDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) +nsXULDocument::CreateTextNode(const nsAReadableString& aData, + nsIDOMText** aReturn) { NS_PRECONDITION(aReturn != nsnull, "null ptr"); if (! aReturn) @@ -2544,7 +2549,7 @@ nsXULDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) rv = nsComponentManager::CreateInstance(kTextNodeCID, nsnull, NS_GET_IID(nsITextContent), getter_AddRefs(text)); if (NS_FAILED(rv)) return rv; - rv = text->SetText(aData.GetUnicode(), aData.Length(), PR_FALSE); + rv = text->SetText(aData, PR_FALSE); if (NS_FAILED(rv)) return rv; rv = text->QueryInterface(NS_GET_IID(nsIDOMText), (void**) aReturn); @@ -2556,7 +2561,8 @@ nsXULDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) NS_IMETHODIMP -nsXULDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) +nsXULDocument::CreateComment(const nsAReadableString& aData, + nsIDOMComment** aReturn) { NS_NOTREACHED("nsXULDocument::CreateComment"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2564,7 +2570,8 @@ nsXULDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) NS_IMETHODIMP -nsXULDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) +nsXULDocument::CreateCDATASection(const nsAReadableString& aData, + nsIDOMCDATASection** aReturn) { NS_NOTREACHED("nsXULDocument::CreateCDATASection"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2572,7 +2579,9 @@ nsXULDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aR NS_IMETHODIMP -nsXULDocument::CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn) +nsXULDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, + nsIDOMProcessingInstruction** aReturn) { NS_NOTREACHED("nsXULDocument::CreateProcessingInstruction"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2580,7 +2589,8 @@ nsXULDocument::CreateProcessingInstruction(const nsString& aTarget, const nsStri NS_IMETHODIMP -nsXULDocument::CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) +nsXULDocument::CreateAttribute(const nsAReadableString& aName, + nsIDOMAttr** aReturn) { NS_NOTREACHED("nsXULDocument::CreateAttribute"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2588,7 +2598,8 @@ nsXULDocument::CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) NS_IMETHODIMP -nsXULDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn) +nsXULDocument::CreateEntityReference(const nsAReadableString& aName, + nsIDOMEntityReference** aReturn) { NS_NOTREACHED("nsXULDocument::CreateEntityReference"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2596,12 +2607,13 @@ nsXULDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReferenc NS_IMETHODIMP -nsXULDocument::GetElementsByTagName(const nsString& aTagName, nsIDOMNodeList** aReturn) +nsXULDocument::GetElementsByTagName(const nsAReadableString& aTagName, + nsIDOMNodeList** aReturn) { if (kStrictDOMLevel2) { PRInt32 pos = aTagName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aTagName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aTagName)); printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp); } } @@ -2628,8 +2640,9 @@ nsXULDocument::GetElementsByTagName(const nsString& aTagName, nsIDOMNodeList** a } NS_IMETHODIMP -nsXULDocument::GetElementsByAttribute(const nsString& aAttribute, const nsString& aValue, - nsIDOMNodeList** aReturn) +nsXULDocument::GetElementsByAttribute(const nsAReadableString& aAttribute, + const nsAReadableString& aValue, + nsIDOMNodeList** aReturn) { nsresult rv; nsRDFDOMNodeList* elements; @@ -2656,7 +2669,8 @@ nsXULDocument::GetElementsByAttribute(const nsString& aAttribute, const nsString NS_IMETHODIMP -nsXULDocument::Persist(const nsString& aID, const nsString& aAttr) +nsXULDocument::Persist(const nsAReadableString& aID, + const nsAReadableString& aAttr) { nsresult rv; @@ -2685,7 +2699,8 @@ nsXULDocument::Persist(const nsString& aID, const nsString& aAttr) nsresult -nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute) +nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID, + nsIAtom* aAttribute) { // First make sure we _have_ a local store to stuff the persited // information into. (We might not have one if profile information @@ -2792,23 +2807,16 @@ nsXULDocument::DestroyForwardReferences() // nsIDOMNSDocument interface // -NS_IMETHODIMP -nsXULDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets) -{ - NS_NOTREACHED("nsXULDocument::GetStyleSheets"); - return NS_ERROR_NOT_IMPLEMENTED; -} - NS_IMETHODIMP -nsXULDocument::GetCharacterSet(nsString& aCharacterSet) +nsXULDocument::GetCharacterSet(nsAWritableString& aCharacterSet) { return GetDocumentCharacterSet(aCharacterSet); } NS_IMETHODIMP -nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, - nsIDOMElement** aResult) +nsXULDocument::CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, + nsIDOMElement** aResult) { printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n"); @@ -2821,8 +2829,8 @@ nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName, #ifdef PR_LOGGING if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { - char* namespaceCStr = aNameSpace.ToNewCString(); - char* tagCStr = aTagName.ToNewCString(); + char* namespaceCStr = ToNewCString(aNameSpace); + char* tagCStr = ToNewCString(aTagName); PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr)); @@ -2832,7 +2840,7 @@ nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName, } #endif - nsCOMPtr name = dont_AddRef(NS_NewAtom(aTagName.GetUnicode())); + nsCOMPtr name = dont_AddRef(NS_NewAtom(aTagName)); if (! name) return NS_ERROR_OUT_OF_MEMORY; @@ -2898,8 +2906,8 @@ nsXULDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView) nsresult nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, - PRInt32* aWidth, - PRInt32* aHeight) + PRInt32* aWidth, + PRInt32* aHeight) { nsresult result = NS_OK; nsSize size; @@ -3005,7 +3013,8 @@ nsXULDocument::GetHeight(PRInt32* aHeight) } NS_IMETHODIMP -nsXULDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) +nsXULDocument::AddBinding(nsIDOMElement* aContent, + const nsAReadableString& aURL) { nsCOMPtr bm; GetBindingManager(getter_AddRefs(bm)); @@ -3015,7 +3024,8 @@ nsXULDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsXULDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) +nsXULDocument::RemoveBinding(nsIDOMElement* aContent, + const nsAReadableString& aURL) { if (mBindingManager) { nsCOMPtr content(do_QueryInterface(aContent)); @@ -3026,7 +3036,7 @@ nsXULDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsXULDocument::LoadBindingDocument(const nsString& aURL) +nsXULDocument::LoadBindingDocument(const nsAReadableString& aURL) { if (mBindingManager) return mBindingManager->LoadBindingDocument(this, aURL); @@ -3034,7 +3044,8 @@ nsXULDocument::LoadBindingDocument(const nsString& aURL) } NS_IMETHODIMP -nsXULDocument::GetAnonymousNodes(nsIDOMElement* aElement, nsIDOMNodeList** aResult) +nsXULDocument::GetAnonymousNodes(nsIDOMElement* aElement, + nsIDOMNodeList** aResult) { nsresult rv; nsRDFDOMNodeList* elements; @@ -3084,7 +3095,7 @@ nsXULDocument::GetAnonymousNodes(nsIDOMElement* aElement, nsIDOMNodeList** aResu } NS_IMETHODIMP -nsXULDocument::Load(const nsString& aUrl) +nsXULDocument::Load(const nsAReadableString& aUrl) { NS_NOTREACHED("nsXULDocument::Load"); return NS_ERROR_NOT_IMPLEMENTED; @@ -3164,8 +3175,8 @@ nsXULDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXULDocument::CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -3174,8 +3185,8 @@ nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, #ifdef PR_LOGGING if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { - char* namespaceCStr = aNamespaceURI.ToNewCString(); - char* tagCStr = aQualifiedName.ToNewCString(); + char* namespaceCStr = ToNewCString(aNamespaceURI); + char* tagCStr = ToNewCString(aQualifiedName); PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr)); @@ -3192,7 +3203,7 @@ nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, *getter_AddRefs(prefix)); if (NS_FAILED(rv)) { #ifdef PR_LOGGING - char* tagNameStr = aQualifiedName.ToNewCString(); + char* tagNameStr = ToNewCString(aQualifiedName); PR_LOG(gXULLog, PR_LOG_ERROR, ("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr)); nsCRT::free(tagNameStr); @@ -3223,8 +3234,8 @@ nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULDocument::CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXULDocument::CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -3232,7 +3243,8 @@ nsXULDocument::CreateAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) +nsXULDocument::GetElementById(const nsAReadableString& aId, + nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; @@ -3258,8 +3270,8 @@ nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) } NS_IMETHODIMP -nsXULDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsresult rv; @@ -3277,7 +3289,7 @@ nsXULDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, if (root) { PRInt32 nsid = kNameSpaceID_Unknown; - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { rv = mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nsid); NS_ENSURE_SUCCESS(rv, rv); @@ -3460,15 +3472,15 @@ nsXULDocument::RemoveElementsFromMapByContent(const PRUnichar* aID, // NS_IMETHODIMP -nsXULDocument::GetNodeName(nsString& aNodeName) +nsXULDocument::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#document"); + aNodeName.Assign(NS_LITERAL_STRING("#document")); return NS_OK; } NS_IMETHODIMP -nsXULDocument::GetNodeValue(nsString& aNodeValue) +nsXULDocument::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; @@ -3476,9 +3488,9 @@ nsXULDocument::GetNodeValue(nsString& aNodeValue) NS_IMETHODIMP -nsXULDocument::SetNodeValue(const nsString& aNodeValue) +nsXULDocument::SetNodeValue(const nsAReadableString& aNodeValue) { - return NS_OK; + return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -3638,7 +3650,7 @@ nsXULDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) NS_IMETHODIMP -nsXULDocument::GetNamespaceURI(nsString& aNamespaceURI) +nsXULDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; @@ -3646,7 +3658,7 @@ nsXULDocument::GetNamespaceURI(nsString& aNamespaceURI) NS_IMETHODIMP -nsXULDocument::GetPrefix(nsString& aPrefix) +nsXULDocument::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; @@ -3654,14 +3666,14 @@ nsXULDocument::GetPrefix(nsString& aPrefix) NS_IMETHODIMP -nsXULDocument::SetPrefix(const nsString& aPrefix) +nsXULDocument::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsXULDocument::GetLocalName(nsString& aLocalName) +nsXULDocument::GetLocalName(nsAWritableString& aLocalName) { aLocalName.Truncate(); return NS_OK; @@ -3718,7 +3730,8 @@ nsXULDocument::Normalize() NS_IMETHODIMP -nsXULDocument::Supports(const nsString& aFeature, const nsString& aVersion, +nsXULDocument::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -4200,7 +4213,7 @@ nsXULDocument::StartLayout(void) nsresult nsXULDocument::GetElementsByTagName(nsIContent *aContent, - const nsString& aName, + const nsAReadableString& aName, PRInt32 aNamespaceID, nsRDFDOMNodeList* aElements) { @@ -4217,7 +4230,7 @@ nsXULDocument::GetElementsByTagName(nsIContent *aContent, aContent->GetNodeInfo(*getter_AddRefs(ni)); NS_ENSURE_TRUE(ni, NS_OK); - if (aName.EqualsWithConversion("*")) { + if (aName.Equals(NS_LITERAL_STRING("*"))) { if (aNamespaceID == kNameSpaceID_Unknown || ni->NamespaceEquals(aNamespaceID)) { if (NS_FAILED(rv = aElements->AppendNode(element))) { @@ -4262,8 +4275,8 @@ nsXULDocument::GetElementsByTagName(nsIContent *aContent, nsresult nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttribute, - const nsString& aValue, + const nsAReadableString& aAttribute, + const nsAReadableString& aValue, nsRDFDOMNodeList* aElements) { nsresult rv; @@ -4279,7 +4292,7 @@ nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, return rv; } - if ((attrValue == aValue) || (attrValue.Length() > 0 && aValue.EqualsWithConversion("*"))) { + if ((attrValue.Equals(aValue)) || (attrValue.Length() > 0 && aValue.Equals(NS_LITERAL_STRING("*")))) { if (NS_FAILED(rv = aElements->AppendNode(aNode))) { NS_ERROR("unable to append element to node list"); return rv; @@ -4321,7 +4334,7 @@ nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, nsresult -nsXULDocument::ParseTagString(const nsString& aTagName, nsIAtom*& aName, +nsXULDocument::ParseTagString(const nsAReadableString& aTagName, nsIAtom*& aName, nsIAtom*& aPrefix) { // Parse the tag into a name and prefix @@ -4371,8 +4384,9 @@ nsXULDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const ns } NS_IMETHODIMP -nsXULDocument::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULDocument::AddEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { nsIEventListenerManager *manager; @@ -4387,8 +4401,9 @@ nsXULDocument::AddEventListener(const nsString& aType, nsIDOMEventListener* aLis } NS_IMETHODIMP -nsXULDocument::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULDocument::RemoveEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { if (mListenerManager) { PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; @@ -4422,7 +4437,8 @@ nsXULDocument::DispatchEvent(nsIDOMEvent* aEvent) } NS_IMETHODIMP -nsXULDocument::CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn) +nsXULDocument::CreateEvent(const nsAReadableString& aEventType, + nsIDOMEvent** aReturn) { // Obtain a presentation context PRInt32 count = GetNumberOfShells(); @@ -4478,7 +4494,7 @@ nsXULDocument::HandleEvent(nsIDOMEvent *aEvent) } nsresult -nsXULDocument::CaptureEvent(const nsString& aType) +nsXULDocument::CaptureEvent(const nsAReadableString& aType) { nsIEventListenerManager *mManager; @@ -4491,7 +4507,7 @@ nsXULDocument::CaptureEvent(const nsString& aType) } nsresult -nsXULDocument::ReleaseEvent(const nsString& aType) +nsXULDocument::ReleaseEvent(const nsAReadableString& aType) { if (mListenerManager) { //mListenerManager->ReleaseEvent(aListener); @@ -6287,7 +6303,7 @@ nsXULDocument::BroadcasterHookup::~BroadcasterHookup() rv = mObservesElement->GetAttribute(kNameSpaceID_None, kObservesAtom, broadcasterID); if (NS_FAILED(rv)) return; - attribute.AssignWithConversion("*"); + attribute.Assign(NS_LITERAL_STRING("*")); } nsAutoString tagStr; @@ -6381,7 +6397,7 @@ nsXULDocument::CheckBroadcasterHookup(nsXULDocument* aDocument, listener = do_QueryInterface(aElement); - attribute.AssignWithConversion("*"); + attribute.Assign(NS_LITERAL_STRING("*")); } // Make sure we got a valid listener. @@ -6779,7 +6795,7 @@ nsXULDocument::ToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode) } NS_IMETHODIMP -nsXULDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) +nsXULDocument::CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection) { nsresult result=NS_OK; @@ -6793,28 +6809,28 @@ nsXULDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) converter->SetSelection(aSelection); - converter->AddStartTag( NS_ConvertToString("section") , PR_TRUE); - converter->AddStartTag( NS_ConvertToString("section_head") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section_head") , PR_TRUE); - converter->BeginStartTag( NS_ConvertToString("document_info") ); - converter->AddAttribute(NS_ConvertToString("charset"),mCharSetID); + converter->BeginStartTag( NS_LITERAL_STRING("document_info") ); + converter->AddAttribute(NS_LITERAL_STRING("charset"),mCharSetID); /* nsCOMPtr uri (getter_AddRefs(GetDocumentURL())); if (uri) { char* spec = 0; if (NS_SUCCEEDED(uri->GetSpec(&spec)) && spec) { - converter->AddAttribute(NS_ConvertToString("uri"), NS_ConvertToString(spec)); + converter->AddAttribute(NS_LITERAL_STRING("uri"), NS_ConvertToString(spec)); Recycle(spec); } }*/ - converter->FinishStartTag(NS_ConvertToString("document_info"),PR_TRUE,PR_TRUE); + converter->FinishStartTag(NS_LITERAL_STRING("document_info"),PR_TRUE,PR_TRUE); - converter->AddEndTag(NS_ConvertToString("section_head"), PR_TRUE, PR_TRUE); - converter->AddStartTag(NS_ConvertToString("section_body"), PR_TRUE); + converter->AddEndTag(NS_LITERAL_STRING("section_head"), PR_TRUE, PR_TRUE); + converter->AddStartTag(NS_LITERAL_STRING("section_body"), PR_TRUE); //HACKHACKHACK DOCTYPE NOT DONE FOR XULDOCUMENTS>ASSIGN IN HTML nsString hack; - hack.AssignWithConversion("DOCTYPE html PUBLIC \"-//w3c//dtd html 4.0 transitional//en\""); + hack.Assign(NS_LITERAL_STRING("DOCTYPE html PUBLIC \"-//w3c//dtd html 4.0 transitional//en\"")); converter->AddMarkupDeclaration(hack); nsCOMPtr doctype; diff --git a/content/xul/document/src/nsXULDocument.h b/content/xul/document/src/nsXULDocument.h index 15068b886437..174bc0fbb765 100644 --- a/content/xul/document/src/nsXULDocument.h +++ b/content/xul/document/src/nsXULDocument.h @@ -116,7 +116,7 @@ public: // nsIDocument interface virtual nsIArena* GetArena(); - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, @@ -139,9 +139,9 @@ public: NS_IMETHOD GetBaseURL(nsIURI*& aURL) const; - NS_IMETHOD GetDocumentCharacterSet(nsString& oCharSetID); + NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharSetID); - NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID); + NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID); NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver); NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver); @@ -151,8 +151,10 @@ public: NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) ; NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) ; - NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const; - NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData); + NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, + nsAWritableString& aData) const; + NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, + const nsAReadableString& aData); NS_IMETHOD CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, @@ -262,9 +264,9 @@ public: NS_IMETHOD SelectAll(); - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); - NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection); + NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection); NS_IMETHOD ToXIF(nsIXIFConverter *aConverter, nsIDOMNode* aNode); @@ -308,9 +310,9 @@ public: #endif // nsIXULDocument interface - NS_IMETHOD AddElementForID(const nsString& aID, nsIContent* aElement); - NS_IMETHOD RemoveElementForID(const nsString& aID, nsIContent* aElement); - NS_IMETHOD GetElementsForID(const nsString& aID, nsISupportsArray* aElements); + NS_IMETHOD AddElementForID(const nsAReadableString& aID, nsIContent* aElement); + NS_IMETHOD RemoveElementForID(const nsAReadableString& aID, nsIContent* aElement); + NS_IMETHOD GetElementsForID(const nsAReadableString& aID, nsISupportsArray* aElements); NS_IMETHOD CreateContents(nsIContent* aElement); NS_IMETHOD AddContentModelBuilder(nsIRDFContentModelBuilder* aBuilder); NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); @@ -330,8 +332,8 @@ public: const char* aCommand ); // nsIDOMEventCapturer interface - NS_IMETHOD CaptureEvent(const nsString& aType); - NS_IMETHOD ReleaseEvent(const nsString& aType); + NS_IMETHOD CaptureEvent(const nsAReadableString& aType); + NS_IMETHOD ReleaseEvent(const nsAReadableString& aType); // nsIDOMEventReceiver interface (yuck. inherited from nsIDOMEventCapturer) NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); @@ -341,9 +343,11 @@ public: NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent); // nsIDOMEventTarget interface - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); @@ -360,41 +364,13 @@ public: NS_DECL_IDOMDOCUMENTXBL // nsIDOMNSDocument interface - NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets); - NS_IMETHOD GetCharacterSet(nsString& aCharacterSet); - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aResult); - NS_IMETHOD CreateRange(nsIDOMRange** aRange); - NS_IMETHOD Load (const nsString& aUrl); - NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); + NS_DECL_IDOMNSDOCUMENT // nsIDOMXULDocument interface NS_DECL_IDOMXULDOCUMENT // nsIDOMNode interface - NS_IMETHOD GetNodeName(nsString& aNodeName); - NS_IMETHOD GetNodeValue(nsString& aNodeValue); - NS_IMETHOD SetNodeValue(const nsString& aNodeValue); - NS_IMETHOD GetNodeType(PRUint16* aNodeType); - NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode); - NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes); - NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes); - NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild); - NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild); - NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling); - NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling); - NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes); - NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument); - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI); - NS_IMETHOD GetPrefix(nsString& aPrefix); - NS_IMETHOD SetPrefix(const nsString& aPrefix); - NS_IMETHOD GetLocalName(nsString& aLocalName); - NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn); - NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn); - NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn); - NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn); - NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD Normalize(); - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn); + NS_DECL_IDOMNODE // nsIJSScriptObject interface virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, @@ -420,7 +396,7 @@ public: static nsresult GetElementsByTagName(nsIContent* aContent, - const nsString& aTagName, + const nsAReadableString& aTagName, PRInt32 aNamespaceID, nsRDFDOMNodeList* aElements); @@ -458,12 +434,12 @@ protected: static nsresult GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttribute, - const nsString& aValue, + const nsAReadableString& aAttribute, + const nsAReadableString& aValue, nsRDFDOMNodeList* aElements); nsresult - ParseTagString(const nsString& aTagName, nsIAtom*& aName, + ParseTagString(const nsAReadableString& aTagName, nsIAtom*& aName, nsIAtom*& aPrefix); void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; }; diff --git a/content/xul/document/src/nsXULPrototypeDocument.cpp b/content/xul/document/src/nsXULPrototypeDocument.cpp index 52bfe95e81d1..0786f25a7f0d 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -113,8 +113,8 @@ public: NS_IMETHOD AddOverlayReference(nsIURI* aURI); NS_IMETHOD GetOverlayReferences(nsISupportsArray** aResult); - NS_IMETHOD GetHeaderData(nsIAtom* aField, nsString& aData) const; - NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsString& aData); + NS_IMETHOD GetHeaderData(nsIAtom* aField, nsAWritableString& aData) const; + NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsAReadableString& aData); NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aResult); NS_IMETHOD SetDocumentPrincipal(nsIPrincipal* aPrincipal); @@ -303,7 +303,7 @@ nsXULPrototypeDocument::GetOverlayReferences(nsISupportsArray** aResult) NS_IMETHODIMP -nsXULPrototypeDocument::GetHeaderData(nsIAtom* aField, nsString& aData) const +nsXULPrototypeDocument::GetHeaderData(nsIAtom* aField, nsAWritableString& aData) const { // XXX Not implemented aData.Truncate(); @@ -312,7 +312,7 @@ nsXULPrototypeDocument::GetHeaderData(nsIAtom* aField, nsString& aData) const NS_IMETHODIMP -nsXULPrototypeDocument::SetHeaderData(nsIAtom* aField, const nsString& aData) +nsXULPrototypeDocument::SetHeaderData(nsIAtom* aField, const nsAReadableString& aData) { // XXX Not implemented return NS_OK; diff --git a/content/xul/templates/src/nsXULContentUtils.cpp b/content/xul/templates/src/nsXULContentUtils.cpp index 24826d9dcb04..208bb1f6cbcb 100644 --- a/content/xul/templates/src/nsXULContentUtils.cpp +++ b/content/xul/templates/src/nsXULContentUtils.cpp @@ -149,22 +149,22 @@ public: GetElementRefResource(nsIContent* aElement, nsIRDFResource** aResult); NS_IMETHOD - GetTextForNode(nsIRDFNode* aNode, nsString& aResult); + GetTextForNode(nsIRDFNode* aNode, nsAWritableString& aResult); NS_IMETHOD - GetElementLogString(nsIContent* aElement, nsString& aResult); + GetElementLogString(nsIContent* aElement, nsAWritableString& aResult); NS_IMETHOD - GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult); + GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsAWritableString& aResult); NS_IMETHOD - MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI); + MakeElementURI(nsIDocument* aDocument, const nsAReadableString& aElementID, nsCString& aURI); NS_IMETHOD - MakeElementResource(nsIDocument* aDocument, const nsString& aElementID, nsIRDFResource** aResult); + MakeElementResource(nsIDocument* aDocument, const nsAReadableString& aElementID, nsIRDFResource** aResult); NS_IMETHOD - MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID); + MakeElementID(nsIDocument* aDocument, const nsAReadableString& aURI, nsAWritableString& aElementID); NS_IMETHOD_(PRBool) IsContainedBy(nsIContent* aElement, nsIContent* aContainer); @@ -173,7 +173,7 @@ public: GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aResult); NS_IMETHOD - GetResource(PRInt32 aNameSpaceID, const nsString& aAttribute, nsIRDFResource** aResult); + GetResource(PRInt32 aNameSpaceID, const nsAReadableString& aAttribute, nsIRDFResource** aResult); NS_IMETHOD SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement); @@ -536,7 +536,7 @@ nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource** return NS_ERROR_UNEXPECTED; nsCAutoString uriStr; - uriStr.AssignWithConversion(uri); + uriStr.Assign(NS_ConvertUCS2toUTF8(uri)); rv = rdf_MakeAbsoluteURI(url, uriStr); if (NS_FAILED(rv)) return rv; @@ -556,7 +556,7 @@ nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource** */ NS_IMETHODIMP -nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) +nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAWritableString& aResult) { if (! aNode) { aResult.Truncate(); @@ -582,11 +582,13 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) rv = dateLiteral->GetValue(&value); if (NS_FAILED(rv)) return rv; + nsAutoString str; rv = gFormat->FormatPRTime(nsnull /* nsILocale* locale */, kDateFormatShort, kTimeFormatSeconds, PRTime(value), - aResult); + str); + aResult.Assign(str); if (NS_FAILED(rv)) return rv; @@ -600,7 +602,9 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) if (NS_FAILED(rv)) return rv; aResult.Truncate(); - aResult.AppendInt(value, 10); + nsAutoString intStr; + intStr.AppendInt(value, 10); + aResult.Append(intStr); return NS_OK; } @@ -610,7 +614,7 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) const char* p; rv = resource->GetValueConst(&p); if (NS_FAILED(rv)) return rv; - aResult.AssignWithConversion(p); + aResult.Assign(NS_ConvertASCIItoUCS2(p)); return NS_OK; } @@ -619,11 +623,11 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) } NS_IMETHODIMP -nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) +nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsAWritableString& aResult) { nsresult rv; - aResult.AssignWithConversion('<'); + aResult.Assign(PRUnichar('<')); nsCOMPtr ns; @@ -632,7 +636,7 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) if (NS_FAILED(rv)) return rv; if (kNameSpaceID_HTML == elementNameSpaceID) { - aResult.AppendWithConversion("html:"); + aResult.Append(NS_LITERAL_STRING("html:")); } else { nsCOMPtr xml( do_QueryInterface(aElement) ); @@ -651,7 +655,7 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) const PRUnichar *unicodeString; prefix->GetUnicode(&unicodeString); aResult.Append(unicodeString); - aResult.AppendWithConversion(':'); + aResult.Append(NS_LITERAL_STRING(":")); } } } @@ -669,7 +673,7 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) if (NS_FAILED(rv)) return rv; for (PRInt32 i = 0; i < count; ++i) { - aResult.AppendWithConversion(' '); + aResult.Append(NS_LITERAL_STRING(" ")); PRInt32 nameSpaceID; nsCOMPtr name, prefix; @@ -680,23 +684,23 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) nsXULContentUtils::GetAttributeLogString(aElement, nameSpaceID, name, attr); aResult.Append(attr); - aResult.AppendWithConversion("=\""); + aResult.Append(NS_LITERAL_STRING("=\"")); nsAutoString value; rv = aElement->GetAttribute(nameSpaceID, name, value); if (NS_FAILED(rv)) return rv; aResult.Append(value); - aResult.AppendWithConversion("\""); + aResult.Append(NS_LITERAL_STRING("\"")); } - aResult.AppendWithConversion('>'); + aResult.Append(NS_LITERAL_STRING(">")); return NS_OK; } NS_IMETHODIMP -nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult) +nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsAWritableString& aResult) { nsresult rv; @@ -727,7 +731,7 @@ nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpac const PRUnichar *unicodeString; prefix->GetUnicode(&unicodeString); aResult.Append(unicodeString); - aResult.AppendWithConversion(':'); + aResult.Append(NS_LITERAL_STRING(":")); } } } @@ -740,14 +744,14 @@ nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpac NS_IMETHODIMP -nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI) +nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsAReadableString& aElementID, nsCString& aURI) { // Convert an element's ID to a URI that can be used to refer to // the element in the XUL graph. if (aElementID.FindChar(':') > 0) { // Assume it's absolute already. Use as is. - aURI.AssignWithConversion(aElementID.GetUnicode()); + aURI.Assign(NS_ConvertUCS2toUTF8(aElementID)); } else { nsresult rv; @@ -791,7 +795,7 @@ nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aEleme NS_IMETHODIMP -nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsString& aID, nsIRDFResource** aResult) +nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsAReadableString& aID, nsIRDFResource** aResult) { nsresult rv; @@ -810,7 +814,7 @@ nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsString& a NS_IMETHODIMP -nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID) +nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsAReadableString& aURI, nsAWritableString& aElementID) { // Convert a URI into an element ID that can be accessed from the // DOM APIs. @@ -825,7 +829,9 @@ nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsString& aURI, n if (! spec) return NS_ERROR_FAILURE; - if (aURI.Find(spec) == 0) { + // XXX FIX ME to not do a copy + nsAutoString str(aURI); + if (str.Find(spec) == 0) { #ifdef USE_BROKEN_RELATIVE_PARSING static const PRInt32 kFudge = 1; // XXX assume '#' #else @@ -881,7 +887,7 @@ nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDF NS_IMETHODIMP -nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, const nsString& aAttribute, nsIRDFResource** aResult) +nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, const nsAReadableString& aAttribute, nsIRDFResource** aResult) { // construct a fully-qualified URI from the namespace/tag pair. @@ -947,13 +953,13 @@ nsXULContentUtils::SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElemen rv = aElement->GetAttribute(kNameSpaceID_None, kEventsAtom, events); if (rv != NS_CONTENT_ATTR_HAS_VALUE) - events.AssignWithConversion("*"); + events.Assign(NS_LITERAL_STRING("*")); nsAutoString targets; rv = aElement->GetAttribute(kNameSpaceID_None, kTargetsAtom, targets); if (rv != NS_CONTENT_ATTR_HAS_VALUE) - targets.AssignWithConversion("*"); + targets.Assign(NS_LITERAL_STRING("*")); nsCOMPtr domelement = do_QueryInterface(aElement); NS_ASSERTION(domelement != nsnull, "not a DOM element"); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 8571dbd37bbf..c132f5ac7af2 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -3404,7 +3404,7 @@ nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType nsCOMPtr baseURI = mCurrentURI; PRInt32 millis = -1; - PRUnichar *uriAttrib = nsnull; + nsAutoString uriAttrib; nsString result; result.AssignWithConversion (refreshHeader); PRInt32 semiColon = result.FindCharInSet(";,"); @@ -3441,7 +3441,7 @@ nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType if (loc > -1) token.Cut(0, loc+1); token.Trim(" \"'"); - uriAttrib = token.ToNewUnicode(); + uriAttrib = token; } else { // Increment to the next token. if (semiColon > -1) { @@ -3457,11 +3457,10 @@ nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType } // end while nsCOMPtr uri; - if (!uriAttrib) { + if (!uriAttrib.Length()) { uri = baseURI; } else { - NS_NewURI(getter_AddRefs(uri), nsAutoString(uriAttrib), baseURI); - nsMemory::Free(uriAttrib); + NS_NewURI(getter_AddRefs(uri), uriAttrib, baseURI); } RefreshURI (uri, millis, PR_FALSE); diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index 933fa926505c..51013dd6ed16 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -515,14 +515,15 @@ nsWebShell::GetReferrer(nsIURI **aReferrer) void nsWebShell::SetReferrer(const PRUnichar* aReferrer) { - NS_NewURI(getter_AddRefs(mReferrerURI), nsAutoString(aReferrer), nsnull); + NS_NewURI(getter_AddRefs(mReferrerURI), nsLiteralString(aReferrer), nsnull); } NS_IMETHODIMP nsWebShell::SetURL(const PRUnichar* aURL) { nsCOMPtr uri; - NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(uri), nsAutoString(aURL), nsnull), + NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(uri), nsLiteralString(aURL), + nsnull), NS_ERROR_FAILURE); SetCurrentURI(uri); return NS_OK; @@ -828,7 +829,7 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent, // and down in the load document code we'll detect this and // set the correct uri loader command nsCOMPtr uri; - NS_NewURI(getter_AddRefs(uri), nsAutoString(aURLSpec), nsnull); + NS_NewURI(getter_AddRefs(uri), nsLiteralString(aURLSpec), nsnull); nsCOMPtr owner; GetCurrentDocumentOwner(getter_AddRefs(owner)); diff --git a/dom/public/base/nsIDOMCRMFObject.h b/dom/public/base/nsIDOMCRMFObject.h index a97e039d7c31..d40713d37adf 100644 --- a/dom/public/base/nsIDOMCRMFObject.h +++ b/dom/public/base/nsIDOMCRMFObject.h @@ -37,17 +37,17 @@ class nsIDOMCRMFObject : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCRMFOBJECT_IID; return iid; } - NS_IMETHOD GetRequest(nsString& aRequest)=0; + NS_IMETHOD GetRequest(nsAWritableString& aRequest)=0; }; #define NS_DECL_IDOMCRMFOBJECT \ - NS_IMETHOD GetRequest(nsString& aRequest); \ + NS_IMETHOD GetRequest(nsAWritableString& aRequest); \ #define NS_FORWARD_IDOMCRMFOBJECT(_to) \ - NS_IMETHOD GetRequest(nsString& aRequest) { return _to GetRequest(aRequest); } \ + NS_IMETHOD GetRequest(nsAWritableString& aRequest) { return _to GetRequest(aRequest); } \ extern "C" NS_DOM nsresult NS_InitCRMFObjectClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMCrypto.h b/dom/public/base/nsIDOMCrypto.h index 8e06a31cdbdc..f49181d953e6 100644 --- a/dom/public/base/nsIDOMCrypto.h +++ b/dom/public/base/nsIDOMCrypto.h @@ -39,19 +39,19 @@ class nsIDOMCrypto : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCRYPTO_IID; return iid; } - NS_IMETHOD GetVersion(nsString& aVersion)=0; + NS_IMETHOD GetVersion(nsAWritableString& aVersion)=0; NS_IMETHOD GenerateCRMFRequest(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMCRMFObject** aReturn)=0; - NS_IMETHOD ImportUserCertificates(const nsString& aNickname, const nsString& aCmmfResponse, PRBool aDoForcedBackup, nsString& aReturn)=0; + NS_IMETHOD ImportUserCertificates(const nsAReadableString& aNickname, const nsAReadableString& aCmmfResponse, PRBool aDoForcedBackup, nsAWritableString& aReturn)=0; - NS_IMETHOD PopChallengeResponse(const nsString& aChallenge, nsString& aReturn)=0; + NS_IMETHOD PopChallengeResponse(const nsAReadableString& aChallenge, nsAWritableString& aReturn)=0; - NS_IMETHOD Random(PRInt32 aNumBytes, nsString& aReturn)=0; + NS_IMETHOD Random(PRInt32 aNumBytes, nsAWritableString& aReturn)=0; - NS_IMETHOD SignText(JSContext* cx, jsval* argv, PRUint32 argc, nsString& aReturn)=0; + NS_IMETHOD SignText(JSContext* cx, jsval* argv, PRUint32 argc, nsAWritableString& aReturn)=0; - NS_IMETHOD Alert(const nsString& aMessage)=0; + NS_IMETHOD Alert(const nsAReadableString& aMessage)=0; NS_IMETHOD Logout()=0; @@ -60,26 +60,26 @@ public: #define NS_DECL_IDOMCRYPTO \ - NS_IMETHOD GetVersion(nsString& aVersion); \ + NS_IMETHOD GetVersion(nsAWritableString& aVersion); \ NS_IMETHOD GenerateCRMFRequest(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMCRMFObject** aReturn); \ - NS_IMETHOD ImportUserCertificates(const nsString& aNickname, const nsString& aCmmfResponse, PRBool aDoForcedBackup, nsString& aReturn); \ - NS_IMETHOD PopChallengeResponse(const nsString& aChallenge, nsString& aReturn); \ - NS_IMETHOD Random(PRInt32 aNumBytes, nsString& aReturn); \ - NS_IMETHOD SignText(JSContext* cx, jsval* argv, PRUint32 argc, nsString& aReturn); \ - NS_IMETHOD Alert(const nsString& aMessage); \ + NS_IMETHOD ImportUserCertificates(const nsAReadableString& aNickname, const nsAReadableString& aCmmfResponse, PRBool aDoForcedBackup, nsAWritableString& aReturn); \ + NS_IMETHOD PopChallengeResponse(const nsAReadableString& aChallenge, nsAWritableString& aReturn); \ + NS_IMETHOD Random(PRInt32 aNumBytes, nsAWritableString& aReturn); \ + NS_IMETHOD SignText(JSContext* cx, jsval* argv, PRUint32 argc, nsAWritableString& aReturn); \ + NS_IMETHOD Alert(const nsAReadableString& aMessage); \ NS_IMETHOD Logout(); \ NS_IMETHOD DisableRightClick(); \ #define NS_FORWARD_IDOMCRYPTO(_to) \ - NS_IMETHOD GetVersion(nsString& aVersion) { return _to GetVersion(aVersion); } \ + NS_IMETHOD GetVersion(nsAWritableString& aVersion) { return _to GetVersion(aVersion); } \ NS_IMETHOD GenerateCRMFRequest(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMCRMFObject** aReturn) { return _to GenerateCRMFRequest(cx, argv, argc, aReturn); } \ - NS_IMETHOD ImportUserCertificates(const nsString& aNickname, const nsString& aCmmfResponse, PRBool aDoForcedBackup, nsString& aReturn) { return _to ImportUserCertificates(aNickname, aCmmfResponse, aDoForcedBackup, aReturn); } \ - NS_IMETHOD PopChallengeResponse(const nsString& aChallenge, nsString& aReturn) { return _to PopChallengeResponse(aChallenge, aReturn); } \ - NS_IMETHOD Random(PRInt32 aNumBytes, nsString& aReturn) { return _to Random(aNumBytes, aReturn); } \ - NS_IMETHOD SignText(JSContext* cx, jsval* argv, PRUint32 argc, nsString& aReturn) { return _to SignText(cx, argv, argc, aReturn); } \ - NS_IMETHOD Alert(const nsString& aMessage) { return _to Alert(aMessage); } \ + NS_IMETHOD ImportUserCertificates(const nsAReadableString& aNickname, const nsAReadableString& aCmmfResponse, PRBool aDoForcedBackup, nsAWritableString& aReturn) { return _to ImportUserCertificates(aNickname, aCmmfResponse, aDoForcedBackup, aReturn); } \ + NS_IMETHOD PopChallengeResponse(const nsAReadableString& aChallenge, nsAWritableString& aReturn) { return _to PopChallengeResponse(aChallenge, aReturn); } \ + NS_IMETHOD Random(PRInt32 aNumBytes, nsAWritableString& aReturn) { return _to Random(aNumBytes, aReturn); } \ + NS_IMETHOD SignText(JSContext* cx, jsval* argv, PRUint32 argc, nsAWritableString& aReturn) { return _to SignText(cx, argv, argc, aReturn); } \ + NS_IMETHOD Alert(const nsAReadableString& aMessage) { return _to Alert(aMessage); } \ NS_IMETHOD Logout() { return _to Logout(); } \ NS_IMETHOD DisableRightClick() { return _to DisableRightClick(); } \ diff --git a/dom/public/base/nsIDOMDOMException.h b/dom/public/base/nsIDOMDOMException.h index 2fb3f0d1262f..6f2dd27e5f6e 100644 --- a/dom/public/base/nsIDOMDOMException.h +++ b/dom/public/base/nsIDOMDOMException.h @@ -58,29 +58,29 @@ public: NS_IMETHOD GetResult(PRUint32* aResult)=0; - NS_IMETHOD GetMessage(nsString& aMessage)=0; + NS_IMETHOD GetMessage(nsAWritableString& aMessage)=0; - NS_IMETHOD GetName(nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; - NS_IMETHOD ToString(nsString& aReturn)=0; + NS_IMETHOD ToString(nsAWritableString& aReturn)=0; }; #define NS_DECL_IDOMDOMEXCEPTION \ NS_IMETHOD GetCode(PRUint32* aCode); \ NS_IMETHOD GetResult(PRUint32* aResult); \ - NS_IMETHOD GetMessage(nsString& aMessage); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD ToString(nsString& aReturn); \ + NS_IMETHOD GetMessage(nsAWritableString& aMessage); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD ToString(nsAWritableString& aReturn); \ #define NS_FORWARD_IDOMDOMEXCEPTION(_to) \ NS_IMETHOD GetCode(PRUint32* aCode) { return _to GetCode(aCode); } \ NS_IMETHOD GetResult(PRUint32* aResult) { return _to GetResult(aResult); } \ - NS_IMETHOD GetMessage(nsString& aMessage) { return _to GetMessage(aMessage); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD ToString(nsString& aReturn) { return _to ToString(aReturn); } \ + NS_IMETHOD GetMessage(nsAWritableString& aMessage) { return _to GetMessage(aMessage); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD ToString(nsAWritableString& aReturn) { return _to ToString(aReturn); } \ extern "C" NS_DOM nsresult NS_InitDOMExceptionClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMHistory.h b/dom/public/base/nsIDOMHistory.h index ed8fdbaec345..8d8a6fb1be2e 100644 --- a/dom/public/base/nsIDOMHistory.h +++ b/dom/public/base/nsIDOMHistory.h @@ -40,11 +40,11 @@ public: NS_IMETHOD GetLength(PRInt32* aLength)=0; - NS_IMETHOD GetCurrent(nsString& aCurrent)=0; + NS_IMETHOD GetCurrent(nsAWritableString& aCurrent)=0; - NS_IMETHOD GetPrevious(nsString& aPrevious)=0; + NS_IMETHOD GetPrevious(nsAWritableString& aPrevious)=0; - NS_IMETHOD GetNext(nsString& aNext)=0; + NS_IMETHOD GetNext(nsAWritableString& aNext)=0; NS_IMETHOD Back()=0; @@ -52,31 +52,31 @@ public: NS_IMETHOD Go(JSContext* cx, jsval* argv, PRUint32 argc)=0; - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn)=0; + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn)=0; }; #define NS_DECL_IDOMHISTORY \ NS_IMETHOD GetLength(PRInt32* aLength); \ - NS_IMETHOD GetCurrent(nsString& aCurrent); \ - NS_IMETHOD GetPrevious(nsString& aPrevious); \ - NS_IMETHOD GetNext(nsString& aNext); \ + NS_IMETHOD GetCurrent(nsAWritableString& aCurrent); \ + NS_IMETHOD GetPrevious(nsAWritableString& aPrevious); \ + NS_IMETHOD GetNext(nsAWritableString& aNext); \ NS_IMETHOD Back(); \ NS_IMETHOD Forward(); \ NS_IMETHOD Go(JSContext* cx, jsval* argv, PRUint32 argc); \ - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn); \ + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn); \ #define NS_FORWARD_IDOMHISTORY(_to) \ NS_IMETHOD GetLength(PRInt32* aLength) { return _to GetLength(aLength); } \ - NS_IMETHOD GetCurrent(nsString& aCurrent) { return _to GetCurrent(aCurrent); } \ - NS_IMETHOD GetPrevious(nsString& aPrevious) { return _to GetPrevious(aPrevious); } \ - NS_IMETHOD GetNext(nsString& aNext) { return _to GetNext(aNext); } \ + NS_IMETHOD GetCurrent(nsAWritableString& aCurrent) { return _to GetCurrent(aCurrent); } \ + NS_IMETHOD GetPrevious(nsAWritableString& aPrevious) { return _to GetPrevious(aPrevious); } \ + NS_IMETHOD GetNext(nsAWritableString& aNext) { return _to GetNext(aNext); } \ NS_IMETHOD Back() { return _to Back(); } \ NS_IMETHOD Forward() { return _to Forward(); } \ NS_IMETHOD Go(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Go(cx, argv, argc); } \ - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn) { return _to Item(aIndex, aReturn); } \ + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn) { return _to Item(aIndex, aReturn); } \ extern "C" NS_DOM nsresult NS_InitHistoryClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMLocation.h b/dom/public/base/nsIDOMLocation.h index f702d8b91807..26e0d74be054 100644 --- a/dom/public/base/nsIDOMLocation.h +++ b/dom/public/base/nsIDOMLocation.h @@ -37,81 +37,81 @@ class nsIDOMLocation : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMLOCATION_IID; return iid; } - NS_IMETHOD GetHash(nsString& aHash)=0; - NS_IMETHOD SetHash(const nsString& aHash)=0; + NS_IMETHOD GetHash(nsAWritableString& aHash)=0; + NS_IMETHOD SetHash(const nsAReadableString& aHash)=0; - NS_IMETHOD GetHost(nsString& aHost)=0; - NS_IMETHOD SetHost(const nsString& aHost)=0; + NS_IMETHOD GetHost(nsAWritableString& aHost)=0; + NS_IMETHOD SetHost(const nsAReadableString& aHost)=0; - NS_IMETHOD GetHostname(nsString& aHostname)=0; - NS_IMETHOD SetHostname(const nsString& aHostname)=0; + NS_IMETHOD GetHostname(nsAWritableString& aHostname)=0; + NS_IMETHOD SetHostname(const nsAReadableString& aHostname)=0; - NS_IMETHOD GetHref(nsString& aHref)=0; - NS_IMETHOD SetHref(const nsString& aHref)=0; + NS_IMETHOD GetHref(nsAWritableString& aHref)=0; + NS_IMETHOD SetHref(const nsAReadableString& aHref)=0; - NS_IMETHOD GetPathname(nsString& aPathname)=0; - NS_IMETHOD SetPathname(const nsString& aPathname)=0; + NS_IMETHOD GetPathname(nsAWritableString& aPathname)=0; + NS_IMETHOD SetPathname(const nsAReadableString& aPathname)=0; - NS_IMETHOD GetPort(nsString& aPort)=0; - NS_IMETHOD SetPort(const nsString& aPort)=0; + NS_IMETHOD GetPort(nsAWritableString& aPort)=0; + NS_IMETHOD SetPort(const nsAReadableString& aPort)=0; - NS_IMETHOD GetProtocol(nsString& aProtocol)=0; - NS_IMETHOD SetProtocol(const nsString& aProtocol)=0; + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol)=0; + NS_IMETHOD SetProtocol(const nsAReadableString& aProtocol)=0; - NS_IMETHOD GetSearch(nsString& aSearch)=0; - NS_IMETHOD SetSearch(const nsString& aSearch)=0; + NS_IMETHOD GetSearch(nsAWritableString& aSearch)=0; + NS_IMETHOD SetSearch(const nsAReadableString& aSearch)=0; NS_IMETHOD Reload(PRBool aForceget)=0; - NS_IMETHOD Replace(const nsString& aUrl)=0; + NS_IMETHOD Replace(const nsAReadableString& aUrl)=0; - NS_IMETHOD ToString(nsString& aReturn)=0; + NS_IMETHOD ToString(nsAWritableString& aReturn)=0; }; #define NS_DECL_IDOMLOCATION \ - NS_IMETHOD GetHash(nsString& aHash); \ - NS_IMETHOD SetHash(const nsString& aHash); \ - NS_IMETHOD GetHost(nsString& aHost); \ - NS_IMETHOD SetHost(const nsString& aHost); \ - NS_IMETHOD GetHostname(nsString& aHostname); \ - NS_IMETHOD SetHostname(const nsString& aHostname); \ - NS_IMETHOD GetHref(nsString& aHref); \ - NS_IMETHOD SetHref(const nsString& aHref); \ - NS_IMETHOD GetPathname(nsString& aPathname); \ - NS_IMETHOD SetPathname(const nsString& aPathname); \ - NS_IMETHOD GetPort(nsString& aPort); \ - NS_IMETHOD SetPort(const nsString& aPort); \ - NS_IMETHOD GetProtocol(nsString& aProtocol); \ - NS_IMETHOD SetProtocol(const nsString& aProtocol); \ - NS_IMETHOD GetSearch(nsString& aSearch); \ - NS_IMETHOD SetSearch(const nsString& aSearch); \ + NS_IMETHOD GetHash(nsAWritableString& aHash); \ + NS_IMETHOD SetHash(const nsAReadableString& aHash); \ + NS_IMETHOD GetHost(nsAWritableString& aHost); \ + NS_IMETHOD SetHost(const nsAReadableString& aHost); \ + NS_IMETHOD GetHostname(nsAWritableString& aHostname); \ + NS_IMETHOD SetHostname(const nsAReadableString& aHostname); \ + NS_IMETHOD GetHref(nsAWritableString& aHref); \ + NS_IMETHOD SetHref(const nsAReadableString& aHref); \ + NS_IMETHOD GetPathname(nsAWritableString& aPathname); \ + NS_IMETHOD SetPathname(const nsAReadableString& aPathname); \ + NS_IMETHOD GetPort(nsAWritableString& aPort); \ + NS_IMETHOD SetPort(const nsAReadableString& aPort); \ + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol); \ + NS_IMETHOD SetProtocol(const nsAReadableString& aProtocol); \ + NS_IMETHOD GetSearch(nsAWritableString& aSearch); \ + NS_IMETHOD SetSearch(const nsAReadableString& aSearch); \ NS_IMETHOD Reload(PRBool aForceget); \ - NS_IMETHOD Replace(const nsString& aUrl); \ - NS_IMETHOD ToString(nsString& aReturn); \ + NS_IMETHOD Replace(const nsAReadableString& aUrl); \ + NS_IMETHOD ToString(nsAWritableString& aReturn); \ #define NS_FORWARD_IDOMLOCATION(_to) \ - NS_IMETHOD GetHash(nsString& aHash) { return _to GetHash(aHash); } \ - NS_IMETHOD SetHash(const nsString& aHash) { return _to SetHash(aHash); } \ - NS_IMETHOD GetHost(nsString& aHost) { return _to GetHost(aHost); } \ - NS_IMETHOD SetHost(const nsString& aHost) { return _to SetHost(aHost); } \ - NS_IMETHOD GetHostname(nsString& aHostname) { return _to GetHostname(aHostname); } \ - NS_IMETHOD SetHostname(const nsString& aHostname) { return _to SetHostname(aHostname); } \ - NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \ - NS_IMETHOD SetHref(const nsString& aHref) { return _to SetHref(aHref); } \ - NS_IMETHOD GetPathname(nsString& aPathname) { return _to GetPathname(aPathname); } \ - NS_IMETHOD SetPathname(const nsString& aPathname) { return _to SetPathname(aPathname); } \ - NS_IMETHOD GetPort(nsString& aPort) { return _to GetPort(aPort); } \ - NS_IMETHOD SetPort(const nsString& aPort) { return _to SetPort(aPort); } \ - NS_IMETHOD GetProtocol(nsString& aProtocol) { return _to GetProtocol(aProtocol); } \ - NS_IMETHOD SetProtocol(const nsString& aProtocol) { return _to SetProtocol(aProtocol); } \ - NS_IMETHOD GetSearch(nsString& aSearch) { return _to GetSearch(aSearch); } \ - NS_IMETHOD SetSearch(const nsString& aSearch) { return _to SetSearch(aSearch); } \ + NS_IMETHOD GetHash(nsAWritableString& aHash) { return _to GetHash(aHash); } \ + NS_IMETHOD SetHash(const nsAReadableString& aHash) { return _to SetHash(aHash); } \ + NS_IMETHOD GetHost(nsAWritableString& aHost) { return _to GetHost(aHost); } \ + NS_IMETHOD SetHost(const nsAReadableString& aHost) { return _to SetHost(aHost); } \ + NS_IMETHOD GetHostname(nsAWritableString& aHostname) { return _to GetHostname(aHostname); } \ + NS_IMETHOD SetHostname(const nsAReadableString& aHostname) { return _to SetHostname(aHostname); } \ + NS_IMETHOD GetHref(nsAWritableString& aHref) { return _to GetHref(aHref); } \ + NS_IMETHOD SetHref(const nsAReadableString& aHref) { return _to SetHref(aHref); } \ + NS_IMETHOD GetPathname(nsAWritableString& aPathname) { return _to GetPathname(aPathname); } \ + NS_IMETHOD SetPathname(const nsAReadableString& aPathname) { return _to SetPathname(aPathname); } \ + NS_IMETHOD GetPort(nsAWritableString& aPort) { return _to GetPort(aPort); } \ + NS_IMETHOD SetPort(const nsAReadableString& aPort) { return _to SetPort(aPort); } \ + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol) { return _to GetProtocol(aProtocol); } \ + NS_IMETHOD SetProtocol(const nsAReadableString& aProtocol) { return _to SetProtocol(aProtocol); } \ + NS_IMETHOD GetSearch(nsAWritableString& aSearch) { return _to GetSearch(aSearch); } \ + NS_IMETHOD SetSearch(const nsAReadableString& aSearch) { return _to SetSearch(aSearch); } \ NS_IMETHOD Reload(PRBool aForceget) { return _to Reload(aForceget); } \ - NS_IMETHOD Replace(const nsString& aUrl) { return _to Replace(aUrl); } \ - NS_IMETHOD ToString(nsString& aReturn) { return _to ToString(aReturn); } \ + NS_IMETHOD Replace(const nsAReadableString& aUrl) { return _to Replace(aUrl); } \ + NS_IMETHOD ToString(nsAWritableString& aReturn) { return _to ToString(aReturn); } \ extern "C" NS_DOM nsresult NS_InitLocationClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMMimeType.h b/dom/public/base/nsIDOMMimeType.h index f13c8f2a922f..3a04c2fa1f6c 100644 --- a/dom/public/base/nsIDOMMimeType.h +++ b/dom/public/base/nsIDOMMimeType.h @@ -37,29 +37,29 @@ class nsIDOMMimeType : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMMIMETYPE_IID; return iid; } - NS_IMETHOD GetDescription(nsString& aDescription)=0; + NS_IMETHOD GetDescription(nsAWritableString& aDescription)=0; NS_IMETHOD GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugin)=0; - NS_IMETHOD GetSuffixes(nsString& aSuffixes)=0; + NS_IMETHOD GetSuffixes(nsAWritableString& aSuffixes)=0; - NS_IMETHOD GetType(nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; }; #define NS_DECL_IDOMMIMETYPE \ - NS_IMETHOD GetDescription(nsString& aDescription); \ + NS_IMETHOD GetDescription(nsAWritableString& aDescription); \ NS_IMETHOD GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugin); \ - NS_IMETHOD GetSuffixes(nsString& aSuffixes); \ - NS_IMETHOD GetType(nsString& aType); \ + NS_IMETHOD GetSuffixes(nsAWritableString& aSuffixes); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ #define NS_FORWARD_IDOMMIMETYPE(_to) \ - NS_IMETHOD GetDescription(nsString& aDescription) { return _to GetDescription(aDescription); } \ + NS_IMETHOD GetDescription(nsAWritableString& aDescription) { return _to GetDescription(aDescription); } \ NS_IMETHOD GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugin) { return _to GetEnabledPlugin(aEnabledPlugin); } \ - NS_IMETHOD GetSuffixes(nsString& aSuffixes) { return _to GetSuffixes(aSuffixes); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ + NS_IMETHOD GetSuffixes(nsAWritableString& aSuffixes) { return _to GetSuffixes(aSuffixes); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ extern "C" NS_DOM nsresult NS_InitMimeTypeClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMMimeTypeArray.h b/dom/public/base/nsIDOMMimeTypeArray.h index 3db24d02dd9f..d75e15acec4c 100644 --- a/dom/public/base/nsIDOMMimeTypeArray.h +++ b/dom/public/base/nsIDOMMimeTypeArray.h @@ -41,21 +41,21 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn)=0; }; #define NS_DECL_IDOMMIMETYPEARRAY \ NS_IMETHOD GetLength(PRUint32* aLength); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn); \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn); \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn); \ #define NS_FORWARD_IDOMMIMETYPEARRAY(_to) \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn) { return _to NamedItem(aName, aReturn); } \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn) { return _to NamedItem(aName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitMimeTypeArrayClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMNavigator.h b/dom/public/base/nsIDOMNavigator.h index 795b976acc5e..4137f69874a9 100644 --- a/dom/public/base/nsIDOMNavigator.h +++ b/dom/public/base/nsIDOMNavigator.h @@ -40,33 +40,33 @@ class nsIDOMNavigator : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMNAVIGATOR_IID; return iid; } - NS_IMETHOD GetAppCodeName(nsString& aAppCodeName)=0; + NS_IMETHOD GetAppCodeName(nsAWritableString& aAppCodeName)=0; - NS_IMETHOD GetAppName(nsString& aAppName)=0; + NS_IMETHOD GetAppName(nsAWritableString& aAppName)=0; - NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0; + NS_IMETHOD GetAppVersion(nsAWritableString& aAppVersion)=0; - NS_IMETHOD GetLanguage(nsString& aLanguage)=0; + NS_IMETHOD GetLanguage(nsAWritableString& aLanguage)=0; NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes)=0; - NS_IMETHOD GetPlatform(nsString& aPlatform)=0; + NS_IMETHOD GetPlatform(nsAWritableString& aPlatform)=0; - NS_IMETHOD GetOscpu(nsString& aOscpu)=0; + NS_IMETHOD GetOscpu(nsAWritableString& aOscpu)=0; - NS_IMETHOD GetVendor(nsString& aVendor)=0; + NS_IMETHOD GetVendor(nsAWritableString& aVendor)=0; - NS_IMETHOD GetVendorSub(nsString& aVendorSub)=0; + NS_IMETHOD GetVendorSub(nsAWritableString& aVendorSub)=0; - NS_IMETHOD GetProduct(nsString& aProduct)=0; + NS_IMETHOD GetProduct(nsAWritableString& aProduct)=0; - NS_IMETHOD GetProductSub(nsString& aProductSub)=0; + NS_IMETHOD GetProductSub(nsAWritableString& aProductSub)=0; NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins)=0; - NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy)=0; + NS_IMETHOD GetSecurityPolicy(nsAWritableString& aSecurityPolicy)=0; - NS_IMETHOD GetUserAgent(nsString& aUserAgent)=0; + NS_IMETHOD GetUserAgent(nsAWritableString& aUserAgent)=0; NS_IMETHOD GetCookieEnabled(PRBool* aCookieEnabled)=0; @@ -79,20 +79,20 @@ public: #define NS_DECL_IDOMNAVIGATOR \ - NS_IMETHOD GetAppCodeName(nsString& aAppCodeName); \ - NS_IMETHOD GetAppName(nsString& aAppName); \ - NS_IMETHOD GetAppVersion(nsString& aAppVersion); \ - NS_IMETHOD GetLanguage(nsString& aLanguage); \ + NS_IMETHOD GetAppCodeName(nsAWritableString& aAppCodeName); \ + NS_IMETHOD GetAppName(nsAWritableString& aAppName); \ + NS_IMETHOD GetAppVersion(nsAWritableString& aAppVersion); \ + NS_IMETHOD GetLanguage(nsAWritableString& aLanguage); \ NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes); \ - NS_IMETHOD GetPlatform(nsString& aPlatform); \ - NS_IMETHOD GetOscpu(nsString& aOscpu); \ - NS_IMETHOD GetVendor(nsString& aVendor); \ - NS_IMETHOD GetVendorSub(nsString& aVendorSub); \ - NS_IMETHOD GetProduct(nsString& aProduct); \ - NS_IMETHOD GetProductSub(nsString& aProductSub); \ + NS_IMETHOD GetPlatform(nsAWritableString& aPlatform); \ + NS_IMETHOD GetOscpu(nsAWritableString& aOscpu); \ + NS_IMETHOD GetVendor(nsAWritableString& aVendor); \ + NS_IMETHOD GetVendorSub(nsAWritableString& aVendorSub); \ + NS_IMETHOD GetProduct(nsAWritableString& aProduct); \ + NS_IMETHOD GetProductSub(nsAWritableString& aProductSub); \ NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); \ - NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy); \ - NS_IMETHOD GetUserAgent(nsString& aUserAgent); \ + NS_IMETHOD GetSecurityPolicy(nsAWritableString& aSecurityPolicy); \ + NS_IMETHOD GetUserAgent(nsAWritableString& aUserAgent); \ NS_IMETHOD GetCookieEnabled(PRBool* aCookieEnabled); \ NS_IMETHOD JavaEnabled(PRBool* aReturn); \ NS_IMETHOD TaintEnabled(PRBool* aReturn); \ @@ -101,20 +101,20 @@ public: #define NS_FORWARD_IDOMNAVIGATOR(_to) \ - NS_IMETHOD GetAppCodeName(nsString& aAppCodeName) { return _to GetAppCodeName(aAppCodeName); } \ - NS_IMETHOD GetAppName(nsString& aAppName) { return _to GetAppName(aAppName); } \ - NS_IMETHOD GetAppVersion(nsString& aAppVersion) { return _to GetAppVersion(aAppVersion); } \ - NS_IMETHOD GetLanguage(nsString& aLanguage) { return _to GetLanguage(aLanguage); } \ + NS_IMETHOD GetAppCodeName(nsAWritableString& aAppCodeName) { return _to GetAppCodeName(aAppCodeName); } \ + NS_IMETHOD GetAppName(nsAWritableString& aAppName) { return _to GetAppName(aAppName); } \ + NS_IMETHOD GetAppVersion(nsAWritableString& aAppVersion) { return _to GetAppVersion(aAppVersion); } \ + NS_IMETHOD GetLanguage(nsAWritableString& aLanguage) { return _to GetLanguage(aLanguage); } \ NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes) { return _to GetMimeTypes(aMimeTypes); } \ - NS_IMETHOD GetPlatform(nsString& aPlatform) { return _to GetPlatform(aPlatform); } \ - NS_IMETHOD GetOscpu(nsString& aOscpu) { return _to GetOscpu(aOscpu); } \ - NS_IMETHOD GetVendor(nsString& aVendor) { return _to GetVendor(aVendor); } \ - NS_IMETHOD GetVendorSub(nsString& aVendorSub) { return _to GetVendorSub(aVendorSub); } \ - NS_IMETHOD GetProduct(nsString& aProduct) { return _to GetProduct(aProduct); } \ - NS_IMETHOD GetProductSub(nsString& aProductSub) { return _to GetProductSub(aProductSub); } \ + NS_IMETHOD GetPlatform(nsAWritableString& aPlatform) { return _to GetPlatform(aPlatform); } \ + NS_IMETHOD GetOscpu(nsAWritableString& aOscpu) { return _to GetOscpu(aOscpu); } \ + NS_IMETHOD GetVendor(nsAWritableString& aVendor) { return _to GetVendor(aVendor); } \ + NS_IMETHOD GetVendorSub(nsAWritableString& aVendorSub) { return _to GetVendorSub(aVendorSub); } \ + NS_IMETHOD GetProduct(nsAWritableString& aProduct) { return _to GetProduct(aProduct); } \ + NS_IMETHOD GetProductSub(nsAWritableString& aProductSub) { return _to GetProductSub(aProductSub); } \ NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins) { return _to GetPlugins(aPlugins); } \ - NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy) { return _to GetSecurityPolicy(aSecurityPolicy); } \ - NS_IMETHOD GetUserAgent(nsString& aUserAgent) { return _to GetUserAgent(aUserAgent); } \ + NS_IMETHOD GetSecurityPolicy(nsAWritableString& aSecurityPolicy) { return _to GetSecurityPolicy(aSecurityPolicy); } \ + NS_IMETHOD GetUserAgent(nsAWritableString& aUserAgent) { return _to GetUserAgent(aUserAgent); } \ NS_IMETHOD GetCookieEnabled(PRBool* aCookieEnabled) { return _to GetCookieEnabled(aCookieEnabled); } \ NS_IMETHOD JavaEnabled(PRBool* aReturn) { return _to JavaEnabled(aReturn); } \ NS_IMETHOD TaintEnabled(PRBool* aReturn) { return _to TaintEnabled(aReturn); } \ diff --git a/dom/public/base/nsIDOMPkcs11.h b/dom/public/base/nsIDOMPkcs11.h index 223b2c3705ec..2074ba076de5 100644 --- a/dom/public/base/nsIDOMPkcs11.h +++ b/dom/public/base/nsIDOMPkcs11.h @@ -37,21 +37,21 @@ class nsIDOMPkcs11 : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMPKCS11_IID; return iid; } - NS_IMETHOD Deletemodule(const nsString& aModuleName, PRInt32* aReturn)=0; + NS_IMETHOD Deletemodule(const nsAReadableString& aModuleName, PRInt32* aReturn)=0; - NS_IMETHOD Addmodule(const nsString& aModuleName, const nsString& aLibraryFullPath, PRInt32 aCryptoMechanismFlags, PRInt32 aCipherFlags, PRInt32* aReturn)=0; + NS_IMETHOD Addmodule(const nsAReadableString& aModuleName, const nsAReadableString& aLibraryFullPath, PRInt32 aCryptoMechanismFlags, PRInt32 aCipherFlags, PRInt32* aReturn)=0; }; #define NS_DECL_IDOMPKCS11 \ - NS_IMETHOD Deletemodule(const nsString& aModuleName, PRInt32* aReturn); \ - NS_IMETHOD Addmodule(const nsString& aModuleName, const nsString& aLibraryFullPath, PRInt32 aCryptoMechanismFlags, PRInt32 aCipherFlags, PRInt32* aReturn); \ + NS_IMETHOD Deletemodule(const nsAReadableString& aModuleName, PRInt32* aReturn); \ + NS_IMETHOD Addmodule(const nsAReadableString& aModuleName, const nsAReadableString& aLibraryFullPath, PRInt32 aCryptoMechanismFlags, PRInt32 aCipherFlags, PRInt32* aReturn); \ #define NS_FORWARD_IDOMPKCS11(_to) \ - NS_IMETHOD Deletemodule(const nsString& aModuleName, PRInt32* aReturn) { return _to Deletemodule(aModuleName, aReturn); } \ - NS_IMETHOD Addmodule(const nsString& aModuleName, const nsString& aLibraryFullPath, PRInt32 aCryptoMechanismFlags, PRInt32 aCipherFlags, PRInt32* aReturn) { return _to Addmodule(aModuleName, aLibraryFullPath, aCryptoMechanismFlags, aCipherFlags, aReturn); } \ + NS_IMETHOD Deletemodule(const nsAReadableString& aModuleName, PRInt32* aReturn) { return _to Deletemodule(aModuleName, aReturn); } \ + NS_IMETHOD Addmodule(const nsAReadableString& aModuleName, const nsAReadableString& aLibraryFullPath, PRInt32 aCryptoMechanismFlags, PRInt32 aCipherFlags, PRInt32* aReturn) { return _to Addmodule(aModuleName, aLibraryFullPath, aCryptoMechanismFlags, aCipherFlags, aReturn); } \ extern "C" NS_DOM nsresult NS_InitPkcs11Class(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMPlugin.h b/dom/public/base/nsIDOMPlugin.h index f2e0ad6a2369..f8cea791af96 100644 --- a/dom/public/base/nsIDOMPlugin.h +++ b/dom/public/base/nsIDOMPlugin.h @@ -37,37 +37,37 @@ class nsIDOMPlugin : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMPLUGIN_IID; return iid; } - NS_IMETHOD GetDescription(nsString& aDescription)=0; + NS_IMETHOD GetDescription(nsAWritableString& aDescription)=0; - NS_IMETHOD GetFilename(nsString& aFilename)=0; + NS_IMETHOD GetFilename(nsAWritableString& aFilename)=0; - NS_IMETHOD GetName(nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; NS_IMETHOD GetLength(PRUint32* aLength)=0; NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn)=0; }; #define NS_DECL_IDOMPLUGIN \ - NS_IMETHOD GetDescription(nsString& aDescription); \ - NS_IMETHOD GetFilename(nsString& aFilename); \ - NS_IMETHOD GetName(nsString& aName); \ + NS_IMETHOD GetDescription(nsAWritableString& aDescription); \ + NS_IMETHOD GetFilename(nsAWritableString& aFilename); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ NS_IMETHOD GetLength(PRUint32* aLength); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn); \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn); \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn); \ #define NS_FORWARD_IDOMPLUGIN(_to) \ - NS_IMETHOD GetDescription(nsString& aDescription) { return _to GetDescription(aDescription); } \ - NS_IMETHOD GetFilename(nsString& aFilename) { return _to GetFilename(aFilename); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ + NS_IMETHOD GetDescription(nsAWritableString& aDescription) { return _to GetDescription(aDescription); } \ + NS_IMETHOD GetFilename(nsAWritableString& aFilename) { return _to GetFilename(aFilename); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn) { return _to NamedItem(aName, aReturn); } \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn) { return _to NamedItem(aName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitPluginClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/base/nsIDOMPluginArray.h b/dom/public/base/nsIDOMPluginArray.h index 7506e682453f..1b73b5190186 100644 --- a/dom/public/base/nsIDOMPluginArray.h +++ b/dom/public/base/nsIDOMPluginArray.h @@ -41,7 +41,7 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMPlugin** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMPlugin** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMPlugin** aReturn)=0; NS_IMETHOD Refresh(PRBool aReloadDocuments)=0; }; @@ -50,7 +50,7 @@ public: #define NS_DECL_IDOMPLUGINARRAY \ NS_IMETHOD GetLength(PRUint32* aLength); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMPlugin** aReturn); \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMPlugin** aReturn); \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMPlugin** aReturn); \ NS_IMETHOD Refresh(PRBool aReloadDocuments); \ @@ -58,7 +58,7 @@ public: #define NS_FORWARD_IDOMPLUGINARRAY(_to) \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMPlugin** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMPlugin** aReturn) { return _to NamedItem(aName, aReturn); } \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMPlugin** aReturn) { return _to NamedItem(aName, aReturn); } \ NS_IMETHOD Refresh(PRBool aReloadDocuments) { return _to Refresh(aReloadDocuments); } \ diff --git a/dom/public/base/nsIDOMViewCSS.h b/dom/public/base/nsIDOMViewCSS.h index 058617563ab8..b43bffdce6dc 100644 --- a/dom/public/base/nsIDOMViewCSS.h +++ b/dom/public/base/nsIDOMViewCSS.h @@ -40,17 +40,17 @@ class nsIDOMViewCSS : public nsIDOMAbstractView { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMVIEWCSS_IID; return iid; } - NS_IMETHOD GetComputedStyle(nsIDOMElement* aElt, const nsString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn)=0; + NS_IMETHOD GetComputedStyle(nsIDOMElement* aElt, const nsAReadableString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn)=0; }; #define NS_DECL_IDOMVIEWCSS \ - NS_IMETHOD GetComputedStyle(nsIDOMElement* aElt, const nsString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn); \ + NS_IMETHOD GetComputedStyle(nsIDOMElement* aElt, const nsAReadableString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn); \ #define NS_FORWARD_IDOMVIEWCSS(_to) \ - NS_IMETHOD GetComputedStyle(nsIDOMElement* aElt, const nsString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn) { return _to GetComputedStyle(aElt, aPseudoElt, aReturn); } \ + NS_IMETHOD GetComputedStyle(nsIDOMElement* aElt, const nsAReadableString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn) { return _to GetComputedStyle(aElt, aPseudoElt, aReturn); } \ #endif // nsIDOMViewCSS_h__ diff --git a/dom/public/base/nsIDOMWindow.h b/dom/public/base/nsIDOMWindow.h index 9fc3df239cab..d97fc1304dec 100644 --- a/dom/public/base/nsIDOMWindow.h +++ b/dom/public/base/nsIDOMWindow.h @@ -101,14 +101,14 @@ public: NS_IMETHOD GetOpener(nsIDOMWindow** aOpener)=0; NS_IMETHOD SetOpener(nsIDOMWindow* aOpener)=0; - NS_IMETHOD GetStatus(nsString& aStatus)=0; - NS_IMETHOD SetStatus(const nsString& aStatus)=0; + NS_IMETHOD GetStatus(nsAWritableString& aStatus)=0; + NS_IMETHOD SetStatus(const nsAReadableString& aStatus)=0; - NS_IMETHOD GetDefaultStatus(nsString& aDefaultStatus)=0; - NS_IMETHOD SetDefaultStatus(const nsString& aDefaultStatus)=0; + NS_IMETHOD GetDefaultStatus(nsAWritableString& aDefaultStatus)=0; + NS_IMETHOD SetDefaultStatus(const nsAReadableString& aDefaultStatus)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; NS_IMETHOD GetInnerWidth(PRInt32* aInnerWidth)=0; NS_IMETHOD SetInnerWidth(PRInt32 aInnerWidth)=0; @@ -140,7 +140,7 @@ public: NS_IMETHOD GetLength(PRUint32* aLength)=0; - NS_IMETHOD Dump(const nsString& aStr)=0; + NS_IMETHOD Dump(const nsAReadableString& aStr)=0; NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc)=0; @@ -198,7 +198,7 @@ public: NS_IMETHOD DisableExternalCapture()=0; - NS_IMETHOD SetCursor(const nsString& aCursor)=0; + NS_IMETHOD SetCursor(const nsAReadableString& aCursor)=0; NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn)=0; @@ -208,11 +208,11 @@ public: NS_IMETHOD Close(JSContext* cx, jsval* argv, PRUint32 argc)=0; - NS_IMETHOD UpdateCommands(const nsString& aAction)=0; + NS_IMETHOD UpdateCommands(const nsAReadableString& aAction)=0; - NS_IMETHOD Escape(const nsString& aStr, nsString& aReturn)=0; + NS_IMETHOD Escape(const nsAReadableString& aStr, nsAWritableString& aReturn)=0; - NS_IMETHOD Unescape(const nsString& aStr, nsString& aReturn)=0; + NS_IMETHOD Unescape(const nsAReadableString& aStr, nsAWritableString& aReturn)=0; NS_IMETHOD GetSelection(nsIDOMSelection** aReturn)=0; }; @@ -244,12 +244,12 @@ public: NS_IMETHOD GetControllers(nsIControllers** aControllers); \ NS_IMETHOD GetOpener(nsIDOMWindow** aOpener); \ NS_IMETHOD SetOpener(nsIDOMWindow* aOpener); \ - NS_IMETHOD GetStatus(nsString& aStatus); \ - NS_IMETHOD SetStatus(const nsString& aStatus); \ - NS_IMETHOD GetDefaultStatus(nsString& aDefaultStatus); \ - NS_IMETHOD SetDefaultStatus(const nsString& aDefaultStatus); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetStatus(nsAWritableString& aStatus); \ + NS_IMETHOD SetStatus(const nsAReadableString& aStatus); \ + NS_IMETHOD GetDefaultStatus(nsAWritableString& aDefaultStatus); \ + NS_IMETHOD SetDefaultStatus(const nsAReadableString& aDefaultStatus); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ NS_IMETHOD GetInnerWidth(PRInt32* aInnerWidth); \ NS_IMETHOD SetInnerWidth(PRInt32 aInnerWidth); \ NS_IMETHOD GetInnerHeight(PRInt32* aInnerHeight); \ @@ -269,7 +269,7 @@ public: NS_IMETHOD GetScrollX(PRInt32* aScrollX); \ NS_IMETHOD GetScrollY(PRInt32* aScrollY); \ NS_IMETHOD GetLength(PRUint32* aLength); \ - NS_IMETHOD Dump(const nsString& aStr); \ + NS_IMETHOD Dump(const nsAReadableString& aStr); \ NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc); \ NS_IMETHOD Confirm(JSContext* cx, jsval* argv, PRUint32 argc, PRBool* aReturn); \ NS_IMETHOD Prompt(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); \ @@ -298,14 +298,14 @@ public: NS_IMETHOD RouteEvent(nsIDOMEvent* aEvt); \ NS_IMETHOD EnableExternalCapture(); \ NS_IMETHOD DisableExternalCapture(); \ - NS_IMETHOD SetCursor(const nsString& aCursor); \ + NS_IMETHOD SetCursor(const nsAReadableString& aCursor); \ NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn); \ NS_IMETHOD OpenDialog(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn); \ NS_IMETHOD Close(); \ NS_IMETHOD Close(JSContext* cx, jsval* argv, PRUint32 argc); \ - NS_IMETHOD UpdateCommands(const nsString& aAction); \ - NS_IMETHOD Escape(const nsString& aStr, nsString& aReturn); \ - NS_IMETHOD Unescape(const nsString& aStr, nsString& aReturn); \ + NS_IMETHOD UpdateCommands(const nsAReadableString& aAction); \ + NS_IMETHOD Escape(const nsAReadableString& aStr, nsAWritableString& aReturn); \ + NS_IMETHOD Unescape(const nsAReadableString& aStr, nsAWritableString& aReturn); \ NS_IMETHOD GetSelection(nsIDOMSelection** aReturn); \ @@ -336,12 +336,12 @@ public: NS_IMETHOD GetControllers(nsIControllers** aControllers) { return _to GetControllers(aControllers); } \ NS_IMETHOD GetOpener(nsIDOMWindow** aOpener) { return _to GetOpener(aOpener); } \ NS_IMETHOD SetOpener(nsIDOMWindow* aOpener) { return _to SetOpener(aOpener); } \ - NS_IMETHOD GetStatus(nsString& aStatus) { return _to GetStatus(aStatus); } \ - NS_IMETHOD SetStatus(const nsString& aStatus) { return _to SetStatus(aStatus); } \ - NS_IMETHOD GetDefaultStatus(nsString& aDefaultStatus) { return _to GetDefaultStatus(aDefaultStatus); } \ - NS_IMETHOD SetDefaultStatus(const nsString& aDefaultStatus) { return _to SetDefaultStatus(aDefaultStatus); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetStatus(nsAWritableString& aStatus) { return _to GetStatus(aStatus); } \ + NS_IMETHOD SetStatus(const nsAReadableString& aStatus) { return _to SetStatus(aStatus); } \ + NS_IMETHOD GetDefaultStatus(nsAWritableString& aDefaultStatus) { return _to GetDefaultStatus(aDefaultStatus); } \ + NS_IMETHOD SetDefaultStatus(const nsAReadableString& aDefaultStatus) { return _to SetDefaultStatus(aDefaultStatus); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ NS_IMETHOD GetInnerWidth(PRInt32* aInnerWidth) { return _to GetInnerWidth(aInnerWidth); } \ NS_IMETHOD SetInnerWidth(PRInt32 aInnerWidth) { return _to SetInnerWidth(aInnerWidth); } \ NS_IMETHOD GetInnerHeight(PRInt32* aInnerHeight) { return _to GetInnerHeight(aInnerHeight); } \ @@ -361,7 +361,7 @@ public: NS_IMETHOD GetScrollX(PRInt32* aScrollX) { return _to GetScrollX(aScrollX); } \ NS_IMETHOD GetScrollY(PRInt32* aScrollY) { return _to GetScrollY(aScrollY); } \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ - NS_IMETHOD Dump(const nsString& aStr) { return _to Dump(aStr); } \ + NS_IMETHOD Dump(const nsAReadableString& aStr) { return _to Dump(aStr); } \ NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Alert(cx, argv, argc); } \ NS_IMETHOD Confirm(JSContext* cx, jsval* argv, PRUint32 argc, PRBool* aReturn) { return _to Confirm(cx, argv, argc, aReturn); } \ NS_IMETHOD Prompt(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn) { return _to Prompt(cx, argv, argc, aReturn); } \ @@ -390,14 +390,14 @@ public: NS_IMETHOD RouteEvent(nsIDOMEvent* aEvt) { return _to RouteEvent(aEvt); } \ NS_IMETHOD EnableExternalCapture() { return _to EnableExternalCapture(); } \ NS_IMETHOD DisableExternalCapture() { return _to DisableExternalCapture(); } \ - NS_IMETHOD SetCursor(const nsString& aCursor) { return _to SetCursor(aCursor); } \ + NS_IMETHOD SetCursor(const nsAReadableString& aCursor) { return _to SetCursor(aCursor); } \ NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn) { return _to Open(cx, argv, argc, aReturn); } \ NS_IMETHOD OpenDialog(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn) { return _to OpenDialog(cx, argv, argc, aReturn); } \ NS_IMETHOD Close() { return _to Close(); } \ NS_IMETHOD Close(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Close(cx, argv, argc); } \ - NS_IMETHOD UpdateCommands(const nsString& aAction) { return _to UpdateCommands(aAction); } \ - NS_IMETHOD Escape(const nsString& aStr, nsString& aReturn) { return _to Escape(aStr, aReturn); } \ - NS_IMETHOD Unescape(const nsString& aStr, nsString& aReturn) { return _to Unescape(aStr, aReturn); } \ + NS_IMETHOD UpdateCommands(const nsAReadableString& aAction) { return _to UpdateCommands(aAction); } \ + NS_IMETHOD Escape(const nsAReadableString& aStr, nsAWritableString& aReturn) { return _to Escape(aStr, aReturn); } \ + NS_IMETHOD Unescape(const nsAReadableString& aStr, nsAWritableString& aReturn) { return _to Unescape(aStr, aReturn); } \ NS_IMETHOD GetSelection(nsIDOMSelection** aReturn) { return _to GetSelection(aReturn); } \ diff --git a/dom/public/base/nsIDOMWindowCollection.h b/dom/public/base/nsIDOMWindowCollection.h index 16a77c2f17b5..5fc06033fa83 100644 --- a/dom/public/base/nsIDOMWindowCollection.h +++ b/dom/public/base/nsIDOMWindowCollection.h @@ -42,21 +42,21 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMWindow** aReturn)=0; }; #define NS_DECL_IDOMWINDOWCOLLECTION \ NS_IMETHOD GetLength(PRUint32* aLength); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn); \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn); \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMWindow** aReturn); \ #define NS_FORWARD_IDOMWINDOWCOLLECTION(_to) \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn) { return _to NamedItem(aName, aReturn); } \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMWindow** aReturn) { return _to NamedItem(aName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitWindowCollectionClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMAttr.h b/dom/public/coreDom/nsIDOMAttr.h index 4b567981a1bf..166283aa45f6 100644 --- a/dom/public/coreDom/nsIDOMAttr.h +++ b/dom/public/coreDom/nsIDOMAttr.h @@ -39,31 +39,31 @@ class nsIDOMAttr : public nsIDOMNode { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMATTR_IID; return iid; } - NS_IMETHOD GetName(nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; NS_IMETHOD GetSpecified(PRBool* aSpecified)=0; - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; NS_IMETHOD GetOwnerElement(nsIDOMElement** aOwnerElement)=0; }; #define NS_DECL_IDOMATTR \ - NS_IMETHOD GetName(nsString& aName); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ NS_IMETHOD GetSpecified(PRBool* aSpecified); \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ NS_IMETHOD GetOwnerElement(nsIDOMElement** aOwnerElement); \ #define NS_FORWARD_IDOMATTR(_to) \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ NS_IMETHOD GetSpecified(PRBool* aSpecified) { return _to GetSpecified(aSpecified); } \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ NS_IMETHOD GetOwnerElement(nsIDOMElement** aOwnerElement) { return _to GetOwnerElement(aOwnerElement); } \ diff --git a/dom/public/coreDom/nsIDOMCharacterData.h b/dom/public/coreDom/nsIDOMCharacterData.h index 52db7ae01da2..74548ec7152f 100644 --- a/dom/public/coreDom/nsIDOMCharacterData.h +++ b/dom/public/coreDom/nsIDOMCharacterData.h @@ -38,44 +38,44 @@ class nsIDOMCharacterData : public nsIDOMNode { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCHARACTERDATA_IID; return iid; } - NS_IMETHOD GetData(nsString& aData)=0; - NS_IMETHOD SetData(const nsString& aData)=0; + NS_IMETHOD GetData(nsAWritableString& aData)=0; + NS_IMETHOD SetData(const nsAReadableString& aData)=0; NS_IMETHOD GetLength(PRUint32* aLength)=0; - NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn)=0; + NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsAWritableString& aReturn)=0; - NS_IMETHOD AppendData(const nsString& aArg)=0; + NS_IMETHOD AppendData(const nsAReadableString& aArg)=0; - NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aArg)=0; + NS_IMETHOD InsertData(PRUint32 aOffset, const nsAReadableString& aArg)=0; NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount)=0; - NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg)=0; + NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsAReadableString& aArg)=0; }; #define NS_DECL_IDOMCHARACTERDATA \ - NS_IMETHOD GetData(nsString& aData); \ - NS_IMETHOD SetData(const nsString& aData); \ + NS_IMETHOD GetData(nsAWritableString& aData); \ + NS_IMETHOD SetData(const nsAReadableString& aData); \ NS_IMETHOD GetLength(PRUint32* aLength); \ - NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn); \ - NS_IMETHOD AppendData(const nsString& aArg); \ - NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aArg); \ + NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsAWritableString& aReturn); \ + NS_IMETHOD AppendData(const nsAReadableString& aArg); \ + NS_IMETHOD InsertData(PRUint32 aOffset, const nsAReadableString& aArg); \ NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount); \ - NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg); \ + NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsAReadableString& aArg); \ #define NS_FORWARD_IDOMCHARACTERDATA(_to) \ - NS_IMETHOD GetData(nsString& aData) { return _to GetData(aData); } \ - NS_IMETHOD SetData(const nsString& aData) { return _to SetData(aData); } \ + NS_IMETHOD GetData(nsAWritableString& aData) { return _to GetData(aData); } \ + NS_IMETHOD SetData(const nsAReadableString& aData) { return _to SetData(aData); } \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ - NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn) { return _to SubstringData(aOffset, aCount, aReturn); } \ - NS_IMETHOD AppendData(const nsString& aArg) { return _to AppendData(aArg); } \ - NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aArg) { return _to InsertData(aOffset, aArg); } \ + NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsAWritableString& aReturn) { return _to SubstringData(aOffset, aCount, aReturn); } \ + NS_IMETHOD AppendData(const nsAReadableString& aArg) { return _to AppendData(aArg); } \ + NS_IMETHOD InsertData(PRUint32 aOffset, const nsAReadableString& aArg) { return _to InsertData(aOffset, aArg); } \ NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount) { return _to DeleteData(aOffset, aCount); } \ - NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg) { return _to ReplaceData(aOffset, aCount, aArg); } \ + NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsAReadableString& aArg) { return _to ReplaceData(aOffset, aCount, aArg); } \ extern "C" NS_DOM nsresult NS_InitCharacterDataClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMDOMImplementation.h b/dom/public/coreDom/nsIDOMDOMImplementation.h index 18fcdd829172..311ee2b81a0d 100644 --- a/dom/public/coreDom/nsIDOMDOMImplementation.h +++ b/dom/public/coreDom/nsIDOMDOMImplementation.h @@ -39,25 +39,25 @@ class nsIDOMDOMImplementation : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOMIMPLEMENTATION_IID; return iid; } - NS_IMETHOD HasFeature(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn)=0; + NS_IMETHOD HasFeature(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn)=0; - NS_IMETHOD CreateDocumentType(const nsString& aQualifiedName, const nsString& aPublicId, const nsString& aSystemId, nsIDOMDocumentType** aReturn)=0; + NS_IMETHOD CreateDocumentType(const nsAReadableString& aQualifiedName, const nsAReadableString& aPublicId, const nsAReadableString& aSystemId, nsIDOMDocumentType** aReturn)=0; - NS_IMETHOD CreateDocument(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn)=0; + NS_IMETHOD CreateDocument(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn)=0; }; #define NS_DECL_IDOMDOMIMPLEMENTATION \ - NS_IMETHOD HasFeature(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn); \ - NS_IMETHOD CreateDocumentType(const nsString& aQualifiedName, const nsString& aPublicId, const nsString& aSystemId, nsIDOMDocumentType** aReturn); \ - NS_IMETHOD CreateDocument(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn); \ + NS_IMETHOD HasFeature(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); \ + NS_IMETHOD CreateDocumentType(const nsAReadableString& aQualifiedName, const nsAReadableString& aPublicId, const nsAReadableString& aSystemId, nsIDOMDocumentType** aReturn); \ + NS_IMETHOD CreateDocument(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn); \ #define NS_FORWARD_IDOMDOMIMPLEMENTATION(_to) \ - NS_IMETHOD HasFeature(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn) { return _to HasFeature(aFeature, aVersion, aReturn); } \ - NS_IMETHOD CreateDocumentType(const nsString& aQualifiedName, const nsString& aPublicId, const nsString& aSystemId, nsIDOMDocumentType** aReturn) { return _to CreateDocumentType(aQualifiedName, aPublicId, aSystemId, aReturn); } \ - NS_IMETHOD CreateDocument(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn) { return _to CreateDocument(aNamespaceURI, aQualifiedName, aDoctype, aReturn); } \ + NS_IMETHOD HasFeature(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return _to HasFeature(aFeature, aVersion, aReturn); } \ + NS_IMETHOD CreateDocumentType(const nsAReadableString& aQualifiedName, const nsAReadableString& aPublicId, const nsAReadableString& aSystemId, nsIDOMDocumentType** aReturn) { return _to CreateDocumentType(aQualifiedName, aPublicId, aSystemId, aReturn); } \ + NS_IMETHOD CreateDocument(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn) { return _to CreateDocument(aNamespaceURI, aQualifiedName, aDoctype, aReturn); } \ extern "C" NS_DOM nsresult NS_InitDOMImplementationClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMDocument.h b/dom/public/coreDom/nsIDOMDocument.h index 2dc48627e3a4..89ae52af3f12 100644 --- a/dom/public/coreDom/nsIDOMDocument.h +++ b/dom/public/coreDom/nsIDOMDocument.h @@ -56,33 +56,33 @@ public: NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement)=0; - NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn)=0; + NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn)=0; NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn)=0; - NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn)=0; + NS_IMETHOD CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn)=0; - NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn)=0; + NS_IMETHOD CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn)=0; - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn)=0; + NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn)=0; - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn)=0; + NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn)=0; - NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn)=0; + NS_IMETHOD CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn)=0; - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn)=0; + NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn)=0; - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn)=0; NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn)=0; - NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMElement** aReturn)=0; + NS_IMETHOD CreateElementNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn)=0; - NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMAttr** aReturn)=0; + NS_IMETHOD CreateAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn)=0; - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn)=0; - NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn)=0; + NS_IMETHOD GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn)=0; }; @@ -90,20 +90,20 @@ public: NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype); \ NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation); \ NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement); \ - NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn); \ + NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn); \ NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn); \ - NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn); \ - NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn); \ - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); \ - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); \ - NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn); \ - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); \ - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn); \ + NS_IMETHOD CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn); \ + NS_IMETHOD CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn); \ + NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn); \ + NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn); \ + NS_IMETHOD CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn); \ + NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn); \ + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn); \ NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn); \ - NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMElement** aReturn); \ - NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMAttr** aReturn); \ - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn); \ - NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn); \ + NS_IMETHOD CreateElementNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn); \ + NS_IMETHOD CreateAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn); \ + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn); \ + NS_IMETHOD GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn); \ @@ -111,20 +111,20 @@ public: NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype) { return _to GetDoctype(aDoctype); } \ NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation) { return _to GetImplementation(aImplementation); } \ NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement) { return _to GetDocumentElement(aDocumentElement); } \ - NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) { return _to CreateElement(aTagName, aReturn); } \ + NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn) { return _to CreateElement(aTagName, aReturn); } \ NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) { return _to CreateDocumentFragment(aReturn); } \ - NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn) { return _to CreateTextNode(aData, aReturn); } \ - NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn) { return _to CreateComment(aData, aReturn); } \ - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) { return _to CreateCDATASection(aData, aReturn); } \ - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn) { return _to CreateProcessingInstruction(aTarget, aData, aReturn); } \ - NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) { return _to CreateAttribute(aName, aReturn); } \ - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn) { return _to CreateEntityReference(aName, aReturn); } \ - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn) { return _to GetElementsByTagName(aTagname, aReturn); } \ + NS_IMETHOD CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn) { return _to CreateTextNode(aData, aReturn); } \ + NS_IMETHOD CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn) { return _to CreateComment(aData, aReturn); } \ + NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn) { return _to CreateCDATASection(aData, aReturn); } \ + NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn) { return _to CreateProcessingInstruction(aTarget, aData, aReturn); } \ + NS_IMETHOD CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return _to CreateAttribute(aName, aReturn); } \ + NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn) { return _to CreateEntityReference(aName, aReturn); } \ + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { return _to GetElementsByTagName(aTagname, aReturn); } \ NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn) { return _to ImportNode(aImportedNode, aDeep, aReturn); } \ - NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMElement** aReturn) { return _to CreateElementNS(aNamespaceURI, aQualifiedName, aReturn); } \ - NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMAttr** aReturn) { return _to CreateAttributeNS(aNamespaceURI, aQualifiedName, aReturn); } \ - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } \ - NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn) { return _to GetElementById(aElementId, aReturn); } \ + NS_IMETHOD CreateElementNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn) { return _to CreateElementNS(aNamespaceURI, aQualifiedName, aReturn); } \ + NS_IMETHOD CreateAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { return _to CreateAttributeNS(aNamespaceURI, aQualifiedName, aReturn); } \ + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn) { return _to GetElementById(aElementId, aReturn); } \ extern "C" NS_DOM nsresult NS_InitDocumentClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMDocumentCSS.h b/dom/public/coreDom/nsIDOMDocumentCSS.h index 642fe3c844ee..a7c0280398a7 100644 --- a/dom/public/coreDom/nsIDOMDocumentCSS.h +++ b/dom/public/coreDom/nsIDOMDocumentCSS.h @@ -40,17 +40,17 @@ class nsIDOMDocumentCSS : public nsIDOMDocumentStyle { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOCUMENTCSS_IID; return iid; } - NS_IMETHOD GetOverrideStyle(nsIDOMElement* aElt, const nsString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn)=0; + NS_IMETHOD GetOverrideStyle(nsIDOMElement* aElt, const nsAReadableString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn)=0; }; #define NS_DECL_IDOMDOCUMENTCSS \ - NS_IMETHOD GetOverrideStyle(nsIDOMElement* aElt, const nsString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn); \ + NS_IMETHOD GetOverrideStyle(nsIDOMElement* aElt, const nsAReadableString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn); \ #define NS_FORWARD_IDOMDOCUMENTCSS(_to) \ - NS_IMETHOD GetOverrideStyle(nsIDOMElement* aElt, const nsString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn) { return _to GetOverrideStyle(aElt, aPseudoElt, aReturn); } \ + NS_IMETHOD GetOverrideStyle(nsIDOMElement* aElt, const nsAReadableString& aPseudoElt, nsIDOMCSSStyleDeclaration** aReturn) { return _to GetOverrideStyle(aElt, aPseudoElt, aReturn); } \ #endif // nsIDOMDocumentCSS_h__ diff --git a/dom/public/coreDom/nsIDOMDocumentEvent.h b/dom/public/coreDom/nsIDOMDocumentEvent.h index 53c40d17ca4b..c5182c6f28a5 100644 --- a/dom/public/coreDom/nsIDOMDocumentEvent.h +++ b/dom/public/coreDom/nsIDOMDocumentEvent.h @@ -38,17 +38,17 @@ class nsIDOMDocumentEvent : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOCUMENTEVENT_IID; return iid; } - NS_IMETHOD CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn)=0; + NS_IMETHOD CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aReturn)=0; }; #define NS_DECL_IDOMDOCUMENTEVENT \ - NS_IMETHOD CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn); \ + NS_IMETHOD CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aReturn); \ #define NS_FORWARD_IDOMDOCUMENTEVENT(_to) \ - NS_IMETHOD CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn) { return _to CreateEvent(aEventType, aReturn); } \ + NS_IMETHOD CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aReturn) { return _to CreateEvent(aEventType, aReturn); } \ #endif // nsIDOMDocumentEvent_h__ diff --git a/dom/public/coreDom/nsIDOMDocumentType.h b/dom/public/coreDom/nsIDOMDocumentType.h index 4383de7dafd3..d3040e55dd59 100644 --- a/dom/public/coreDom/nsIDOMDocumentType.h +++ b/dom/public/coreDom/nsIDOMDocumentType.h @@ -39,37 +39,37 @@ class nsIDOMDocumentType : public nsIDOMNode { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOCUMENTTYPE_IID; return iid; } - NS_IMETHOD GetName(nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; NS_IMETHOD GetEntities(nsIDOMNamedNodeMap** aEntities)=0; NS_IMETHOD GetNotations(nsIDOMNamedNodeMap** aNotations)=0; - NS_IMETHOD GetPublicId(nsString& aPublicId)=0; + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId)=0; - NS_IMETHOD GetSystemId(nsString& aSystemId)=0; + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId)=0; - NS_IMETHOD GetInternalSubset(nsString& aInternalSubset)=0; + NS_IMETHOD GetInternalSubset(nsAWritableString& aInternalSubset)=0; }; #define NS_DECL_IDOMDOCUMENTTYPE \ - NS_IMETHOD GetName(nsString& aName); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ NS_IMETHOD GetEntities(nsIDOMNamedNodeMap** aEntities); \ NS_IMETHOD GetNotations(nsIDOMNamedNodeMap** aNotations); \ - NS_IMETHOD GetPublicId(nsString& aPublicId); \ - NS_IMETHOD GetSystemId(nsString& aSystemId); \ - NS_IMETHOD GetInternalSubset(nsString& aInternalSubset); \ + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId); \ + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId); \ + NS_IMETHOD GetInternalSubset(nsAWritableString& aInternalSubset); \ #define NS_FORWARD_IDOMDOCUMENTTYPE(_to) \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ NS_IMETHOD GetEntities(nsIDOMNamedNodeMap** aEntities) { return _to GetEntities(aEntities); } \ NS_IMETHOD GetNotations(nsIDOMNamedNodeMap** aNotations) { return _to GetNotations(aNotations); } \ - NS_IMETHOD GetPublicId(nsString& aPublicId) { return _to GetPublicId(aPublicId); } \ - NS_IMETHOD GetSystemId(nsString& aSystemId) { return _to GetSystemId(aSystemId); } \ - NS_IMETHOD GetInternalSubset(nsString& aInternalSubset) { return _to GetInternalSubset(aInternalSubset); } \ + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId) { return _to GetPublicId(aPublicId); } \ + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId) { return _to GetSystemId(aSystemId); } \ + NS_IMETHOD GetInternalSubset(nsAWritableString& aInternalSubset) { return _to GetInternalSubset(aInternalSubset); } \ extern "C" NS_DOM nsresult NS_InitDocumentTypeClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMDocumentXBL.h b/dom/public/coreDom/nsIDOMDocumentXBL.h index c440c33bc0d6..dfeabc3a80a6 100644 --- a/dom/public/coreDom/nsIDOMDocumentXBL.h +++ b/dom/public/coreDom/nsIDOMDocumentXBL.h @@ -41,27 +41,27 @@ public: NS_IMETHOD GetAnonymousNodes(nsIDOMElement* aElt, nsIDOMNodeList** aReturn)=0; - NS_IMETHOD AddBinding(nsIDOMElement* aElt, const nsString& aBindingURL)=0; + NS_IMETHOD AddBinding(nsIDOMElement* aElt, const nsAReadableString& aBindingURL)=0; - NS_IMETHOD RemoveBinding(nsIDOMElement* aElt, const nsString& aBindingURL)=0; + NS_IMETHOD RemoveBinding(nsIDOMElement* aElt, const nsAReadableString& aBindingURL)=0; - NS_IMETHOD LoadBindingDocument(const nsString& aDocumentURL)=0; + NS_IMETHOD LoadBindingDocument(const nsAReadableString& aDocumentURL)=0; }; #define NS_DECL_IDOMDOCUMENTXBL \ NS_IMETHOD GetAnonymousNodes(nsIDOMElement* aElt, nsIDOMNodeList** aReturn); \ - NS_IMETHOD AddBinding(nsIDOMElement* aElt, const nsString& aBindingURL); \ - NS_IMETHOD RemoveBinding(nsIDOMElement* aElt, const nsString& aBindingURL); \ - NS_IMETHOD LoadBindingDocument(const nsString& aDocumentURL); \ + NS_IMETHOD AddBinding(nsIDOMElement* aElt, const nsAReadableString& aBindingURL); \ + NS_IMETHOD RemoveBinding(nsIDOMElement* aElt, const nsAReadableString& aBindingURL); \ + NS_IMETHOD LoadBindingDocument(const nsAReadableString& aDocumentURL); \ #define NS_FORWARD_IDOMDOCUMENTXBL(_to) \ NS_IMETHOD GetAnonymousNodes(nsIDOMElement* aElt, nsIDOMNodeList** aReturn) { return _to GetAnonymousNodes(aElt, aReturn); } \ - NS_IMETHOD AddBinding(nsIDOMElement* aElt, const nsString& aBindingURL) { return _to AddBinding(aElt, aBindingURL); } \ - NS_IMETHOD RemoveBinding(nsIDOMElement* aElt, const nsString& aBindingURL) { return _to RemoveBinding(aElt, aBindingURL); } \ - NS_IMETHOD LoadBindingDocument(const nsString& aDocumentURL) { return _to LoadBindingDocument(aDocumentURL); } \ + NS_IMETHOD AddBinding(nsIDOMElement* aElt, const nsAReadableString& aBindingURL) { return _to AddBinding(aElt, aBindingURL); } \ + NS_IMETHOD RemoveBinding(nsIDOMElement* aElt, const nsAReadableString& aBindingURL) { return _to RemoveBinding(aElt, aBindingURL); } \ + NS_IMETHOD LoadBindingDocument(const nsAReadableString& aDocumentURL) { return _to LoadBindingDocument(aDocumentURL); } \ #endif // nsIDOMDocumentXBL_h__ diff --git a/dom/public/coreDom/nsIDOMElement.h b/dom/public/coreDom/nsIDOMElement.h index 0f0604b38e4a..fbd04eb5f1f7 100644 --- a/dom/public/coreDom/nsIDOMElement.h +++ b/dom/public/coreDom/nsIDOMElement.h @@ -40,77 +40,77 @@ class nsIDOMElement : public nsIDOMNode { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMELEMENT_IID; return iid; } - NS_IMETHOD GetTagName(nsString& aTagName)=0; + NS_IMETHOD GetTagName(nsAWritableString& aTagName)=0; - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn)=0; + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn)=0; - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue)=0; + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)=0; - NS_IMETHOD RemoveAttribute(const nsString& aName)=0; + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName)=0; - NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn)=0; + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn)=0; NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn)=0; NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn)=0; - NS_IMETHOD GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aName, nsIDOMNodeList** aReturn)=0; - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsString& aReturn)=0; + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsAWritableString& aReturn)=0; - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, const nsString& aValue)=0; + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, const nsAReadableString& aValue)=0; - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName)=0; + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName)=0; - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMAttr** aReturn)=0; + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMAttr** aReturn)=0; NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn)=0; - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn)=0; - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn)=0; + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn)=0; - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName, PRBool* aReturn)=0; + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, PRBool* aReturn)=0; }; #define NS_DECL_IDOMELEMENT \ - NS_IMETHOD GetTagName(nsString& aTagName); \ - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn); \ - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue); \ - NS_IMETHOD RemoveAttribute(const nsString& aName); \ - NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn); \ + NS_IMETHOD GetTagName(nsAWritableString& aTagName); \ + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn); \ + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue); \ + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName); \ + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn); \ NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); \ NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn); \ - NS_IMETHOD GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn); \ - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsString& aReturn); \ - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, const nsString& aValue); \ - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName); \ - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMAttr** aReturn); \ + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aName, nsIDOMNodeList** aReturn); \ + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsAWritableString& aReturn); \ + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, const nsAReadableString& aValue); \ + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName); \ + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMAttr** aReturn); \ NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); \ - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn); \ - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn); \ - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName, PRBool* aReturn); \ + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn); \ + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn); \ + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, PRBool* aReturn); \ #define NS_FORWARD_IDOMELEMENT(_to) \ - NS_IMETHOD GetTagName(nsString& aTagName) { return _to GetTagName(aTagName); } \ - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { return _to GetAttribute(aName, aReturn); } \ - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { return _to SetAttribute(aName, aValue); } \ - NS_IMETHOD RemoveAttribute(const nsString& aName) { return _to RemoveAttribute(aName); } \ - NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn) { return _to GetAttributeNode(aName, aReturn); } \ + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { return _to GetTagName(aTagName); } \ + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return _to GetAttribute(aName, aReturn); } \ + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return _to SetAttribute(aName, aValue); } \ + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { return _to RemoveAttribute(aName); } \ + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return _to GetAttributeNode(aName, aReturn); } \ NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return _to SetAttributeNode(aNewAttr, aReturn); } \ NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return _to RemoveAttributeNode(aOldAttr, aReturn); } \ - NS_IMETHOD GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagName(aName, aReturn); } \ - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsString& aReturn) { return _to GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } \ - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, const nsString& aValue) { return _to SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } \ - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName) { return _to RemoveAttributeNS(aNamespaceURI, aLocalName); } \ - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMAttr** aReturn) { return _to GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagName(aName, aReturn); } \ + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsAWritableString& aReturn) { return _to GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, const nsAReadableString& aValue) { return _to SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } \ + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName) { return _to RemoveAttributeNS(aNamespaceURI, aLocalName); } \ + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { return _to GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } \ NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return _to SetAttributeNodeNS(aNewAttr, aReturn); } \ - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } \ - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { return _to HasAttribute(aName, aReturn); } \ - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, const nsString& aLocalName, PRBool* aReturn) { return _to HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { return _to HasAttribute(aName, aReturn); } \ + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, PRBool* aReturn) { return _to HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMEntity.h b/dom/public/coreDom/nsIDOMEntity.h index a1baf82e2087..ed41eafbb9ec 100644 --- a/dom/public/coreDom/nsIDOMEntity.h +++ b/dom/public/coreDom/nsIDOMEntity.h @@ -38,25 +38,25 @@ class nsIDOMEntity : public nsIDOMNode { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMENTITY_IID; return iid; } - NS_IMETHOD GetPublicId(nsString& aPublicId)=0; + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId)=0; - NS_IMETHOD GetSystemId(nsString& aSystemId)=0; + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId)=0; - NS_IMETHOD GetNotationName(nsString& aNotationName)=0; + NS_IMETHOD GetNotationName(nsAWritableString& aNotationName)=0; }; #define NS_DECL_IDOMENTITY \ - NS_IMETHOD GetPublicId(nsString& aPublicId); \ - NS_IMETHOD GetSystemId(nsString& aSystemId); \ - NS_IMETHOD GetNotationName(nsString& aNotationName); \ + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId); \ + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId); \ + NS_IMETHOD GetNotationName(nsAWritableString& aNotationName); \ #define NS_FORWARD_IDOMENTITY(_to) \ - NS_IMETHOD GetPublicId(nsString& aPublicId) { return _to GetPublicId(aPublicId); } \ - NS_IMETHOD GetSystemId(nsString& aSystemId) { return _to GetSystemId(aSystemId); } \ - NS_IMETHOD GetNotationName(nsString& aNotationName) { return _to GetNotationName(aNotationName); } \ + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId) { return _to GetPublicId(aPublicId); } \ + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId) { return _to GetSystemId(aSystemId); } \ + NS_IMETHOD GetNotationName(nsAWritableString& aNotationName) { return _to GetNotationName(aNotationName); } \ extern "C" NS_DOM nsresult NS_InitEntityClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMMediaList.h b/dom/public/coreDom/nsIDOMMediaList.h index 07a98a5426fc..7fd2e71c8502 100644 --- a/dom/public/coreDom/nsIDOMMediaList.h +++ b/dom/public/coreDom/nsIDOMMediaList.h @@ -37,36 +37,36 @@ class nsIDOMMediaList : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMMEDIALIST_IID; return iid; } - NS_IMETHOD GetMediaText(nsString& aMediaText)=0; - NS_IMETHOD SetMediaText(const nsString& aMediaText)=0; + NS_IMETHOD GetMediaText(nsAWritableString& aMediaText)=0; + NS_IMETHOD SetMediaText(const nsAReadableString& aMediaText)=0; NS_IMETHOD GetLength(PRUint32* aLength)=0; - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn)=0; + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn)=0; - NS_IMETHOD Delete(const nsString& aOldMedium)=0; + NS_IMETHOD Delete(const nsAReadableString& aOldMedium)=0; - NS_IMETHOD Append(const nsString& aNewMedium)=0; + NS_IMETHOD Append(const nsAReadableString& aNewMedium)=0; }; #define NS_DECL_IDOMMEDIALIST \ - NS_IMETHOD GetMediaText(nsString& aMediaText); \ - NS_IMETHOD SetMediaText(const nsString& aMediaText); \ + NS_IMETHOD GetMediaText(nsAWritableString& aMediaText); \ + NS_IMETHOD SetMediaText(const nsAReadableString& aMediaText); \ NS_IMETHOD GetLength(PRUint32* aLength); \ - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn); \ - NS_IMETHOD Delete(const nsString& aOldMedium); \ - NS_IMETHOD Append(const nsString& aNewMedium); \ + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn); \ + NS_IMETHOD Delete(const nsAReadableString& aOldMedium); \ + NS_IMETHOD Append(const nsAReadableString& aNewMedium); \ #define NS_FORWARD_IDOMMEDIALIST(_to) \ - NS_IMETHOD GetMediaText(nsString& aMediaText) { return _to GetMediaText(aMediaText); } \ - NS_IMETHOD SetMediaText(const nsString& aMediaText) { return _to SetMediaText(aMediaText); } \ + NS_IMETHOD GetMediaText(nsAWritableString& aMediaText) { return _to GetMediaText(aMediaText); } \ + NS_IMETHOD SetMediaText(const nsAReadableString& aMediaText) { return _to SetMediaText(aMediaText); } \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD Delete(const nsString& aOldMedium) { return _to Delete(aOldMedium); } \ - NS_IMETHOD Append(const nsString& aNewMedium) { return _to Append(aNewMedium); } \ + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn) { return _to Item(aIndex, aReturn); } \ + NS_IMETHOD Delete(const nsAReadableString& aOldMedium) { return _to Delete(aOldMedium); } \ + NS_IMETHOD Append(const nsAReadableString& aNewMedium) { return _to Append(aNewMedium); } \ extern "C" NS_DOM nsresult NS_InitMediaListClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMNSDocument.h b/dom/public/coreDom/nsIDOMNSDocument.h index 1226c95b37ec..9c29b1cde582 100644 --- a/dom/public/coreDom/nsIDOMNSDocument.h +++ b/dom/public/coreDom/nsIDOMNSDocument.h @@ -40,33 +40,33 @@ class nsIDOMNSDocument : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSDOCUMENT_IID; return iid; } - NS_IMETHOD GetCharacterSet(nsString& aCharacterSet)=0; + NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet)=0; NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins)=0; - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn)=0; + NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName, const nsAReadableString& aNameSpace, nsIDOMElement** aReturn)=0; NS_IMETHOD CreateRange(nsIDOMRange** aReturn)=0; - NS_IMETHOD Load(const nsString& aUrl)=0; + NS_IMETHOD Load(const nsAReadableString& aUrl)=0; }; #define NS_DECL_IDOMNSDOCUMENT \ - NS_IMETHOD GetCharacterSet(nsString& aCharacterSet); \ + NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet); \ NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); \ - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn); \ + NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName, const nsAReadableString& aNameSpace, nsIDOMElement** aReturn); \ NS_IMETHOD CreateRange(nsIDOMRange** aReturn); \ - NS_IMETHOD Load(const nsString& aUrl); \ + NS_IMETHOD Load(const nsAReadableString& aUrl); \ #define NS_FORWARD_IDOMNSDOCUMENT(_to) \ - NS_IMETHOD GetCharacterSet(nsString& aCharacterSet) { return _to GetCharacterSet(aCharacterSet); } \ + NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet) { return _to GetCharacterSet(aCharacterSet); } \ NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins) { return _to GetPlugins(aPlugins); } \ - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn) { return _to CreateElementWithNameSpace(aTagName, aNameSpace, aReturn); } \ + NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName, const nsAReadableString& aNameSpace, nsIDOMElement** aReturn) { return _to CreateElementWithNameSpace(aTagName, aNameSpace, aReturn); } \ NS_IMETHOD CreateRange(nsIDOMRange** aReturn) { return _to CreateRange(aReturn); } \ - NS_IMETHOD Load(const nsString& aUrl) { return _to Load(aUrl); } \ + NS_IMETHOD Load(const nsAReadableString& aUrl) { return _to Load(aUrl); } \ #endif // nsIDOMNSDocument_h__ diff --git a/dom/public/coreDom/nsIDOMNamedNodeMap.h b/dom/public/coreDom/nsIDOMNamedNodeMap.h index af46a71d4128..fc19874c44a6 100644 --- a/dom/public/coreDom/nsIDOMNamedNodeMap.h +++ b/dom/public/coreDom/nsIDOMNamedNodeMap.h @@ -40,43 +40,43 @@ public: NS_IMETHOD GetLength(PRUint32* aLength)=0; - NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn)=0; + NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0; NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn)=0; - NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)=0; + NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0; NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0; - NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn)=0; + NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNode** aReturn)=0; NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)=0; - NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn)=0; + NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNode** aReturn)=0; }; #define NS_DECL_IDOMNAMEDNODEMAP \ NS_IMETHOD GetLength(PRUint32* aLength); \ - NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn); \ + NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); \ NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn); \ - NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn); \ + NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); \ - NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn); \ + NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNode** aReturn); \ NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn); \ - NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn); \ + NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNode** aReturn); \ #define NS_FORWARD_IDOMNAMEDNODEMAP(_to) \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ - NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to GetNamedItem(aName, aReturn); } \ + NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { return _to GetNamedItem(aName, aReturn); } \ NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) { return _to SetNamedItem(aArg, aReturn); } \ - NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to RemoveNamedItem(aName, aReturn); } \ + NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { return _to RemoveNamedItem(aName, aReturn); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn) { return _to GetNamedItemNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { return _to GetNamedItemNS(aNamespaceURI, aLocalName, aReturn); } \ NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) { return _to SetNamedItemNS(aArg, aReturn); } \ - NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNode** aReturn) { return _to RemoveNamedItemNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { return _to RemoveNamedItemNS(aNamespaceURI, aLocalName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitNamedNodeMapClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMNode.h b/dom/public/coreDom/nsIDOMNode.h index ecd36d2a8a05..6aa9a5f72921 100644 --- a/dom/public/coreDom/nsIDOMNode.h +++ b/dom/public/coreDom/nsIDOMNode.h @@ -55,10 +55,10 @@ public: NOTATION_NODE = 12 }; - NS_IMETHOD GetNodeName(nsString& aNodeName)=0; + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName)=0; - NS_IMETHOD GetNodeValue(nsString& aNodeValue)=0; - NS_IMETHOD SetNodeValue(const nsString& aNodeValue)=0; + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue)=0; + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue)=0; NS_IMETHOD GetNodeType(PRUint16* aNodeType)=0; @@ -78,12 +78,12 @@ public: NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument)=0; - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI)=0; + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI)=0; - NS_IMETHOD GetPrefix(nsString& aPrefix)=0; - NS_IMETHOD SetPrefix(const nsString& aPrefix)=0; + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix)=0; + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix)=0; - NS_IMETHOD GetLocalName(nsString& aLocalName)=0; + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName)=0; NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)=0; @@ -99,14 +99,14 @@ public: NS_IMETHOD Normalize()=0; - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn)=0; + NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn)=0; }; #define NS_DECL_IDOMNODE \ - NS_IMETHOD GetNodeName(nsString& aNodeName); \ - NS_IMETHOD GetNodeValue(nsString& aNodeValue); \ - NS_IMETHOD SetNodeValue(const nsString& aNodeValue); \ + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); \ + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue); \ + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue); \ NS_IMETHOD GetNodeType(PRUint16* aNodeType); \ NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode); \ NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes); \ @@ -116,10 +116,10 @@ public: NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling); \ NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes); \ NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument); \ - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI); \ - NS_IMETHOD GetPrefix(nsString& aPrefix); \ - NS_IMETHOD SetPrefix(const nsString& aPrefix); \ - NS_IMETHOD GetLocalName(nsString& aLocalName); \ + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI); \ + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix); \ + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix); \ + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName); \ NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn); \ NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn); \ NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn); \ @@ -127,14 +127,14 @@ public: NS_IMETHOD HasChildNodes(PRBool* aReturn); \ NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); \ NS_IMETHOD Normalize(); \ - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn); \ + NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); \ #define NS_FORWARD_IDOMNODE(_to) \ - NS_IMETHOD GetNodeName(nsString& aNodeName) { return _to GetNodeName(aNodeName); } \ - NS_IMETHOD GetNodeValue(nsString& aNodeValue) { return _to GetNodeValue(aNodeValue); } \ - NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { return _to SetNodeValue(aNodeValue); } \ + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName) { return _to GetNodeName(aNodeName); } \ + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { return _to GetNodeValue(aNodeValue); } \ + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { return _to SetNodeValue(aNodeValue); } \ NS_IMETHOD GetNodeType(PRUint16* aNodeType) { return _to GetNodeType(aNodeType); } \ NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) { return _to GetParentNode(aParentNode); } \ NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) { return _to GetChildNodes(aChildNodes); } \ @@ -144,10 +144,10 @@ public: NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) { return _to GetNextSibling(aNextSibling); } \ NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { return _to GetAttributes(aAttributes); } \ NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { return _to GetOwnerDocument(aOwnerDocument); } \ - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI) { return _to GetNamespaceURI(aNamespaceURI); } \ - NS_IMETHOD GetPrefix(nsString& aPrefix) { return _to GetPrefix(aPrefix); } \ - NS_IMETHOD SetPrefix(const nsString& aPrefix) { return _to SetPrefix(aPrefix); } \ - NS_IMETHOD GetLocalName(nsString& aLocalName) { return _to GetLocalName(aLocalName); } \ + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI) { return _to GetNamespaceURI(aNamespaceURI); } \ + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { return _to GetPrefix(aPrefix); } \ + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { return _to SetPrefix(aPrefix); } \ + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { return _to GetLocalName(aLocalName); } \ NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) { return _to InsertBefore(aNewChild, aRefChild, aReturn); } \ NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return _to ReplaceChild(aNewChild, aOldChild, aReturn); } \ NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return _to RemoveChild(aOldChild, aReturn); } \ @@ -155,7 +155,7 @@ public: NS_IMETHOD HasChildNodes(PRBool* aReturn) { return _to HasChildNodes(aReturn); } \ NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { return _to CloneNode(aDeep, aReturn); } \ NS_IMETHOD Normalize() { return _to Normalize(); } \ - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn) { return _to Supports(aFeature, aVersion, aReturn); } \ + NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return _to Supports(aFeature, aVersion, aReturn); } \ extern "C" NS_DOM nsresult NS_InitNodeClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMNotation.h b/dom/public/coreDom/nsIDOMNotation.h index bbc19c0e6c30..f86b14cd7295 100644 --- a/dom/public/coreDom/nsIDOMNotation.h +++ b/dom/public/coreDom/nsIDOMNotation.h @@ -38,21 +38,21 @@ class nsIDOMNotation : public nsIDOMNode { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMNOTATION_IID; return iid; } - NS_IMETHOD GetPublicId(nsString& aPublicId)=0; + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId)=0; - NS_IMETHOD GetSystemId(nsString& aSystemId)=0; + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId)=0; }; #define NS_DECL_IDOMNOTATION \ - NS_IMETHOD GetPublicId(nsString& aPublicId); \ - NS_IMETHOD GetSystemId(nsString& aSystemId); \ + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId); \ + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId); \ #define NS_FORWARD_IDOMNOTATION(_to) \ - NS_IMETHOD GetPublicId(nsString& aPublicId) { return _to GetPublicId(aPublicId); } \ - NS_IMETHOD GetSystemId(nsString& aSystemId) { return _to GetSystemId(aSystemId); } \ + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId) { return _to GetPublicId(aPublicId); } \ + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId) { return _to GetSystemId(aSystemId); } \ extern "C" NS_DOM nsresult NS_InitNotationClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMProcessingInstruction.h b/dom/public/coreDom/nsIDOMProcessingInstruction.h index e7be4076fdb7..97b36d734ce2 100644 --- a/dom/public/coreDom/nsIDOMProcessingInstruction.h +++ b/dom/public/coreDom/nsIDOMProcessingInstruction.h @@ -38,24 +38,24 @@ class nsIDOMProcessingInstruction : public nsIDOMNode { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMPROCESSINGINSTRUCTION_IID; return iid; } - NS_IMETHOD GetTarget(nsString& aTarget)=0; + NS_IMETHOD GetTarget(nsAWritableString& aTarget)=0; - NS_IMETHOD GetData(nsString& aData)=0; - NS_IMETHOD SetData(const nsString& aData)=0; + NS_IMETHOD GetData(nsAWritableString& aData)=0; + NS_IMETHOD SetData(const nsAReadableString& aData)=0; }; #define NS_DECL_IDOMPROCESSINGINSTRUCTION \ - NS_IMETHOD GetTarget(nsString& aTarget); \ - NS_IMETHOD GetData(nsString& aData); \ - NS_IMETHOD SetData(const nsString& aData); \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget); \ + NS_IMETHOD GetData(nsAWritableString& aData); \ + NS_IMETHOD SetData(const nsAReadableString& aData); \ #define NS_FORWARD_IDOMPROCESSINGINSTRUCTION(_to) \ - NS_IMETHOD GetTarget(nsString& aTarget) { return _to GetTarget(aTarget); } \ - NS_IMETHOD GetData(nsString& aData) { return _to GetData(aData); } \ - NS_IMETHOD SetData(const nsString& aData) { return _to SetData(aData); } \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget) { return _to GetTarget(aTarget); } \ + NS_IMETHOD GetData(nsAWritableString& aData) { return _to GetData(aData); } \ + NS_IMETHOD SetData(const nsAReadableString& aData) { return _to SetData(aData); } \ extern "C" NS_DOM nsresult NS_InitProcessingInstructionClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreDom/nsIDOMStyleSheet.h b/dom/public/coreDom/nsIDOMStyleSheet.h index d3163af64d25..44b29b4eae63 100644 --- a/dom/public/coreDom/nsIDOMStyleSheet.h +++ b/dom/public/coreDom/nsIDOMStyleSheet.h @@ -40,7 +40,7 @@ class nsIDOMStyleSheet : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMSTYLESHEET_IID; return iid; } - NS_IMETHOD GetType(nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; @@ -49,34 +49,34 @@ public: NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet)=0; - NS_IMETHOD GetHref(nsString& aHref)=0; + NS_IMETHOD GetHref(nsAWritableString& aHref)=0; - NS_IMETHOD GetTitle(nsString& aTitle)=0; + NS_IMETHOD GetTitle(nsAWritableString& aTitle)=0; NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia)=0; }; #define NS_DECL_IDOMSTYLESHEET \ - NS_IMETHOD GetType(nsString& aType); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode); \ NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet); \ - NS_IMETHOD GetHref(nsString& aHref); \ - NS_IMETHOD GetTitle(nsString& aTitle); \ + NS_IMETHOD GetHref(nsAWritableString& aHref); \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle); \ NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia); \ #define NS_FORWARD_IDOMSTYLESHEET(_to) \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode) { return _to GetOwnerNode(aOwnerNode); } \ NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) { return _to GetParentStyleSheet(aParentStyleSheet); } \ - NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \ - NS_IMETHOD GetTitle(nsString& aTitle) { return _to GetTitle(aTitle); } \ + NS_IMETHOD GetHref(nsAWritableString& aHref) { return _to GetHref(aHref); } \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle) { return _to GetTitle(aTitle); } \ NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) { return _to GetMedia(aMedia); } \ diff --git a/dom/public/coreEvents/nsIDOMEvent.h b/dom/public/coreEvents/nsIDOMEvent.h index aa2f12882cbd..cd40046fa621 100644 --- a/dom/public/coreEvents/nsIDOMEvent.h +++ b/dom/public/coreEvents/nsIDOMEvent.h @@ -78,7 +78,7 @@ public: META_MASK = 8 }; - NS_IMETHOD GetType(nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget)=0; @@ -100,12 +100,12 @@ public: NS_IMETHOD PreventDefault()=0; - NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg)=0; + NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg)=0; }; #define NS_DECL_IDOMEVENT \ - NS_IMETHOD GetType(nsString& aType); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget); \ NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget); \ NS_IMETHOD GetEventPhase(PRUint16* aEventPhase); \ @@ -116,12 +116,12 @@ public: NS_IMETHOD PreventBubble(); \ NS_IMETHOD PreventCapture(); \ NS_IMETHOD PreventDefault(); \ - NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg); \ + NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg); \ #define NS_FORWARD_IDOMEVENT(_to) \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget) { return _to GetTarget(aTarget); } \ NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget) { return _to GetCurrentTarget(aCurrentTarget); } \ NS_IMETHOD GetEventPhase(PRUint16* aEventPhase) { return _to GetEventPhase(aEventPhase); } \ @@ -132,7 +132,7 @@ public: NS_IMETHOD PreventBubble() { return _to PreventBubble(); } \ NS_IMETHOD PreventCapture() { return _to PreventCapture(); } \ NS_IMETHOD PreventDefault() { return _to PreventDefault(); } \ - NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg) { return _to InitEvent(aEventTypeArg, aCanBubbleArg, aCancelableArg); } \ + NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg) { return _to InitEvent(aEventTypeArg, aCanBubbleArg, aCancelableArg); } \ extern "C" NS_DOM nsresult NS_InitEventClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreEvents/nsIDOMEventCapturer.h b/dom/public/coreEvents/nsIDOMEventCapturer.h index 412ef6d8ac76..88026dc6318c 100644 --- a/dom/public/coreEvents/nsIDOMEventCapturer.h +++ b/dom/public/coreEvents/nsIDOMEventCapturer.h @@ -25,7 +25,7 @@ #define nsIDOMEventCapturer_h__ #include "nsISupports.h" -#include "nsString.h" +#include "nsAWritableString.h" #include "nsIScriptContext.h" #include "nsIDOMEventReceiver.h" @@ -38,21 +38,21 @@ class nsIDOMEventCapturer : public nsIDOMEventReceiver { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMEVENTCAPTURER_IID; return iid; } - NS_IMETHOD CaptureEvent(const nsString& aType)=0; + NS_IMETHOD CaptureEvent(const nsAReadableString& aType)=0; - NS_IMETHOD ReleaseEvent(const nsString& aType)=0; + NS_IMETHOD ReleaseEvent(const nsAReadableString& aType)=0; }; #define NS_DECL_IDOMEVENTCAPTURER \ - NS_IMETHOD CaptureEvent(const nsString& aType); \ - NS_IMETHOD ReleaseEvent(const nsString& aType); \ + NS_IMETHOD CaptureEvent(const nsAReadableString& aType); \ + NS_IMETHOD ReleaseEvent(const nsAReadableString& aType); \ #define NS_FORWARD_IDOMEVENTCAPTURER(_to) \ - NS_IMETHOD CaptureEvent(const nsString& aType) { return _to CaptureEvent(aType); } \ - NS_IMETHOD ReleaseEvent(const nsString& aType) { return _to ReleaseEvent(aType); } \ + NS_IMETHOD CaptureEvent(const nsAReadableString& aType) { return _to CaptureEvent(aType); } \ + NS_IMETHOD ReleaseEvent(const nsAReadableString& aType) { return _to ReleaseEvent(aType); } \ #endif // nsIDOMEventCapturer_h__ diff --git a/dom/public/coreEvents/nsIDOMEventTarget.h b/dom/public/coreEvents/nsIDOMEventTarget.h index f0b3fb3f1671..8a8a478d64a0 100644 --- a/dom/public/coreEvents/nsIDOMEventTarget.h +++ b/dom/public/coreEvents/nsIDOMEventTarget.h @@ -39,24 +39,24 @@ class nsIDOMEventTarget : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMEVENTTARGET_IID; return iid; } - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture)=0; + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture)=0; - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture)=0; + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture)=0; NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvt)=0; }; #define NS_DECL_IDOMEVENTTARGET \ - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); \ - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); \ + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); \ + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); \ NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvt); \ #define NS_FORWARD_IDOMEVENTTARGET(_to) \ - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { return _to AddEventListener(aType, aListener, aUseCapture); } \ - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { return _to RemoveEventListener(aType, aListener, aUseCapture); } \ + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { return _to AddEventListener(aType, aListener, aUseCapture); } \ + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { return _to RemoveEventListener(aType, aListener, aUseCapture); } \ NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvt) { return _to DispatchEvent(aEvt); } \ diff --git a/dom/public/coreEvents/nsIDOMKeyEvent.h b/dom/public/coreEvents/nsIDOMKeyEvent.h index 25b9aa00056f..1f73d2a9fd2d 100644 --- a/dom/public/coreEvents/nsIDOMKeyEvent.h +++ b/dom/public/coreEvents/nsIDOMKeyEvent.h @@ -166,7 +166,7 @@ public: NS_IMETHOD GetMetaKey(PRBool* aMetaKey)=0; - NS_IMETHOD InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg)=0; + NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg)=0; }; @@ -177,7 +177,7 @@ public: NS_IMETHOD GetCtrlKey(PRBool* aCtrlKey); \ NS_IMETHOD GetShiftKey(PRBool* aShiftKey); \ NS_IMETHOD GetMetaKey(PRBool* aMetaKey); \ - NS_IMETHOD InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg); \ + NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg); \ @@ -188,7 +188,7 @@ public: NS_IMETHOD GetCtrlKey(PRBool* aCtrlKey) { return _to GetCtrlKey(aCtrlKey); } \ NS_IMETHOD GetShiftKey(PRBool* aShiftKey) { return _to GetShiftKey(aShiftKey); } \ NS_IMETHOD GetMetaKey(PRBool* aMetaKey) { return _to GetMetaKey(aMetaKey); } \ - NS_IMETHOD InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg) { return _to InitKeyEvent(aTypeArg, aCanBubbleArg, aCancelableArg, aCtrlKeyArg, aAltKeyArg, aShiftKeyArg, aMetaKeyArg, aKeyCodeArg, aCharCodeArg, aViewArg); } \ + NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg) { return _to InitKeyEvent(aTypeArg, aCanBubbleArg, aCancelableArg, aCtrlKeyArg, aAltKeyArg, aShiftKeyArg, aMetaKeyArg, aKeyCodeArg, aCharCodeArg, aViewArg); } \ extern "C" NS_DOM nsresult NS_InitKeyEventClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/coreEvents/nsIDOMMouseEvent.h b/dom/public/coreEvents/nsIDOMMouseEvent.h index 5b6d8056155a..1084038b5095 100644 --- a/dom/public/coreEvents/nsIDOMMouseEvent.h +++ b/dom/public/coreEvents/nsIDOMMouseEvent.h @@ -59,7 +59,7 @@ public: NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)=0; - NS_IMETHOD InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg)=0; + NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg)=0; }; @@ -74,7 +74,7 @@ public: NS_IMETHOD GetMetaKey(PRBool* aMetaKey); \ NS_IMETHOD GetButton(PRUint16* aButton); \ NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget); \ - NS_IMETHOD InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg); \ + NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg); \ @@ -89,7 +89,7 @@ public: NS_IMETHOD GetMetaKey(PRBool* aMetaKey) { return _to GetMetaKey(aMetaKey); } \ NS_IMETHOD GetButton(PRUint16* aButton) { return _to GetButton(aButton); } \ NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget) { return _to GetRelatedTarget(aRelatedTarget); } \ - NS_IMETHOD InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg) { return _to InitMouseEvent(aTypeArg, aCtrlKeyArg, aAltKeyArg, aShiftKeyArg, aMetaKeyArg, aScreenXArg, aScreenYArg, aClientXArg, aClientYArg, aButtonArg, aDetailArg); } \ + NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg) { return _to InitMouseEvent(aTypeArg, aCtrlKeyArg, aAltKeyArg, aShiftKeyArg, aMetaKeyArg, aScreenXArg, aScreenYArg, aClientXArg, aClientYArg, aButtonArg, aDetailArg); } \ #endif // nsIDOMMouseEvent_h__ diff --git a/dom/public/coreEvents/nsIDOMUIEvent.h b/dom/public/coreEvents/nsIDOMUIEvent.h index 1cf42ed1e1c6..ecfa07deb15a 100644 --- a/dom/public/coreEvents/nsIDOMUIEvent.h +++ b/dom/public/coreEvents/nsIDOMUIEvent.h @@ -43,21 +43,21 @@ public: NS_IMETHOD GetDetail(PRInt32* aDetail)=0; - NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)=0; + NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)=0; }; #define NS_DECL_IDOMUIEVENT \ NS_IMETHOD GetView(nsIDOMAbstractView** aView); \ NS_IMETHOD GetDetail(PRInt32* aDetail); \ - NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg); \ + NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg); \ #define NS_FORWARD_IDOMUIEVENT(_to) \ NS_IMETHOD GetView(nsIDOMAbstractView** aView) { return _to GetView(aView); } \ NS_IMETHOD GetDetail(PRInt32* aDetail) { return _to GetDetail(aDetail); } \ - NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg) { return _to InitUIEvent(aTypeArg, aCanBubbleArg, aCancelableArg, aViewArg, aDetailArg); } \ + NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg) { return _to InitUIEvent(aTypeArg, aCanBubbleArg, aCancelableArg, aViewArg, aDetailArg); } \ extern "C" NS_DOM nsresult NS_InitUIEventClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/css/nsIDOMCSS2Properties.h b/dom/public/css/nsIDOMCSS2Properties.h index e490750d5a83..699021668f79 100644 --- a/dom/public/css/nsIDOMCSS2Properties.h +++ b/dom/public/css/nsIDOMCSS2Properties.h @@ -38,881 +38,881 @@ class nsIDOMCSS2Properties : public nsIDOMCSSStyleDeclaration { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSS2PROPERTIES_IID; return iid; } - NS_IMETHOD GetAzimuth(nsString& aAzimuth)=0; - NS_IMETHOD SetAzimuth(const nsString& aAzimuth)=0; + NS_IMETHOD GetAzimuth(nsAWritableString& aAzimuth)=0; + NS_IMETHOD SetAzimuth(const nsAReadableString& aAzimuth)=0; - NS_IMETHOD GetBackground(nsString& aBackground)=0; - NS_IMETHOD SetBackground(const nsString& aBackground)=0; + NS_IMETHOD GetBackground(nsAWritableString& aBackground)=0; + NS_IMETHOD SetBackground(const nsAReadableString& aBackground)=0; - NS_IMETHOD GetBackgroundAttachment(nsString& aBackgroundAttachment)=0; - NS_IMETHOD SetBackgroundAttachment(const nsString& aBackgroundAttachment)=0; + NS_IMETHOD GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment)=0; + NS_IMETHOD SetBackgroundAttachment(const nsAReadableString& aBackgroundAttachment)=0; - NS_IMETHOD GetBackgroundColor(nsString& aBackgroundColor)=0; - NS_IMETHOD SetBackgroundColor(const nsString& aBackgroundColor)=0; + NS_IMETHOD GetBackgroundColor(nsAWritableString& aBackgroundColor)=0; + NS_IMETHOD SetBackgroundColor(const nsAReadableString& aBackgroundColor)=0; - NS_IMETHOD GetBackgroundImage(nsString& aBackgroundImage)=0; - NS_IMETHOD SetBackgroundImage(const nsString& aBackgroundImage)=0; + NS_IMETHOD GetBackgroundImage(nsAWritableString& aBackgroundImage)=0; + NS_IMETHOD SetBackgroundImage(const nsAReadableString& aBackgroundImage)=0; - NS_IMETHOD GetBackgroundPosition(nsString& aBackgroundPosition)=0; - NS_IMETHOD SetBackgroundPosition(const nsString& aBackgroundPosition)=0; + NS_IMETHOD GetBackgroundPosition(nsAWritableString& aBackgroundPosition)=0; + NS_IMETHOD SetBackgroundPosition(const nsAReadableString& aBackgroundPosition)=0; - NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat)=0; - NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat)=0; + NS_IMETHOD GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat)=0; + NS_IMETHOD SetBackgroundRepeat(const nsAReadableString& aBackgroundRepeat)=0; - NS_IMETHOD GetBorder(nsString& aBorder)=0; - NS_IMETHOD SetBorder(const nsString& aBorder)=0; + NS_IMETHOD GetBorder(nsAWritableString& aBorder)=0; + NS_IMETHOD SetBorder(const nsAReadableString& aBorder)=0; - NS_IMETHOD GetBorderCollapse(nsString& aBorderCollapse)=0; - NS_IMETHOD SetBorderCollapse(const nsString& aBorderCollapse)=0; + NS_IMETHOD GetBorderCollapse(nsAWritableString& aBorderCollapse)=0; + NS_IMETHOD SetBorderCollapse(const nsAReadableString& aBorderCollapse)=0; - NS_IMETHOD GetBorderColor(nsString& aBorderColor)=0; - NS_IMETHOD SetBorderColor(const nsString& aBorderColor)=0; + NS_IMETHOD GetBorderColor(nsAWritableString& aBorderColor)=0; + NS_IMETHOD SetBorderColor(const nsAReadableString& aBorderColor)=0; - NS_IMETHOD GetBorderSpacing(nsString& aBorderSpacing)=0; - NS_IMETHOD SetBorderSpacing(const nsString& aBorderSpacing)=0; + NS_IMETHOD GetBorderSpacing(nsAWritableString& aBorderSpacing)=0; + NS_IMETHOD SetBorderSpacing(const nsAReadableString& aBorderSpacing)=0; - NS_IMETHOD GetBorderStyle(nsString& aBorderStyle)=0; - NS_IMETHOD SetBorderStyle(const nsString& aBorderStyle)=0; + NS_IMETHOD GetBorderStyle(nsAWritableString& aBorderStyle)=0; + NS_IMETHOD SetBorderStyle(const nsAReadableString& aBorderStyle)=0; - NS_IMETHOD GetBorderTop(nsString& aBorderTop)=0; - NS_IMETHOD SetBorderTop(const nsString& aBorderTop)=0; + NS_IMETHOD GetBorderTop(nsAWritableString& aBorderTop)=0; + NS_IMETHOD SetBorderTop(const nsAReadableString& aBorderTop)=0; - NS_IMETHOD GetBorderRight(nsString& aBorderRight)=0; - NS_IMETHOD SetBorderRight(const nsString& aBorderRight)=0; + NS_IMETHOD GetBorderRight(nsAWritableString& aBorderRight)=0; + NS_IMETHOD SetBorderRight(const nsAReadableString& aBorderRight)=0; - NS_IMETHOD GetBorderBottom(nsString& aBorderBottom)=0; - NS_IMETHOD SetBorderBottom(const nsString& aBorderBottom)=0; + NS_IMETHOD GetBorderBottom(nsAWritableString& aBorderBottom)=0; + NS_IMETHOD SetBorderBottom(const nsAReadableString& aBorderBottom)=0; - NS_IMETHOD GetBorderLeft(nsString& aBorderLeft)=0; - NS_IMETHOD SetBorderLeft(const nsString& aBorderLeft)=0; + NS_IMETHOD GetBorderLeft(nsAWritableString& aBorderLeft)=0; + NS_IMETHOD SetBorderLeft(const nsAReadableString& aBorderLeft)=0; - NS_IMETHOD GetBorderTopColor(nsString& aBorderTopColor)=0; - NS_IMETHOD SetBorderTopColor(const nsString& aBorderTopColor)=0; + NS_IMETHOD GetBorderTopColor(nsAWritableString& aBorderTopColor)=0; + NS_IMETHOD SetBorderTopColor(const nsAReadableString& aBorderTopColor)=0; - NS_IMETHOD GetBorderRightColor(nsString& aBorderRightColor)=0; - NS_IMETHOD SetBorderRightColor(const nsString& aBorderRightColor)=0; + NS_IMETHOD GetBorderRightColor(nsAWritableString& aBorderRightColor)=0; + NS_IMETHOD SetBorderRightColor(const nsAReadableString& aBorderRightColor)=0; - NS_IMETHOD GetBorderBottomColor(nsString& aBorderBottomColor)=0; - NS_IMETHOD SetBorderBottomColor(const nsString& aBorderBottomColor)=0; + NS_IMETHOD GetBorderBottomColor(nsAWritableString& aBorderBottomColor)=0; + NS_IMETHOD SetBorderBottomColor(const nsAReadableString& aBorderBottomColor)=0; - NS_IMETHOD GetBorderLeftColor(nsString& aBorderLeftColor)=0; - NS_IMETHOD SetBorderLeftColor(const nsString& aBorderLeftColor)=0; + NS_IMETHOD GetBorderLeftColor(nsAWritableString& aBorderLeftColor)=0; + NS_IMETHOD SetBorderLeftColor(const nsAReadableString& aBorderLeftColor)=0; - NS_IMETHOD GetBorderTopStyle(nsString& aBorderTopStyle)=0; - NS_IMETHOD SetBorderTopStyle(const nsString& aBorderTopStyle)=0; + NS_IMETHOD GetBorderTopStyle(nsAWritableString& aBorderTopStyle)=0; + NS_IMETHOD SetBorderTopStyle(const nsAReadableString& aBorderTopStyle)=0; - NS_IMETHOD GetBorderRightStyle(nsString& aBorderRightStyle)=0; - NS_IMETHOD SetBorderRightStyle(const nsString& aBorderRightStyle)=0; + NS_IMETHOD GetBorderRightStyle(nsAWritableString& aBorderRightStyle)=0; + NS_IMETHOD SetBorderRightStyle(const nsAReadableString& aBorderRightStyle)=0; - NS_IMETHOD GetBorderBottomStyle(nsString& aBorderBottomStyle)=0; - NS_IMETHOD SetBorderBottomStyle(const nsString& aBorderBottomStyle)=0; + NS_IMETHOD GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle)=0; + NS_IMETHOD SetBorderBottomStyle(const nsAReadableString& aBorderBottomStyle)=0; - NS_IMETHOD GetBorderLeftStyle(nsString& aBorderLeftStyle)=0; - NS_IMETHOD SetBorderLeftStyle(const nsString& aBorderLeftStyle)=0; + NS_IMETHOD GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle)=0; + NS_IMETHOD SetBorderLeftStyle(const nsAReadableString& aBorderLeftStyle)=0; - NS_IMETHOD GetBorderTopWidth(nsString& aBorderTopWidth)=0; - NS_IMETHOD SetBorderTopWidth(const nsString& aBorderTopWidth)=0; + NS_IMETHOD GetBorderTopWidth(nsAWritableString& aBorderTopWidth)=0; + NS_IMETHOD SetBorderTopWidth(const nsAReadableString& aBorderTopWidth)=0; - NS_IMETHOD GetBorderRightWidth(nsString& aBorderRightWidth)=0; - NS_IMETHOD SetBorderRightWidth(const nsString& aBorderRightWidth)=0; + NS_IMETHOD GetBorderRightWidth(nsAWritableString& aBorderRightWidth)=0; + NS_IMETHOD SetBorderRightWidth(const nsAReadableString& aBorderRightWidth)=0; - NS_IMETHOD GetBorderBottomWidth(nsString& aBorderBottomWidth)=0; - NS_IMETHOD SetBorderBottomWidth(const nsString& aBorderBottomWidth)=0; + NS_IMETHOD GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth)=0; + NS_IMETHOD SetBorderBottomWidth(const nsAReadableString& aBorderBottomWidth)=0; - NS_IMETHOD GetBorderLeftWidth(nsString& aBorderLeftWidth)=0; - NS_IMETHOD SetBorderLeftWidth(const nsString& aBorderLeftWidth)=0; + NS_IMETHOD GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth)=0; + NS_IMETHOD SetBorderLeftWidth(const nsAReadableString& aBorderLeftWidth)=0; - NS_IMETHOD GetBorderWidth(nsString& aBorderWidth)=0; - NS_IMETHOD SetBorderWidth(const nsString& aBorderWidth)=0; + NS_IMETHOD GetBorderWidth(nsAWritableString& aBorderWidth)=0; + NS_IMETHOD SetBorderWidth(const nsAReadableString& aBorderWidth)=0; - NS_IMETHOD GetBottom(nsString& aBottom)=0; - NS_IMETHOD SetBottom(const nsString& aBottom)=0; + NS_IMETHOD GetBottom(nsAWritableString& aBottom)=0; + NS_IMETHOD SetBottom(const nsAReadableString& aBottom)=0; - NS_IMETHOD GetCaptionSide(nsString& aCaptionSide)=0; - NS_IMETHOD SetCaptionSide(const nsString& aCaptionSide)=0; + NS_IMETHOD GetCaptionSide(nsAWritableString& aCaptionSide)=0; + NS_IMETHOD SetCaptionSide(const nsAReadableString& aCaptionSide)=0; - NS_IMETHOD GetClear(nsString& aClear)=0; - NS_IMETHOD SetClear(const nsString& aClear)=0; + NS_IMETHOD GetClear(nsAWritableString& aClear)=0; + NS_IMETHOD SetClear(const nsAReadableString& aClear)=0; - NS_IMETHOD GetClip(nsString& aClip)=0; - NS_IMETHOD SetClip(const nsString& aClip)=0; + NS_IMETHOD GetClip(nsAWritableString& aClip)=0; + NS_IMETHOD SetClip(const nsAReadableString& aClip)=0; - NS_IMETHOD GetColor(nsString& aColor)=0; - NS_IMETHOD SetColor(const nsString& aColor)=0; + NS_IMETHOD GetColor(nsAWritableString& aColor)=0; + NS_IMETHOD SetColor(const nsAReadableString& aColor)=0; - NS_IMETHOD GetContent(nsString& aContent)=0; - NS_IMETHOD SetContent(const nsString& aContent)=0; + NS_IMETHOD GetContent(nsAWritableString& aContent)=0; + NS_IMETHOD SetContent(const nsAReadableString& aContent)=0; - NS_IMETHOD GetCounterIncrement(nsString& aCounterIncrement)=0; - NS_IMETHOD SetCounterIncrement(const nsString& aCounterIncrement)=0; + NS_IMETHOD GetCounterIncrement(nsAWritableString& aCounterIncrement)=0; + NS_IMETHOD SetCounterIncrement(const nsAReadableString& aCounterIncrement)=0; - NS_IMETHOD GetCounterReset(nsString& aCounterReset)=0; - NS_IMETHOD SetCounterReset(const nsString& aCounterReset)=0; + NS_IMETHOD GetCounterReset(nsAWritableString& aCounterReset)=0; + NS_IMETHOD SetCounterReset(const nsAReadableString& aCounterReset)=0; - NS_IMETHOD GetCue(nsString& aCue)=0; - NS_IMETHOD SetCue(const nsString& aCue)=0; + NS_IMETHOD GetCue(nsAWritableString& aCue)=0; + NS_IMETHOD SetCue(const nsAReadableString& aCue)=0; - NS_IMETHOD GetCueAfter(nsString& aCueAfter)=0; - NS_IMETHOD SetCueAfter(const nsString& aCueAfter)=0; + NS_IMETHOD GetCueAfter(nsAWritableString& aCueAfter)=0; + NS_IMETHOD SetCueAfter(const nsAReadableString& aCueAfter)=0; - NS_IMETHOD GetCueBefore(nsString& aCueBefore)=0; - NS_IMETHOD SetCueBefore(const nsString& aCueBefore)=0; + NS_IMETHOD GetCueBefore(nsAWritableString& aCueBefore)=0; + NS_IMETHOD SetCueBefore(const nsAReadableString& aCueBefore)=0; - NS_IMETHOD GetCursor(nsString& aCursor)=0; - NS_IMETHOD SetCursor(const nsString& aCursor)=0; + NS_IMETHOD GetCursor(nsAWritableString& aCursor)=0; + NS_IMETHOD SetCursor(const nsAReadableString& aCursor)=0; - NS_IMETHOD GetDirection(nsString& aDirection)=0; - NS_IMETHOD SetDirection(const nsString& aDirection)=0; + NS_IMETHOD GetDirection(nsAWritableString& aDirection)=0; + NS_IMETHOD SetDirection(const nsAReadableString& aDirection)=0; - NS_IMETHOD GetDisplay(nsString& aDisplay)=0; - NS_IMETHOD SetDisplay(const nsString& aDisplay)=0; + NS_IMETHOD GetDisplay(nsAWritableString& aDisplay)=0; + NS_IMETHOD SetDisplay(const nsAReadableString& aDisplay)=0; - NS_IMETHOD GetElevation(nsString& aElevation)=0; - NS_IMETHOD SetElevation(const nsString& aElevation)=0; + NS_IMETHOD GetElevation(nsAWritableString& aElevation)=0; + NS_IMETHOD SetElevation(const nsAReadableString& aElevation)=0; - NS_IMETHOD GetEmptyCells(nsString& aEmptyCells)=0; - NS_IMETHOD SetEmptyCells(const nsString& aEmptyCells)=0; + NS_IMETHOD GetEmptyCells(nsAWritableString& aEmptyCells)=0; + NS_IMETHOD SetEmptyCells(const nsAReadableString& aEmptyCells)=0; - NS_IMETHOD GetCssFloat(nsString& aCssFloat)=0; - NS_IMETHOD SetCssFloat(const nsString& aCssFloat)=0; + NS_IMETHOD GetCssFloat(nsAWritableString& aCssFloat)=0; + NS_IMETHOD SetCssFloat(const nsAReadableString& aCssFloat)=0; - NS_IMETHOD GetFont(nsString& aFont)=0; - NS_IMETHOD SetFont(const nsString& aFont)=0; + NS_IMETHOD GetFont(nsAWritableString& aFont)=0; + NS_IMETHOD SetFont(const nsAReadableString& aFont)=0; - NS_IMETHOD GetFontFamily(nsString& aFontFamily)=0; - NS_IMETHOD SetFontFamily(const nsString& aFontFamily)=0; + NS_IMETHOD GetFontFamily(nsAWritableString& aFontFamily)=0; + NS_IMETHOD SetFontFamily(const nsAReadableString& aFontFamily)=0; - NS_IMETHOD GetFontSize(nsString& aFontSize)=0; - NS_IMETHOD SetFontSize(const nsString& aFontSize)=0; + NS_IMETHOD GetFontSize(nsAWritableString& aFontSize)=0; + NS_IMETHOD SetFontSize(const nsAReadableString& aFontSize)=0; - NS_IMETHOD GetFontSizeAdjust(nsString& aFontSizeAdjust)=0; - NS_IMETHOD SetFontSizeAdjust(const nsString& aFontSizeAdjust)=0; + NS_IMETHOD GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust)=0; + NS_IMETHOD SetFontSizeAdjust(const nsAReadableString& aFontSizeAdjust)=0; - NS_IMETHOD GetFontStretch(nsString& aFontStretch)=0; - NS_IMETHOD SetFontStretch(const nsString& aFontStretch)=0; + NS_IMETHOD GetFontStretch(nsAWritableString& aFontStretch)=0; + NS_IMETHOD SetFontStretch(const nsAReadableString& aFontStretch)=0; - NS_IMETHOD GetFontStyle(nsString& aFontStyle)=0; - NS_IMETHOD SetFontStyle(const nsString& aFontStyle)=0; + NS_IMETHOD GetFontStyle(nsAWritableString& aFontStyle)=0; + NS_IMETHOD SetFontStyle(const nsAReadableString& aFontStyle)=0; - NS_IMETHOD GetFontVariant(nsString& aFontVariant)=0; - NS_IMETHOD SetFontVariant(const nsString& aFontVariant)=0; + NS_IMETHOD GetFontVariant(nsAWritableString& aFontVariant)=0; + NS_IMETHOD SetFontVariant(const nsAReadableString& aFontVariant)=0; - NS_IMETHOD GetFontWeight(nsString& aFontWeight)=0; - NS_IMETHOD SetFontWeight(const nsString& aFontWeight)=0; + NS_IMETHOD GetFontWeight(nsAWritableString& aFontWeight)=0; + NS_IMETHOD SetFontWeight(const nsAReadableString& aFontWeight)=0; - NS_IMETHOD GetHeight(nsString& aHeight)=0; - NS_IMETHOD SetHeight(const nsString& aHeight)=0; + NS_IMETHOD GetHeight(nsAWritableString& aHeight)=0; + NS_IMETHOD SetHeight(const nsAReadableString& aHeight)=0; - NS_IMETHOD GetLeft(nsString& aLeft)=0; - NS_IMETHOD SetLeft(const nsString& aLeft)=0; + NS_IMETHOD GetLeft(nsAWritableString& aLeft)=0; + NS_IMETHOD SetLeft(const nsAReadableString& aLeft)=0; - NS_IMETHOD GetLetterSpacing(nsString& aLetterSpacing)=0; - NS_IMETHOD SetLetterSpacing(const nsString& aLetterSpacing)=0; + NS_IMETHOD GetLetterSpacing(nsAWritableString& aLetterSpacing)=0; + NS_IMETHOD SetLetterSpacing(const nsAReadableString& aLetterSpacing)=0; - NS_IMETHOD GetLineHeight(nsString& aLineHeight)=0; - NS_IMETHOD SetLineHeight(const nsString& aLineHeight)=0; + NS_IMETHOD GetLineHeight(nsAWritableString& aLineHeight)=0; + NS_IMETHOD SetLineHeight(const nsAReadableString& aLineHeight)=0; - NS_IMETHOD GetListStyle(nsString& aListStyle)=0; - NS_IMETHOD SetListStyle(const nsString& aListStyle)=0; + NS_IMETHOD GetListStyle(nsAWritableString& aListStyle)=0; + NS_IMETHOD SetListStyle(const nsAReadableString& aListStyle)=0; - NS_IMETHOD GetListStyleImage(nsString& aListStyleImage)=0; - NS_IMETHOD SetListStyleImage(const nsString& aListStyleImage)=0; + NS_IMETHOD GetListStyleImage(nsAWritableString& aListStyleImage)=0; + NS_IMETHOD SetListStyleImage(const nsAReadableString& aListStyleImage)=0; - NS_IMETHOD GetListStylePosition(nsString& aListStylePosition)=0; - NS_IMETHOD SetListStylePosition(const nsString& aListStylePosition)=0; + NS_IMETHOD GetListStylePosition(nsAWritableString& aListStylePosition)=0; + NS_IMETHOD SetListStylePosition(const nsAReadableString& aListStylePosition)=0; - NS_IMETHOD GetListStyleType(nsString& aListStyleType)=0; - NS_IMETHOD SetListStyleType(const nsString& aListStyleType)=0; + NS_IMETHOD GetListStyleType(nsAWritableString& aListStyleType)=0; + NS_IMETHOD SetListStyleType(const nsAReadableString& aListStyleType)=0; - NS_IMETHOD GetMargin(nsString& aMargin)=0; - NS_IMETHOD SetMargin(const nsString& aMargin)=0; + NS_IMETHOD GetMargin(nsAWritableString& aMargin)=0; + NS_IMETHOD SetMargin(const nsAReadableString& aMargin)=0; - NS_IMETHOD GetMarginTop(nsString& aMarginTop)=0; - NS_IMETHOD SetMarginTop(const nsString& aMarginTop)=0; + NS_IMETHOD GetMarginTop(nsAWritableString& aMarginTop)=0; + NS_IMETHOD SetMarginTop(const nsAReadableString& aMarginTop)=0; - NS_IMETHOD GetMarginRight(nsString& aMarginRight)=0; - NS_IMETHOD SetMarginRight(const nsString& aMarginRight)=0; + NS_IMETHOD GetMarginRight(nsAWritableString& aMarginRight)=0; + NS_IMETHOD SetMarginRight(const nsAReadableString& aMarginRight)=0; - NS_IMETHOD GetMarginBottom(nsString& aMarginBottom)=0; - NS_IMETHOD SetMarginBottom(const nsString& aMarginBottom)=0; + NS_IMETHOD GetMarginBottom(nsAWritableString& aMarginBottom)=0; + NS_IMETHOD SetMarginBottom(const nsAReadableString& aMarginBottom)=0; - NS_IMETHOD GetMarginLeft(nsString& aMarginLeft)=0; - NS_IMETHOD SetMarginLeft(const nsString& aMarginLeft)=0; + NS_IMETHOD GetMarginLeft(nsAWritableString& aMarginLeft)=0; + NS_IMETHOD SetMarginLeft(const nsAReadableString& aMarginLeft)=0; - NS_IMETHOD GetMarkerOffset(nsString& aMarkerOffset)=0; - NS_IMETHOD SetMarkerOffset(const nsString& aMarkerOffset)=0; + NS_IMETHOD GetMarkerOffset(nsAWritableString& aMarkerOffset)=0; + NS_IMETHOD SetMarkerOffset(const nsAReadableString& aMarkerOffset)=0; - NS_IMETHOD GetMarks(nsString& aMarks)=0; - NS_IMETHOD SetMarks(const nsString& aMarks)=0; + NS_IMETHOD GetMarks(nsAWritableString& aMarks)=0; + NS_IMETHOD SetMarks(const nsAReadableString& aMarks)=0; - NS_IMETHOD GetMaxHeight(nsString& aMaxHeight)=0; - NS_IMETHOD SetMaxHeight(const nsString& aMaxHeight)=0; + NS_IMETHOD GetMaxHeight(nsAWritableString& aMaxHeight)=0; + NS_IMETHOD SetMaxHeight(const nsAReadableString& aMaxHeight)=0; - NS_IMETHOD GetMaxWidth(nsString& aMaxWidth)=0; - NS_IMETHOD SetMaxWidth(const nsString& aMaxWidth)=0; + NS_IMETHOD GetMaxWidth(nsAWritableString& aMaxWidth)=0; + NS_IMETHOD SetMaxWidth(const nsAReadableString& aMaxWidth)=0; - NS_IMETHOD GetMinHeight(nsString& aMinHeight)=0; - NS_IMETHOD SetMinHeight(const nsString& aMinHeight)=0; + NS_IMETHOD GetMinHeight(nsAWritableString& aMinHeight)=0; + NS_IMETHOD SetMinHeight(const nsAReadableString& aMinHeight)=0; - NS_IMETHOD GetMinWidth(nsString& aMinWidth)=0; - NS_IMETHOD SetMinWidth(const nsString& aMinWidth)=0; + NS_IMETHOD GetMinWidth(nsAWritableString& aMinWidth)=0; + NS_IMETHOD SetMinWidth(const nsAReadableString& aMinWidth)=0; - NS_IMETHOD GetOrphans(nsString& aOrphans)=0; - NS_IMETHOD SetOrphans(const nsString& aOrphans)=0; + NS_IMETHOD GetOrphans(nsAWritableString& aOrphans)=0; + NS_IMETHOD SetOrphans(const nsAReadableString& aOrphans)=0; - NS_IMETHOD GetOutline(nsString& aOutline)=0; - NS_IMETHOD SetOutline(const nsString& aOutline)=0; + NS_IMETHOD GetOutline(nsAWritableString& aOutline)=0; + NS_IMETHOD SetOutline(const nsAReadableString& aOutline)=0; - NS_IMETHOD GetOutlineColor(nsString& aOutlineColor)=0; - NS_IMETHOD SetOutlineColor(const nsString& aOutlineColor)=0; + NS_IMETHOD GetOutlineColor(nsAWritableString& aOutlineColor)=0; + NS_IMETHOD SetOutlineColor(const nsAReadableString& aOutlineColor)=0; - NS_IMETHOD GetOutlineStyle(nsString& aOutlineStyle)=0; - NS_IMETHOD SetOutlineStyle(const nsString& aOutlineStyle)=0; + NS_IMETHOD GetOutlineStyle(nsAWritableString& aOutlineStyle)=0; + NS_IMETHOD SetOutlineStyle(const nsAReadableString& aOutlineStyle)=0; - NS_IMETHOD GetOutlineWidth(nsString& aOutlineWidth)=0; - NS_IMETHOD SetOutlineWidth(const nsString& aOutlineWidth)=0; + NS_IMETHOD GetOutlineWidth(nsAWritableString& aOutlineWidth)=0; + NS_IMETHOD SetOutlineWidth(const nsAReadableString& aOutlineWidth)=0; - NS_IMETHOD GetOverflow(nsString& aOverflow)=0; - NS_IMETHOD SetOverflow(const nsString& aOverflow)=0; + NS_IMETHOD GetOverflow(nsAWritableString& aOverflow)=0; + NS_IMETHOD SetOverflow(const nsAReadableString& aOverflow)=0; - NS_IMETHOD GetPadding(nsString& aPadding)=0; - NS_IMETHOD SetPadding(const nsString& aPadding)=0; + NS_IMETHOD GetPadding(nsAWritableString& aPadding)=0; + NS_IMETHOD SetPadding(const nsAReadableString& aPadding)=0; - NS_IMETHOD GetPaddingTop(nsString& aPaddingTop)=0; - NS_IMETHOD SetPaddingTop(const nsString& aPaddingTop)=0; + NS_IMETHOD GetPaddingTop(nsAWritableString& aPaddingTop)=0; + NS_IMETHOD SetPaddingTop(const nsAReadableString& aPaddingTop)=0; - NS_IMETHOD GetPaddingRight(nsString& aPaddingRight)=0; - NS_IMETHOD SetPaddingRight(const nsString& aPaddingRight)=0; + NS_IMETHOD GetPaddingRight(nsAWritableString& aPaddingRight)=0; + NS_IMETHOD SetPaddingRight(const nsAReadableString& aPaddingRight)=0; - NS_IMETHOD GetPaddingBottom(nsString& aPaddingBottom)=0; - NS_IMETHOD SetPaddingBottom(const nsString& aPaddingBottom)=0; + NS_IMETHOD GetPaddingBottom(nsAWritableString& aPaddingBottom)=0; + NS_IMETHOD SetPaddingBottom(const nsAReadableString& aPaddingBottom)=0; - NS_IMETHOD GetPaddingLeft(nsString& aPaddingLeft)=0; - NS_IMETHOD SetPaddingLeft(const nsString& aPaddingLeft)=0; + NS_IMETHOD GetPaddingLeft(nsAWritableString& aPaddingLeft)=0; + NS_IMETHOD SetPaddingLeft(const nsAReadableString& aPaddingLeft)=0; - NS_IMETHOD GetPage(nsString& aPage)=0; - NS_IMETHOD SetPage(const nsString& aPage)=0; + NS_IMETHOD GetPage(nsAWritableString& aPage)=0; + NS_IMETHOD SetPage(const nsAReadableString& aPage)=0; - NS_IMETHOD GetPageBreakAfter(nsString& aPageBreakAfter)=0; - NS_IMETHOD SetPageBreakAfter(const nsString& aPageBreakAfter)=0; + NS_IMETHOD GetPageBreakAfter(nsAWritableString& aPageBreakAfter)=0; + NS_IMETHOD SetPageBreakAfter(const nsAReadableString& aPageBreakAfter)=0; - NS_IMETHOD GetPageBreakBefore(nsString& aPageBreakBefore)=0; - NS_IMETHOD SetPageBreakBefore(const nsString& aPageBreakBefore)=0; + NS_IMETHOD GetPageBreakBefore(nsAWritableString& aPageBreakBefore)=0; + NS_IMETHOD SetPageBreakBefore(const nsAReadableString& aPageBreakBefore)=0; - NS_IMETHOD GetPageBreakInside(nsString& aPageBreakInside)=0; - NS_IMETHOD SetPageBreakInside(const nsString& aPageBreakInside)=0; + NS_IMETHOD GetPageBreakInside(nsAWritableString& aPageBreakInside)=0; + NS_IMETHOD SetPageBreakInside(const nsAReadableString& aPageBreakInside)=0; - NS_IMETHOD GetPause(nsString& aPause)=0; - NS_IMETHOD SetPause(const nsString& aPause)=0; + NS_IMETHOD GetPause(nsAWritableString& aPause)=0; + NS_IMETHOD SetPause(const nsAReadableString& aPause)=0; - NS_IMETHOD GetPauseAfter(nsString& aPauseAfter)=0; - NS_IMETHOD SetPauseAfter(const nsString& aPauseAfter)=0; + NS_IMETHOD GetPauseAfter(nsAWritableString& aPauseAfter)=0; + NS_IMETHOD SetPauseAfter(const nsAReadableString& aPauseAfter)=0; - NS_IMETHOD GetPauseBefore(nsString& aPauseBefore)=0; - NS_IMETHOD SetPauseBefore(const nsString& aPauseBefore)=0; + NS_IMETHOD GetPauseBefore(nsAWritableString& aPauseBefore)=0; + NS_IMETHOD SetPauseBefore(const nsAReadableString& aPauseBefore)=0; - NS_IMETHOD GetPitch(nsString& aPitch)=0; - NS_IMETHOD SetPitch(const nsString& aPitch)=0; + NS_IMETHOD GetPitch(nsAWritableString& aPitch)=0; + NS_IMETHOD SetPitch(const nsAReadableString& aPitch)=0; - NS_IMETHOD GetPitchRange(nsString& aPitchRange)=0; - NS_IMETHOD SetPitchRange(const nsString& aPitchRange)=0; + NS_IMETHOD GetPitchRange(nsAWritableString& aPitchRange)=0; + NS_IMETHOD SetPitchRange(const nsAReadableString& aPitchRange)=0; - NS_IMETHOD GetPlayDuring(nsString& aPlayDuring)=0; - NS_IMETHOD SetPlayDuring(const nsString& aPlayDuring)=0; + NS_IMETHOD GetPlayDuring(nsAWritableString& aPlayDuring)=0; + NS_IMETHOD SetPlayDuring(const nsAReadableString& aPlayDuring)=0; - NS_IMETHOD GetPosition(nsString& aPosition)=0; - NS_IMETHOD SetPosition(const nsString& aPosition)=0; + NS_IMETHOD GetPosition(nsAWritableString& aPosition)=0; + NS_IMETHOD SetPosition(const nsAReadableString& aPosition)=0; - NS_IMETHOD GetQuotes(nsString& aQuotes)=0; - NS_IMETHOD SetQuotes(const nsString& aQuotes)=0; + NS_IMETHOD GetQuotes(nsAWritableString& aQuotes)=0; + NS_IMETHOD SetQuotes(const nsAReadableString& aQuotes)=0; - NS_IMETHOD GetRichness(nsString& aRichness)=0; - NS_IMETHOD SetRichness(const nsString& aRichness)=0; + NS_IMETHOD GetRichness(nsAWritableString& aRichness)=0; + NS_IMETHOD SetRichness(const nsAReadableString& aRichness)=0; - NS_IMETHOD GetRight(nsString& aRight)=0; - NS_IMETHOD SetRight(const nsString& aRight)=0; + NS_IMETHOD GetRight(nsAWritableString& aRight)=0; + NS_IMETHOD SetRight(const nsAReadableString& aRight)=0; - NS_IMETHOD GetSize(nsString& aSize)=0; - NS_IMETHOD SetSize(const nsString& aSize)=0; + NS_IMETHOD GetSize(nsAWritableString& aSize)=0; + NS_IMETHOD SetSize(const nsAReadableString& aSize)=0; - NS_IMETHOD GetSpeak(nsString& aSpeak)=0; - NS_IMETHOD SetSpeak(const nsString& aSpeak)=0; + NS_IMETHOD GetSpeak(nsAWritableString& aSpeak)=0; + NS_IMETHOD SetSpeak(const nsAReadableString& aSpeak)=0; - NS_IMETHOD GetSpeakHeader(nsString& aSpeakHeader)=0; - NS_IMETHOD SetSpeakHeader(const nsString& aSpeakHeader)=0; + NS_IMETHOD GetSpeakHeader(nsAWritableString& aSpeakHeader)=0; + NS_IMETHOD SetSpeakHeader(const nsAReadableString& aSpeakHeader)=0; - NS_IMETHOD GetSpeakNumeral(nsString& aSpeakNumeral)=0; - NS_IMETHOD SetSpeakNumeral(const nsString& aSpeakNumeral)=0; + NS_IMETHOD GetSpeakNumeral(nsAWritableString& aSpeakNumeral)=0; + NS_IMETHOD SetSpeakNumeral(const nsAReadableString& aSpeakNumeral)=0; - NS_IMETHOD GetSpeakPunctuation(nsString& aSpeakPunctuation)=0; - NS_IMETHOD SetSpeakPunctuation(const nsString& aSpeakPunctuation)=0; + NS_IMETHOD GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation)=0; + NS_IMETHOD SetSpeakPunctuation(const nsAReadableString& aSpeakPunctuation)=0; - NS_IMETHOD GetSpeechRate(nsString& aSpeechRate)=0; - NS_IMETHOD SetSpeechRate(const nsString& aSpeechRate)=0; + NS_IMETHOD GetSpeechRate(nsAWritableString& aSpeechRate)=0; + NS_IMETHOD SetSpeechRate(const nsAReadableString& aSpeechRate)=0; - NS_IMETHOD GetStress(nsString& aStress)=0; - NS_IMETHOD SetStress(const nsString& aStress)=0; + NS_IMETHOD GetStress(nsAWritableString& aStress)=0; + NS_IMETHOD SetStress(const nsAReadableString& aStress)=0; - NS_IMETHOD GetTableLayout(nsString& aTableLayout)=0; - NS_IMETHOD SetTableLayout(const nsString& aTableLayout)=0; + NS_IMETHOD GetTableLayout(nsAWritableString& aTableLayout)=0; + NS_IMETHOD SetTableLayout(const nsAReadableString& aTableLayout)=0; - NS_IMETHOD GetTextAlign(nsString& aTextAlign)=0; - NS_IMETHOD SetTextAlign(const nsString& aTextAlign)=0; + NS_IMETHOD GetTextAlign(nsAWritableString& aTextAlign)=0; + NS_IMETHOD SetTextAlign(const nsAReadableString& aTextAlign)=0; - NS_IMETHOD GetTextDecoration(nsString& aTextDecoration)=0; - NS_IMETHOD SetTextDecoration(const nsString& aTextDecoration)=0; + NS_IMETHOD GetTextDecoration(nsAWritableString& aTextDecoration)=0; + NS_IMETHOD SetTextDecoration(const nsAReadableString& aTextDecoration)=0; - NS_IMETHOD GetTextIndent(nsString& aTextIndent)=0; - NS_IMETHOD SetTextIndent(const nsString& aTextIndent)=0; + NS_IMETHOD GetTextIndent(nsAWritableString& aTextIndent)=0; + NS_IMETHOD SetTextIndent(const nsAReadableString& aTextIndent)=0; - NS_IMETHOD GetTextShadow(nsString& aTextShadow)=0; - NS_IMETHOD SetTextShadow(const nsString& aTextShadow)=0; + NS_IMETHOD GetTextShadow(nsAWritableString& aTextShadow)=0; + NS_IMETHOD SetTextShadow(const nsAReadableString& aTextShadow)=0; - NS_IMETHOD GetTextTransform(nsString& aTextTransform)=0; - NS_IMETHOD SetTextTransform(const nsString& aTextTransform)=0; + NS_IMETHOD GetTextTransform(nsAWritableString& aTextTransform)=0; + NS_IMETHOD SetTextTransform(const nsAReadableString& aTextTransform)=0; - NS_IMETHOD GetTop(nsString& aTop)=0; - NS_IMETHOD SetTop(const nsString& aTop)=0; + NS_IMETHOD GetTop(nsAWritableString& aTop)=0; + NS_IMETHOD SetTop(const nsAReadableString& aTop)=0; - NS_IMETHOD GetUnicodeBidi(nsString& aUnicodeBidi)=0; - NS_IMETHOD SetUnicodeBidi(const nsString& aUnicodeBidi)=0; + NS_IMETHOD GetUnicodeBidi(nsAWritableString& aUnicodeBidi)=0; + NS_IMETHOD SetUnicodeBidi(const nsAReadableString& aUnicodeBidi)=0; - NS_IMETHOD GetVerticalAlign(nsString& aVerticalAlign)=0; - NS_IMETHOD SetVerticalAlign(const nsString& aVerticalAlign)=0; + NS_IMETHOD GetVerticalAlign(nsAWritableString& aVerticalAlign)=0; + NS_IMETHOD SetVerticalAlign(const nsAReadableString& aVerticalAlign)=0; - NS_IMETHOD GetVisibility(nsString& aVisibility)=0; - NS_IMETHOD SetVisibility(const nsString& aVisibility)=0; + NS_IMETHOD GetVisibility(nsAWritableString& aVisibility)=0; + NS_IMETHOD SetVisibility(const nsAReadableString& aVisibility)=0; - NS_IMETHOD GetVoiceFamily(nsString& aVoiceFamily)=0; - NS_IMETHOD SetVoiceFamily(const nsString& aVoiceFamily)=0; + NS_IMETHOD GetVoiceFamily(nsAWritableString& aVoiceFamily)=0; + NS_IMETHOD SetVoiceFamily(const nsAReadableString& aVoiceFamily)=0; - NS_IMETHOD GetVolume(nsString& aVolume)=0; - NS_IMETHOD SetVolume(const nsString& aVolume)=0; + NS_IMETHOD GetVolume(nsAWritableString& aVolume)=0; + NS_IMETHOD SetVolume(const nsAReadableString& aVolume)=0; - NS_IMETHOD GetWhiteSpace(nsString& aWhiteSpace)=0; - NS_IMETHOD SetWhiteSpace(const nsString& aWhiteSpace)=0; + NS_IMETHOD GetWhiteSpace(nsAWritableString& aWhiteSpace)=0; + NS_IMETHOD SetWhiteSpace(const nsAReadableString& aWhiteSpace)=0; - NS_IMETHOD GetWidows(nsString& aWidows)=0; - NS_IMETHOD SetWidows(const nsString& aWidows)=0; + NS_IMETHOD GetWidows(nsAWritableString& aWidows)=0; + NS_IMETHOD SetWidows(const nsAReadableString& aWidows)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; - NS_IMETHOD GetWordSpacing(nsString& aWordSpacing)=0; - NS_IMETHOD SetWordSpacing(const nsString& aWordSpacing)=0; + NS_IMETHOD GetWordSpacing(nsAWritableString& aWordSpacing)=0; + NS_IMETHOD SetWordSpacing(const nsAReadableString& aWordSpacing)=0; - NS_IMETHOD GetZIndex(nsString& aZIndex)=0; - NS_IMETHOD SetZIndex(const nsString& aZIndex)=0; + NS_IMETHOD GetZIndex(nsAWritableString& aZIndex)=0; + NS_IMETHOD SetZIndex(const nsAReadableString& aZIndex)=0; - NS_IMETHOD GetBehavior(nsString& aBehavior)=0; - NS_IMETHOD SetBehavior(const nsString& aBehavior)=0; + NS_IMETHOD GetBehavior(nsAWritableString& aBehavior)=0; + NS_IMETHOD SetBehavior(const nsAReadableString& aBehavior)=0; - NS_IMETHOD GetOpacity(nsString& aOpacity)=0; - NS_IMETHOD SetOpacity(const nsString& aOpacity)=0; + NS_IMETHOD GetOpacity(nsAWritableString& aOpacity)=0; + NS_IMETHOD SetOpacity(const nsAReadableString& aOpacity)=0; }; #define NS_DECL_IDOMCSS2PROPERTIES \ - NS_IMETHOD GetAzimuth(nsString& aAzimuth); \ - NS_IMETHOD SetAzimuth(const nsString& aAzimuth); \ - NS_IMETHOD GetBackground(nsString& aBackground); \ - NS_IMETHOD SetBackground(const nsString& aBackground); \ - NS_IMETHOD GetBackgroundAttachment(nsString& aBackgroundAttachment); \ - NS_IMETHOD SetBackgroundAttachment(const nsString& aBackgroundAttachment); \ - NS_IMETHOD GetBackgroundColor(nsString& aBackgroundColor); \ - NS_IMETHOD SetBackgroundColor(const nsString& aBackgroundColor); \ - NS_IMETHOD GetBackgroundImage(nsString& aBackgroundImage); \ - NS_IMETHOD SetBackgroundImage(const nsString& aBackgroundImage); \ - NS_IMETHOD GetBackgroundPosition(nsString& aBackgroundPosition); \ - NS_IMETHOD SetBackgroundPosition(const nsString& aBackgroundPosition); \ - NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat); \ - NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat); \ - NS_IMETHOD GetBorder(nsString& aBorder); \ - NS_IMETHOD SetBorder(const nsString& aBorder); \ - NS_IMETHOD GetBorderCollapse(nsString& aBorderCollapse); \ - NS_IMETHOD SetBorderCollapse(const nsString& aBorderCollapse); \ - NS_IMETHOD GetBorderColor(nsString& aBorderColor); \ - NS_IMETHOD SetBorderColor(const nsString& aBorderColor); \ - NS_IMETHOD GetBorderSpacing(nsString& aBorderSpacing); \ - NS_IMETHOD SetBorderSpacing(const nsString& aBorderSpacing); \ - NS_IMETHOD GetBorderStyle(nsString& aBorderStyle); \ - NS_IMETHOD SetBorderStyle(const nsString& aBorderStyle); \ - NS_IMETHOD GetBorderTop(nsString& aBorderTop); \ - NS_IMETHOD SetBorderTop(const nsString& aBorderTop); \ - NS_IMETHOD GetBorderRight(nsString& aBorderRight); \ - NS_IMETHOD SetBorderRight(const nsString& aBorderRight); \ - NS_IMETHOD GetBorderBottom(nsString& aBorderBottom); \ - NS_IMETHOD SetBorderBottom(const nsString& aBorderBottom); \ - NS_IMETHOD GetBorderLeft(nsString& aBorderLeft); \ - NS_IMETHOD SetBorderLeft(const nsString& aBorderLeft); \ - NS_IMETHOD GetBorderTopColor(nsString& aBorderTopColor); \ - NS_IMETHOD SetBorderTopColor(const nsString& aBorderTopColor); \ - NS_IMETHOD GetBorderRightColor(nsString& aBorderRightColor); \ - NS_IMETHOD SetBorderRightColor(const nsString& aBorderRightColor); \ - NS_IMETHOD GetBorderBottomColor(nsString& aBorderBottomColor); \ - NS_IMETHOD SetBorderBottomColor(const nsString& aBorderBottomColor); \ - NS_IMETHOD GetBorderLeftColor(nsString& aBorderLeftColor); \ - NS_IMETHOD SetBorderLeftColor(const nsString& aBorderLeftColor); \ - NS_IMETHOD GetBorderTopStyle(nsString& aBorderTopStyle); \ - NS_IMETHOD SetBorderTopStyle(const nsString& aBorderTopStyle); \ - NS_IMETHOD GetBorderRightStyle(nsString& aBorderRightStyle); \ - NS_IMETHOD SetBorderRightStyle(const nsString& aBorderRightStyle); \ - NS_IMETHOD GetBorderBottomStyle(nsString& aBorderBottomStyle); \ - NS_IMETHOD SetBorderBottomStyle(const nsString& aBorderBottomStyle); \ - NS_IMETHOD GetBorderLeftStyle(nsString& aBorderLeftStyle); \ - NS_IMETHOD SetBorderLeftStyle(const nsString& aBorderLeftStyle); \ - NS_IMETHOD GetBorderTopWidth(nsString& aBorderTopWidth); \ - NS_IMETHOD SetBorderTopWidth(const nsString& aBorderTopWidth); \ - NS_IMETHOD GetBorderRightWidth(nsString& aBorderRightWidth); \ - NS_IMETHOD SetBorderRightWidth(const nsString& aBorderRightWidth); \ - NS_IMETHOD GetBorderBottomWidth(nsString& aBorderBottomWidth); \ - NS_IMETHOD SetBorderBottomWidth(const nsString& aBorderBottomWidth); \ - NS_IMETHOD GetBorderLeftWidth(nsString& aBorderLeftWidth); \ - NS_IMETHOD SetBorderLeftWidth(const nsString& aBorderLeftWidth); \ - NS_IMETHOD GetBorderWidth(nsString& aBorderWidth); \ - NS_IMETHOD SetBorderWidth(const nsString& aBorderWidth); \ - NS_IMETHOD GetBottom(nsString& aBottom); \ - NS_IMETHOD SetBottom(const nsString& aBottom); \ - NS_IMETHOD GetCaptionSide(nsString& aCaptionSide); \ - NS_IMETHOD SetCaptionSide(const nsString& aCaptionSide); \ - NS_IMETHOD GetClear(nsString& aClear); \ - NS_IMETHOD SetClear(const nsString& aClear); \ - NS_IMETHOD GetClip(nsString& aClip); \ - NS_IMETHOD SetClip(const nsString& aClip); \ - NS_IMETHOD GetColor(nsString& aColor); \ - NS_IMETHOD SetColor(const nsString& aColor); \ - NS_IMETHOD GetContent(nsString& aContent); \ - NS_IMETHOD SetContent(const nsString& aContent); \ - NS_IMETHOD GetCounterIncrement(nsString& aCounterIncrement); \ - NS_IMETHOD SetCounterIncrement(const nsString& aCounterIncrement); \ - NS_IMETHOD GetCounterReset(nsString& aCounterReset); \ - NS_IMETHOD SetCounterReset(const nsString& aCounterReset); \ - NS_IMETHOD GetCue(nsString& aCue); \ - NS_IMETHOD SetCue(const nsString& aCue); \ - NS_IMETHOD GetCueAfter(nsString& aCueAfter); \ - NS_IMETHOD SetCueAfter(const nsString& aCueAfter); \ - NS_IMETHOD GetCueBefore(nsString& aCueBefore); \ - NS_IMETHOD SetCueBefore(const nsString& aCueBefore); \ - NS_IMETHOD GetCursor(nsString& aCursor); \ - NS_IMETHOD SetCursor(const nsString& aCursor); \ - NS_IMETHOD GetDirection(nsString& aDirection); \ - NS_IMETHOD SetDirection(const nsString& aDirection); \ - NS_IMETHOD GetDisplay(nsString& aDisplay); \ - NS_IMETHOD SetDisplay(const nsString& aDisplay); \ - NS_IMETHOD GetElevation(nsString& aElevation); \ - NS_IMETHOD SetElevation(const nsString& aElevation); \ - NS_IMETHOD GetEmptyCells(nsString& aEmptyCells); \ - NS_IMETHOD SetEmptyCells(const nsString& aEmptyCells); \ - NS_IMETHOD GetCssFloat(nsString& aCssFloat); \ - NS_IMETHOD SetCssFloat(const nsString& aCssFloat); \ - NS_IMETHOD GetFont(nsString& aFont); \ - NS_IMETHOD SetFont(const nsString& aFont); \ - NS_IMETHOD GetFontFamily(nsString& aFontFamily); \ - NS_IMETHOD SetFontFamily(const nsString& aFontFamily); \ - NS_IMETHOD GetFontSize(nsString& aFontSize); \ - NS_IMETHOD SetFontSize(const nsString& aFontSize); \ - NS_IMETHOD GetFontSizeAdjust(nsString& aFontSizeAdjust); \ - NS_IMETHOD SetFontSizeAdjust(const nsString& aFontSizeAdjust); \ - NS_IMETHOD GetFontStretch(nsString& aFontStretch); \ - NS_IMETHOD SetFontStretch(const nsString& aFontStretch); \ - NS_IMETHOD GetFontStyle(nsString& aFontStyle); \ - NS_IMETHOD SetFontStyle(const nsString& aFontStyle); \ - NS_IMETHOD GetFontVariant(nsString& aFontVariant); \ - NS_IMETHOD SetFontVariant(const nsString& aFontVariant); \ - NS_IMETHOD GetFontWeight(nsString& aFontWeight); \ - NS_IMETHOD SetFontWeight(const nsString& aFontWeight); \ - NS_IMETHOD GetHeight(nsString& aHeight); \ - NS_IMETHOD SetHeight(const nsString& aHeight); \ - NS_IMETHOD GetLeft(nsString& aLeft); \ - NS_IMETHOD SetLeft(const nsString& aLeft); \ - NS_IMETHOD GetLetterSpacing(nsString& aLetterSpacing); \ - NS_IMETHOD SetLetterSpacing(const nsString& aLetterSpacing); \ - NS_IMETHOD GetLineHeight(nsString& aLineHeight); \ - NS_IMETHOD SetLineHeight(const nsString& aLineHeight); \ - NS_IMETHOD GetListStyle(nsString& aListStyle); \ - NS_IMETHOD SetListStyle(const nsString& aListStyle); \ - NS_IMETHOD GetListStyleImage(nsString& aListStyleImage); \ - NS_IMETHOD SetListStyleImage(const nsString& aListStyleImage); \ - NS_IMETHOD GetListStylePosition(nsString& aListStylePosition); \ - NS_IMETHOD SetListStylePosition(const nsString& aListStylePosition); \ - NS_IMETHOD GetListStyleType(nsString& aListStyleType); \ - NS_IMETHOD SetListStyleType(const nsString& aListStyleType); \ - NS_IMETHOD GetMargin(nsString& aMargin); \ - NS_IMETHOD SetMargin(const nsString& aMargin); \ - NS_IMETHOD GetMarginTop(nsString& aMarginTop); \ - NS_IMETHOD SetMarginTop(const nsString& aMarginTop); \ - NS_IMETHOD GetMarginRight(nsString& aMarginRight); \ - NS_IMETHOD SetMarginRight(const nsString& aMarginRight); \ - NS_IMETHOD GetMarginBottom(nsString& aMarginBottom); \ - NS_IMETHOD SetMarginBottom(const nsString& aMarginBottom); \ - NS_IMETHOD GetMarginLeft(nsString& aMarginLeft); \ - NS_IMETHOD SetMarginLeft(const nsString& aMarginLeft); \ - NS_IMETHOD GetMarkerOffset(nsString& aMarkerOffset); \ - NS_IMETHOD SetMarkerOffset(const nsString& aMarkerOffset); \ - NS_IMETHOD GetMarks(nsString& aMarks); \ - NS_IMETHOD SetMarks(const nsString& aMarks); \ - NS_IMETHOD GetMaxHeight(nsString& aMaxHeight); \ - NS_IMETHOD SetMaxHeight(const nsString& aMaxHeight); \ - NS_IMETHOD GetMaxWidth(nsString& aMaxWidth); \ - NS_IMETHOD SetMaxWidth(const nsString& aMaxWidth); \ - NS_IMETHOD GetMinHeight(nsString& aMinHeight); \ - NS_IMETHOD SetMinHeight(const nsString& aMinHeight); \ - NS_IMETHOD GetMinWidth(nsString& aMinWidth); \ - NS_IMETHOD SetMinWidth(const nsString& aMinWidth); \ - NS_IMETHOD GetOrphans(nsString& aOrphans); \ - NS_IMETHOD SetOrphans(const nsString& aOrphans); \ - NS_IMETHOD GetOutline(nsString& aOutline); \ - NS_IMETHOD SetOutline(const nsString& aOutline); \ - NS_IMETHOD GetOutlineColor(nsString& aOutlineColor); \ - NS_IMETHOD SetOutlineColor(const nsString& aOutlineColor); \ - NS_IMETHOD GetOutlineStyle(nsString& aOutlineStyle); \ - NS_IMETHOD SetOutlineStyle(const nsString& aOutlineStyle); \ - NS_IMETHOD GetOutlineWidth(nsString& aOutlineWidth); \ - NS_IMETHOD SetOutlineWidth(const nsString& aOutlineWidth); \ - NS_IMETHOD GetOverflow(nsString& aOverflow); \ - NS_IMETHOD SetOverflow(const nsString& aOverflow); \ - NS_IMETHOD GetPadding(nsString& aPadding); \ - NS_IMETHOD SetPadding(const nsString& aPadding); \ - NS_IMETHOD GetPaddingTop(nsString& aPaddingTop); \ - NS_IMETHOD SetPaddingTop(const nsString& aPaddingTop); \ - NS_IMETHOD GetPaddingRight(nsString& aPaddingRight); \ - NS_IMETHOD SetPaddingRight(const nsString& aPaddingRight); \ - NS_IMETHOD GetPaddingBottom(nsString& aPaddingBottom); \ - NS_IMETHOD SetPaddingBottom(const nsString& aPaddingBottom); \ - NS_IMETHOD GetPaddingLeft(nsString& aPaddingLeft); \ - NS_IMETHOD SetPaddingLeft(const nsString& aPaddingLeft); \ - NS_IMETHOD GetPage(nsString& aPage); \ - NS_IMETHOD SetPage(const nsString& aPage); \ - NS_IMETHOD GetPageBreakAfter(nsString& aPageBreakAfter); \ - NS_IMETHOD SetPageBreakAfter(const nsString& aPageBreakAfter); \ - NS_IMETHOD GetPageBreakBefore(nsString& aPageBreakBefore); \ - NS_IMETHOD SetPageBreakBefore(const nsString& aPageBreakBefore); \ - NS_IMETHOD GetPageBreakInside(nsString& aPageBreakInside); \ - NS_IMETHOD SetPageBreakInside(const nsString& aPageBreakInside); \ - NS_IMETHOD GetPause(nsString& aPause); \ - NS_IMETHOD SetPause(const nsString& aPause); \ - NS_IMETHOD GetPauseAfter(nsString& aPauseAfter); \ - NS_IMETHOD SetPauseAfter(const nsString& aPauseAfter); \ - NS_IMETHOD GetPauseBefore(nsString& aPauseBefore); \ - NS_IMETHOD SetPauseBefore(const nsString& aPauseBefore); \ - NS_IMETHOD GetPitch(nsString& aPitch); \ - NS_IMETHOD SetPitch(const nsString& aPitch); \ - NS_IMETHOD GetPitchRange(nsString& aPitchRange); \ - NS_IMETHOD SetPitchRange(const nsString& aPitchRange); \ - NS_IMETHOD GetPlayDuring(nsString& aPlayDuring); \ - NS_IMETHOD SetPlayDuring(const nsString& aPlayDuring); \ - NS_IMETHOD GetPosition(nsString& aPosition); \ - NS_IMETHOD SetPosition(const nsString& aPosition); \ - NS_IMETHOD GetQuotes(nsString& aQuotes); \ - NS_IMETHOD SetQuotes(const nsString& aQuotes); \ - NS_IMETHOD GetRichness(nsString& aRichness); \ - NS_IMETHOD SetRichness(const nsString& aRichness); \ - NS_IMETHOD GetRight(nsString& aRight); \ - NS_IMETHOD SetRight(const nsString& aRight); \ - NS_IMETHOD GetSize(nsString& aSize); \ - NS_IMETHOD SetSize(const nsString& aSize); \ - NS_IMETHOD GetSpeak(nsString& aSpeak); \ - NS_IMETHOD SetSpeak(const nsString& aSpeak); \ - NS_IMETHOD GetSpeakHeader(nsString& aSpeakHeader); \ - NS_IMETHOD SetSpeakHeader(const nsString& aSpeakHeader); \ - NS_IMETHOD GetSpeakNumeral(nsString& aSpeakNumeral); \ - NS_IMETHOD SetSpeakNumeral(const nsString& aSpeakNumeral); \ - NS_IMETHOD GetSpeakPunctuation(nsString& aSpeakPunctuation); \ - NS_IMETHOD SetSpeakPunctuation(const nsString& aSpeakPunctuation); \ - NS_IMETHOD GetSpeechRate(nsString& aSpeechRate); \ - NS_IMETHOD SetSpeechRate(const nsString& aSpeechRate); \ - NS_IMETHOD GetStress(nsString& aStress); \ - NS_IMETHOD SetStress(const nsString& aStress); \ - NS_IMETHOD GetTableLayout(nsString& aTableLayout); \ - NS_IMETHOD SetTableLayout(const nsString& aTableLayout); \ - NS_IMETHOD GetTextAlign(nsString& aTextAlign); \ - NS_IMETHOD SetTextAlign(const nsString& aTextAlign); \ - NS_IMETHOD GetTextDecoration(nsString& aTextDecoration); \ - NS_IMETHOD SetTextDecoration(const nsString& aTextDecoration); \ - NS_IMETHOD GetTextIndent(nsString& aTextIndent); \ - NS_IMETHOD SetTextIndent(const nsString& aTextIndent); \ - NS_IMETHOD GetTextShadow(nsString& aTextShadow); \ - NS_IMETHOD SetTextShadow(const nsString& aTextShadow); \ - NS_IMETHOD GetTextTransform(nsString& aTextTransform); \ - NS_IMETHOD SetTextTransform(const nsString& aTextTransform); \ - NS_IMETHOD GetTop(nsString& aTop); \ - NS_IMETHOD SetTop(const nsString& aTop); \ - NS_IMETHOD GetUnicodeBidi(nsString& aUnicodeBidi); \ - NS_IMETHOD SetUnicodeBidi(const nsString& aUnicodeBidi); \ - NS_IMETHOD GetVerticalAlign(nsString& aVerticalAlign); \ - NS_IMETHOD SetVerticalAlign(const nsString& aVerticalAlign); \ - NS_IMETHOD GetVisibility(nsString& aVisibility); \ - NS_IMETHOD SetVisibility(const nsString& aVisibility); \ - NS_IMETHOD GetVoiceFamily(nsString& aVoiceFamily); \ - NS_IMETHOD SetVoiceFamily(const nsString& aVoiceFamily); \ - NS_IMETHOD GetVolume(nsString& aVolume); \ - NS_IMETHOD SetVolume(const nsString& aVolume); \ - NS_IMETHOD GetWhiteSpace(nsString& aWhiteSpace); \ - NS_IMETHOD SetWhiteSpace(const nsString& aWhiteSpace); \ - NS_IMETHOD GetWidows(nsString& aWidows); \ - NS_IMETHOD SetWidows(const nsString& aWidows); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ - NS_IMETHOD GetWordSpacing(nsString& aWordSpacing); \ - NS_IMETHOD SetWordSpacing(const nsString& aWordSpacing); \ - NS_IMETHOD GetZIndex(nsString& aZIndex); \ - NS_IMETHOD SetZIndex(const nsString& aZIndex); \ - NS_IMETHOD GetBehavior(nsString& aBehavior); \ - NS_IMETHOD SetBehavior(const nsString& aBehavior); \ - NS_IMETHOD GetOpacity(nsString& aOpacity); \ - NS_IMETHOD SetOpacity(const nsString& aOpacity); \ + NS_IMETHOD GetAzimuth(nsAWritableString& aAzimuth); \ + NS_IMETHOD SetAzimuth(const nsAReadableString& aAzimuth); \ + NS_IMETHOD GetBackground(nsAWritableString& aBackground); \ + NS_IMETHOD SetBackground(const nsAReadableString& aBackground); \ + NS_IMETHOD GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment); \ + NS_IMETHOD SetBackgroundAttachment(const nsAReadableString& aBackgroundAttachment); \ + NS_IMETHOD GetBackgroundColor(nsAWritableString& aBackgroundColor); \ + NS_IMETHOD SetBackgroundColor(const nsAReadableString& aBackgroundColor); \ + NS_IMETHOD GetBackgroundImage(nsAWritableString& aBackgroundImage); \ + NS_IMETHOD SetBackgroundImage(const nsAReadableString& aBackgroundImage); \ + NS_IMETHOD GetBackgroundPosition(nsAWritableString& aBackgroundPosition); \ + NS_IMETHOD SetBackgroundPosition(const nsAReadableString& aBackgroundPosition); \ + NS_IMETHOD GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat); \ + NS_IMETHOD SetBackgroundRepeat(const nsAReadableString& aBackgroundRepeat); \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder); \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder); \ + NS_IMETHOD GetBorderCollapse(nsAWritableString& aBorderCollapse); \ + NS_IMETHOD SetBorderCollapse(const nsAReadableString& aBorderCollapse); \ + NS_IMETHOD GetBorderColor(nsAWritableString& aBorderColor); \ + NS_IMETHOD SetBorderColor(const nsAReadableString& aBorderColor); \ + NS_IMETHOD GetBorderSpacing(nsAWritableString& aBorderSpacing); \ + NS_IMETHOD SetBorderSpacing(const nsAReadableString& aBorderSpacing); \ + NS_IMETHOD GetBorderStyle(nsAWritableString& aBorderStyle); \ + NS_IMETHOD SetBorderStyle(const nsAReadableString& aBorderStyle); \ + NS_IMETHOD GetBorderTop(nsAWritableString& aBorderTop); \ + NS_IMETHOD SetBorderTop(const nsAReadableString& aBorderTop); \ + NS_IMETHOD GetBorderRight(nsAWritableString& aBorderRight); \ + NS_IMETHOD SetBorderRight(const nsAReadableString& aBorderRight); \ + NS_IMETHOD GetBorderBottom(nsAWritableString& aBorderBottom); \ + NS_IMETHOD SetBorderBottom(const nsAReadableString& aBorderBottom); \ + NS_IMETHOD GetBorderLeft(nsAWritableString& aBorderLeft); \ + NS_IMETHOD SetBorderLeft(const nsAReadableString& aBorderLeft); \ + NS_IMETHOD GetBorderTopColor(nsAWritableString& aBorderTopColor); \ + NS_IMETHOD SetBorderTopColor(const nsAReadableString& aBorderTopColor); \ + NS_IMETHOD GetBorderRightColor(nsAWritableString& aBorderRightColor); \ + NS_IMETHOD SetBorderRightColor(const nsAReadableString& aBorderRightColor); \ + NS_IMETHOD GetBorderBottomColor(nsAWritableString& aBorderBottomColor); \ + NS_IMETHOD SetBorderBottomColor(const nsAReadableString& aBorderBottomColor); \ + NS_IMETHOD GetBorderLeftColor(nsAWritableString& aBorderLeftColor); \ + NS_IMETHOD SetBorderLeftColor(const nsAReadableString& aBorderLeftColor); \ + NS_IMETHOD GetBorderTopStyle(nsAWritableString& aBorderTopStyle); \ + NS_IMETHOD SetBorderTopStyle(const nsAReadableString& aBorderTopStyle); \ + NS_IMETHOD GetBorderRightStyle(nsAWritableString& aBorderRightStyle); \ + NS_IMETHOD SetBorderRightStyle(const nsAReadableString& aBorderRightStyle); \ + NS_IMETHOD GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle); \ + NS_IMETHOD SetBorderBottomStyle(const nsAReadableString& aBorderBottomStyle); \ + NS_IMETHOD GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle); \ + NS_IMETHOD SetBorderLeftStyle(const nsAReadableString& aBorderLeftStyle); \ + NS_IMETHOD GetBorderTopWidth(nsAWritableString& aBorderTopWidth); \ + NS_IMETHOD SetBorderTopWidth(const nsAReadableString& aBorderTopWidth); \ + NS_IMETHOD GetBorderRightWidth(nsAWritableString& aBorderRightWidth); \ + NS_IMETHOD SetBorderRightWidth(const nsAReadableString& aBorderRightWidth); \ + NS_IMETHOD GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth); \ + NS_IMETHOD SetBorderBottomWidth(const nsAReadableString& aBorderBottomWidth); \ + NS_IMETHOD GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth); \ + NS_IMETHOD SetBorderLeftWidth(const nsAReadableString& aBorderLeftWidth); \ + NS_IMETHOD GetBorderWidth(nsAWritableString& aBorderWidth); \ + NS_IMETHOD SetBorderWidth(const nsAReadableString& aBorderWidth); \ + NS_IMETHOD GetBottom(nsAWritableString& aBottom); \ + NS_IMETHOD SetBottom(const nsAReadableString& aBottom); \ + NS_IMETHOD GetCaptionSide(nsAWritableString& aCaptionSide); \ + NS_IMETHOD SetCaptionSide(const nsAReadableString& aCaptionSide); \ + NS_IMETHOD GetClear(nsAWritableString& aClear); \ + NS_IMETHOD SetClear(const nsAReadableString& aClear); \ + NS_IMETHOD GetClip(nsAWritableString& aClip); \ + NS_IMETHOD SetClip(const nsAReadableString& aClip); \ + NS_IMETHOD GetColor(nsAWritableString& aColor); \ + NS_IMETHOD SetColor(const nsAReadableString& aColor); \ + NS_IMETHOD GetContent(nsAWritableString& aContent); \ + NS_IMETHOD SetContent(const nsAReadableString& aContent); \ + NS_IMETHOD GetCounterIncrement(nsAWritableString& aCounterIncrement); \ + NS_IMETHOD SetCounterIncrement(const nsAReadableString& aCounterIncrement); \ + NS_IMETHOD GetCounterReset(nsAWritableString& aCounterReset); \ + NS_IMETHOD SetCounterReset(const nsAReadableString& aCounterReset); \ + NS_IMETHOD GetCue(nsAWritableString& aCue); \ + NS_IMETHOD SetCue(const nsAReadableString& aCue); \ + NS_IMETHOD GetCueAfter(nsAWritableString& aCueAfter); \ + NS_IMETHOD SetCueAfter(const nsAReadableString& aCueAfter); \ + NS_IMETHOD GetCueBefore(nsAWritableString& aCueBefore); \ + NS_IMETHOD SetCueBefore(const nsAReadableString& aCueBefore); \ + NS_IMETHOD GetCursor(nsAWritableString& aCursor); \ + NS_IMETHOD SetCursor(const nsAReadableString& aCursor); \ + NS_IMETHOD GetDirection(nsAWritableString& aDirection); \ + NS_IMETHOD SetDirection(const nsAReadableString& aDirection); \ + NS_IMETHOD GetDisplay(nsAWritableString& aDisplay); \ + NS_IMETHOD SetDisplay(const nsAReadableString& aDisplay); \ + NS_IMETHOD GetElevation(nsAWritableString& aElevation); \ + NS_IMETHOD SetElevation(const nsAReadableString& aElevation); \ + NS_IMETHOD GetEmptyCells(nsAWritableString& aEmptyCells); \ + NS_IMETHOD SetEmptyCells(const nsAReadableString& aEmptyCells); \ + NS_IMETHOD GetCssFloat(nsAWritableString& aCssFloat); \ + NS_IMETHOD SetCssFloat(const nsAReadableString& aCssFloat); \ + NS_IMETHOD GetFont(nsAWritableString& aFont); \ + NS_IMETHOD SetFont(const nsAReadableString& aFont); \ + NS_IMETHOD GetFontFamily(nsAWritableString& aFontFamily); \ + NS_IMETHOD SetFontFamily(const nsAReadableString& aFontFamily); \ + NS_IMETHOD GetFontSize(nsAWritableString& aFontSize); \ + NS_IMETHOD SetFontSize(const nsAReadableString& aFontSize); \ + NS_IMETHOD GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust); \ + NS_IMETHOD SetFontSizeAdjust(const nsAReadableString& aFontSizeAdjust); \ + NS_IMETHOD GetFontStretch(nsAWritableString& aFontStretch); \ + NS_IMETHOD SetFontStretch(const nsAReadableString& aFontStretch); \ + NS_IMETHOD GetFontStyle(nsAWritableString& aFontStyle); \ + NS_IMETHOD SetFontStyle(const nsAReadableString& aFontStyle); \ + NS_IMETHOD GetFontVariant(nsAWritableString& aFontVariant); \ + NS_IMETHOD SetFontVariant(const nsAReadableString& aFontVariant); \ + NS_IMETHOD GetFontWeight(nsAWritableString& aFontWeight); \ + NS_IMETHOD SetFontWeight(const nsAReadableString& aFontWeight); \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight); \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight); \ + NS_IMETHOD GetLeft(nsAWritableString& aLeft); \ + NS_IMETHOD SetLeft(const nsAReadableString& aLeft); \ + NS_IMETHOD GetLetterSpacing(nsAWritableString& aLetterSpacing); \ + NS_IMETHOD SetLetterSpacing(const nsAReadableString& aLetterSpacing); \ + NS_IMETHOD GetLineHeight(nsAWritableString& aLineHeight); \ + NS_IMETHOD SetLineHeight(const nsAReadableString& aLineHeight); \ + NS_IMETHOD GetListStyle(nsAWritableString& aListStyle); \ + NS_IMETHOD SetListStyle(const nsAReadableString& aListStyle); \ + NS_IMETHOD GetListStyleImage(nsAWritableString& aListStyleImage); \ + NS_IMETHOD SetListStyleImage(const nsAReadableString& aListStyleImage); \ + NS_IMETHOD GetListStylePosition(nsAWritableString& aListStylePosition); \ + NS_IMETHOD SetListStylePosition(const nsAReadableString& aListStylePosition); \ + NS_IMETHOD GetListStyleType(nsAWritableString& aListStyleType); \ + NS_IMETHOD SetListStyleType(const nsAReadableString& aListStyleType); \ + NS_IMETHOD GetMargin(nsAWritableString& aMargin); \ + NS_IMETHOD SetMargin(const nsAReadableString& aMargin); \ + NS_IMETHOD GetMarginTop(nsAWritableString& aMarginTop); \ + NS_IMETHOD SetMarginTop(const nsAReadableString& aMarginTop); \ + NS_IMETHOD GetMarginRight(nsAWritableString& aMarginRight); \ + NS_IMETHOD SetMarginRight(const nsAReadableString& aMarginRight); \ + NS_IMETHOD GetMarginBottom(nsAWritableString& aMarginBottom); \ + NS_IMETHOD SetMarginBottom(const nsAReadableString& aMarginBottom); \ + NS_IMETHOD GetMarginLeft(nsAWritableString& aMarginLeft); \ + NS_IMETHOD SetMarginLeft(const nsAReadableString& aMarginLeft); \ + NS_IMETHOD GetMarkerOffset(nsAWritableString& aMarkerOffset); \ + NS_IMETHOD SetMarkerOffset(const nsAReadableString& aMarkerOffset); \ + NS_IMETHOD GetMarks(nsAWritableString& aMarks); \ + NS_IMETHOD SetMarks(const nsAReadableString& aMarks); \ + NS_IMETHOD GetMaxHeight(nsAWritableString& aMaxHeight); \ + NS_IMETHOD SetMaxHeight(const nsAReadableString& aMaxHeight); \ + NS_IMETHOD GetMaxWidth(nsAWritableString& aMaxWidth); \ + NS_IMETHOD SetMaxWidth(const nsAReadableString& aMaxWidth); \ + NS_IMETHOD GetMinHeight(nsAWritableString& aMinHeight); \ + NS_IMETHOD SetMinHeight(const nsAReadableString& aMinHeight); \ + NS_IMETHOD GetMinWidth(nsAWritableString& aMinWidth); \ + NS_IMETHOD SetMinWidth(const nsAReadableString& aMinWidth); \ + NS_IMETHOD GetOrphans(nsAWritableString& aOrphans); \ + NS_IMETHOD SetOrphans(const nsAReadableString& aOrphans); \ + NS_IMETHOD GetOutline(nsAWritableString& aOutline); \ + NS_IMETHOD SetOutline(const nsAReadableString& aOutline); \ + NS_IMETHOD GetOutlineColor(nsAWritableString& aOutlineColor); \ + NS_IMETHOD SetOutlineColor(const nsAReadableString& aOutlineColor); \ + NS_IMETHOD GetOutlineStyle(nsAWritableString& aOutlineStyle); \ + NS_IMETHOD SetOutlineStyle(const nsAReadableString& aOutlineStyle); \ + NS_IMETHOD GetOutlineWidth(nsAWritableString& aOutlineWidth); \ + NS_IMETHOD SetOutlineWidth(const nsAReadableString& aOutlineWidth); \ + NS_IMETHOD GetOverflow(nsAWritableString& aOverflow); \ + NS_IMETHOD SetOverflow(const nsAReadableString& aOverflow); \ + NS_IMETHOD GetPadding(nsAWritableString& aPadding); \ + NS_IMETHOD SetPadding(const nsAReadableString& aPadding); \ + NS_IMETHOD GetPaddingTop(nsAWritableString& aPaddingTop); \ + NS_IMETHOD SetPaddingTop(const nsAReadableString& aPaddingTop); \ + NS_IMETHOD GetPaddingRight(nsAWritableString& aPaddingRight); \ + NS_IMETHOD SetPaddingRight(const nsAReadableString& aPaddingRight); \ + NS_IMETHOD GetPaddingBottom(nsAWritableString& aPaddingBottom); \ + NS_IMETHOD SetPaddingBottom(const nsAReadableString& aPaddingBottom); \ + NS_IMETHOD GetPaddingLeft(nsAWritableString& aPaddingLeft); \ + NS_IMETHOD SetPaddingLeft(const nsAReadableString& aPaddingLeft); \ + NS_IMETHOD GetPage(nsAWritableString& aPage); \ + NS_IMETHOD SetPage(const nsAReadableString& aPage); \ + NS_IMETHOD GetPageBreakAfter(nsAWritableString& aPageBreakAfter); \ + NS_IMETHOD SetPageBreakAfter(const nsAReadableString& aPageBreakAfter); \ + NS_IMETHOD GetPageBreakBefore(nsAWritableString& aPageBreakBefore); \ + NS_IMETHOD SetPageBreakBefore(const nsAReadableString& aPageBreakBefore); \ + NS_IMETHOD GetPageBreakInside(nsAWritableString& aPageBreakInside); \ + NS_IMETHOD SetPageBreakInside(const nsAReadableString& aPageBreakInside); \ + NS_IMETHOD GetPause(nsAWritableString& aPause); \ + NS_IMETHOD SetPause(const nsAReadableString& aPause); \ + NS_IMETHOD GetPauseAfter(nsAWritableString& aPauseAfter); \ + NS_IMETHOD SetPauseAfter(const nsAReadableString& aPauseAfter); \ + NS_IMETHOD GetPauseBefore(nsAWritableString& aPauseBefore); \ + NS_IMETHOD SetPauseBefore(const nsAReadableString& aPauseBefore); \ + NS_IMETHOD GetPitch(nsAWritableString& aPitch); \ + NS_IMETHOD SetPitch(const nsAReadableString& aPitch); \ + NS_IMETHOD GetPitchRange(nsAWritableString& aPitchRange); \ + NS_IMETHOD SetPitchRange(const nsAReadableString& aPitchRange); \ + NS_IMETHOD GetPlayDuring(nsAWritableString& aPlayDuring); \ + NS_IMETHOD SetPlayDuring(const nsAReadableString& aPlayDuring); \ + NS_IMETHOD GetPosition(nsAWritableString& aPosition); \ + NS_IMETHOD SetPosition(const nsAReadableString& aPosition); \ + NS_IMETHOD GetQuotes(nsAWritableString& aQuotes); \ + NS_IMETHOD SetQuotes(const nsAReadableString& aQuotes); \ + NS_IMETHOD GetRichness(nsAWritableString& aRichness); \ + NS_IMETHOD SetRichness(const nsAReadableString& aRichness); \ + NS_IMETHOD GetRight(nsAWritableString& aRight); \ + NS_IMETHOD SetRight(const nsAReadableString& aRight); \ + NS_IMETHOD GetSize(nsAWritableString& aSize); \ + NS_IMETHOD SetSize(const nsAReadableString& aSize); \ + NS_IMETHOD GetSpeak(nsAWritableString& aSpeak); \ + NS_IMETHOD SetSpeak(const nsAReadableString& aSpeak); \ + NS_IMETHOD GetSpeakHeader(nsAWritableString& aSpeakHeader); \ + NS_IMETHOD SetSpeakHeader(const nsAReadableString& aSpeakHeader); \ + NS_IMETHOD GetSpeakNumeral(nsAWritableString& aSpeakNumeral); \ + NS_IMETHOD SetSpeakNumeral(const nsAReadableString& aSpeakNumeral); \ + NS_IMETHOD GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation); \ + NS_IMETHOD SetSpeakPunctuation(const nsAReadableString& aSpeakPunctuation); \ + NS_IMETHOD GetSpeechRate(nsAWritableString& aSpeechRate); \ + NS_IMETHOD SetSpeechRate(const nsAReadableString& aSpeechRate); \ + NS_IMETHOD GetStress(nsAWritableString& aStress); \ + NS_IMETHOD SetStress(const nsAReadableString& aStress); \ + NS_IMETHOD GetTableLayout(nsAWritableString& aTableLayout); \ + NS_IMETHOD SetTableLayout(const nsAReadableString& aTableLayout); \ + NS_IMETHOD GetTextAlign(nsAWritableString& aTextAlign); \ + NS_IMETHOD SetTextAlign(const nsAReadableString& aTextAlign); \ + NS_IMETHOD GetTextDecoration(nsAWritableString& aTextDecoration); \ + NS_IMETHOD SetTextDecoration(const nsAReadableString& aTextDecoration); \ + NS_IMETHOD GetTextIndent(nsAWritableString& aTextIndent); \ + NS_IMETHOD SetTextIndent(const nsAReadableString& aTextIndent); \ + NS_IMETHOD GetTextShadow(nsAWritableString& aTextShadow); \ + NS_IMETHOD SetTextShadow(const nsAReadableString& aTextShadow); \ + NS_IMETHOD GetTextTransform(nsAWritableString& aTextTransform); \ + NS_IMETHOD SetTextTransform(const nsAReadableString& aTextTransform); \ + NS_IMETHOD GetTop(nsAWritableString& aTop); \ + NS_IMETHOD SetTop(const nsAReadableString& aTop); \ + NS_IMETHOD GetUnicodeBidi(nsAWritableString& aUnicodeBidi); \ + NS_IMETHOD SetUnicodeBidi(const nsAReadableString& aUnicodeBidi); \ + NS_IMETHOD GetVerticalAlign(nsAWritableString& aVerticalAlign); \ + NS_IMETHOD SetVerticalAlign(const nsAReadableString& aVerticalAlign); \ + NS_IMETHOD GetVisibility(nsAWritableString& aVisibility); \ + NS_IMETHOD SetVisibility(const nsAReadableString& aVisibility); \ + NS_IMETHOD GetVoiceFamily(nsAWritableString& aVoiceFamily); \ + NS_IMETHOD SetVoiceFamily(const nsAReadableString& aVoiceFamily); \ + NS_IMETHOD GetVolume(nsAWritableString& aVolume); \ + NS_IMETHOD SetVolume(const nsAReadableString& aVolume); \ + NS_IMETHOD GetWhiteSpace(nsAWritableString& aWhiteSpace); \ + NS_IMETHOD SetWhiteSpace(const nsAReadableString& aWhiteSpace); \ + NS_IMETHOD GetWidows(nsAWritableString& aWidows); \ + NS_IMETHOD SetWidows(const nsAReadableString& aWidows); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ + NS_IMETHOD GetWordSpacing(nsAWritableString& aWordSpacing); \ + NS_IMETHOD SetWordSpacing(const nsAReadableString& aWordSpacing); \ + NS_IMETHOD GetZIndex(nsAWritableString& aZIndex); \ + NS_IMETHOD SetZIndex(const nsAReadableString& aZIndex); \ + NS_IMETHOD GetBehavior(nsAWritableString& aBehavior); \ + NS_IMETHOD SetBehavior(const nsAReadableString& aBehavior); \ + NS_IMETHOD GetOpacity(nsAWritableString& aOpacity); \ + NS_IMETHOD SetOpacity(const nsAReadableString& aOpacity); \ #define NS_FORWARD_IDOMCSS2PROPERTIES(_to) \ - NS_IMETHOD GetAzimuth(nsString& aAzimuth) { return _to GetAzimuth(aAzimuth); } \ - NS_IMETHOD SetAzimuth(const nsString& aAzimuth) { return _to SetAzimuth(aAzimuth); } \ - NS_IMETHOD GetBackground(nsString& aBackground) { return _to GetBackground(aBackground); } \ - NS_IMETHOD SetBackground(const nsString& aBackground) { return _to SetBackground(aBackground); } \ - NS_IMETHOD GetBackgroundAttachment(nsString& aBackgroundAttachment) { return _to GetBackgroundAttachment(aBackgroundAttachment); } \ - NS_IMETHOD SetBackgroundAttachment(const nsString& aBackgroundAttachment) { return _to SetBackgroundAttachment(aBackgroundAttachment); } \ - NS_IMETHOD GetBackgroundColor(nsString& aBackgroundColor) { return _to GetBackgroundColor(aBackgroundColor); } \ - NS_IMETHOD SetBackgroundColor(const nsString& aBackgroundColor) { return _to SetBackgroundColor(aBackgroundColor); } \ - NS_IMETHOD GetBackgroundImage(nsString& aBackgroundImage) { return _to GetBackgroundImage(aBackgroundImage); } \ - NS_IMETHOD SetBackgroundImage(const nsString& aBackgroundImage) { return _to SetBackgroundImage(aBackgroundImage); } \ - NS_IMETHOD GetBackgroundPosition(nsString& aBackgroundPosition) { return _to GetBackgroundPosition(aBackgroundPosition); } \ - NS_IMETHOD SetBackgroundPosition(const nsString& aBackgroundPosition) { return _to SetBackgroundPosition(aBackgroundPosition); } \ - NS_IMETHOD GetBackgroundRepeat(nsString& aBackgroundRepeat) { return _to GetBackgroundRepeat(aBackgroundRepeat); } \ - NS_IMETHOD SetBackgroundRepeat(const nsString& aBackgroundRepeat) { return _to SetBackgroundRepeat(aBackgroundRepeat); } \ - NS_IMETHOD GetBorder(nsString& aBorder) { return _to GetBorder(aBorder); } \ - NS_IMETHOD SetBorder(const nsString& aBorder) { return _to SetBorder(aBorder); } \ - NS_IMETHOD GetBorderCollapse(nsString& aBorderCollapse) { return _to GetBorderCollapse(aBorderCollapse); } \ - NS_IMETHOD SetBorderCollapse(const nsString& aBorderCollapse) { return _to SetBorderCollapse(aBorderCollapse); } \ - NS_IMETHOD GetBorderColor(nsString& aBorderColor) { return _to GetBorderColor(aBorderColor); } \ - NS_IMETHOD SetBorderColor(const nsString& aBorderColor) { return _to SetBorderColor(aBorderColor); } \ - NS_IMETHOD GetBorderSpacing(nsString& aBorderSpacing) { return _to GetBorderSpacing(aBorderSpacing); } \ - NS_IMETHOD SetBorderSpacing(const nsString& aBorderSpacing) { return _to SetBorderSpacing(aBorderSpacing); } \ - NS_IMETHOD GetBorderStyle(nsString& aBorderStyle) { return _to GetBorderStyle(aBorderStyle); } \ - NS_IMETHOD SetBorderStyle(const nsString& aBorderStyle) { return _to SetBorderStyle(aBorderStyle); } \ - NS_IMETHOD GetBorderTop(nsString& aBorderTop) { return _to GetBorderTop(aBorderTop); } \ - NS_IMETHOD SetBorderTop(const nsString& aBorderTop) { return _to SetBorderTop(aBorderTop); } \ - NS_IMETHOD GetBorderRight(nsString& aBorderRight) { return _to GetBorderRight(aBorderRight); } \ - NS_IMETHOD SetBorderRight(const nsString& aBorderRight) { return _to SetBorderRight(aBorderRight); } \ - NS_IMETHOD GetBorderBottom(nsString& aBorderBottom) { return _to GetBorderBottom(aBorderBottom); } \ - NS_IMETHOD SetBorderBottom(const nsString& aBorderBottom) { return _to SetBorderBottom(aBorderBottom); } \ - NS_IMETHOD GetBorderLeft(nsString& aBorderLeft) { return _to GetBorderLeft(aBorderLeft); } \ - NS_IMETHOD SetBorderLeft(const nsString& aBorderLeft) { return _to SetBorderLeft(aBorderLeft); } \ - NS_IMETHOD GetBorderTopColor(nsString& aBorderTopColor) { return _to GetBorderTopColor(aBorderTopColor); } \ - NS_IMETHOD SetBorderTopColor(const nsString& aBorderTopColor) { return _to SetBorderTopColor(aBorderTopColor); } \ - NS_IMETHOD GetBorderRightColor(nsString& aBorderRightColor) { return _to GetBorderRightColor(aBorderRightColor); } \ - NS_IMETHOD SetBorderRightColor(const nsString& aBorderRightColor) { return _to SetBorderRightColor(aBorderRightColor); } \ - NS_IMETHOD GetBorderBottomColor(nsString& aBorderBottomColor) { return _to GetBorderBottomColor(aBorderBottomColor); } \ - NS_IMETHOD SetBorderBottomColor(const nsString& aBorderBottomColor) { return _to SetBorderBottomColor(aBorderBottomColor); } \ - NS_IMETHOD GetBorderLeftColor(nsString& aBorderLeftColor) { return _to GetBorderLeftColor(aBorderLeftColor); } \ - NS_IMETHOD SetBorderLeftColor(const nsString& aBorderLeftColor) { return _to SetBorderLeftColor(aBorderLeftColor); } \ - NS_IMETHOD GetBorderTopStyle(nsString& aBorderTopStyle) { return _to GetBorderTopStyle(aBorderTopStyle); } \ - NS_IMETHOD SetBorderTopStyle(const nsString& aBorderTopStyle) { return _to SetBorderTopStyle(aBorderTopStyle); } \ - NS_IMETHOD GetBorderRightStyle(nsString& aBorderRightStyle) { return _to GetBorderRightStyle(aBorderRightStyle); } \ - NS_IMETHOD SetBorderRightStyle(const nsString& aBorderRightStyle) { return _to SetBorderRightStyle(aBorderRightStyle); } \ - NS_IMETHOD GetBorderBottomStyle(nsString& aBorderBottomStyle) { return _to GetBorderBottomStyle(aBorderBottomStyle); } \ - NS_IMETHOD SetBorderBottomStyle(const nsString& aBorderBottomStyle) { return _to SetBorderBottomStyle(aBorderBottomStyle); } \ - NS_IMETHOD GetBorderLeftStyle(nsString& aBorderLeftStyle) { return _to GetBorderLeftStyle(aBorderLeftStyle); } \ - NS_IMETHOD SetBorderLeftStyle(const nsString& aBorderLeftStyle) { return _to SetBorderLeftStyle(aBorderLeftStyle); } \ - NS_IMETHOD GetBorderTopWidth(nsString& aBorderTopWidth) { return _to GetBorderTopWidth(aBorderTopWidth); } \ - NS_IMETHOD SetBorderTopWidth(const nsString& aBorderTopWidth) { return _to SetBorderTopWidth(aBorderTopWidth); } \ - NS_IMETHOD GetBorderRightWidth(nsString& aBorderRightWidth) { return _to GetBorderRightWidth(aBorderRightWidth); } \ - NS_IMETHOD SetBorderRightWidth(const nsString& aBorderRightWidth) { return _to SetBorderRightWidth(aBorderRightWidth); } \ - NS_IMETHOD GetBorderBottomWidth(nsString& aBorderBottomWidth) { return _to GetBorderBottomWidth(aBorderBottomWidth); } \ - NS_IMETHOD SetBorderBottomWidth(const nsString& aBorderBottomWidth) { return _to SetBorderBottomWidth(aBorderBottomWidth); } \ - NS_IMETHOD GetBorderLeftWidth(nsString& aBorderLeftWidth) { return _to GetBorderLeftWidth(aBorderLeftWidth); } \ - NS_IMETHOD SetBorderLeftWidth(const nsString& aBorderLeftWidth) { return _to SetBorderLeftWidth(aBorderLeftWidth); } \ - NS_IMETHOD GetBorderWidth(nsString& aBorderWidth) { return _to GetBorderWidth(aBorderWidth); } \ - NS_IMETHOD SetBorderWidth(const nsString& aBorderWidth) { return _to SetBorderWidth(aBorderWidth); } \ - NS_IMETHOD GetBottom(nsString& aBottom) { return _to GetBottom(aBottom); } \ - NS_IMETHOD SetBottom(const nsString& aBottom) { return _to SetBottom(aBottom); } \ - NS_IMETHOD GetCaptionSide(nsString& aCaptionSide) { return _to GetCaptionSide(aCaptionSide); } \ - NS_IMETHOD SetCaptionSide(const nsString& aCaptionSide) { return _to SetCaptionSide(aCaptionSide); } \ - NS_IMETHOD GetClear(nsString& aClear) { return _to GetClear(aClear); } \ - NS_IMETHOD SetClear(const nsString& aClear) { return _to SetClear(aClear); } \ - NS_IMETHOD GetClip(nsString& aClip) { return _to GetClip(aClip); } \ - NS_IMETHOD SetClip(const nsString& aClip) { return _to SetClip(aClip); } \ - NS_IMETHOD GetColor(nsString& aColor) { return _to GetColor(aColor); } \ - NS_IMETHOD SetColor(const nsString& aColor) { return _to SetColor(aColor); } \ - NS_IMETHOD GetContent(nsString& aContent) { return _to GetContent(aContent); } \ - NS_IMETHOD SetContent(const nsString& aContent) { return _to SetContent(aContent); } \ - NS_IMETHOD GetCounterIncrement(nsString& aCounterIncrement) { return _to GetCounterIncrement(aCounterIncrement); } \ - NS_IMETHOD SetCounterIncrement(const nsString& aCounterIncrement) { return _to SetCounterIncrement(aCounterIncrement); } \ - NS_IMETHOD GetCounterReset(nsString& aCounterReset) { return _to GetCounterReset(aCounterReset); } \ - NS_IMETHOD SetCounterReset(const nsString& aCounterReset) { return _to SetCounterReset(aCounterReset); } \ - NS_IMETHOD GetCue(nsString& aCue) { return _to GetCue(aCue); } \ - NS_IMETHOD SetCue(const nsString& aCue) { return _to SetCue(aCue); } \ - NS_IMETHOD GetCueAfter(nsString& aCueAfter) { return _to GetCueAfter(aCueAfter); } \ - NS_IMETHOD SetCueAfter(const nsString& aCueAfter) { return _to SetCueAfter(aCueAfter); } \ - NS_IMETHOD GetCueBefore(nsString& aCueBefore) { return _to GetCueBefore(aCueBefore); } \ - NS_IMETHOD SetCueBefore(const nsString& aCueBefore) { return _to SetCueBefore(aCueBefore); } \ - NS_IMETHOD GetCursor(nsString& aCursor) { return _to GetCursor(aCursor); } \ - NS_IMETHOD SetCursor(const nsString& aCursor) { return _to SetCursor(aCursor); } \ - NS_IMETHOD GetDirection(nsString& aDirection) { return _to GetDirection(aDirection); } \ - NS_IMETHOD SetDirection(const nsString& aDirection) { return _to SetDirection(aDirection); } \ - NS_IMETHOD GetDisplay(nsString& aDisplay) { return _to GetDisplay(aDisplay); } \ - NS_IMETHOD SetDisplay(const nsString& aDisplay) { return _to SetDisplay(aDisplay); } \ - NS_IMETHOD GetElevation(nsString& aElevation) { return _to GetElevation(aElevation); } \ - NS_IMETHOD SetElevation(const nsString& aElevation) { return _to SetElevation(aElevation); } \ - NS_IMETHOD GetEmptyCells(nsString& aEmptyCells) { return _to GetEmptyCells(aEmptyCells); } \ - NS_IMETHOD SetEmptyCells(const nsString& aEmptyCells) { return _to SetEmptyCells(aEmptyCells); } \ - NS_IMETHOD GetCssFloat(nsString& aCssFloat) { return _to GetCssFloat(aCssFloat); } \ - NS_IMETHOD SetCssFloat(const nsString& aCssFloat) { return _to SetCssFloat(aCssFloat); } \ - NS_IMETHOD GetFont(nsString& aFont) { return _to GetFont(aFont); } \ - NS_IMETHOD SetFont(const nsString& aFont) { return _to SetFont(aFont); } \ - NS_IMETHOD GetFontFamily(nsString& aFontFamily) { return _to GetFontFamily(aFontFamily); } \ - NS_IMETHOD SetFontFamily(const nsString& aFontFamily) { return _to SetFontFamily(aFontFamily); } \ - NS_IMETHOD GetFontSize(nsString& aFontSize) { return _to GetFontSize(aFontSize); } \ - NS_IMETHOD SetFontSize(const nsString& aFontSize) { return _to SetFontSize(aFontSize); } \ - NS_IMETHOD GetFontSizeAdjust(nsString& aFontSizeAdjust) { return _to GetFontSizeAdjust(aFontSizeAdjust); } \ - NS_IMETHOD SetFontSizeAdjust(const nsString& aFontSizeAdjust) { return _to SetFontSizeAdjust(aFontSizeAdjust); } \ - NS_IMETHOD GetFontStretch(nsString& aFontStretch) { return _to GetFontStretch(aFontStretch); } \ - NS_IMETHOD SetFontStretch(const nsString& aFontStretch) { return _to SetFontStretch(aFontStretch); } \ - NS_IMETHOD GetFontStyle(nsString& aFontStyle) { return _to GetFontStyle(aFontStyle); } \ - NS_IMETHOD SetFontStyle(const nsString& aFontStyle) { return _to SetFontStyle(aFontStyle); } \ - NS_IMETHOD GetFontVariant(nsString& aFontVariant) { return _to GetFontVariant(aFontVariant); } \ - NS_IMETHOD SetFontVariant(const nsString& aFontVariant) { return _to SetFontVariant(aFontVariant); } \ - NS_IMETHOD GetFontWeight(nsString& aFontWeight) { return _to GetFontWeight(aFontWeight); } \ - NS_IMETHOD SetFontWeight(const nsString& aFontWeight) { return _to SetFontWeight(aFontWeight); } \ - NS_IMETHOD GetHeight(nsString& aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD SetHeight(const nsString& aHeight) { return _to SetHeight(aHeight); } \ - NS_IMETHOD GetLeft(nsString& aLeft) { return _to GetLeft(aLeft); } \ - NS_IMETHOD SetLeft(const nsString& aLeft) { return _to SetLeft(aLeft); } \ - NS_IMETHOD GetLetterSpacing(nsString& aLetterSpacing) { return _to GetLetterSpacing(aLetterSpacing); } \ - NS_IMETHOD SetLetterSpacing(const nsString& aLetterSpacing) { return _to SetLetterSpacing(aLetterSpacing); } \ - NS_IMETHOD GetLineHeight(nsString& aLineHeight) { return _to GetLineHeight(aLineHeight); } \ - NS_IMETHOD SetLineHeight(const nsString& aLineHeight) { return _to SetLineHeight(aLineHeight); } \ - NS_IMETHOD GetListStyle(nsString& aListStyle) { return _to GetListStyle(aListStyle); } \ - NS_IMETHOD SetListStyle(const nsString& aListStyle) { return _to SetListStyle(aListStyle); } \ - NS_IMETHOD GetListStyleImage(nsString& aListStyleImage) { return _to GetListStyleImage(aListStyleImage); } \ - NS_IMETHOD SetListStyleImage(const nsString& aListStyleImage) { return _to SetListStyleImage(aListStyleImage); } \ - NS_IMETHOD GetListStylePosition(nsString& aListStylePosition) { return _to GetListStylePosition(aListStylePosition); } \ - NS_IMETHOD SetListStylePosition(const nsString& aListStylePosition) { return _to SetListStylePosition(aListStylePosition); } \ - NS_IMETHOD GetListStyleType(nsString& aListStyleType) { return _to GetListStyleType(aListStyleType); } \ - NS_IMETHOD SetListStyleType(const nsString& aListStyleType) { return _to SetListStyleType(aListStyleType); } \ - NS_IMETHOD GetMargin(nsString& aMargin) { return _to GetMargin(aMargin); } \ - NS_IMETHOD SetMargin(const nsString& aMargin) { return _to SetMargin(aMargin); } \ - NS_IMETHOD GetMarginTop(nsString& aMarginTop) { return _to GetMarginTop(aMarginTop); } \ - NS_IMETHOD SetMarginTop(const nsString& aMarginTop) { return _to SetMarginTop(aMarginTop); } \ - NS_IMETHOD GetMarginRight(nsString& aMarginRight) { return _to GetMarginRight(aMarginRight); } \ - NS_IMETHOD SetMarginRight(const nsString& aMarginRight) { return _to SetMarginRight(aMarginRight); } \ - NS_IMETHOD GetMarginBottom(nsString& aMarginBottom) { return _to GetMarginBottom(aMarginBottom); } \ - NS_IMETHOD SetMarginBottom(const nsString& aMarginBottom) { return _to SetMarginBottom(aMarginBottom); } \ - NS_IMETHOD GetMarginLeft(nsString& aMarginLeft) { return _to GetMarginLeft(aMarginLeft); } \ - NS_IMETHOD SetMarginLeft(const nsString& aMarginLeft) { return _to SetMarginLeft(aMarginLeft); } \ - NS_IMETHOD GetMarkerOffset(nsString& aMarkerOffset) { return _to GetMarkerOffset(aMarkerOffset); } \ - NS_IMETHOD SetMarkerOffset(const nsString& aMarkerOffset) { return _to SetMarkerOffset(aMarkerOffset); } \ - NS_IMETHOD GetMarks(nsString& aMarks) { return _to GetMarks(aMarks); } \ - NS_IMETHOD SetMarks(const nsString& aMarks) { return _to SetMarks(aMarks); } \ - NS_IMETHOD GetMaxHeight(nsString& aMaxHeight) { return _to GetMaxHeight(aMaxHeight); } \ - NS_IMETHOD SetMaxHeight(const nsString& aMaxHeight) { return _to SetMaxHeight(aMaxHeight); } \ - NS_IMETHOD GetMaxWidth(nsString& aMaxWidth) { return _to GetMaxWidth(aMaxWidth); } \ - NS_IMETHOD SetMaxWidth(const nsString& aMaxWidth) { return _to SetMaxWidth(aMaxWidth); } \ - NS_IMETHOD GetMinHeight(nsString& aMinHeight) { return _to GetMinHeight(aMinHeight); } \ - NS_IMETHOD SetMinHeight(const nsString& aMinHeight) { return _to SetMinHeight(aMinHeight); } \ - NS_IMETHOD GetMinWidth(nsString& aMinWidth) { return _to GetMinWidth(aMinWidth); } \ - NS_IMETHOD SetMinWidth(const nsString& aMinWidth) { return _to SetMinWidth(aMinWidth); } \ - NS_IMETHOD GetOrphans(nsString& aOrphans) { return _to GetOrphans(aOrphans); } \ - NS_IMETHOD SetOrphans(const nsString& aOrphans) { return _to SetOrphans(aOrphans); } \ - NS_IMETHOD GetOutline(nsString& aOutline) { return _to GetOutline(aOutline); } \ - NS_IMETHOD SetOutline(const nsString& aOutline) { return _to SetOutline(aOutline); } \ - NS_IMETHOD GetOutlineColor(nsString& aOutlineColor) { return _to GetOutlineColor(aOutlineColor); } \ - NS_IMETHOD SetOutlineColor(const nsString& aOutlineColor) { return _to SetOutlineColor(aOutlineColor); } \ - NS_IMETHOD GetOutlineStyle(nsString& aOutlineStyle) { return _to GetOutlineStyle(aOutlineStyle); } \ - NS_IMETHOD SetOutlineStyle(const nsString& aOutlineStyle) { return _to SetOutlineStyle(aOutlineStyle); } \ - NS_IMETHOD GetOutlineWidth(nsString& aOutlineWidth) { return _to GetOutlineWidth(aOutlineWidth); } \ - NS_IMETHOD SetOutlineWidth(const nsString& aOutlineWidth) { return _to SetOutlineWidth(aOutlineWidth); } \ - NS_IMETHOD GetOverflow(nsString& aOverflow) { return _to GetOverflow(aOverflow); } \ - NS_IMETHOD SetOverflow(const nsString& aOverflow) { return _to SetOverflow(aOverflow); } \ - NS_IMETHOD GetPadding(nsString& aPadding) { return _to GetPadding(aPadding); } \ - NS_IMETHOD SetPadding(const nsString& aPadding) { return _to SetPadding(aPadding); } \ - NS_IMETHOD GetPaddingTop(nsString& aPaddingTop) { return _to GetPaddingTop(aPaddingTop); } \ - NS_IMETHOD SetPaddingTop(const nsString& aPaddingTop) { return _to SetPaddingTop(aPaddingTop); } \ - NS_IMETHOD GetPaddingRight(nsString& aPaddingRight) { return _to GetPaddingRight(aPaddingRight); } \ - NS_IMETHOD SetPaddingRight(const nsString& aPaddingRight) { return _to SetPaddingRight(aPaddingRight); } \ - NS_IMETHOD GetPaddingBottom(nsString& aPaddingBottom) { return _to GetPaddingBottom(aPaddingBottom); } \ - NS_IMETHOD SetPaddingBottom(const nsString& aPaddingBottom) { return _to SetPaddingBottom(aPaddingBottom); } \ - NS_IMETHOD GetPaddingLeft(nsString& aPaddingLeft) { return _to GetPaddingLeft(aPaddingLeft); } \ - NS_IMETHOD SetPaddingLeft(const nsString& aPaddingLeft) { return _to SetPaddingLeft(aPaddingLeft); } \ - NS_IMETHOD GetPage(nsString& aPage) { return _to GetPage(aPage); } \ - NS_IMETHOD SetPage(const nsString& aPage) { return _to SetPage(aPage); } \ - NS_IMETHOD GetPageBreakAfter(nsString& aPageBreakAfter) { return _to GetPageBreakAfter(aPageBreakAfter); } \ - NS_IMETHOD SetPageBreakAfter(const nsString& aPageBreakAfter) { return _to SetPageBreakAfter(aPageBreakAfter); } \ - NS_IMETHOD GetPageBreakBefore(nsString& aPageBreakBefore) { return _to GetPageBreakBefore(aPageBreakBefore); } \ - NS_IMETHOD SetPageBreakBefore(const nsString& aPageBreakBefore) { return _to SetPageBreakBefore(aPageBreakBefore); } \ - NS_IMETHOD GetPageBreakInside(nsString& aPageBreakInside) { return _to GetPageBreakInside(aPageBreakInside); } \ - NS_IMETHOD SetPageBreakInside(const nsString& aPageBreakInside) { return _to SetPageBreakInside(aPageBreakInside); } \ - NS_IMETHOD GetPause(nsString& aPause) { return _to GetPause(aPause); } \ - NS_IMETHOD SetPause(const nsString& aPause) { return _to SetPause(aPause); } \ - NS_IMETHOD GetPauseAfter(nsString& aPauseAfter) { return _to GetPauseAfter(aPauseAfter); } \ - NS_IMETHOD SetPauseAfter(const nsString& aPauseAfter) { return _to SetPauseAfter(aPauseAfter); } \ - NS_IMETHOD GetPauseBefore(nsString& aPauseBefore) { return _to GetPauseBefore(aPauseBefore); } \ - NS_IMETHOD SetPauseBefore(const nsString& aPauseBefore) { return _to SetPauseBefore(aPauseBefore); } \ - NS_IMETHOD GetPitch(nsString& aPitch) { return _to GetPitch(aPitch); } \ - NS_IMETHOD SetPitch(const nsString& aPitch) { return _to SetPitch(aPitch); } \ - NS_IMETHOD GetPitchRange(nsString& aPitchRange) { return _to GetPitchRange(aPitchRange); } \ - NS_IMETHOD SetPitchRange(const nsString& aPitchRange) { return _to SetPitchRange(aPitchRange); } \ - NS_IMETHOD GetPlayDuring(nsString& aPlayDuring) { return _to GetPlayDuring(aPlayDuring); } \ - NS_IMETHOD SetPlayDuring(const nsString& aPlayDuring) { return _to SetPlayDuring(aPlayDuring); } \ - NS_IMETHOD GetPosition(nsString& aPosition) { return _to GetPosition(aPosition); } \ - NS_IMETHOD SetPosition(const nsString& aPosition) { return _to SetPosition(aPosition); } \ - NS_IMETHOD GetQuotes(nsString& aQuotes) { return _to GetQuotes(aQuotes); } \ - NS_IMETHOD SetQuotes(const nsString& aQuotes) { return _to SetQuotes(aQuotes); } \ - NS_IMETHOD GetRichness(nsString& aRichness) { return _to GetRichness(aRichness); } \ - NS_IMETHOD SetRichness(const nsString& aRichness) { return _to SetRichness(aRichness); } \ - NS_IMETHOD GetRight(nsString& aRight) { return _to GetRight(aRight); } \ - NS_IMETHOD SetRight(const nsString& aRight) { return _to SetRight(aRight); } \ - NS_IMETHOD GetSize(nsString& aSize) { return _to GetSize(aSize); } \ - NS_IMETHOD SetSize(const nsString& aSize) { return _to SetSize(aSize); } \ - NS_IMETHOD GetSpeak(nsString& aSpeak) { return _to GetSpeak(aSpeak); } \ - NS_IMETHOD SetSpeak(const nsString& aSpeak) { return _to SetSpeak(aSpeak); } \ - NS_IMETHOD GetSpeakHeader(nsString& aSpeakHeader) { return _to GetSpeakHeader(aSpeakHeader); } \ - NS_IMETHOD SetSpeakHeader(const nsString& aSpeakHeader) { return _to SetSpeakHeader(aSpeakHeader); } \ - NS_IMETHOD GetSpeakNumeral(nsString& aSpeakNumeral) { return _to GetSpeakNumeral(aSpeakNumeral); } \ - NS_IMETHOD SetSpeakNumeral(const nsString& aSpeakNumeral) { return _to SetSpeakNumeral(aSpeakNumeral); } \ - NS_IMETHOD GetSpeakPunctuation(nsString& aSpeakPunctuation) { return _to GetSpeakPunctuation(aSpeakPunctuation); } \ - NS_IMETHOD SetSpeakPunctuation(const nsString& aSpeakPunctuation) { return _to SetSpeakPunctuation(aSpeakPunctuation); } \ - NS_IMETHOD GetSpeechRate(nsString& aSpeechRate) { return _to GetSpeechRate(aSpeechRate); } \ - NS_IMETHOD SetSpeechRate(const nsString& aSpeechRate) { return _to SetSpeechRate(aSpeechRate); } \ - NS_IMETHOD GetStress(nsString& aStress) { return _to GetStress(aStress); } \ - NS_IMETHOD SetStress(const nsString& aStress) { return _to SetStress(aStress); } \ - NS_IMETHOD GetTableLayout(nsString& aTableLayout) { return _to GetTableLayout(aTableLayout); } \ - NS_IMETHOD SetTableLayout(const nsString& aTableLayout) { return _to SetTableLayout(aTableLayout); } \ - NS_IMETHOD GetTextAlign(nsString& aTextAlign) { return _to GetTextAlign(aTextAlign); } \ - NS_IMETHOD SetTextAlign(const nsString& aTextAlign) { return _to SetTextAlign(aTextAlign); } \ - NS_IMETHOD GetTextDecoration(nsString& aTextDecoration) { return _to GetTextDecoration(aTextDecoration); } \ - NS_IMETHOD SetTextDecoration(const nsString& aTextDecoration) { return _to SetTextDecoration(aTextDecoration); } \ - NS_IMETHOD GetTextIndent(nsString& aTextIndent) { return _to GetTextIndent(aTextIndent); } \ - NS_IMETHOD SetTextIndent(const nsString& aTextIndent) { return _to SetTextIndent(aTextIndent); } \ - NS_IMETHOD GetTextShadow(nsString& aTextShadow) { return _to GetTextShadow(aTextShadow); } \ - NS_IMETHOD SetTextShadow(const nsString& aTextShadow) { return _to SetTextShadow(aTextShadow); } \ - NS_IMETHOD GetTextTransform(nsString& aTextTransform) { return _to GetTextTransform(aTextTransform); } \ - NS_IMETHOD SetTextTransform(const nsString& aTextTransform) { return _to SetTextTransform(aTextTransform); } \ - NS_IMETHOD GetTop(nsString& aTop) { return _to GetTop(aTop); } \ - NS_IMETHOD SetTop(const nsString& aTop) { return _to SetTop(aTop); } \ - NS_IMETHOD GetUnicodeBidi(nsString& aUnicodeBidi) { return _to GetUnicodeBidi(aUnicodeBidi); } \ - NS_IMETHOD SetUnicodeBidi(const nsString& aUnicodeBidi) { return _to SetUnicodeBidi(aUnicodeBidi); } \ - NS_IMETHOD GetVerticalAlign(nsString& aVerticalAlign) { return _to GetVerticalAlign(aVerticalAlign); } \ - NS_IMETHOD SetVerticalAlign(const nsString& aVerticalAlign) { return _to SetVerticalAlign(aVerticalAlign); } \ - NS_IMETHOD GetVisibility(nsString& aVisibility) { return _to GetVisibility(aVisibility); } \ - NS_IMETHOD SetVisibility(const nsString& aVisibility) { return _to SetVisibility(aVisibility); } \ - NS_IMETHOD GetVoiceFamily(nsString& aVoiceFamily) { return _to GetVoiceFamily(aVoiceFamily); } \ - NS_IMETHOD SetVoiceFamily(const nsString& aVoiceFamily) { return _to SetVoiceFamily(aVoiceFamily); } \ - NS_IMETHOD GetVolume(nsString& aVolume) { return _to GetVolume(aVolume); } \ - NS_IMETHOD SetVolume(const nsString& aVolume) { return _to SetVolume(aVolume); } \ - NS_IMETHOD GetWhiteSpace(nsString& aWhiteSpace) { return _to GetWhiteSpace(aWhiteSpace); } \ - NS_IMETHOD SetWhiteSpace(const nsString& aWhiteSpace) { return _to SetWhiteSpace(aWhiteSpace); } \ - NS_IMETHOD GetWidows(nsString& aWidows) { return _to GetWidows(aWidows); } \ - NS_IMETHOD SetWidows(const nsString& aWidows) { return _to SetWidows(aWidows); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ - NS_IMETHOD GetWordSpacing(nsString& aWordSpacing) { return _to GetWordSpacing(aWordSpacing); } \ - NS_IMETHOD SetWordSpacing(const nsString& aWordSpacing) { return _to SetWordSpacing(aWordSpacing); } \ - NS_IMETHOD GetZIndex(nsString& aZIndex) { return _to GetZIndex(aZIndex); } \ - NS_IMETHOD SetZIndex(const nsString& aZIndex) { return _to SetZIndex(aZIndex); } \ - NS_IMETHOD GetBehavior(nsString& aBehavior) { return _to GetBehavior(aBehavior); } \ - NS_IMETHOD SetBehavior(const nsString& aBehavior) { return _to SetBehavior(aBehavior); } \ - NS_IMETHOD GetOpacity(nsString& aOpacity) { return _to GetOpacity(aOpacity); } \ - NS_IMETHOD SetOpacity(const nsString& aOpacity) { return _to SetOpacity(aOpacity); } \ + NS_IMETHOD GetAzimuth(nsAWritableString& aAzimuth) { return _to GetAzimuth(aAzimuth); } \ + NS_IMETHOD SetAzimuth(const nsAReadableString& aAzimuth) { return _to SetAzimuth(aAzimuth); } \ + NS_IMETHOD GetBackground(nsAWritableString& aBackground) { return _to GetBackground(aBackground); } \ + NS_IMETHOD SetBackground(const nsAReadableString& aBackground) { return _to SetBackground(aBackground); } \ + NS_IMETHOD GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment) { return _to GetBackgroundAttachment(aBackgroundAttachment); } \ + NS_IMETHOD SetBackgroundAttachment(const nsAReadableString& aBackgroundAttachment) { return _to SetBackgroundAttachment(aBackgroundAttachment); } \ + NS_IMETHOD GetBackgroundColor(nsAWritableString& aBackgroundColor) { return _to GetBackgroundColor(aBackgroundColor); } \ + NS_IMETHOD SetBackgroundColor(const nsAReadableString& aBackgroundColor) { return _to SetBackgroundColor(aBackgroundColor); } \ + NS_IMETHOD GetBackgroundImage(nsAWritableString& aBackgroundImage) { return _to GetBackgroundImage(aBackgroundImage); } \ + NS_IMETHOD SetBackgroundImage(const nsAReadableString& aBackgroundImage) { return _to SetBackgroundImage(aBackgroundImage); } \ + NS_IMETHOD GetBackgroundPosition(nsAWritableString& aBackgroundPosition) { return _to GetBackgroundPosition(aBackgroundPosition); } \ + NS_IMETHOD SetBackgroundPosition(const nsAReadableString& aBackgroundPosition) { return _to SetBackgroundPosition(aBackgroundPosition); } \ + NS_IMETHOD GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat) { return _to GetBackgroundRepeat(aBackgroundRepeat); } \ + NS_IMETHOD SetBackgroundRepeat(const nsAReadableString& aBackgroundRepeat) { return _to SetBackgroundRepeat(aBackgroundRepeat); } \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder) { return _to GetBorder(aBorder); } \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder) { return _to SetBorder(aBorder); } \ + NS_IMETHOD GetBorderCollapse(nsAWritableString& aBorderCollapse) { return _to GetBorderCollapse(aBorderCollapse); } \ + NS_IMETHOD SetBorderCollapse(const nsAReadableString& aBorderCollapse) { return _to SetBorderCollapse(aBorderCollapse); } \ + NS_IMETHOD GetBorderColor(nsAWritableString& aBorderColor) { return _to GetBorderColor(aBorderColor); } \ + NS_IMETHOD SetBorderColor(const nsAReadableString& aBorderColor) { return _to SetBorderColor(aBorderColor); } \ + NS_IMETHOD GetBorderSpacing(nsAWritableString& aBorderSpacing) { return _to GetBorderSpacing(aBorderSpacing); } \ + NS_IMETHOD SetBorderSpacing(const nsAReadableString& aBorderSpacing) { return _to SetBorderSpacing(aBorderSpacing); } \ + NS_IMETHOD GetBorderStyle(nsAWritableString& aBorderStyle) { return _to GetBorderStyle(aBorderStyle); } \ + NS_IMETHOD SetBorderStyle(const nsAReadableString& aBorderStyle) { return _to SetBorderStyle(aBorderStyle); } \ + NS_IMETHOD GetBorderTop(nsAWritableString& aBorderTop) { return _to GetBorderTop(aBorderTop); } \ + NS_IMETHOD SetBorderTop(const nsAReadableString& aBorderTop) { return _to SetBorderTop(aBorderTop); } \ + NS_IMETHOD GetBorderRight(nsAWritableString& aBorderRight) { return _to GetBorderRight(aBorderRight); } \ + NS_IMETHOD SetBorderRight(const nsAReadableString& aBorderRight) { return _to SetBorderRight(aBorderRight); } \ + NS_IMETHOD GetBorderBottom(nsAWritableString& aBorderBottom) { return _to GetBorderBottom(aBorderBottom); } \ + NS_IMETHOD SetBorderBottom(const nsAReadableString& aBorderBottom) { return _to SetBorderBottom(aBorderBottom); } \ + NS_IMETHOD GetBorderLeft(nsAWritableString& aBorderLeft) { return _to GetBorderLeft(aBorderLeft); } \ + NS_IMETHOD SetBorderLeft(const nsAReadableString& aBorderLeft) { return _to SetBorderLeft(aBorderLeft); } \ + NS_IMETHOD GetBorderTopColor(nsAWritableString& aBorderTopColor) { return _to GetBorderTopColor(aBorderTopColor); } \ + NS_IMETHOD SetBorderTopColor(const nsAReadableString& aBorderTopColor) { return _to SetBorderTopColor(aBorderTopColor); } \ + NS_IMETHOD GetBorderRightColor(nsAWritableString& aBorderRightColor) { return _to GetBorderRightColor(aBorderRightColor); } \ + NS_IMETHOD SetBorderRightColor(const nsAReadableString& aBorderRightColor) { return _to SetBorderRightColor(aBorderRightColor); } \ + NS_IMETHOD GetBorderBottomColor(nsAWritableString& aBorderBottomColor) { return _to GetBorderBottomColor(aBorderBottomColor); } \ + NS_IMETHOD SetBorderBottomColor(const nsAReadableString& aBorderBottomColor) { return _to SetBorderBottomColor(aBorderBottomColor); } \ + NS_IMETHOD GetBorderLeftColor(nsAWritableString& aBorderLeftColor) { return _to GetBorderLeftColor(aBorderLeftColor); } \ + NS_IMETHOD SetBorderLeftColor(const nsAReadableString& aBorderLeftColor) { return _to SetBorderLeftColor(aBorderLeftColor); } \ + NS_IMETHOD GetBorderTopStyle(nsAWritableString& aBorderTopStyle) { return _to GetBorderTopStyle(aBorderTopStyle); } \ + NS_IMETHOD SetBorderTopStyle(const nsAReadableString& aBorderTopStyle) { return _to SetBorderTopStyle(aBorderTopStyle); } \ + NS_IMETHOD GetBorderRightStyle(nsAWritableString& aBorderRightStyle) { return _to GetBorderRightStyle(aBorderRightStyle); } \ + NS_IMETHOD SetBorderRightStyle(const nsAReadableString& aBorderRightStyle) { return _to SetBorderRightStyle(aBorderRightStyle); } \ + NS_IMETHOD GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle) { return _to GetBorderBottomStyle(aBorderBottomStyle); } \ + NS_IMETHOD SetBorderBottomStyle(const nsAReadableString& aBorderBottomStyle) { return _to SetBorderBottomStyle(aBorderBottomStyle); } \ + NS_IMETHOD GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle) { return _to GetBorderLeftStyle(aBorderLeftStyle); } \ + NS_IMETHOD SetBorderLeftStyle(const nsAReadableString& aBorderLeftStyle) { return _to SetBorderLeftStyle(aBorderLeftStyle); } \ + NS_IMETHOD GetBorderTopWidth(nsAWritableString& aBorderTopWidth) { return _to GetBorderTopWidth(aBorderTopWidth); } \ + NS_IMETHOD SetBorderTopWidth(const nsAReadableString& aBorderTopWidth) { return _to SetBorderTopWidth(aBorderTopWidth); } \ + NS_IMETHOD GetBorderRightWidth(nsAWritableString& aBorderRightWidth) { return _to GetBorderRightWidth(aBorderRightWidth); } \ + NS_IMETHOD SetBorderRightWidth(const nsAReadableString& aBorderRightWidth) { return _to SetBorderRightWidth(aBorderRightWidth); } \ + NS_IMETHOD GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth) { return _to GetBorderBottomWidth(aBorderBottomWidth); } \ + NS_IMETHOD SetBorderBottomWidth(const nsAReadableString& aBorderBottomWidth) { return _to SetBorderBottomWidth(aBorderBottomWidth); } \ + NS_IMETHOD GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth) { return _to GetBorderLeftWidth(aBorderLeftWidth); } \ + NS_IMETHOD SetBorderLeftWidth(const nsAReadableString& aBorderLeftWidth) { return _to SetBorderLeftWidth(aBorderLeftWidth); } \ + NS_IMETHOD GetBorderWidth(nsAWritableString& aBorderWidth) { return _to GetBorderWidth(aBorderWidth); } \ + NS_IMETHOD SetBorderWidth(const nsAReadableString& aBorderWidth) { return _to SetBorderWidth(aBorderWidth); } \ + NS_IMETHOD GetBottom(nsAWritableString& aBottom) { return _to GetBottom(aBottom); } \ + NS_IMETHOD SetBottom(const nsAReadableString& aBottom) { return _to SetBottom(aBottom); } \ + NS_IMETHOD GetCaptionSide(nsAWritableString& aCaptionSide) { return _to GetCaptionSide(aCaptionSide); } \ + NS_IMETHOD SetCaptionSide(const nsAReadableString& aCaptionSide) { return _to SetCaptionSide(aCaptionSide); } \ + NS_IMETHOD GetClear(nsAWritableString& aClear) { return _to GetClear(aClear); } \ + NS_IMETHOD SetClear(const nsAReadableString& aClear) { return _to SetClear(aClear); } \ + NS_IMETHOD GetClip(nsAWritableString& aClip) { return _to GetClip(aClip); } \ + NS_IMETHOD SetClip(const nsAReadableString& aClip) { return _to SetClip(aClip); } \ + NS_IMETHOD GetColor(nsAWritableString& aColor) { return _to GetColor(aColor); } \ + NS_IMETHOD SetColor(const nsAReadableString& aColor) { return _to SetColor(aColor); } \ + NS_IMETHOD GetContent(nsAWritableString& aContent) { return _to GetContent(aContent); } \ + NS_IMETHOD SetContent(const nsAReadableString& aContent) { return _to SetContent(aContent); } \ + NS_IMETHOD GetCounterIncrement(nsAWritableString& aCounterIncrement) { return _to GetCounterIncrement(aCounterIncrement); } \ + NS_IMETHOD SetCounterIncrement(const nsAReadableString& aCounterIncrement) { return _to SetCounterIncrement(aCounterIncrement); } \ + NS_IMETHOD GetCounterReset(nsAWritableString& aCounterReset) { return _to GetCounterReset(aCounterReset); } \ + NS_IMETHOD SetCounterReset(const nsAReadableString& aCounterReset) { return _to SetCounterReset(aCounterReset); } \ + NS_IMETHOD GetCue(nsAWritableString& aCue) { return _to GetCue(aCue); } \ + NS_IMETHOD SetCue(const nsAReadableString& aCue) { return _to SetCue(aCue); } \ + NS_IMETHOD GetCueAfter(nsAWritableString& aCueAfter) { return _to GetCueAfter(aCueAfter); } \ + NS_IMETHOD SetCueAfter(const nsAReadableString& aCueAfter) { return _to SetCueAfter(aCueAfter); } \ + NS_IMETHOD GetCueBefore(nsAWritableString& aCueBefore) { return _to GetCueBefore(aCueBefore); } \ + NS_IMETHOD SetCueBefore(const nsAReadableString& aCueBefore) { return _to SetCueBefore(aCueBefore); } \ + NS_IMETHOD GetCursor(nsAWritableString& aCursor) { return _to GetCursor(aCursor); } \ + NS_IMETHOD SetCursor(const nsAReadableString& aCursor) { return _to SetCursor(aCursor); } \ + NS_IMETHOD GetDirection(nsAWritableString& aDirection) { return _to GetDirection(aDirection); } \ + NS_IMETHOD SetDirection(const nsAReadableString& aDirection) { return _to SetDirection(aDirection); } \ + NS_IMETHOD GetDisplay(nsAWritableString& aDisplay) { return _to GetDisplay(aDisplay); } \ + NS_IMETHOD SetDisplay(const nsAReadableString& aDisplay) { return _to SetDisplay(aDisplay); } \ + NS_IMETHOD GetElevation(nsAWritableString& aElevation) { return _to GetElevation(aElevation); } \ + NS_IMETHOD SetElevation(const nsAReadableString& aElevation) { return _to SetElevation(aElevation); } \ + NS_IMETHOD GetEmptyCells(nsAWritableString& aEmptyCells) { return _to GetEmptyCells(aEmptyCells); } \ + NS_IMETHOD SetEmptyCells(const nsAReadableString& aEmptyCells) { return _to SetEmptyCells(aEmptyCells); } \ + NS_IMETHOD GetCssFloat(nsAWritableString& aCssFloat) { return _to GetCssFloat(aCssFloat); } \ + NS_IMETHOD SetCssFloat(const nsAReadableString& aCssFloat) { return _to SetCssFloat(aCssFloat); } \ + NS_IMETHOD GetFont(nsAWritableString& aFont) { return _to GetFont(aFont); } \ + NS_IMETHOD SetFont(const nsAReadableString& aFont) { return _to SetFont(aFont); } \ + NS_IMETHOD GetFontFamily(nsAWritableString& aFontFamily) { return _to GetFontFamily(aFontFamily); } \ + NS_IMETHOD SetFontFamily(const nsAReadableString& aFontFamily) { return _to SetFontFamily(aFontFamily); } \ + NS_IMETHOD GetFontSize(nsAWritableString& aFontSize) { return _to GetFontSize(aFontSize); } \ + NS_IMETHOD SetFontSize(const nsAReadableString& aFontSize) { return _to SetFontSize(aFontSize); } \ + NS_IMETHOD GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust) { return _to GetFontSizeAdjust(aFontSizeAdjust); } \ + NS_IMETHOD SetFontSizeAdjust(const nsAReadableString& aFontSizeAdjust) { return _to SetFontSizeAdjust(aFontSizeAdjust); } \ + NS_IMETHOD GetFontStretch(nsAWritableString& aFontStretch) { return _to GetFontStretch(aFontStretch); } \ + NS_IMETHOD SetFontStretch(const nsAReadableString& aFontStretch) { return _to SetFontStretch(aFontStretch); } \ + NS_IMETHOD GetFontStyle(nsAWritableString& aFontStyle) { return _to GetFontStyle(aFontStyle); } \ + NS_IMETHOD SetFontStyle(const nsAReadableString& aFontStyle) { return _to SetFontStyle(aFontStyle); } \ + NS_IMETHOD GetFontVariant(nsAWritableString& aFontVariant) { return _to GetFontVariant(aFontVariant); } \ + NS_IMETHOD SetFontVariant(const nsAReadableString& aFontVariant) { return _to SetFontVariant(aFontVariant); } \ + NS_IMETHOD GetFontWeight(nsAWritableString& aFontWeight) { return _to GetFontWeight(aFontWeight); } \ + NS_IMETHOD SetFontWeight(const nsAReadableString& aFontWeight) { return _to SetFontWeight(aFontWeight); } \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight) { return _to GetHeight(aHeight); } \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight) { return _to SetHeight(aHeight); } \ + NS_IMETHOD GetLeft(nsAWritableString& aLeft) { return _to GetLeft(aLeft); } \ + NS_IMETHOD SetLeft(const nsAReadableString& aLeft) { return _to SetLeft(aLeft); } \ + NS_IMETHOD GetLetterSpacing(nsAWritableString& aLetterSpacing) { return _to GetLetterSpacing(aLetterSpacing); } \ + NS_IMETHOD SetLetterSpacing(const nsAReadableString& aLetterSpacing) { return _to SetLetterSpacing(aLetterSpacing); } \ + NS_IMETHOD GetLineHeight(nsAWritableString& aLineHeight) { return _to GetLineHeight(aLineHeight); } \ + NS_IMETHOD SetLineHeight(const nsAReadableString& aLineHeight) { return _to SetLineHeight(aLineHeight); } \ + NS_IMETHOD GetListStyle(nsAWritableString& aListStyle) { return _to GetListStyle(aListStyle); } \ + NS_IMETHOD SetListStyle(const nsAReadableString& aListStyle) { return _to SetListStyle(aListStyle); } \ + NS_IMETHOD GetListStyleImage(nsAWritableString& aListStyleImage) { return _to GetListStyleImage(aListStyleImage); } \ + NS_IMETHOD SetListStyleImage(const nsAReadableString& aListStyleImage) { return _to SetListStyleImage(aListStyleImage); } \ + NS_IMETHOD GetListStylePosition(nsAWritableString& aListStylePosition) { return _to GetListStylePosition(aListStylePosition); } \ + NS_IMETHOD SetListStylePosition(const nsAReadableString& aListStylePosition) { return _to SetListStylePosition(aListStylePosition); } \ + NS_IMETHOD GetListStyleType(nsAWritableString& aListStyleType) { return _to GetListStyleType(aListStyleType); } \ + NS_IMETHOD SetListStyleType(const nsAReadableString& aListStyleType) { return _to SetListStyleType(aListStyleType); } \ + NS_IMETHOD GetMargin(nsAWritableString& aMargin) { return _to GetMargin(aMargin); } \ + NS_IMETHOD SetMargin(const nsAReadableString& aMargin) { return _to SetMargin(aMargin); } \ + NS_IMETHOD GetMarginTop(nsAWritableString& aMarginTop) { return _to GetMarginTop(aMarginTop); } \ + NS_IMETHOD SetMarginTop(const nsAReadableString& aMarginTop) { return _to SetMarginTop(aMarginTop); } \ + NS_IMETHOD GetMarginRight(nsAWritableString& aMarginRight) { return _to GetMarginRight(aMarginRight); } \ + NS_IMETHOD SetMarginRight(const nsAReadableString& aMarginRight) { return _to SetMarginRight(aMarginRight); } \ + NS_IMETHOD GetMarginBottom(nsAWritableString& aMarginBottom) { return _to GetMarginBottom(aMarginBottom); } \ + NS_IMETHOD SetMarginBottom(const nsAReadableString& aMarginBottom) { return _to SetMarginBottom(aMarginBottom); } \ + NS_IMETHOD GetMarginLeft(nsAWritableString& aMarginLeft) { return _to GetMarginLeft(aMarginLeft); } \ + NS_IMETHOD SetMarginLeft(const nsAReadableString& aMarginLeft) { return _to SetMarginLeft(aMarginLeft); } \ + NS_IMETHOD GetMarkerOffset(nsAWritableString& aMarkerOffset) { return _to GetMarkerOffset(aMarkerOffset); } \ + NS_IMETHOD SetMarkerOffset(const nsAReadableString& aMarkerOffset) { return _to SetMarkerOffset(aMarkerOffset); } \ + NS_IMETHOD GetMarks(nsAWritableString& aMarks) { return _to GetMarks(aMarks); } \ + NS_IMETHOD SetMarks(const nsAReadableString& aMarks) { return _to SetMarks(aMarks); } \ + NS_IMETHOD GetMaxHeight(nsAWritableString& aMaxHeight) { return _to GetMaxHeight(aMaxHeight); } \ + NS_IMETHOD SetMaxHeight(const nsAReadableString& aMaxHeight) { return _to SetMaxHeight(aMaxHeight); } \ + NS_IMETHOD GetMaxWidth(nsAWritableString& aMaxWidth) { return _to GetMaxWidth(aMaxWidth); } \ + NS_IMETHOD SetMaxWidth(const nsAReadableString& aMaxWidth) { return _to SetMaxWidth(aMaxWidth); } \ + NS_IMETHOD GetMinHeight(nsAWritableString& aMinHeight) { return _to GetMinHeight(aMinHeight); } \ + NS_IMETHOD SetMinHeight(const nsAReadableString& aMinHeight) { return _to SetMinHeight(aMinHeight); } \ + NS_IMETHOD GetMinWidth(nsAWritableString& aMinWidth) { return _to GetMinWidth(aMinWidth); } \ + NS_IMETHOD SetMinWidth(const nsAReadableString& aMinWidth) { return _to SetMinWidth(aMinWidth); } \ + NS_IMETHOD GetOrphans(nsAWritableString& aOrphans) { return _to GetOrphans(aOrphans); } \ + NS_IMETHOD SetOrphans(const nsAReadableString& aOrphans) { return _to SetOrphans(aOrphans); } \ + NS_IMETHOD GetOutline(nsAWritableString& aOutline) { return _to GetOutline(aOutline); } \ + NS_IMETHOD SetOutline(const nsAReadableString& aOutline) { return _to SetOutline(aOutline); } \ + NS_IMETHOD GetOutlineColor(nsAWritableString& aOutlineColor) { return _to GetOutlineColor(aOutlineColor); } \ + NS_IMETHOD SetOutlineColor(const nsAReadableString& aOutlineColor) { return _to SetOutlineColor(aOutlineColor); } \ + NS_IMETHOD GetOutlineStyle(nsAWritableString& aOutlineStyle) { return _to GetOutlineStyle(aOutlineStyle); } \ + NS_IMETHOD SetOutlineStyle(const nsAReadableString& aOutlineStyle) { return _to SetOutlineStyle(aOutlineStyle); } \ + NS_IMETHOD GetOutlineWidth(nsAWritableString& aOutlineWidth) { return _to GetOutlineWidth(aOutlineWidth); } \ + NS_IMETHOD SetOutlineWidth(const nsAReadableString& aOutlineWidth) { return _to SetOutlineWidth(aOutlineWidth); } \ + NS_IMETHOD GetOverflow(nsAWritableString& aOverflow) { return _to GetOverflow(aOverflow); } \ + NS_IMETHOD SetOverflow(const nsAReadableString& aOverflow) { return _to SetOverflow(aOverflow); } \ + NS_IMETHOD GetPadding(nsAWritableString& aPadding) { return _to GetPadding(aPadding); } \ + NS_IMETHOD SetPadding(const nsAReadableString& aPadding) { return _to SetPadding(aPadding); } \ + NS_IMETHOD GetPaddingTop(nsAWritableString& aPaddingTop) { return _to GetPaddingTop(aPaddingTop); } \ + NS_IMETHOD SetPaddingTop(const nsAReadableString& aPaddingTop) { return _to SetPaddingTop(aPaddingTop); } \ + NS_IMETHOD GetPaddingRight(nsAWritableString& aPaddingRight) { return _to GetPaddingRight(aPaddingRight); } \ + NS_IMETHOD SetPaddingRight(const nsAReadableString& aPaddingRight) { return _to SetPaddingRight(aPaddingRight); } \ + NS_IMETHOD GetPaddingBottom(nsAWritableString& aPaddingBottom) { return _to GetPaddingBottom(aPaddingBottom); } \ + NS_IMETHOD SetPaddingBottom(const nsAReadableString& aPaddingBottom) { return _to SetPaddingBottom(aPaddingBottom); } \ + NS_IMETHOD GetPaddingLeft(nsAWritableString& aPaddingLeft) { return _to GetPaddingLeft(aPaddingLeft); } \ + NS_IMETHOD SetPaddingLeft(const nsAReadableString& aPaddingLeft) { return _to SetPaddingLeft(aPaddingLeft); } \ + NS_IMETHOD GetPage(nsAWritableString& aPage) { return _to GetPage(aPage); } \ + NS_IMETHOD SetPage(const nsAReadableString& aPage) { return _to SetPage(aPage); } \ + NS_IMETHOD GetPageBreakAfter(nsAWritableString& aPageBreakAfter) { return _to GetPageBreakAfter(aPageBreakAfter); } \ + NS_IMETHOD SetPageBreakAfter(const nsAReadableString& aPageBreakAfter) { return _to SetPageBreakAfter(aPageBreakAfter); } \ + NS_IMETHOD GetPageBreakBefore(nsAWritableString& aPageBreakBefore) { return _to GetPageBreakBefore(aPageBreakBefore); } \ + NS_IMETHOD SetPageBreakBefore(const nsAReadableString& aPageBreakBefore) { return _to SetPageBreakBefore(aPageBreakBefore); } \ + NS_IMETHOD GetPageBreakInside(nsAWritableString& aPageBreakInside) { return _to GetPageBreakInside(aPageBreakInside); } \ + NS_IMETHOD SetPageBreakInside(const nsAReadableString& aPageBreakInside) { return _to SetPageBreakInside(aPageBreakInside); } \ + NS_IMETHOD GetPause(nsAWritableString& aPause) { return _to GetPause(aPause); } \ + NS_IMETHOD SetPause(const nsAReadableString& aPause) { return _to SetPause(aPause); } \ + NS_IMETHOD GetPauseAfter(nsAWritableString& aPauseAfter) { return _to GetPauseAfter(aPauseAfter); } \ + NS_IMETHOD SetPauseAfter(const nsAReadableString& aPauseAfter) { return _to SetPauseAfter(aPauseAfter); } \ + NS_IMETHOD GetPauseBefore(nsAWritableString& aPauseBefore) { return _to GetPauseBefore(aPauseBefore); } \ + NS_IMETHOD SetPauseBefore(const nsAReadableString& aPauseBefore) { return _to SetPauseBefore(aPauseBefore); } \ + NS_IMETHOD GetPitch(nsAWritableString& aPitch) { return _to GetPitch(aPitch); } \ + NS_IMETHOD SetPitch(const nsAReadableString& aPitch) { return _to SetPitch(aPitch); } \ + NS_IMETHOD GetPitchRange(nsAWritableString& aPitchRange) { return _to GetPitchRange(aPitchRange); } \ + NS_IMETHOD SetPitchRange(const nsAReadableString& aPitchRange) { return _to SetPitchRange(aPitchRange); } \ + NS_IMETHOD GetPlayDuring(nsAWritableString& aPlayDuring) { return _to GetPlayDuring(aPlayDuring); } \ + NS_IMETHOD SetPlayDuring(const nsAReadableString& aPlayDuring) { return _to SetPlayDuring(aPlayDuring); } \ + NS_IMETHOD GetPosition(nsAWritableString& aPosition) { return _to GetPosition(aPosition); } \ + NS_IMETHOD SetPosition(const nsAReadableString& aPosition) { return _to SetPosition(aPosition); } \ + NS_IMETHOD GetQuotes(nsAWritableString& aQuotes) { return _to GetQuotes(aQuotes); } \ + NS_IMETHOD SetQuotes(const nsAReadableString& aQuotes) { return _to SetQuotes(aQuotes); } \ + NS_IMETHOD GetRichness(nsAWritableString& aRichness) { return _to GetRichness(aRichness); } \ + NS_IMETHOD SetRichness(const nsAReadableString& aRichness) { return _to SetRichness(aRichness); } \ + NS_IMETHOD GetRight(nsAWritableString& aRight) { return _to GetRight(aRight); } \ + NS_IMETHOD SetRight(const nsAReadableString& aRight) { return _to SetRight(aRight); } \ + NS_IMETHOD GetSize(nsAWritableString& aSize) { return _to GetSize(aSize); } \ + NS_IMETHOD SetSize(const nsAReadableString& aSize) { return _to SetSize(aSize); } \ + NS_IMETHOD GetSpeak(nsAWritableString& aSpeak) { return _to GetSpeak(aSpeak); } \ + NS_IMETHOD SetSpeak(const nsAReadableString& aSpeak) { return _to SetSpeak(aSpeak); } \ + NS_IMETHOD GetSpeakHeader(nsAWritableString& aSpeakHeader) { return _to GetSpeakHeader(aSpeakHeader); } \ + NS_IMETHOD SetSpeakHeader(const nsAReadableString& aSpeakHeader) { return _to SetSpeakHeader(aSpeakHeader); } \ + NS_IMETHOD GetSpeakNumeral(nsAWritableString& aSpeakNumeral) { return _to GetSpeakNumeral(aSpeakNumeral); } \ + NS_IMETHOD SetSpeakNumeral(const nsAReadableString& aSpeakNumeral) { return _to SetSpeakNumeral(aSpeakNumeral); } \ + NS_IMETHOD GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation) { return _to GetSpeakPunctuation(aSpeakPunctuation); } \ + NS_IMETHOD SetSpeakPunctuation(const nsAReadableString& aSpeakPunctuation) { return _to SetSpeakPunctuation(aSpeakPunctuation); } \ + NS_IMETHOD GetSpeechRate(nsAWritableString& aSpeechRate) { return _to GetSpeechRate(aSpeechRate); } \ + NS_IMETHOD SetSpeechRate(const nsAReadableString& aSpeechRate) { return _to SetSpeechRate(aSpeechRate); } \ + NS_IMETHOD GetStress(nsAWritableString& aStress) { return _to GetStress(aStress); } \ + NS_IMETHOD SetStress(const nsAReadableString& aStress) { return _to SetStress(aStress); } \ + NS_IMETHOD GetTableLayout(nsAWritableString& aTableLayout) { return _to GetTableLayout(aTableLayout); } \ + NS_IMETHOD SetTableLayout(const nsAReadableString& aTableLayout) { return _to SetTableLayout(aTableLayout); } \ + NS_IMETHOD GetTextAlign(nsAWritableString& aTextAlign) { return _to GetTextAlign(aTextAlign); } \ + NS_IMETHOD SetTextAlign(const nsAReadableString& aTextAlign) { return _to SetTextAlign(aTextAlign); } \ + NS_IMETHOD GetTextDecoration(nsAWritableString& aTextDecoration) { return _to GetTextDecoration(aTextDecoration); } \ + NS_IMETHOD SetTextDecoration(const nsAReadableString& aTextDecoration) { return _to SetTextDecoration(aTextDecoration); } \ + NS_IMETHOD GetTextIndent(nsAWritableString& aTextIndent) { return _to GetTextIndent(aTextIndent); } \ + NS_IMETHOD SetTextIndent(const nsAReadableString& aTextIndent) { return _to SetTextIndent(aTextIndent); } \ + NS_IMETHOD GetTextShadow(nsAWritableString& aTextShadow) { return _to GetTextShadow(aTextShadow); } \ + NS_IMETHOD SetTextShadow(const nsAReadableString& aTextShadow) { return _to SetTextShadow(aTextShadow); } \ + NS_IMETHOD GetTextTransform(nsAWritableString& aTextTransform) { return _to GetTextTransform(aTextTransform); } \ + NS_IMETHOD SetTextTransform(const nsAReadableString& aTextTransform) { return _to SetTextTransform(aTextTransform); } \ + NS_IMETHOD GetTop(nsAWritableString& aTop) { return _to GetTop(aTop); } \ + NS_IMETHOD SetTop(const nsAReadableString& aTop) { return _to SetTop(aTop); } \ + NS_IMETHOD GetUnicodeBidi(nsAWritableString& aUnicodeBidi) { return _to GetUnicodeBidi(aUnicodeBidi); } \ + NS_IMETHOD SetUnicodeBidi(const nsAReadableString& aUnicodeBidi) { return _to SetUnicodeBidi(aUnicodeBidi); } \ + NS_IMETHOD GetVerticalAlign(nsAWritableString& aVerticalAlign) { return _to GetVerticalAlign(aVerticalAlign); } \ + NS_IMETHOD SetVerticalAlign(const nsAReadableString& aVerticalAlign) { return _to SetVerticalAlign(aVerticalAlign); } \ + NS_IMETHOD GetVisibility(nsAWritableString& aVisibility) { return _to GetVisibility(aVisibility); } \ + NS_IMETHOD SetVisibility(const nsAReadableString& aVisibility) { return _to SetVisibility(aVisibility); } \ + NS_IMETHOD GetVoiceFamily(nsAWritableString& aVoiceFamily) { return _to GetVoiceFamily(aVoiceFamily); } \ + NS_IMETHOD SetVoiceFamily(const nsAReadableString& aVoiceFamily) { return _to SetVoiceFamily(aVoiceFamily); } \ + NS_IMETHOD GetVolume(nsAWritableString& aVolume) { return _to GetVolume(aVolume); } \ + NS_IMETHOD SetVolume(const nsAReadableString& aVolume) { return _to SetVolume(aVolume); } \ + NS_IMETHOD GetWhiteSpace(nsAWritableString& aWhiteSpace) { return _to GetWhiteSpace(aWhiteSpace); } \ + NS_IMETHOD SetWhiteSpace(const nsAReadableString& aWhiteSpace) { return _to SetWhiteSpace(aWhiteSpace); } \ + NS_IMETHOD GetWidows(nsAWritableString& aWidows) { return _to GetWidows(aWidows); } \ + NS_IMETHOD SetWidows(const nsAReadableString& aWidows) { return _to SetWidows(aWidows); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetWordSpacing(nsAWritableString& aWordSpacing) { return _to GetWordSpacing(aWordSpacing); } \ + NS_IMETHOD SetWordSpacing(const nsAReadableString& aWordSpacing) { return _to SetWordSpacing(aWordSpacing); } \ + NS_IMETHOD GetZIndex(nsAWritableString& aZIndex) { return _to GetZIndex(aZIndex); } \ + NS_IMETHOD SetZIndex(const nsAReadableString& aZIndex) { return _to SetZIndex(aZIndex); } \ + NS_IMETHOD GetBehavior(nsAWritableString& aBehavior) { return _to GetBehavior(aBehavior); } \ + NS_IMETHOD SetBehavior(const nsAReadableString& aBehavior) { return _to SetBehavior(aBehavior); } \ + NS_IMETHOD GetOpacity(nsAWritableString& aOpacity) { return _to GetOpacity(aOpacity); } \ + NS_IMETHOD SetOpacity(const nsAReadableString& aOpacity) { return _to SetOpacity(aOpacity); } \ extern "C" NS_DOM nsresult NS_InitCSS2PropertiesClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/css/nsIDOMCSSImportRule.h b/dom/public/css/nsIDOMCSSImportRule.h index dc76e4c28227..3793c3376c4a 100644 --- a/dom/public/css/nsIDOMCSSImportRule.h +++ b/dom/public/css/nsIDOMCSSImportRule.h @@ -40,7 +40,7 @@ class nsIDOMCSSImportRule : public nsIDOMCSSRule { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSIMPORTRULE_IID; return iid; } - NS_IMETHOD GetHref(nsString& aHref)=0; + NS_IMETHOD GetHref(nsAWritableString& aHref)=0; NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia)=0; @@ -49,14 +49,14 @@ public: #define NS_DECL_IDOMCSSIMPORTRULE \ - NS_IMETHOD GetHref(nsString& aHref); \ + NS_IMETHOD GetHref(nsAWritableString& aHref); \ NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia); \ NS_IMETHOD GetStyleSheet(nsIDOMCSSStyleSheet** aStyleSheet); \ #define NS_FORWARD_IDOMCSSIMPORTRULE(_to) \ - NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \ + NS_IMETHOD GetHref(nsAWritableString& aHref) { return _to GetHref(aHref); } \ NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) { return _to GetMedia(aMedia); } \ NS_IMETHOD GetStyleSheet(nsIDOMCSSStyleSheet** aStyleSheet) { return _to GetStyleSheet(aStyleSheet); } \ diff --git a/dom/public/css/nsIDOMCSSMediaRule.h b/dom/public/css/nsIDOMCSSMediaRule.h index 5a8a286e1169..e66b8b49c118 100644 --- a/dom/public/css/nsIDOMCSSMediaRule.h +++ b/dom/public/css/nsIDOMCSSMediaRule.h @@ -44,7 +44,7 @@ public: NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules)=0; - NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn)=0; + NS_IMETHOD InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn)=0; NS_IMETHOD DeleteRule(PRUint32 aIndex)=0; }; @@ -53,7 +53,7 @@ public: #define NS_DECL_IDOMCSSMEDIARULE \ NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia); \ NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules); \ - NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn); \ + NS_IMETHOD InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn); \ NS_IMETHOD DeleteRule(PRUint32 aIndex); \ @@ -61,7 +61,7 @@ public: #define NS_FORWARD_IDOMCSSMEDIARULE(_to) \ NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) { return _to GetMedia(aMedia); } \ NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules) { return _to GetCssRules(aCssRules); } \ - NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn) { return _to InsertRule(aRule, aIndex, aReturn); } \ + NS_IMETHOD InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn) { return _to InsertRule(aRule, aIndex, aReturn); } \ NS_IMETHOD DeleteRule(PRUint32 aIndex) { return _to DeleteRule(aIndex); } \ diff --git a/dom/public/css/nsIDOMCSSPageRule.h b/dom/public/css/nsIDOMCSSPageRule.h index d8349dcd192a..7e91a6ad392b 100644 --- a/dom/public/css/nsIDOMCSSPageRule.h +++ b/dom/public/css/nsIDOMCSSPageRule.h @@ -39,23 +39,23 @@ class nsIDOMCSSPageRule : public nsIDOMCSSRule { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSPAGERULE_IID; return iid; } - NS_IMETHOD GetSelectorText(nsString& aSelectorText)=0; - NS_IMETHOD SetSelectorText(const nsString& aSelectorText)=0; + NS_IMETHOD GetSelectorText(nsAWritableString& aSelectorText)=0; + NS_IMETHOD SetSelectorText(const nsAReadableString& aSelectorText)=0; NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0; }; #define NS_DECL_IDOMCSSPAGERULE \ - NS_IMETHOD GetSelectorText(nsString& aSelectorText); \ - NS_IMETHOD SetSelectorText(const nsString& aSelectorText); \ + NS_IMETHOD GetSelectorText(nsAWritableString& aSelectorText); \ + NS_IMETHOD SetSelectorText(const nsAReadableString& aSelectorText); \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \ #define NS_FORWARD_IDOMCSSPAGERULE(_to) \ - NS_IMETHOD GetSelectorText(nsString& aSelectorText) { return _to GetSelectorText(aSelectorText); } \ - NS_IMETHOD SetSelectorText(const nsString& aSelectorText) { return _to SetSelectorText(aSelectorText); } \ + NS_IMETHOD GetSelectorText(nsAWritableString& aSelectorText) { return _to GetSelectorText(aSelectorText); } \ + NS_IMETHOD SetSelectorText(const nsAReadableString& aSelectorText) { return _to SetSelectorText(aSelectorText); } \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \ diff --git a/dom/public/css/nsIDOMCSSPrimitiveValue.h b/dom/public/css/nsIDOMCSSPrimitiveValue.h index f57bfe8a04eb..852c7e85f9ca 100644 --- a/dom/public/css/nsIDOMCSSPrimitiveValue.h +++ b/dom/public/css/nsIDOMCSSPrimitiveValue.h @@ -75,9 +75,9 @@ public: NS_IMETHOD GetFloatValue(PRUint16 aUnitType, float* aReturn)=0; - NS_IMETHOD SetStringValue(PRUint16 aStringType, const nsString& aStringValue)=0; + NS_IMETHOD SetStringValue(PRUint16 aStringType, const nsAReadableString& aStringValue)=0; - NS_IMETHOD GetStringValue(nsString& aReturn)=0; + NS_IMETHOD GetStringValue(nsAWritableString& aReturn)=0; NS_IMETHOD GetCounterValue(nsIDOMCounter** aReturn)=0; @@ -91,8 +91,8 @@ public: NS_IMETHOD GetPrimitiveType(PRUint16* aPrimitiveType); \ NS_IMETHOD SetFloatValue(PRUint16 aUnitType, float aFloatValue); \ NS_IMETHOD GetFloatValue(PRUint16 aUnitType, float* aReturn); \ - NS_IMETHOD SetStringValue(PRUint16 aStringType, const nsString& aStringValue); \ - NS_IMETHOD GetStringValue(nsString& aReturn); \ + NS_IMETHOD SetStringValue(PRUint16 aStringType, const nsAReadableString& aStringValue); \ + NS_IMETHOD GetStringValue(nsAWritableString& aReturn); \ NS_IMETHOD GetCounterValue(nsIDOMCounter** aReturn); \ NS_IMETHOD GetRectValue(nsIDOMRect** aReturn); \ NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor** aReturn); \ @@ -103,8 +103,8 @@ public: NS_IMETHOD GetPrimitiveType(PRUint16* aPrimitiveType) { return _to GetPrimitiveType(aPrimitiveType); } \ NS_IMETHOD SetFloatValue(PRUint16 aUnitType, float aFloatValue) { return _to SetFloatValue(aUnitType, aFloatValue); } \ NS_IMETHOD GetFloatValue(PRUint16 aUnitType, float* aReturn) { return _to GetFloatValue(aUnitType, aReturn); } \ - NS_IMETHOD SetStringValue(PRUint16 aStringType, const nsString& aStringValue) { return _to SetStringValue(aStringType, aStringValue); } \ - NS_IMETHOD GetStringValue(nsString& aReturn) { return _to GetStringValue(aReturn); } \ + NS_IMETHOD SetStringValue(PRUint16 aStringType, const nsAReadableString& aStringValue) { return _to SetStringValue(aStringType, aStringValue); } \ + NS_IMETHOD GetStringValue(nsAWritableString& aReturn) { return _to GetStringValue(aReturn); } \ NS_IMETHOD GetCounterValue(nsIDOMCounter** aReturn) { return _to GetCounterValue(aReturn); } \ NS_IMETHOD GetRectValue(nsIDOMRect** aReturn) { return _to GetRectValue(aReturn); } \ NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor** aReturn) { return _to GetRGBColorValue(aReturn); } \ diff --git a/dom/public/css/nsIDOMCSSRule.h b/dom/public/css/nsIDOMCSSRule.h index c9db31f0a91b..18562f2d13c0 100644 --- a/dom/public/css/nsIDOMCSSRule.h +++ b/dom/public/css/nsIDOMCSSRule.h @@ -50,8 +50,8 @@ public: NS_IMETHOD GetType(PRUint16* aType)=0; - NS_IMETHOD GetCssText(nsString& aCssText)=0; - NS_IMETHOD SetCssText(const nsString& aCssText)=0; + NS_IMETHOD GetCssText(nsAWritableString& aCssText)=0; + NS_IMETHOD SetCssText(const nsAReadableString& aCssText)=0; NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet** aParentStyleSheet)=0; @@ -61,8 +61,8 @@ public: #define NS_DECL_IDOMCSSRULE \ NS_IMETHOD GetType(PRUint16* aType); \ - NS_IMETHOD GetCssText(nsString& aCssText); \ - NS_IMETHOD SetCssText(const nsString& aCssText); \ + NS_IMETHOD GetCssText(nsAWritableString& aCssText); \ + NS_IMETHOD SetCssText(const nsAReadableString& aCssText); \ NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet** aParentStyleSheet); \ NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule); \ @@ -70,8 +70,8 @@ public: #define NS_FORWARD_IDOMCSSRULE(_to) \ NS_IMETHOD GetType(PRUint16* aType) { return _to GetType(aType); } \ - NS_IMETHOD GetCssText(nsString& aCssText) { return _to GetCssText(aCssText); } \ - NS_IMETHOD SetCssText(const nsString& aCssText) { return _to SetCssText(aCssText); } \ + NS_IMETHOD GetCssText(nsAWritableString& aCssText) { return _to GetCssText(aCssText); } \ + NS_IMETHOD SetCssText(const nsAReadableString& aCssText) { return _to SetCssText(aCssText); } \ NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet** aParentStyleSheet) { return _to GetParentStyleSheet(aParentStyleSheet); } \ NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule) { return _to GetParentRule(aParentRule); } \ diff --git a/dom/public/css/nsIDOMCSSStyleDeclaration.h b/dom/public/css/nsIDOMCSSStyleDeclaration.h index 35ef3c2f92a4..81ef5ab2a65d 100644 --- a/dom/public/css/nsIDOMCSSStyleDeclaration.h +++ b/dom/public/css/nsIDOMCSSStyleDeclaration.h @@ -39,52 +39,52 @@ class nsIDOMCSSStyleDeclaration : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSSTYLEDECLARATION_IID; return iid; } - NS_IMETHOD GetCssText(nsString& aCssText)=0; - NS_IMETHOD SetCssText(const nsString& aCssText)=0; + NS_IMETHOD GetCssText(nsAWritableString& aCssText)=0; + NS_IMETHOD SetCssText(const nsAReadableString& aCssText)=0; NS_IMETHOD GetLength(PRUint32* aLength)=0; NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule)=0; - NS_IMETHOD GetPropertyValue(const nsString& aPropertyName, nsString& aReturn)=0; + NS_IMETHOD GetPropertyValue(const nsAReadableString& aPropertyName, nsAWritableString& aReturn)=0; - NS_IMETHOD GetPropertyCSSValue(const nsString& aPropertyName, nsIDOMCSSValue** aReturn)=0; + NS_IMETHOD GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn)=0; - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, nsString& aReturn)=0; + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, nsAWritableString& aReturn)=0; - NS_IMETHOD GetPropertyPriority(const nsString& aPropertyName, nsString& aReturn)=0; + NS_IMETHOD GetPropertyPriority(const nsAReadableString& aPropertyName, nsAWritableString& aReturn)=0; - NS_IMETHOD SetProperty(const nsString& aPropertyName, const nsString& aValue, const nsString& aPriority)=0; + NS_IMETHOD SetProperty(const nsAReadableString& aPropertyName, const nsAReadableString& aValue, const nsAReadableString& aPriority)=0; - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn)=0; + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn)=0; }; #define NS_DECL_IDOMCSSSTYLEDECLARATION \ - NS_IMETHOD GetCssText(nsString& aCssText); \ - NS_IMETHOD SetCssText(const nsString& aCssText); \ + NS_IMETHOD GetCssText(nsAWritableString& aCssText); \ + NS_IMETHOD SetCssText(const nsAReadableString& aCssText); \ NS_IMETHOD GetLength(PRUint32* aLength); \ NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule); \ - NS_IMETHOD GetPropertyValue(const nsString& aPropertyName, nsString& aReturn); \ - NS_IMETHOD GetPropertyCSSValue(const nsString& aPropertyName, nsIDOMCSSValue** aReturn); \ - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, nsString& aReturn); \ - NS_IMETHOD GetPropertyPriority(const nsString& aPropertyName, nsString& aReturn); \ - NS_IMETHOD SetProperty(const nsString& aPropertyName, const nsString& aValue, const nsString& aPriority); \ - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn); \ + NS_IMETHOD GetPropertyValue(const nsAReadableString& aPropertyName, nsAWritableString& aReturn); \ + NS_IMETHOD GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn); \ + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, nsAWritableString& aReturn); \ + NS_IMETHOD GetPropertyPriority(const nsAReadableString& aPropertyName, nsAWritableString& aReturn); \ + NS_IMETHOD SetProperty(const nsAReadableString& aPropertyName, const nsAReadableString& aValue, const nsAReadableString& aPriority); \ + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn); \ #define NS_FORWARD_IDOMCSSSTYLEDECLARATION(_to) \ - NS_IMETHOD GetCssText(nsString& aCssText) { return _to GetCssText(aCssText); } \ - NS_IMETHOD SetCssText(const nsString& aCssText) { return _to SetCssText(aCssText); } \ + NS_IMETHOD GetCssText(nsAWritableString& aCssText) { return _to GetCssText(aCssText); } \ + NS_IMETHOD SetCssText(const nsAReadableString& aCssText) { return _to SetCssText(aCssText); } \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule) { return _to GetParentRule(aParentRule); } \ - NS_IMETHOD GetPropertyValue(const nsString& aPropertyName, nsString& aReturn) { return _to GetPropertyValue(aPropertyName, aReturn); } \ - NS_IMETHOD GetPropertyCSSValue(const nsString& aPropertyName, nsIDOMCSSValue** aReturn) { return _to GetPropertyCSSValue(aPropertyName, aReturn); } \ - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, nsString& aReturn) { return _to RemoveProperty(aPropertyName, aReturn); } \ - NS_IMETHOD GetPropertyPriority(const nsString& aPropertyName, nsString& aReturn) { return _to GetPropertyPriority(aPropertyName, aReturn); } \ - NS_IMETHOD SetProperty(const nsString& aPropertyName, const nsString& aValue, const nsString& aPriority) { return _to SetProperty(aPropertyName, aValue, aPriority); } \ - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn) { return _to Item(aIndex, aReturn); } \ + NS_IMETHOD GetPropertyValue(const nsAReadableString& aPropertyName, nsAWritableString& aReturn) { return _to GetPropertyValue(aPropertyName, aReturn); } \ + NS_IMETHOD GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn) { return _to GetPropertyCSSValue(aPropertyName, aReturn); } \ + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, nsAWritableString& aReturn) { return _to RemoveProperty(aPropertyName, aReturn); } \ + NS_IMETHOD GetPropertyPriority(const nsAReadableString& aPropertyName, nsAWritableString& aReturn) { return _to GetPropertyPriority(aPropertyName, aReturn); } \ + NS_IMETHOD SetProperty(const nsAReadableString& aPropertyName, const nsAReadableString& aValue, const nsAReadableString& aPriority) { return _to SetProperty(aPropertyName, aValue, aPriority); } \ + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn) { return _to Item(aIndex, aReturn); } \ extern "C" NS_DOM nsresult NS_InitCSSStyleDeclarationClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/css/nsIDOMCSSStyleRule.h b/dom/public/css/nsIDOMCSSStyleRule.h index 15126371eacb..02651b04324d 100644 --- a/dom/public/css/nsIDOMCSSStyleRule.h +++ b/dom/public/css/nsIDOMCSSStyleRule.h @@ -39,23 +39,23 @@ class nsIDOMCSSStyleRule : public nsIDOMCSSRule { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCSSSTYLERULE_IID; return iid; } - NS_IMETHOD GetSelectorText(nsString& aSelectorText)=0; - NS_IMETHOD SetSelectorText(const nsString& aSelectorText)=0; + NS_IMETHOD GetSelectorText(nsAWritableString& aSelectorText)=0; + NS_IMETHOD SetSelectorText(const nsAReadableString& aSelectorText)=0; NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0; }; #define NS_DECL_IDOMCSSSTYLERULE \ - NS_IMETHOD GetSelectorText(nsString& aSelectorText); \ - NS_IMETHOD SetSelectorText(const nsString& aSelectorText); \ + NS_IMETHOD GetSelectorText(nsAWritableString& aSelectorText); \ + NS_IMETHOD SetSelectorText(const nsAReadableString& aSelectorText); \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \ #define NS_FORWARD_IDOMCSSSTYLERULE(_to) \ - NS_IMETHOD GetSelectorText(nsString& aSelectorText) { return _to GetSelectorText(aSelectorText); } \ - NS_IMETHOD SetSelectorText(const nsString& aSelectorText) { return _to SetSelectorText(aSelectorText); } \ + NS_IMETHOD GetSelectorText(nsAWritableString& aSelectorText) { return _to GetSelectorText(aSelectorText); } \ + NS_IMETHOD SetSelectorText(const nsAReadableString& aSelectorText) { return _to SetSelectorText(aSelectorText); } \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \ diff --git a/dom/public/css/nsIDOMCSSStyleSheet.h b/dom/public/css/nsIDOMCSSStyleSheet.h index 32aabd1966e8..8939f79c6246 100644 --- a/dom/public/css/nsIDOMCSSStyleSheet.h +++ b/dom/public/css/nsIDOMCSSStyleSheet.h @@ -44,7 +44,7 @@ public: NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules)=0; - NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn)=0; + NS_IMETHOD InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn)=0; NS_IMETHOD DeleteRule(PRUint32 aIndex)=0; }; @@ -53,7 +53,7 @@ public: #define NS_DECL_IDOMCSSSTYLESHEET \ NS_IMETHOD GetOwnerRule(nsIDOMCSSRule** aOwnerRule); \ NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules); \ - NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn); \ + NS_IMETHOD InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn); \ NS_IMETHOD DeleteRule(PRUint32 aIndex); \ @@ -61,7 +61,7 @@ public: #define NS_FORWARD_IDOMCSSSTYLESHEET(_to) \ NS_IMETHOD GetOwnerRule(nsIDOMCSSRule** aOwnerRule) { return _to GetOwnerRule(aOwnerRule); } \ NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aCssRules) { return _to GetCssRules(aCssRules); } \ - NS_IMETHOD InsertRule(const nsString& aRule, PRUint32 aIndex, PRUint32* aReturn) { return _to InsertRule(aRule, aIndex, aReturn); } \ + NS_IMETHOD InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn) { return _to InsertRule(aRule, aIndex, aReturn); } \ NS_IMETHOD DeleteRule(PRUint32 aIndex) { return _to DeleteRule(aIndex); } \ diff --git a/dom/public/css/nsIDOMCSSValue.h b/dom/public/css/nsIDOMCSSValue.h index 86db54ecf61b..81a085053c6f 100644 --- a/dom/public/css/nsIDOMCSSValue.h +++ b/dom/public/css/nsIDOMCSSValue.h @@ -43,23 +43,23 @@ public: CSS_CUSTOM = 3 }; - NS_IMETHOD GetCssText(nsString& aCssText)=0; - NS_IMETHOD SetCssText(const nsString& aCssText)=0; + NS_IMETHOD GetCssText(nsAWritableString& aCssText)=0; + NS_IMETHOD SetCssText(const nsAReadableString& aCssText)=0; NS_IMETHOD GetValueType(PRUint16* aValueType)=0; }; #define NS_DECL_IDOMCSSVALUE \ - NS_IMETHOD GetCssText(nsString& aCssText); \ - NS_IMETHOD SetCssText(const nsString& aCssText); \ + NS_IMETHOD GetCssText(nsAWritableString& aCssText); \ + NS_IMETHOD SetCssText(const nsAReadableString& aCssText); \ NS_IMETHOD GetValueType(PRUint16* aValueType); \ #define NS_FORWARD_IDOMCSSVALUE(_to) \ - NS_IMETHOD GetCssText(nsString& aCssText) { return _to GetCssText(aCssText); } \ - NS_IMETHOD SetCssText(const nsString& aCssText) { return _to SetCssText(aCssText); } \ + NS_IMETHOD GetCssText(nsAWritableString& aCssText) { return _to GetCssText(aCssText); } \ + NS_IMETHOD SetCssText(const nsAReadableString& aCssText) { return _to SetCssText(aCssText); } \ NS_IMETHOD GetValueType(PRUint16* aValueType) { return _to GetValueType(aValueType); } \ diff --git a/dom/public/css/nsIDOMCounter.h b/dom/public/css/nsIDOMCounter.h index a4e11bd1ec3d..cfdb7123be50 100644 --- a/dom/public/css/nsIDOMCounter.h +++ b/dom/public/css/nsIDOMCounter.h @@ -37,25 +37,25 @@ class nsIDOMCounter : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMCOUNTER_IID; return iid; } - NS_IMETHOD GetIdentifier(nsString& aIdentifier)=0; + NS_IMETHOD GetIdentifier(nsAWritableString& aIdentifier)=0; - NS_IMETHOD GetListStyle(nsString& aListStyle)=0; + NS_IMETHOD GetListStyle(nsAWritableString& aListStyle)=0; - NS_IMETHOD GetSeparator(nsString& aSeparator)=0; + NS_IMETHOD GetSeparator(nsAWritableString& aSeparator)=0; }; #define NS_DECL_IDOMCOUNTER \ - NS_IMETHOD GetIdentifier(nsString& aIdentifier); \ - NS_IMETHOD GetListStyle(nsString& aListStyle); \ - NS_IMETHOD GetSeparator(nsString& aSeparator); \ + NS_IMETHOD GetIdentifier(nsAWritableString& aIdentifier); \ + NS_IMETHOD GetListStyle(nsAWritableString& aListStyle); \ + NS_IMETHOD GetSeparator(nsAWritableString& aSeparator); \ #define NS_FORWARD_IDOMCOUNTER(_to) \ - NS_IMETHOD GetIdentifier(nsString& aIdentifier) { return _to GetIdentifier(aIdentifier); } \ - NS_IMETHOD GetListStyle(nsString& aListStyle) { return _to GetListStyle(aListStyle); } \ - NS_IMETHOD GetSeparator(nsString& aSeparator) { return _to GetSeparator(aSeparator); } \ + NS_IMETHOD GetIdentifier(nsAWritableString& aIdentifier) { return _to GetIdentifier(aIdentifier); } \ + NS_IMETHOD GetListStyle(nsAWritableString& aListStyle) { return _to GetListStyle(aListStyle); } \ + NS_IMETHOD GetSeparator(nsAWritableString& aSeparator) { return _to GetSeparator(aSeparator); } \ extern "C" NS_DOM nsresult NS_InitCounterClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLAnchorElement.h b/dom/public/html/nsIDOMHTMLAnchorElement.h index 56352b00ec20..07403798c1c8 100644 --- a/dom/public/html/nsIDOMHTMLAnchorElement.h +++ b/dom/public/html/nsIDOMHTMLAnchorElement.h @@ -38,41 +38,41 @@ class nsIDOMHTMLAnchorElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLANCHORELEMENT_IID; return iid; } - NS_IMETHOD GetAccessKey(nsString& aAccessKey)=0; - NS_IMETHOD SetAccessKey(const nsString& aAccessKey)=0; + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey)=0; + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey)=0; - NS_IMETHOD GetCharset(nsString& aCharset)=0; - NS_IMETHOD SetCharset(const nsString& aCharset)=0; + NS_IMETHOD GetCharset(nsAWritableString& aCharset)=0; + NS_IMETHOD SetCharset(const nsAReadableString& aCharset)=0; - NS_IMETHOD GetCoords(nsString& aCoords)=0; - NS_IMETHOD SetCoords(const nsString& aCoords)=0; + NS_IMETHOD GetCoords(nsAWritableString& aCoords)=0; + NS_IMETHOD SetCoords(const nsAReadableString& aCoords)=0; - NS_IMETHOD GetHref(nsString& aHref)=0; - NS_IMETHOD SetHref(const nsString& aHref)=0; + NS_IMETHOD GetHref(nsAWritableString& aHref)=0; + NS_IMETHOD SetHref(const nsAReadableString& aHref)=0; - NS_IMETHOD GetHreflang(nsString& aHreflang)=0; - NS_IMETHOD SetHreflang(const nsString& aHreflang)=0; + NS_IMETHOD GetHreflang(nsAWritableString& aHreflang)=0; + NS_IMETHOD SetHreflang(const nsAReadableString& aHreflang)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetRel(nsString& aRel)=0; - NS_IMETHOD SetRel(const nsString& aRel)=0; + NS_IMETHOD GetRel(nsAWritableString& aRel)=0; + NS_IMETHOD SetRel(const nsAReadableString& aRel)=0; - NS_IMETHOD GetRev(nsString& aRev)=0; - NS_IMETHOD SetRev(const nsString& aRev)=0; + NS_IMETHOD GetRev(nsAWritableString& aRev)=0; + NS_IMETHOD SetRev(const nsAReadableString& aRev)=0; - NS_IMETHOD GetShape(nsString& aShape)=0; - NS_IMETHOD SetShape(const nsString& aShape)=0; + NS_IMETHOD GetShape(nsAWritableString& aShape)=0; + NS_IMETHOD SetShape(const nsAReadableString& aShape)=0; NS_IMETHOD GetTabIndex(PRInt32* aTabIndex)=0; NS_IMETHOD SetTabIndex(PRInt32 aTabIndex)=0; - NS_IMETHOD GetTarget(nsString& aTarget)=0; - NS_IMETHOD SetTarget(const nsString& aTarget)=0; + NS_IMETHOD GetTarget(nsAWritableString& aTarget)=0; + NS_IMETHOD SetTarget(const nsAReadableString& aTarget)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; NS_IMETHOD Blur()=0; @@ -81,60 +81,60 @@ public: #define NS_DECL_IDOMHTMLANCHORELEMENT \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey); \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); \ - NS_IMETHOD GetCharset(nsString& aCharset); \ - NS_IMETHOD SetCharset(const nsString& aCharset); \ - NS_IMETHOD GetCoords(nsString& aCoords); \ - NS_IMETHOD SetCoords(const nsString& aCoords); \ - NS_IMETHOD GetHref(nsString& aHref); \ - NS_IMETHOD SetHref(const nsString& aHref); \ - NS_IMETHOD GetHreflang(nsString& aHreflang); \ - NS_IMETHOD SetHreflang(const nsString& aHreflang); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetRel(nsString& aRel); \ - NS_IMETHOD SetRel(const nsString& aRel); \ - NS_IMETHOD GetRev(nsString& aRev); \ - NS_IMETHOD SetRev(const nsString& aRev); \ - NS_IMETHOD GetShape(nsString& aShape); \ - NS_IMETHOD SetShape(const nsString& aShape); \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey); \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey); \ + NS_IMETHOD GetCharset(nsAWritableString& aCharset); \ + NS_IMETHOD SetCharset(const nsAReadableString& aCharset); \ + NS_IMETHOD GetCoords(nsAWritableString& aCoords); \ + NS_IMETHOD SetCoords(const nsAReadableString& aCoords); \ + NS_IMETHOD GetHref(nsAWritableString& aHref); \ + NS_IMETHOD SetHref(const nsAReadableString& aHref); \ + NS_IMETHOD GetHreflang(nsAWritableString& aHreflang); \ + NS_IMETHOD SetHreflang(const nsAReadableString& aHreflang); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetRel(nsAWritableString& aRel); \ + NS_IMETHOD SetRel(const nsAReadableString& aRel); \ + NS_IMETHOD GetRev(nsAWritableString& aRev); \ + NS_IMETHOD SetRev(const nsAReadableString& aRev); \ + NS_IMETHOD GetShape(nsAWritableString& aShape); \ + NS_IMETHOD SetShape(const nsAReadableString& aShape); \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); \ - NS_IMETHOD GetTarget(nsString& aTarget); \ - NS_IMETHOD SetTarget(const nsString& aTarget); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget); \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ NS_IMETHOD Blur(); \ NS_IMETHOD Focus(); \ #define NS_FORWARD_IDOMHTMLANCHORELEMENT(_to) \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ - NS_IMETHOD GetCharset(nsString& aCharset) { return _to GetCharset(aCharset); } \ - NS_IMETHOD SetCharset(const nsString& aCharset) { return _to SetCharset(aCharset); } \ - NS_IMETHOD GetCoords(nsString& aCoords) { return _to GetCoords(aCoords); } \ - NS_IMETHOD SetCoords(const nsString& aCoords) { return _to SetCoords(aCoords); } \ - NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \ - NS_IMETHOD SetHref(const nsString& aHref) { return _to SetHref(aHref); } \ - NS_IMETHOD GetHreflang(nsString& aHreflang) { return _to GetHreflang(aHreflang); } \ - NS_IMETHOD SetHreflang(const nsString& aHreflang) { return _to SetHreflang(aHreflang); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetRel(nsString& aRel) { return _to GetRel(aRel); } \ - NS_IMETHOD SetRel(const nsString& aRel) { return _to SetRel(aRel); } \ - NS_IMETHOD GetRev(nsString& aRev) { return _to GetRev(aRev); } \ - NS_IMETHOD SetRev(const nsString& aRev) { return _to SetRev(aRev); } \ - NS_IMETHOD GetShape(nsString& aShape) { return _to GetShape(aShape); } \ - NS_IMETHOD SetShape(const nsString& aShape) { return _to SetShape(aShape); } \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ + NS_IMETHOD GetCharset(nsAWritableString& aCharset) { return _to GetCharset(aCharset); } \ + NS_IMETHOD SetCharset(const nsAReadableString& aCharset) { return _to SetCharset(aCharset); } \ + NS_IMETHOD GetCoords(nsAWritableString& aCoords) { return _to GetCoords(aCoords); } \ + NS_IMETHOD SetCoords(const nsAReadableString& aCoords) { return _to SetCoords(aCoords); } \ + NS_IMETHOD GetHref(nsAWritableString& aHref) { return _to GetHref(aHref); } \ + NS_IMETHOD SetHref(const nsAReadableString& aHref) { return _to SetHref(aHref); } \ + NS_IMETHOD GetHreflang(nsAWritableString& aHreflang) { return _to GetHreflang(aHreflang); } \ + NS_IMETHOD SetHreflang(const nsAReadableString& aHreflang) { return _to SetHreflang(aHreflang); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetRel(nsAWritableString& aRel) { return _to GetRel(aRel); } \ + NS_IMETHOD SetRel(const nsAReadableString& aRel) { return _to SetRel(aRel); } \ + NS_IMETHOD GetRev(nsAWritableString& aRev) { return _to GetRev(aRev); } \ + NS_IMETHOD SetRev(const nsAReadableString& aRev) { return _to SetRev(aRev); } \ + NS_IMETHOD GetShape(nsAWritableString& aShape) { return _to GetShape(aShape); } \ + NS_IMETHOD SetShape(const nsAReadableString& aShape) { return _to SetShape(aShape); } \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) { return _to SetTabIndex(aTabIndex); } \ - NS_IMETHOD GetTarget(nsString& aTarget) { return _to GetTarget(aTarget); } \ - NS_IMETHOD SetTarget(const nsString& aTarget) { return _to SetTarget(aTarget); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget) { return _to GetTarget(aTarget); } \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget) { return _to SetTarget(aTarget); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ NS_IMETHOD Blur() { return _to Blur(); } \ NS_IMETHOD Focus() { return _to Focus(); } \ diff --git a/dom/public/html/nsIDOMHTMLAppletElement.h b/dom/public/html/nsIDOMHTMLAppletElement.h index fd8eeafa3fe5..d31795160b42 100644 --- a/dom/public/html/nsIDOMHTMLAppletElement.h +++ b/dom/public/html/nsIDOMHTMLAppletElement.h @@ -38,90 +38,90 @@ class nsIDOMHTMLAppletElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLAPPLETELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetAlt(nsString& aAlt)=0; - NS_IMETHOD SetAlt(const nsString& aAlt)=0; + NS_IMETHOD GetAlt(nsAWritableString& aAlt)=0; + NS_IMETHOD SetAlt(const nsAReadableString& aAlt)=0; - NS_IMETHOD GetArchive(nsString& aArchive)=0; - NS_IMETHOD SetArchive(const nsString& aArchive)=0; + NS_IMETHOD GetArchive(nsAWritableString& aArchive)=0; + NS_IMETHOD SetArchive(const nsAReadableString& aArchive)=0; - NS_IMETHOD GetCode(nsString& aCode)=0; - NS_IMETHOD SetCode(const nsString& aCode)=0; + NS_IMETHOD GetCode(nsAWritableString& aCode)=0; + NS_IMETHOD SetCode(const nsAReadableString& aCode)=0; - NS_IMETHOD GetCodeBase(nsString& aCodeBase)=0; - NS_IMETHOD SetCodeBase(const nsString& aCodeBase)=0; + NS_IMETHOD GetCodeBase(nsAWritableString& aCodeBase)=0; + NS_IMETHOD SetCodeBase(const nsAReadableString& aCodeBase)=0; - NS_IMETHOD GetHeight(nsString& aHeight)=0; - NS_IMETHOD SetHeight(const nsString& aHeight)=0; + NS_IMETHOD GetHeight(nsAWritableString& aHeight)=0; + NS_IMETHOD SetHeight(const nsAReadableString& aHeight)=0; - NS_IMETHOD GetHspace(nsString& aHspace)=0; - NS_IMETHOD SetHspace(const nsString& aHspace)=0; + NS_IMETHOD GetHspace(nsAWritableString& aHspace)=0; + NS_IMETHOD SetHspace(const nsAReadableString& aHspace)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetObject(nsString& aObject)=0; - NS_IMETHOD SetObject(const nsString& aObject)=0; + NS_IMETHOD GetObject(nsAWritableString& aObject)=0; + NS_IMETHOD SetObject(const nsAReadableString& aObject)=0; - NS_IMETHOD GetVspace(nsString& aVspace)=0; - NS_IMETHOD SetVspace(const nsString& aVspace)=0; + NS_IMETHOD GetVspace(nsAWritableString& aVspace)=0; + NS_IMETHOD SetVspace(const nsAReadableString& aVspace)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; }; #define NS_DECL_IDOMHTMLAPPLETELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetAlt(nsString& aAlt); \ - NS_IMETHOD SetAlt(const nsString& aAlt); \ - NS_IMETHOD GetArchive(nsString& aArchive); \ - NS_IMETHOD SetArchive(const nsString& aArchive); \ - NS_IMETHOD GetCode(nsString& aCode); \ - NS_IMETHOD SetCode(const nsString& aCode); \ - NS_IMETHOD GetCodeBase(nsString& aCodeBase); \ - NS_IMETHOD SetCodeBase(const nsString& aCodeBase); \ - NS_IMETHOD GetHeight(nsString& aHeight); \ - NS_IMETHOD SetHeight(const nsString& aHeight); \ - NS_IMETHOD GetHspace(nsString& aHspace); \ - NS_IMETHOD SetHspace(const nsString& aHspace); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetObject(nsString& aObject); \ - NS_IMETHOD SetObject(const nsString& aObject); \ - NS_IMETHOD GetVspace(nsString& aVspace); \ - NS_IMETHOD SetVspace(const nsString& aVspace); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt); \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt); \ + NS_IMETHOD GetArchive(nsAWritableString& aArchive); \ + NS_IMETHOD SetArchive(const nsAReadableString& aArchive); \ + NS_IMETHOD GetCode(nsAWritableString& aCode); \ + NS_IMETHOD SetCode(const nsAReadableString& aCode); \ + NS_IMETHOD GetCodeBase(nsAWritableString& aCodeBase); \ + NS_IMETHOD SetCodeBase(const nsAReadableString& aCodeBase); \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight); \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight); \ + NS_IMETHOD GetHspace(nsAWritableString& aHspace); \ + NS_IMETHOD SetHspace(const nsAReadableString& aHspace); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetObject(nsAWritableString& aObject); \ + NS_IMETHOD SetObject(const nsAReadableString& aObject); \ + NS_IMETHOD GetVspace(nsAWritableString& aVspace); \ + NS_IMETHOD SetVspace(const nsAReadableString& aVspace); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ #define NS_FORWARD_IDOMHTMLAPPLETELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetAlt(nsString& aAlt) { return _to GetAlt(aAlt); } \ - NS_IMETHOD SetAlt(const nsString& aAlt) { return _to SetAlt(aAlt); } \ - NS_IMETHOD GetArchive(nsString& aArchive) { return _to GetArchive(aArchive); } \ - NS_IMETHOD SetArchive(const nsString& aArchive) { return _to SetArchive(aArchive); } \ - NS_IMETHOD GetCode(nsString& aCode) { return _to GetCode(aCode); } \ - NS_IMETHOD SetCode(const nsString& aCode) { return _to SetCode(aCode); } \ - NS_IMETHOD GetCodeBase(nsString& aCodeBase) { return _to GetCodeBase(aCodeBase); } \ - NS_IMETHOD SetCodeBase(const nsString& aCodeBase) { return _to SetCodeBase(aCodeBase); } \ - NS_IMETHOD GetHeight(nsString& aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD SetHeight(const nsString& aHeight) { return _to SetHeight(aHeight); } \ - NS_IMETHOD GetHspace(nsString& aHspace) { return _to GetHspace(aHspace); } \ - NS_IMETHOD SetHspace(const nsString& aHspace) { return _to SetHspace(aHspace); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetObject(nsString& aObject) { return _to GetObject(aObject); } \ - NS_IMETHOD SetObject(const nsString& aObject) { return _to SetObject(aObject); } \ - NS_IMETHOD GetVspace(nsString& aVspace) { return _to GetVspace(aVspace); } \ - NS_IMETHOD SetVspace(const nsString& aVspace) { return _to SetVspace(aVspace); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt) { return _to GetAlt(aAlt); } \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt) { return _to SetAlt(aAlt); } \ + NS_IMETHOD GetArchive(nsAWritableString& aArchive) { return _to GetArchive(aArchive); } \ + NS_IMETHOD SetArchive(const nsAReadableString& aArchive) { return _to SetArchive(aArchive); } \ + NS_IMETHOD GetCode(nsAWritableString& aCode) { return _to GetCode(aCode); } \ + NS_IMETHOD SetCode(const nsAReadableString& aCode) { return _to SetCode(aCode); } \ + NS_IMETHOD GetCodeBase(nsAWritableString& aCodeBase) { return _to GetCodeBase(aCodeBase); } \ + NS_IMETHOD SetCodeBase(const nsAReadableString& aCodeBase) { return _to SetCodeBase(aCodeBase); } \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight) { return _to GetHeight(aHeight); } \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight) { return _to SetHeight(aHeight); } \ + NS_IMETHOD GetHspace(nsAWritableString& aHspace) { return _to GetHspace(aHspace); } \ + NS_IMETHOD SetHspace(const nsAReadableString& aHspace) { return _to SetHspace(aHspace); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetObject(nsAWritableString& aObject) { return _to GetObject(aObject); } \ + NS_IMETHOD SetObject(const nsAReadableString& aObject) { return _to SetObject(aObject); } \ + NS_IMETHOD GetVspace(nsAWritableString& aVspace) { return _to GetVspace(aVspace); } \ + NS_IMETHOD SetVspace(const nsAReadableString& aVspace) { return _to SetVspace(aVspace); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ extern "C" NS_DOM nsresult NS_InitHTMLAppletElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLAreaElement.h b/dom/public/html/nsIDOMHTMLAreaElement.h index 8d4083091f5a..e21cabed0759 100644 --- a/dom/public/html/nsIDOMHTMLAreaElement.h +++ b/dom/public/html/nsIDOMHTMLAreaElement.h @@ -38,69 +38,69 @@ class nsIDOMHTMLAreaElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLAREAELEMENT_IID; return iid; } - NS_IMETHOD GetAccessKey(nsString& aAccessKey)=0; - NS_IMETHOD SetAccessKey(const nsString& aAccessKey)=0; + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey)=0; + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey)=0; - NS_IMETHOD GetAlt(nsString& aAlt)=0; - NS_IMETHOD SetAlt(const nsString& aAlt)=0; + NS_IMETHOD GetAlt(nsAWritableString& aAlt)=0; + NS_IMETHOD SetAlt(const nsAReadableString& aAlt)=0; - NS_IMETHOD GetCoords(nsString& aCoords)=0; - NS_IMETHOD SetCoords(const nsString& aCoords)=0; + NS_IMETHOD GetCoords(nsAWritableString& aCoords)=0; + NS_IMETHOD SetCoords(const nsAReadableString& aCoords)=0; - NS_IMETHOD GetHref(nsString& aHref)=0; - NS_IMETHOD SetHref(const nsString& aHref)=0; + NS_IMETHOD GetHref(nsAWritableString& aHref)=0; + NS_IMETHOD SetHref(const nsAReadableString& aHref)=0; NS_IMETHOD GetNoHref(PRBool* aNoHref)=0; NS_IMETHOD SetNoHref(PRBool aNoHref)=0; - NS_IMETHOD GetShape(nsString& aShape)=0; - NS_IMETHOD SetShape(const nsString& aShape)=0; + NS_IMETHOD GetShape(nsAWritableString& aShape)=0; + NS_IMETHOD SetShape(const nsAReadableString& aShape)=0; NS_IMETHOD GetTabIndex(PRInt32* aTabIndex)=0; NS_IMETHOD SetTabIndex(PRInt32 aTabIndex)=0; - NS_IMETHOD GetTarget(nsString& aTarget)=0; - NS_IMETHOD SetTarget(const nsString& aTarget)=0; + NS_IMETHOD GetTarget(nsAWritableString& aTarget)=0; + NS_IMETHOD SetTarget(const nsAReadableString& aTarget)=0; }; #define NS_DECL_IDOMHTMLAREAELEMENT \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey); \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); \ - NS_IMETHOD GetAlt(nsString& aAlt); \ - NS_IMETHOD SetAlt(const nsString& aAlt); \ - NS_IMETHOD GetCoords(nsString& aCoords); \ - NS_IMETHOD SetCoords(const nsString& aCoords); \ - NS_IMETHOD GetHref(nsString& aHref); \ - NS_IMETHOD SetHref(const nsString& aHref); \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey); \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey); \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt); \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt); \ + NS_IMETHOD GetCoords(nsAWritableString& aCoords); \ + NS_IMETHOD SetCoords(const nsAReadableString& aCoords); \ + NS_IMETHOD GetHref(nsAWritableString& aHref); \ + NS_IMETHOD SetHref(const nsAReadableString& aHref); \ NS_IMETHOD GetNoHref(PRBool* aNoHref); \ NS_IMETHOD SetNoHref(PRBool aNoHref); \ - NS_IMETHOD GetShape(nsString& aShape); \ - NS_IMETHOD SetShape(const nsString& aShape); \ + NS_IMETHOD GetShape(nsAWritableString& aShape); \ + NS_IMETHOD SetShape(const nsAReadableString& aShape); \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); \ - NS_IMETHOD GetTarget(nsString& aTarget); \ - NS_IMETHOD SetTarget(const nsString& aTarget); \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget); \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget); \ #define NS_FORWARD_IDOMHTMLAREAELEMENT(_to) \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ - NS_IMETHOD GetAlt(nsString& aAlt) { return _to GetAlt(aAlt); } \ - NS_IMETHOD SetAlt(const nsString& aAlt) { return _to SetAlt(aAlt); } \ - NS_IMETHOD GetCoords(nsString& aCoords) { return _to GetCoords(aCoords); } \ - NS_IMETHOD SetCoords(const nsString& aCoords) { return _to SetCoords(aCoords); } \ - NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \ - NS_IMETHOD SetHref(const nsString& aHref) { return _to SetHref(aHref); } \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt) { return _to GetAlt(aAlt); } \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt) { return _to SetAlt(aAlt); } \ + NS_IMETHOD GetCoords(nsAWritableString& aCoords) { return _to GetCoords(aCoords); } \ + NS_IMETHOD SetCoords(const nsAReadableString& aCoords) { return _to SetCoords(aCoords); } \ + NS_IMETHOD GetHref(nsAWritableString& aHref) { return _to GetHref(aHref); } \ + NS_IMETHOD SetHref(const nsAReadableString& aHref) { return _to SetHref(aHref); } \ NS_IMETHOD GetNoHref(PRBool* aNoHref) { return _to GetNoHref(aNoHref); } \ NS_IMETHOD SetNoHref(PRBool aNoHref) { return _to SetNoHref(aNoHref); } \ - NS_IMETHOD GetShape(nsString& aShape) { return _to GetShape(aShape); } \ - NS_IMETHOD SetShape(const nsString& aShape) { return _to SetShape(aShape); } \ + NS_IMETHOD GetShape(nsAWritableString& aShape) { return _to GetShape(aShape); } \ + NS_IMETHOD SetShape(const nsAReadableString& aShape) { return _to SetShape(aShape); } \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) { return _to SetTabIndex(aTabIndex); } \ - NS_IMETHOD GetTarget(nsString& aTarget) { return _to GetTarget(aTarget); } \ - NS_IMETHOD SetTarget(const nsString& aTarget) { return _to SetTarget(aTarget); } \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget) { return _to GetTarget(aTarget); } \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget) { return _to SetTarget(aTarget); } \ extern "C" NS_DOM nsresult NS_InitHTMLAreaElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLBRElement.h b/dom/public/html/nsIDOMHTMLBRElement.h index c00d071a05d2..bd87eef0939f 100644 --- a/dom/public/html/nsIDOMHTMLBRElement.h +++ b/dom/public/html/nsIDOMHTMLBRElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLBRElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLBRELEMENT_IID; return iid; } - NS_IMETHOD GetClear(nsString& aClear)=0; - NS_IMETHOD SetClear(const nsString& aClear)=0; + NS_IMETHOD GetClear(nsAWritableString& aClear)=0; + NS_IMETHOD SetClear(const nsAReadableString& aClear)=0; }; #define NS_DECL_IDOMHTMLBRELEMENT \ - NS_IMETHOD GetClear(nsString& aClear); \ - NS_IMETHOD SetClear(const nsString& aClear); \ + NS_IMETHOD GetClear(nsAWritableString& aClear); \ + NS_IMETHOD SetClear(const nsAReadableString& aClear); \ #define NS_FORWARD_IDOMHTMLBRELEMENT(_to) \ - NS_IMETHOD GetClear(nsString& aClear) { return _to GetClear(aClear); } \ - NS_IMETHOD SetClear(const nsString& aClear) { return _to SetClear(aClear); } \ + NS_IMETHOD GetClear(nsAWritableString& aClear) { return _to GetClear(aClear); } \ + NS_IMETHOD SetClear(const nsAReadableString& aClear) { return _to SetClear(aClear); } \ extern "C" NS_DOM nsresult NS_InitHTMLBRElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLBaseElement.h b/dom/public/html/nsIDOMHTMLBaseElement.h index 5742ba174a4d..712f0d217b28 100644 --- a/dom/public/html/nsIDOMHTMLBaseElement.h +++ b/dom/public/html/nsIDOMHTMLBaseElement.h @@ -38,27 +38,27 @@ class nsIDOMHTMLBaseElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLBASEELEMENT_IID; return iid; } - NS_IMETHOD GetHref(nsString& aHref)=0; - NS_IMETHOD SetHref(const nsString& aHref)=0; + NS_IMETHOD GetHref(nsAWritableString& aHref)=0; + NS_IMETHOD SetHref(const nsAReadableString& aHref)=0; - NS_IMETHOD GetTarget(nsString& aTarget)=0; - NS_IMETHOD SetTarget(const nsString& aTarget)=0; + NS_IMETHOD GetTarget(nsAWritableString& aTarget)=0; + NS_IMETHOD SetTarget(const nsAReadableString& aTarget)=0; }; #define NS_DECL_IDOMHTMLBASEELEMENT \ - NS_IMETHOD GetHref(nsString& aHref); \ - NS_IMETHOD SetHref(const nsString& aHref); \ - NS_IMETHOD GetTarget(nsString& aTarget); \ - NS_IMETHOD SetTarget(const nsString& aTarget); \ + NS_IMETHOD GetHref(nsAWritableString& aHref); \ + NS_IMETHOD SetHref(const nsAReadableString& aHref); \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget); \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget); \ #define NS_FORWARD_IDOMHTMLBASEELEMENT(_to) \ - NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \ - NS_IMETHOD SetHref(const nsString& aHref) { return _to SetHref(aHref); } \ - NS_IMETHOD GetTarget(nsString& aTarget) { return _to GetTarget(aTarget); } \ - NS_IMETHOD SetTarget(const nsString& aTarget) { return _to SetTarget(aTarget); } \ + NS_IMETHOD GetHref(nsAWritableString& aHref) { return _to GetHref(aHref); } \ + NS_IMETHOD SetHref(const nsAReadableString& aHref) { return _to SetHref(aHref); } \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget) { return _to GetTarget(aTarget); } \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget) { return _to SetTarget(aTarget); } \ extern "C" NS_DOM nsresult NS_InitHTMLBaseElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLBaseFontElement.h b/dom/public/html/nsIDOMHTMLBaseFontElement.h index c2abdba5a7c5..4a65836fce00 100644 --- a/dom/public/html/nsIDOMHTMLBaseFontElement.h +++ b/dom/public/html/nsIDOMHTMLBaseFontElement.h @@ -38,34 +38,34 @@ class nsIDOMHTMLBaseFontElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLBASEFONTELEMENT_IID; return iid; } - NS_IMETHOD GetColor(nsString& aColor)=0; - NS_IMETHOD SetColor(const nsString& aColor)=0; + NS_IMETHOD GetColor(nsAWritableString& aColor)=0; + NS_IMETHOD SetColor(const nsAReadableString& aColor)=0; - NS_IMETHOD GetFace(nsString& aFace)=0; - NS_IMETHOD SetFace(const nsString& aFace)=0; + NS_IMETHOD GetFace(nsAWritableString& aFace)=0; + NS_IMETHOD SetFace(const nsAReadableString& aFace)=0; - NS_IMETHOD GetSize(nsString& aSize)=0; - NS_IMETHOD SetSize(const nsString& aSize)=0; + NS_IMETHOD GetSize(nsAWritableString& aSize)=0; + NS_IMETHOD SetSize(const nsAReadableString& aSize)=0; }; #define NS_DECL_IDOMHTMLBASEFONTELEMENT \ - NS_IMETHOD GetColor(nsString& aColor); \ - NS_IMETHOD SetColor(const nsString& aColor); \ - NS_IMETHOD GetFace(nsString& aFace); \ - NS_IMETHOD SetFace(const nsString& aFace); \ - NS_IMETHOD GetSize(nsString& aSize); \ - NS_IMETHOD SetSize(const nsString& aSize); \ + NS_IMETHOD GetColor(nsAWritableString& aColor); \ + NS_IMETHOD SetColor(const nsAReadableString& aColor); \ + NS_IMETHOD GetFace(nsAWritableString& aFace); \ + NS_IMETHOD SetFace(const nsAReadableString& aFace); \ + NS_IMETHOD GetSize(nsAWritableString& aSize); \ + NS_IMETHOD SetSize(const nsAReadableString& aSize); \ #define NS_FORWARD_IDOMHTMLBASEFONTELEMENT(_to) \ - NS_IMETHOD GetColor(nsString& aColor) { return _to GetColor(aColor); } \ - NS_IMETHOD SetColor(const nsString& aColor) { return _to SetColor(aColor); } \ - NS_IMETHOD GetFace(nsString& aFace) { return _to GetFace(aFace); } \ - NS_IMETHOD SetFace(const nsString& aFace) { return _to SetFace(aFace); } \ - NS_IMETHOD GetSize(nsString& aSize) { return _to GetSize(aSize); } \ - NS_IMETHOD SetSize(const nsString& aSize) { return _to SetSize(aSize); } \ + NS_IMETHOD GetColor(nsAWritableString& aColor) { return _to GetColor(aColor); } \ + NS_IMETHOD SetColor(const nsAReadableString& aColor) { return _to SetColor(aColor); } \ + NS_IMETHOD GetFace(nsAWritableString& aFace) { return _to GetFace(aFace); } \ + NS_IMETHOD SetFace(const nsAReadableString& aFace) { return _to SetFace(aFace); } \ + NS_IMETHOD GetSize(nsAWritableString& aSize) { return _to GetSize(aSize); } \ + NS_IMETHOD SetSize(const nsAReadableString& aSize) { return _to SetSize(aSize); } \ extern "C" NS_DOM nsresult NS_InitHTMLBaseFontElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLBodyElement.h b/dom/public/html/nsIDOMHTMLBodyElement.h index 1795a43f47bd..f5821ad856a3 100644 --- a/dom/public/html/nsIDOMHTMLBodyElement.h +++ b/dom/public/html/nsIDOMHTMLBodyElement.h @@ -38,55 +38,55 @@ class nsIDOMHTMLBodyElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLBODYELEMENT_IID; return iid; } - NS_IMETHOD GetALink(nsString& aALink)=0; - NS_IMETHOD SetALink(const nsString& aALink)=0; + NS_IMETHOD GetALink(nsAWritableString& aALink)=0; + NS_IMETHOD SetALink(const nsAReadableString& aALink)=0; - NS_IMETHOD GetBackground(nsString& aBackground)=0; - NS_IMETHOD SetBackground(const nsString& aBackground)=0; + NS_IMETHOD GetBackground(nsAWritableString& aBackground)=0; + NS_IMETHOD SetBackground(const nsAReadableString& aBackground)=0; - NS_IMETHOD GetBgColor(nsString& aBgColor)=0; - NS_IMETHOD SetBgColor(const nsString& aBgColor)=0; + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor)=0; + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor)=0; - NS_IMETHOD GetLink(nsString& aLink)=0; - NS_IMETHOD SetLink(const nsString& aLink)=0; + NS_IMETHOD GetLink(nsAWritableString& aLink)=0; + NS_IMETHOD SetLink(const nsAReadableString& aLink)=0; - NS_IMETHOD GetText(nsString& aText)=0; - NS_IMETHOD SetText(const nsString& aText)=0; + NS_IMETHOD GetText(nsAWritableString& aText)=0; + NS_IMETHOD SetText(const nsAReadableString& aText)=0; - NS_IMETHOD GetVLink(nsString& aVLink)=0; - NS_IMETHOD SetVLink(const nsString& aVLink)=0; + NS_IMETHOD GetVLink(nsAWritableString& aVLink)=0; + NS_IMETHOD SetVLink(const nsAReadableString& aVLink)=0; }; #define NS_DECL_IDOMHTMLBODYELEMENT \ - NS_IMETHOD GetALink(nsString& aALink); \ - NS_IMETHOD SetALink(const nsString& aALink); \ - NS_IMETHOD GetBackground(nsString& aBackground); \ - NS_IMETHOD SetBackground(const nsString& aBackground); \ - NS_IMETHOD GetBgColor(nsString& aBgColor); \ - NS_IMETHOD SetBgColor(const nsString& aBgColor); \ - NS_IMETHOD GetLink(nsString& aLink); \ - NS_IMETHOD SetLink(const nsString& aLink); \ - NS_IMETHOD GetText(nsString& aText); \ - NS_IMETHOD SetText(const nsString& aText); \ - NS_IMETHOD GetVLink(nsString& aVLink); \ - NS_IMETHOD SetVLink(const nsString& aVLink); \ + NS_IMETHOD GetALink(nsAWritableString& aALink); \ + NS_IMETHOD SetALink(const nsAReadableString& aALink); \ + NS_IMETHOD GetBackground(nsAWritableString& aBackground); \ + NS_IMETHOD SetBackground(const nsAReadableString& aBackground); \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor); \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor); \ + NS_IMETHOD GetLink(nsAWritableString& aLink); \ + NS_IMETHOD SetLink(const nsAReadableString& aLink); \ + NS_IMETHOD GetText(nsAWritableString& aText); \ + NS_IMETHOD SetText(const nsAReadableString& aText); \ + NS_IMETHOD GetVLink(nsAWritableString& aVLink); \ + NS_IMETHOD SetVLink(const nsAReadableString& aVLink); \ #define NS_FORWARD_IDOMHTMLBODYELEMENT(_to) \ - NS_IMETHOD GetALink(nsString& aALink) { return _to GetALink(aALink); } \ - NS_IMETHOD SetALink(const nsString& aALink) { return _to SetALink(aALink); } \ - NS_IMETHOD GetBackground(nsString& aBackground) { return _to GetBackground(aBackground); } \ - NS_IMETHOD SetBackground(const nsString& aBackground) { return _to SetBackground(aBackground); } \ - NS_IMETHOD GetBgColor(nsString& aBgColor) { return _to GetBgColor(aBgColor); } \ - NS_IMETHOD SetBgColor(const nsString& aBgColor) { return _to SetBgColor(aBgColor); } \ - NS_IMETHOD GetLink(nsString& aLink) { return _to GetLink(aLink); } \ - NS_IMETHOD SetLink(const nsString& aLink) { return _to SetLink(aLink); } \ - NS_IMETHOD GetText(nsString& aText) { return _to GetText(aText); } \ - NS_IMETHOD SetText(const nsString& aText) { return _to SetText(aText); } \ - NS_IMETHOD GetVLink(nsString& aVLink) { return _to GetVLink(aVLink); } \ - NS_IMETHOD SetVLink(const nsString& aVLink) { return _to SetVLink(aVLink); } \ + NS_IMETHOD GetALink(nsAWritableString& aALink) { return _to GetALink(aALink); } \ + NS_IMETHOD SetALink(const nsAReadableString& aALink) { return _to SetALink(aALink); } \ + NS_IMETHOD GetBackground(nsAWritableString& aBackground) { return _to GetBackground(aBackground); } \ + NS_IMETHOD SetBackground(const nsAReadableString& aBackground) { return _to SetBackground(aBackground); } \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor) { return _to GetBgColor(aBgColor); } \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor) { return _to SetBgColor(aBgColor); } \ + NS_IMETHOD GetLink(nsAWritableString& aLink) { return _to GetLink(aLink); } \ + NS_IMETHOD SetLink(const nsAReadableString& aLink) { return _to SetLink(aLink); } \ + NS_IMETHOD GetText(nsAWritableString& aText) { return _to GetText(aText); } \ + NS_IMETHOD SetText(const nsAReadableString& aText) { return _to SetText(aText); } \ + NS_IMETHOD GetVLink(nsAWritableString& aVLink) { return _to GetVLink(aVLink); } \ + NS_IMETHOD SetVLink(const nsAReadableString& aVLink) { return _to SetVLink(aVLink); } \ extern "C" NS_DOM nsresult NS_InitHTMLBodyElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLButtonElement.h b/dom/public/html/nsIDOMHTMLButtonElement.h index 41ecc6b519b2..10208782050a 100644 --- a/dom/public/html/nsIDOMHTMLButtonElement.h +++ b/dom/public/html/nsIDOMHTMLButtonElement.h @@ -41,54 +41,54 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm)=0; - NS_IMETHOD GetAccessKey(nsString& aAccessKey)=0; - NS_IMETHOD SetAccessKey(const nsString& aAccessKey)=0; + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey)=0; + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey)=0; NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; NS_IMETHOD GetTabIndex(PRInt32* aTabIndex)=0; NS_IMETHOD SetTabIndex(PRInt32 aTabIndex)=0; - NS_IMETHOD GetType(nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; }; #define NS_DECL_IDOMHTMLBUTTONELEMENT \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey); \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey); \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey); \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ #define NS_FORWARD_IDOMHTMLBUTTONELEMENT(_to) \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) { return _to SetTabIndex(aTabIndex); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ extern "C" NS_DOM nsresult NS_InitHTMLButtonElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLCollection.h b/dom/public/html/nsIDOMHTMLCollection.h index 9f943db8dad4..2847814c308b 100644 --- a/dom/public/html/nsIDOMHTMLCollection.h +++ b/dom/public/html/nsIDOMHTMLCollection.h @@ -42,21 +42,21 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0; }; #define NS_DECL_IDOMHTMLCOLLECTION \ NS_IMETHOD GetLength(PRUint32* aLength); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); \ #define NS_FORWARD_IDOMHTMLCOLLECTION(_to) \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to NamedItem(aName, aReturn); } \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { return _to NamedItem(aName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitHTMLCollectionClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLDivElement.h b/dom/public/html/nsIDOMHTMLDivElement.h index 0b3edcc5ed6d..2dac8e54c848 100644 --- a/dom/public/html/nsIDOMHTMLDivElement.h +++ b/dom/public/html/nsIDOMHTMLDivElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLDivElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLDIVELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; }; #define NS_DECL_IDOMHTMLDIVELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ #define NS_FORWARD_IDOMHTMLDIVELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ extern "C" NS_DOM nsresult NS_InitHTMLDivElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLDocument.h b/dom/public/html/nsIDOMHTMLDocument.h index 8dfc6ace7bd2..6a1c5e9ac435 100644 --- a/dom/public/html/nsIDOMHTMLDocument.h +++ b/dom/public/html/nsIDOMHTMLDocument.h @@ -41,15 +41,15 @@ class nsIDOMHTMLDocument : public nsIDOMDocument { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLDOCUMENT_IID; return iid; } - NS_IMETHOD GetTitle(nsString& aTitle)=0; - NS_IMETHOD SetTitle(const nsString& aTitle)=0; + NS_IMETHOD GetTitle(nsAWritableString& aTitle)=0; + NS_IMETHOD SetTitle(const nsAReadableString& aTitle)=0; - NS_IMETHOD GetReferrer(nsString& aReferrer)=0; + NS_IMETHOD GetReferrer(nsAWritableString& aReferrer)=0; - NS_IMETHOD GetDomain(nsString& aDomain)=0; - NS_IMETHOD SetDomain(const nsString& aDomain)=0; + NS_IMETHOD GetDomain(nsAWritableString& aDomain)=0; + NS_IMETHOD SetDomain(const nsAReadableString& aDomain)=0; - NS_IMETHOD GetURL(nsString& aURL)=0; + NS_IMETHOD GetURL(nsAWritableString& aURL)=0; NS_IMETHOD GetBody(nsIDOMHTMLElement** aBody)=0; NS_IMETHOD SetBody(nsIDOMHTMLElement* aBody)=0; @@ -64,28 +64,28 @@ public: NS_IMETHOD GetAnchors(nsIDOMHTMLCollection** aAnchors)=0; - NS_IMETHOD GetCookie(nsString& aCookie)=0; - NS_IMETHOD SetCookie(const nsString& aCookie)=0; + NS_IMETHOD GetCookie(nsAWritableString& aCookie)=0; + NS_IMETHOD SetCookie(const nsAReadableString& aCookie)=0; NS_IMETHOD Open()=0; NS_IMETHOD Close()=0; - NS_IMETHOD Write(const nsString& aText)=0; + NS_IMETHOD Write(const nsAReadableString& aText)=0; - NS_IMETHOD Writeln(const nsString& aText)=0; + NS_IMETHOD Writeln(const nsAReadableString& aText)=0; - NS_IMETHOD GetElementsByName(const nsString& aElementName, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByName(const nsAReadableString& aElementName, nsIDOMNodeList** aReturn)=0; }; #define NS_DECL_IDOMHTMLDOCUMENT \ - NS_IMETHOD GetTitle(nsString& aTitle); \ - NS_IMETHOD SetTitle(const nsString& aTitle); \ - NS_IMETHOD GetReferrer(nsString& aReferrer); \ - NS_IMETHOD GetDomain(nsString& aDomain); \ - NS_IMETHOD SetDomain(const nsString& aDomain); \ - NS_IMETHOD GetURL(nsString& aURL); \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle); \ + NS_IMETHOD SetTitle(const nsAReadableString& aTitle); \ + NS_IMETHOD GetReferrer(nsAWritableString& aReferrer); \ + NS_IMETHOD GetDomain(nsAWritableString& aDomain); \ + NS_IMETHOD SetDomain(const nsAReadableString& aDomain); \ + NS_IMETHOD GetURL(nsAWritableString& aURL); \ NS_IMETHOD GetBody(nsIDOMHTMLElement** aBody); \ NS_IMETHOD SetBody(nsIDOMHTMLElement* aBody); \ NS_IMETHOD GetImages(nsIDOMHTMLCollection** aImages); \ @@ -93,23 +93,23 @@ public: NS_IMETHOD GetLinks(nsIDOMHTMLCollection** aLinks); \ NS_IMETHOD GetForms(nsIDOMHTMLCollection** aForms); \ NS_IMETHOD GetAnchors(nsIDOMHTMLCollection** aAnchors); \ - NS_IMETHOD GetCookie(nsString& aCookie); \ - NS_IMETHOD SetCookie(const nsString& aCookie); \ + NS_IMETHOD GetCookie(nsAWritableString& aCookie); \ + NS_IMETHOD SetCookie(const nsAReadableString& aCookie); \ NS_IMETHOD Open(); \ NS_IMETHOD Close(); \ - NS_IMETHOD Write(const nsString& aText); \ - NS_IMETHOD Writeln(const nsString& aText); \ - NS_IMETHOD GetElementsByName(const nsString& aElementName, nsIDOMNodeList** aReturn); \ + NS_IMETHOD Write(const nsAReadableString& aText); \ + NS_IMETHOD Writeln(const nsAReadableString& aText); \ + NS_IMETHOD GetElementsByName(const nsAReadableString& aElementName, nsIDOMNodeList** aReturn); \ #define NS_FORWARD_IDOMHTMLDOCUMENT(_to) \ - NS_IMETHOD GetTitle(nsString& aTitle) { return _to GetTitle(aTitle); } \ - NS_IMETHOD SetTitle(const nsString& aTitle) { return _to SetTitle(aTitle); } \ - NS_IMETHOD GetReferrer(nsString& aReferrer) { return _to GetReferrer(aReferrer); } \ - NS_IMETHOD GetDomain(nsString& aDomain) { return _to GetDomain(aDomain); } \ - NS_IMETHOD SetDomain(const nsString& aDomain) { return _to SetDomain(aDomain); } \ - NS_IMETHOD GetURL(nsString& aURL) { return _to GetURL(aURL); } \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle) { return _to GetTitle(aTitle); } \ + NS_IMETHOD SetTitle(const nsAReadableString& aTitle) { return _to SetTitle(aTitle); } \ + NS_IMETHOD GetReferrer(nsAWritableString& aReferrer) { return _to GetReferrer(aReferrer); } \ + NS_IMETHOD GetDomain(nsAWritableString& aDomain) { return _to GetDomain(aDomain); } \ + NS_IMETHOD SetDomain(const nsAReadableString& aDomain) { return _to SetDomain(aDomain); } \ + NS_IMETHOD GetURL(nsAWritableString& aURL) { return _to GetURL(aURL); } \ NS_IMETHOD GetBody(nsIDOMHTMLElement** aBody) { return _to GetBody(aBody); } \ NS_IMETHOD SetBody(nsIDOMHTMLElement* aBody) { return _to SetBody(aBody); } \ NS_IMETHOD GetImages(nsIDOMHTMLCollection** aImages) { return _to GetImages(aImages); } \ @@ -117,13 +117,13 @@ public: NS_IMETHOD GetLinks(nsIDOMHTMLCollection** aLinks) { return _to GetLinks(aLinks); } \ NS_IMETHOD GetForms(nsIDOMHTMLCollection** aForms) { return _to GetForms(aForms); } \ NS_IMETHOD GetAnchors(nsIDOMHTMLCollection** aAnchors) { return _to GetAnchors(aAnchors); } \ - NS_IMETHOD GetCookie(nsString& aCookie) { return _to GetCookie(aCookie); } \ - NS_IMETHOD SetCookie(const nsString& aCookie) { return _to SetCookie(aCookie); } \ + NS_IMETHOD GetCookie(nsAWritableString& aCookie) { return _to GetCookie(aCookie); } \ + NS_IMETHOD SetCookie(const nsAReadableString& aCookie) { return _to SetCookie(aCookie); } \ NS_IMETHOD Open() { return _to Open(); } \ NS_IMETHOD Close() { return _to Close(); } \ - NS_IMETHOD Write(const nsString& aText) { return _to Write(aText); } \ - NS_IMETHOD Writeln(const nsString& aText) { return _to Writeln(aText); } \ - NS_IMETHOD GetElementsByName(const nsString& aElementName, nsIDOMNodeList** aReturn) { return _to GetElementsByName(aElementName, aReturn); } \ + NS_IMETHOD Write(const nsAReadableString& aText) { return _to Write(aText); } \ + NS_IMETHOD Writeln(const nsAReadableString& aText) { return _to Writeln(aText); } \ + NS_IMETHOD GetElementsByName(const nsAReadableString& aElementName, nsIDOMNodeList** aReturn) { return _to GetElementsByName(aElementName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitHTMLDocumentClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLElement.h b/dom/public/html/nsIDOMHTMLElement.h index a5e2e143f03f..61dbf93354d7 100644 --- a/dom/public/html/nsIDOMHTMLElement.h +++ b/dom/public/html/nsIDOMHTMLElement.h @@ -40,20 +40,20 @@ class nsIDOMHTMLElement : public nsIDOMElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLELEMENT_IID; return iid; } - NS_IMETHOD GetId(nsString& aId)=0; - NS_IMETHOD SetId(const nsString& aId)=0; + NS_IMETHOD GetId(nsAWritableString& aId)=0; + NS_IMETHOD SetId(const nsAReadableString& aId)=0; - NS_IMETHOD GetTitle(nsString& aTitle)=0; - NS_IMETHOD SetTitle(const nsString& aTitle)=0; + NS_IMETHOD GetTitle(nsAWritableString& aTitle)=0; + NS_IMETHOD SetTitle(const nsAReadableString& aTitle)=0; - NS_IMETHOD GetLang(nsString& aLang)=0; - NS_IMETHOD SetLang(const nsString& aLang)=0; + NS_IMETHOD GetLang(nsAWritableString& aLang)=0; + NS_IMETHOD SetLang(const nsAReadableString& aLang)=0; - NS_IMETHOD GetDir(nsString& aDir)=0; - NS_IMETHOD SetDir(const nsString& aDir)=0; + NS_IMETHOD GetDir(nsAWritableString& aDir)=0; + NS_IMETHOD SetDir(const nsAReadableString& aDir)=0; - NS_IMETHOD GetClassName(nsString& aClassName)=0; - NS_IMETHOD SetClassName(const nsString& aClassName)=0; + NS_IMETHOD GetClassName(nsAWritableString& aClassName)=0; + NS_IMETHOD SetClassName(const nsAReadableString& aClassName)=0; NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0; @@ -67,52 +67,52 @@ public: NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent)=0; - NS_IMETHOD GetInnerHTML(nsString& aInnerHTML)=0; - NS_IMETHOD SetInnerHTML(const nsString& aInnerHTML)=0; + NS_IMETHOD GetInnerHTML(nsAWritableString& aInnerHTML)=0; + NS_IMETHOD SetInnerHTML(const nsAReadableString& aInnerHTML)=0; }; #define NS_DECL_IDOMHTMLELEMENT \ - NS_IMETHOD GetId(nsString& aId); \ - NS_IMETHOD SetId(const nsString& aId); \ - NS_IMETHOD GetTitle(nsString& aTitle); \ - NS_IMETHOD SetTitle(const nsString& aTitle); \ - NS_IMETHOD GetLang(nsString& aLang); \ - NS_IMETHOD SetLang(const nsString& aLang); \ - NS_IMETHOD GetDir(nsString& aDir); \ - NS_IMETHOD SetDir(const nsString& aDir); \ - NS_IMETHOD GetClassName(nsString& aClassName); \ - NS_IMETHOD SetClassName(const nsString& aClassName); \ + NS_IMETHOD GetId(nsAWritableString& aId); \ + NS_IMETHOD SetId(const nsAReadableString& aId); \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle); \ + NS_IMETHOD SetTitle(const nsAReadableString& aTitle); \ + NS_IMETHOD GetLang(nsAWritableString& aLang); \ + NS_IMETHOD SetLang(const nsAReadableString& aLang); \ + NS_IMETHOD GetDir(nsAWritableString& aDir); \ + NS_IMETHOD SetDir(const nsAReadableString& aDir); \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName); \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName); \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \ NS_IMETHOD GetOffsetTop(PRInt32* aOffsetTop); \ NS_IMETHOD GetOffsetLeft(PRInt32* aOffsetLeft); \ NS_IMETHOD GetOffsetWidth(PRInt32* aOffsetWidth); \ NS_IMETHOD GetOffsetHeight(PRInt32* aOffsetHeight); \ NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent); \ - NS_IMETHOD GetInnerHTML(nsString& aInnerHTML); \ - NS_IMETHOD SetInnerHTML(const nsString& aInnerHTML); \ + NS_IMETHOD GetInnerHTML(nsAWritableString& aInnerHTML); \ + NS_IMETHOD SetInnerHTML(const nsAReadableString& aInnerHTML); \ #define NS_FORWARD_IDOMHTMLELEMENT(_to) \ - NS_IMETHOD GetId(nsString& aId) { return _to GetId(aId); } \ - NS_IMETHOD SetId(const nsString& aId) { return _to SetId(aId); } \ - NS_IMETHOD GetTitle(nsString& aTitle) { return _to GetTitle(aTitle); } \ - NS_IMETHOD SetTitle(const nsString& aTitle) { return _to SetTitle(aTitle); } \ - NS_IMETHOD GetLang(nsString& aLang) { return _to GetLang(aLang); } \ - NS_IMETHOD SetLang(const nsString& aLang) { return _to SetLang(aLang); } \ - NS_IMETHOD GetDir(nsString& aDir) { return _to GetDir(aDir); } \ - NS_IMETHOD SetDir(const nsString& aDir) { return _to SetDir(aDir); } \ - NS_IMETHOD GetClassName(nsString& aClassName) { return _to GetClassName(aClassName); } \ - NS_IMETHOD SetClassName(const nsString& aClassName) { return _to SetClassName(aClassName); } \ + NS_IMETHOD GetId(nsAWritableString& aId) { return _to GetId(aId); } \ + NS_IMETHOD SetId(const nsAReadableString& aId) { return _to SetId(aId); } \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle) { return _to GetTitle(aTitle); } \ + NS_IMETHOD SetTitle(const nsAReadableString& aTitle) { return _to SetTitle(aTitle); } \ + NS_IMETHOD GetLang(nsAWritableString& aLang) { return _to GetLang(aLang); } \ + NS_IMETHOD SetLang(const nsAReadableString& aLang) { return _to SetLang(aLang); } \ + NS_IMETHOD GetDir(nsAWritableString& aDir) { return _to GetDir(aDir); } \ + NS_IMETHOD SetDir(const nsAReadableString& aDir) { return _to SetDir(aDir); } \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName) { return _to GetClassName(aClassName); } \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName) { return _to SetClassName(aClassName); } \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \ NS_IMETHOD GetOffsetTop(PRInt32* aOffsetTop) { return _to GetOffsetTop(aOffsetTop); } \ NS_IMETHOD GetOffsetLeft(PRInt32* aOffsetLeft) { return _to GetOffsetLeft(aOffsetLeft); } \ NS_IMETHOD GetOffsetWidth(PRInt32* aOffsetWidth) { return _to GetOffsetWidth(aOffsetWidth); } \ NS_IMETHOD GetOffsetHeight(PRInt32* aOffsetHeight) { return _to GetOffsetHeight(aOffsetHeight); } \ NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) { return _to GetOffsetParent(aOffsetParent); } \ - NS_IMETHOD GetInnerHTML(nsString& aInnerHTML) { return _to GetInnerHTML(aInnerHTML); } \ - NS_IMETHOD SetInnerHTML(const nsString& aInnerHTML) { return _to SetInnerHTML(aInnerHTML); } \ + NS_IMETHOD GetInnerHTML(nsAWritableString& aInnerHTML) { return _to GetInnerHTML(aInnerHTML); } \ + NS_IMETHOD SetInnerHTML(const nsAReadableString& aInnerHTML) { return _to SetInnerHTML(aInnerHTML); } \ extern "C" NS_DOM nsresult NS_InitHTMLElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLEmbedElement.h b/dom/public/html/nsIDOMHTMLEmbedElement.h index 568e81ec2a28..a719fed220f5 100644 --- a/dom/public/html/nsIDOMHTMLEmbedElement.h +++ b/dom/public/html/nsIDOMHTMLEmbedElement.h @@ -38,55 +38,55 @@ class nsIDOMHTMLEmbedElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLEMBEDELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetHeight(nsString& aHeight)=0; - NS_IMETHOD SetHeight(const nsString& aHeight)=0; + NS_IMETHOD GetHeight(nsAWritableString& aHeight)=0; + NS_IMETHOD SetHeight(const nsAReadableString& aHeight)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetSrc(nsString& aSrc)=0; - NS_IMETHOD SetSrc(const nsString& aSrc)=0; + NS_IMETHOD GetSrc(nsAWritableString& aSrc)=0; + NS_IMETHOD SetSrc(const nsAReadableString& aSrc)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; }; #define NS_DECL_IDOMHTMLEMBEDELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetHeight(nsString& aHeight); \ - NS_IMETHOD SetHeight(const nsString& aHeight); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetSrc(nsString& aSrc); \ - NS_IMETHOD SetSrc(const nsString& aSrc); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight); \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc); \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ #define NS_FORWARD_IDOMHTMLEMBEDELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetHeight(nsString& aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD SetHeight(const nsString& aHeight) { return _to SetHeight(aHeight); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetSrc(nsString& aSrc) { return _to GetSrc(aSrc); } \ - NS_IMETHOD SetSrc(const nsString& aSrc) { return _to SetSrc(aSrc); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight) { return _to GetHeight(aHeight); } \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight) { return _to SetHeight(aHeight); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc) { return _to GetSrc(aSrc); } \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc) { return _to SetSrc(aSrc); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ extern "C" NS_DOM nsresult NS_InitHTMLEmbedElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLFontElement.h b/dom/public/html/nsIDOMHTMLFontElement.h index ab0a88799305..72927b42425f 100644 --- a/dom/public/html/nsIDOMHTMLFontElement.h +++ b/dom/public/html/nsIDOMHTMLFontElement.h @@ -38,34 +38,34 @@ class nsIDOMHTMLFontElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLFONTELEMENT_IID; return iid; } - NS_IMETHOD GetColor(nsString& aColor)=0; - NS_IMETHOD SetColor(const nsString& aColor)=0; + NS_IMETHOD GetColor(nsAWritableString& aColor)=0; + NS_IMETHOD SetColor(const nsAReadableString& aColor)=0; - NS_IMETHOD GetFace(nsString& aFace)=0; - NS_IMETHOD SetFace(const nsString& aFace)=0; + NS_IMETHOD GetFace(nsAWritableString& aFace)=0; + NS_IMETHOD SetFace(const nsAReadableString& aFace)=0; - NS_IMETHOD GetSize(nsString& aSize)=0; - NS_IMETHOD SetSize(const nsString& aSize)=0; + NS_IMETHOD GetSize(nsAWritableString& aSize)=0; + NS_IMETHOD SetSize(const nsAReadableString& aSize)=0; }; #define NS_DECL_IDOMHTMLFONTELEMENT \ - NS_IMETHOD GetColor(nsString& aColor); \ - NS_IMETHOD SetColor(const nsString& aColor); \ - NS_IMETHOD GetFace(nsString& aFace); \ - NS_IMETHOD SetFace(const nsString& aFace); \ - NS_IMETHOD GetSize(nsString& aSize); \ - NS_IMETHOD SetSize(const nsString& aSize); \ + NS_IMETHOD GetColor(nsAWritableString& aColor); \ + NS_IMETHOD SetColor(const nsAReadableString& aColor); \ + NS_IMETHOD GetFace(nsAWritableString& aFace); \ + NS_IMETHOD SetFace(const nsAReadableString& aFace); \ + NS_IMETHOD GetSize(nsAWritableString& aSize); \ + NS_IMETHOD SetSize(const nsAReadableString& aSize); \ #define NS_FORWARD_IDOMHTMLFONTELEMENT(_to) \ - NS_IMETHOD GetColor(nsString& aColor) { return _to GetColor(aColor); } \ - NS_IMETHOD SetColor(const nsString& aColor) { return _to SetColor(aColor); } \ - NS_IMETHOD GetFace(nsString& aFace) { return _to GetFace(aFace); } \ - NS_IMETHOD SetFace(const nsString& aFace) { return _to SetFace(aFace); } \ - NS_IMETHOD GetSize(nsString& aSize) { return _to GetSize(aSize); } \ - NS_IMETHOD SetSize(const nsString& aSize) { return _to SetSize(aSize); } \ + NS_IMETHOD GetColor(nsAWritableString& aColor) { return _to GetColor(aColor); } \ + NS_IMETHOD SetColor(const nsAReadableString& aColor) { return _to SetColor(aColor); } \ + NS_IMETHOD GetFace(nsAWritableString& aFace) { return _to GetFace(aFace); } \ + NS_IMETHOD SetFace(const nsAReadableString& aFace) { return _to SetFace(aFace); } \ + NS_IMETHOD GetSize(nsAWritableString& aSize) { return _to GetSize(aSize); } \ + NS_IMETHOD SetSize(const nsAReadableString& aSize) { return _to SetSize(aSize); } \ extern "C" NS_DOM nsresult NS_InitHTMLFontElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLFormElement.h b/dom/public/html/nsIDOMHTMLFormElement.h index 401bd8b96bbb..924450c54ba3 100644 --- a/dom/public/html/nsIDOMHTMLFormElement.h +++ b/dom/public/html/nsIDOMHTMLFormElement.h @@ -43,23 +43,23 @@ public: NS_IMETHOD GetLength(PRInt32* aLength)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetAcceptCharset(nsString& aAcceptCharset)=0; - NS_IMETHOD SetAcceptCharset(const nsString& aAcceptCharset)=0; + NS_IMETHOD GetAcceptCharset(nsAWritableString& aAcceptCharset)=0; + NS_IMETHOD SetAcceptCharset(const nsAReadableString& aAcceptCharset)=0; - NS_IMETHOD GetAction(nsString& aAction)=0; - NS_IMETHOD SetAction(const nsString& aAction)=0; + NS_IMETHOD GetAction(nsAWritableString& aAction)=0; + NS_IMETHOD SetAction(const nsAReadableString& aAction)=0; - NS_IMETHOD GetEnctype(nsString& aEnctype)=0; - NS_IMETHOD SetEnctype(const nsString& aEnctype)=0; + NS_IMETHOD GetEnctype(nsAWritableString& aEnctype)=0; + NS_IMETHOD SetEnctype(const nsAReadableString& aEnctype)=0; - NS_IMETHOD GetMethod(nsString& aMethod)=0; - NS_IMETHOD SetMethod(const nsString& aMethod)=0; + NS_IMETHOD GetMethod(nsAWritableString& aMethod)=0; + NS_IMETHOD SetMethod(const nsAReadableString& aMethod)=0; - NS_IMETHOD GetTarget(nsString& aTarget)=0; - NS_IMETHOD SetTarget(const nsString& aTarget)=0; + NS_IMETHOD GetTarget(nsAWritableString& aTarget)=0; + NS_IMETHOD SetTarget(const nsAReadableString& aTarget)=0; NS_IMETHOD Submit()=0; @@ -70,18 +70,18 @@ public: #define NS_DECL_IDOMHTMLFORMELEMENT \ NS_IMETHOD GetElements(nsIDOMHTMLCollection** aElements); \ NS_IMETHOD GetLength(PRInt32* aLength); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetAcceptCharset(nsString& aAcceptCharset); \ - NS_IMETHOD SetAcceptCharset(const nsString& aAcceptCharset); \ - NS_IMETHOD GetAction(nsString& aAction); \ - NS_IMETHOD SetAction(const nsString& aAction); \ - NS_IMETHOD GetEnctype(nsString& aEnctype); \ - NS_IMETHOD SetEnctype(const nsString& aEnctype); \ - NS_IMETHOD GetMethod(nsString& aMethod); \ - NS_IMETHOD SetMethod(const nsString& aMethod); \ - NS_IMETHOD GetTarget(nsString& aTarget); \ - NS_IMETHOD SetTarget(const nsString& aTarget); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetAcceptCharset(nsAWritableString& aAcceptCharset); \ + NS_IMETHOD SetAcceptCharset(const nsAReadableString& aAcceptCharset); \ + NS_IMETHOD GetAction(nsAWritableString& aAction); \ + NS_IMETHOD SetAction(const nsAReadableString& aAction); \ + NS_IMETHOD GetEnctype(nsAWritableString& aEnctype); \ + NS_IMETHOD SetEnctype(const nsAReadableString& aEnctype); \ + NS_IMETHOD GetMethod(nsAWritableString& aMethod); \ + NS_IMETHOD SetMethod(const nsAReadableString& aMethod); \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget); \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget); \ NS_IMETHOD Submit(); \ NS_IMETHOD Reset(); \ @@ -90,18 +90,18 @@ public: #define NS_FORWARD_IDOMHTMLFORMELEMENT(_to) \ NS_IMETHOD GetElements(nsIDOMHTMLCollection** aElements) { return _to GetElements(aElements); } \ NS_IMETHOD GetLength(PRInt32* aLength) { return _to GetLength(aLength); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetAcceptCharset(nsString& aAcceptCharset) { return _to GetAcceptCharset(aAcceptCharset); } \ - NS_IMETHOD SetAcceptCharset(const nsString& aAcceptCharset) { return _to SetAcceptCharset(aAcceptCharset); } \ - NS_IMETHOD GetAction(nsString& aAction) { return _to GetAction(aAction); } \ - NS_IMETHOD SetAction(const nsString& aAction) { return _to SetAction(aAction); } \ - NS_IMETHOD GetEnctype(nsString& aEnctype) { return _to GetEnctype(aEnctype); } \ - NS_IMETHOD SetEnctype(const nsString& aEnctype) { return _to SetEnctype(aEnctype); } \ - NS_IMETHOD GetMethod(nsString& aMethod) { return _to GetMethod(aMethod); } \ - NS_IMETHOD SetMethod(const nsString& aMethod) { return _to SetMethod(aMethod); } \ - NS_IMETHOD GetTarget(nsString& aTarget) { return _to GetTarget(aTarget); } \ - NS_IMETHOD SetTarget(const nsString& aTarget) { return _to SetTarget(aTarget); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetAcceptCharset(nsAWritableString& aAcceptCharset) { return _to GetAcceptCharset(aAcceptCharset); } \ + NS_IMETHOD SetAcceptCharset(const nsAReadableString& aAcceptCharset) { return _to SetAcceptCharset(aAcceptCharset); } \ + NS_IMETHOD GetAction(nsAWritableString& aAction) { return _to GetAction(aAction); } \ + NS_IMETHOD SetAction(const nsAReadableString& aAction) { return _to SetAction(aAction); } \ + NS_IMETHOD GetEnctype(nsAWritableString& aEnctype) { return _to GetEnctype(aEnctype); } \ + NS_IMETHOD SetEnctype(const nsAReadableString& aEnctype) { return _to SetEnctype(aEnctype); } \ + NS_IMETHOD GetMethod(nsAWritableString& aMethod) { return _to GetMethod(aMethod); } \ + NS_IMETHOD SetMethod(const nsAReadableString& aMethod) { return _to SetMethod(aMethod); } \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget) { return _to GetTarget(aTarget); } \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget) { return _to SetTarget(aTarget); } \ NS_IMETHOD Submit() { return _to Submit(); } \ NS_IMETHOD Reset() { return _to Reset(); } \ diff --git a/dom/public/html/nsIDOMHTMLFrameElement.h b/dom/public/html/nsIDOMHTMLFrameElement.h index cade524c1aba..f70d7023dbef 100644 --- a/dom/public/html/nsIDOMHTMLFrameElement.h +++ b/dom/public/html/nsIDOMHTMLFrameElement.h @@ -39,29 +39,29 @@ class nsIDOMHTMLFrameElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLFRAMEELEMENT_IID; return iid; } - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder)=0; - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder)=0; + NS_IMETHOD GetFrameBorder(nsAWritableString& aFrameBorder)=0; + NS_IMETHOD SetFrameBorder(const nsAReadableString& aFrameBorder)=0; - NS_IMETHOD GetLongDesc(nsString& aLongDesc)=0; - NS_IMETHOD SetLongDesc(const nsString& aLongDesc)=0; + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc)=0; + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc)=0; - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight)=0; - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight)=0; + NS_IMETHOD GetMarginHeight(nsAWritableString& aMarginHeight)=0; + NS_IMETHOD SetMarginHeight(const nsAReadableString& aMarginHeight)=0; - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth)=0; - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth)=0; + NS_IMETHOD GetMarginWidth(nsAWritableString& aMarginWidth)=0; + NS_IMETHOD SetMarginWidth(const nsAReadableString& aMarginWidth)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; NS_IMETHOD GetNoResize(PRBool* aNoResize)=0; NS_IMETHOD SetNoResize(PRBool aNoResize)=0; - NS_IMETHOD GetScrolling(nsString& aScrolling)=0; - NS_IMETHOD SetScrolling(const nsString& aScrolling)=0; + NS_IMETHOD GetScrolling(nsAWritableString& aScrolling)=0; + NS_IMETHOD SetScrolling(const nsAReadableString& aScrolling)=0; - NS_IMETHOD GetSrc(nsString& aSrc)=0; - NS_IMETHOD SetSrc(const nsString& aSrc)=0; + NS_IMETHOD GetSrc(nsAWritableString& aSrc)=0; + NS_IMETHOD SetSrc(const nsAReadableString& aSrc)=0; NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument)=0; NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument)=0; @@ -69,44 +69,44 @@ public: #define NS_DECL_IDOMHTMLFRAMEELEMENT \ - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder); \ - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder); \ - NS_IMETHOD GetLongDesc(nsString& aLongDesc); \ - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); \ - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight); \ - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight); \ - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth); \ - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetFrameBorder(nsAWritableString& aFrameBorder); \ + NS_IMETHOD SetFrameBorder(const nsAReadableString& aFrameBorder); \ + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc); \ + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc); \ + NS_IMETHOD GetMarginHeight(nsAWritableString& aMarginHeight); \ + NS_IMETHOD SetMarginHeight(const nsAReadableString& aMarginHeight); \ + NS_IMETHOD GetMarginWidth(nsAWritableString& aMarginWidth); \ + NS_IMETHOD SetMarginWidth(const nsAReadableString& aMarginWidth); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ NS_IMETHOD GetNoResize(PRBool* aNoResize); \ NS_IMETHOD SetNoResize(PRBool aNoResize); \ - NS_IMETHOD GetScrolling(nsString& aScrolling); \ - NS_IMETHOD SetScrolling(const nsString& aScrolling); \ - NS_IMETHOD GetSrc(nsString& aSrc); \ - NS_IMETHOD SetSrc(const nsString& aSrc); \ + NS_IMETHOD GetScrolling(nsAWritableString& aScrolling); \ + NS_IMETHOD SetScrolling(const nsAReadableString& aScrolling); \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc); \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc); \ NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); \ NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); \ #define NS_FORWARD_IDOMHTMLFRAMEELEMENT(_to) \ - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder) { return _to GetFrameBorder(aFrameBorder); } \ - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder) { return _to SetFrameBorder(aFrameBorder); } \ - NS_IMETHOD GetLongDesc(nsString& aLongDesc) { return _to GetLongDesc(aLongDesc); } \ - NS_IMETHOD SetLongDesc(const nsString& aLongDesc) { return _to SetLongDesc(aLongDesc); } \ - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight) { return _to GetMarginHeight(aMarginHeight); } \ - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight) { return _to SetMarginHeight(aMarginHeight); } \ - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth) { return _to GetMarginWidth(aMarginWidth); } \ - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth) { return _to SetMarginWidth(aMarginWidth); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetFrameBorder(nsAWritableString& aFrameBorder) { return _to GetFrameBorder(aFrameBorder); } \ + NS_IMETHOD SetFrameBorder(const nsAReadableString& aFrameBorder) { return _to SetFrameBorder(aFrameBorder); } \ + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc) { return _to GetLongDesc(aLongDesc); } \ + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc) { return _to SetLongDesc(aLongDesc); } \ + NS_IMETHOD GetMarginHeight(nsAWritableString& aMarginHeight) { return _to GetMarginHeight(aMarginHeight); } \ + NS_IMETHOD SetMarginHeight(const nsAReadableString& aMarginHeight) { return _to SetMarginHeight(aMarginHeight); } \ + NS_IMETHOD GetMarginWidth(nsAWritableString& aMarginWidth) { return _to GetMarginWidth(aMarginWidth); } \ + NS_IMETHOD SetMarginWidth(const nsAReadableString& aMarginWidth) { return _to SetMarginWidth(aMarginWidth); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ NS_IMETHOD GetNoResize(PRBool* aNoResize) { return _to GetNoResize(aNoResize); } \ NS_IMETHOD SetNoResize(PRBool aNoResize) { return _to SetNoResize(aNoResize); } \ - NS_IMETHOD GetScrolling(nsString& aScrolling) { return _to GetScrolling(aScrolling); } \ - NS_IMETHOD SetScrolling(const nsString& aScrolling) { return _to SetScrolling(aScrolling); } \ - NS_IMETHOD GetSrc(nsString& aSrc) { return _to GetSrc(aSrc); } \ - NS_IMETHOD SetSrc(const nsString& aSrc) { return _to SetSrc(aSrc); } \ + NS_IMETHOD GetScrolling(nsAWritableString& aScrolling) { return _to GetScrolling(aScrolling); } \ + NS_IMETHOD SetScrolling(const nsAReadableString& aScrolling) { return _to SetScrolling(aScrolling); } \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc) { return _to GetSrc(aSrc); } \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc) { return _to SetSrc(aSrc); } \ NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument) { return _to GetContentDocument(aContentDocument); } \ NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument) { return _to SetContentDocument(aContentDocument); } \ diff --git a/dom/public/html/nsIDOMHTMLFrameSetElement.h b/dom/public/html/nsIDOMHTMLFrameSetElement.h index 4a6370ce7deb..bd3ee1da3d1a 100644 --- a/dom/public/html/nsIDOMHTMLFrameSetElement.h +++ b/dom/public/html/nsIDOMHTMLFrameSetElement.h @@ -38,27 +38,27 @@ class nsIDOMHTMLFrameSetElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLFRAMESETELEMENT_IID; return iid; } - NS_IMETHOD GetCols(nsString& aCols)=0; - NS_IMETHOD SetCols(const nsString& aCols)=0; + NS_IMETHOD GetCols(nsAWritableString& aCols)=0; + NS_IMETHOD SetCols(const nsAReadableString& aCols)=0; - NS_IMETHOD GetRows(nsString& aRows)=0; - NS_IMETHOD SetRows(const nsString& aRows)=0; + NS_IMETHOD GetRows(nsAWritableString& aRows)=0; + NS_IMETHOD SetRows(const nsAReadableString& aRows)=0; }; #define NS_DECL_IDOMHTMLFRAMESETELEMENT \ - NS_IMETHOD GetCols(nsString& aCols); \ - NS_IMETHOD SetCols(const nsString& aCols); \ - NS_IMETHOD GetRows(nsString& aRows); \ - NS_IMETHOD SetRows(const nsString& aRows); \ + NS_IMETHOD GetCols(nsAWritableString& aCols); \ + NS_IMETHOD SetCols(const nsAReadableString& aCols); \ + NS_IMETHOD GetRows(nsAWritableString& aRows); \ + NS_IMETHOD SetRows(const nsAReadableString& aRows); \ #define NS_FORWARD_IDOMHTMLFRAMESETELEMENT(_to) \ - NS_IMETHOD GetCols(nsString& aCols) { return _to GetCols(aCols); } \ - NS_IMETHOD SetCols(const nsString& aCols) { return _to SetCols(aCols); } \ - NS_IMETHOD GetRows(nsString& aRows) { return _to GetRows(aRows); } \ - NS_IMETHOD SetRows(const nsString& aRows) { return _to SetRows(aRows); } \ + NS_IMETHOD GetCols(nsAWritableString& aCols) { return _to GetCols(aCols); } \ + NS_IMETHOD SetCols(const nsAReadableString& aCols) { return _to SetCols(aCols); } \ + NS_IMETHOD GetRows(nsAWritableString& aRows) { return _to GetRows(aRows); } \ + NS_IMETHOD SetRows(const nsAReadableString& aRows) { return _to SetRows(aRows); } \ extern "C" NS_DOM nsresult NS_InitHTMLFrameSetElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLHRElement.h b/dom/public/html/nsIDOMHTMLHRElement.h index 40ec965342b1..af7d166b6a9c 100644 --- a/dom/public/html/nsIDOMHTMLHRElement.h +++ b/dom/public/html/nsIDOMHTMLHRElement.h @@ -38,41 +38,41 @@ class nsIDOMHTMLHRElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLHRELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; NS_IMETHOD GetNoShade(PRBool* aNoShade)=0; NS_IMETHOD SetNoShade(PRBool aNoShade)=0; - NS_IMETHOD GetSize(nsString& aSize)=0; - NS_IMETHOD SetSize(const nsString& aSize)=0; + NS_IMETHOD GetSize(nsAWritableString& aSize)=0; + NS_IMETHOD SetSize(const nsAReadableString& aSize)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; }; #define NS_DECL_IDOMHTMLHRELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ NS_IMETHOD GetNoShade(PRBool* aNoShade); \ NS_IMETHOD SetNoShade(PRBool aNoShade); \ - NS_IMETHOD GetSize(nsString& aSize); \ - NS_IMETHOD SetSize(const nsString& aSize); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetSize(nsAWritableString& aSize); \ + NS_IMETHOD SetSize(const nsAReadableString& aSize); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ #define NS_FORWARD_IDOMHTMLHRELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ NS_IMETHOD GetNoShade(PRBool* aNoShade) { return _to GetNoShade(aNoShade); } \ NS_IMETHOD SetNoShade(PRBool aNoShade) { return _to SetNoShade(aNoShade); } \ - NS_IMETHOD GetSize(nsString& aSize) { return _to GetSize(aSize); } \ - NS_IMETHOD SetSize(const nsString& aSize) { return _to SetSize(aSize); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetSize(nsAWritableString& aSize) { return _to GetSize(aSize); } \ + NS_IMETHOD SetSize(const nsAReadableString& aSize) { return _to SetSize(aSize); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ extern "C" NS_DOM nsresult NS_InitHTMLHRElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLHeadElement.h b/dom/public/html/nsIDOMHTMLHeadElement.h index af538154c0a8..bd7a0e7f5101 100644 --- a/dom/public/html/nsIDOMHTMLHeadElement.h +++ b/dom/public/html/nsIDOMHTMLHeadElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLHeadElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLHEADELEMENT_IID; return iid; } - NS_IMETHOD GetProfile(nsString& aProfile)=0; - NS_IMETHOD SetProfile(const nsString& aProfile)=0; + NS_IMETHOD GetProfile(nsAWritableString& aProfile)=0; + NS_IMETHOD SetProfile(const nsAReadableString& aProfile)=0; }; #define NS_DECL_IDOMHTMLHEADELEMENT \ - NS_IMETHOD GetProfile(nsString& aProfile); \ - NS_IMETHOD SetProfile(const nsString& aProfile); \ + NS_IMETHOD GetProfile(nsAWritableString& aProfile); \ + NS_IMETHOD SetProfile(const nsAReadableString& aProfile); \ #define NS_FORWARD_IDOMHTMLHEADELEMENT(_to) \ - NS_IMETHOD GetProfile(nsString& aProfile) { return _to GetProfile(aProfile); } \ - NS_IMETHOD SetProfile(const nsString& aProfile) { return _to SetProfile(aProfile); } \ + NS_IMETHOD GetProfile(nsAWritableString& aProfile) { return _to GetProfile(aProfile); } \ + NS_IMETHOD SetProfile(const nsAReadableString& aProfile) { return _to SetProfile(aProfile); } \ extern "C" NS_DOM nsresult NS_InitHTMLHeadElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLHeadingElement.h b/dom/public/html/nsIDOMHTMLHeadingElement.h index ff4dc598b2df..6636ed1040bc 100644 --- a/dom/public/html/nsIDOMHTMLHeadingElement.h +++ b/dom/public/html/nsIDOMHTMLHeadingElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLHeadingElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLHEADINGELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; }; #define NS_DECL_IDOMHTMLHEADINGELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ #define NS_FORWARD_IDOMHTMLHEADINGELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ extern "C" NS_DOM nsresult NS_InitHTMLHeadingElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLHtmlElement.h b/dom/public/html/nsIDOMHTMLHtmlElement.h index d9dd3c6ab366..d14ca78bdeee 100644 --- a/dom/public/html/nsIDOMHTMLHtmlElement.h +++ b/dom/public/html/nsIDOMHTMLHtmlElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLHtmlElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLHTMLELEMENT_IID; return iid; } - NS_IMETHOD GetVersion(nsString& aVersion)=0; - NS_IMETHOD SetVersion(const nsString& aVersion)=0; + NS_IMETHOD GetVersion(nsAWritableString& aVersion)=0; + NS_IMETHOD SetVersion(const nsAReadableString& aVersion)=0; }; #define NS_DECL_IDOMHTMLHTMLELEMENT \ - NS_IMETHOD GetVersion(nsString& aVersion); \ - NS_IMETHOD SetVersion(const nsString& aVersion); \ + NS_IMETHOD GetVersion(nsAWritableString& aVersion); \ + NS_IMETHOD SetVersion(const nsAReadableString& aVersion); \ #define NS_FORWARD_IDOMHTMLHTMLELEMENT(_to) \ - NS_IMETHOD GetVersion(nsString& aVersion) { return _to GetVersion(aVersion); } \ - NS_IMETHOD SetVersion(const nsString& aVersion) { return _to SetVersion(aVersion); } \ + NS_IMETHOD GetVersion(nsAWritableString& aVersion) { return _to GetVersion(aVersion); } \ + NS_IMETHOD SetVersion(const nsAReadableString& aVersion) { return _to SetVersion(aVersion); } \ extern "C" NS_DOM nsresult NS_InitHTMLHtmlElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLIFrameElement.h b/dom/public/html/nsIDOMHTMLIFrameElement.h index 6d8bd97641f5..dc7e48180cf9 100644 --- a/dom/public/html/nsIDOMHTMLIFrameElement.h +++ b/dom/public/html/nsIDOMHTMLIFrameElement.h @@ -39,35 +39,35 @@ class nsIDOMHTMLIFrameElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLIFRAMEELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder)=0; - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder)=0; + NS_IMETHOD GetFrameBorder(nsAWritableString& aFrameBorder)=0; + NS_IMETHOD SetFrameBorder(const nsAReadableString& aFrameBorder)=0; - NS_IMETHOD GetHeight(nsString& aHeight)=0; - NS_IMETHOD SetHeight(const nsString& aHeight)=0; + NS_IMETHOD GetHeight(nsAWritableString& aHeight)=0; + NS_IMETHOD SetHeight(const nsAReadableString& aHeight)=0; - NS_IMETHOD GetLongDesc(nsString& aLongDesc)=0; - NS_IMETHOD SetLongDesc(const nsString& aLongDesc)=0; + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc)=0; + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc)=0; - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight)=0; - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight)=0; + NS_IMETHOD GetMarginHeight(nsAWritableString& aMarginHeight)=0; + NS_IMETHOD SetMarginHeight(const nsAReadableString& aMarginHeight)=0; - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth)=0; - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth)=0; + NS_IMETHOD GetMarginWidth(nsAWritableString& aMarginWidth)=0; + NS_IMETHOD SetMarginWidth(const nsAReadableString& aMarginWidth)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetScrolling(nsString& aScrolling)=0; - NS_IMETHOD SetScrolling(const nsString& aScrolling)=0; + NS_IMETHOD GetScrolling(nsAWritableString& aScrolling)=0; + NS_IMETHOD SetScrolling(const nsAReadableString& aScrolling)=0; - NS_IMETHOD GetSrc(nsString& aSrc)=0; - NS_IMETHOD SetSrc(const nsString& aSrc)=0; + NS_IMETHOD GetSrc(nsAWritableString& aSrc)=0; + NS_IMETHOD SetSrc(const nsAReadableString& aSrc)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument)=0; NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument)=0; @@ -75,52 +75,52 @@ public: #define NS_DECL_IDOMHTMLIFRAMEELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder); \ - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder); \ - NS_IMETHOD GetHeight(nsString& aHeight); \ - NS_IMETHOD SetHeight(const nsString& aHeight); \ - NS_IMETHOD GetLongDesc(nsString& aLongDesc); \ - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); \ - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight); \ - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight); \ - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth); \ - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetScrolling(nsString& aScrolling); \ - NS_IMETHOD SetScrolling(const nsString& aScrolling); \ - NS_IMETHOD GetSrc(nsString& aSrc); \ - NS_IMETHOD SetSrc(const nsString& aSrc); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetFrameBorder(nsAWritableString& aFrameBorder); \ + NS_IMETHOD SetFrameBorder(const nsAReadableString& aFrameBorder); \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight); \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight); \ + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc); \ + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc); \ + NS_IMETHOD GetMarginHeight(nsAWritableString& aMarginHeight); \ + NS_IMETHOD SetMarginHeight(const nsAReadableString& aMarginHeight); \ + NS_IMETHOD GetMarginWidth(nsAWritableString& aMarginWidth); \ + NS_IMETHOD SetMarginWidth(const nsAReadableString& aMarginWidth); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetScrolling(nsAWritableString& aScrolling); \ + NS_IMETHOD SetScrolling(const nsAReadableString& aScrolling); \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc); \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); \ NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); \ #define NS_FORWARD_IDOMHTMLIFRAMEELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder) { return _to GetFrameBorder(aFrameBorder); } \ - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder) { return _to SetFrameBorder(aFrameBorder); } \ - NS_IMETHOD GetHeight(nsString& aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD SetHeight(const nsString& aHeight) { return _to SetHeight(aHeight); } \ - NS_IMETHOD GetLongDesc(nsString& aLongDesc) { return _to GetLongDesc(aLongDesc); } \ - NS_IMETHOD SetLongDesc(const nsString& aLongDesc) { return _to SetLongDesc(aLongDesc); } \ - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight) { return _to GetMarginHeight(aMarginHeight); } \ - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight) { return _to SetMarginHeight(aMarginHeight); } \ - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth) { return _to GetMarginWidth(aMarginWidth); } \ - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth) { return _to SetMarginWidth(aMarginWidth); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetScrolling(nsString& aScrolling) { return _to GetScrolling(aScrolling); } \ - NS_IMETHOD SetScrolling(const nsString& aScrolling) { return _to SetScrolling(aScrolling); } \ - NS_IMETHOD GetSrc(nsString& aSrc) { return _to GetSrc(aSrc); } \ - NS_IMETHOD SetSrc(const nsString& aSrc) { return _to SetSrc(aSrc); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetFrameBorder(nsAWritableString& aFrameBorder) { return _to GetFrameBorder(aFrameBorder); } \ + NS_IMETHOD SetFrameBorder(const nsAReadableString& aFrameBorder) { return _to SetFrameBorder(aFrameBorder); } \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight) { return _to GetHeight(aHeight); } \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight) { return _to SetHeight(aHeight); } \ + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc) { return _to GetLongDesc(aLongDesc); } \ + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc) { return _to SetLongDesc(aLongDesc); } \ + NS_IMETHOD GetMarginHeight(nsAWritableString& aMarginHeight) { return _to GetMarginHeight(aMarginHeight); } \ + NS_IMETHOD SetMarginHeight(const nsAReadableString& aMarginHeight) { return _to SetMarginHeight(aMarginHeight); } \ + NS_IMETHOD GetMarginWidth(nsAWritableString& aMarginWidth) { return _to GetMarginWidth(aMarginWidth); } \ + NS_IMETHOD SetMarginWidth(const nsAReadableString& aMarginWidth) { return _to SetMarginWidth(aMarginWidth); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetScrolling(nsAWritableString& aScrolling) { return _to GetScrolling(aScrolling); } \ + NS_IMETHOD SetScrolling(const nsAReadableString& aScrolling) { return _to SetScrolling(aScrolling); } \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc) { return _to GetSrc(aSrc); } \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc) { return _to SetSrc(aSrc); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument) { return _to GetContentDocument(aContentDocument); } \ NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument) { return _to SetContentDocument(aContentDocument); } \ diff --git a/dom/public/html/nsIDOMHTMLImageElement.h b/dom/public/html/nsIDOMHTMLImageElement.h index ac7497f44979..02c775237de6 100644 --- a/dom/public/html/nsIDOMHTMLImageElement.h +++ b/dom/public/html/nsIDOMHTMLImageElement.h @@ -38,104 +38,104 @@ class nsIDOMHTMLImageElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLIMAGEELEMENT_IID; return iid; } - NS_IMETHOD GetLowSrc(nsString& aLowSrc)=0; - NS_IMETHOD SetLowSrc(const nsString& aLowSrc)=0; + NS_IMETHOD GetLowSrc(nsAWritableString& aLowSrc)=0; + NS_IMETHOD SetLowSrc(const nsAReadableString& aLowSrc)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetAlt(nsString& aAlt)=0; - NS_IMETHOD SetAlt(const nsString& aAlt)=0; + NS_IMETHOD GetAlt(nsAWritableString& aAlt)=0; + NS_IMETHOD SetAlt(const nsAReadableString& aAlt)=0; - NS_IMETHOD GetBorder(nsString& aBorder)=0; - NS_IMETHOD SetBorder(const nsString& aBorder)=0; + NS_IMETHOD GetBorder(nsAWritableString& aBorder)=0; + NS_IMETHOD SetBorder(const nsAReadableString& aBorder)=0; - NS_IMETHOD GetHeight(nsString& aHeight)=0; - NS_IMETHOD SetHeight(const nsString& aHeight)=0; + NS_IMETHOD GetHeight(nsAWritableString& aHeight)=0; + NS_IMETHOD SetHeight(const nsAReadableString& aHeight)=0; - NS_IMETHOD GetHspace(nsString& aHspace)=0; - NS_IMETHOD SetHspace(const nsString& aHspace)=0; + NS_IMETHOD GetHspace(nsAWritableString& aHspace)=0; + NS_IMETHOD SetHspace(const nsAReadableString& aHspace)=0; NS_IMETHOD GetIsMap(PRBool* aIsMap)=0; NS_IMETHOD SetIsMap(PRBool aIsMap)=0; - NS_IMETHOD GetLongDesc(nsString& aLongDesc)=0; - NS_IMETHOD SetLongDesc(const nsString& aLongDesc)=0; + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc)=0; + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc)=0; - NS_IMETHOD GetSrc(nsString& aSrc)=0; - NS_IMETHOD SetSrc(const nsString& aSrc)=0; + NS_IMETHOD GetSrc(nsAWritableString& aSrc)=0; + NS_IMETHOD SetSrc(const nsAReadableString& aSrc)=0; - NS_IMETHOD GetVspace(nsString& aVspace)=0; - NS_IMETHOD SetVspace(const nsString& aVspace)=0; + NS_IMETHOD GetVspace(nsAWritableString& aVspace)=0; + NS_IMETHOD SetVspace(const nsAReadableString& aVspace)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; - NS_IMETHOD GetUseMap(nsString& aUseMap)=0; - NS_IMETHOD SetUseMap(const nsString& aUseMap)=0; + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap)=0; + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap)=0; }; #define NS_DECL_IDOMHTMLIMAGEELEMENT \ - NS_IMETHOD GetLowSrc(nsString& aLowSrc); \ - NS_IMETHOD SetLowSrc(const nsString& aLowSrc); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetAlt(nsString& aAlt); \ - NS_IMETHOD SetAlt(const nsString& aAlt); \ - NS_IMETHOD GetBorder(nsString& aBorder); \ - NS_IMETHOD SetBorder(const nsString& aBorder); \ - NS_IMETHOD GetHeight(nsString& aHeight); \ - NS_IMETHOD SetHeight(const nsString& aHeight); \ - NS_IMETHOD GetHspace(nsString& aHspace); \ - NS_IMETHOD SetHspace(const nsString& aHspace); \ + NS_IMETHOD GetLowSrc(nsAWritableString& aLowSrc); \ + NS_IMETHOD SetLowSrc(const nsAReadableString& aLowSrc); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt); \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt); \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder); \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder); \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight); \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight); \ + NS_IMETHOD GetHspace(nsAWritableString& aHspace); \ + NS_IMETHOD SetHspace(const nsAReadableString& aHspace); \ NS_IMETHOD GetIsMap(PRBool* aIsMap); \ NS_IMETHOD SetIsMap(PRBool aIsMap); \ - NS_IMETHOD GetLongDesc(nsString& aLongDesc); \ - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); \ - NS_IMETHOD GetSrc(nsString& aSrc); \ - NS_IMETHOD SetSrc(const nsString& aSrc); \ - NS_IMETHOD GetVspace(nsString& aVspace); \ - NS_IMETHOD SetVspace(const nsString& aVspace); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ - NS_IMETHOD GetUseMap(nsString& aUseMap); \ - NS_IMETHOD SetUseMap(const nsString& aUseMap); \ + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc); \ + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc); \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc); \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc); \ + NS_IMETHOD GetVspace(nsAWritableString& aVspace); \ + NS_IMETHOD SetVspace(const nsAReadableString& aVspace); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap); \ + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap); \ #define NS_FORWARD_IDOMHTMLIMAGEELEMENT(_to) \ - NS_IMETHOD GetLowSrc(nsString& aLowSrc) { return _to GetLowSrc(aLowSrc); } \ - NS_IMETHOD SetLowSrc(const nsString& aLowSrc) { return _to SetLowSrc(aLowSrc); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetAlt(nsString& aAlt) { return _to GetAlt(aAlt); } \ - NS_IMETHOD SetAlt(const nsString& aAlt) { return _to SetAlt(aAlt); } \ - NS_IMETHOD GetBorder(nsString& aBorder) { return _to GetBorder(aBorder); } \ - NS_IMETHOD SetBorder(const nsString& aBorder) { return _to SetBorder(aBorder); } \ - NS_IMETHOD GetHeight(nsString& aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD SetHeight(const nsString& aHeight) { return _to SetHeight(aHeight); } \ - NS_IMETHOD GetHspace(nsString& aHspace) { return _to GetHspace(aHspace); } \ - NS_IMETHOD SetHspace(const nsString& aHspace) { return _to SetHspace(aHspace); } \ + NS_IMETHOD GetLowSrc(nsAWritableString& aLowSrc) { return _to GetLowSrc(aLowSrc); } \ + NS_IMETHOD SetLowSrc(const nsAReadableString& aLowSrc) { return _to SetLowSrc(aLowSrc); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt) { return _to GetAlt(aAlt); } \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt) { return _to SetAlt(aAlt); } \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder) { return _to GetBorder(aBorder); } \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder) { return _to SetBorder(aBorder); } \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight) { return _to GetHeight(aHeight); } \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight) { return _to SetHeight(aHeight); } \ + NS_IMETHOD GetHspace(nsAWritableString& aHspace) { return _to GetHspace(aHspace); } \ + NS_IMETHOD SetHspace(const nsAReadableString& aHspace) { return _to SetHspace(aHspace); } \ NS_IMETHOD GetIsMap(PRBool* aIsMap) { return _to GetIsMap(aIsMap); } \ NS_IMETHOD SetIsMap(PRBool aIsMap) { return _to SetIsMap(aIsMap); } \ - NS_IMETHOD GetLongDesc(nsString& aLongDesc) { return _to GetLongDesc(aLongDesc); } \ - NS_IMETHOD SetLongDesc(const nsString& aLongDesc) { return _to SetLongDesc(aLongDesc); } \ - NS_IMETHOD GetSrc(nsString& aSrc) { return _to GetSrc(aSrc); } \ - NS_IMETHOD SetSrc(const nsString& aSrc) { return _to SetSrc(aSrc); } \ - NS_IMETHOD GetVspace(nsString& aVspace) { return _to GetVspace(aVspace); } \ - NS_IMETHOD SetVspace(const nsString& aVspace) { return _to SetVspace(aVspace); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ - NS_IMETHOD GetUseMap(nsString& aUseMap) { return _to GetUseMap(aUseMap); } \ - NS_IMETHOD SetUseMap(const nsString& aUseMap) { return _to SetUseMap(aUseMap); } \ + NS_IMETHOD GetLongDesc(nsAWritableString& aLongDesc) { return _to GetLongDesc(aLongDesc); } \ + NS_IMETHOD SetLongDesc(const nsAReadableString& aLongDesc) { return _to SetLongDesc(aLongDesc); } \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc) { return _to GetSrc(aSrc); } \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc) { return _to SetSrc(aSrc); } \ + NS_IMETHOD GetVspace(nsAWritableString& aVspace) { return _to GetVspace(aVspace); } \ + NS_IMETHOD SetVspace(const nsAReadableString& aVspace) { return _to SetVspace(aVspace); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap) { return _to GetUseMap(aUseMap); } \ + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap) { return _to SetUseMap(aUseMap); } \ extern "C" NS_DOM nsresult NS_InitHTMLImageElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLInputElement.h b/dom/public/html/nsIDOMHTMLInputElement.h index 44566bdf1c1c..dd80becf6e87 100644 --- a/dom/public/html/nsIDOMHTMLInputElement.h +++ b/dom/public/html/nsIDOMHTMLInputElement.h @@ -39,25 +39,25 @@ class nsIDOMHTMLInputElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLINPUTELEMENT_IID; return iid; } - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue)=0; - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue)=0; + NS_IMETHOD GetDefaultValue(nsAWritableString& aDefaultValue)=0; + NS_IMETHOD SetDefaultValue(const nsAReadableString& aDefaultValue)=0; NS_IMETHOD GetDefaultChecked(PRBool* aDefaultChecked)=0; NS_IMETHOD SetDefaultChecked(PRBool aDefaultChecked)=0; NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm)=0; - NS_IMETHOD GetAccept(nsString& aAccept)=0; - NS_IMETHOD SetAccept(const nsString& aAccept)=0; + NS_IMETHOD GetAccept(nsAWritableString& aAccept)=0; + NS_IMETHOD SetAccept(const nsAReadableString& aAccept)=0; - NS_IMETHOD GetAccessKey(nsString& aAccessKey)=0; - NS_IMETHOD SetAccessKey(const nsString& aAccessKey)=0; + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey)=0; + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey)=0; - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetAlt(nsString& aAlt)=0; - NS_IMETHOD SetAlt(const nsString& aAlt)=0; + NS_IMETHOD GetAlt(nsAWritableString& aAlt)=0; + NS_IMETHOD SetAlt(const nsAReadableString& aAlt)=0; NS_IMETHOD GetChecked(PRBool* aChecked)=0; NS_IMETHOD SetChecked(PRBool aChecked)=0; @@ -68,29 +68,29 @@ public: NS_IMETHOD GetMaxLength(PRInt32* aMaxLength)=0; NS_IMETHOD SetMaxLength(PRInt32 aMaxLength)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; NS_IMETHOD GetReadOnly(PRBool* aReadOnly)=0; NS_IMETHOD SetReadOnly(PRBool aReadOnly)=0; - NS_IMETHOD GetSize(nsString& aSize)=0; - NS_IMETHOD SetSize(const nsString& aSize)=0; + NS_IMETHOD GetSize(nsAWritableString& aSize)=0; + NS_IMETHOD SetSize(const nsAReadableString& aSize)=0; - NS_IMETHOD GetSrc(nsString& aSrc)=0; - NS_IMETHOD SetSrc(const nsString& aSrc)=0; + NS_IMETHOD GetSrc(nsAWritableString& aSrc)=0; + NS_IMETHOD SetSrc(const nsAReadableString& aSrc)=0; NS_IMETHOD GetTabIndex(PRInt32* aTabIndex)=0; NS_IMETHOD SetTabIndex(PRInt32 aTabIndex)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; - NS_IMETHOD GetUseMap(nsString& aUseMap)=0; - NS_IMETHOD SetUseMap(const nsString& aUseMap)=0; + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap)=0; + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap)=0; - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; NS_IMETHOD Blur()=0; @@ -103,41 +103,41 @@ public: #define NS_DECL_IDOMHTMLINPUTELEMENT \ - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue); \ - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue); \ + NS_IMETHOD GetDefaultValue(nsAWritableString& aDefaultValue); \ + NS_IMETHOD SetDefaultValue(const nsAReadableString& aDefaultValue); \ NS_IMETHOD GetDefaultChecked(PRBool* aDefaultChecked); \ NS_IMETHOD SetDefaultChecked(PRBool aDefaultChecked); \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ - NS_IMETHOD GetAccept(nsString& aAccept); \ - NS_IMETHOD SetAccept(const nsString& aAccept); \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey); \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetAlt(nsString& aAlt); \ - NS_IMETHOD SetAlt(const nsString& aAlt); \ + NS_IMETHOD GetAccept(nsAWritableString& aAccept); \ + NS_IMETHOD SetAccept(const nsAReadableString& aAccept); \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey); \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt); \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt); \ NS_IMETHOD GetChecked(PRBool* aChecked); \ NS_IMETHOD SetChecked(PRBool aChecked); \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ NS_IMETHOD GetMaxLength(PRInt32* aMaxLength); \ NS_IMETHOD SetMaxLength(PRInt32 aMaxLength); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ NS_IMETHOD GetReadOnly(PRBool* aReadOnly); \ NS_IMETHOD SetReadOnly(PRBool aReadOnly); \ - NS_IMETHOD GetSize(nsString& aSize); \ - NS_IMETHOD SetSize(const nsString& aSize); \ - NS_IMETHOD GetSrc(nsString& aSrc); \ - NS_IMETHOD SetSrc(const nsString& aSrc); \ + NS_IMETHOD GetSize(nsAWritableString& aSize); \ + NS_IMETHOD SetSize(const nsAReadableString& aSize); \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc); \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc); \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ - NS_IMETHOD GetUseMap(nsString& aUseMap); \ - NS_IMETHOD SetUseMap(const nsString& aUseMap); \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap); \ + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ NS_IMETHOD Blur(); \ NS_IMETHOD Focus(); \ NS_IMETHOD Select(); \ @@ -146,41 +146,41 @@ public: #define NS_FORWARD_IDOMHTMLINPUTELEMENT(_to) \ - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue) { return _to GetDefaultValue(aDefaultValue); } \ - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue) { return _to SetDefaultValue(aDefaultValue); } \ + NS_IMETHOD GetDefaultValue(nsAWritableString& aDefaultValue) { return _to GetDefaultValue(aDefaultValue); } \ + NS_IMETHOD SetDefaultValue(const nsAReadableString& aDefaultValue) { return _to SetDefaultValue(aDefaultValue); } \ NS_IMETHOD GetDefaultChecked(PRBool* aDefaultChecked) { return _to GetDefaultChecked(aDefaultChecked); } \ NS_IMETHOD SetDefaultChecked(PRBool aDefaultChecked) { return _to SetDefaultChecked(aDefaultChecked); } \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ - NS_IMETHOD GetAccept(nsString& aAccept) { return _to GetAccept(aAccept); } \ - NS_IMETHOD SetAccept(const nsString& aAccept) { return _to SetAccept(aAccept); } \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetAlt(nsString& aAlt) { return _to GetAlt(aAlt); } \ - NS_IMETHOD SetAlt(const nsString& aAlt) { return _to SetAlt(aAlt); } \ + NS_IMETHOD GetAccept(nsAWritableString& aAccept) { return _to GetAccept(aAccept); } \ + NS_IMETHOD SetAccept(const nsAReadableString& aAccept) { return _to SetAccept(aAccept); } \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlt(nsAWritableString& aAlt) { return _to GetAlt(aAlt); } \ + NS_IMETHOD SetAlt(const nsAReadableString& aAlt) { return _to SetAlt(aAlt); } \ NS_IMETHOD GetChecked(PRBool* aChecked) { return _to GetChecked(aChecked); } \ NS_IMETHOD SetChecked(PRBool aChecked) { return _to SetChecked(aChecked); } \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ NS_IMETHOD GetMaxLength(PRInt32* aMaxLength) { return _to GetMaxLength(aMaxLength); } \ NS_IMETHOD SetMaxLength(PRInt32 aMaxLength) { return _to SetMaxLength(aMaxLength); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ NS_IMETHOD GetReadOnly(PRBool* aReadOnly) { return _to GetReadOnly(aReadOnly); } \ NS_IMETHOD SetReadOnly(PRBool aReadOnly) { return _to SetReadOnly(aReadOnly); } \ - NS_IMETHOD GetSize(nsString& aSize) { return _to GetSize(aSize); } \ - NS_IMETHOD SetSize(const nsString& aSize) { return _to SetSize(aSize); } \ - NS_IMETHOD GetSrc(nsString& aSrc) { return _to GetSrc(aSrc); } \ - NS_IMETHOD SetSrc(const nsString& aSrc) { return _to SetSrc(aSrc); } \ + NS_IMETHOD GetSize(nsAWritableString& aSize) { return _to GetSize(aSize); } \ + NS_IMETHOD SetSize(const nsAReadableString& aSize) { return _to SetSize(aSize); } \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc) { return _to GetSrc(aSrc); } \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc) { return _to SetSrc(aSrc); } \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) { return _to SetTabIndex(aTabIndex); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ - NS_IMETHOD GetUseMap(nsString& aUseMap) { return _to GetUseMap(aUseMap); } \ - NS_IMETHOD SetUseMap(const nsString& aUseMap) { return _to SetUseMap(aUseMap); } \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap) { return _to GetUseMap(aUseMap); } \ + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap) { return _to SetUseMap(aUseMap); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ NS_IMETHOD Blur() { return _to Blur(); } \ NS_IMETHOD Focus() { return _to Focus(); } \ NS_IMETHOD Select() { return _to Select(); } \ diff --git a/dom/public/html/nsIDOMHTMLIsIndexElement.h b/dom/public/html/nsIDOMHTMLIsIndexElement.h index 9b316f3efcbe..1604b633cb1f 100644 --- a/dom/public/html/nsIDOMHTMLIsIndexElement.h +++ b/dom/public/html/nsIDOMHTMLIsIndexElement.h @@ -41,22 +41,22 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm)=0; - NS_IMETHOD GetPrompt(nsString& aPrompt)=0; - NS_IMETHOD SetPrompt(const nsString& aPrompt)=0; + NS_IMETHOD GetPrompt(nsAWritableString& aPrompt)=0; + NS_IMETHOD SetPrompt(const nsAReadableString& aPrompt)=0; }; #define NS_DECL_IDOMHTMLISINDEXELEMENT \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ - NS_IMETHOD GetPrompt(nsString& aPrompt); \ - NS_IMETHOD SetPrompt(const nsString& aPrompt); \ + NS_IMETHOD GetPrompt(nsAWritableString& aPrompt); \ + NS_IMETHOD SetPrompt(const nsAReadableString& aPrompt); \ #define NS_FORWARD_IDOMHTMLISINDEXELEMENT(_to) \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ - NS_IMETHOD GetPrompt(nsString& aPrompt) { return _to GetPrompt(aPrompt); } \ - NS_IMETHOD SetPrompt(const nsString& aPrompt) { return _to SetPrompt(aPrompt); } \ + NS_IMETHOD GetPrompt(nsAWritableString& aPrompt) { return _to GetPrompt(aPrompt); } \ + NS_IMETHOD SetPrompt(const nsAReadableString& aPrompt) { return _to SetPrompt(aPrompt); } \ extern "C" NS_DOM nsresult NS_InitHTMLIsIndexElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLLIElement.h b/dom/public/html/nsIDOMHTMLLIElement.h index f7cc7b895dc8..dea6088c9a4d 100644 --- a/dom/public/html/nsIDOMHTMLLIElement.h +++ b/dom/public/html/nsIDOMHTMLLIElement.h @@ -38,8 +38,8 @@ class nsIDOMHTMLLIElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLLIELEMENT_IID; return iid; } - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; NS_IMETHOD GetValue(PRInt32* aValue)=0; NS_IMETHOD SetValue(PRInt32 aValue)=0; @@ -47,16 +47,16 @@ public: #define NS_DECL_IDOMHTMLLIELEMENT \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ NS_IMETHOD GetValue(PRInt32* aValue); \ NS_IMETHOD SetValue(PRInt32 aValue); \ #define NS_FORWARD_IDOMHTMLLIELEMENT(_to) \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ NS_IMETHOD GetValue(PRInt32* aValue) { return _to GetValue(aValue); } \ NS_IMETHOD SetValue(PRInt32 aValue) { return _to SetValue(aValue); } \ diff --git a/dom/public/html/nsIDOMHTMLLabelElement.h b/dom/public/html/nsIDOMHTMLLabelElement.h index afdf9d7483ae..714ea9ea17f6 100644 --- a/dom/public/html/nsIDOMHTMLLabelElement.h +++ b/dom/public/html/nsIDOMHTMLLabelElement.h @@ -41,29 +41,29 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm)=0; - NS_IMETHOD GetAccessKey(nsString& aAccessKey)=0; - NS_IMETHOD SetAccessKey(const nsString& aAccessKey)=0; + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey)=0; + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey)=0; - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor)=0; - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor)=0; + NS_IMETHOD GetHtmlFor(nsAWritableString& aHtmlFor)=0; + NS_IMETHOD SetHtmlFor(const nsAReadableString& aHtmlFor)=0; }; #define NS_DECL_IDOMHTMLLABELELEMENT \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey); \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); \ - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); \ - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey); \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey); \ + NS_IMETHOD GetHtmlFor(nsAWritableString& aHtmlFor); \ + NS_IMETHOD SetHtmlFor(const nsAReadableString& aHtmlFor); \ #define NS_FORWARD_IDOMHTMLLABELELEMENT(_to) \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor) { return _to GetHtmlFor(aHtmlFor); } \ - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor) { return _to SetHtmlFor(aHtmlFor); } \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ + NS_IMETHOD GetHtmlFor(nsAWritableString& aHtmlFor) { return _to GetHtmlFor(aHtmlFor); } \ + NS_IMETHOD SetHtmlFor(const nsAReadableString& aHtmlFor) { return _to SetHtmlFor(aHtmlFor); } \ extern "C" NS_DOM nsresult NS_InitHTMLLabelElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLLayerElement.h b/dom/public/html/nsIDOMHTMLLayerElement.h index efad0d6d258d..a5a09b68ee26 100644 --- a/dom/public/html/nsIDOMHTMLLayerElement.h +++ b/dom/public/html/nsIDOMHTMLLayerElement.h @@ -45,17 +45,17 @@ public: NS_IMETHOD GetLeft(PRInt32* aLeft)=0; NS_IMETHOD SetLeft(PRInt32 aLeft)=0; - NS_IMETHOD GetVisibility(nsString& aVisibility)=0; - NS_IMETHOD SetVisibility(const nsString& aVisibility)=0; + NS_IMETHOD GetVisibility(nsAWritableString& aVisibility)=0; + NS_IMETHOD SetVisibility(const nsAReadableString& aVisibility)=0; - NS_IMETHOD GetBackground(nsString& aBackground)=0; - NS_IMETHOD SetBackground(const nsString& aBackground)=0; + NS_IMETHOD GetBackground(nsAWritableString& aBackground)=0; + NS_IMETHOD SetBackground(const nsAReadableString& aBackground)=0; - NS_IMETHOD GetBgColor(nsString& aBgColor)=0; - NS_IMETHOD SetBgColor(const nsString& aBgColor)=0; + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor)=0; + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; NS_IMETHOD GetZIndex(PRInt32* aZIndex)=0; NS_IMETHOD SetZIndex(PRInt32 aZIndex)=0; @@ -69,14 +69,14 @@ public: NS_IMETHOD SetTop(PRInt32 aTop); \ NS_IMETHOD GetLeft(PRInt32* aLeft); \ NS_IMETHOD SetLeft(PRInt32 aLeft); \ - NS_IMETHOD GetVisibility(nsString& aVisibility); \ - NS_IMETHOD SetVisibility(const nsString& aVisibility); \ - NS_IMETHOD GetBackground(nsString& aBackground); \ - NS_IMETHOD SetBackground(const nsString& aBackground); \ - NS_IMETHOD GetBgColor(nsString& aBgColor); \ - NS_IMETHOD SetBgColor(const nsString& aBgColor); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetVisibility(nsAWritableString& aVisibility); \ + NS_IMETHOD SetVisibility(const nsAReadableString& aVisibility); \ + NS_IMETHOD GetBackground(nsAWritableString& aBackground); \ + NS_IMETHOD SetBackground(const nsAReadableString& aBackground); \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor); \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ NS_IMETHOD GetZIndex(PRInt32* aZIndex); \ NS_IMETHOD SetZIndex(PRInt32 aZIndex); \ NS_IMETHOD GetDocument(nsIDOMDocument** aDocument); \ @@ -88,14 +88,14 @@ public: NS_IMETHOD SetTop(PRInt32 aTop) { return _to SetTop(aTop); } \ NS_IMETHOD GetLeft(PRInt32* aLeft) { return _to GetLeft(aLeft); } \ NS_IMETHOD SetLeft(PRInt32 aLeft) { return _to SetLeft(aLeft); } \ - NS_IMETHOD GetVisibility(nsString& aVisibility) { return _to GetVisibility(aVisibility); } \ - NS_IMETHOD SetVisibility(const nsString& aVisibility) { return _to SetVisibility(aVisibility); } \ - NS_IMETHOD GetBackground(nsString& aBackground) { return _to GetBackground(aBackground); } \ - NS_IMETHOD SetBackground(const nsString& aBackground) { return _to SetBackground(aBackground); } \ - NS_IMETHOD GetBgColor(nsString& aBgColor) { return _to GetBgColor(aBgColor); } \ - NS_IMETHOD SetBgColor(const nsString& aBgColor) { return _to SetBgColor(aBgColor); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetVisibility(nsAWritableString& aVisibility) { return _to GetVisibility(aVisibility); } \ + NS_IMETHOD SetVisibility(const nsAReadableString& aVisibility) { return _to SetVisibility(aVisibility); } \ + NS_IMETHOD GetBackground(nsAWritableString& aBackground) { return _to GetBackground(aBackground); } \ + NS_IMETHOD SetBackground(const nsAReadableString& aBackground) { return _to SetBackground(aBackground); } \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor) { return _to GetBgColor(aBgColor); } \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor) { return _to SetBgColor(aBgColor); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ NS_IMETHOD GetZIndex(PRInt32* aZIndex) { return _to GetZIndex(aZIndex); } \ NS_IMETHOD SetZIndex(PRInt32 aZIndex) { return _to SetZIndex(aZIndex); } \ NS_IMETHOD GetDocument(nsIDOMDocument** aDocument) { return _to GetDocument(aDocument); } \ diff --git a/dom/public/html/nsIDOMHTMLLegendElement.h b/dom/public/html/nsIDOMHTMLLegendElement.h index 6b7c893c045b..77d1799c0891 100644 --- a/dom/public/html/nsIDOMHTMLLegendElement.h +++ b/dom/public/html/nsIDOMHTMLLegendElement.h @@ -41,29 +41,29 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm)=0; - NS_IMETHOD GetAccessKey(nsString& aAccessKey)=0; - NS_IMETHOD SetAccessKey(const nsString& aAccessKey)=0; + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey)=0; + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey)=0; - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; }; #define NS_DECL_IDOMHTMLLEGENDELEMENT \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey); \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey); \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ #define NS_FORWARD_IDOMHTMLLEGENDELEMENT(_to) \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ extern "C" NS_DOM nsresult NS_InitHTMLLegendElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLLinkElement.h b/dom/public/html/nsIDOMHTMLLinkElement.h index e617b6cf6efe..c62afee1e8a5 100644 --- a/dom/public/html/nsIDOMHTMLLinkElement.h +++ b/dom/public/html/nsIDOMHTMLLinkElement.h @@ -41,73 +41,73 @@ public: NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; - NS_IMETHOD GetCharset(nsString& aCharset)=0; - NS_IMETHOD SetCharset(const nsString& aCharset)=0; + NS_IMETHOD GetCharset(nsAWritableString& aCharset)=0; + NS_IMETHOD SetCharset(const nsAReadableString& aCharset)=0; - NS_IMETHOD GetHref(nsString& aHref)=0; - NS_IMETHOD SetHref(const nsString& aHref)=0; + NS_IMETHOD GetHref(nsAWritableString& aHref)=0; + NS_IMETHOD SetHref(const nsAReadableString& aHref)=0; - NS_IMETHOD GetHreflang(nsString& aHreflang)=0; - NS_IMETHOD SetHreflang(const nsString& aHreflang)=0; + NS_IMETHOD GetHreflang(nsAWritableString& aHreflang)=0; + NS_IMETHOD SetHreflang(const nsAReadableString& aHreflang)=0; - NS_IMETHOD GetMedia(nsString& aMedia)=0; - NS_IMETHOD SetMedia(const nsString& aMedia)=0; + NS_IMETHOD GetMedia(nsAWritableString& aMedia)=0; + NS_IMETHOD SetMedia(const nsAReadableString& aMedia)=0; - NS_IMETHOD GetRel(nsString& aRel)=0; - NS_IMETHOD SetRel(const nsString& aRel)=0; + NS_IMETHOD GetRel(nsAWritableString& aRel)=0; + NS_IMETHOD SetRel(const nsAReadableString& aRel)=0; - NS_IMETHOD GetRev(nsString& aRev)=0; - NS_IMETHOD SetRev(const nsString& aRev)=0; + NS_IMETHOD GetRev(nsAWritableString& aRev)=0; + NS_IMETHOD SetRev(const nsAReadableString& aRev)=0; - NS_IMETHOD GetTarget(nsString& aTarget)=0; - NS_IMETHOD SetTarget(const nsString& aTarget)=0; + NS_IMETHOD GetTarget(nsAWritableString& aTarget)=0; + NS_IMETHOD SetTarget(const nsAReadableString& aTarget)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; }; #define NS_DECL_IDOMHTMLLINKELEMENT \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ - NS_IMETHOD GetCharset(nsString& aCharset); \ - NS_IMETHOD SetCharset(const nsString& aCharset); \ - NS_IMETHOD GetHref(nsString& aHref); \ - NS_IMETHOD SetHref(const nsString& aHref); \ - NS_IMETHOD GetHreflang(nsString& aHreflang); \ - NS_IMETHOD SetHreflang(const nsString& aHreflang); \ - NS_IMETHOD GetMedia(nsString& aMedia); \ - NS_IMETHOD SetMedia(const nsString& aMedia); \ - NS_IMETHOD GetRel(nsString& aRel); \ - NS_IMETHOD SetRel(const nsString& aRel); \ - NS_IMETHOD GetRev(nsString& aRev); \ - NS_IMETHOD SetRev(const nsString& aRev); \ - NS_IMETHOD GetTarget(nsString& aTarget); \ - NS_IMETHOD SetTarget(const nsString& aTarget); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ + NS_IMETHOD GetCharset(nsAWritableString& aCharset); \ + NS_IMETHOD SetCharset(const nsAReadableString& aCharset); \ + NS_IMETHOD GetHref(nsAWritableString& aHref); \ + NS_IMETHOD SetHref(const nsAReadableString& aHref); \ + NS_IMETHOD GetHreflang(nsAWritableString& aHreflang); \ + NS_IMETHOD SetHreflang(const nsAReadableString& aHreflang); \ + NS_IMETHOD GetMedia(nsAWritableString& aMedia); \ + NS_IMETHOD SetMedia(const nsAReadableString& aMedia); \ + NS_IMETHOD GetRel(nsAWritableString& aRel); \ + NS_IMETHOD SetRel(const nsAReadableString& aRel); \ + NS_IMETHOD GetRev(nsAWritableString& aRev); \ + NS_IMETHOD SetRev(const nsAReadableString& aRev); \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget); \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ #define NS_FORWARD_IDOMHTMLLINKELEMENT(_to) \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ - NS_IMETHOD GetCharset(nsString& aCharset) { return _to GetCharset(aCharset); } \ - NS_IMETHOD SetCharset(const nsString& aCharset) { return _to SetCharset(aCharset); } \ - NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \ - NS_IMETHOD SetHref(const nsString& aHref) { return _to SetHref(aHref); } \ - NS_IMETHOD GetHreflang(nsString& aHreflang) { return _to GetHreflang(aHreflang); } \ - NS_IMETHOD SetHreflang(const nsString& aHreflang) { return _to SetHreflang(aHreflang); } \ - NS_IMETHOD GetMedia(nsString& aMedia) { return _to GetMedia(aMedia); } \ - NS_IMETHOD SetMedia(const nsString& aMedia) { return _to SetMedia(aMedia); } \ - NS_IMETHOD GetRel(nsString& aRel) { return _to GetRel(aRel); } \ - NS_IMETHOD SetRel(const nsString& aRel) { return _to SetRel(aRel); } \ - NS_IMETHOD GetRev(nsString& aRev) { return _to GetRev(aRev); } \ - NS_IMETHOD SetRev(const nsString& aRev) { return _to SetRev(aRev); } \ - NS_IMETHOD GetTarget(nsString& aTarget) { return _to GetTarget(aTarget); } \ - NS_IMETHOD SetTarget(const nsString& aTarget) { return _to SetTarget(aTarget); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetCharset(nsAWritableString& aCharset) { return _to GetCharset(aCharset); } \ + NS_IMETHOD SetCharset(const nsAReadableString& aCharset) { return _to SetCharset(aCharset); } \ + NS_IMETHOD GetHref(nsAWritableString& aHref) { return _to GetHref(aHref); } \ + NS_IMETHOD SetHref(const nsAReadableString& aHref) { return _to SetHref(aHref); } \ + NS_IMETHOD GetHreflang(nsAWritableString& aHreflang) { return _to GetHreflang(aHreflang); } \ + NS_IMETHOD SetHreflang(const nsAReadableString& aHreflang) { return _to SetHreflang(aHreflang); } \ + NS_IMETHOD GetMedia(nsAWritableString& aMedia) { return _to GetMedia(aMedia); } \ + NS_IMETHOD SetMedia(const nsAReadableString& aMedia) { return _to SetMedia(aMedia); } \ + NS_IMETHOD GetRel(nsAWritableString& aRel) { return _to GetRel(aRel); } \ + NS_IMETHOD SetRel(const nsAReadableString& aRel) { return _to SetRel(aRel); } \ + NS_IMETHOD GetRev(nsAWritableString& aRev) { return _to GetRev(aRev); } \ + NS_IMETHOD SetRev(const nsAReadableString& aRev) { return _to SetRev(aRev); } \ + NS_IMETHOD GetTarget(nsAWritableString& aTarget) { return _to GetTarget(aTarget); } \ + NS_IMETHOD SetTarget(const nsAReadableString& aTarget) { return _to SetTarget(aTarget); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ extern "C" NS_DOM nsresult NS_InitHTMLLinkElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLMapElement.h b/dom/public/html/nsIDOMHTMLMapElement.h index 36ff67f1b6a5..f1775cb70248 100644 --- a/dom/public/html/nsIDOMHTMLMapElement.h +++ b/dom/public/html/nsIDOMHTMLMapElement.h @@ -41,22 +41,22 @@ public: NS_IMETHOD GetAreas(nsIDOMHTMLCollection** aAreas)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; }; #define NS_DECL_IDOMHTMLMAPELEMENT \ NS_IMETHOD GetAreas(nsIDOMHTMLCollection** aAreas); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ #define NS_FORWARD_IDOMHTMLMAPELEMENT(_to) \ NS_IMETHOD GetAreas(nsIDOMHTMLCollection** aAreas) { return _to GetAreas(aAreas); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ extern "C" NS_DOM nsresult NS_InitHTMLMapElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLMetaElement.h b/dom/public/html/nsIDOMHTMLMetaElement.h index b4ff801fb65d..66cc1d3d3b6d 100644 --- a/dom/public/html/nsIDOMHTMLMetaElement.h +++ b/dom/public/html/nsIDOMHTMLMetaElement.h @@ -38,41 +38,41 @@ class nsIDOMHTMLMetaElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLMETAELEMENT_IID; return iid; } - NS_IMETHOD GetContent(nsString& aContent)=0; - NS_IMETHOD SetContent(const nsString& aContent)=0; + NS_IMETHOD GetContent(nsAWritableString& aContent)=0; + NS_IMETHOD SetContent(const nsAReadableString& aContent)=0; - NS_IMETHOD GetHttpEquiv(nsString& aHttpEquiv)=0; - NS_IMETHOD SetHttpEquiv(const nsString& aHttpEquiv)=0; + NS_IMETHOD GetHttpEquiv(nsAWritableString& aHttpEquiv)=0; + NS_IMETHOD SetHttpEquiv(const nsAReadableString& aHttpEquiv)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetScheme(nsString& aScheme)=0; - NS_IMETHOD SetScheme(const nsString& aScheme)=0; + NS_IMETHOD GetScheme(nsAWritableString& aScheme)=0; + NS_IMETHOD SetScheme(const nsAReadableString& aScheme)=0; }; #define NS_DECL_IDOMHTMLMETAELEMENT \ - NS_IMETHOD GetContent(nsString& aContent); \ - NS_IMETHOD SetContent(const nsString& aContent); \ - NS_IMETHOD GetHttpEquiv(nsString& aHttpEquiv); \ - NS_IMETHOD SetHttpEquiv(const nsString& aHttpEquiv); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetScheme(nsString& aScheme); \ - NS_IMETHOD SetScheme(const nsString& aScheme); \ + NS_IMETHOD GetContent(nsAWritableString& aContent); \ + NS_IMETHOD SetContent(const nsAReadableString& aContent); \ + NS_IMETHOD GetHttpEquiv(nsAWritableString& aHttpEquiv); \ + NS_IMETHOD SetHttpEquiv(const nsAReadableString& aHttpEquiv); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetScheme(nsAWritableString& aScheme); \ + NS_IMETHOD SetScheme(const nsAReadableString& aScheme); \ #define NS_FORWARD_IDOMHTMLMETAELEMENT(_to) \ - NS_IMETHOD GetContent(nsString& aContent) { return _to GetContent(aContent); } \ - NS_IMETHOD SetContent(const nsString& aContent) { return _to SetContent(aContent); } \ - NS_IMETHOD GetHttpEquiv(nsString& aHttpEquiv) { return _to GetHttpEquiv(aHttpEquiv); } \ - NS_IMETHOD SetHttpEquiv(const nsString& aHttpEquiv) { return _to SetHttpEquiv(aHttpEquiv); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetScheme(nsString& aScheme) { return _to GetScheme(aScheme); } \ - NS_IMETHOD SetScheme(const nsString& aScheme) { return _to SetScheme(aScheme); } \ + NS_IMETHOD GetContent(nsAWritableString& aContent) { return _to GetContent(aContent); } \ + NS_IMETHOD SetContent(const nsAReadableString& aContent) { return _to SetContent(aContent); } \ + NS_IMETHOD GetHttpEquiv(nsAWritableString& aHttpEquiv) { return _to GetHttpEquiv(aHttpEquiv); } \ + NS_IMETHOD SetHttpEquiv(const nsAReadableString& aHttpEquiv) { return _to SetHttpEquiv(aHttpEquiv); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetScheme(nsAWritableString& aScheme) { return _to GetScheme(aScheme); } \ + NS_IMETHOD SetScheme(const nsAReadableString& aScheme) { return _to SetScheme(aScheme); } \ extern "C" NS_DOM nsresult NS_InitHTMLMetaElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLModElement.h b/dom/public/html/nsIDOMHTMLModElement.h index 671d7ed056a1..3d7816da9dda 100644 --- a/dom/public/html/nsIDOMHTMLModElement.h +++ b/dom/public/html/nsIDOMHTMLModElement.h @@ -38,27 +38,27 @@ class nsIDOMHTMLModElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLMODELEMENT_IID; return iid; } - NS_IMETHOD GetCite(nsString& aCite)=0; - NS_IMETHOD SetCite(const nsString& aCite)=0; + NS_IMETHOD GetCite(nsAWritableString& aCite)=0; + NS_IMETHOD SetCite(const nsAReadableString& aCite)=0; - NS_IMETHOD GetDateTime(nsString& aDateTime)=0; - NS_IMETHOD SetDateTime(const nsString& aDateTime)=0; + NS_IMETHOD GetDateTime(nsAWritableString& aDateTime)=0; + NS_IMETHOD SetDateTime(const nsAReadableString& aDateTime)=0; }; #define NS_DECL_IDOMHTMLMODELEMENT \ - NS_IMETHOD GetCite(nsString& aCite); \ - NS_IMETHOD SetCite(const nsString& aCite); \ - NS_IMETHOD GetDateTime(nsString& aDateTime); \ - NS_IMETHOD SetDateTime(const nsString& aDateTime); \ + NS_IMETHOD GetCite(nsAWritableString& aCite); \ + NS_IMETHOD SetCite(const nsAReadableString& aCite); \ + NS_IMETHOD GetDateTime(nsAWritableString& aDateTime); \ + NS_IMETHOD SetDateTime(const nsAReadableString& aDateTime); \ #define NS_FORWARD_IDOMHTMLMODELEMENT(_to) \ - NS_IMETHOD GetCite(nsString& aCite) { return _to GetCite(aCite); } \ - NS_IMETHOD SetCite(const nsString& aCite) { return _to SetCite(aCite); } \ - NS_IMETHOD GetDateTime(nsString& aDateTime) { return _to GetDateTime(aDateTime); } \ - NS_IMETHOD SetDateTime(const nsString& aDateTime) { return _to SetDateTime(aDateTime); } \ + NS_IMETHOD GetCite(nsAWritableString& aCite) { return _to GetCite(aCite); } \ + NS_IMETHOD SetCite(const nsAReadableString& aCite) { return _to SetCite(aCite); } \ + NS_IMETHOD GetDateTime(nsAWritableString& aDateTime) { return _to GetDateTime(aDateTime); } \ + NS_IMETHOD SetDateTime(const nsAReadableString& aDateTime) { return _to SetDateTime(aDateTime); } \ extern "C" NS_DOM nsresult NS_InitHTMLModElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLOListElement.h b/dom/public/html/nsIDOMHTMLOListElement.h index 102e65448bc6..9023e77562cf 100644 --- a/dom/public/html/nsIDOMHTMLOListElement.h +++ b/dom/public/html/nsIDOMHTMLOListElement.h @@ -44,8 +44,8 @@ public: NS_IMETHOD GetStart(PRInt32* aStart)=0; NS_IMETHOD SetStart(PRInt32 aStart)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; }; @@ -54,8 +54,8 @@ public: NS_IMETHOD SetCompact(PRBool aCompact); \ NS_IMETHOD GetStart(PRInt32* aStart); \ NS_IMETHOD SetStart(PRInt32 aStart); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ @@ -64,8 +64,8 @@ public: NS_IMETHOD SetCompact(PRBool aCompact) { return _to SetCompact(aCompact); } \ NS_IMETHOD GetStart(PRInt32* aStart) { return _to GetStart(aStart); } \ NS_IMETHOD SetStart(PRInt32 aStart) { return _to SetStart(aStart); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ extern "C" NS_DOM nsresult NS_InitHTMLOListElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLObjectElement.h b/dom/public/html/nsIDOMHTMLObjectElement.h index c333983b8ac3..339c02e632c0 100644 --- a/dom/public/html/nsIDOMHTMLObjectElement.h +++ b/dom/public/html/nsIDOMHTMLObjectElement.h @@ -42,56 +42,56 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm)=0; - NS_IMETHOD GetCode(nsString& aCode)=0; - NS_IMETHOD SetCode(const nsString& aCode)=0; + NS_IMETHOD GetCode(nsAWritableString& aCode)=0; + NS_IMETHOD SetCode(const nsAReadableString& aCode)=0; - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetArchive(nsString& aArchive)=0; - NS_IMETHOD SetArchive(const nsString& aArchive)=0; + NS_IMETHOD GetArchive(nsAWritableString& aArchive)=0; + NS_IMETHOD SetArchive(const nsAReadableString& aArchive)=0; - NS_IMETHOD GetBorder(nsString& aBorder)=0; - NS_IMETHOD SetBorder(const nsString& aBorder)=0; + NS_IMETHOD GetBorder(nsAWritableString& aBorder)=0; + NS_IMETHOD SetBorder(const nsAReadableString& aBorder)=0; - NS_IMETHOD GetCodeBase(nsString& aCodeBase)=0; - NS_IMETHOD SetCodeBase(const nsString& aCodeBase)=0; + NS_IMETHOD GetCodeBase(nsAWritableString& aCodeBase)=0; + NS_IMETHOD SetCodeBase(const nsAReadableString& aCodeBase)=0; - NS_IMETHOD GetCodeType(nsString& aCodeType)=0; - NS_IMETHOD SetCodeType(const nsString& aCodeType)=0; + NS_IMETHOD GetCodeType(nsAWritableString& aCodeType)=0; + NS_IMETHOD SetCodeType(const nsAReadableString& aCodeType)=0; - NS_IMETHOD GetData(nsString& aData)=0; - NS_IMETHOD SetData(const nsString& aData)=0; + NS_IMETHOD GetData(nsAWritableString& aData)=0; + NS_IMETHOD SetData(const nsAReadableString& aData)=0; NS_IMETHOD GetDeclare(PRBool* aDeclare)=0; NS_IMETHOD SetDeclare(PRBool aDeclare)=0; - NS_IMETHOD GetHeight(nsString& aHeight)=0; - NS_IMETHOD SetHeight(const nsString& aHeight)=0; + NS_IMETHOD GetHeight(nsAWritableString& aHeight)=0; + NS_IMETHOD SetHeight(const nsAReadableString& aHeight)=0; - NS_IMETHOD GetHspace(nsString& aHspace)=0; - NS_IMETHOD SetHspace(const nsString& aHspace)=0; + NS_IMETHOD GetHspace(nsAWritableString& aHspace)=0; + NS_IMETHOD SetHspace(const nsAReadableString& aHspace)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetStandby(nsString& aStandby)=0; - NS_IMETHOD SetStandby(const nsString& aStandby)=0; + NS_IMETHOD GetStandby(nsAWritableString& aStandby)=0; + NS_IMETHOD SetStandby(const nsAReadableString& aStandby)=0; NS_IMETHOD GetTabIndex(PRInt32* aTabIndex)=0; NS_IMETHOD SetTabIndex(PRInt32 aTabIndex)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; - NS_IMETHOD GetUseMap(nsString& aUseMap)=0; - NS_IMETHOD SetUseMap(const nsString& aUseMap)=0; + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap)=0; + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap)=0; - NS_IMETHOD GetVspace(nsString& aVspace)=0; - NS_IMETHOD SetVspace(const nsString& aVspace)=0; + NS_IMETHOD GetVspace(nsAWritableString& aVspace)=0; + NS_IMETHOD SetVspace(const nsAReadableString& aVspace)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument)=0; NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument)=0; @@ -100,40 +100,40 @@ public: #define NS_DECL_IDOMHTMLOBJECTELEMENT \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ - NS_IMETHOD GetCode(nsString& aCode); \ - NS_IMETHOD SetCode(const nsString& aCode); \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetArchive(nsString& aArchive); \ - NS_IMETHOD SetArchive(const nsString& aArchive); \ - NS_IMETHOD GetBorder(nsString& aBorder); \ - NS_IMETHOD SetBorder(const nsString& aBorder); \ - NS_IMETHOD GetCodeBase(nsString& aCodeBase); \ - NS_IMETHOD SetCodeBase(const nsString& aCodeBase); \ - NS_IMETHOD GetCodeType(nsString& aCodeType); \ - NS_IMETHOD SetCodeType(const nsString& aCodeType); \ - NS_IMETHOD GetData(nsString& aData); \ - NS_IMETHOD SetData(const nsString& aData); \ + NS_IMETHOD GetCode(nsAWritableString& aCode); \ + NS_IMETHOD SetCode(const nsAReadableString& aCode); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetArchive(nsAWritableString& aArchive); \ + NS_IMETHOD SetArchive(const nsAReadableString& aArchive); \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder); \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder); \ + NS_IMETHOD GetCodeBase(nsAWritableString& aCodeBase); \ + NS_IMETHOD SetCodeBase(const nsAReadableString& aCodeBase); \ + NS_IMETHOD GetCodeType(nsAWritableString& aCodeType); \ + NS_IMETHOD SetCodeType(const nsAReadableString& aCodeType); \ + NS_IMETHOD GetData(nsAWritableString& aData); \ + NS_IMETHOD SetData(const nsAReadableString& aData); \ NS_IMETHOD GetDeclare(PRBool* aDeclare); \ NS_IMETHOD SetDeclare(PRBool aDeclare); \ - NS_IMETHOD GetHeight(nsString& aHeight); \ - NS_IMETHOD SetHeight(const nsString& aHeight); \ - NS_IMETHOD GetHspace(nsString& aHspace); \ - NS_IMETHOD SetHspace(const nsString& aHspace); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetStandby(nsString& aStandby); \ - NS_IMETHOD SetStandby(const nsString& aStandby); \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight); \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight); \ + NS_IMETHOD GetHspace(nsAWritableString& aHspace); \ + NS_IMETHOD SetHspace(const nsAReadableString& aHspace); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetStandby(nsAWritableString& aStandby); \ + NS_IMETHOD SetStandby(const nsAReadableString& aStandby); \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ - NS_IMETHOD GetUseMap(nsString& aUseMap); \ - NS_IMETHOD SetUseMap(const nsString& aUseMap); \ - NS_IMETHOD GetVspace(nsString& aVspace); \ - NS_IMETHOD SetVspace(const nsString& aVspace); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap); \ + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap); \ + NS_IMETHOD GetVspace(nsAWritableString& aVspace); \ + NS_IMETHOD SetVspace(const nsAReadableString& aVspace); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); \ NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); \ @@ -141,40 +141,40 @@ public: #define NS_FORWARD_IDOMHTMLOBJECTELEMENT(_to) \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ - NS_IMETHOD GetCode(nsString& aCode) { return _to GetCode(aCode); } \ - NS_IMETHOD SetCode(const nsString& aCode) { return _to SetCode(aCode); } \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetArchive(nsString& aArchive) { return _to GetArchive(aArchive); } \ - NS_IMETHOD SetArchive(const nsString& aArchive) { return _to SetArchive(aArchive); } \ - NS_IMETHOD GetBorder(nsString& aBorder) { return _to GetBorder(aBorder); } \ - NS_IMETHOD SetBorder(const nsString& aBorder) { return _to SetBorder(aBorder); } \ - NS_IMETHOD GetCodeBase(nsString& aCodeBase) { return _to GetCodeBase(aCodeBase); } \ - NS_IMETHOD SetCodeBase(const nsString& aCodeBase) { return _to SetCodeBase(aCodeBase); } \ - NS_IMETHOD GetCodeType(nsString& aCodeType) { return _to GetCodeType(aCodeType); } \ - NS_IMETHOD SetCodeType(const nsString& aCodeType) { return _to SetCodeType(aCodeType); } \ - NS_IMETHOD GetData(nsString& aData) { return _to GetData(aData); } \ - NS_IMETHOD SetData(const nsString& aData) { return _to SetData(aData); } \ + NS_IMETHOD GetCode(nsAWritableString& aCode) { return _to GetCode(aCode); } \ + NS_IMETHOD SetCode(const nsAReadableString& aCode) { return _to SetCode(aCode); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetArchive(nsAWritableString& aArchive) { return _to GetArchive(aArchive); } \ + NS_IMETHOD SetArchive(const nsAReadableString& aArchive) { return _to SetArchive(aArchive); } \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder) { return _to GetBorder(aBorder); } \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder) { return _to SetBorder(aBorder); } \ + NS_IMETHOD GetCodeBase(nsAWritableString& aCodeBase) { return _to GetCodeBase(aCodeBase); } \ + NS_IMETHOD SetCodeBase(const nsAReadableString& aCodeBase) { return _to SetCodeBase(aCodeBase); } \ + NS_IMETHOD GetCodeType(nsAWritableString& aCodeType) { return _to GetCodeType(aCodeType); } \ + NS_IMETHOD SetCodeType(const nsAReadableString& aCodeType) { return _to SetCodeType(aCodeType); } \ + NS_IMETHOD GetData(nsAWritableString& aData) { return _to GetData(aData); } \ + NS_IMETHOD SetData(const nsAReadableString& aData) { return _to SetData(aData); } \ NS_IMETHOD GetDeclare(PRBool* aDeclare) { return _to GetDeclare(aDeclare); } \ NS_IMETHOD SetDeclare(PRBool aDeclare) { return _to SetDeclare(aDeclare); } \ - NS_IMETHOD GetHeight(nsString& aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD SetHeight(const nsString& aHeight) { return _to SetHeight(aHeight); } \ - NS_IMETHOD GetHspace(nsString& aHspace) { return _to GetHspace(aHspace); } \ - NS_IMETHOD SetHspace(const nsString& aHspace) { return _to SetHspace(aHspace); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetStandby(nsString& aStandby) { return _to GetStandby(aStandby); } \ - NS_IMETHOD SetStandby(const nsString& aStandby) { return _to SetStandby(aStandby); } \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight) { return _to GetHeight(aHeight); } \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight) { return _to SetHeight(aHeight); } \ + NS_IMETHOD GetHspace(nsAWritableString& aHspace) { return _to GetHspace(aHspace); } \ + NS_IMETHOD SetHspace(const nsAReadableString& aHspace) { return _to SetHspace(aHspace); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetStandby(nsAWritableString& aStandby) { return _to GetStandby(aStandby); } \ + NS_IMETHOD SetStandby(const nsAReadableString& aStandby) { return _to SetStandby(aStandby); } \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) { return _to SetTabIndex(aTabIndex); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ - NS_IMETHOD GetUseMap(nsString& aUseMap) { return _to GetUseMap(aUseMap); } \ - NS_IMETHOD SetUseMap(const nsString& aUseMap) { return _to SetUseMap(aUseMap); } \ - NS_IMETHOD GetVspace(nsString& aVspace) { return _to GetVspace(aVspace); } \ - NS_IMETHOD SetVspace(const nsString& aVspace) { return _to SetVspace(aVspace); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetUseMap(nsAWritableString& aUseMap) { return _to GetUseMap(aUseMap); } \ + NS_IMETHOD SetUseMap(const nsAReadableString& aUseMap) { return _to SetUseMap(aUseMap); } \ + NS_IMETHOD GetVspace(nsAWritableString& aVspace) { return _to GetVspace(aVspace); } \ + NS_IMETHOD SetVspace(const nsAReadableString& aVspace) { return _to SetVspace(aVspace); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument) { return _to GetContentDocument(aContentDocument); } \ NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument) { return _to SetContentDocument(aContentDocument); } \ diff --git a/dom/public/html/nsIDOMHTMLOptGroupElement.h b/dom/public/html/nsIDOMHTMLOptGroupElement.h index a3c6508c1077..c97fed629f71 100644 --- a/dom/public/html/nsIDOMHTMLOptGroupElement.h +++ b/dom/public/html/nsIDOMHTMLOptGroupElement.h @@ -41,24 +41,24 @@ public: NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; - NS_IMETHOD GetLabel(nsString& aLabel)=0; - NS_IMETHOD SetLabel(const nsString& aLabel)=0; + NS_IMETHOD GetLabel(nsAWritableString& aLabel)=0; + NS_IMETHOD SetLabel(const nsAReadableString& aLabel)=0; }; #define NS_DECL_IDOMHTMLOPTGROUPELEMENT \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ - NS_IMETHOD GetLabel(nsString& aLabel); \ - NS_IMETHOD SetLabel(const nsString& aLabel); \ + NS_IMETHOD GetLabel(nsAWritableString& aLabel); \ + NS_IMETHOD SetLabel(const nsAReadableString& aLabel); \ #define NS_FORWARD_IDOMHTMLOPTGROUPELEMENT(_to) \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ - NS_IMETHOD GetLabel(nsString& aLabel) { return _to GetLabel(aLabel); } \ - NS_IMETHOD SetLabel(const nsString& aLabel) { return _to SetLabel(aLabel); } \ + NS_IMETHOD GetLabel(nsAWritableString& aLabel) { return _to GetLabel(aLabel); } \ + NS_IMETHOD SetLabel(const nsAReadableString& aLabel) { return _to SetLabel(aLabel); } \ extern "C" NS_DOM nsresult NS_InitHTMLOptGroupElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLOptionElement.h b/dom/public/html/nsIDOMHTMLOptionElement.h index 1281d8bc3161..36fba7b9162d 100644 --- a/dom/public/html/nsIDOMHTMLOptionElement.h +++ b/dom/public/html/nsIDOMHTMLOptionElement.h @@ -44,22 +44,22 @@ public: NS_IMETHOD GetDefaultSelected(PRBool* aDefaultSelected)=0; NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected)=0; - NS_IMETHOD GetText(nsString& aText)=0; - NS_IMETHOD SetText(const nsString& aText)=0; + NS_IMETHOD GetText(nsAWritableString& aText)=0; + NS_IMETHOD SetText(const nsAReadableString& aText)=0; NS_IMETHOD GetIndex(PRInt32* aIndex)=0; NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; - NS_IMETHOD GetLabel(nsString& aLabel)=0; - NS_IMETHOD SetLabel(const nsString& aLabel)=0; + NS_IMETHOD GetLabel(nsAWritableString& aLabel)=0; + NS_IMETHOD SetLabel(const nsAReadableString& aLabel)=0; NS_IMETHOD GetSelected(PRBool* aSelected)=0; NS_IMETHOD SetSelected(PRBool aSelected)=0; - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; }; @@ -67,17 +67,17 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ NS_IMETHOD GetDefaultSelected(PRBool* aDefaultSelected); \ NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected); \ - NS_IMETHOD GetText(nsString& aText); \ - NS_IMETHOD SetText(const nsString& aText); \ + NS_IMETHOD GetText(nsAWritableString& aText); \ + NS_IMETHOD SetText(const nsAReadableString& aText); \ NS_IMETHOD GetIndex(PRInt32* aIndex); \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ - NS_IMETHOD GetLabel(nsString& aLabel); \ - NS_IMETHOD SetLabel(const nsString& aLabel); \ + NS_IMETHOD GetLabel(nsAWritableString& aLabel); \ + NS_IMETHOD SetLabel(const nsAReadableString& aLabel); \ NS_IMETHOD GetSelected(PRBool* aSelected); \ NS_IMETHOD SetSelected(PRBool aSelected); \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ @@ -85,17 +85,17 @@ public: NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ NS_IMETHOD GetDefaultSelected(PRBool* aDefaultSelected) { return _to GetDefaultSelected(aDefaultSelected); } \ NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected) { return _to SetDefaultSelected(aDefaultSelected); } \ - NS_IMETHOD GetText(nsString& aText) { return _to GetText(aText); } \ - NS_IMETHOD SetText(const nsString& aText) { return _to SetText(aText); } \ + NS_IMETHOD GetText(nsAWritableString& aText) { return _to GetText(aText); } \ + NS_IMETHOD SetText(const nsAReadableString& aText) { return _to SetText(aText); } \ NS_IMETHOD GetIndex(PRInt32* aIndex) { return _to GetIndex(aIndex); } \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ - NS_IMETHOD GetLabel(nsString& aLabel) { return _to GetLabel(aLabel); } \ - NS_IMETHOD SetLabel(const nsString& aLabel) { return _to SetLabel(aLabel); } \ + NS_IMETHOD GetLabel(nsAWritableString& aLabel) { return _to GetLabel(aLabel); } \ + NS_IMETHOD SetLabel(const nsAReadableString& aLabel) { return _to SetLabel(aLabel); } \ NS_IMETHOD GetSelected(PRBool* aSelected) { return _to GetSelected(aSelected); } \ NS_IMETHOD SetSelected(PRBool aSelected) { return _to SetSelected(aSelected); } \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ extern "C" NS_DOM nsresult NS_InitHTMLOptionElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLParagraphElement.h b/dom/public/html/nsIDOMHTMLParagraphElement.h index 35a03a82f074..a93ecbd6baf6 100644 --- a/dom/public/html/nsIDOMHTMLParagraphElement.h +++ b/dom/public/html/nsIDOMHTMLParagraphElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLParagraphElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLPARAGRAPHELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; }; #define NS_DECL_IDOMHTMLPARAGRAPHELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ #define NS_FORWARD_IDOMHTMLPARAGRAPHELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ extern "C" NS_DOM nsresult NS_InitHTMLParagraphElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLParamElement.h b/dom/public/html/nsIDOMHTMLParamElement.h index cf8e3bb28ef8..d0dfa7b81c69 100644 --- a/dom/public/html/nsIDOMHTMLParamElement.h +++ b/dom/public/html/nsIDOMHTMLParamElement.h @@ -38,41 +38,41 @@ class nsIDOMHTMLParamElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLPARAMELEMENT_IID; return iid; } - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; - NS_IMETHOD GetValueType(nsString& aValueType)=0; - NS_IMETHOD SetValueType(const nsString& aValueType)=0; + NS_IMETHOD GetValueType(nsAWritableString& aValueType)=0; + NS_IMETHOD SetValueType(const nsAReadableString& aValueType)=0; }; #define NS_DECL_IDOMHTMLPARAMELEMENT \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ - NS_IMETHOD GetValueType(nsString& aValueType); \ - NS_IMETHOD SetValueType(const nsString& aValueType); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ + NS_IMETHOD GetValueType(nsAWritableString& aValueType); \ + NS_IMETHOD SetValueType(const nsAReadableString& aValueType); \ #define NS_FORWARD_IDOMHTMLPARAMELEMENT(_to) \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ - NS_IMETHOD GetValueType(nsString& aValueType) { return _to GetValueType(aValueType); } \ - NS_IMETHOD SetValueType(const nsString& aValueType) { return _to SetValueType(aValueType); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetValueType(nsAWritableString& aValueType) { return _to GetValueType(aValueType); } \ + NS_IMETHOD SetValueType(const nsAReadableString& aValueType) { return _to SetValueType(aValueType); } \ extern "C" NS_DOM nsresult NS_InitHTMLParamElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLQuoteElement.h b/dom/public/html/nsIDOMHTMLQuoteElement.h index 3cd27fe811fb..35821ace73b8 100644 --- a/dom/public/html/nsIDOMHTMLQuoteElement.h +++ b/dom/public/html/nsIDOMHTMLQuoteElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLQuoteElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLQUOTEELEMENT_IID; return iid; } - NS_IMETHOD GetCite(nsString& aCite)=0; - NS_IMETHOD SetCite(const nsString& aCite)=0; + NS_IMETHOD GetCite(nsAWritableString& aCite)=0; + NS_IMETHOD SetCite(const nsAReadableString& aCite)=0; }; #define NS_DECL_IDOMHTMLQUOTEELEMENT \ - NS_IMETHOD GetCite(nsString& aCite); \ - NS_IMETHOD SetCite(const nsString& aCite); \ + NS_IMETHOD GetCite(nsAWritableString& aCite); \ + NS_IMETHOD SetCite(const nsAReadableString& aCite); \ #define NS_FORWARD_IDOMHTMLQUOTEELEMENT(_to) \ - NS_IMETHOD GetCite(nsString& aCite) { return _to GetCite(aCite); } \ - NS_IMETHOD SetCite(const nsString& aCite) { return _to SetCite(aCite); } \ + NS_IMETHOD GetCite(nsAWritableString& aCite) { return _to GetCite(aCite); } \ + NS_IMETHOD SetCite(const nsAReadableString& aCite) { return _to SetCite(aCite); } \ extern "C" NS_DOM nsresult NS_InitHTMLQuoteElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLScriptElement.h b/dom/public/html/nsIDOMHTMLScriptElement.h index 1268aeb4148d..5650f4c703ca 100644 --- a/dom/public/html/nsIDOMHTMLScriptElement.h +++ b/dom/public/html/nsIDOMHTMLScriptElement.h @@ -38,62 +38,62 @@ class nsIDOMHTMLScriptElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLSCRIPTELEMENT_IID; return iid; } - NS_IMETHOD GetText(nsString& aText)=0; - NS_IMETHOD SetText(const nsString& aText)=0; + NS_IMETHOD GetText(nsAWritableString& aText)=0; + NS_IMETHOD SetText(const nsAReadableString& aText)=0; - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor)=0; - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor)=0; + NS_IMETHOD GetHtmlFor(nsAWritableString& aHtmlFor)=0; + NS_IMETHOD SetHtmlFor(const nsAReadableString& aHtmlFor)=0; - NS_IMETHOD GetEvent(nsString& aEvent)=0; - NS_IMETHOD SetEvent(const nsString& aEvent)=0; + NS_IMETHOD GetEvent(nsAWritableString& aEvent)=0; + NS_IMETHOD SetEvent(const nsAReadableString& aEvent)=0; - NS_IMETHOD GetCharset(nsString& aCharset)=0; - NS_IMETHOD SetCharset(const nsString& aCharset)=0; + NS_IMETHOD GetCharset(nsAWritableString& aCharset)=0; + NS_IMETHOD SetCharset(const nsAReadableString& aCharset)=0; NS_IMETHOD GetDefer(PRBool* aDefer)=0; NS_IMETHOD SetDefer(PRBool aDefer)=0; - NS_IMETHOD GetSrc(nsString& aSrc)=0; - NS_IMETHOD SetSrc(const nsString& aSrc)=0; + NS_IMETHOD GetSrc(nsAWritableString& aSrc)=0; + NS_IMETHOD SetSrc(const nsAReadableString& aSrc)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; }; #define NS_DECL_IDOMHTMLSCRIPTELEMENT \ - NS_IMETHOD GetText(nsString& aText); \ - NS_IMETHOD SetText(const nsString& aText); \ - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); \ - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); \ - NS_IMETHOD GetEvent(nsString& aEvent); \ - NS_IMETHOD SetEvent(const nsString& aEvent); \ - NS_IMETHOD GetCharset(nsString& aCharset); \ - NS_IMETHOD SetCharset(const nsString& aCharset); \ + NS_IMETHOD GetText(nsAWritableString& aText); \ + NS_IMETHOD SetText(const nsAReadableString& aText); \ + NS_IMETHOD GetHtmlFor(nsAWritableString& aHtmlFor); \ + NS_IMETHOD SetHtmlFor(const nsAReadableString& aHtmlFor); \ + NS_IMETHOD GetEvent(nsAWritableString& aEvent); \ + NS_IMETHOD SetEvent(const nsAReadableString& aEvent); \ + NS_IMETHOD GetCharset(nsAWritableString& aCharset); \ + NS_IMETHOD SetCharset(const nsAReadableString& aCharset); \ NS_IMETHOD GetDefer(PRBool* aDefer); \ NS_IMETHOD SetDefer(PRBool aDefer); \ - NS_IMETHOD GetSrc(nsString& aSrc); \ - NS_IMETHOD SetSrc(const nsString& aSrc); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc); \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ #define NS_FORWARD_IDOMHTMLSCRIPTELEMENT(_to) \ - NS_IMETHOD GetText(nsString& aText) { return _to GetText(aText); } \ - NS_IMETHOD SetText(const nsString& aText) { return _to SetText(aText); } \ - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor) { return _to GetHtmlFor(aHtmlFor); } \ - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor) { return _to SetHtmlFor(aHtmlFor); } \ - NS_IMETHOD GetEvent(nsString& aEvent) { return _to GetEvent(aEvent); } \ - NS_IMETHOD SetEvent(const nsString& aEvent) { return _to SetEvent(aEvent); } \ - NS_IMETHOD GetCharset(nsString& aCharset) { return _to GetCharset(aCharset); } \ - NS_IMETHOD SetCharset(const nsString& aCharset) { return _to SetCharset(aCharset); } \ + NS_IMETHOD GetText(nsAWritableString& aText) { return _to GetText(aText); } \ + NS_IMETHOD SetText(const nsAReadableString& aText) { return _to SetText(aText); } \ + NS_IMETHOD GetHtmlFor(nsAWritableString& aHtmlFor) { return _to GetHtmlFor(aHtmlFor); } \ + NS_IMETHOD SetHtmlFor(const nsAReadableString& aHtmlFor) { return _to SetHtmlFor(aHtmlFor); } \ + NS_IMETHOD GetEvent(nsAWritableString& aEvent) { return _to GetEvent(aEvent); } \ + NS_IMETHOD SetEvent(const nsAReadableString& aEvent) { return _to SetEvent(aEvent); } \ + NS_IMETHOD GetCharset(nsAWritableString& aCharset) { return _to GetCharset(aCharset); } \ + NS_IMETHOD SetCharset(const nsAReadableString& aCharset) { return _to SetCharset(aCharset); } \ NS_IMETHOD GetDefer(PRBool* aDefer) { return _to GetDefer(aDefer); } \ NS_IMETHOD SetDefer(PRBool aDefer) { return _to SetDefer(aDefer); } \ - NS_IMETHOD GetSrc(nsString& aSrc) { return _to GetSrc(aSrc); } \ - NS_IMETHOD SetSrc(const nsString& aSrc) { return _to SetSrc(aSrc); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc) { return _to GetSrc(aSrc); } \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc) { return _to SetSrc(aSrc); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ extern "C" NS_DOM nsresult NS_InitHTMLScriptElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLSelectElement.h b/dom/public/html/nsIDOMHTMLSelectElement.h index 121547a91326..bb729aa30df2 100644 --- a/dom/public/html/nsIDOMHTMLSelectElement.h +++ b/dom/public/html/nsIDOMHTMLSelectElement.h @@ -41,13 +41,13 @@ class nsIDOMHTMLSelectElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLSELECTELEMENT_IID; return iid; } - NS_IMETHOD GetType(nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex)=0; NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex)=0; - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; NS_IMETHOD GetLength(PRUint32* aLength)=0; NS_IMETHOD SetLength(PRUint32 aLength)=0; @@ -62,8 +62,8 @@ public: NS_IMETHOD GetMultiple(PRBool* aMultiple)=0; NS_IMETHOD SetMultiple(PRBool aMultiple)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; NS_IMETHOD GetSize(PRInt32* aSize)=0; NS_IMETHOD SetSize(PRInt32 aSize)=0; @@ -82,11 +82,11 @@ public: #define NS_DECL_IDOMHTMLSELECTELEMENT \ - NS_IMETHOD GetType(nsString& aType); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex); \ NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex); \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ NS_IMETHOD GetLength(PRUint32* aLength); \ NS_IMETHOD SetLength(PRUint32 aLength); \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ @@ -95,8 +95,8 @@ public: NS_IMETHOD SetDisabled(PRBool aDisabled); \ NS_IMETHOD GetMultiple(PRBool* aMultiple); \ NS_IMETHOD SetMultiple(PRBool aMultiple); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ NS_IMETHOD GetSize(PRInt32* aSize); \ NS_IMETHOD SetSize(PRInt32 aSize); \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ @@ -109,11 +109,11 @@ public: #define NS_FORWARD_IDOMHTMLSELECTELEMENT(_to) \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex) { return _to GetSelectedIndex(aSelectedIndex); } \ NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex) { return _to SetSelectedIndex(aSelectedIndex); } \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \ NS_IMETHOD SetLength(PRUint32 aLength) { return _to SetLength(aLength); } \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ @@ -122,8 +122,8 @@ public: NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ NS_IMETHOD GetMultiple(PRBool* aMultiple) { return _to GetMultiple(aMultiple); } \ NS_IMETHOD SetMultiple(PRBool aMultiple) { return _to SetMultiple(aMultiple); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ NS_IMETHOD GetSize(PRInt32* aSize) { return _to GetSize(aSize); } \ NS_IMETHOD SetSize(PRInt32 aSize) { return _to SetSize(aSize); } \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ diff --git a/dom/public/html/nsIDOMHTMLStyleElement.h b/dom/public/html/nsIDOMHTMLStyleElement.h index 583103c640eb..81d6cd180598 100644 --- a/dom/public/html/nsIDOMHTMLStyleElement.h +++ b/dom/public/html/nsIDOMHTMLStyleElement.h @@ -41,31 +41,31 @@ public: NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; - NS_IMETHOD GetMedia(nsString& aMedia)=0; - NS_IMETHOD SetMedia(const nsString& aMedia)=0; + NS_IMETHOD GetMedia(nsAWritableString& aMedia)=0; + NS_IMETHOD SetMedia(const nsAReadableString& aMedia)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; }; #define NS_DECL_IDOMHTMLSTYLEELEMENT \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ - NS_IMETHOD GetMedia(nsString& aMedia); \ - NS_IMETHOD SetMedia(const nsString& aMedia); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ + NS_IMETHOD GetMedia(nsAWritableString& aMedia); \ + NS_IMETHOD SetMedia(const nsAReadableString& aMedia); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ #define NS_FORWARD_IDOMHTMLSTYLEELEMENT(_to) \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ - NS_IMETHOD GetMedia(nsString& aMedia) { return _to GetMedia(aMedia); } \ - NS_IMETHOD SetMedia(const nsString& aMedia) { return _to SetMedia(aMedia); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetMedia(nsAWritableString& aMedia) { return _to GetMedia(aMedia); } \ + NS_IMETHOD SetMedia(const nsAReadableString& aMedia) { return _to SetMedia(aMedia); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ extern "C" NS_DOM nsresult NS_InitHTMLStyleElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLTableCaptionElement.h b/dom/public/html/nsIDOMHTMLTableCaptionElement.h index 4ec5e23ea321..fbf7b80289db 100644 --- a/dom/public/html/nsIDOMHTMLTableCaptionElement.h +++ b/dom/public/html/nsIDOMHTMLTableCaptionElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLTableCaptionElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLTABLECAPTIONELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; }; #define NS_DECL_IDOMHTMLTABLECAPTIONELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ #define NS_FORWARD_IDOMHTMLTABLECAPTIONELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ extern "C" NS_DOM nsresult NS_InitHTMLTableCaptionElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLTableCellElement.h b/dom/public/html/nsIDOMHTMLTableCellElement.h index ba34e5eb7a31..66574316c655 100644 --- a/dom/public/html/nsIDOMHTMLTableCellElement.h +++ b/dom/public/html/nsIDOMHTMLTableCellElement.h @@ -41,32 +41,32 @@ public: NS_IMETHOD GetCellIndex(PRInt32* aCellIndex)=0; NS_IMETHOD SetCellIndex(PRInt32 aCellIndex)=0; - NS_IMETHOD GetAbbr(nsString& aAbbr)=0; - NS_IMETHOD SetAbbr(const nsString& aAbbr)=0; + NS_IMETHOD GetAbbr(nsAWritableString& aAbbr)=0; + NS_IMETHOD SetAbbr(const nsAReadableString& aAbbr)=0; - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetAxis(nsString& aAxis)=0; - NS_IMETHOD SetAxis(const nsString& aAxis)=0; + NS_IMETHOD GetAxis(nsAWritableString& aAxis)=0; + NS_IMETHOD SetAxis(const nsAReadableString& aAxis)=0; - NS_IMETHOD GetBgColor(nsString& aBgColor)=0; - NS_IMETHOD SetBgColor(const nsString& aBgColor)=0; + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor)=0; + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor)=0; - NS_IMETHOD GetCh(nsString& aCh)=0; - NS_IMETHOD SetCh(const nsString& aCh)=0; + NS_IMETHOD GetCh(nsAWritableString& aCh)=0; + NS_IMETHOD SetCh(const nsAReadableString& aCh)=0; - NS_IMETHOD GetChOff(nsString& aChOff)=0; - NS_IMETHOD SetChOff(const nsString& aChOff)=0; + NS_IMETHOD GetChOff(nsAWritableString& aChOff)=0; + NS_IMETHOD SetChOff(const nsAReadableString& aChOff)=0; NS_IMETHOD GetColSpan(PRInt32* aColSpan)=0; NS_IMETHOD SetColSpan(PRInt32 aColSpan)=0; - NS_IMETHOD GetHeaders(nsString& aHeaders)=0; - NS_IMETHOD SetHeaders(const nsString& aHeaders)=0; + NS_IMETHOD GetHeaders(nsAWritableString& aHeaders)=0; + NS_IMETHOD SetHeaders(const nsAReadableString& aHeaders)=0; - NS_IMETHOD GetHeight(nsString& aHeight)=0; - NS_IMETHOD SetHeight(const nsString& aHeight)=0; + NS_IMETHOD GetHeight(nsAWritableString& aHeight)=0; + NS_IMETHOD SetHeight(const nsAReadableString& aHeight)=0; NS_IMETHOD GetNoWrap(PRBool* aNoWrap)=0; NS_IMETHOD SetNoWrap(PRBool aNoWrap)=0; @@ -74,82 +74,82 @@ public: NS_IMETHOD GetRowSpan(PRInt32* aRowSpan)=0; NS_IMETHOD SetRowSpan(PRInt32 aRowSpan)=0; - NS_IMETHOD GetScope(nsString& aScope)=0; - NS_IMETHOD SetScope(const nsString& aScope)=0; + NS_IMETHOD GetScope(nsAWritableString& aScope)=0; + NS_IMETHOD SetScope(const nsAReadableString& aScope)=0; - NS_IMETHOD GetVAlign(nsString& aVAlign)=0; - NS_IMETHOD SetVAlign(const nsString& aVAlign)=0; + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign)=0; + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; }; #define NS_DECL_IDOMHTMLTABLECELLELEMENT \ NS_IMETHOD GetCellIndex(PRInt32* aCellIndex); \ NS_IMETHOD SetCellIndex(PRInt32 aCellIndex); \ - NS_IMETHOD GetAbbr(nsString& aAbbr); \ - NS_IMETHOD SetAbbr(const nsString& aAbbr); \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetAxis(nsString& aAxis); \ - NS_IMETHOD SetAxis(const nsString& aAxis); \ - NS_IMETHOD GetBgColor(nsString& aBgColor); \ - NS_IMETHOD SetBgColor(const nsString& aBgColor); \ - NS_IMETHOD GetCh(nsString& aCh); \ - NS_IMETHOD SetCh(const nsString& aCh); \ - NS_IMETHOD GetChOff(nsString& aChOff); \ - NS_IMETHOD SetChOff(const nsString& aChOff); \ + NS_IMETHOD GetAbbr(nsAWritableString& aAbbr); \ + NS_IMETHOD SetAbbr(const nsAReadableString& aAbbr); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetAxis(nsAWritableString& aAxis); \ + NS_IMETHOD SetAxis(const nsAReadableString& aAxis); \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor); \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor); \ + NS_IMETHOD GetCh(nsAWritableString& aCh); \ + NS_IMETHOD SetCh(const nsAReadableString& aCh); \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff); \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff); \ NS_IMETHOD GetColSpan(PRInt32* aColSpan); \ NS_IMETHOD SetColSpan(PRInt32 aColSpan); \ - NS_IMETHOD GetHeaders(nsString& aHeaders); \ - NS_IMETHOD SetHeaders(const nsString& aHeaders); \ - NS_IMETHOD GetHeight(nsString& aHeight); \ - NS_IMETHOD SetHeight(const nsString& aHeight); \ + NS_IMETHOD GetHeaders(nsAWritableString& aHeaders); \ + NS_IMETHOD SetHeaders(const nsAReadableString& aHeaders); \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight); \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight); \ NS_IMETHOD GetNoWrap(PRBool* aNoWrap); \ NS_IMETHOD SetNoWrap(PRBool aNoWrap); \ NS_IMETHOD GetRowSpan(PRInt32* aRowSpan); \ NS_IMETHOD SetRowSpan(PRInt32 aRowSpan); \ - NS_IMETHOD GetScope(nsString& aScope); \ - NS_IMETHOD SetScope(const nsString& aScope); \ - NS_IMETHOD GetVAlign(nsString& aVAlign); \ - NS_IMETHOD SetVAlign(const nsString& aVAlign); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetScope(nsAWritableString& aScope); \ + NS_IMETHOD SetScope(const nsAReadableString& aScope); \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign); \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ #define NS_FORWARD_IDOMHTMLTABLECELLELEMENT(_to) \ NS_IMETHOD GetCellIndex(PRInt32* aCellIndex) { return _to GetCellIndex(aCellIndex); } \ NS_IMETHOD SetCellIndex(PRInt32 aCellIndex) { return _to SetCellIndex(aCellIndex); } \ - NS_IMETHOD GetAbbr(nsString& aAbbr) { return _to GetAbbr(aAbbr); } \ - NS_IMETHOD SetAbbr(const nsString& aAbbr) { return _to SetAbbr(aAbbr); } \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetAxis(nsString& aAxis) { return _to GetAxis(aAxis); } \ - NS_IMETHOD SetAxis(const nsString& aAxis) { return _to SetAxis(aAxis); } \ - NS_IMETHOD GetBgColor(nsString& aBgColor) { return _to GetBgColor(aBgColor); } \ - NS_IMETHOD SetBgColor(const nsString& aBgColor) { return _to SetBgColor(aBgColor); } \ - NS_IMETHOD GetCh(nsString& aCh) { return _to GetCh(aCh); } \ - NS_IMETHOD SetCh(const nsString& aCh) { return _to SetCh(aCh); } \ - NS_IMETHOD GetChOff(nsString& aChOff) { return _to GetChOff(aChOff); } \ - NS_IMETHOD SetChOff(const nsString& aChOff) { return _to SetChOff(aChOff); } \ + NS_IMETHOD GetAbbr(nsAWritableString& aAbbr) { return _to GetAbbr(aAbbr); } \ + NS_IMETHOD SetAbbr(const nsAReadableString& aAbbr) { return _to SetAbbr(aAbbr); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetAxis(nsAWritableString& aAxis) { return _to GetAxis(aAxis); } \ + NS_IMETHOD SetAxis(const nsAReadableString& aAxis) { return _to SetAxis(aAxis); } \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor) { return _to GetBgColor(aBgColor); } \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor) { return _to SetBgColor(aBgColor); } \ + NS_IMETHOD GetCh(nsAWritableString& aCh) { return _to GetCh(aCh); } \ + NS_IMETHOD SetCh(const nsAReadableString& aCh) { return _to SetCh(aCh); } \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff) { return _to GetChOff(aChOff); } \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff) { return _to SetChOff(aChOff); } \ NS_IMETHOD GetColSpan(PRInt32* aColSpan) { return _to GetColSpan(aColSpan); } \ NS_IMETHOD SetColSpan(PRInt32 aColSpan) { return _to SetColSpan(aColSpan); } \ - NS_IMETHOD GetHeaders(nsString& aHeaders) { return _to GetHeaders(aHeaders); } \ - NS_IMETHOD SetHeaders(const nsString& aHeaders) { return _to SetHeaders(aHeaders); } \ - NS_IMETHOD GetHeight(nsString& aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD SetHeight(const nsString& aHeight) { return _to SetHeight(aHeight); } \ + NS_IMETHOD GetHeaders(nsAWritableString& aHeaders) { return _to GetHeaders(aHeaders); } \ + NS_IMETHOD SetHeaders(const nsAReadableString& aHeaders) { return _to SetHeaders(aHeaders); } \ + NS_IMETHOD GetHeight(nsAWritableString& aHeight) { return _to GetHeight(aHeight); } \ + NS_IMETHOD SetHeight(const nsAReadableString& aHeight) { return _to SetHeight(aHeight); } \ NS_IMETHOD GetNoWrap(PRBool* aNoWrap) { return _to GetNoWrap(aNoWrap); } \ NS_IMETHOD SetNoWrap(PRBool aNoWrap) { return _to SetNoWrap(aNoWrap); } \ NS_IMETHOD GetRowSpan(PRInt32* aRowSpan) { return _to GetRowSpan(aRowSpan); } \ NS_IMETHOD SetRowSpan(PRInt32 aRowSpan) { return _to SetRowSpan(aRowSpan); } \ - NS_IMETHOD GetScope(nsString& aScope) { return _to GetScope(aScope); } \ - NS_IMETHOD SetScope(const nsString& aScope) { return _to SetScope(aScope); } \ - NS_IMETHOD GetVAlign(nsString& aVAlign) { return _to GetVAlign(aVAlign); } \ - NS_IMETHOD SetVAlign(const nsString& aVAlign) { return _to SetVAlign(aVAlign); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetScope(nsAWritableString& aScope) { return _to GetScope(aScope); } \ + NS_IMETHOD SetScope(const nsAReadableString& aScope) { return _to SetScope(aScope); } \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign) { return _to GetVAlign(aVAlign); } \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign) { return _to SetVAlign(aVAlign); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ extern "C" NS_DOM nsresult NS_InitHTMLTableCellElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLTableColElement.h b/dom/public/html/nsIDOMHTMLTableColElement.h index fc821d700a4a..78796946c941 100644 --- a/dom/public/html/nsIDOMHTMLTableColElement.h +++ b/dom/public/html/nsIDOMHTMLTableColElement.h @@ -38,55 +38,55 @@ class nsIDOMHTMLTableColElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLTABLECOLELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetCh(nsString& aCh)=0; - NS_IMETHOD SetCh(const nsString& aCh)=0; + NS_IMETHOD GetCh(nsAWritableString& aCh)=0; + NS_IMETHOD SetCh(const nsAReadableString& aCh)=0; - NS_IMETHOD GetChOff(nsString& aChOff)=0; - NS_IMETHOD SetChOff(const nsString& aChOff)=0; + NS_IMETHOD GetChOff(nsAWritableString& aChOff)=0; + NS_IMETHOD SetChOff(const nsAReadableString& aChOff)=0; NS_IMETHOD GetSpan(PRInt32* aSpan)=0; NS_IMETHOD SetSpan(PRInt32 aSpan)=0; - NS_IMETHOD GetVAlign(nsString& aVAlign)=0; - NS_IMETHOD SetVAlign(const nsString& aVAlign)=0; + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign)=0; + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; }; #define NS_DECL_IDOMHTMLTABLECOLELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetCh(nsString& aCh); \ - NS_IMETHOD SetCh(const nsString& aCh); \ - NS_IMETHOD GetChOff(nsString& aChOff); \ - NS_IMETHOD SetChOff(const nsString& aChOff); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetCh(nsAWritableString& aCh); \ + NS_IMETHOD SetCh(const nsAReadableString& aCh); \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff); \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff); \ NS_IMETHOD GetSpan(PRInt32* aSpan); \ NS_IMETHOD SetSpan(PRInt32 aSpan); \ - NS_IMETHOD GetVAlign(nsString& aVAlign); \ - NS_IMETHOD SetVAlign(const nsString& aVAlign); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign); \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ #define NS_FORWARD_IDOMHTMLTABLECOLELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetCh(nsString& aCh) { return _to GetCh(aCh); } \ - NS_IMETHOD SetCh(const nsString& aCh) { return _to SetCh(aCh); } \ - NS_IMETHOD GetChOff(nsString& aChOff) { return _to GetChOff(aChOff); } \ - NS_IMETHOD SetChOff(const nsString& aChOff) { return _to SetChOff(aChOff); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetCh(nsAWritableString& aCh) { return _to GetCh(aCh); } \ + NS_IMETHOD SetCh(const nsAReadableString& aCh) { return _to SetCh(aCh); } \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff) { return _to GetChOff(aChOff); } \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff) { return _to SetChOff(aChOff); } \ NS_IMETHOD GetSpan(PRInt32* aSpan) { return _to GetSpan(aSpan); } \ NS_IMETHOD SetSpan(PRInt32 aSpan) { return _to SetSpan(aSpan); } \ - NS_IMETHOD GetVAlign(nsString& aVAlign) { return _to GetVAlign(aVAlign); } \ - NS_IMETHOD SetVAlign(const nsString& aVAlign) { return _to SetVAlign(aVAlign); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign) { return _to GetVAlign(aVAlign); } \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign) { return _to SetVAlign(aVAlign); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ extern "C" NS_DOM nsresult NS_InitHTMLTableColElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLTableElement.h b/dom/public/html/nsIDOMHTMLTableElement.h index 55f6b78d148e..16765e6b3c13 100644 --- a/dom/public/html/nsIDOMHTMLTableElement.h +++ b/dom/public/html/nsIDOMHTMLTableElement.h @@ -55,32 +55,32 @@ public: NS_IMETHOD GetTBodies(nsIDOMHTMLCollection** aTBodies)=0; - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetBgColor(nsString& aBgColor)=0; - NS_IMETHOD SetBgColor(const nsString& aBgColor)=0; + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor)=0; + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor)=0; - NS_IMETHOD GetBorder(nsString& aBorder)=0; - NS_IMETHOD SetBorder(const nsString& aBorder)=0; + NS_IMETHOD GetBorder(nsAWritableString& aBorder)=0; + NS_IMETHOD SetBorder(const nsAReadableString& aBorder)=0; - NS_IMETHOD GetCellPadding(nsString& aCellPadding)=0; - NS_IMETHOD SetCellPadding(const nsString& aCellPadding)=0; + NS_IMETHOD GetCellPadding(nsAWritableString& aCellPadding)=0; + NS_IMETHOD SetCellPadding(const nsAReadableString& aCellPadding)=0; - NS_IMETHOD GetCellSpacing(nsString& aCellSpacing)=0; - NS_IMETHOD SetCellSpacing(const nsString& aCellSpacing)=0; + NS_IMETHOD GetCellSpacing(nsAWritableString& aCellSpacing)=0; + NS_IMETHOD SetCellSpacing(const nsAReadableString& aCellSpacing)=0; - NS_IMETHOD GetFrame(nsString& aFrame)=0; - NS_IMETHOD SetFrame(const nsString& aFrame)=0; + NS_IMETHOD GetFrame(nsAWritableString& aFrame)=0; + NS_IMETHOD SetFrame(const nsAReadableString& aFrame)=0; - NS_IMETHOD GetRules(nsString& aRules)=0; - NS_IMETHOD SetRules(const nsString& aRules)=0; + NS_IMETHOD GetRules(nsAWritableString& aRules)=0; + NS_IMETHOD SetRules(const nsAReadableString& aRules)=0; - NS_IMETHOD GetSummary(nsString& aSummary)=0; - NS_IMETHOD SetSummary(const nsString& aSummary)=0; + NS_IMETHOD GetSummary(nsAWritableString& aSummary)=0; + NS_IMETHOD SetSummary(const nsAReadableString& aSummary)=0; - NS_IMETHOD GetWidth(nsString& aWidth)=0; - NS_IMETHOD SetWidth(const nsString& aWidth)=0; + NS_IMETHOD GetWidth(nsAWritableString& aWidth)=0; + NS_IMETHOD SetWidth(const nsAReadableString& aWidth)=0; NS_IMETHOD CreateTHead(nsIDOMHTMLElement** aReturn)=0; @@ -109,24 +109,24 @@ public: NS_IMETHOD SetTFoot(nsIDOMHTMLTableSectionElement* aTFoot); \ NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); \ NS_IMETHOD GetTBodies(nsIDOMHTMLCollection** aTBodies); \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetBgColor(nsString& aBgColor); \ - NS_IMETHOD SetBgColor(const nsString& aBgColor); \ - NS_IMETHOD GetBorder(nsString& aBorder); \ - NS_IMETHOD SetBorder(const nsString& aBorder); \ - NS_IMETHOD GetCellPadding(nsString& aCellPadding); \ - NS_IMETHOD SetCellPadding(const nsString& aCellPadding); \ - NS_IMETHOD GetCellSpacing(nsString& aCellSpacing); \ - NS_IMETHOD SetCellSpacing(const nsString& aCellSpacing); \ - NS_IMETHOD GetFrame(nsString& aFrame); \ - NS_IMETHOD SetFrame(const nsString& aFrame); \ - NS_IMETHOD GetRules(nsString& aRules); \ - NS_IMETHOD SetRules(const nsString& aRules); \ - NS_IMETHOD GetSummary(nsString& aSummary); \ - NS_IMETHOD SetSummary(const nsString& aSummary); \ - NS_IMETHOD GetWidth(nsString& aWidth); \ - NS_IMETHOD SetWidth(const nsString& aWidth); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor); \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor); \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder); \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder); \ + NS_IMETHOD GetCellPadding(nsAWritableString& aCellPadding); \ + NS_IMETHOD SetCellPadding(const nsAReadableString& aCellPadding); \ + NS_IMETHOD GetCellSpacing(nsAWritableString& aCellSpacing); \ + NS_IMETHOD SetCellSpacing(const nsAReadableString& aCellSpacing); \ + NS_IMETHOD GetFrame(nsAWritableString& aFrame); \ + NS_IMETHOD SetFrame(const nsAReadableString& aFrame); \ + NS_IMETHOD GetRules(nsAWritableString& aRules); \ + NS_IMETHOD SetRules(const nsAReadableString& aRules); \ + NS_IMETHOD GetSummary(nsAWritableString& aSummary); \ + NS_IMETHOD SetSummary(const nsAReadableString& aSummary); \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth); \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth); \ NS_IMETHOD CreateTHead(nsIDOMHTMLElement** aReturn); \ NS_IMETHOD DeleteTHead(); \ NS_IMETHOD CreateTFoot(nsIDOMHTMLElement** aReturn); \ @@ -147,24 +147,24 @@ public: NS_IMETHOD SetTFoot(nsIDOMHTMLTableSectionElement* aTFoot) { return _to SetTFoot(aTFoot); } \ NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows) { return _to GetRows(aRows); } \ NS_IMETHOD GetTBodies(nsIDOMHTMLCollection** aTBodies) { return _to GetTBodies(aTBodies); } \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetBgColor(nsString& aBgColor) { return _to GetBgColor(aBgColor); } \ - NS_IMETHOD SetBgColor(const nsString& aBgColor) { return _to SetBgColor(aBgColor); } \ - NS_IMETHOD GetBorder(nsString& aBorder) { return _to GetBorder(aBorder); } \ - NS_IMETHOD SetBorder(const nsString& aBorder) { return _to SetBorder(aBorder); } \ - NS_IMETHOD GetCellPadding(nsString& aCellPadding) { return _to GetCellPadding(aCellPadding); } \ - NS_IMETHOD SetCellPadding(const nsString& aCellPadding) { return _to SetCellPadding(aCellPadding); } \ - NS_IMETHOD GetCellSpacing(nsString& aCellSpacing) { return _to GetCellSpacing(aCellSpacing); } \ - NS_IMETHOD SetCellSpacing(const nsString& aCellSpacing) { return _to SetCellSpacing(aCellSpacing); } \ - NS_IMETHOD GetFrame(nsString& aFrame) { return _to GetFrame(aFrame); } \ - NS_IMETHOD SetFrame(const nsString& aFrame) { return _to SetFrame(aFrame); } \ - NS_IMETHOD GetRules(nsString& aRules) { return _to GetRules(aRules); } \ - NS_IMETHOD SetRules(const nsString& aRules) { return _to SetRules(aRules); } \ - NS_IMETHOD GetSummary(nsString& aSummary) { return _to GetSummary(aSummary); } \ - NS_IMETHOD SetSummary(const nsString& aSummary) { return _to SetSummary(aSummary); } \ - NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \ - NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor) { return _to GetBgColor(aBgColor); } \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor) { return _to SetBgColor(aBgColor); } \ + NS_IMETHOD GetBorder(nsAWritableString& aBorder) { return _to GetBorder(aBorder); } \ + NS_IMETHOD SetBorder(const nsAReadableString& aBorder) { return _to SetBorder(aBorder); } \ + NS_IMETHOD GetCellPadding(nsAWritableString& aCellPadding) { return _to GetCellPadding(aCellPadding); } \ + NS_IMETHOD SetCellPadding(const nsAReadableString& aCellPadding) { return _to SetCellPadding(aCellPadding); } \ + NS_IMETHOD GetCellSpacing(nsAWritableString& aCellSpacing) { return _to GetCellSpacing(aCellSpacing); } \ + NS_IMETHOD SetCellSpacing(const nsAReadableString& aCellSpacing) { return _to SetCellSpacing(aCellSpacing); } \ + NS_IMETHOD GetFrame(nsAWritableString& aFrame) { return _to GetFrame(aFrame); } \ + NS_IMETHOD SetFrame(const nsAReadableString& aFrame) { return _to SetFrame(aFrame); } \ + NS_IMETHOD GetRules(nsAWritableString& aRules) { return _to GetRules(aRules); } \ + NS_IMETHOD SetRules(const nsAReadableString& aRules) { return _to SetRules(aRules); } \ + NS_IMETHOD GetSummary(nsAWritableString& aSummary) { return _to GetSummary(aSummary); } \ + NS_IMETHOD SetSummary(const nsAReadableString& aSummary) { return _to SetSummary(aSummary); } \ + NS_IMETHOD GetWidth(nsAWritableString& aWidth) { return _to GetWidth(aWidth); } \ + NS_IMETHOD SetWidth(const nsAReadableString& aWidth) { return _to SetWidth(aWidth); } \ NS_IMETHOD CreateTHead(nsIDOMHTMLElement** aReturn) { return _to CreateTHead(aReturn); } \ NS_IMETHOD DeleteTHead() { return _to DeleteTHead(); } \ NS_IMETHOD CreateTFoot(nsIDOMHTMLElement** aReturn) { return _to CreateTFoot(aReturn); } \ diff --git a/dom/public/html/nsIDOMHTMLTableRowElement.h b/dom/public/html/nsIDOMHTMLTableRowElement.h index 2b39406cb7d7..68d272c6885f 100644 --- a/dom/public/html/nsIDOMHTMLTableRowElement.h +++ b/dom/public/html/nsIDOMHTMLTableRowElement.h @@ -49,20 +49,20 @@ public: NS_IMETHOD GetCells(nsIDOMHTMLCollection** aCells)=0; NS_IMETHOD SetCells(nsIDOMHTMLCollection* aCells)=0; - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetBgColor(nsString& aBgColor)=0; - NS_IMETHOD SetBgColor(const nsString& aBgColor)=0; + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor)=0; + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor)=0; - NS_IMETHOD GetCh(nsString& aCh)=0; - NS_IMETHOD SetCh(const nsString& aCh)=0; + NS_IMETHOD GetCh(nsAWritableString& aCh)=0; + NS_IMETHOD SetCh(const nsAReadableString& aCh)=0; - NS_IMETHOD GetChOff(nsString& aChOff)=0; - NS_IMETHOD SetChOff(const nsString& aChOff)=0; + NS_IMETHOD GetChOff(nsAWritableString& aChOff)=0; + NS_IMETHOD SetChOff(const nsAReadableString& aChOff)=0; - NS_IMETHOD GetVAlign(nsString& aVAlign)=0; - NS_IMETHOD SetVAlign(const nsString& aVAlign)=0; + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign)=0; + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign)=0; NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn)=0; @@ -77,16 +77,16 @@ public: NS_IMETHOD SetSectionRowIndex(PRInt32 aSectionRowIndex); \ NS_IMETHOD GetCells(nsIDOMHTMLCollection** aCells); \ NS_IMETHOD SetCells(nsIDOMHTMLCollection* aCells); \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetBgColor(nsString& aBgColor); \ - NS_IMETHOD SetBgColor(const nsString& aBgColor); \ - NS_IMETHOD GetCh(nsString& aCh); \ - NS_IMETHOD SetCh(const nsString& aCh); \ - NS_IMETHOD GetChOff(nsString& aChOff); \ - NS_IMETHOD SetChOff(const nsString& aChOff); \ - NS_IMETHOD GetVAlign(nsString& aVAlign); \ - NS_IMETHOD SetVAlign(const nsString& aVAlign); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor); \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor); \ + NS_IMETHOD GetCh(nsAWritableString& aCh); \ + NS_IMETHOD SetCh(const nsAReadableString& aCh); \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff); \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff); \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign); \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign); \ NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); \ NS_IMETHOD DeleteCell(PRInt32 aIndex); \ @@ -99,16 +99,16 @@ public: NS_IMETHOD SetSectionRowIndex(PRInt32 aSectionRowIndex) { return _to SetSectionRowIndex(aSectionRowIndex); } \ NS_IMETHOD GetCells(nsIDOMHTMLCollection** aCells) { return _to GetCells(aCells); } \ NS_IMETHOD SetCells(nsIDOMHTMLCollection* aCells) { return _to SetCells(aCells); } \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetBgColor(nsString& aBgColor) { return _to GetBgColor(aBgColor); } \ - NS_IMETHOD SetBgColor(const nsString& aBgColor) { return _to SetBgColor(aBgColor); } \ - NS_IMETHOD GetCh(nsString& aCh) { return _to GetCh(aCh); } \ - NS_IMETHOD SetCh(const nsString& aCh) { return _to SetCh(aCh); } \ - NS_IMETHOD GetChOff(nsString& aChOff) { return _to GetChOff(aChOff); } \ - NS_IMETHOD SetChOff(const nsString& aChOff) { return _to SetChOff(aChOff); } \ - NS_IMETHOD GetVAlign(nsString& aVAlign) { return _to GetVAlign(aVAlign); } \ - NS_IMETHOD SetVAlign(const nsString& aVAlign) { return _to SetVAlign(aVAlign); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor) { return _to GetBgColor(aBgColor); } \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor) { return _to SetBgColor(aBgColor); } \ + NS_IMETHOD GetCh(nsAWritableString& aCh) { return _to GetCh(aCh); } \ + NS_IMETHOD SetCh(const nsAReadableString& aCh) { return _to SetCh(aCh); } \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff) { return _to GetChOff(aChOff); } \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff) { return _to SetChOff(aChOff); } \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign) { return _to GetVAlign(aVAlign); } \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign) { return _to SetVAlign(aVAlign); } \ NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn) { return _to InsertCell(aIndex, aReturn); } \ NS_IMETHOD DeleteCell(PRInt32 aIndex) { return _to DeleteCell(aIndex); } \ diff --git a/dom/public/html/nsIDOMHTMLTableSectionElement.h b/dom/public/html/nsIDOMHTMLTableSectionElement.h index 3f9a44827f3f..306c907532fe 100644 --- a/dom/public/html/nsIDOMHTMLTableSectionElement.h +++ b/dom/public/html/nsIDOMHTMLTableSectionElement.h @@ -40,17 +40,17 @@ class nsIDOMHTMLTableSectionElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLTABLESECTIONELEMENT_IID; return iid; } - NS_IMETHOD GetAlign(nsString& aAlign)=0; - NS_IMETHOD SetAlign(const nsString& aAlign)=0; + NS_IMETHOD GetAlign(nsAWritableString& aAlign)=0; + NS_IMETHOD SetAlign(const nsAReadableString& aAlign)=0; - NS_IMETHOD GetCh(nsString& aCh)=0; - NS_IMETHOD SetCh(const nsString& aCh)=0; + NS_IMETHOD GetCh(nsAWritableString& aCh)=0; + NS_IMETHOD SetCh(const nsAReadableString& aCh)=0; - NS_IMETHOD GetChOff(nsString& aChOff)=0; - NS_IMETHOD SetChOff(const nsString& aChOff)=0; + NS_IMETHOD GetChOff(nsAWritableString& aChOff)=0; + NS_IMETHOD SetChOff(const nsAReadableString& aChOff)=0; - NS_IMETHOD GetVAlign(nsString& aVAlign)=0; - NS_IMETHOD SetVAlign(const nsString& aVAlign)=0; + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign)=0; + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign)=0; NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows)=0; @@ -61,14 +61,14 @@ public: #define NS_DECL_IDOMHTMLTABLESECTIONELEMENT \ - NS_IMETHOD GetAlign(nsString& aAlign); \ - NS_IMETHOD SetAlign(const nsString& aAlign); \ - NS_IMETHOD GetCh(nsString& aCh); \ - NS_IMETHOD SetCh(const nsString& aCh); \ - NS_IMETHOD GetChOff(nsString& aChOff); \ - NS_IMETHOD SetChOff(const nsString& aChOff); \ - NS_IMETHOD GetVAlign(nsString& aVAlign); \ - NS_IMETHOD SetVAlign(const nsString& aVAlign); \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign); \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign); \ + NS_IMETHOD GetCh(nsAWritableString& aCh); \ + NS_IMETHOD SetCh(const nsAReadableString& aCh); \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff); \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff); \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign); \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign); \ NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); \ NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); \ NS_IMETHOD DeleteRow(PRInt32 aIndex); \ @@ -76,14 +76,14 @@ public: #define NS_FORWARD_IDOMHTMLTABLESECTIONELEMENT(_to) \ - NS_IMETHOD GetAlign(nsString& aAlign) { return _to GetAlign(aAlign); } \ - NS_IMETHOD SetAlign(const nsString& aAlign) { return _to SetAlign(aAlign); } \ - NS_IMETHOD GetCh(nsString& aCh) { return _to GetCh(aCh); } \ - NS_IMETHOD SetCh(const nsString& aCh) { return _to SetCh(aCh); } \ - NS_IMETHOD GetChOff(nsString& aChOff) { return _to GetChOff(aChOff); } \ - NS_IMETHOD SetChOff(const nsString& aChOff) { return _to SetChOff(aChOff); } \ - NS_IMETHOD GetVAlign(nsString& aVAlign) { return _to GetVAlign(aVAlign); } \ - NS_IMETHOD SetVAlign(const nsString& aVAlign) { return _to SetVAlign(aVAlign); } \ + NS_IMETHOD GetAlign(nsAWritableString& aAlign) { return _to GetAlign(aAlign); } \ + NS_IMETHOD SetAlign(const nsAReadableString& aAlign) { return _to SetAlign(aAlign); } \ + NS_IMETHOD GetCh(nsAWritableString& aCh) { return _to GetCh(aCh); } \ + NS_IMETHOD SetCh(const nsAReadableString& aCh) { return _to SetCh(aCh); } \ + NS_IMETHOD GetChOff(nsAWritableString& aChOff) { return _to GetChOff(aChOff); } \ + NS_IMETHOD SetChOff(const nsAReadableString& aChOff) { return _to SetChOff(aChOff); } \ + NS_IMETHOD GetVAlign(nsAWritableString& aVAlign) { return _to GetVAlign(aVAlign); } \ + NS_IMETHOD SetVAlign(const nsAReadableString& aVAlign) { return _to SetVAlign(aVAlign); } \ NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows) { return _to GetRows(aRows); } \ NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn) { return _to InsertRow(aIndex, aReturn); } \ NS_IMETHOD DeleteRow(PRInt32 aIndex) { return _to DeleteRow(aIndex); } \ diff --git a/dom/public/html/nsIDOMHTMLTextAreaElement.h b/dom/public/html/nsIDOMHTMLTextAreaElement.h index 1a7792901ddc..432b40f715e2 100644 --- a/dom/public/html/nsIDOMHTMLTextAreaElement.h +++ b/dom/public/html/nsIDOMHTMLTextAreaElement.h @@ -39,13 +39,13 @@ class nsIDOMHTMLTextAreaElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLTEXTAREAELEMENT_IID; return iid; } - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue)=0; - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue)=0; + NS_IMETHOD GetDefaultValue(nsAWritableString& aDefaultValue)=0; + NS_IMETHOD SetDefaultValue(const nsAReadableString& aDefaultValue)=0; NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm)=0; - NS_IMETHOD GetAccessKey(nsString& aAccessKey)=0; - NS_IMETHOD SetAccessKey(const nsString& aAccessKey)=0; + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey)=0; + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey)=0; NS_IMETHOD GetCols(PRInt32* aCols)=0; NS_IMETHOD SetCols(PRInt32 aCols)=0; @@ -53,8 +53,8 @@ public: NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; - NS_IMETHOD GetName(nsString& aName)=0; - NS_IMETHOD SetName(const nsString& aName)=0; + NS_IMETHOD GetName(nsAWritableString& aName)=0; + NS_IMETHOD SetName(const nsAReadableString& aName)=0; NS_IMETHOD GetReadOnly(PRBool* aReadOnly)=0; NS_IMETHOD SetReadOnly(PRBool aReadOnly)=0; @@ -65,10 +65,10 @@ public: NS_IMETHOD GetTabIndex(PRInt32* aTabIndex)=0; NS_IMETHOD SetTabIndex(PRInt32 aTabIndex)=0; - NS_IMETHOD GetType(nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; NS_IMETHOD Blur()=0; @@ -79,26 +79,26 @@ public: #define NS_DECL_IDOMHTMLTEXTAREAELEMENT \ - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue); \ - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue); \ + NS_IMETHOD GetDefaultValue(nsAWritableString& aDefaultValue); \ + NS_IMETHOD SetDefaultValue(const nsAReadableString& aDefaultValue); \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey); \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey); \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey); \ NS_IMETHOD GetCols(PRInt32* aCols); \ NS_IMETHOD SetCols(PRInt32 aCols); \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ - NS_IMETHOD GetName(nsString& aName); \ - NS_IMETHOD SetName(const nsString& aName); \ + NS_IMETHOD GetName(nsAWritableString& aName); \ + NS_IMETHOD SetName(const nsAReadableString& aName); \ NS_IMETHOD GetReadOnly(PRBool* aReadOnly); \ NS_IMETHOD SetReadOnly(PRBool aReadOnly); \ NS_IMETHOD GetRows(PRInt32* aRows); \ NS_IMETHOD SetRows(PRInt32 aRows); \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ NS_IMETHOD Blur(); \ NS_IMETHOD Focus(); \ NS_IMETHOD Select(); \ @@ -106,26 +106,26 @@ public: #define NS_FORWARD_IDOMHTMLTEXTAREAELEMENT(_to) \ - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue) { return _to GetDefaultValue(aDefaultValue); } \ - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue) { return _to SetDefaultValue(aDefaultValue); } \ + NS_IMETHOD GetDefaultValue(nsAWritableString& aDefaultValue) { return _to GetDefaultValue(aDefaultValue); } \ + NS_IMETHOD SetDefaultValue(const nsAReadableString& aDefaultValue) { return _to SetDefaultValue(aDefaultValue); } \ NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) { return _to GetForm(aForm); } \ - NS_IMETHOD GetAccessKey(nsString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ - NS_IMETHOD SetAccessKey(const nsString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ + NS_IMETHOD GetAccessKey(nsAWritableString& aAccessKey) { return _to GetAccessKey(aAccessKey); } \ + NS_IMETHOD SetAccessKey(const nsAReadableString& aAccessKey) { return _to SetAccessKey(aAccessKey); } \ NS_IMETHOD GetCols(PRInt32* aCols) { return _to GetCols(aCols); } \ NS_IMETHOD SetCols(PRInt32 aCols) { return _to SetCols(aCols); } \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ - NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \ - NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \ + NS_IMETHOD GetName(nsAWritableString& aName) { return _to GetName(aName); } \ + NS_IMETHOD SetName(const nsAReadableString& aName) { return _to SetName(aName); } \ NS_IMETHOD GetReadOnly(PRBool* aReadOnly) { return _to GetReadOnly(aReadOnly); } \ NS_IMETHOD SetReadOnly(PRBool aReadOnly) { return _to SetReadOnly(aReadOnly); } \ NS_IMETHOD GetRows(PRInt32* aRows) { return _to GetRows(aRows); } \ NS_IMETHOD SetRows(PRInt32 aRows) { return _to SetRows(aRows); } \ NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) { return _to GetTabIndex(aTabIndex); } \ NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) { return _to SetTabIndex(aTabIndex); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ NS_IMETHOD Blur() { return _to Blur(); } \ NS_IMETHOD Focus() { return _to Focus(); } \ NS_IMETHOD Select() { return _to Select(); } \ diff --git a/dom/public/html/nsIDOMHTMLTitleElement.h b/dom/public/html/nsIDOMHTMLTitleElement.h index 4c2dbfacdca1..89fd701a4485 100644 --- a/dom/public/html/nsIDOMHTMLTitleElement.h +++ b/dom/public/html/nsIDOMHTMLTitleElement.h @@ -38,20 +38,20 @@ class nsIDOMHTMLTitleElement : public nsIDOMHTMLElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMHTMLTITLEELEMENT_IID; return iid; } - NS_IMETHOD GetText(nsString& aText)=0; - NS_IMETHOD SetText(const nsString& aText)=0; + NS_IMETHOD GetText(nsAWritableString& aText)=0; + NS_IMETHOD SetText(const nsAReadableString& aText)=0; }; #define NS_DECL_IDOMHTMLTITLEELEMENT \ - NS_IMETHOD GetText(nsString& aText); \ - NS_IMETHOD SetText(const nsString& aText); \ + NS_IMETHOD GetText(nsAWritableString& aText); \ + NS_IMETHOD SetText(const nsAReadableString& aText); \ #define NS_FORWARD_IDOMHTMLTITLEELEMENT(_to) \ - NS_IMETHOD GetText(nsString& aText) { return _to GetText(aText); } \ - NS_IMETHOD SetText(const nsString& aText) { return _to SetText(aText); } \ + NS_IMETHOD GetText(nsAWritableString& aText) { return _to GetText(aText); } \ + NS_IMETHOD SetText(const nsAReadableString& aText) { return _to SetText(aText); } \ extern "C" NS_DOM nsresult NS_InitHTMLTitleElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMHTMLUListElement.h b/dom/public/html/nsIDOMHTMLUListElement.h index 46027615fd82..b57c48f8d30c 100644 --- a/dom/public/html/nsIDOMHTMLUListElement.h +++ b/dom/public/html/nsIDOMHTMLUListElement.h @@ -41,24 +41,24 @@ public: NS_IMETHOD GetCompact(PRBool* aCompact)=0; NS_IMETHOD SetCompact(PRBool aCompact)=0; - NS_IMETHOD GetType(nsString& aType)=0; - NS_IMETHOD SetType(const nsString& aType)=0; + NS_IMETHOD GetType(nsAWritableString& aType)=0; + NS_IMETHOD SetType(const nsAReadableString& aType)=0; }; #define NS_DECL_IDOMHTMLULISTELEMENT \ NS_IMETHOD GetCompact(PRBool* aCompact); \ NS_IMETHOD SetCompact(PRBool aCompact); \ - NS_IMETHOD GetType(nsString& aType); \ - NS_IMETHOD SetType(const nsString& aType); \ + NS_IMETHOD GetType(nsAWritableString& aType); \ + NS_IMETHOD SetType(const nsAReadableString& aType); \ #define NS_FORWARD_IDOMHTMLULISTELEMENT(_to) \ NS_IMETHOD GetCompact(PRBool* aCompact) { return _to GetCompact(aCompact); } \ NS_IMETHOD SetCompact(PRBool aCompact) { return _to SetCompact(aCompact); } \ - NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \ - NS_IMETHOD SetType(const nsString& aType) { return _to SetType(aType); } \ + NS_IMETHOD GetType(nsAWritableString& aType) { return _to GetType(aType); } \ + NS_IMETHOD SetType(const nsAReadableString& aType) { return _to SetType(aType); } \ extern "C" NS_DOM nsresult NS_InitHTMLUListElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMImage.h b/dom/public/html/nsIDOMImage.h index afd710c671a4..55df997d38c8 100644 --- a/dom/public/html/nsIDOMImage.h +++ b/dom/public/html/nsIDOMImage.h @@ -37,8 +37,8 @@ class nsIDOMImage : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMIMAGE_IID; return iid; } - NS_IMETHOD GetLowsrc(nsString& aLowsrc)=0; - NS_IMETHOD SetLowsrc(const nsString& aLowsrc)=0; + NS_IMETHOD GetLowsrc(nsAWritableString& aLowsrc)=0; + NS_IMETHOD SetLowsrc(const nsAReadableString& aLowsrc)=0; NS_IMETHOD GetComplete(PRBool* aComplete)=0; @@ -60,8 +60,8 @@ public: #define NS_DECL_IDOMIMAGE \ - NS_IMETHOD GetLowsrc(nsString& aLowsrc); \ - NS_IMETHOD SetLowsrc(const nsString& aLowsrc); \ + NS_IMETHOD GetLowsrc(nsAWritableString& aLowsrc); \ + NS_IMETHOD SetLowsrc(const nsAReadableString& aLowsrc); \ NS_IMETHOD GetComplete(PRBool* aComplete); \ NS_IMETHOD GetBorder(PRInt32* aBorder); \ NS_IMETHOD SetBorder(PRInt32 aBorder); \ @@ -77,8 +77,8 @@ public: #define NS_FORWARD_IDOMIMAGE(_to) \ - NS_IMETHOD GetLowsrc(nsString& aLowsrc) { return _to GetLowsrc(aLowsrc); } \ - NS_IMETHOD SetLowsrc(const nsString& aLowsrc) { return _to SetLowsrc(aLowsrc); } \ + NS_IMETHOD GetLowsrc(nsAWritableString& aLowsrc) { return _to GetLowsrc(aLowsrc); } \ + NS_IMETHOD SetLowsrc(const nsAReadableString& aLowsrc) { return _to SetLowsrc(aLowsrc); } \ NS_IMETHOD GetComplete(PRBool* aComplete) { return _to GetComplete(aComplete); } \ NS_IMETHOD GetBorder(PRInt32* aBorder) { return _to GetBorder(aBorder); } \ NS_IMETHOD SetBorder(PRInt32 aBorder) { return _to SetBorder(aBorder); } \ diff --git a/dom/public/html/nsIDOMNSHTMLAnchorElement.h b/dom/public/html/nsIDOMNSHTMLAnchorElement.h index 25f7ceef70b1..10c7528b8240 100644 --- a/dom/public/html/nsIDOMNSHTMLAnchorElement.h +++ b/dom/public/html/nsIDOMNSHTMLAnchorElement.h @@ -37,45 +37,45 @@ class nsIDOMNSHTMLAnchorElement : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSHTMLANCHORELEMENT_IID; return iid; } - NS_IMETHOD GetProtocol(nsString& aProtocol)=0; + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol)=0; - NS_IMETHOD GetHost(nsString& aHost)=0; + NS_IMETHOD GetHost(nsAWritableString& aHost)=0; - NS_IMETHOD GetHostname(nsString& aHostname)=0; + NS_IMETHOD GetHostname(nsAWritableString& aHostname)=0; - NS_IMETHOD GetPathname(nsString& aPathname)=0; + NS_IMETHOD GetPathname(nsAWritableString& aPathname)=0; - NS_IMETHOD GetSearch(nsString& aSearch)=0; + NS_IMETHOD GetSearch(nsAWritableString& aSearch)=0; - NS_IMETHOD GetPort(nsString& aPort)=0; + NS_IMETHOD GetPort(nsAWritableString& aPort)=0; - NS_IMETHOD GetHash(nsString& aHash)=0; + NS_IMETHOD GetHash(nsAWritableString& aHash)=0; - NS_IMETHOD GetText(nsString& aText)=0; + NS_IMETHOD GetText(nsAWritableString& aText)=0; }; #define NS_DECL_IDOMNSHTMLANCHORELEMENT \ - NS_IMETHOD GetProtocol(nsString& aProtocol); \ - NS_IMETHOD GetHost(nsString& aHost); \ - NS_IMETHOD GetHostname(nsString& aHostname); \ - NS_IMETHOD GetPathname(nsString& aPathname); \ - NS_IMETHOD GetSearch(nsString& aSearch); \ - NS_IMETHOD GetPort(nsString& aPort); \ - NS_IMETHOD GetHash(nsString& aHash); \ - NS_IMETHOD GetText(nsString& aText); \ + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol); \ + NS_IMETHOD GetHost(nsAWritableString& aHost); \ + NS_IMETHOD GetHostname(nsAWritableString& aHostname); \ + NS_IMETHOD GetPathname(nsAWritableString& aPathname); \ + NS_IMETHOD GetSearch(nsAWritableString& aSearch); \ + NS_IMETHOD GetPort(nsAWritableString& aPort); \ + NS_IMETHOD GetHash(nsAWritableString& aHash); \ + NS_IMETHOD GetText(nsAWritableString& aText); \ #define NS_FORWARD_IDOMNSHTMLANCHORELEMENT(_to) \ - NS_IMETHOD GetProtocol(nsString& aProtocol) { return _to GetProtocol(aProtocol); } \ - NS_IMETHOD GetHost(nsString& aHost) { return _to GetHost(aHost); } \ - NS_IMETHOD GetHostname(nsString& aHostname) { return _to GetHostname(aHostname); } \ - NS_IMETHOD GetPathname(nsString& aPathname) { return _to GetPathname(aPathname); } \ - NS_IMETHOD GetSearch(nsString& aSearch) { return _to GetSearch(aSearch); } \ - NS_IMETHOD GetPort(nsString& aPort) { return _to GetPort(aPort); } \ - NS_IMETHOD GetHash(nsString& aHash) { return _to GetHash(aHash); } \ - NS_IMETHOD GetText(nsString& aText) { return _to GetText(aText); } \ + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol) { return _to GetProtocol(aProtocol); } \ + NS_IMETHOD GetHost(nsAWritableString& aHost) { return _to GetHost(aHost); } \ + NS_IMETHOD GetHostname(nsAWritableString& aHostname) { return _to GetHostname(aHostname); } \ + NS_IMETHOD GetPathname(nsAWritableString& aPathname) { return _to GetPathname(aPathname); } \ + NS_IMETHOD GetSearch(nsAWritableString& aSearch) { return _to GetSearch(aSearch); } \ + NS_IMETHOD GetPort(nsAWritableString& aPort) { return _to GetPort(aPort); } \ + NS_IMETHOD GetHash(nsAWritableString& aHash) { return _to GetHash(aHash); } \ + NS_IMETHOD GetText(nsAWritableString& aText) { return _to GetText(aText); } \ #endif // nsIDOMNSHTMLAnchorElement_h__ diff --git a/dom/public/html/nsIDOMNSHTMLAreaElement.h b/dom/public/html/nsIDOMNSHTMLAreaElement.h index d1ea10fd6d20..cbd1fdcda88a 100644 --- a/dom/public/html/nsIDOMNSHTMLAreaElement.h +++ b/dom/public/html/nsIDOMNSHTMLAreaElement.h @@ -37,41 +37,41 @@ class nsIDOMNSHTMLAreaElement : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSHTMLAREAELEMENT_IID; return iid; } - NS_IMETHOD GetProtocol(nsString& aProtocol)=0; + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol)=0; - NS_IMETHOD GetHost(nsString& aHost)=0; + NS_IMETHOD GetHost(nsAWritableString& aHost)=0; - NS_IMETHOD GetHostname(nsString& aHostname)=0; + NS_IMETHOD GetHostname(nsAWritableString& aHostname)=0; - NS_IMETHOD GetPathname(nsString& aPathname)=0; + NS_IMETHOD GetPathname(nsAWritableString& aPathname)=0; - NS_IMETHOD GetSearch(nsString& aSearch)=0; + NS_IMETHOD GetSearch(nsAWritableString& aSearch)=0; - NS_IMETHOD GetPort(nsString& aPort)=0; + NS_IMETHOD GetPort(nsAWritableString& aPort)=0; - NS_IMETHOD GetHash(nsString& aHash)=0; + NS_IMETHOD GetHash(nsAWritableString& aHash)=0; }; #define NS_DECL_IDOMNSHTMLAREAELEMENT \ - NS_IMETHOD GetProtocol(nsString& aProtocol); \ - NS_IMETHOD GetHost(nsString& aHost); \ - NS_IMETHOD GetHostname(nsString& aHostname); \ - NS_IMETHOD GetPathname(nsString& aPathname); \ - NS_IMETHOD GetSearch(nsString& aSearch); \ - NS_IMETHOD GetPort(nsString& aPort); \ - NS_IMETHOD GetHash(nsString& aHash); \ + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol); \ + NS_IMETHOD GetHost(nsAWritableString& aHost); \ + NS_IMETHOD GetHostname(nsAWritableString& aHostname); \ + NS_IMETHOD GetPathname(nsAWritableString& aPathname); \ + NS_IMETHOD GetSearch(nsAWritableString& aSearch); \ + NS_IMETHOD GetPort(nsAWritableString& aPort); \ + NS_IMETHOD GetHash(nsAWritableString& aHash); \ #define NS_FORWARD_IDOMNSHTMLAREAELEMENT(_to) \ - NS_IMETHOD GetProtocol(nsString& aProtocol) { return _to GetProtocol(aProtocol); } \ - NS_IMETHOD GetHost(nsString& aHost) { return _to GetHost(aHost); } \ - NS_IMETHOD GetHostname(nsString& aHostname) { return _to GetHostname(aHostname); } \ - NS_IMETHOD GetPathname(nsString& aPathname) { return _to GetPathname(aPathname); } \ - NS_IMETHOD GetSearch(nsString& aSearch) { return _to GetSearch(aSearch); } \ - NS_IMETHOD GetPort(nsString& aPort) { return _to GetPort(aPort); } \ - NS_IMETHOD GetHash(nsString& aHash) { return _to GetHash(aHash); } \ + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol) { return _to GetProtocol(aProtocol); } \ + NS_IMETHOD GetHost(nsAWritableString& aHost) { return _to GetHost(aHost); } \ + NS_IMETHOD GetHostname(nsAWritableString& aHostname) { return _to GetHostname(aHostname); } \ + NS_IMETHOD GetPathname(nsAWritableString& aPathname) { return _to GetPathname(aPathname); } \ + NS_IMETHOD GetSearch(nsAWritableString& aSearch) { return _to GetSearch(aSearch); } \ + NS_IMETHOD GetPort(nsAWritableString& aPort) { return _to GetPort(aPort); } \ + NS_IMETHOD GetHash(nsAWritableString& aHash) { return _to GetHash(aHash); } \ #endif // nsIDOMNSHTMLAreaElement_h__ diff --git a/dom/public/html/nsIDOMNSHTMLDocument.h b/dom/public/html/nsIDOMNSHTMLDocument.h index 9a67a9b1604c..4785fc3c1251 100644 --- a/dom/public/html/nsIDOMNSHTMLDocument.h +++ b/dom/public/html/nsIDOMNSHTMLDocument.h @@ -44,26 +44,26 @@ public: NS_IMETHOD GetHeight(PRInt32* aHeight)=0; - NS_IMETHOD GetAlinkColor(nsString& aAlinkColor)=0; - NS_IMETHOD SetAlinkColor(const nsString& aAlinkColor)=0; + NS_IMETHOD GetAlinkColor(nsAWritableString& aAlinkColor)=0; + NS_IMETHOD SetAlinkColor(const nsAReadableString& aAlinkColor)=0; - NS_IMETHOD GetLinkColor(nsString& aLinkColor)=0; - NS_IMETHOD SetLinkColor(const nsString& aLinkColor)=0; + NS_IMETHOD GetLinkColor(nsAWritableString& aLinkColor)=0; + NS_IMETHOD SetLinkColor(const nsAReadableString& aLinkColor)=0; - NS_IMETHOD GetVlinkColor(nsString& aVlinkColor)=0; - NS_IMETHOD SetVlinkColor(const nsString& aVlinkColor)=0; + NS_IMETHOD GetVlinkColor(nsAWritableString& aVlinkColor)=0; + NS_IMETHOD SetVlinkColor(const nsAReadableString& aVlinkColor)=0; - NS_IMETHOD GetBgColor(nsString& aBgColor)=0; - NS_IMETHOD SetBgColor(const nsString& aBgColor)=0; + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor)=0; + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor)=0; - NS_IMETHOD GetFgColor(nsString& aFgColor)=0; - NS_IMETHOD SetFgColor(const nsString& aFgColor)=0; + NS_IMETHOD GetFgColor(nsAWritableString& aFgColor)=0; + NS_IMETHOD SetFgColor(const nsAReadableString& aFgColor)=0; - NS_IMETHOD GetLastModified(nsString& aLastModified)=0; + NS_IMETHOD GetLastModified(nsAWritableString& aLastModified)=0; NS_IMETHOD GetEmbeds(nsIDOMHTMLCollection** aEmbeds)=0; - NS_IMETHOD GetSelection(nsString& aReturn)=0; + NS_IMETHOD GetSelection(nsAWritableString& aReturn)=0; NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn)=0; @@ -86,19 +86,19 @@ public: #define NS_DECL_IDOMNSHTMLDOCUMENT \ NS_IMETHOD GetWidth(PRInt32* aWidth); \ NS_IMETHOD GetHeight(PRInt32* aHeight); \ - NS_IMETHOD GetAlinkColor(nsString& aAlinkColor); \ - NS_IMETHOD SetAlinkColor(const nsString& aAlinkColor); \ - NS_IMETHOD GetLinkColor(nsString& aLinkColor); \ - NS_IMETHOD SetLinkColor(const nsString& aLinkColor); \ - NS_IMETHOD GetVlinkColor(nsString& aVlinkColor); \ - NS_IMETHOD SetVlinkColor(const nsString& aVlinkColor); \ - NS_IMETHOD GetBgColor(nsString& aBgColor); \ - NS_IMETHOD SetBgColor(const nsString& aBgColor); \ - NS_IMETHOD GetFgColor(nsString& aFgColor); \ - NS_IMETHOD SetFgColor(const nsString& aFgColor); \ - NS_IMETHOD GetLastModified(nsString& aLastModified); \ + NS_IMETHOD GetAlinkColor(nsAWritableString& aAlinkColor); \ + NS_IMETHOD SetAlinkColor(const nsAReadableString& aAlinkColor); \ + NS_IMETHOD GetLinkColor(nsAWritableString& aLinkColor); \ + NS_IMETHOD SetLinkColor(const nsAReadableString& aLinkColor); \ + NS_IMETHOD GetVlinkColor(nsAWritableString& aVlinkColor); \ + NS_IMETHOD SetVlinkColor(const nsAReadableString& aVlinkColor); \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor); \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor); \ + NS_IMETHOD GetFgColor(nsAWritableString& aFgColor); \ + NS_IMETHOD SetFgColor(const nsAReadableString& aFgColor); \ + NS_IMETHOD GetLastModified(nsAWritableString& aLastModified); \ NS_IMETHOD GetEmbeds(nsIDOMHTMLCollection** aEmbeds); \ - NS_IMETHOD GetSelection(nsString& aReturn); \ + NS_IMETHOD GetSelection(nsAWritableString& aReturn); \ NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); \ NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc); \ NS_IMETHOD Write(JSContext* cx, jsval* argv, PRUint32 argc); \ @@ -113,19 +113,19 @@ public: #define NS_FORWARD_IDOMNSHTMLDOCUMENT(_to) \ NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \ NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \ - NS_IMETHOD GetAlinkColor(nsString& aAlinkColor) { return _to GetAlinkColor(aAlinkColor); } \ - NS_IMETHOD SetAlinkColor(const nsString& aAlinkColor) { return _to SetAlinkColor(aAlinkColor); } \ - NS_IMETHOD GetLinkColor(nsString& aLinkColor) { return _to GetLinkColor(aLinkColor); } \ - NS_IMETHOD SetLinkColor(const nsString& aLinkColor) { return _to SetLinkColor(aLinkColor); } \ - NS_IMETHOD GetVlinkColor(nsString& aVlinkColor) { return _to GetVlinkColor(aVlinkColor); } \ - NS_IMETHOD SetVlinkColor(const nsString& aVlinkColor) { return _to SetVlinkColor(aVlinkColor); } \ - NS_IMETHOD GetBgColor(nsString& aBgColor) { return _to GetBgColor(aBgColor); } \ - NS_IMETHOD SetBgColor(const nsString& aBgColor) { return _to SetBgColor(aBgColor); } \ - NS_IMETHOD GetFgColor(nsString& aFgColor) { return _to GetFgColor(aFgColor); } \ - NS_IMETHOD SetFgColor(const nsString& aFgColor) { return _to SetFgColor(aFgColor); } \ - NS_IMETHOD GetLastModified(nsString& aLastModified) { return _to GetLastModified(aLastModified); } \ + NS_IMETHOD GetAlinkColor(nsAWritableString& aAlinkColor) { return _to GetAlinkColor(aAlinkColor); } \ + NS_IMETHOD SetAlinkColor(const nsAReadableString& aAlinkColor) { return _to SetAlinkColor(aAlinkColor); } \ + NS_IMETHOD GetLinkColor(nsAWritableString& aLinkColor) { return _to GetLinkColor(aLinkColor); } \ + NS_IMETHOD SetLinkColor(const nsAReadableString& aLinkColor) { return _to SetLinkColor(aLinkColor); } \ + NS_IMETHOD GetVlinkColor(nsAWritableString& aVlinkColor) { return _to GetVlinkColor(aVlinkColor); } \ + NS_IMETHOD SetVlinkColor(const nsAReadableString& aVlinkColor) { return _to SetVlinkColor(aVlinkColor); } \ + NS_IMETHOD GetBgColor(nsAWritableString& aBgColor) { return _to GetBgColor(aBgColor); } \ + NS_IMETHOD SetBgColor(const nsAReadableString& aBgColor) { return _to SetBgColor(aBgColor); } \ + NS_IMETHOD GetFgColor(nsAWritableString& aFgColor) { return _to GetFgColor(aFgColor); } \ + NS_IMETHOD SetFgColor(const nsAReadableString& aFgColor) { return _to SetFgColor(aFgColor); } \ + NS_IMETHOD GetLastModified(nsAWritableString& aLastModified) { return _to GetLastModified(aLastModified); } \ NS_IMETHOD GetEmbeds(nsIDOMHTMLCollection** aEmbeds) { return _to GetEmbeds(aEmbeds); } \ - NS_IMETHOD GetSelection(nsString& aReturn) { return _to GetSelection(aReturn); } \ + NS_IMETHOD GetSelection(nsAWritableString& aReturn) { return _to GetSelection(aReturn); } \ NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn) { return _to NamedItem(cx, argv, argc, aReturn); } \ NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Open(cx, argv, argc); } \ NS_IMETHOD Write(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Write(cx, argv, argc); } \ diff --git a/dom/public/html/nsIDOMNSHTMLFormElement.h b/dom/public/html/nsIDOMNSHTMLFormElement.h index d04908006da6..cecd1d31cdef 100644 --- a/dom/public/html/nsIDOMNSHTMLFormElement.h +++ b/dom/public/html/nsIDOMNSHTMLFormElement.h @@ -39,7 +39,7 @@ class nsIDOMNSHTMLFormElement : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSHTMLFORMELEMENT_IID; return iid; } - NS_IMETHOD GetEncoding(nsString& aEncoding)=0; + NS_IMETHOD GetEncoding(nsAWritableString& aEncoding)=0; NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn)=0; @@ -48,14 +48,14 @@ public: #define NS_DECL_IDOMNSHTMLFORMELEMENT \ - NS_IMETHOD GetEncoding(nsString& aEncoding); \ + NS_IMETHOD GetEncoding(nsAWritableString& aEncoding); \ NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn); \ #define NS_FORWARD_IDOMNSHTMLFORMELEMENT(_to) \ - NS_IMETHOD GetEncoding(nsString& aEncoding) { return _to GetEncoding(aEncoding); } \ + NS_IMETHOD GetEncoding(nsAWritableString& aEncoding) { return _to GetEncoding(aEncoding); } \ NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn) { return _to NamedItem(cx, argv, argc, aReturn); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn) { return _to Item(aIndex, aReturn); } \ diff --git a/dom/public/html/nsIDOMNSHTMLOptionCollection.h b/dom/public/html/nsIDOMNSHTMLOptionCollection.h index e1bb42f3ae4b..43d1e30d0fe4 100755 --- a/dom/public/html/nsIDOMNSHTMLOptionCollection.h +++ b/dom/public/html/nsIDOMNSHTMLOptionCollection.h @@ -47,7 +47,7 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0; }; @@ -57,7 +57,7 @@ public: NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex); \ NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex); \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); \ @@ -67,7 +67,7 @@ public: NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex) { return _to GetSelectedIndex(aSelectedIndex); } \ NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex) { return _to SetSelectedIndex(aSelectedIndex); } \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to NamedItem(aName, aReturn); } \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { return _to NamedItem(aName, aReturn); } \ extern "C" NS_DOM nsresult NS_InitNSHTMLOptionCollectionClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/html/nsIDOMNSHTMLSelectElement.h b/dom/public/html/nsIDOMNSHTMLSelectElement.h index d9b4f15ce776..aab6282f831b 100644 --- a/dom/public/html/nsIDOMNSHTMLSelectElement.h +++ b/dom/public/html/nsIDOMNSHTMLSelectElement.h @@ -40,19 +40,19 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0; }; #define NS_DECL_IDOMNSHTMLSELECTELEMENT \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); \ #define NS_FORWARD_IDOMNSHTMLSELECTELEMENT(_to) \ NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return _to Item(aIndex, aReturn); } \ - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to NamedItem(aName, aReturn); } \ + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { return _to NamedItem(aName, aReturn); } \ #endif // nsIDOMNSHTMLSelectElement_h__ diff --git a/dom/public/idl/coreDom/DOMImplementation.idl b/dom/public/idl/coreDom/DOMImplementation.idl index bf96d7d99f1b..a0c8eeb9ab9a 100644 --- a/dom/public/idl/coreDom/DOMImplementation.idl +++ b/dom/public/idl/coreDom/DOMImplementation.idl @@ -15,3 +15,4 @@ in DocumentType doctype) raises(DOMException); }; + diff --git a/dom/public/nsIScriptContext.h b/dom/public/nsIScriptContext.h index 31bffe4b27d9..1675e711685c 100644 --- a/dom/public/nsIScriptContext.h +++ b/dom/public/nsIScriptContext.h @@ -68,16 +68,16 @@ public: * @return NS_OK if the script was valid and got executed * **/ - NS_IMETHOD EvaluateString(const nsString& aScript, + NS_IMETHOD EvaluateString(const nsAReadableString& aScript, void *aScopeObject, nsIPrincipal *aPrincipal, const char *aURL, PRUint32 aLineNo, const char* aVersion, - nsString& aRetValue, + nsAWritableString& aRetValue, PRBool* aIsUndefined) = 0; - NS_IMETHOD EvaluateStringWithValue(const nsString& aScript, + NS_IMETHOD EvaluateStringWithValue(const nsAReadableString& aScript, void *aScopeObject, nsIPrincipal *aPrincipal, const char *aURL, @@ -129,7 +129,7 @@ public: */ NS_IMETHOD ExecuteScript(void* aScriptObject, void* aScopeObject, - nsString* aRetValue, + nsAWritableString* aRetValue, PRBool* aIsUndefined) = 0; /** @@ -156,7 +156,7 @@ public: */ NS_IMETHOD CompileEventHandler(void* aTarget, nsIAtom* aName, - const nsString& aBody, + const nsAReadableString& aBody, PRBool aShared, void** aHandler) = 0; @@ -200,7 +200,7 @@ public: const nsCString& aName, PRUint32 aArgCount, const char** aArgArray, - const nsString& aBody, + const nsAReadableString& aBody, const char* aURL, PRUint32 aLineNo, PRBool aShared, diff --git a/dom/public/nsIScriptObjectOwner.h b/dom/public/nsIScriptObjectOwner.h index 5f686c4d7f46..20de97690e23 100644 --- a/dom/public/nsIScriptObjectOwner.h +++ b/dom/public/nsIScriptObjectOwner.h @@ -26,6 +26,7 @@ #include "nscore.h" #include "nsISupports.h" #include "nsIScriptContext.h" +#include "nsAReadableString.h" class nsIScriptContext; @@ -103,7 +104,7 @@ public: NS_IMETHOD CompileEventHandler(nsIScriptContext* aContext, void* aTarget, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, void** aHandler) = 0; /** diff --git a/dom/public/range/nsIDOMNSRange.h b/dom/public/range/nsIDOMNSRange.h index ad2cdfd3a403..efb02cc86e22 100644 --- a/dom/public/range/nsIDOMNSRange.h +++ b/dom/public/range/nsIDOMNSRange.h @@ -45,9 +45,9 @@ public: NODE_INSIDE = 3 }; - NS_IMETHOD CreateContextualFragment(const nsString& aFragment, nsIDOMDocumentFragment** aReturn)=0; + NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn)=0; - NS_IMETHOD IsValidFragment(const nsString& aFragment, PRBool* aReturn)=0; + NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn)=0; NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn)=0; @@ -60,8 +60,8 @@ public: #define NS_DECL_IDOMNSRANGE \ - NS_IMETHOD CreateContextualFragment(const nsString& aFragment, nsIDOMDocumentFragment** aReturn); \ - NS_IMETHOD IsValidFragment(const nsString& aFragment, PRBool* aReturn); \ + NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn); \ + NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn); \ NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn); \ NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aReturn); \ NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn); \ @@ -70,8 +70,8 @@ public: #define NS_FORWARD_IDOMNSRANGE(_to) \ - NS_IMETHOD CreateContextualFragment(const nsString& aFragment, nsIDOMDocumentFragment** aReturn) { return _to CreateContextualFragment(aFragment, aReturn); } \ - NS_IMETHOD IsValidFragment(const nsString& aFragment, PRBool* aReturn) { return _to IsValidFragment(aFragment, aReturn); } \ + NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn) { return _to CreateContextualFragment(aFragment, aReturn); } \ + NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn) { return _to IsValidFragment(aFragment, aReturn); } \ NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn) { return _to IsPointInRange(aParent, aOffset, aReturn); } \ NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aReturn) { return _to ComparePoint(aParent, aOffset, aReturn); } \ NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn) { return _to IntersectsNode(aN, aReturn); } \ diff --git a/dom/public/range/nsIDOMRange.h b/dom/public/range/nsIDOMRange.h index f9f616c938db..2d7535ee6f2a 100644 --- a/dom/public/range/nsIDOMRange.h +++ b/dom/public/range/nsIDOMRange.h @@ -90,7 +90,7 @@ public: NS_IMETHOD Clone(nsIDOMRange** aReturn)=0; - NS_IMETHOD ToString(nsString& aReturn)=0; + NS_IMETHOD ToString(nsAWritableString& aReturn)=0; }; @@ -117,7 +117,7 @@ public: NS_IMETHOD InsertNode(nsIDOMNode* aN); \ NS_IMETHOD SurroundContents(nsIDOMNode* aN); \ NS_IMETHOD Clone(nsIDOMRange** aReturn); \ - NS_IMETHOD ToString(nsString& aReturn); \ + NS_IMETHOD ToString(nsAWritableString& aReturn); \ @@ -144,7 +144,7 @@ public: NS_IMETHOD InsertNode(nsIDOMNode* aN) { return _to InsertNode(aN); } \ NS_IMETHOD SurroundContents(nsIDOMNode* aN) { return _to SurroundContents(aN); } \ NS_IMETHOD Clone(nsIDOMRange** aReturn) { return _to Clone(aReturn); } \ - NS_IMETHOD ToString(nsString& aReturn) { return _to ToString(aReturn); } \ + NS_IMETHOD ToString(nsAWritableString& aReturn) { return _to ToString(aReturn); } \ extern "C" NS_DOM nsresult NS_InitRangeClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/range/nsIDOMSelection.h b/dom/public/range/nsIDOMSelection.h index 890915e97a8e..144c2f22f617 100644 --- a/dom/public/range/nsIDOMSelection.h +++ b/dom/public/range/nsIDOMSelection.h @@ -87,7 +87,7 @@ public: NS_IMETHOD GetEnumerator(nsIEnumerator** aReturn)=0; - NS_IMETHOD ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn)=0; + NS_IMETHOD ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn)=0; }; @@ -115,7 +115,7 @@ public: NS_IMETHOD SetHint(PRBool aRight); \ NS_IMETHOD GetHint(PRBool* aReturn); \ NS_IMETHOD GetEnumerator(nsIEnumerator** aReturn); \ - NS_IMETHOD ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn); \ + NS_IMETHOD ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn); \ @@ -143,7 +143,7 @@ public: NS_IMETHOD SetHint(PRBool aRight) { return _to SetHint(aRight); } \ NS_IMETHOD GetHint(PRBool* aReturn) { return _to GetHint(aReturn); } \ NS_IMETHOD GetEnumerator(nsIEnumerator** aReturn) { return _to GetEnumerator(aReturn); } \ - NS_IMETHOD ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn) { return _to ToString(aFormatType, aFlags, aWrapCount, aReturn); } \ + NS_IMETHOD ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn) { return _to ToString(aFormatType, aFlags, aWrapCount, aReturn); } \ extern "C" NS_DOM nsresult NS_InitSelectionClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/xul/nsIDOMXULCommandDispatcher.h b/dom/public/xul/nsIDOMXULCommandDispatcher.h index 025cb9e733c7..b5bc0a7a1d54 100644 --- a/dom/public/xul/nsIDOMXULCommandDispatcher.h +++ b/dom/public/xul/nsIDOMXULCommandDispatcher.h @@ -56,13 +56,13 @@ public: NS_IMETHOD GetActive(PRBool* aActive)=0; NS_IMETHOD SetActive(PRBool aActive)=0; - NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets)=0; + NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsAReadableString& aEvents, const nsAReadableString& aTargets)=0; NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater)=0; - NS_IMETHOD UpdateCommands(const nsString& aEventName)=0; + NS_IMETHOD UpdateCommands(const nsAReadableString& aEventName)=0; - NS_IMETHOD GetControllerForCommand(const nsString& aCommand, nsIController** aReturn)=0; + NS_IMETHOD GetControllerForCommand(const nsAReadableString& aCommand, nsIController** aReturn)=0; NS_IMETHOD GetControllers(nsIControllers** aReturn)=0; }; @@ -79,10 +79,10 @@ public: NS_IMETHOD SetSuppressFocusScroll(PRBool aSuppressFocusScroll); \ NS_IMETHOD GetActive(PRBool* aActive); \ NS_IMETHOD SetActive(PRBool aActive); \ - NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets); \ + NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsAReadableString& aEvents, const nsAReadableString& aTargets); \ NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater); \ - NS_IMETHOD UpdateCommands(const nsString& aEventName); \ - NS_IMETHOD GetControllerForCommand(const nsString& aCommand, nsIController** aReturn); \ + NS_IMETHOD UpdateCommands(const nsAReadableString& aEventName); \ + NS_IMETHOD GetControllerForCommand(const nsAReadableString& aCommand, nsIController** aReturn); \ NS_IMETHOD GetControllers(nsIControllers** aReturn); \ @@ -98,10 +98,10 @@ public: NS_IMETHOD SetSuppressFocusScroll(PRBool aSuppressFocusScroll) { return _to SetSuppressFocusScroll(aSuppressFocusScroll); } \ NS_IMETHOD GetActive(PRBool* aActive) { return _to GetActive(aActive); } \ NS_IMETHOD SetActive(PRBool aActive) { return _to SetActive(aActive); } \ - NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets) { return _to AddCommandUpdater(aUpdater, aEvents, aTargets); } \ + NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsAReadableString& aEvents, const nsAReadableString& aTargets) { return _to AddCommandUpdater(aUpdater, aEvents, aTargets); } \ NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater) { return _to RemoveCommandUpdater(aUpdater); } \ - NS_IMETHOD UpdateCommands(const nsString& aEventName) { return _to UpdateCommands(aEventName); } \ - NS_IMETHOD GetControllerForCommand(const nsString& aCommand, nsIController** aReturn) { return _to GetControllerForCommand(aCommand, aReturn); } \ + NS_IMETHOD UpdateCommands(const nsAReadableString& aEventName) { return _to UpdateCommands(aEventName); } \ + NS_IMETHOD GetControllerForCommand(const nsAReadableString& aCommand, nsIController** aReturn) { return _to GetControllerForCommand(aCommand, aReturn); } \ NS_IMETHOD GetControllers(nsIControllers** aReturn) { return _to GetControllers(aReturn); } \ diff --git a/dom/public/xul/nsIDOMXULDocument.h b/dom/public/xul/nsIDOMXULDocument.h index 78feb38e632c..b0225fc6aec8 100644 --- a/dom/public/xul/nsIDOMXULDocument.h +++ b/dom/public/xul/nsIDOMXULDocument.h @@ -56,9 +56,9 @@ public: NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls)=0; - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn)=0; - NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr)=0; + NS_IMETHOD Persist(const nsAReadableString& aId, const nsAReadableString& aAttr)=0; }; @@ -71,8 +71,8 @@ public: NS_IMETHOD GetWidth(PRInt32* aWidth); \ NS_IMETHOD GetHeight(PRInt32* aHeight); \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls); \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \ - NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr); \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn); \ + NS_IMETHOD Persist(const nsAReadableString& aId, const nsAReadableString& aAttr); \ @@ -85,8 +85,8 @@ public: NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \ NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls) { return _to GetControls(aControls); } \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ - NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr) { return _to Persist(aId, aAttr); } \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ + NS_IMETHOD Persist(const nsAReadableString& aId, const nsAReadableString& aAttr) { return _to Persist(aId, aAttr); } \ extern "C" NS_DOM nsresult NS_InitXULDocumentClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/public/xul/nsIDOMXULElement.h b/dom/public/xul/nsIDOMXULElement.h index 219835ef1e05..7c5190e3c6eb 100644 --- a/dom/public/xul/nsIDOMXULElement.h +++ b/dom/public/xul/nsIDOMXULElement.h @@ -46,11 +46,11 @@ class nsIDOMXULElement : public nsIDOMElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULELEMENT_IID; return iid; } - NS_IMETHOD GetId(nsString& aId)=0; - NS_IMETHOD SetId(const nsString& aId)=0; + NS_IMETHOD GetId(nsAWritableString& aId)=0; + NS_IMETHOD SetId(const nsAReadableString& aId)=0; - NS_IMETHOD GetClassName(nsString& aClassName)=0; - NS_IMETHOD SetClassName(const nsString& aClassName)=0; + NS_IMETHOD GetClassName(nsAWritableString& aClassName)=0; + NS_IMETHOD SetClassName(const nsAReadableString& aClassName)=0; NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0; @@ -64,9 +64,9 @@ public: NS_IMETHOD GetBoxObject(nsIBoxObject** aBoxObject)=0; - NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0; + NS_IMETHOD AddBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement)=0; - NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0; + NS_IMETHOD RemoveBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement)=0; NS_IMETHOD DoCommand()=0; @@ -76,49 +76,49 @@ public: NS_IMETHOD Click()=0; - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn)=0; }; #define NS_DECL_IDOMXULELEMENT \ - NS_IMETHOD GetId(nsString& aId); \ - NS_IMETHOD SetId(const nsString& aId); \ - NS_IMETHOD GetClassName(nsString& aClassName); \ - NS_IMETHOD SetClassName(const nsString& aClassName); \ + NS_IMETHOD GetId(nsAWritableString& aId); \ + NS_IMETHOD SetId(const nsAReadableString& aId); \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName); \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName); \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \ NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \ NS_IMETHOD GetBuilder(nsIXULTemplateBuilder** aBuilder); \ NS_IMETHOD GetResource(nsIRDFResource** aResource); \ NS_IMETHOD GetControllers(nsIControllers** aControllers); \ NS_IMETHOD GetBoxObject(nsIBoxObject** aBoxObject); \ - NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \ - NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \ + NS_IMETHOD AddBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement); \ + NS_IMETHOD RemoveBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement); \ NS_IMETHOD DoCommand(); \ NS_IMETHOD Focus(); \ NS_IMETHOD Blur(); \ NS_IMETHOD Click(); \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn); \ #define NS_FORWARD_IDOMXULELEMENT(_to) \ - NS_IMETHOD GetId(nsString& aId) { return _to GetId(aId); } \ - NS_IMETHOD SetId(const nsString& aId) { return _to SetId(aId); } \ - NS_IMETHOD GetClassName(nsString& aClassName) { return _to GetClassName(aClassName); } \ - NS_IMETHOD SetClassName(const nsString& aClassName) { return _to SetClassName(aClassName); } \ + NS_IMETHOD GetId(nsAWritableString& aId) { return _to GetId(aId); } \ + NS_IMETHOD SetId(const nsAReadableString& aId) { return _to SetId(aId); } \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName) { return _to GetClassName(aClassName); } \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName) { return _to SetClassName(aClassName); } \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \ NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \ NS_IMETHOD GetBuilder(nsIXULTemplateBuilder** aBuilder) { return _to GetBuilder(aBuilder); } \ NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \ NS_IMETHOD GetControllers(nsIControllers** aControllers) { return _to GetControllers(aControllers); } \ NS_IMETHOD GetBoxObject(nsIBoxObject** aBoxObject) { return _to GetBoxObject(aBoxObject); } \ - NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \ - NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \ + NS_IMETHOD AddBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \ + NS_IMETHOD RemoveBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \ NS_IMETHOD DoCommand() { return _to DoCommand(); } \ NS_IMETHOD Focus() { return _to Focus(); } \ NS_IMETHOD Blur() { return _to Blur(); } \ NS_IMETHOD Click() { return _to Click(); } \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ extern "C" NS_DOM nsresult NS_InitXULElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/dom/src/base/nsDOMException.cpp b/dom/src/base/nsDOMException.cpp index 0860781bb73d..1c192ce7f6c5 100644 --- a/dom/src/base/nsDOMException.cpp +++ b/dom/src/base/nsDOMException.cpp @@ -26,6 +26,7 @@ #include "nsDOMError.h" #include "prprf.h" #include "nsIScriptGlobalObject.h" +#include "nsReadableUtils.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -169,10 +170,10 @@ nsDOMException::GetResult(PRUint32* aResult) } NS_IMETHODIMP -nsDOMException::GetMessage(nsString& aMessage) +nsDOMException::GetMessage(nsAWritableString& aMessage) { if (mMessage) { - aMessage.AssignWithConversion(mMessage); + CopyASCIItoUCS2(nsLiteralCString(mMessage), aMessage); } else { aMessage.Truncate(); @@ -182,10 +183,10 @@ nsDOMException::GetMessage(nsString& aMessage) } NS_IMETHODIMP -nsDOMException::GetName(nsString& aName) +nsDOMException::GetName(nsAWritableString& aName) { if (mName) { - aName.AssignWithConversion(mName); + CopyASCIItoUCS2(nsLiteralCString(mName), aName); } else { aName.Truncate(); @@ -195,7 +196,7 @@ nsDOMException::GetName(nsString& aName) } NS_IMETHODIMP -nsDOMException::ToString(nsString& aReturn) +nsDOMException::ToString(nsAWritableString& aReturn) { static const char defaultMsg[] = ""; static const char defaultLocation[] = ""; @@ -211,7 +212,7 @@ nsDOMException::ToString(nsString& aReturn) GetCode(&code); char* temp = PR_smprintf(format, msg, code, mResult, resultName, location); if (temp) { - aReturn.AssignWithConversion(temp); + CopyASCIItoUCS2(nsLiteralCString(temp), aReturn); PR_smprintf_free(temp); } diff --git a/dom/src/base/nsDOMWindowList.cpp b/dom/src/base/nsDOMWindowList.cpp index eab04780968b..dcbd5093f411 100644 --- a/dom/src/base/nsDOMWindowList.cpp +++ b/dom/src/base/nsDOMWindowList.cpp @@ -127,7 +127,7 @@ nsDOMWindowList::Item(PRUint32 aIndex, nsIDOMWindow** aReturn) } NS_IMETHODIMP -nsDOMWindowList::NamedItem(const nsString& aName, nsIDOMWindow** aReturn) +nsDOMWindowList::NamedItem(const nsAReadableString& aName, nsIDOMWindow** aReturn) { nsCOMPtr item; @@ -146,9 +146,10 @@ nsDOMWindowList::NamedItem(const nsString& aName, nsIDOMWindow** aReturn) } } - mDocShellNode->FindChildWithName(aName.GetUnicode(), PR_FALSE, PR_FALSE, + mDocShellNode->FindChildWithName(nsPromiseFlatString(aName), + PR_FALSE, PR_FALSE, nsnull, getter_AddRefs(item)); - + nsCOMPtr globalObject(do_GetInterface(item)); NS_ASSERTION(globalObject, "Couldn't get to the globalObject"); if (globalObject) { diff --git a/dom/src/base/nsDOMWindowList.h b/dom/src/base/nsDOMWindowList.h index 1ffa49efe641..a8509e85af08 100644 --- a/dom/src/base/nsDOMWindowList.h +++ b/dom/src/base/nsDOMWindowList.h @@ -44,7 +44,7 @@ public: //nsIDOMWindowCollection interface NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMWindow** aReturn); //nsIScriptObjectOwner interface NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); diff --git a/dom/src/base/nsFrameList.cpp b/dom/src/base/nsFrameList.cpp index 592db386df6d..89ae736a6096 100644 --- a/dom/src/base/nsFrameList.cpp +++ b/dom/src/base/nsFrameList.cpp @@ -108,7 +108,7 @@ nsFrameList::Item(PRUint32 aIndex, nsIDOMWindow** aReturn) } NS_IMETHODIMP -nsFrameList::NamedItem(const nsString& aName, nsIDOMWindow** aReturn) +nsFrameList::NamedItem(const nsAReadableString& aName, nsIDOMWindow** aReturn) { nsCOMPtr item; diff --git a/dom/src/base/nsFrameList.h b/dom/src/base/nsFrameList.h index 8b9bb4481f0d..3c2c216717c1 100644 --- a/dom/src/base/nsFrameList.h +++ b/dom/src/base/nsFrameList.h @@ -40,7 +40,7 @@ public: //nsIDOMWindowCollection interface NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMWindow** aReturn); //nsIScriptObjectOwner interface NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 1e73a3dcc43f..3164d7697e4c 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -34,6 +34,7 @@ #include "nsJSUtils.h" #include "prmem.h" #include "jsdbgapi.h" // for JS_ClearWatchPointsForObject +#include "nsReadableUtils.h" // Other Classes #include "nsEventListenerManager.h" @@ -848,43 +849,43 @@ NS_IMETHODIMP GlobalWindowImpl::SetOpener(nsIDOMWindow* aOpener) return NS_OK; } -NS_IMETHODIMP GlobalWindowImpl::GetStatus(nsString& aStatus) +NS_IMETHODIMP GlobalWindowImpl::GetStatus(nsAWritableString& aStatus) { aStatus = mStatus; return NS_OK; } -NS_IMETHODIMP GlobalWindowImpl::SetStatus(const nsString& aStatus) +NS_IMETHODIMP GlobalWindowImpl::SetStatus(const nsAReadableString& aStatus) { mStatus = aStatus; nsCOMPtr browserChrome; GetWebBrowserChrome(getter_AddRefs(browserChrome)); if (browserChrome) - browserChrome->SetJSStatus(aStatus.GetUnicode()); + browserChrome->SetJSStatus(nsPromiseFlatString(aStatus)); return NS_OK; } -NS_IMETHODIMP GlobalWindowImpl::GetDefaultStatus(nsString& aDefaultStatus) +NS_IMETHODIMP GlobalWindowImpl::GetDefaultStatus(nsAWritableString& aDefaultStatus) { aDefaultStatus = mDefaultStatus; return NS_OK; } -NS_IMETHODIMP GlobalWindowImpl::SetDefaultStatus(const nsString& aDefaultStatus) +NS_IMETHODIMP GlobalWindowImpl::SetDefaultStatus(const nsAReadableString& aDefaultStatus) { mDefaultStatus = aDefaultStatus; nsCOMPtr browserChrome; GetWebBrowserChrome(getter_AddRefs(browserChrome)); if (browserChrome) - browserChrome->SetJSDefaultStatus(aDefaultStatus.GetUnicode()); + browserChrome->SetJSDefaultStatus(nsPromiseFlatString(aDefaultStatus)); return NS_OK; } -NS_IMETHODIMP GlobalWindowImpl::GetName(nsString& aName) +NS_IMETHODIMP GlobalWindowImpl::GetName(nsAWritableString& aName) { nsXPIDLString name; nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); @@ -895,12 +896,12 @@ NS_IMETHODIMP GlobalWindowImpl::GetName(nsString& aName) return NS_OK; } -NS_IMETHODIMP GlobalWindowImpl::SetName(const nsString& aName) +NS_IMETHODIMP GlobalWindowImpl::SetName(const nsAReadableString& aName) { nsresult result = NS_OK; nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); if (docShellAsItem) - result = docShellAsItem->SetName(aName.GetUnicode()); + result = docShellAsItem->SetName(nsPromiseFlatString(aName)); return result; } @@ -1269,9 +1270,9 @@ NS_IMETHODIMP GlobalWindowImpl::GetLength(PRUint32* aLength) return NS_ERROR_FAILURE; } -NS_IMETHODIMP GlobalWindowImpl::Dump(const nsString& aStr) +NS_IMETHODIMP GlobalWindowImpl::Dump(const nsAReadableString& aStr) { - char *cstr = aStr.ToNewUTF8String(); + char *cstr = ToNewUTF8String(aStr); #ifdef XP_MAC // have to convert \r to \n so that printing to the console works @@ -1701,62 +1702,62 @@ NS_IMETHODIMP GlobalWindowImpl::DisableExternalCapture() //Note: This call will lock the cursor, it will not change as it moves. //To unlock, the cursor must be set back to CURSOR_AUTO. -NS_IMETHODIMP GlobalWindowImpl::SetCursor(const nsString& aCursor) +NS_IMETHODIMP GlobalWindowImpl::SetCursor(const nsAReadableString& aCursor) { nsresult ret = NS_OK; PRInt32 cursor; - if (aCursor.EqualsWithConversion("auto")) + if (aCursor.Equals(NS_LITERAL_STRING("auto"))) cursor = NS_STYLE_CURSOR_AUTO; - else if (aCursor.EqualsWithConversion("default")) + else if (aCursor.Equals(NS_LITERAL_STRING("default"))) cursor = NS_STYLE_CURSOR_DEFAULT; - else if (aCursor.EqualsWithConversion("pointer")) + else if (aCursor.Equals(NS_LITERAL_STRING("pointer"))) cursor = NS_STYLE_CURSOR_POINTER; - else if (aCursor.EqualsWithConversion("crosshair")) + else if (aCursor.Equals(NS_LITERAL_STRING("crosshair"))) cursor = NS_STYLE_CURSOR_CROSSHAIR; - else if (aCursor.EqualsWithConversion("move")) + else if (aCursor.Equals(NS_LITERAL_STRING("move"))) cursor = NS_STYLE_CURSOR_MOVE; - else if (aCursor.EqualsWithConversion("text")) + else if (aCursor.Equals(NS_LITERAL_STRING("text"))) cursor = NS_STYLE_CURSOR_TEXT; - else if (aCursor.EqualsWithConversion("wait")) + else if (aCursor.Equals(NS_LITERAL_STRING("wait"))) cursor = NS_STYLE_CURSOR_WAIT; - else if (aCursor.EqualsWithConversion("help")) + else if (aCursor.Equals(NS_LITERAL_STRING("help"))) cursor = NS_STYLE_CURSOR_HELP; - else if (aCursor.EqualsWithConversion("n-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("n-resize"))) cursor = NS_STYLE_CURSOR_N_RESIZE; - else if (aCursor.EqualsWithConversion("s-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("s-resize"))) cursor = NS_STYLE_CURSOR_S_RESIZE; - else if (aCursor.EqualsWithConversion("w-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("w-resize"))) cursor = NS_STYLE_CURSOR_W_RESIZE; - else if (aCursor.EqualsWithConversion("e-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("e-resize"))) cursor = NS_STYLE_CURSOR_E_RESIZE; - else if (aCursor.EqualsWithConversion("ne-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("ne-resize"))) cursor = NS_STYLE_CURSOR_NE_RESIZE; - else if (aCursor.EqualsWithConversion("nw-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("nw-resize"))) cursor = NS_STYLE_CURSOR_NW_RESIZE; - else if (aCursor.EqualsWithConversion("se-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("se-resize"))) cursor = NS_STYLE_CURSOR_SE_RESIZE; - else if (aCursor.EqualsWithConversion("sw-resize")) + else if (aCursor.Equals(NS_LITERAL_STRING("sw-resize"))) cursor = NS_STYLE_CURSOR_SW_RESIZE; - else if (aCursor.EqualsWithConversion("copy")) + else if (aCursor.Equals(NS_LITERAL_STRING("copy"))) cursor = NS_STYLE_CURSOR_COPY; // CSS3 - else if (aCursor.EqualsWithConversion("alias")) + else if (aCursor.Equals(NS_LITERAL_STRING("alias"))) cursor = NS_STYLE_CURSOR_ALIAS; - else if (aCursor.EqualsWithConversion("context-menu")) + else if (aCursor.Equals(NS_LITERAL_STRING("context-menu"))) cursor = NS_STYLE_CURSOR_CONTEXT_MENU; - else if (aCursor.EqualsWithConversion("cell")) + else if (aCursor.Equals(NS_LITERAL_STRING("cell"))) cursor = NS_STYLE_CURSOR_CELL; - else if (aCursor.EqualsWithConversion("grab")) + else if (aCursor.Equals(NS_LITERAL_STRING("grab"))) cursor = NS_STYLE_CURSOR_GRAB; - else if (aCursor.EqualsWithConversion("grabbing")) + else if (aCursor.Equals(NS_LITERAL_STRING("grabbing"))) cursor = NS_STYLE_CURSOR_GRABBING; - else if (aCursor.EqualsWithConversion("spinning")) + else if (aCursor.Equals(NS_LITERAL_STRING("spinning"))) cursor = NS_STYLE_CURSOR_SPINNING; - else if (aCursor.EqualsWithConversion("count-up")) + else if (aCursor.Equals(NS_LITERAL_STRING("count-up"))) cursor = NS_STYLE_CURSOR_COUNT_UP; - else if (aCursor.EqualsWithConversion("count-down")) + else if (aCursor.Equals(NS_LITERAL_STRING("count-down"))) cursor = NS_STYLE_CURSOR_COUNT_DOWN; - else if (aCursor.EqualsWithConversion("count-up-down")) + else if (aCursor.Equals(NS_LITERAL_STRING("count-up-down"))) cursor = NS_STYLE_CURSOR_COUNT_UP_DOWN; else return NS_OK; @@ -1848,7 +1849,7 @@ NS_IMETHODIMP GlobalWindowImpl::Close(JSContext* cx, jsval* argv, PRUint32 argc) return result; } -NS_IMETHODIMP GlobalWindowImpl::UpdateCommands(const nsString& anAction) +NS_IMETHODIMP GlobalWindowImpl::UpdateCommands(const nsAReadableString& anAction) { if (mChromeEventHandler) { // Just jump out to the chrome event handler. @@ -1896,7 +1897,7 @@ NS_IMETHODIMP GlobalWindowImpl::UpdateCommands(const nsString& anAction) return NS_OK; } -NS_IMETHODIMP GlobalWindowImpl::Escape(const nsString& aStr, nsString& aReturn) +NS_IMETHODIMP GlobalWindowImpl::Escape(const nsAReadableString& aStr, nsAWritableString& aReturn) { nsresult result = NS_OK; nsCOMPtr encoder; @@ -1928,7 +1929,7 @@ NS_IMETHODIMP GlobalWindowImpl::Escape(const nsString& aStr, nsString& aReturn) PRInt32 maxByteLen, srcLen; srcLen = aStr.Length(); - const PRUnichar *src = aStr.GetUnicode(); + const PRUnichar* src = nsPromiseFlatString(aStr); // Get the expected length of result string result = encoder->GetMaxLength(src, srcLen, &maxByteLen); @@ -1936,11 +1937,11 @@ NS_IMETHODIMP GlobalWindowImpl::Escape(const nsString& aStr, nsString& aReturn) return result; // Allocate a buffer of the maximum length - char *dest = (char *) nsMemory::Alloc(maxByteLen + 1); + char* dest = (char *) nsMemory::Alloc(maxByteLen + 1); PRInt32 destLen2, destLen = maxByteLen; if (!dest) return NS_ERROR_OUT_OF_MEMORY; - + // Convert from unicode to the character set result = encoder->Convert(src, &srcLen, dest, &destLen); if (NS_FAILED(result)) { @@ -1956,7 +1957,7 @@ NS_IMETHODIMP GlobalWindowImpl::Escape(const nsString& aStr, nsString& aReturn) // Escape the string char *outBuf = nsEscape(dest, nsEscapeMask(url_XAlphas | url_XPAlphas | url_Path)); - aReturn.AssignWithConversion(outBuf); + CopyASCIItoUCS2(nsLiteralCString(outBuf), aReturn); nsMemory::Free(outBuf); nsMemory::Free(dest); @@ -1964,7 +1965,8 @@ NS_IMETHODIMP GlobalWindowImpl::Escape(const nsString& aStr, nsString& aReturn) return result; } -NS_IMETHODIMP GlobalWindowImpl::Unescape(const nsString& aStr, nsString& aReturn) +NS_IMETHODIMP GlobalWindowImpl::Unescape(const nsAReadableString& aStr, + nsAWritableString& aReturn) { nsresult result = NS_OK; nsCOMPtr decoder; @@ -1995,7 +1997,7 @@ NS_IMETHODIMP GlobalWindowImpl::Unescape(const nsString& aStr, nsString& aReturn return result; // Need to copy to do the two-byte to one-byte deflation - char *inBuf = aStr.ToNewCString(); + char *inBuf = ToNewCString(aStr ); if (!inBuf) return NS_ERROR_OUT_OF_MEMORY; @@ -2183,7 +2185,7 @@ PRBool GlobalWindowImpl::SetProperty(JSContext* aContext, JSObject* aObj, if (NS_OK == GetLocation(getter_AddRefs(location))) { nsCOMPtr scriptObj = do_QueryInterface(location); - JSString *str = ::JS_NewStringCopyZ(aContext, "href"); + str = ::JS_NewStringCopyZ(aContext, "href"); if (scriptObj && str) result = @@ -2312,7 +2314,7 @@ void GlobalWindowImpl::Finalize(JSContext* aContext, JSObject* aObj) //***************************************************************************** NS_IMETHODIMP -GlobalWindowImpl::AddEventListener(const nsString& aType, +GlobalWindowImpl::AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { @@ -2328,7 +2330,7 @@ GlobalWindowImpl::AddEventListener(const nsString& aType, } NS_IMETHODIMP -GlobalWindowImpl::RemoveEventListener(const nsString& aType, +GlobalWindowImpl::RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { @@ -2740,10 +2742,10 @@ GlobalWindowImpl::GetPositionAndSize(PRInt32 *x, PRInt32 *y, PRInt32 *cx, // GlobalWindowImpl::nsIDOMViewCSS //***************************************************************************** -NS_IMETHODIMP GlobalWindowImpl::GetComputedStyle(nsIDOMElement *aElt, - const nsString& aPseudoElt, - nsIDOMCSSStyleDeclaration ** - aReturn) +NS_IMETHODIMP +GlobalWindowImpl::GetComputedStyle(nsIDOMElement* aElt, + const nsAReadableString& aPseudoElt, + nsIDOMCSSStyleDeclaration** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); NS_ENSURE_ARG_POINTER(aElt); @@ -4266,7 +4268,7 @@ NS_IMETHODIMP NavigatorImpl::GetScriptObject(nsIScriptContext *aContext, // NavigatorImpl::nsIDOMNavigator //***************************************************************************** -NS_IMETHODIMP NavigatorImpl::GetUserAgent(nsString& aUserAgent) +NS_IMETHODIMP NavigatorImpl::GetUserAgent(nsAWritableString& aUserAgent) { nsresult res; nsCOMPtr @@ -4281,7 +4283,7 @@ NS_IMETHODIMP NavigatorImpl::GetUserAgent(nsString& aUserAgent) return res; } -NS_IMETHODIMP NavigatorImpl::GetAppCodeName(nsString& aAppCodeName) +NS_IMETHODIMP NavigatorImpl::GetAppCodeName(nsAWritableString& aAppCodeName) { nsresult res; nsCOMPtr @@ -4296,7 +4298,7 @@ NS_IMETHODIMP NavigatorImpl::GetAppCodeName(nsString& aAppCodeName) return res; } -NS_IMETHODIMP NavigatorImpl::GetAppVersion(nsString& aAppVersion) +NS_IMETHODIMP NavigatorImpl::GetAppVersion(nsAWritableString& aAppVersion) { nsresult res; nsCOMPtr @@ -4307,7 +4309,7 @@ NS_IMETHODIMP NavigatorImpl::GetAppVersion(nsString& aAppVersion) aAppVersion = str; Recycle(str); - aAppVersion.AppendWithConversion(" ("); + aAppVersion.Append(NS_LITERAL_STRING(" (")); res = service->GetPlatform(&str); if (NS_FAILED(res)) return res; @@ -4315,8 +4317,7 @@ NS_IMETHODIMP NavigatorImpl::GetAppVersion(nsString& aAppVersion) aAppVersion += str; Recycle(str); - aAppVersion.AppendWithConversion("; "); - + aAppVersion.Append(NS_LITERAL_STRING("; ")); res = service->GetLanguage(&str); if (NS_FAILED(res)) return res; @@ -4324,19 +4325,19 @@ NS_IMETHODIMP NavigatorImpl::GetAppVersion(nsString& aAppVersion) aAppVersion += str; Recycle(str); - aAppVersion.AppendWithConversion(')'); + aAppVersion.Append(PRUnichar(')')); } return res; } -NS_IMETHODIMP NavigatorImpl::GetAppName(nsString& aAppName) +NS_IMETHODIMP NavigatorImpl::GetAppName(nsAWritableString& aAppName) { - aAppName.AssignWithConversion("Netscape"); + aAppName.Assign(NS_LITERAL_STRING("Netscape")); return NS_OK; } -NS_IMETHODIMP NavigatorImpl::GetLanguage(nsString& aLanguage) +NS_IMETHODIMP NavigatorImpl::GetLanguage(nsAWritableString& aLanguage) { nsresult res; nsCOMPtr @@ -4351,7 +4352,7 @@ NS_IMETHODIMP NavigatorImpl::GetLanguage(nsString& aLanguage) return res; } -NS_IMETHODIMP NavigatorImpl::GetPlatform(nsString& aPlatform) +NS_IMETHODIMP NavigatorImpl::GetPlatform(nsAWritableString& aPlatform) { nsresult res; nsCOMPtr @@ -4366,7 +4367,7 @@ NS_IMETHODIMP NavigatorImpl::GetPlatform(nsString& aPlatform) return res; } -NS_IMETHODIMP NavigatorImpl::GetOscpu(nsString& aOSCPU) +NS_IMETHODIMP NavigatorImpl::GetOscpu(nsAWritableString& aOSCPU) { nsresult res; nsCOMPtr @@ -4381,7 +4382,7 @@ NS_IMETHODIMP NavigatorImpl::GetOscpu(nsString& aOSCPU) return res; } -NS_IMETHODIMP NavigatorImpl::GetVendor(nsString& aVendor) +NS_IMETHODIMP NavigatorImpl::GetVendor(nsAWritableString& aVendor) { nsresult res; nsCOMPtr @@ -4397,7 +4398,7 @@ NS_IMETHODIMP NavigatorImpl::GetVendor(nsString& aVendor) } -NS_IMETHODIMP NavigatorImpl::GetVendorSub(nsString& aVendorSub) +NS_IMETHODIMP NavigatorImpl::GetVendorSub(nsAWritableString& aVendorSub) { nsresult res; nsCOMPtr @@ -4412,7 +4413,7 @@ NS_IMETHODIMP NavigatorImpl::GetVendorSub(nsString& aVendorSub) return res; } -NS_IMETHODIMP NavigatorImpl::GetProduct(nsString& aProduct) +NS_IMETHODIMP NavigatorImpl::GetProduct(nsAWritableString& aProduct) { nsresult res; nsCOMPtr @@ -4427,7 +4428,7 @@ NS_IMETHODIMP NavigatorImpl::GetProduct(nsString& aProduct) return res; } -NS_IMETHODIMP NavigatorImpl::GetProductSub(nsString& aProductSub) +NS_IMETHODIMP NavigatorImpl::GetProductSub(nsAWritableString& aProductSub) { nsresult res; nsCOMPtr @@ -4442,7 +4443,7 @@ NS_IMETHODIMP NavigatorImpl::GetProductSub(nsString& aProductSub) return res; } -NS_IMETHODIMP NavigatorImpl::GetSecurityPolicy(nsString& aSecurityPolicy) +NS_IMETHODIMP NavigatorImpl::GetSecurityPolicy(nsAWritableString& aSecurityPolicy) { return NS_OK; } diff --git a/dom/src/base/nsGlobalWindow.h b/dom/src/base/nsGlobalWindow.h index 6f54f2aecb62..521de61cec7f 100644 --- a/dom/src/base/nsGlobalWindow.h +++ b/dom/src/base/nsGlobalWindow.h @@ -126,9 +126,9 @@ public: virtual void Finalize(JSContext *aContext, JSObject *aObj); // nsIDOMEventTarget - NS_IMETHOD AddEventListener(const nsString& aType, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); @@ -321,25 +321,25 @@ public: NS_IMETHOD_(void) SetDocShell(nsIDocShell *aDocShell); // nsIDOMLocation - NS_IMETHOD GetHash(nsString& aHash); - NS_IMETHOD SetHash(const nsString& aHash); - NS_IMETHOD GetHost(nsString& aHost); - NS_IMETHOD SetHost(const nsString& aHost); - NS_IMETHOD GetHostname(nsString& aHostname); - NS_IMETHOD SetHostname(const nsString& aHostname); - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetPathname(nsString& aPathname); - NS_IMETHOD SetPathname(const nsString& aPathname); - NS_IMETHOD GetPort(nsString& aPort); - NS_IMETHOD SetPort(const nsString& aPort); - NS_IMETHOD GetProtocol(nsString& aProtocol); - NS_IMETHOD SetProtocol(const nsString& aProtocol); - NS_IMETHOD GetSearch(nsString& aSearch); - NS_IMETHOD SetSearch(const nsString& aSearch); + NS_IMETHOD GetHash(nsAWritableString& aHash); + NS_IMETHOD SetHash(const nsAReadableString& aHash); + NS_IMETHOD GetHost(nsAWritableString& aHost); + NS_IMETHOD SetHost(const nsAReadableString& aHost); + NS_IMETHOD GetHostname(nsAWritableString& aHostname); + NS_IMETHOD SetHostname(const nsAReadableString& aHostname); + NS_IMETHOD GetHref(nsAWritableString& aHref); + NS_IMETHOD SetHref(const nsAReadableString& aHref); + NS_IMETHOD GetPathname(nsAWritableString& aPathname); + NS_IMETHOD SetPathname(const nsAReadableString& aPathname); + NS_IMETHOD GetPort(nsAWritableString& aPort); + NS_IMETHOD SetPort(const nsAReadableString& aPort); + NS_IMETHOD GetProtocol(nsAWritableString& aProtocol); + NS_IMETHOD SetProtocol(const nsAReadableString& aProtocol); + NS_IMETHOD GetSearch(nsAWritableString& aSearch); + NS_IMETHOD SetSearch(const nsAReadableString& aSearch); NS_IMETHOD Reload(PRBool aForceget); - NS_IMETHOD Replace(const nsString& aUrl); - NS_IMETHOD ToString(nsString& aReturn); + NS_IMETHOD Replace(const nsAReadableString& aUrl); + NS_IMETHOD ToString(nsAWritableString& aReturn); // nsIDOMNSLocation NS_IMETHOD Reload(JSContext *cx, jsval *argv, PRUint32 argc); @@ -357,7 +357,7 @@ public: protected: nsresult SetURL(nsIURI* aURL); - nsresult SetHrefWithBase(const nsString& aHref, + nsresult SetHrefWithBase(const nsAReadableString& aHref, nsIURI* aBase, PRBool aReplace); nsresult GetSourceURL(JSContext* cx, diff --git a/dom/src/base/nsHistory.cpp b/dom/src/base/nsHistory.cpp index fcf3eb979117..42fe96382595 100644 --- a/dom/src/base/nsHistory.cpp +++ b/dom/src/base/nsHistory.cpp @@ -97,7 +97,7 @@ HistoryImpl::GetLength(PRInt32* aLength) } NS_IMETHODIMP -HistoryImpl::GetCurrent(nsString& aCurrent) +HistoryImpl::GetCurrent(nsAWritableString& aCurrent) { PRInt32 curIndex; const PRUnichar* curURL = nsnull; @@ -112,7 +112,7 @@ HistoryImpl::GetCurrent(nsString& aCurrent) } NS_IMETHODIMP -HistoryImpl::GetPrevious(nsString& aPrevious) +HistoryImpl::GetPrevious(nsAWritableString& aPrevious) { PRInt32 curIndex; const PRUnichar* prevURL = nsnull; @@ -127,7 +127,7 @@ HistoryImpl::GetPrevious(nsString& aPrevious) } NS_IMETHODIMP -HistoryImpl::GetNext(nsString& aNext) +HistoryImpl::GetNext(nsAWritableString& aNext) { PRInt32 curIndex; const PRUnichar* nextURL = nsnull; @@ -222,7 +222,7 @@ HistoryImpl::Go(JSContext* cx, jsval* argv, PRUint32 argc) NS_IMETHODIMP -HistoryImpl::Item(PRUint32 aIndex, nsString& aReturn) +HistoryImpl::Item(PRUint32 aIndex, nsAWritableString& aReturn) { aReturn.Truncate(); diff --git a/dom/src/base/nsHistory.h b/dom/src/base/nsHistory.h index a60395421099..30126d8b6535 100644 --- a/dom/src/base/nsHistory.h +++ b/dom/src/base/nsHistory.h @@ -44,13 +44,13 @@ public: NS_IMETHOD_(void) SetDocShell(nsIDocShell *aDocShell); NS_IMETHOD GetLength(PRInt32* aLength); - NS_IMETHOD GetCurrent(nsString& aCurrent); - NS_IMETHOD GetPrevious(nsString& aPrevious); - NS_IMETHOD GetNext(nsString& aNext); + NS_IMETHOD GetCurrent(nsAWritableString& aCurrent); + NS_IMETHOD GetPrevious(nsAWritableString& aPrevious); + NS_IMETHOD GetNext(nsAWritableString& aNext); NS_IMETHOD Back(); NS_IMETHOD Forward(); NS_IMETHOD Go(JSContext* cx, jsval* argv, PRUint32 argc); - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn); protected: nsIDocShell* mDocShell; diff --git a/dom/src/base/nsJSEnvironment.cpp b/dom/src/base/nsJSEnvironment.cpp index 5e01e9f3766a..6125ca6a5443 100644 --- a/dom/src/base/nsJSEnvironment.cpp +++ b/dom/src/base/nsJSEnvironment.cpp @@ -324,7 +324,7 @@ nsJSContext::~nsJSContext() NS_IMPL_ISUPPORTS(nsJSContext, NS_GET_IID(nsIScriptContext)); NS_IMETHODIMP -nsJSContext::EvaluateStringWithValue(const nsString& aScript, +nsJSContext::EvaluateStringWithValue(const nsAReadableString& aScript, void *aScopeObject, nsIPrincipal *aPrincipal, const char *aURL, @@ -410,7 +410,7 @@ nsJSContext::EvaluateStringWithValue(const nsString& aScript, ok = ::JS_EvaluateUCScriptForPrincipals(mContext, (JSObject *)aScopeObject, jsprin, - (jschar*)aScript.GetUnicode(), + (jschar*)(const PRUnichar*)nsPromiseFlatString(aScript), aScript.Length(), aURL, aLineNo, @@ -441,13 +441,13 @@ nsJSContext::EvaluateStringWithValue(const nsString& aScript, } NS_IMETHODIMP -nsJSContext::EvaluateString(const nsString& aScript, +nsJSContext::EvaluateString(const nsAReadableString& aScript, void *aScopeObject, nsIPrincipal *aPrincipal, const char *aURL, PRUint32 aLineNo, const char* aVersion, - nsString& aRetValue, + nsAWritableString& aRetValue, PRBool* aIsUndefined) { if (!mScriptsEnabled) { @@ -526,7 +526,7 @@ nsJSContext::EvaluateString(const nsString& aScript, ok = ::JS_EvaluateUCScriptForPrincipals(mContext, (JSObject *)aScopeObject, jsprin, - (jschar*)aScript.GetUnicode(), + (jschar*)(const PRUnichar*)nsPromiseFlatString(aScript), aScript.Length(), aURL, aLineNo, @@ -636,7 +636,7 @@ nsJSContext::CompileScript(const PRUnichar* aText, NS_IMETHODIMP nsJSContext::ExecuteScript(void* aScriptObject, void *aScopeObject, - nsString* aRetValue, + nsAWritableString* aRetValue, PRBool* aIsUndefined) { if (!mScriptsEnabled) { @@ -725,7 +725,8 @@ AtomToEventHandlerName(nsIAtom *aName, char *charName, PRUint32 charNameSize) } NS_IMETHODIMP -nsJSContext::CompileEventHandler(void *aTarget, nsIAtom *aName, const nsString& aBody, +nsJSContext::CompileEventHandler(void *aTarget, nsIAtom *aName, + const nsAReadableString& aBody, PRBool aShared, void** aHandler) { JSPrincipals *jsprin = nsnull; @@ -749,7 +750,7 @@ nsJSContext::CompileEventHandler(void *aTarget, nsIAtom *aName, const nsString& JSFunction* fun = ::JS_CompileUCFunctionForPrincipals(mContext, target, jsprin, charName, 1, gEventArgv, - (jschar*)aBody.GetUnicode(), + (jschar*)(const PRUnichar*)nsPromiseFlatString(aBody), aBody.Length(), //XXXbe filename, lineno: nsnull, 0); @@ -775,7 +776,7 @@ nsJSContext::CompileFunction(void* aTarget, const nsCString& aName, PRUint32 aArgCount, const char** aArgArray, - const nsString& aBody, + const nsAReadableString& aBody, const char* aURL, PRUint32 aLineNo, PRBool aShared, @@ -799,7 +800,7 @@ nsJSContext::CompileFunction(void* aTarget, JSFunction* fun = ::JS_CompileUCFunctionForPrincipals(mContext, target, jsprin, aName, aArgCount, aArgArray, - (jschar*)aBody.GetUnicode(), + (jschar*)(const PRUnichar*)nsPromiseFlatString(aBody), aBody.Length(), aURL, aLineNo); diff --git a/dom/src/base/nsJSEnvironment.h b/dom/src/base/nsJSEnvironment.h index 3ce938acfb76..f867d3480ebd 100644 --- a/dom/src/base/nsJSEnvironment.h +++ b/dom/src/base/nsJSEnvironment.h @@ -58,15 +58,15 @@ public: NS_DECL_ISUPPORTS - NS_IMETHOD EvaluateString(const nsString& aScript, + NS_IMETHOD EvaluateString(const nsAReadableString& aScript, void *aScopeObject, nsIPrincipal *principal, const char *aURL, PRUint32 aLineNo, const char* aVersion, - nsString& aRetValue, + nsAWritableString& aRetValue, PRBool* aIsUndefined); - NS_IMETHOD EvaluateStringWithValue(const nsString& aScript, + NS_IMETHOD EvaluateStringWithValue(const nsAReadableString& aScript, void *aScopeObject, nsIPrincipal *aPrincipal, const char *aURL, @@ -85,11 +85,11 @@ public: void** aScriptObject); NS_IMETHOD ExecuteScript(void* aScriptObject, void *aScopeObject, - nsString* aRetValue, + nsAWritableString* aRetValue, PRBool* aIsUndefined); NS_IMETHOD CompileEventHandler(void *aTarget, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, PRBool aShared, void** aHandler); NS_IMETHOD CallEventHandler(void *aTarget, void *aHandler, @@ -102,7 +102,7 @@ public: const nsCString& aName, PRUint32 aArgCount, const char** aArgArray, - const nsString& aBody, + const nsAReadableString& aBody, const char* aURL, PRUint32 aLineNo, PRBool aShared, diff --git a/dom/src/base/nsJSUtils.cpp b/dom/src/base/nsJSUtils.cpp index 20136e2e2cbb..a4aa27822e3d 100644 --- a/dom/src/base/nsJSUtils.cpp +++ b/dom/src/base/nsJSUtils.cpp @@ -337,7 +337,7 @@ nsJSUtils::nsConvertJSValToXPCObject(nsISupports** aSupports, NS_EXPORT void -nsJSUtils::nsConvertJSValToString(nsString& aString, +nsJSUtils::nsConvertJSValToString(nsAWritableString& aString, JSContext* aContext, jsval aValue) { @@ -432,6 +432,7 @@ nsJSUtils::nsGenericFinalize(JSContext* aContext, NS_RELEASE(owner); } + // The addref was part of JSObject construction NS_RELEASE(nativeThis); } } diff --git a/dom/src/base/nsJSUtils.h b/dom/src/base/nsJSUtils.h index c43ddb46070a..457cb6204e07 100644 --- a/dom/src/base/nsJSUtils.h +++ b/dom/src/base/nsJSUtils.h @@ -74,8 +74,8 @@ public: jsval* aReturn); static NS_EXPORT void nsConvertStringToJSVal(const nsString& aProp, - JSContext* aContext, - jsval* aReturn); + JSContext* aContext, + jsval* aReturn); static NS_EXPORT PRBool nsConvertJSValToObject(nsISupports** aSupports, REFNSIID aIID, @@ -88,9 +88,9 @@ public: JSContext* aContext, jsval aValue); - static NS_EXPORT void nsConvertJSValToString(nsString& aString, - JSContext* aContext, - jsval aValue); + static NS_EXPORT void nsConvertJSValToString(nsAWritableString& aString, + JSContext* aContext, + jsval aValue); static NS_EXPORT PRBool nsConvertJSValToBool(PRBool* aProp, JSContext* aContext, diff --git a/dom/src/base/nsLocation.cpp b/dom/src/base/nsLocation.cpp index e298329f357f..81b8735a3e68 100644 --- a/dom/src/base/nsLocation.cpp +++ b/dom/src/base/nsLocation.cpp @@ -33,6 +33,7 @@ #include "nsIServiceManager.h" #include "nsNetUtil.h" #include "plstr.h" +#include "prprf.h" #include "prmem.h" #include "nsCOMPtr.h" #include "nsJSUtils.h" @@ -172,7 +173,7 @@ LocationImpl::SetURL(nsIURI* aURL) } NS_IMETHODIMP -LocationImpl::GetHash(nsString& aHash) +LocationImpl::GetHash(nsAWritableString& aHash) { nsAutoString href; nsIURI *uri; @@ -191,8 +192,8 @@ LocationImpl::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.AssignWithConversion("#"); - aHash.AppendWithConversion(ref); + aHash.Assign(NS_LITERAL_STRING("#")); + aHash.Append(NS_ConvertASCIItoUCS2(ref)); nsCRT::free(ref); } else { @@ -206,7 +207,7 @@ LocationImpl::GetHash(nsString& aHash) } NS_IMETHODIMP -LocationImpl::SetHash(const nsString& aHash) +LocationImpl::SetHash(const nsAReadableString& aHash) { nsAutoString href; nsIURI *uri; @@ -220,10 +221,8 @@ LocationImpl::SetHash(const nsString& aHash) result = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url); NS_RELEASE(uri); if (NS_OK == result) { - char *buf = aHash.ToNewCString(); - url->SetRef(buf); + url->SetRef(NS_ConvertUCS2toUTF8(aHash)); SetURL(url); - nsCRT::free(buf); NS_RELEASE(url); } } @@ -232,7 +231,7 @@ LocationImpl::SetHash(const nsString& aHash) } NS_IMETHODIMP -LocationImpl::GetHost(nsString& aHost) +LocationImpl::GetHost(nsAWritableString& aHost) { nsAutoString href; nsIURI *url; @@ -245,13 +244,17 @@ LocationImpl::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.AssignWithConversion(host); + CopyASCIItoUCS2(nsLiteralCString(host), aHost); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.AppendWithConversion(":"); - aHost.AppendInt(port, 10); + aHost.Append(NS_LITERAL_STRING(":")); + + nsAutoString tmpHost; + tmpHost.AppendInt(port); + + aHost.Append(tmpHost); } } NS_RELEASE(url); @@ -262,7 +265,7 @@ LocationImpl::GetHost(nsString& aHost) } NS_IMETHODIMP -LocationImpl::SetHost(const nsString& aHost) +LocationImpl::SetHost(const nsAReadableString& aHost) { nsAutoString href; nsIURI *url; @@ -272,10 +275,8 @@ LocationImpl::SetHost(const nsString& aHost) if (NS_OK == result) { result = NS_NewURI(&url, href); if (NS_OK == result) { - char *buf = aHost.ToNewCString(); - url->SetHost(buf); + url->SetHost(NS_ConvertUCS2toUTF8(aHost)); SetURL(url); - nsCRT::free(buf); NS_RELEASE(url); } } @@ -284,7 +285,7 @@ LocationImpl::SetHost(const nsString& aHost) } NS_IMETHODIMP -LocationImpl::GetHostname(nsString& aHostname) +LocationImpl::GetHostname(nsAWritableString& aHostname) { nsAutoString href; nsIURI *url; @@ -297,7 +298,7 @@ LocationImpl::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.AssignWithConversion(host); + CopyASCIItoUCS2(nsLiteralCString(host), aHostname); nsCRT::free(host); } NS_RELEASE(url); @@ -308,7 +309,7 @@ LocationImpl::GetHostname(nsString& aHostname) } NS_IMETHODIMP -LocationImpl::SetHostname(const nsString& aHostname) +LocationImpl::SetHostname(const nsAReadableString& aHostname) { nsAutoString href; nsIURI *url; @@ -318,10 +319,8 @@ LocationImpl::SetHostname(const nsString& aHostname) if (NS_OK == result) { result = NS_NewURI(&url, href); if (NS_OK == result) { - char *buf = aHostname.ToNewCString(); - url->SetHost(buf); + url->SetHost(NS_ConvertUCS2toUTF8(aHostname)); SetURL(url); - nsCRT::free(buf); NS_RELEASE(url); } } @@ -330,7 +329,7 @@ LocationImpl::SetHostname(const nsString& aHostname) } NS_IMETHODIMP -LocationImpl::GetHref(nsString& aHref) +LocationImpl::GetHref(nsAWritableString& aHref) { nsresult result = NS_OK; @@ -338,10 +337,10 @@ LocationImpl::GetHref(nsString& aHref) nsCOMPtr uri; result = mDocShell->GetCurrentURI(getter_AddRefs(uri)); if (NS_SUCCEEDED(result) && uri) { - nsXPIDLCString uriString; - result = uri->GetSpec(getter_Copies(uriString)); - if (NS_SUCCEEDED(result)) - aHref.AssignWithConversion(uriString); + nsXPIDLCString uriString; + result = uri->GetSpec(getter_Copies(uriString)); + if (NS_SUCCEEDED(result)) + CopyASCIItoUCS2(nsLiteralCString(uriString), aHref); } } @@ -349,7 +348,7 @@ LocationImpl::GetHref(nsString& aHref) } NS_IMETHODIMP -LocationImpl::SetHref(const nsString& aHref) +LocationImpl::SetHref(const nsAReadableString& aHref) { nsAutoString oldHref; nsIURI *oldUrl; @@ -368,7 +367,7 @@ LocationImpl::SetHref(const nsString& aHref) } nsresult -LocationImpl::SetHrefWithBase(const nsString& aHref, +LocationImpl::SetHrefWithBase(const nsAReadableString& aHref, nsIURI* aBase, PRBool aReplace) { @@ -393,7 +392,7 @@ LocationImpl::SetHrefWithBase(const nsString& aHref, } NS_IMETHODIMP -LocationImpl::GetPathname(nsString& aPathname) +LocationImpl::GetPathname(nsAWritableString& aPathname) { nsAutoString href; nsIURI *uri; @@ -408,7 +407,7 @@ LocationImpl::GetPathname(nsString& aPathname) char* file; result = url->GetFilePath(&file); if (result == NS_OK) { - aPathname.AssignWithConversion(file); + CopyASCIItoUCS2(nsLiteralCString(file), aPathname); nsCRT::free(file); } } @@ -420,7 +419,7 @@ LocationImpl::GetPathname(nsString& aPathname) } NS_IMETHODIMP -LocationImpl::SetPathname(const nsString& aPathname) +LocationImpl::SetPathname(const nsAReadableString& aPathname) { nsAutoString href; nsIURI *url; @@ -430,10 +429,8 @@ LocationImpl::SetPathname(const nsString& aPathname) if (NS_OK == result) { result = NS_NewURI(&url, href); if (NS_OK == result) { - char *buf = aPathname.ToNewCString(); - url->SetPath(buf); + url->SetPath(NS_ConvertUCS2toUTF8(aPathname)); SetURL(url); - nsCRT::free(buf); NS_RELEASE(url); } } @@ -442,7 +439,7 @@ LocationImpl::SetPathname(const nsString& aPathname) } NS_IMETHODIMP -LocationImpl::GetPort(nsString& aPort) +LocationImpl::GetPort(nsAWritableString& aPort) { nsAutoString href; nsIURI *url; @@ -456,7 +453,9 @@ LocationImpl::GetPort(nsString& aPort) PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.AppendInt(port, 10); + nsAutoString portStr; + portStr.AppendInt(port); + aPort.Append(portStr); } NS_RELEASE(url); } @@ -466,7 +465,7 @@ LocationImpl::GetPort(nsString& aPort) } NS_IMETHODIMP -LocationImpl::SetPort(const nsString& aPort) +LocationImpl::SetPort(const nsAReadableString& aPort) { nsAutoString href; nsIURI *url; @@ -476,7 +475,7 @@ LocationImpl::SetPort(const nsString& aPort) if (NS_OK == result) { result = NS_NewURI(&url, href); if (NS_OK == result) { - char *buf = aPort.ToNewCString(); + const char *buf = NS_ConvertUCS2toUTF8(aPort).GetBuffer(); PRInt32 port = -1; if (buf) { @@ -489,7 +488,6 @@ LocationImpl::SetPort(const nsString& aPort) } url->SetPort(port); SetURL(url); - nsCRT::free(buf); NS_RELEASE(url); } } @@ -498,7 +496,7 @@ LocationImpl::SetPort(const nsString& aPort) } NS_IMETHODIMP -LocationImpl::GetProtocol(nsString& aProtocol) +LocationImpl::GetProtocol(nsAWritableString& aProtocol) { nsAutoString href; nsIURI *url; @@ -511,8 +509,8 @@ LocationImpl::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.AssignWithConversion(protocol); - aProtocol.AppendWithConversion(":"); + aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol)); + aProtocol.Append(NS_LITERAL_STRING(":")); nsCRT::free(protocol); } NS_RELEASE(url); @@ -523,7 +521,7 @@ LocationImpl::GetProtocol(nsString& aProtocol) } NS_IMETHODIMP -LocationImpl::SetProtocol(const nsString& aProtocol) +LocationImpl::SetProtocol(const nsAReadableString& aProtocol) { nsAutoString href; nsIURI *url; @@ -533,10 +531,8 @@ LocationImpl::SetProtocol(const nsString& aProtocol) if (NS_OK == result) { result = NS_NewURI(&url, href); if (NS_OK == result) { - char *buf = aProtocol.ToNewCString(); - url->SetScheme(buf); + url->SetScheme(NS_ConvertUCS2toUTF8(aProtocol)); SetURL(url); - nsCRT::free(buf); NS_RELEASE(url); } } @@ -545,7 +541,7 @@ LocationImpl::SetProtocol(const nsString& aProtocol) } NS_IMETHODIMP -LocationImpl::GetSearch(nsString& aSearch) +LocationImpl::GetSearch(nsAWritableString& aSearch) { nsAutoString href; nsIURI *uri; @@ -563,8 +559,8 @@ LocationImpl::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.AssignWithConversion("?"); - aSearch.AppendWithConversion(search); + aSearch.Assign(NS_LITERAL_STRING("?")); + aSearch.Append(NS_ConvertASCIItoUCS2(search)); nsCRT::free(search); } else { @@ -578,7 +574,7 @@ LocationImpl::GetSearch(nsString& aSearch) } NS_IMETHODIMP -LocationImpl::SetSearch(const nsString& aSearch) +LocationImpl::SetSearch(const nsAReadableString& aSearch) { nsAutoString href; nsIURI *uri; @@ -588,15 +584,13 @@ LocationImpl::SetSearch(const nsString& aSearch) if (NS_OK == result) { result = NS_NewURI(&uri, href); if (NS_OK == result) { - char *buf = aSearch.ToNewCString(); nsIURL* url; result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url); if (NS_SUCCEEDED(result)) { - result = url->SetQuery(buf); + result = url->SetQuery(NS_ConvertUCS2toUTF8(aSearch)); NS_RELEASE(url); } SetURL(uri); - nsCRT::free(buf); NS_RELEASE(uri); } } @@ -617,7 +611,7 @@ LocationImpl::Reload(PRBool aForceget) } NS_IMETHODIMP -LocationImpl::Replace(const nsString& aUrl) +LocationImpl::Replace(const nsAReadableString& aUrl) { nsAutoString oldHref; nsIURI *oldUrl; @@ -674,7 +668,7 @@ LocationImpl::Replace(JSContext *cx, jsval *argv, PRUint32 argc) } NS_IMETHODIMP -LocationImpl::ToString(nsString& aReturn) +LocationImpl::ToString(nsAWritableString& aReturn) { return GetHref(aReturn); } diff --git a/dom/src/base/nsMimeTypeArray.cpp b/dom/src/base/nsMimeTypeArray.cpp index 8c13906d911f..8e3c474e80fd 100644 --- a/dom/src/base/nsMimeTypeArray.cpp +++ b/dom/src/base/nsMimeTypeArray.cpp @@ -120,7 +120,7 @@ NS_IMETHODIMP MimeTypeArrayImpl::Item(PRUint32 aIndex, nsIDOMMimeType** aReturn) return NS_ERROR_FAILURE; } -NS_IMETHODIMP MimeTypeArrayImpl::NamedItem(const nsString& aName, +NS_IMETHODIMP MimeTypeArrayImpl::NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -257,7 +257,7 @@ NS_IMETHODIMP MimeTypeElementImpl::GetScriptObject(nsIScriptContext *aContext, v return res; } -NS_IMETHODIMP MimeTypeElementImpl::GetDescription(nsString& aDescription) +NS_IMETHODIMP MimeTypeElementImpl::GetDescription(nsAWritableString& aDescription) { return mMimeType->GetDescription(aDescription); } @@ -269,12 +269,12 @@ NS_IMETHODIMP MimeTypeElementImpl::GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugi return NS_OK; } -NS_IMETHODIMP MimeTypeElementImpl::GetSuffixes(nsString& aSuffixes) +NS_IMETHODIMP MimeTypeElementImpl::GetSuffixes(nsAWritableString& aSuffixes) { return mMimeType->GetSuffixes(aSuffixes); } -NS_IMETHODIMP MimeTypeElementImpl::GetType(nsString& aType) +NS_IMETHODIMP MimeTypeElementImpl::GetType(nsAWritableString& aType) { return mMimeType->GetType(aType); } diff --git a/dom/src/base/nsMimeTypeArray.h b/dom/src/base/nsMimeTypeArray.h index 9cd53fe8be3a..ed38272758b0 100644 --- a/dom/src/base/nsMimeTypeArray.h +++ b/dom/src/base/nsMimeTypeArray.h @@ -41,7 +41,7 @@ public: NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn); private: nsresult GetMimeTypes(); @@ -63,10 +63,10 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void* aScriptObject); - NS_IMETHOD GetDescription(nsString& aDescription); + NS_IMETHOD GetDescription(nsAWritableString& aDescription); NS_IMETHOD GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugin); - NS_IMETHOD GetSuffixes(nsString& aSuffixes); - NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD GetSuffixes(nsAWritableString& aSuffixes); + NS_IMETHOD GetType(nsAWritableString& aType); protected: void *mScriptObject; diff --git a/dom/src/base/nsPluginArray.cpp b/dom/src/base/nsPluginArray.cpp index be27c5e782ab..9654bc0ea60c 100644 --- a/dom/src/base/nsPluginArray.cpp +++ b/dom/src/base/nsPluginArray.cpp @@ -129,7 +129,7 @@ NS_IMETHODIMP PluginArrayImpl::Item(PRUint32 aIndex, nsIDOMPlugin** aReturn) return NS_OK; } -NS_IMETHODIMP PluginArrayImpl::NamedItem(const nsString& aName, nsIDOMPlugin** aReturn) +NS_IMETHODIMP PluginArrayImpl::NamedItem(const nsAReadableString& aName, nsIDOMPlugin** aReturn) { NS_PRECONDITION(nsnull != aReturn, "null arg"); @@ -142,10 +142,10 @@ NS_IMETHODIMP PluginArrayImpl::NamedItem(const nsString& aName, nsIDOMPlugin** a *aReturn = nsnull; for (PRUint32 i = 0; i < mPluginCount; i++) { - nsString pluginName; + nsAutoString pluginName; nsIDOMPlugin* plugin = mPluginArray[i]; if (plugin->GetName(pluginName) == NS_OK) { - if (pluginName == aName) { + if (pluginName.Equals(aName)) { *aReturn = plugin; NS_IF_ADDREF(plugin); break; @@ -253,17 +253,17 @@ NS_IMETHODIMP PluginElementImpl::GetScriptObject(nsIScriptContext *aContext, voi return res; } -NS_IMETHODIMP PluginElementImpl::GetDescription(nsString& aDescription) +NS_IMETHODIMP PluginElementImpl::GetDescription(nsAWritableString& aDescription) { return mPlugin->GetDescription(aDescription); } -NS_IMETHODIMP PluginElementImpl::GetFilename(nsString& aFilename) +NS_IMETHODIMP PluginElementImpl::GetFilename(nsAWritableString& aFilename) { return mPlugin->GetFilename(aFilename); } -NS_IMETHODIMP PluginElementImpl::GetName(nsString& aName) +NS_IMETHODIMP PluginElementImpl::GetName(nsAWritableString& aName) { return mPlugin->GetName(aName); } @@ -289,7 +289,7 @@ NS_IMETHODIMP PluginElementImpl::Item(PRUint32 aIndex, nsIDOMMimeType** aReturn) return NS_ERROR_FAILURE; } -NS_IMETHODIMP PluginElementImpl::NamedItem(const nsString& aName, nsIDOMMimeType** aReturn) +NS_IMETHODIMP PluginElementImpl::NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn) { if (mMimeTypeArray == nsnull) { nsresult rv = GetMimeTypes(); @@ -299,10 +299,10 @@ NS_IMETHODIMP PluginElementImpl::NamedItem(const nsString& aName, nsIDOMMimeType *aReturn = nsnull; for (PRUint32 i = 0; i < mMimeTypeCount; i++) { - nsString type; + nsAutoString type; nsIDOMMimeType* mimeType = mMimeTypeArray[i]; if (mimeType->GetType(type) == NS_OK) { - if (type == aName) { + if (type.Equals(aName)) { *aReturn = mimeType; NS_ADDREF(mimeType); break; diff --git a/dom/src/base/nsPluginArray.h b/dom/src/base/nsPluginArray.h index 8aca9ce26d2e..4ffa2cb8fd58 100644 --- a/dom/src/base/nsPluginArray.h +++ b/dom/src/base/nsPluginArray.h @@ -28,7 +28,7 @@ #include "nsIDOMPlugin.h" class nsIDOMNavigator; -class nsIPluginHost; +struct nsIPluginHost; class PluginArrayImpl : public nsIScriptObjectOwner, public nsIDOMPluginArray { public: @@ -42,7 +42,7 @@ public: NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMPlugin** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMPlugin** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMPlugin** aReturn); NS_IMETHOD Refresh(PRBool aReloadDocuments); private: @@ -66,12 +66,12 @@ public: NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); NS_IMETHOD SetScriptObject(void* aScriptObject); - NS_IMETHOD GetDescription(nsString& aDescription); - NS_IMETHOD GetFilename(nsString& aFilename); - NS_IMETHOD GetName(nsString& aName); + NS_IMETHOD GetDescription(nsAWritableString& aDescription); + NS_IMETHOD GetFilename(nsAWritableString& aFilename); + NS_IMETHOD GetName(nsAWritableString& aName); NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn); private: nsresult GetMimeTypes(); diff --git a/dom/src/events/nsJSKeyEvent.cpp b/dom/src/events/nsJSKeyEvent.cpp index 8e5a5e717dd5..b4341814a01e 100644 --- a/dom/src/events/nsJSKeyEvent.cpp +++ b/dom/src/events/nsJSKeyEvent.cpp @@ -954,6 +954,9 @@ extern "C" NS_DOM nsresult NS_InitKeyEventClass(nsIScriptContext *aContext, void vp = INT_TO_JSVAL(nsIDOMKeyEvent::DOM_VK_QUOTE); JS_SetProperty(jscontext, constructor, "DOM_VK_QUOTE", &vp); + vp = INT_TO_JSVAL(nsIDOMKeyEvent::DOM_VK_META); + JS_SetProperty(jscontext, constructor, "DOM_VK_META", &vp); + } } diff --git a/dom/tools/FileGen.cpp b/dom/tools/FileGen.cpp index a6b546e8eb60..ff8050ca0842 100644 --- a/dom/tools/FileGen.cpp +++ b/dom/tools/FileGen.cpp @@ -269,7 +269,7 @@ FileGen::GetVariableTypeForParameter(char *aBuffer, IdlVariable &aVariable) strcpy(aBuffer, "float"); break; case TYPE_STRING: - strcpy(aBuffer, "nsString&"); + strcpy(aBuffer, "nsAReadableString&"); break; case TYPE_OBJECT: sprintf(aBuffer, kObjTypeStr, aVariable.GetTypeName()); @@ -289,6 +289,17 @@ FileGen::GetVariableTypeForParameter(char *aBuffer, IdlVariable &aVariable) } } +void +FileGen::GetVariableTypeForReturnValue(char *aBuffer, IdlVariable &aVariable) +{ + if (TYPE_STRING == aVariable.GetType()) { + strcpy(aBuffer, "nsAWritableString&"); + } + else { + GetVariableTypeForParameter(aBuffer, aVariable); + } +} + void FileGen::GetParameterType(char *aBuffer, IdlParameter &aParameter) { diff --git a/dom/tools/FileGen.h b/dom/tools/FileGen.h index 97ac9dd7a12a..045ae901818b 100644 --- a/dom/tools/FileGen.h +++ b/dom/tools/FileGen.h @@ -56,6 +56,7 @@ protected: void GetVariableTypeForParameter(char *aBuffer, IdlVariable &aVariable); void GetVariableTypeForLocal(char *aBuffer, IdlVariable &aVariable); void GetVariableTypeForMethodLocal(char *aBuffer, IdlVariable &aVariable); + void GetVariableTypeForReturnValue(char *aBuffer, IdlVariable &aVariable); void GetParameterType(char *aBuffer, IdlParameter &aParameter); void GetInterfaceIID(char *aBuffer, IdlInterface &aInterface); diff --git a/dom/tools/XPCOMGen.cpp b/dom/tools/XPCOMGen.cpp index 17906fa965ae..d6be94ad50e9 100644 --- a/dom/tools/XPCOMGen.cpp +++ b/dom/tools/XPCOMGen.cpp @@ -319,13 +319,14 @@ XPCOMGen::GenerateMethods(IdlInterface &aInterface) for (a = 0; a < acount; a++) { IdlAttribute *attr = aInterface.GetAttributeAt(a); - GetVariableTypeForParameter(type_buf, *attr); + GetVariableTypeForReturnValue(type_buf, *attr); GetCapitalizedName(name_buf, *attr); sprintf(buf, kGetterMethodDeclStr, name_buf, type_buf, attr->GetType() == TYPE_STRING ? "" : "*", name_buf); *file << buf; if (!attr->GetReadOnly()) { + GetVariableTypeForParameter(type_buf, *attr); sprintf(buf, kSetterMethodDeclStr, name_buf, attr->GetType() == TYPE_STRING ? "const " : "", type_buf, name_buf); @@ -371,7 +372,7 @@ XPCOMGen::GenerateMethods(IdlInterface &aInterface) strcpy(cur_param, kDelimiterStr); cur_param += strlen(kDelimiterStr); } - GetVariableTypeForParameter(type_buf, *rval); + GetVariableTypeForReturnValue(type_buf, *rval); sprintf(cur_param, kReturnStr, type_buf, rval->GetType() == TYPE_STRING ? "" : "*"); } @@ -403,13 +404,14 @@ XPCOMGen::GenerateDeclMacro(IdlInterface &aInterface) for (a = 0; a < acount; a++) { IdlAttribute *attr = aInterface.GetAttributeAt(a); - GetVariableTypeForParameter(type_buf, *attr); + GetVariableTypeForReturnValue(type_buf, *attr); GetCapitalizedName(name_buf, *attr); sprintf(buf, kGetterMethodDeclNonVirtualStr, name_buf, type_buf, attr->GetType() == TYPE_STRING ? "" : "*", name_buf); *file << buf; if (!attr->GetReadOnly()) { + GetVariableTypeForParameter(type_buf, *attr); sprintf(buf, kSetterMethodDeclNonVirtualStr, name_buf, attr->GetType() == TYPE_STRING ? "const " : "", type_buf, name_buf); @@ -458,7 +460,7 @@ XPCOMGen::GenerateDeclMacro(IdlInterface &aInterface) strcpy(cur_param, kDelimiterStr); cur_param += strlen(kDelimiterStr); } - GetVariableTypeForParameter(type_buf, *rval); + GetVariableTypeForReturnValue(type_buf, *rval); sprintf(cur_param, kReturnStr, type_buf, rval->GetType() == TYPE_STRING ? "" : "*"); } @@ -491,7 +493,7 @@ XPCOMGen::GenerateForwardMacro(IdlInterface &aInterface) for (a = 0; a < acount; a++) { IdlAttribute *attr = aInterface.GetAttributeAt(a); - GetVariableTypeForParameter(type_buf, *attr); + GetVariableTypeForReturnValue(type_buf, *attr); GetCapitalizedName(name_buf, *attr); sprintf(buf, kGetterMethodForwardStr, name_buf, type_buf, attr->GetType() == TYPE_STRING ? "" : "*", name_buf, @@ -499,6 +501,7 @@ XPCOMGen::GenerateForwardMacro(IdlInterface &aInterface) *file << buf; if (!attr->GetReadOnly()) { + GetVariableTypeForParameter(type_buf, *attr); sprintf(buf, kSetterMethodForwardStr, name_buf, attr->GetType() == TYPE_STRING ? "const " : "", type_buf, name_buf, name_buf, name_buf); @@ -559,7 +562,7 @@ XPCOMGen::GenerateForwardMacro(IdlInterface &aInterface) strcpy(cur_param2, kDelimiterStr); cur_param2 += strlen(kDelimiterStr); } - GetVariableTypeForParameter(type_buf, *rval); + GetVariableTypeForReturnValue(type_buf, *rval); sprintf(cur_param, kReturnStr, type_buf, rval->GetType() == TYPE_STRING ? "" : "*"); strcpy(cur_param2, kReturnCallStr); diff --git a/editor/base/nsEditor.cpp b/editor/base/nsEditor.cpp index d85d546a998f..7d514870f1ff 100644 --- a/editor/base/nsEditor.cpp +++ b/editor/base/nsEditor.cpp @@ -2192,8 +2192,8 @@ nsEditor::RemoveDocumentStateListener(nsIDocumentStateListener *aListener) #pragma mark - #endif -NS_IMETHODIMP nsEditor::OutputToString(nsString& aOutputString, - const nsString& aFormatType, +NS_IMETHODIMP nsEditor::OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags) { // these should be implemented by derived classes. diff --git a/editor/base/nsEditor.h b/editor/base/nsEditor.h index 45c54565e67a..8b24c5100435 100644 --- a/editor/base/nsEditor.h +++ b/editor/base/nsEditor.h @@ -272,8 +272,8 @@ public: /* output */ - NS_IMETHOD OutputToString(nsString& aOutputString, - const nsString& aFormatType, + NS_IMETHOD OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags); NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream, diff --git a/editor/base/nsHTMLEditor.cpp b/editor/base/nsHTMLEditor.cpp index 7b150d2fd836..3b22bc21e45e 100644 --- a/editor/base/nsHTMLEditor.cpp +++ b/editor/base/nsHTMLEditor.cpp @@ -5432,20 +5432,22 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsString& aQuotedText, return res; } -NS_IMETHODIMP nsHTMLEditor::OutputToString(nsString& aOutputString, - const nsString& aFormatType, +NS_IMETHODIMP nsHTMLEditor::OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags) { PRBool cancel, handled; nsString resultString; nsTextRulesInfo ruleInfo(nsTextEditRules::kOutputText); ruleInfo.outString = &resultString; - ruleInfo.outputFormat = &aFormatType; + // XXX Struct should store a nsAReadable* + nsAutoString str(aFormatType); + ruleInfo.outputFormat = &str; nsresult rv = mRules->WillDoAction(nsnull, &ruleInfo, &cancel, &handled); if (cancel || NS_FAILED(rv)) { return rv; } if (handled) { // this case will get triggered by password fields - aOutputString = *(ruleInfo.outString); + aOutputString.Assign(*(ruleInfo.outString)); } else { diff --git a/editor/base/nsHTMLEditor.h b/editor/base/nsHTMLEditor.h index 2e1279929b53..a08a1084b04d 100644 --- a/editor/base/nsHTMLEditor.h +++ b/editor/base/nsHTMLEditor.h @@ -272,8 +272,8 @@ public: NS_IMETHOD DoDrag(nsIDOMEvent *aDragEvent); NS_IMETHOD InsertFromDrop(nsIDOMEvent* aDropEvent); - NS_IMETHOD OutputToString(nsString& aOutputString, - const nsString& aFormatType, + NS_IMETHOD OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags); NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream, diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index d85d546a998f..7d514870f1ff 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -2192,8 +2192,8 @@ nsEditor::RemoveDocumentStateListener(nsIDocumentStateListener *aListener) #pragma mark - #endif -NS_IMETHODIMP nsEditor::OutputToString(nsString& aOutputString, - const nsString& aFormatType, +NS_IMETHODIMP nsEditor::OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags) { // these should be implemented by derived classes. diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index 45c54565e67a..8b24c5100435 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -272,8 +272,8 @@ public: /* output */ - NS_IMETHOD OutputToString(nsString& aOutputString, - const nsString& aFormatType, + NS_IMETHOD OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags); NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream, diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 7b150d2fd836..3b22bc21e45e 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -5432,20 +5432,22 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsString& aQuotedText, return res; } -NS_IMETHODIMP nsHTMLEditor::OutputToString(nsString& aOutputString, - const nsString& aFormatType, +NS_IMETHODIMP nsHTMLEditor::OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags) { PRBool cancel, handled; nsString resultString; nsTextRulesInfo ruleInfo(nsTextEditRules::kOutputText); ruleInfo.outString = &resultString; - ruleInfo.outputFormat = &aFormatType; + // XXX Struct should store a nsAReadable* + nsAutoString str(aFormatType); + ruleInfo.outputFormat = &str; nsresult rv = mRules->WillDoAction(nsnull, &ruleInfo, &cancel, &handled); if (cancel || NS_FAILED(rv)) { return rv; } if (handled) { // this case will get triggered by password fields - aOutputString = *(ruleInfo.outString); + aOutputString.Assign(*(ruleInfo.outString)); } else { diff --git a/editor/libeditor/html/nsHTMLEditor.h b/editor/libeditor/html/nsHTMLEditor.h index 2e1279929b53..a08a1084b04d 100644 --- a/editor/libeditor/html/nsHTMLEditor.h +++ b/editor/libeditor/html/nsHTMLEditor.h @@ -272,8 +272,8 @@ public: NS_IMETHOD DoDrag(nsIDOMEvent *aDragEvent); NS_IMETHOD InsertFromDrop(nsIDOMEvent* aDropEvent); - NS_IMETHOD OutputToString(nsString& aOutputString, - const nsString& aFormatType, + NS_IMETHOD OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags); NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream, diff --git a/editor/public/nsIEditor.h b/editor/public/nsIEditor.h index 4b1d0b5eca71..7f0ae91cd836 100644 --- a/editor/public/nsIEditor.h +++ b/editor/public/nsIEditor.h @@ -25,6 +25,7 @@ #include "nsISupports.h" #include "nscore.h" #include "nsIDiskDocument.h" +#include "nsString.h" #define NS_IEDITOR_IID \ {/* A3C5EE71-742E-11d2-8F2C-006008310194*/ \ @@ -32,8 +33,6 @@ {0x8f, 0x2c, 0x0, 0x60, 0x8, 0x31, 0x1, 0x94} } -class nsString; - class nsIPresShell; class nsIDOMNode; class nsIDOMElement; @@ -418,8 +417,8 @@ public: * Output methods: * aFormatType is a mime type, like text/plain. */ - NS_IMETHOD OutputToString(nsString& aOutputString, - const nsString& aFormatType, + NS_IMETHOD OutputToString(nsAWritableString& aOutputString, + const nsAReadableString& aFormatType, PRUint32 aFlags) = 0; NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream, const nsString& aFormatType, diff --git a/extensions/psm-glue/src/nsCrypto.cpp b/extensions/psm-glue/src/nsCrypto.cpp index dd56949603ff..c652739ce4f7 100644 --- a/extensions/psm-glue/src/nsCrypto.cpp +++ b/extensions/psm-glue/src/nsCrypto.cpp @@ -43,6 +43,7 @@ #include "cmtcmn.h" #include "cmtjs.h" #include +#include "nsReadableUtils.h" /* * These are the most common error strings that are returned @@ -272,7 +273,7 @@ cryptojs_interpret_key_gen_type(char *keyAlg) NS_IMETHODIMP -nsCrypto::GetVersion(nsString& aVersion) +nsCrypto::GetVersion(nsAWritableString& aVersion) { if (!mVersionStringSet) { PCMT_CONTROL control = NULL; @@ -293,7 +294,7 @@ nsCrypto::GetVersion(nsString& aVersion) mVersionStringSet = PR_TRUE; } - aVersion = mVersionString; + aVersion.Assign(mVersionString); return NS_OK; } //These defines are taken from the PKCS#11 spec @@ -1063,10 +1064,10 @@ nsCrypto::GenerateCRMFRequest(JSContext* cx, jsval* argv, PRUint32 argc, } NS_IMETHODIMP -nsCrypto::ImportUserCertificates(const nsString& aNickname, - const nsString& aCmmfResponse, +nsCrypto::ImportUserCertificates(const nsAReadableString& aNickname, + const nsAReadableString& aCmmfResponse, PRBool aDoForcedBackup, - nsString& aReturn) + nsAWritableString& aReturn) { char *nickname=nsnull, *cmmfResponse=nsnull; nsresult nrv; @@ -1075,8 +1076,8 @@ nsCrypto::ImportUserCertificates(const nsString& aNickname, char *retString=nsnull; char *freeString=nsnull; - nickname = aNickname.ToNewCString(); - cmmfResponse = aCmmfResponse.ToNewCString(); + nickname = ToNewCString(aNickname); + cmmfResponse = ToNewCString(aCmmfResponse); if (PL_strcmp("null", nickname) == 0) { nsCRT::free(nickname); nickname = nsnull; @@ -1097,7 +1098,7 @@ nsCrypto::ImportUserCertificates(const nsString& aNickname, } retString = ""; loser: - aReturn.AssignWithConversion(retString); + aReturn.Assign(NS_ConvertASCIItoUCS2(retString)); if (freeString != NULL) { PR_smprintf_free(freeString); } @@ -1111,21 +1112,21 @@ nsCrypto::ImportUserCertificates(const nsString& aNickname, } NS_IMETHODIMP -nsCrypto::PopChallengeResponse(const nsString& aChallenge, - nsString& aReturn) +nsCrypto::PopChallengeResponse(const nsAReadableString& aChallenge, + nsAWritableString& aReturn) { return NS_ERROR_FAILURE; } NS_IMETHODIMP -nsCrypto::Random(PRInt32 aNumBytes, nsString& aReturn) +nsCrypto::Random(PRInt32 aNumBytes, nsAWritableString& aReturn) { return NS_ERROR_FAILURE; } NS_IMETHODIMP nsCrypto::SignText(JSContext *cx, jsval *argv, PRUint32 argc, - nsString& aReturn) + nsAWritableString& aReturn) { return NS_ERROR_FAILURE; } @@ -1156,11 +1157,11 @@ alertUser(char *message) NS_IMETHODIMP -nsCrypto::Alert(const nsString& aMessage) +nsCrypto::Alert(const nsAReadableString& aMessage) { char *message; - message = aMessage.ToNewCString(); + message = ToNewCString(aMessage); if (message == nsnull) { return NS_ERROR_FAILURE; } @@ -1235,9 +1236,9 @@ nsCRMFObject::init() } NS_IMETHODIMP -nsCRMFObject::GetRequest(nsString& aRequest) +nsCRMFObject::GetRequest(nsAWritableString& aRequest) { - aRequest = mBase64Request; + aRequest.Assign(mBase64Request); return NS_OK; } @@ -1447,7 +1448,7 @@ confirm_user(char *message) NS_IMETHODIMP -nsPkcs11::Deletemodule(const nsString& aModuleName, PRInt32* aReturn) +nsPkcs11::Deletemodule(const nsAReadableString& aModuleName, PRInt32* aReturn) { PCMT_CONTROL control; char *errorString = nsnull, *warning = nsnull, *wholeMsg = nsnull; @@ -1468,7 +1469,7 @@ nsPkcs11::Deletemodule(const nsString& aModuleName, PRInt32* aReturn) *aReturn = JS_ERR_BAD_MODULE_NAME; goto loser; } - moduleName = aModuleName.ToNewCString(); + moduleName = ToNewCString(aModuleName); status = CMT_GetLocalizedString(control, SSM_STRING_DEL_MOD_WARN, &warning); if (status != CMTSuccess) { @@ -1548,8 +1549,8 @@ nsPkcs11::Deletemodule(const nsString& aModuleName, PRInt32* aReturn) } NS_IMETHODIMP -nsPkcs11::Addmodule(const nsString& aModuleName, - const nsString& aLibraryFullPath, +nsPkcs11::Addmodule(const nsAReadableString& aModuleName, + const nsAReadableString& aLibraryFullPath, PRInt32 aCryptoMechanismFlags, PRInt32 aCipherFlags, PRInt32* aReturn) { @@ -1588,8 +1589,8 @@ nsPkcs11::Addmodule(const nsString& aModuleName, goto loser; } - moduleName = aModuleName.ToNewCString(); - libraryPath = aLibraryFullPath.ToNewCString(); + moduleName = ToNewCString(aModuleName); + libraryPath = ToNewCString(aLibraryFullPath); length = strlen(warning) + strlen(modPrompt) + strlen(moduleName) + strlen(dllPrompt) + strlen(libraryPath) + 5; diff --git a/htmlparser/src/nsHTMLContentSinkStream.cpp b/htmlparser/src/nsHTMLContentSinkStream.cpp index 1a963fdf7a8a..95f057fcd267 100644 --- a/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -128,8 +128,8 @@ nsHTMLContentSinkStream::nsHTMLContentSinkStream() NS_IMETHODIMP nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, - const nsString* aCharsetOverride, + nsAWritableString* aOutString, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags) { mDoFormat = (aFlags & nsIDocumentEncoder::OutputFormatted) ? PR_TRUE @@ -157,7 +157,7 @@ nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream, mStream = aOutStream; mString = aOutString; if (aCharsetOverride != nsnull) - mCharsetOverride.AssignWithConversion(aCharsetOverride->GetUnicode()); + mCharsetOverride.Assign(*aCharsetOverride); mPreLevel = 0; @@ -227,10 +227,10 @@ nsHTMLContentSinkStream::InitEncoders() // Initialize a charset encoder if we're using the stream interface if (mStream) { - nsAutoString charsetName; charsetName.AssignWithConversion(mCharsetOverride); + nsAutoString charsetName; charsetName.Assign(mCharsetOverride); NS_WITH_SERVICE(nsICharsetAlias, calias, kCharsetAliasCID, &res); if (NS_SUCCEEDED(res) && calias) { - nsAutoString temp; temp.AssignWithConversion(mCharsetOverride); + nsAutoString temp; temp.Assign(mCharsetOverride); res = calias->GetPreferred(temp, charsetName); } if (NS_FAILED(res)) @@ -374,7 +374,7 @@ void nsHTMLContentSinkStream::Write(const char* aData) } if (mString) { - mString->AppendWithConversion(aData); + mString->Append(NS_ConvertASCIItoUCS2(aData)); } } @@ -390,7 +390,7 @@ void nsHTMLContentSinkStream::Write(char aData) } if (mString) { - mString->AppendWithConversion(aData); + mString->Append(NS_ConvertASCIItoUCS2(aData)); } } @@ -1072,7 +1072,7 @@ nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode) { const nsString& value=aNode.GetValueAt(i); if (mCharsetOverride.IsEmpty()) - mCharsetOverride.AssignWithConversion(value.GetUnicode()); + mCharsetOverride.Assign(value); InitEncoders(); } else if (key.EqualsWithConversion("uri")) diff --git a/htmlparser/src/nsHTMLContentSinkStream.h b/htmlparser/src/nsHTMLContentSinkStream.h index a6fd3d91d579..cf44cab7ac0e 100644 --- a/htmlparser/src/nsHTMLContentSinkStream.h +++ b/htmlparser/src/nsHTMLContentSinkStream.h @@ -50,6 +50,7 @@ #include "nsISaveAsCharset.h" #include "nsIEntityConverter.h" #include "nsIURI.h" +#include "nsAWritableString.h" #define NS_IHTMLCONTENTSINKSTREAM_IID \ {0xa39c6bff, 0x15f0, 0x11d2, \ @@ -68,8 +69,8 @@ class nsIHTMLContentSinkStream : public nsIHTMLContentSink { NS_DEFINE_STATIC_CID_ACCESSOR(NS_HTMLCONTENTSINKSTREAM_CID) NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, - const nsString* aCharsetOverride, + nsAWritableString* aOutString, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags) = 0; }; @@ -97,8 +98,8 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSinkStream // nsIHTMLContentSinkStream NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, - const nsString* aCharsetOverride, + nsAWritableString* aOutString, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags); @@ -167,7 +168,7 @@ protected: protected: nsIOutputStream* mStream; - nsString* mString; + nsAWritableString* mString; int mTabLevel; char* mBuffer; @@ -197,14 +198,14 @@ protected: nsCOMPtr mCharsetEncoder; nsCOMPtr mEntityConverter; - nsCAutoString mCharsetOverride; + nsString mCharsetOverride; }; inline nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult, nsIOutputStream* aOutStream, - const nsString* aCharsetOverride, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags) { nsCOMPtr it; @@ -231,7 +232,7 @@ NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult, inline nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult, - nsString* aOutString, PRUint32 aFlags) + nsAWritableString* aOutString, PRUint32 aFlags) { nsCOMPtr it; nsresult rv; diff --git a/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/htmlparser/src/nsHTMLToTXTSinkStream.cpp index 83fdf565a8c9..2418d37ac73d 100644 --- a/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -249,10 +249,13 @@ nsHTMLToTXTSinkStream::~nsHTMLToTXTSinkStream() */ NS_IMETHODIMP nsHTMLToTXTSinkStream::Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aFlags) { mStream = aOutStream; + // XXX This is wrong. It violates XPCOM string ownership rules. + // We're only getting away with this because instances of this + // class are restricted to single function scope. mString = aOutString; mFlags = aFlags; @@ -304,11 +307,11 @@ nsHTMLToTXTSinkStream::Initialize(nsIOutputStream* aOutStream, } NS_IMETHODIMP -nsHTMLToTXTSinkStream::SetCharsetOverride(const nsString* aCharset) +nsHTMLToTXTSinkStream::SetCharsetOverride(const nsAReadableString* aCharset) { if (aCharset) { - mCharsetOverride = *aCharset; + mCharsetOverride.Assign(*aCharset); InitEncoder(mCharsetOverride); } return NS_OK; @@ -1108,7 +1111,7 @@ void nsHTMLToTXTSinkStream::WriteSimple(nsString& aString) } if (mString != nsnull) { - mString->AppendWithConversion(mBuffer); + mString->Append(NS_ConvertASCIItoUCS2(mBuffer)); } } else diff --git a/htmlparser/src/nsHTMLToTXTSinkStream.h b/htmlparser/src/nsHTMLToTXTSinkStream.h index cd0df7990d94..2c5b631428e3 100644 --- a/htmlparser/src/nsHTMLToTXTSinkStream.h +++ b/htmlparser/src/nsHTMLToTXTSinkStream.h @@ -62,9 +62,9 @@ class nsIHTMLToTXTSinkStream : public nsIHTMLContentSink { NS_DEFINE_STATIC_CID_ACCESSOR(NS_HTMLTOTXTSINKSTREAM_CID) NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aFlags) = 0; - NS_IMETHOD SetCharsetOverride(const nsString* aCharset) = 0; + NS_IMETHOD SetCharsetOverride(const nsAReadableString* aCharset) = 0; NS_IMETHOD SetWrapColumn(PRUint32 aWrapCol) = 0; }; @@ -85,10 +85,10 @@ class nsHTMLToTXTSinkStream : public nsIHTMLToTXTSinkStream virtual ~nsHTMLToTXTSinkStream(); NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aFlags); - NS_IMETHOD SetCharsetOverride(const nsString* aCharset); + NS_IMETHOD SetCharsetOverride(const nsAReadableString* aCharset); // nsISupports NS_DECL_ISUPPORTS @@ -159,8 +159,11 @@ protected: protected: - nsIOutputStream* mStream; - nsString* mString; + nsIOutputStream* mStream; + // XXX This is wrong. It violates XPCOM string ownership rules. + // We're only getting away with this because instances of this + // class are restricted to single function scope. + nsAWritableString* mString; nsString mCurrentLine; PRInt32 mIndent; @@ -222,7 +225,7 @@ protected: inline nsresult NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult, nsIOutputStream* aOutStream, - const nsString* aCharsetOverride=nsnull, + const nsAReadableString* aCharsetOverride=nsnull, PRUint32 aWrapColumn=0, PRUint32 aFlags=0) { nsCOMPtr it; @@ -250,7 +253,7 @@ NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult, inline nsresult NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aWrapColumn=0, PRUint32 aFlags=0) { nsCOMPtr it; diff --git a/htmlparser/src/nsIParser.h b/htmlparser/src/nsIParser.h index 1728128d0401..c232bd4d2306 100644 --- a/htmlparser/src/nsIParser.h +++ b/htmlparser/src/nsIParser.h @@ -224,12 +224,12 @@ class nsIParser : public nsISupports { virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; - virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0; + virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Terminate(void) = 0; - virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; - virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; + virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; + virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; /** * This method gets called when the tokens have been consumed, and it's time diff --git a/htmlparser/src/nsParser.cpp b/htmlparser/src/nsParser.cpp index 225cfcfffa6d..c073a886acd6 100644 --- a/htmlparser/src/nsParser.cpp +++ b/htmlparser/src/nsParser.cpp @@ -1609,17 +1609,12 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo * @param aMimeType tells us what type of content to expect in the given string * @return error code -- 0 if ok, non-zero if error. */ -nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString& +nsresult nsParser::Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){ //NOTE: Make sure that updates to this method don't cause // bug #2361 to break again! -#if 0 - //this is only for debug purposes - aSourceBuffer.DebugDump(); -#endif - nsresult result=NS_OK; nsParser* me = this; // Maintain a reference to ourselves so we don't go away @@ -1701,7 +1696,7 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){ * @param aMimeType tells us what kind of stuff you're inserting * @return TRUE if valid, otherwise FALSE */ -PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ +PRBool nsParser::IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ /************************************************************************************ This method works like this: @@ -1754,7 +1749,7 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta * @param * @return */ -nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ +nsresult nsParser::ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ nsresult result=NS_OK; nsAutoString theContext; diff --git a/htmlparser/src/nsParser.h b/htmlparser/src/nsParser.h index 9257e3303cb8..ba846cbcc45c 100644 --- a/htmlparser/src/nsParser.h +++ b/htmlparser/src/nsParser.h @@ -200,10 +200,10 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, * @param appendTokens tells us whether we should insert tokens inline, or append them. * @return TRUE if all went well -- FALSE otherwise */ - virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect); + virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect); - virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); - virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); + virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); + virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); /** diff --git a/htmlparser/src/nsScanner.cpp b/htmlparser/src/nsScanner.cpp index 7c0dfdb68913..8ffce4ff81bb 100644 --- a/htmlparser/src/nsScanner.cpp +++ b/htmlparser/src/nsScanner.cpp @@ -236,7 +236,7 @@ PRUint32 nsScanner::Mark(PRInt32 anIndex){ * @update harishd 01/12/99 * @return error code */ -PRBool nsScanner::Insert(const nsString& aBuffer) { +PRBool nsScanner::Insert(const nsAReadableString& aBuffer) { mBuffer.Insert(aBuffer,mOffset); mTotalRead+=aBuffer.Length(); @@ -250,7 +250,7 @@ PRBool nsScanner::Insert(const nsString& aBuffer) { * @update gess4/3/98 * @return error code */ -PRBool nsScanner::Append(const nsString& aBuffer) { +PRBool nsScanner::Append(const nsAReadableString& aBuffer) { PRUint32 theLen=mBuffer.Length(); diff --git a/htmlparser/src/nsScanner.h b/htmlparser/src/nsScanner.h index 1a0c3a6249d2..cb75d5b40dfd 100644 --- a/htmlparser/src/nsScanner.h +++ b/htmlparser/src/nsScanner.h @@ -247,7 +247,7 @@ class nsScanner { * @param * @return */ - PRBool Insert(const nsString& aBuffer); + PRBool Insert(const nsAReadableString& aBuffer); /** * @@ -256,7 +256,7 @@ class nsScanner { * @param * @return */ - PRBool Append(const nsString& aBuffer); + PRBool Append(const nsAReadableString& aBuffer); /** * diff --git a/layout/base/nsIPresState.h b/layout/base/nsIPresState.h index adc1d21d0bd3..78222da107aa 100644 --- a/layout/base/nsIPresState.h +++ b/layout/base/nsIPresState.h @@ -12,11 +12,15 @@ class nsIPresState : public nsISupports { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESSTATE_IID) - NS_IMETHOD GetStatePropertyAsSupports(const nsString& aName, nsISupports** aResult) = 0; - NS_IMETHOD SetStatePropertyAsSupports(const nsString& aName, nsISupports* aValue) = 0; + NS_IMETHOD GetStatePropertyAsSupports(const nsAReadableString& aName, + nsISupports** aResult) = 0; + NS_IMETHOD SetStatePropertyAsSupports(const nsAReadableString& aName, + nsISupports* aValue) = 0; - NS_IMETHOD GetStateProperty(const nsString& aName, nsString& aResult) = 0; - NS_IMETHOD SetStateProperty(const nsString& aProperty, const nsString& aValue) = 0; + NS_IMETHOD GetStateProperty(const nsAReadableString& aName, + nsAWritableString& aResult) = 0; + NS_IMETHOD SetStateProperty(const nsAReadableString& aProperty, + const nsAReadableString& aValue) = 0; }; extern nsresult diff --git a/layout/base/nsPresState.cpp b/layout/base/nsPresState.cpp index 411ad3c6cc47..23ae965ec567 100644 --- a/layout/base/nsPresState.cpp +++ b/layout/base/nsPresState.cpp @@ -12,11 +12,11 @@ class nsPresState: public nsIPresState { NS_DECL_ISUPPORTS - NS_IMETHOD GetStatePropertyAsSupports(const nsString& aName, nsISupports** aResult); - NS_IMETHOD SetStatePropertyAsSupports(const nsString& aName, nsISupports* aValue); + NS_IMETHOD GetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports** aResult); + NS_IMETHOD SetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports* aValue); - NS_IMETHOD GetStateProperty(const nsString& aProperty, nsString& aResult); - NS_IMETHOD SetStateProperty(const nsString& aProperty, const nsString& aValue); + NS_IMETHOD GetStateProperty(const nsAReadableString& aProperty, nsAWritableString& aResult); + NS_IMETHOD SetStateProperty(const nsAReadableString& aProperty, const nsAReadableString& aValue); public: nsPresState(); @@ -56,18 +56,20 @@ nsPresState::~nsPresState(void) // nsIPresState Interface //////////////////////////////////////////////////////////////// NS_IMETHODIMP -nsPresState::GetStateProperty(const nsString& aName, nsString& aResult) +nsPresState::GetStateProperty(const nsAReadableString& aName, + nsAWritableString& aResult) { // Retrieve from hashtable. nsCOMPtr str; - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); if (mPropertyTable) str = dont_AddRef(NS_STATIC_CAST(nsISupportsWString*, mPropertyTable->Get(&key))); if (str) { PRUnichar* data; str->GetData(&data); - aResult = data; + aResult.Append(data); nsMemory::Free(data); } else { aResult.SetLength(0); @@ -76,31 +78,32 @@ nsPresState::GetStateProperty(const nsString& aName, nsString& aResult) } NS_IMETHODIMP -nsPresState::SetStateProperty(const nsString& aName, const nsString& aValue) +nsPresState::SetStateProperty(const nsAReadableString& aName, const nsAReadableString& aValue) { if (!mPropertyTable) mPropertyTable = new nsSupportsHashtable(8); // Add to hashtable - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); nsCOMPtr supportsStr; nsresult rv = nsComponentManager::CreateInstance(NS_SUPPORTS_WSTRING_PROGID, nsnull, NS_GET_IID(nsISupportsWString), getter_AddRefs(supportsStr)); - PRUnichar* val = aValue.ToNewUnicode(); - supportsStr->SetData(val); - nsMemory::Free(val); + supportsStr->SetData(nsPromiseFlatString(aValue)); + mPropertyTable->Put(&key, supportsStr); return NS_OK; } NS_IMETHODIMP -nsPresState::GetStatePropertyAsSupports(const nsString& aName, nsISupports** aResult) +nsPresState::GetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports** aResult) { // Retrieve from hashtable. nsCOMPtr supp; - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); if (mPropertyTable) supp = dont_AddRef(NS_STATIC_CAST(nsISupports*, mPropertyTable->Get(&key))); @@ -110,13 +113,14 @@ nsPresState::GetStatePropertyAsSupports(const nsString& aName, nsISupports** aRe } NS_IMETHODIMP -nsPresState::SetStatePropertyAsSupports(const nsString& aName, nsISupports* aValue) +nsPresState::SetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports* aValue) { if (!mPropertyTable) mPropertyTable = new nsSupportsHashtable(8); // Add to hashtable - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); mPropertyTable->Put(&key, aValue); return NS_OK; } diff --git a/layout/base/public/nsIContent.h b/layout/base/public/nsIContent.h index 051e7f11b54c..f54ef6bf1ab8 100644 --- a/layout/base/public/nsIContent.h +++ b/layout/base/public/nsIContent.h @@ -26,13 +26,12 @@ #include "nslayout.h" #include "nsISupports.h" #include "nsGUIEvent.h" +#include "nsAWritableString.h" // Forward declarations class nsIAtom; class nsIDocument; class nsIPresContext; -class nsString; -class nsString; class nsVoidArray; class nsIXIFConverter; class nsIDOMEvent; @@ -107,7 +106,7 @@ public: * @param aNameSpaceID out parameter reprsenting the namespace * of the attribute */ - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) = 0; @@ -136,7 +135,7 @@ public: * notified of the attribute change. */ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) = 0; /** @@ -153,7 +152,7 @@ public: * @param aNotify specifies whether or not the document should be * notified of the attribute change. */ - NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) = 0; /** @@ -174,7 +173,7 @@ public: * */ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const = 0; + nsAWritableString& aResult) const = 0; /** * Get the current value and prefix of the attribute. This returns a form @@ -197,7 +196,7 @@ public: */ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const = 0; + nsIAtom*& aPrefix, nsAWritableString& aResult) const = 0; /** * Remove an attribute so that it is no longer explicitly specified. diff --git a/layout/base/public/nsIDocument.h b/layout/base/public/nsIDocument.h index 13270667bb7c..94c446f6de4e 100644 --- a/layout/base/public/nsIDocument.h +++ b/layout/base/public/nsIDocument.h @@ -26,6 +26,7 @@ #include "nsISupports.h" #include "nsIUnicharInputStream.h" #include "nsGUIEvent.h" +#include "nsAWritableString.h" class nsIAtom; class nsIArena; @@ -43,7 +44,6 @@ class nsIStyleRule; class nsIURI; class nsILoadGroup; class nsIViewManager; -class nsString; class nsIScriptGlobalObject; class nsIDOMEvent; class nsIDeviceContext; @@ -130,14 +130,14 @@ public: /** * Return the content (mime) type of this document. */ - NS_IMETHOD GetContentType(nsString& aContentType) const = 0; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const = 0; /** * Return a standard name for the document's character set. This will * trigger a startDocumentLoad if necessary to answer the question. */ - NS_IMETHOD GetDocumentCharacterSet(nsString& oCharSetID) = 0; - NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID) = 0; + NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharSetID) = 0; + NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID) = 0; /** * Add an observer that gets notified whenever the charset changes. @@ -161,8 +161,8 @@ public: * Access HTTP header data (this may also get set from other sources, like * HTML META tags). */ - NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const = 0; - NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData) = 0; + NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const = 0; + NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData) = 0; /** * Create a new presentation shell that will use aContext for @@ -296,7 +296,7 @@ public: /** * Finds text in content */ - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0; + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0; /** * Converts the document or a selection of the @@ -306,7 +306,7 @@ public: * NOTE: we may way to place the result in a stream, * but we will use a string for now -- gpk */ - NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0; + NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0; NS_IMETHOD ToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0; virtual void BeginConvertToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0; virtual void ConvertChildrenToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0; @@ -348,8 +348,8 @@ extern NS_LAYOUT nsresult nsIDocument* aOwnerDocument); extern NS_LAYOUT nsresult NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult, - const nsString& aNamespaceURI, - const nsString& aQualifiedName, + const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIURI* aBaseURI); diff --git a/layout/base/public/nsIDocumentEncoder.h b/layout/base/public/nsIDocumentEncoder.h index d505c9001fa4..e9904a4b273f 100644 --- a/layout/base/public/nsIDocumentEncoder.h +++ b/layout/base/public/nsIDocumentEncoder.h @@ -112,7 +112,7 @@ public: /** * Initialize with a pointer to the document and the mime type. */ - NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 flags) = 0; + NS_IMETHOD Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 flags) = 0; /** * If the selection is set to a non-null value, then the @@ -130,7 +130,7 @@ public: * * Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER */ - NS_IMETHOD SetCharset(const nsString& aCharset) = 0; + NS_IMETHOD SetCharset(const nsAReadableString& aCharset) = 0; /** * Set a wrap column. This may have no effect in some types of encoders. @@ -145,7 +145,7 @@ public: * might have been encountered. */ NS_IMETHOD EncodeToStream(nsIOutputStream* aStream) = 0; - NS_IMETHOD EncodeToString(nsString& aOutputString) = 0; + NS_IMETHOD EncodeToString(nsAWritableString& aOutputString) = 0; }; // XXXXXXXXXXXXXXXX nsITextEncoder is going away! XXXXXXXXXXXXXXXXXXXXXX diff --git a/layout/base/public/nsINameSpace.h b/layout/base/public/nsINameSpace.h index b1fb8206ab0b..401f4c7037b5 100644 --- a/layout/base/public/nsINameSpace.h +++ b/layout/base/public/nsINameSpace.h @@ -54,7 +54,7 @@ public: // Get data of this name space NS_IMETHOD GetNameSpaceID(PRInt32& aID) const = 0; - NS_IMETHOD GetNameSpaceURI(nsString& aURI) const = 0; + NS_IMETHOD GetNameSpaceURI(nsAWritableString& aURI) const = 0; NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const = 0; NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const = 0; @@ -65,7 +65,8 @@ public: NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const = 0; // create new child name space - NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI, + NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, + const nsAReadableString& aURI, nsINameSpace*& aChildNameSpace) = 0; NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID, diff --git a/layout/base/public/nsINameSpaceManager.h b/layout/base/public/nsINameSpaceManager.h index f2407dcfa31b..726ffa9422af 100644 --- a/layout/base/public/nsINameSpaceManager.h +++ b/layout/base/public/nsINameSpaceManager.h @@ -25,6 +25,7 @@ #include "nsISupports.h" #include "nslayout.h" +#include "nsAWritableString.h" class nsIAtom; class nsString; @@ -70,11 +71,11 @@ public: NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace) = 0; - NS_IMETHOD RegisterNameSpace(const nsString& aURI, + NS_IMETHOD RegisterNameSpace(const nsAReadableString& aURI, PRInt32& aNameSpaceID) = 0; - NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) = 0; - NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID) = 0; + NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI) = 0; + NS_IMETHOD GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID) = 0; }; extern NS_LAYOUT nsresult diff --git a/layout/base/public/nsINodeInfo.h b/layout/base/public/nsINodeInfo.h index c52ac0bd4ac8..244324b435d0 100644 --- a/layout/base/public/nsINodeInfo.h +++ b/layout/base/public/nsINodeInfo.h @@ -41,6 +41,7 @@ #define nsINodeInfo_h___ #include "nsISupports.h" +#include "nsAWritableString.h" // Forward declarations class nsIAtom; @@ -73,7 +74,7 @@ public: * For the HTML element "" this will return "body" and for the XML * element "" this will return "body". */ - NS_IMETHOD GetName(nsString& aName) = 0; + NS_IMETHOD GetName(nsAWritableString& aName) = 0; /* * Get the name from this node as an atom, this does not include the prefix. @@ -91,7 +92,7 @@ public: * For the HTML element "" this will return "body" and for the XML * element "" this will return "html:body". */ - NS_IMETHOD GetQualifiedName(nsString& aQualifiedName) = 0; + NS_IMETHOD GetQualifiedName(nsAWritableString& aQualifiedName) = 0; /* * Get the local name from this node as a string, GetLocalName() gets the @@ -102,7 +103,7 @@ public: * For the HTML element "" in a HTML document this will return a null * string and for the XML element "" this will return "body". */ - NS_IMETHOD GetLocalName(nsString& aLocalName) = 0; + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) = 0; /* * Get the prefix from this node as a string. @@ -110,7 +111,7 @@ public: * For the HTML element "" this will return a null string and for * the XML element "" this will return the string "html". */ - NS_IMETHOD GetPrefix(nsString& aPrefix) = 0; + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) = 0; /* * Get the prefix from this node as an atom. @@ -129,7 +130,7 @@ public: * xmlns:html='http://www.w3.org/1999/xhtml' attribute) this will return * the string "http://www.w3.org/1999/xhtml". */ - NS_IMETHOD GetNamespaceURI(nsString& aNameSpaceURI) = 0; + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNameSpaceURI) = 0; /* * Get the namespace ID for a node if the node has a namespace, if not this @@ -154,18 +155,19 @@ public: * namespace ID. */ NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName) = 0; + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName) = 0; NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName, - const nsString& aPrefix) = 0; + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, + const nsAReadableString& aPrefix) = 0; NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID) = 0; + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, PRInt32 aNamespaceID) = 0; NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom, PRInt32 aNamespaceID) = 0; - NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, + const nsAReadableString& aPrefix, PRInt32 aNamespaceID) = 0; NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID) = 0; - NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI) = 0; + NS_IMETHOD_(PRBool) NamespaceEquals(const nsAReadableString& aNamespaceURI) = 0; /* * This is a convinience method that creates a new nsINodeInfo that differs @@ -197,15 +199,17 @@ public: */ NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, + const nsAReadableString& aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, + const nsAReadableString& aPrefix, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) = 0; - NS_IMETHOD GetNodeInfo(const nsString& aQualifiedName, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aQualifiedName, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) = 0; /* diff --git a/layout/base/public/nsIPresState.h b/layout/base/public/nsIPresState.h index adc1d21d0bd3..78222da107aa 100644 --- a/layout/base/public/nsIPresState.h +++ b/layout/base/public/nsIPresState.h @@ -12,11 +12,15 @@ class nsIPresState : public nsISupports { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESSTATE_IID) - NS_IMETHOD GetStatePropertyAsSupports(const nsString& aName, nsISupports** aResult) = 0; - NS_IMETHOD SetStatePropertyAsSupports(const nsString& aName, nsISupports* aValue) = 0; + NS_IMETHOD GetStatePropertyAsSupports(const nsAReadableString& aName, + nsISupports** aResult) = 0; + NS_IMETHOD SetStatePropertyAsSupports(const nsAReadableString& aName, + nsISupports* aValue) = 0; - NS_IMETHOD GetStateProperty(const nsString& aName, nsString& aResult) = 0; - NS_IMETHOD SetStateProperty(const nsString& aProperty, const nsString& aValue) = 0; + NS_IMETHOD GetStateProperty(const nsAReadableString& aName, + nsAWritableString& aResult) = 0; + NS_IMETHOD SetStateProperty(const nsAReadableString& aProperty, + const nsAReadableString& aValue) = 0; }; extern nsresult diff --git a/layout/base/public/nsITextContent.h b/layout/base/public/nsITextContent.h index 46fb3099ee5b..108e94b5e6f9 100644 --- a/layout/base/public/nsITextContent.h +++ b/layout/base/public/nsITextContent.h @@ -52,7 +52,7 @@ public: /** * Make a copy of the text content in aResult. */ - NS_IMETHOD CopyText(nsString& aResult) = 0; + NS_IMETHOD CopyText(nsAWritableString& aResult) = 0; /** * Set the text to the given value. If aNotify is PR_TRUE then @@ -62,6 +62,13 @@ public: PRInt32 aLength, PRBool aNotify) = 0; + /** + * Set the text to the given value. If aNotify is PR_TRUE then + * the document is notified of the content change. + */ + NS_IMETHOD SetText(const nsAReadableString& aStr, + PRBool aNotify) = 0; + /** * Set the text to the given value. If aNotify is PR_TRUE then * the document is notified of the content change. diff --git a/layout/base/public/nsIXIFConverter.h b/layout/base/public/nsIXIFConverter.h index e682be55e7de..9717a52f6459 100644 --- a/layout/base/public/nsIXIFConverter.h +++ b/layout/base/public/nsIXIFConverter.h @@ -43,29 +43,29 @@ class nsIXIFConverter: public nsISupports public: static const nsIID& GetIID() { static nsIID iid = NS_IXIFCONVERTER_IID; return iid; } - NS_IMETHOD Init(nsString &aBuffer) = 0; + NS_IMETHOD Init(nsAWritableString &aBuffer) = 0; - NS_IMETHOD BeginStartTag(const nsString& aTag) = 0; + NS_IMETHOD BeginStartTag(const nsAReadableString& aTag) = 0; NS_IMETHOD BeginStartTag(nsIAtom* aTag) = 0; - NS_IMETHOD AddAttribute(const nsString& aName, const nsString& aValue) = 0; - NS_IMETHOD AddAttribute(const nsString& aName, nsIAtom* aValue) = 0; - NS_IMETHOD AddAttribute(const nsString& aName) = 0; + NS_IMETHOD AddAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) = 0; + NS_IMETHOD AddAttribute(const nsAReadableString& aName, nsIAtom* aValue) = 0; + NS_IMETHOD AddAttribute(const nsAReadableString& aName) = 0; NS_IMETHOD AddAttribute(nsIAtom* aName) = 0; - //parameters normally: const nsString& aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE - NS_IMETHOD FinishStartTag(const nsString& aTag, PRBool aIsEmpty , PRBool aAddReturn) = 0; + //parameters normally: const nsAReadableString& aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE + NS_IMETHOD FinishStartTag(const nsAReadableString& aTag, PRBool aIsEmpty , PRBool aAddReturn) = 0; //parameters normally: nsIAtom* aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE NS_IMETHOD FinishStartTag(nsIAtom* aTag, PRBool aIsEmpty, PRBool aAddReturn) = 0; // Short-cut for starting a new tag that has no attributes //default aAddReturn to true - NS_IMETHOD AddStartTag(const nsString& aTag, PRBool aAddReturn) = 0; + NS_IMETHOD AddStartTag(const nsAReadableString& aTag, PRBool aAddReturn) = 0; //default aAddReturn to true NS_IMETHOD AddStartTag(nsIAtom* aTag, PRBool aAddReturn) = 0; - //parameter defaults: const nsString& aTag,PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE - NS_IMETHOD AddEndTag(const nsString& aTag,PRBool aDoIndent, PRBool aDoReturn) = 0; + //parameter defaults: const nsAReadableString& aTag,PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE + NS_IMETHOD AddEndTag(const nsAReadableString& aTag,PRBool aDoIndent, PRBool aDoReturn) = 0; //parameter defaults: nsIAtom* aTag,PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE NS_IMETHOD AddEndTag(nsIAtom* aTag,PRBool aDoIndent, PRBool aDoReturn) = 0; @@ -74,19 +74,19 @@ public: NS_IMETHOD BeginContainer(nsIAtom* aTag) = 0; NS_IMETHOD EndContainer(nsIAtom* aTag) = 0; - NS_IMETHOD BeginContainer(const nsString& aTag) = 0; - NS_IMETHOD EndContainer(const nsString& aTag) = 0; + NS_IMETHOD BeginContainer(const nsAReadableString& aTag) = 0; + NS_IMETHOD EndContainer(const nsAReadableString& aTag) = 0; - NS_IMETHOD BeginLeaf(const nsString& aTag) = 0; - NS_IMETHOD EndLeaf(const nsString& aTag) = 0; + NS_IMETHOD BeginLeaf(const nsAReadableString& aTag) = 0; + NS_IMETHOD EndLeaf(const nsAReadableString& aTag) = 0; - NS_IMETHOD AddContent(const nsString& aContent) = 0; - NS_IMETHOD AddComment(const nsString& aComment) = 0; - NS_IMETHOD AddContentComment(const nsString& aComment) = 0; + NS_IMETHOD AddContent(const nsAReadableString& aContent) = 0; + NS_IMETHOD AddComment(const nsAReadableString& aComment) = 0; + NS_IMETHOD AddContentComment(const nsAReadableString& aComment) = 0; - NS_IMETHOD AddMarkupDeclaration(const nsString& aComment) = 0; + NS_IMETHOD AddMarkupDeclaration(const nsAReadableString& aComment) = 0; - NS_IMETHOD AddHTMLAttribute(const nsString& aName, const nsString& aValue) = 0; + NS_IMETHOD AddHTMLAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) = 0; NS_IMETHOD BeginCSSStyleSheet() = 0; @@ -96,12 +96,12 @@ public: NS_IMETHOD EndCSSRule() = 0; NS_IMETHOD BeginCSSSelectors() = 0; - NS_IMETHOD AddCSSSelectors(const nsString& aSelectors) = 0; + NS_IMETHOD AddCSSSelectors(const nsAReadableString& aSelectors) = 0; NS_IMETHOD EndCSSSelectors() = 0; NS_IMETHOD BeginCSSDeclarationList() = 0; NS_IMETHOD BeginCSSDeclaration() = 0; - NS_IMETHOD AddCSSDeclaration(const nsString& aName, const nsString& aValue) = 0; + NS_IMETHOD AddCSSDeclaration(const nsAReadableString& aName, const nsAReadableString& aValue) = 0; NS_IMETHOD EndCSSDeclaration() = 0; NS_IMETHOD EndCSSDeclarationList() = 0; diff --git a/layout/base/public/nsTextFragment.h b/layout/base/public/nsTextFragment.h index defc9f16aab2..52ccecd47637 100644 --- a/layout/base/public/nsTextFragment.h +++ b/layout/base/public/nsTextFragment.h @@ -23,6 +23,7 @@ #define nsTextFragment_h___ #include "nslayout.h" +#include "nsAWritableString.h" class nsString; // XXX should this normalize the code to keep a \u0000 at the end? @@ -112,7 +113,7 @@ public: * Change the contents of this fragment to be a copy of the * the argument string. */ - nsTextFragment& operator=(const nsString& aString); + nsTextFragment& operator=(const nsAReadableString& aString); /** * Return PR_TRUE if this fragment is represented by PRUnichar data @@ -166,8 +167,8 @@ public: /** * Change the contents of this fragment to be the given buffer and * length. The memory becomes owned by the fragment. In addition, - * the memory for aBuffer must have been allocated using the "new[]" - * because it will be released with "delete []". + * the memory for aBuffer must have been allocated using the + * nsIMemory interface. */ void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease); diff --git a/layout/base/src/nsCommentNode.cpp b/layout/base/src/nsCommentNode.cpp index 3f02aa9f5a93..29d13fe201ea 100644 --- a/layout/base/src/nsCommentNode.cpp +++ b/layout/base/src/nsCommentNode.cpp @@ -110,7 +110,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { aResult = nsnull; return NS_OK; } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -120,19 +120,19 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsString &aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aAttribute, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsIAtom*& aPrefix, nsString &aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNodeInfo, aValue, aNotify); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -215,12 +215,14 @@ public: NS_IMETHOD GetTextLength(PRInt32* aLengthResult) { return mInner.GetTextLength(aLengthResult); } - NS_IMETHOD CopyText(nsString& aResult) { + NS_IMETHOD CopyText(nsAWritableString& aResult) { return mInner.CopyText(aResult); } NS_IMETHOD SetText(const PRUnichar* aBuffer, PRInt32 aLength, PRBool aNotify); + NS_IMETHOD SetText(const nsAReadableString& aStr, + PRBool aNotify); NS_IMETHOD SetText(const char* aBuffer, PRInt32 aLength, PRBool aNotify); @@ -289,9 +291,9 @@ nsCommentNode::GetTag(nsIAtom*& aResult) const } NS_IMETHODIMP -nsCommentNode::GetNodeName(nsString& aNodeName) +nsCommentNode::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#comment"); + aNodeName.Assign(NS_LITERAL_STRING("#comment")); return NS_OK; } @@ -545,6 +547,16 @@ nsCommentNode::SetText(const PRUnichar* aBuffer, return mInner.SetText(this, str.GetUnicode(), str.Length(), aNotify); } +NS_IMETHODIMP +nsCommentNode::SetText(const nsAReadableString& aStr, + PRBool aNotify) +{ + nsAutoString str(aStr); + + StripCommentDelimiters(str); + return mInner.SetText(this, str.GetUnicode(), str.Length(), aNotify); +} + NS_IMETHODIMP nsCommentNode::SetText(const char* aBuffer, PRInt32 aLength, diff --git a/layout/base/src/nsContentList.cpp b/layout/base/src/nsContentList.cpp index 59aee5a87e57..b002486a18f3 100644 --- a/layout/base/src/nsContentList.cpp +++ b/layout/base/src/nsContentList.cpp @@ -180,7 +180,7 @@ nsContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsContentList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsContentList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { nsresult result = CheckDocumentExistence(); diff --git a/layout/base/src/nsContentList.h b/layout/base/src/nsContentList.h index 1a95a618f941..8d0d557e4bd0 100644 --- a/layout/base/src/nsContentList.h +++ b/layout/base/src/nsContentList.h @@ -57,7 +57,7 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); // nsIScriptObjectOwner NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject); diff --git a/layout/base/src/nsDOMAttribute.cpp b/layout/base/src/nsDOMAttribute.cpp index 9421f550f633..98cd37736c6d 100644 --- a/layout/base/src/nsDOMAttribute.cpp +++ b/layout/base/src/nsDOMAttribute.cpp @@ -37,7 +37,7 @@ static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID); nsDOMAttribute::nsDOMAttribute(nsIContent* aContent, nsINodeInfo *aNodeInfo, - const nsString& aValue) + const nsAReadableString& aValue) : mNodeInfo(aNodeInfo), mValue(aValue) { NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!"); @@ -156,7 +156,7 @@ nsDOMAttribute::SetScriptObject(void *aScriptObject) } nsresult -nsDOMAttribute::GetName(nsString& aName) +nsDOMAttribute::GetName(nsAWritableString& aName) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -164,7 +164,7 @@ nsDOMAttribute::GetName(nsString& aName) } nsresult -nsDOMAttribute::GetValue(nsString& aValue) +nsDOMAttribute::GetValue(nsAWritableString& aValue) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -188,7 +188,7 @@ nsDOMAttribute::GetValue(nsString& aValue) } nsresult -nsDOMAttribute::SetValue(const nsString& aValue) +nsDOMAttribute::SetValue(const nsAReadableString& aValue) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -247,19 +247,19 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement) } NS_IMETHODIMP -nsDOMAttribute::GetNodeName(nsString& aNodeName) +nsDOMAttribute::GetNodeName(nsAWritableString& aNodeName) { return GetName(aNodeName); } NS_IMETHODIMP -nsDOMAttribute::GetNodeValue(nsString& aNodeValue) +nsDOMAttribute::GetNodeValue(nsAWritableString& aNodeValue) { return GetValue(aNodeValue); } NS_IMETHODIMP -nsDOMAttribute::SetNodeValue(const nsString& aNodeValue) +nsDOMAttribute::SetNodeValue(const nsAReadableString& aNodeValue) { return SetValue(aNodeValue); } @@ -449,7 +449,7 @@ nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } NS_IMETHODIMP -nsDOMAttribute::GetNamespaceURI(nsString& aNamespaceURI) +nsDOMAttribute::GetNamespaceURI(nsAWritableString& aNamespaceURI) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -457,7 +457,7 @@ nsDOMAttribute::GetNamespaceURI(nsString& aNamespaceURI) } NS_IMETHODIMP -nsDOMAttribute::GetPrefix(nsString& aPrefix) +nsDOMAttribute::GetPrefix(nsAWritableString& aPrefix) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -465,7 +465,7 @@ nsDOMAttribute::GetPrefix(nsString& aPrefix) } NS_IMETHODIMP -nsDOMAttribute::SetPrefix(const nsString& aPrefix) +nsDOMAttribute::SetPrefix(const nsAReadableString& aPrefix) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); nsCOMPtr newNodeInfo; @@ -500,7 +500,7 @@ nsDOMAttribute::SetPrefix(const nsString& aPrefix) } NS_IMETHODIMP -nsDOMAttribute::GetLocalName(nsString& aLocalName) +nsDOMAttribute::GetLocalName(nsAWritableString& aLocalName) { NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE); @@ -515,7 +515,7 @@ nsDOMAttribute::Normalize() } NS_IMETHODIMP -nsDOMAttribute::Supports(const nsString& aFeature, const nsString& aVersion, +nsDOMAttribute::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); diff --git a/layout/base/src/nsDOMAttribute.h b/layout/base/src/nsDOMAttribute.h index a114d481a82c..6f26cd65eaa2 100644 --- a/layout/base/src/nsDOMAttribute.h +++ b/layout/base/src/nsDOMAttribute.h @@ -71,7 +71,7 @@ class nsDOMAttribute : public nsIDOMAttr, { public: nsDOMAttribute(nsIContent* aContent, nsINodeInfo *aNodeInfo, - const nsString& aValue); + const nsAReadableString& aValue); virtual ~nsDOMAttribute(); NS_DECL_ISUPPORTS diff --git a/layout/base/src/nsDOMAttributeMap.cpp b/layout/base/src/nsDOMAttributeMap.cpp index c062c4918388..0e7cb41610ff 100644 --- a/layout/base/src/nsDOMAttributeMap.cpp +++ b/layout/base/src/nsDOMAttributeMap.cpp @@ -90,7 +90,7 @@ nsDOMAttributeMap::SetScriptObject(void *aScriptObject) } nsresult -nsDOMAttributeMap::GetNamedItem(const nsString &aAttrName, +nsDOMAttributeMap::GetNamedItem(const nsAReadableString& aAttrName, nsIDOMNode** aAttribute) { NS_ENSURE_ARG_POINTER(aAttribute); @@ -213,7 +213,7 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn) } NS_IMETHODIMP -nsDOMAttributeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsDOMAttributeMap::RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; @@ -338,8 +338,8 @@ nsDOMAttributeMap::GetLength(PRUint32 *aLength) } nsresult -nsDOMAttributeMap::GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsDOMAttributeMap::GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -452,8 +452,8 @@ nsDOMAttributeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) } nsresult -nsDOMAttributeMap::RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsDOMAttributeMap::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); diff --git a/layout/base/src/nsDOMAttributeMap.h b/layout/base/src/nsDOMAttributeMap.h index 720a925d4e0e..32aeb4001861 100644 --- a/layout/base/src/nsDOMAttributeMap.h +++ b/layout/base/src/nsDOMAttributeMap.h @@ -45,15 +45,16 @@ public: // nsIDOMNamedNodeMap interface NS_IMETHOD GetLength(PRUint32* aSize); - NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItem(nsIDOMNode* aNode, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsIDOMNode** aReturn); + NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, nsIDOMNode** aReturn); + NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + nsIDOMNode** aReturn); void DropReference(); diff --git a/layout/base/src/nsDOMDocumentType.cpp b/layout/base/src/nsDOMDocumentType.cpp index 3472994d4f35..9032553e675b 100644 --- a/layout/base/src/nsDOMDocumentType.cpp +++ b/layout/base/src/nsDOMDocumentType.cpp @@ -29,12 +29,12 @@ nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType, - const nsString& aName, + const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset) + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset) { NS_ENSURE_ARG_POINTER(aDocType); @@ -49,12 +49,12 @@ NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType, return NS_OK; } -nsDOMDocumentType::nsDOMDocumentType(const nsString& aName, +nsDOMDocumentType::nsDOMDocumentType(const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset) : + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset) : mName(aName), mPublicId(aPublicId), mSystemId(aSystemId), @@ -87,7 +87,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMDocumentType) NS_INTERFACE_MAP_END_THREADSAFE NS_IMETHODIMP -nsDOMDocumentType::GetName(nsString& aName) +nsDOMDocumentType::GetName(nsAWritableString& aName) { aName=mName; @@ -119,7 +119,7 @@ nsDOMDocumentType::GetNotations(nsIDOMNamedNodeMap** aNotations) } NS_IMETHODIMP -nsDOMDocumentType::GetPublicId(nsString& aPublicId) +nsDOMDocumentType::GetPublicId(nsAWritableString& aPublicId) { aPublicId = mPublicId; @@ -127,7 +127,7 @@ nsDOMDocumentType::GetPublicId(nsString& aPublicId) } NS_IMETHODIMP -nsDOMDocumentType::GetSystemId(nsString& aSystemId) +nsDOMDocumentType::GetSystemId(nsAWritableString& aSystemId) { aSystemId = mSystemId; @@ -135,7 +135,7 @@ nsDOMDocumentType::GetSystemId(nsString& aSystemId) } NS_IMETHODIMP -nsDOMDocumentType::GetInternalSubset(nsString& aInternalSubset) +nsDOMDocumentType::GetInternalSubset(nsAWritableString& aInternalSubset) { aInternalSubset = mInternalSubset; @@ -158,7 +158,7 @@ nsDOMDocumentType::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsDOMDocumentType::GetNodeName(nsString& aNodeName) +nsDOMDocumentType::GetNodeName(nsAWritableString& aNodeName) { aNodeName=mName; diff --git a/layout/base/src/nsDOMDocumentType.h b/layout/base/src/nsDOMDocumentType.h index 729add67b0ec..def8ba0f6365 100644 --- a/layout/base/src/nsDOMDocumentType.h +++ b/layout/base/src/nsDOMDocumentType.h @@ -37,12 +37,12 @@ class nsDOMDocumentType : public nsIDOMDocumentType, public nsIContent { public: - nsDOMDocumentType(const nsString& aName, + nsDOMDocumentType(const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset); + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset); virtual ~nsDOMDocumentType(); @@ -78,11 +78,11 @@ protected: }; extern nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType, - const nsString& aName, + const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset); + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset); #endif // nsDOMDocument_h___ diff --git a/layout/base/src/nsDocument.cpp b/layout/base/src/nsDocument.cpp index 254d67497ce4..8063d70d8042 100644 --- a/layout/base/src/nsDocument.cpp +++ b/layout/base/src/nsDocument.cpp @@ -368,16 +368,16 @@ public: NS_DECL_ISUPPORTS // nsIDOMDOMImplementation - NS_IMETHOD HasFeature(const nsString& aFeature, - const nsString& aVersion, + NS_IMETHOD HasFeature(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn); - NS_IMETHOD CreateDocumentType(const nsString& aQualifiedName, - const nsString& aPublicId, - const nsString& aSystemId, + NS_IMETHOD CreateDocumentType(const nsAReadableString& aQualifiedName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, nsIDOMDocumentType** aReturn); - NS_IMETHOD CreateDocument(const nsString& aNamespaceURI, - const nsString& aQualifiedName, + NS_IMETHOD CreateDocument(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn); @@ -418,28 +418,28 @@ NS_IMPL_ISUPPORTS4(nsDOMImplementation, nsIDOMDOMImplementation, nsIPrivateDOMIm NS_IMETHODIMP -nsDOMImplementation::HasFeature(const nsString& aFeature, - const nsString& aVersion, +nsDOMImplementation::HasFeature(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); } NS_IMETHODIMP -nsDOMImplementation::CreateDocumentType(const nsString& aQualifiedName, - const nsString& aPublicId, - const nsString& aSystemId, +nsDOMImplementation::CreateDocumentType(const nsAReadableString& aQualifiedName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, nsIDOMDocumentType** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); return NS_NewDOMDocumentType(aReturn, aQualifiedName, nsnull, nsnull, - aPublicId, aSystemId, nsAutoString()); + aPublicId, aSystemId, nsString()); } NS_IMETHODIMP -nsDOMImplementation::CreateDocument(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsDOMImplementation::CreateDocument(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIDOMDocument** aReturn) { @@ -1043,7 +1043,7 @@ nsDocument::AddPrincipal(nsIPrincipal *aNewPrincipal) } NS_IMETHODIMP -nsDocument::GetContentType(nsString& aContentType) const +nsDocument::GetContentType(nsAWritableString& aContentType) const { // Must be implemented by derived class. return NS_ERROR_NOT_IMPLEMENTED; @@ -1067,23 +1067,21 @@ nsDocument::GetBaseURL(nsIURI*& aURL) const return NS_OK; } -NS_IMETHODIMP nsDocument::GetDocumentCharacterSet(nsString& oCharSetID) +NS_IMETHODIMP nsDocument::GetDocumentCharacterSet(nsAWritableString& oCharSetID) { oCharSetID = mCharacterSet; return NS_OK; } -NS_IMETHODIMP nsDocument::SetDocumentCharacterSet(const nsString& aCharSetID) +NS_IMETHODIMP nsDocument::SetDocumentCharacterSet(const nsAReadableString& aCharSetID) { - if (mCharacterSet != aCharSetID) { + if (!mCharacterSet.Equals(aCharSetID)) { mCharacterSet = aCharSetID; - nsAutoString charSetTopic; - charSetTopic.AssignWithConversion("charset"); PRInt32 n = mCharSetObservers.Count(); for (PRInt32 i = 0; i < n; i++) { nsIObserver* observer = (nsIObserver*) mCharSetObservers.ElementAt(i); - observer->Observe((nsIDocument*) this, charSetTopic.GetUnicode(), - aCharSetID.GetUnicode()); + observer->Observe((nsIDocument*) this, NS_LITERAL_STRING("charset"), + nsPromiseFlatString(aCharSetID)); } } return NS_OK; @@ -1165,7 +1163,7 @@ NS_IMETHODIMP nsDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker) } NS_IMETHODIMP -nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const +nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const { aData.Truncate(); const nsDocHeaderData* data = mHeaderData; @@ -1180,7 +1178,7 @@ nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const } NS_IMETHODIMP -nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) +nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData) { if (nsnull != aHeaderField) { if (nsnull == mHeaderData) { @@ -2162,7 +2160,7 @@ nsDocument::GetDocumentElement(nsIDOMElement** aDocumentElement) } NS_IMETHODIMP -nsDocument::CreateElement(const nsString& aTagName, +nsDocument::CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn) { // Should be implemented by subclass @@ -2170,7 +2168,7 @@ nsDocument::CreateElement(const nsString& aTagName, } NS_IMETHODIMP -nsDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) +nsDocument::CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn) { nsIContent* text = nsnull; nsresult rv = NS_NewTextNode(&text); @@ -2191,7 +2189,7 @@ nsDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) } NS_IMETHODIMP -nsDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) +nsDocument::CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn) { nsIContent* comment = nsnull; nsresult rv = NS_NewCommentNode(&comment); @@ -2206,15 +2204,15 @@ nsDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) } NS_IMETHODIMP -nsDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) +nsDocument::CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -nsDocument::CreateProcessingInstruction(const nsString& aTarget, - const nsString& aData, +nsDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn) { // Should be implemented by subclass @@ -2222,7 +2220,7 @@ nsDocument::CreateProcessingInstruction(const nsString& aTarget, } NS_IMETHODIMP -nsDocument::CreateAttribute(const nsString& aName, +nsDocument::CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -2243,7 +2241,7 @@ nsDocument::CreateAttribute(const nsString& aName, } NS_IMETHODIMP -nsDocument::CreateEntityReference(const nsString& aName, +nsDocument::CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn) { // Should be implemented by subclass @@ -2251,7 +2249,7 @@ nsDocument::CreateEntityReference(const nsString& aName, } NS_IMETHODIMP -nsDocument::GetElementsByTagName(const nsString& aTagname, +nsDocument::GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { nsCOMPtr nameAtom = dont_AddRef(NS_NewAtom(aTagname)); @@ -2263,8 +2261,8 @@ nsDocument::GetElementsByTagName(const nsString& aTagname, } NS_IMETHODIMP -nsDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsCOMPtr nameAtom; @@ -2274,7 +2272,7 @@ nsDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, nsContentList* list = nsnull; - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId); if (nameSpaceId == kNameSpaceID_Unknown) { @@ -2310,14 +2308,14 @@ nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets) } NS_IMETHODIMP -nsDocument::GetCharacterSet(nsString& aCharacterSet) +nsDocument::GetCharacterSet(nsAWritableString& aCharacterSet) { return GetDocumentCharacterSet(aCharacterSet); } NS_IMETHODIMP -nsDocument::CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, +nsDocument::CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn) { *aReturn = nsnull; @@ -2336,7 +2334,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) +nsDocument::AddBinding(nsIDOMElement* aContent, const nsAReadableString& aURL) { nsCOMPtr bm; GetBindingManager(getter_AddRefs(bm)); @@ -2346,7 +2344,7 @@ nsDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) +nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAReadableString& aURL) { if (mBindingManager) { nsCOMPtr content(do_QueryInterface(aContent)); @@ -2357,7 +2355,7 @@ nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsDocument::LoadBindingDocument(const nsString& aURL) +nsDocument::LoadBindingDocument(const nsAReadableString& aURL) { if (mBindingManager) return mBindingManager->LoadBindingDocument(this, aURL); @@ -2454,7 +2452,7 @@ nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView) NS_IMETHODIMP -nsDocument::Load (const nsString& aUrl) +nsDocument::Load (const nsAReadableString& aUrl) { // Should be implemented by subclass return NS_ERROR_NOT_IMPLEMENTED; @@ -2497,21 +2495,21 @@ nsDocument::GetPlugins(nsIDOMPluginArray** aPlugins) // nsIDOMNode methods // NS_IMETHODIMP -nsDocument::GetNodeName(nsString& aNodeName) +nsDocument::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#document"); + aNodeName.Assign(NS_LITERAL_STRING("#document")); return NS_OK; } NS_IMETHODIMP -nsDocument::GetNodeValue(nsString& aNodeValue) +nsDocument::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocument::SetNodeValue(const nsString& aNodeValue) +nsDocument::SetNodeValue(const nsAReadableString& aNodeValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -2627,27 +2625,27 @@ nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes) } NS_IMETHODIMP -nsDocument::GetNamespaceURI(nsString& aNamespaceURI) +nsDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocument::GetPrefix(nsString& aPrefix) +nsDocument::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocument::SetPrefix(const nsString& aPrefix) +nsDocument::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsDocument::GetLocalName(nsString& aLocalName) +nsDocument::GetLocalName(nsAWritableString& aLocalName) { aLocalName.Truncate(); return NS_OK; @@ -2930,7 +2928,7 @@ nsDocument::Normalize() } NS_IMETHODIMP -nsDocument::Supports(const nsString& aFeature, const nsString& aVersion, +nsDocument::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); @@ -3044,7 +3042,7 @@ nsresult nsDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, co return NS_ERROR_FAILURE; } -nsresult nsDocument::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, +nsresult nsDocument::AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { nsIEventListenerManager *manager; @@ -3059,7 +3057,7 @@ nsresult nsDocument::AddEventListener(const nsString& aType, nsIDOMEventListener return NS_ERROR_FAILURE; } -nsresult nsDocument::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, +nsresult nsDocument::RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { if (nsnull != mListenerManager) { @@ -3094,7 +3092,7 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent) } NS_IMETHODIMP -nsDocument::CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn) +nsDocument::CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aReturn) { // Obtain a presentation context PRInt32 count = GetNumberOfShells(); @@ -3275,7 +3273,7 @@ void nsDocument::Finalize(JSContext *aContext, JSObject *aObj) /** * Finds text in content */ -NS_IMETHODIMP nsDocument::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) +NS_IMETHODIMP nsDocument::FindNext(const nsAReadableString& aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) { aIsFound = PR_FALSE; return NS_ERROR_FAILURE; @@ -3365,7 +3363,7 @@ nsDocument::ToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode) } NS_IMETHODIMP -nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) +nsDocument::CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection) { nsresult result=NS_OK; @@ -3380,25 +3378,25 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) if (aSelection) converter->SetSelection(aSelection); - converter->AddStartTag( NS_ConvertToString("section") , PR_TRUE); - converter->AddStartTag( NS_ConvertToString("section_head") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section_head") , PR_TRUE); - converter->BeginStartTag( NS_ConvertToString("document_info") ); - converter->AddAttribute(NS_ConvertToString("charset"),mCharacterSet); + converter->BeginStartTag( NS_LITERAL_STRING("document_info") ); + converter->AddAttribute(NS_LITERAL_STRING("charset"),mCharacterSet); nsCOMPtr uri (getter_AddRefs(GetDocumentURL())); if (uri) { char* spec = 0; if (NS_SUCCEEDED(uri->GetSpec(&spec)) && spec) { - converter->AddAttribute(NS_ConvertToString("uri"), NS_ConvertToString(spec)); + converter->AddAttribute(NS_LITERAL_STRING("uri"), NS_ConvertToString(spec)); Recycle(spec); } } - converter->FinishStartTag(NS_ConvertToString("document_info"),PR_TRUE,PR_TRUE); + converter->FinishStartTag(NS_LITERAL_STRING("document_info"),PR_TRUE,PR_TRUE); - converter->AddEndTag(NS_ConvertToString("section_head"), PR_TRUE, PR_TRUE); - converter->AddStartTag(NS_ConvertToString("section_body"), PR_TRUE); + converter->AddEndTag(NS_LITERAL_STRING("section_head"), PR_TRUE, PR_TRUE); + converter->AddStartTag(NS_LITERAL_STRING("section_body"), PR_TRUE); nsCOMPtr doctype; GetDoctype(getter_AddRefs(doctype)); @@ -3408,28 +3406,28 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) doctype->GetName(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion("DOCTYPE "); + docTypeStr.Append(NS_LITERAL_STRING("DOCTYPE ")); docTypeStr.Append(tmpStr); doctype->GetPublicId(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion(" PUBLIC \""); + docTypeStr.Append(NS_LITERAL_STRING(" PUBLIC \"")); docTypeStr.Append(tmpStr); - docTypeStr.AppendWithConversion('"'); + docTypeStr.Append(PRUnichar('"')); } doctype->GetSystemId(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion(" SYSTEM \""); + docTypeStr.Append(NS_LITERAL_STRING(" SYSTEM \"")); docTypeStr.Append(tmpStr); - docTypeStr.AppendWithConversion('"'); + docTypeStr.Append(PRUnichar('"')); } doctype->GetInternalSubset(tmpStr); if (tmpStr.Length()) { - docTypeStr.AppendWithConversion(" [\n"); + docTypeStr.Append(NS_LITERAL_STRING(" [\n")); docTypeStr.Append(tmpStr); - docTypeStr.AppendWithConversion("\n]"); + docTypeStr.Append(NS_LITERAL_STRING("\n]")); } } if (docTypeStr.Length()) diff --git a/layout/base/src/nsDocument.h b/layout/base/src/nsDocument.h index 1fb3cba71d5b..d29875f36c3f 100644 --- a/layout/base/src/nsDocument.h +++ b/layout/base/src/nsDocument.h @@ -74,7 +74,7 @@ protected: class nsDocHeaderData { public: - nsDocHeaderData(nsIAtom* aField, const nsString& aData) + nsDocHeaderData(nsIAtom* aField, const nsAReadableString& aData) { mField = aField; NS_IF_ADDREF(mField); @@ -177,7 +177,7 @@ public: /** * Return the content (mime) type of this document. */ - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; /** * Return the LoadGroup for the document. May return null. @@ -193,8 +193,8 @@ public: * Return a standard name for the document's character set. This will * trigger a startDocumentLoad if necessary to answer the question. */ - NS_IMETHOD GetDocumentCharacterSet(nsString& oCharsetID); - NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID); + NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharsetID); + NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID); /** * Add an observer that gets notified whenever the charset changes. @@ -218,8 +218,8 @@ public: * Access HTTP header data (this may also get set from other sources, like * HTML META tags). */ - NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const; - NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData); + NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const; + NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData); /** * Create a new presentation shell that will use aContext for @@ -350,14 +350,14 @@ public: /** * Finds text in content */ - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); /** * Converts the document or a selection of the * document to XIF (XML Interchange Format) * and places the result in aBuffer. */ - NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection); + NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection); NS_IMETHOD ToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode); virtual void BeginConvertToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode); virtual void ConvertChildrenToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode); @@ -378,26 +378,26 @@ public: NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation); NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement); - NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn); + NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn); NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn); - NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn); - NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn); - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); - NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn); - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn); - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn); + NS_IMETHOD CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn); + NS_IMETHOD CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn); + NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn); + NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn); + NS_IMETHOD CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn); + NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn); + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn); + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn); NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets); - NS_IMETHOD GetCharacterSet(nsString& aCharacterSet); + NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet); NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, + NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn); NS_IMETHOD CreateRange(nsIDOMRange** aReturn); - NS_IMETHOD Load (const nsString& aUrl); + NS_IMETHOD Load (const nsAReadableString& aUrl); NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); // nsIDOMNode interface @@ -434,9 +434,9 @@ public: NS_IMETHOD IncrementModCount(PRInt32 aNumMods); // nsIDOMEventTarget interface - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); diff --git a/layout/base/src/nsDocumentEncoder.cpp b/layout/base/src/nsDocumentEncoder.cpp index e2ca0c73c546..713f1a584f9e 100644 --- a/layout/base/src/nsDocumentEncoder.cpp +++ b/layout/base/src/nsDocumentEncoder.cpp @@ -54,7 +54,7 @@ public: nsTextEncoder(); virtual ~nsTextEncoder(); - NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags); + NS_IMETHOD Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 aFlags); /* Interfaces for addref and release and queryinterface */ NS_DECL_ISUPPORTS @@ -62,10 +62,10 @@ public: // Inherited methods from nsIDocumentEncoder NS_IMETHOD SetSelection(nsIDOMSelection* aSelection); NS_IMETHOD SetWrapColumn(PRUint32 aWC); - NS_IMETHOD SetCharset(const nsString& aCharset); + NS_IMETHOD SetCharset(const nsAReadableString& aCharset); NS_IMETHOD EncodeToStream(nsIOutputStream* aStream); - NS_IMETHOD EncodeToString(nsString& aOutputString); + NS_IMETHOD EncodeToString(nsAWritableString& aOutputString); protected: // Local methods to the text encoder -- used to be in nsITextEncoder, @@ -104,7 +104,7 @@ nsTextEncoder::~nsTextEncoder() } NS_IMETHODIMP -nsTextEncoder::Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags) +nsTextEncoder::Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 aFlags) { if (!aDocument) return NS_ERROR_INVALID_ARG; @@ -156,14 +156,14 @@ nsTextEncoder::SetSelection(nsIDOMSelection* aSelection) } NS_IMETHODIMP -nsTextEncoder::SetCharset(const nsString& aCharset) +nsTextEncoder::SetCharset(const nsAReadableString& aCharset) { mCharset = aCharset; return NS_OK; } NS_IMETHODIMP -nsTextEncoder::EncodeToString(nsString& aOutputString) +nsTextEncoder::EncodeToString(nsAWritableString& aOutputString) { nsresult rv; diff --git a/layout/base/src/nsDocumentFragment.cpp b/layout/base/src/nsDocumentFragment.cpp index 245f9239d119..04ac4313a283 100644 --- a/layout/base/src/nsDocumentFragment.cpp +++ b/layout/base/src/nsDocumentFragment.cpp @@ -49,9 +49,9 @@ public: NS_DECL_ISUPPORTS // interface nsIDOMDocumentFragment - NS_IMETHOD GetNodeName(nsString& aNodeName); - NS_IMETHOD GetNodeValue(nsString& aNodeValue); - NS_IMETHOD SetNodeValue(const nsString& aNodeValue); + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue); + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue); NS_IMETHOD GetNodeType(PRUint16* aNodeType); NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) { @@ -93,12 +93,12 @@ public: NS_IMETHOD HasChildNodes(PRBool* aReturn) { return mInner.HasChildNodes(aReturn); } NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD GetPrefix(nsString& aPrefix); - NS_IMETHOD SetPrefix(const nsString& aPrefix); - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI); - NS_IMETHOD GetLocalName(nsString& aLocalName); + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix); + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix); + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI); + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName); NS_IMETHOD Normalize(); - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion, + NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); // interface nsIScriptObjectOwner @@ -106,7 +106,7 @@ public: NS_IMETHOD SetScriptObject(void* aScriptObject); // interface nsIContent - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { aName = nsnull; @@ -166,18 +166,18 @@ public: NS_IMETHOD IsSynthetic(PRBool& aResult) { return mInner.IsSynthetic(aResult); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const + nsAWritableString& aResult) const { return NS_CONTENT_ATTR_NOT_THERE; } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return NS_CONTENT_ATTR_NOT_THERE; } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) @@ -352,21 +352,21 @@ nsDocumentFragment::QueryInterface(REFNSIID aIID, void** aInstancePtr) } NS_IMETHODIMP -nsDocumentFragment::GetNodeName(nsString& aNodeName) +nsDocumentFragment::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#document-fragment"); + aNodeName.Assign(NS_ConvertASCIItoUCS2("#document-fragment")); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::GetNodeValue(nsString& aNodeValue) +nsDocumentFragment::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::SetNodeValue(const nsString& aNodeValue) +nsDocumentFragment::SetNodeValue(const nsAReadableString& aNodeValue) { // The node value can't be modified return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; @@ -392,27 +392,27 @@ nsDocumentFragment::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } NS_IMETHODIMP -nsDocumentFragment::GetNamespaceURI(nsString& aNamespaceURI) +nsDocumentFragment::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::GetPrefix(nsString& aPrefix) +nsDocumentFragment::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; } NS_IMETHODIMP -nsDocumentFragment::SetPrefix(const nsString& aPrefix) +nsDocumentFragment::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NAMESPACE_ERR; } NS_IMETHODIMP -nsDocumentFragment::GetLocalName(nsString& aLocalName) +nsDocumentFragment::GetLocalName(nsAWritableString& aLocalName) { return GetNodeName(aLocalName); } @@ -438,7 +438,7 @@ nsDocumentFragment::Normalize() NS_IMETHODIMP -nsDocumentFragment::Supports(const nsString& aFeature, const nsString& aVersion, +nsDocumentFragment::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); diff --git a/layout/base/src/nsGenericDOMDataNode.cpp b/layout/base/src/nsGenericDOMDataNode.cpp index 66f88f04831d..badbdaef5688 100644 --- a/layout/base/src/nsGenericDOMDataNode.cpp +++ b/layout/base/src/nsGenericDOMDataNode.cpp @@ -32,7 +32,7 @@ #include "nsTextContentChangeData.h" #include "nsIDOMSelection.h" #include "nsIEnumerator.h" - +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsIEventStateManager.h" @@ -79,14 +79,14 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode() } nsresult -nsGenericDOMDataNode::GetNodeValue(nsString& aNodeValue) +nsGenericDOMDataNode::GetNodeValue(nsAWritableString& aNodeValue) { return GetData(aNodeValue); } nsresult nsGenericDOMDataNode::SetNodeValue(nsIContent *aOuterContent, - const nsString& aNodeValue) + const nsAReadableString& aNodeValue) { return SetData(aOuterContent, aNodeValue); } @@ -215,21 +215,21 @@ nsGenericDOMDataNode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } nsresult -nsGenericDOMDataNode::GetNamespaceURI(nsString& aNamespaceURI) +nsGenericDOMDataNode::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; } nsresult -nsGenericDOMDataNode::GetPrefix(nsString& aPrefix) +nsGenericDOMDataNode::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; } nsresult -nsGenericDOMDataNode::SetPrefix(const nsString& aPrefix) +nsGenericDOMDataNode::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NAMESPACE_ERR; } @@ -241,8 +241,8 @@ nsGenericDOMDataNode::Normalize() } nsresult -nsGenericDOMDataNode::Supports(const nsString& aFeature, - const nsString& aVersion, +nsGenericDOMDataNode::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn); @@ -268,19 +268,19 @@ nsGenericDOMDataNode::Equals(nsIDOMNode* aNode, PRBool aDeep, PRBool* aReturn) // Implementation of nsIDOMCharacterData nsresult -nsGenericDOMDataNode::GetData(nsString& aData) +nsGenericDOMDataNode::GetData(nsAWritableString& aData) { if (mText.Is2b()) { aData.Assign(mText.Get2b(), mText.GetLength()); } else { - aData.AssignWithConversion(mText.Get1b(), mText.GetLength()); + aData.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength())); } return NS_OK; } nsresult -nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsString& aData) +nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsAReadableString& aData) { // inform any enclosed ranges of change // we can lie and say we are deleting all the text, since in a total @@ -294,13 +294,10 @@ nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsString& aData) // If possible, let the container content object have a go at it. if (NS_SUCCEEDED(result)) { - result = textContent->SetText(aData.GetUnicode(), - aData.Length(), - PR_TRUE); + result = textContent->SetText(aData, PR_TRUE); } else { - result = SetText(aOuterContent, aData.GetUnicode(), aData.Length(), - PR_TRUE); + result = SetText(aOuterContent, aData, PR_TRUE); } return result; @@ -316,7 +313,7 @@ nsGenericDOMDataNode::GetLength(PRUint32* aLength) nsresult nsGenericDOMDataNode::SubstringData(PRUint32 aStart, PRUint32 aCount, - nsString& aReturn) + nsAWritableString& aReturn) { aReturn.Truncate(); @@ -334,7 +331,7 @@ nsGenericDOMDataNode::SubstringData(PRUint32 aStart, aReturn.Assign(mText.Get2b() + aStart, amount); } else { - aReturn.AssignWithConversion(mText.Get1b() + aStart, amount); + aReturn.Assign(NS_ConvertASCIItoUCS2(mText.Get1b() + aStart, amount), amount); } return NS_OK; @@ -344,12 +341,12 @@ nsGenericDOMDataNode::SubstringData(PRUint32 aStart, nsresult nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent, - const nsString& aData) + const nsAReadableString& aData) { #if 1 // Allocate new buffer nsresult result = NS_OK; - PRInt32 dataLength = aData.Length(); + PRUint32 dataLength = aData.Length(); PRInt32 textLength = mText.GetLength(); PRInt32 newSize = textLength + dataLength; PRUnichar* to = new PRUnichar[newSize + 1]; @@ -363,8 +360,7 @@ nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent, if (textLength) { mText.CopyTo(to, 0, textLength); } - nsCRT::memcpy(to + textLength, aData.GetUnicode(), - sizeof(PRUnichar) * dataLength); + CopyUnicodeTo(aData, to + textLength, dataLength); // Null terminate the new buffer... to[newSize] = (PRUnichar)0; @@ -405,7 +401,7 @@ nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent, nsresult nsGenericDOMDataNode::InsertData(nsIContent *aOuterContent, PRUint32 aOffset, - const nsString& aData) + const nsAReadableString& aData) { return ReplaceData(aOuterContent, aOffset, 0, aData); } @@ -420,7 +416,7 @@ nsGenericDOMDataNode::DeleteData(nsIContent *aOuterContent, PRUint32 aOffset, nsresult nsGenericDOMDataNode::ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset, - PRUint32 aCount, const nsString& aData) + PRUint32 aCount, const nsAReadableString& aData) { nsresult result = NS_OK; @@ -452,8 +448,7 @@ nsGenericDOMDataNode::ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset, mText.CopyTo(to, 0, aOffset); } if (0 != dataLength) { - nsCRT::memcpy(to + aOffset, aData.GetUnicode(), - sizeof(PRUnichar) * dataLength); + CopyUnicodeTo(aData, to+aOffset, dataLength); } if (endOffset != textLength) { mText.CopyTo(to + aOffset + dataLength, endOffset, textLength - endOffset); @@ -599,7 +594,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, continue; // This range doesn't intersect the node at all // Put all of our text into the buffer, initially: - nsString buffer; + nsAutoString buffer; mText.AppendTo(buffer); // Clip to whatever is inside the range: @@ -640,7 +635,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, } else { - nsString buffer; + nsAutoString buffer; mText.AppendTo(buffer); aConverter->AddContent(buffer); } @@ -648,7 +643,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent, } void -nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset, +nsGenericDOMDataNode::ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const { if (mText.Is2b()) { @@ -657,15 +652,15 @@ nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset, while (cp < end) { PRUnichar ch = *cp++; if (ch == '\r') { - aBuf.AppendWithConversion("\\r"); + aBuf.Append(NS_LITERAL_STRING("\\r")); } else if (ch == '\n') { - aBuf.AppendWithConversion("\\n"); + aBuf.Append(NS_LITERAL_STRING("\\n")); } else if (ch == '\t') { - aBuf.AppendWithConversion("\\t"); + aBuf.Append(NS_LITERAL_STRING("\\t")); } else if ((ch < ' ') || (ch >= 127)) { char buf[10]; PR_snprintf(buf, sizeof(buf), "\\u%04x", ch); - aBuf.AppendWithConversion(buf); + aBuf.Append(NS_ConvertASCIItoUCS2(buf)); } else { aBuf.Append(ch); } @@ -677,15 +672,15 @@ nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset, while (cp < end) { PRUnichar ch = *cp++; if (ch == '\r') { - aBuf.AppendWithConversion("\\r"); + aBuf.Append(NS_LITERAL_STRING("\\r")); } else if (ch == '\n') { - aBuf.AppendWithConversion("\\n"); + aBuf.Append(NS_LITERAL_STRING("\\n")); } else if (ch == '\t') { - aBuf.AppendWithConversion("\\t"); + aBuf.Append(NS_LITERAL_STRING("\\t")); } else if ((ch < ' ') || (ch >= 127)) { char buf[10]; PR_snprintf(buf, sizeof(buf), "\\u%04x", ch); - aBuf.AppendWithConversion(buf); + aBuf.Append(NS_ConvertASCIItoUCS2(buf)); } else { aBuf.Append(ch); } @@ -1008,13 +1003,14 @@ nsGenericDOMDataNode::GetTextLength(PRInt32* aLengthResult) } nsresult -nsGenericDOMDataNode::CopyText(nsString& aResult) +nsGenericDOMDataNode::CopyText(nsAWritableString& aResult) { if (mText.Is2b()) { aResult.Assign(mText.Get2b(), mText.GetLength()); } else { - aResult.AssignWithConversion(mText.Get1b(), mText.GetLength()); + aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()), + mText.GetLength()); } return NS_OK; } @@ -1069,6 +1065,23 @@ nsGenericDOMDataNode::SetText(nsIContent *aOuterContent, const char* aBuffer, return NS_OK; } +nsresult +nsGenericDOMDataNode::SetText(nsIContent *aOuterContent, + const nsAReadableString& aStr, + PRBool aNotify) +{ + if (aNotify && (nsnull != mDocument)) { + mDocument->BeginUpdate(); + } + mText = aStr; + + // Trigger a reflow + if (aNotify && (nsnull != mDocument)) { + mDocument->ContentChanged(aOuterContent, nsnull); + mDocument->EndUpdate(); + } + return NS_OK; +} nsresult nsGenericDOMDataNode::IsOnlyWhitespace(PRBool* aResult) diff --git a/layout/base/src/nsGenericDOMDataNode.h b/layout/base/src/nsGenericDOMDataNode.h index c77415f11ec0..ff365f896a14 100644 --- a/layout/base/src/nsGenericDOMDataNode.h +++ b/layout/base/src/nsGenericDOMDataNode.h @@ -57,9 +57,9 @@ struct nsGenericDOMDataNode { virtual ~nsGenericDOMDataNode(); // Implementation for nsIDOMNode - nsresult GetNodeValue(nsString& aNodeValue); + nsresult GetNodeValue(nsAWritableString& aNodeValue); nsresult SetNodeValue(nsIContent *aOuterContent, - const nsString& aNodeValue); + const nsAReadableString& aNodeValue); nsresult GetParentNode(nsIDOMNode** aParentNode); nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes) { NS_ENSURE_ARG_POINTER(aAttributes); @@ -119,25 +119,25 @@ struct nsGenericDOMDataNode { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument); - nsresult GetNamespaceURI(nsString& aNamespaceURI); - nsresult GetPrefix(nsString& aPrefix); - nsresult SetPrefix(const nsString& aPrefix); + nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI); + nsresult GetPrefix(nsAWritableString& aPrefix); + nsresult SetPrefix(const nsAReadableString& aPrefix); nsresult Normalize(); - nsresult Supports(const nsString& aFeature, const nsString& aVersion, + nsresult Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); // Implementation for nsIDOMCharacterData - nsresult GetData(nsString& aData); - nsresult SetData(nsIContent *aOuterContent, const nsString& aData); + nsresult GetData(nsAWritableString& aData); + nsresult SetData(nsIContent *aOuterContent, const nsAReadableString& aData); nsresult GetLength(PRUint32* aLength); - nsresult SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn); - nsresult AppendData(nsIContent *aOuterContent, const nsString& aArg); + nsresult SubstringData(PRUint32 aOffset, PRUint32 aCount, nsAWritableString& aReturn); + nsresult AppendData(nsIContent *aOuterContent, const nsAReadableString& aArg); nsresult InsertData(nsIContent *aOuterContent, PRUint32 aOffset, - const nsString& aArg); + const nsAReadableString& aArg); nsresult DeleteData(nsIContent *aOuterContent, PRUint32 aOffset, PRUint32 aCount); nsresult ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset, - PRUint32 aCount, const nsString& aArg); + PRUint32 aCount, const nsAReadableString& aArg); // nsIScriptObjectOwner interface @@ -158,7 +158,7 @@ struct nsGenericDOMDataNode { aID = kNameSpaceID_None; return NS_OK; } - nsresult ParseAttributeString(const nsString& aStr, + nsresult ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { aName = nsnull; @@ -170,21 +170,21 @@ struct nsGenericDOMDataNode { aPrefix = nsnull; return NS_OK; } - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } - nsresult SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; } - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const { + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAWritableString& aResult) const { return NS_CONTENT_ATTR_NOT_THERE; } - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const { + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsAWritableString& aResult) const { aPrefix = nsnull; return NS_CONTENT_ATTR_NOT_THERE; } @@ -257,11 +257,14 @@ struct nsGenericDOMDataNode { nsresult GetText(const nsTextFragment** aFragmentsResult); nsresult GetTextLength(PRInt32* aLengthResult); - nsresult CopyText(nsString& aResult); + nsresult CopyText(nsAWritableString& aResult); nsresult SetText(nsIContent *aOuterContent, const PRUnichar* aBuffer, PRInt32 aLength, PRBool aNotify); + nsresult SetText(nsIContent *aOuterContent, + const nsAReadableString& aStr, + PRBool aNotify); nsresult SetText(nsIContent *aOuterContent, const char* aBuffer, PRInt32 aLength, @@ -272,7 +275,7 @@ struct nsGenericDOMDataNode { nsresult GetListenerManager(nsIContent* aOuterContent, nsIEventListenerManager** aInstancePtrResult); - void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; + void ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; nsIDocument* mDocument; nsIContent* mParent; @@ -296,14 +299,14 @@ struct nsGenericDOMDataNode { * NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); */ #define NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(_g) \ - NS_IMETHOD GetNodeName(nsString& aNodeName); \ - NS_IMETHOD GetLocalName(nsString& aLocalName) { \ + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); \ + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \ return GetNodeName(aLocalName); \ } \ - NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \ + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \ return _g.GetNodeValue(aNodeValue); \ } \ - NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \ + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { \ return _g.SetNodeValue(this, aNodeValue); \ } \ NS_IMETHOD GetNodeType(PRUint16* aNodeType); \ @@ -348,48 +351,48 @@ struct nsGenericDOMDataNode { NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { \ return _g.GetOwnerDocument(aOwnerDocument); \ } \ - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI) { \ + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI) { \ return _g.GetNamespaceURI(aNamespaceURI); \ } \ - NS_IMETHOD GetPrefix(nsString& aPrefix) { \ + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { \ return _g.GetPrefix(aPrefix); \ } \ - NS_IMETHOD SetPrefix(const nsString& aPrefix) { \ + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { \ return _g.SetPrefix(aPrefix); \ } \ NS_IMETHOD Normalize() { \ return NS_OK; \ } \ - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion,\ + NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,\ PRBool* aReturn) { \ return _g.Supports(aFeature, aVersion, aReturn); \ } \ NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); #define NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(_g) \ - NS_IMETHOD GetData(nsString& aData) { \ + NS_IMETHOD GetData(nsAWritableString& aData) { \ return _g.GetData(aData); \ } \ - NS_IMETHOD SetData(const nsString& aData) { \ + NS_IMETHOD SetData(const nsAReadableString& aData) { \ return _g.SetData(this, aData); \ } \ NS_IMETHOD GetLength(PRUint32* aLength) { \ return _g.GetLength(aLength); \ } \ - NS_IMETHOD SubstringData(PRUint32 aStart, PRUint32 aEnd, nsString& aReturn) { \ + NS_IMETHOD SubstringData(PRUint32 aStart, PRUint32 aEnd, nsAWritableString& aReturn) { \ return _g.SubstringData(aStart, aEnd, aReturn); \ } \ - NS_IMETHOD AppendData(const nsString& aData) { \ + NS_IMETHOD AppendData(const nsAReadableString& aData) { \ return _g.AppendData(this, aData); \ } \ - NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aData) { \ + NS_IMETHOD InsertData(PRUint32 aOffset, const nsAReadableString& aData) { \ return _g.InsertData(this, aOffset, aData); \ } \ NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount) { \ return _g.DeleteData(this, aOffset, aCount); \ } \ NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, \ - const nsString& aData) { \ + const nsAReadableString& aData) { \ return _g.ReplaceData(this, aOffset, aCount, aData); \ } @@ -417,12 +420,12 @@ struct nsGenericDOMDataNode { NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent) { \ return _g.HandleEvent(aEvent); \ } \ - NS_IMETHOD AddEventListener(const nsString& aType, \ + NS_IMETHOD AddEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.AddEventListener(aType, aListener, aUseCapture); \ } \ - NS_IMETHOD RemoveEventListener(const nsString& aType, \ + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.RemoveEventListener(aType, aListener, aUseCapture); \ @@ -489,7 +492,7 @@ struct nsGenericDOMDataNode { } \ NS_IMETHOD GetTag(nsIAtom*& aResult) const; \ NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const; \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -499,19 +502,19 @@ struct nsGenericDOMDataNode { return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \ - nsString &aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aAttribute, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \ - nsIAtom*& aPrefix, nsString &aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -589,7 +592,7 @@ struct nsGenericDOMDataNode { NS_IMETHOD GetTextLength(PRInt32* aLengthResult) { \ return mInner.GetTextLength(aLengthResult); \ } \ - NS_IMETHOD CopyText(nsString& aResult) { \ + NS_IMETHOD CopyText(nsAWritableString& aResult) { \ return mInner.CopyText(aResult); \ } \ NS_IMETHOD SetText(const PRUnichar* aBuffer, \ @@ -597,6 +600,10 @@ struct nsGenericDOMDataNode { PRBool aNotify){ \ return mInner.SetText(this, aBuffer, aLength, aNotify); \ } \ + NS_IMETHOD SetText(const nsAReadableString& aStr, \ + PRBool aNotify){ \ + return mInner.SetText(this, aStr, aNotify); \ + } \ NS_IMETHOD SetText(const char* aBuffer, \ PRInt32 aLength, \ PRBool aNotify){ \ diff --git a/layout/base/src/nsGenericElement.cpp b/layout/base/src/nsGenericElement.cpp index eabed3eccfb7..c0538a919d23 100644 --- a/layout/base/src/nsGenericElement.cpp +++ b/layout/base/src/nsGenericElement.cpp @@ -486,14 +486,14 @@ nsGenericElement::Init(nsIContent* aOuterContentObject, } nsresult -nsGenericElement::GetNodeValue(nsString& aNodeValue) +nsGenericElement::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } nsresult -nsGenericElement::SetNodeValue(const nsString& aNodeValue) +nsGenericElement::SetNodeValue(const nsAReadableString& aNodeValue) { // The node value can't be modified return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; @@ -614,19 +614,19 @@ nsGenericElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } nsresult -nsGenericElement::GetNamespaceURI(nsString& aNamespaceURI) +nsGenericElement::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return mNodeInfo->GetNamespaceURI(aNamespaceURI); } nsresult -nsGenericElement::GetPrefix(nsString& aPrefix) +nsGenericElement::GetPrefix(nsAWritableString& aPrefix) { return mNodeInfo->GetPrefix(aPrefix); } nsresult -nsGenericElement::SetPrefix(const nsString& aPrefix) +nsGenericElement::SetPrefix(const nsAReadableString& aPrefix) { // XXX: Validate the prefix string! @@ -649,30 +649,31 @@ nsGenericElement::SetPrefix(const nsString& aPrefix) } nsresult -nsGenericElement::InternalSupports(const nsString& aFeature, - const nsString& aVersion, +nsGenericElement::InternalSupports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = PR_FALSE; + nsAutoString feature(aFeature); - if (aFeature.EqualsWithConversion("XML", PR_TRUE) || - aFeature.EqualsWithConversion("HTML", PR_TRUE)) { + if (feature.EqualsWithConversion("XML", PR_TRUE) || + feature.EqualsWithConversion("HTML", PR_TRUE)) { if (!aVersion.Length() || - aVersion.EqualsWithConversion("1.0") || - aVersion.EqualsWithConversion("2.0")) { + aVersion.Equals(NS_LITERAL_STRING("1.0")) || + aVersion.Equals(NS_LITERAL_STRING("2.0"))) { *aReturn = PR_TRUE; } - } else if (aFeature.EqualsWithConversion("Views", PR_TRUE) || - aFeature.EqualsWithConversion("StyleSheets", PR_TRUE) || - aFeature.EqualsWithConversion("CSS", PR_TRUE) || -// aFeature.EqualsWithConversion("CSS2", PR_TRUE) || - aFeature.EqualsWithConversion("Events", PR_TRUE) || -// aFeature.EqualsWithConversion("UIEvents", PR_TRUE) || - aFeature.EqualsWithConversion("MouseEvents", PR_TRUE) || - aFeature.EqualsWithConversion("HTMLEvents", PR_TRUE) || - aFeature.EqualsWithConversion("Range", PR_TRUE)) { - if (!aVersion.Length() || aVersion.EqualsWithConversion("2.0")) { + } else if (feature.EqualsWithConversion("Views", PR_TRUE) || + feature.EqualsWithConversion("StyleSheets", PR_TRUE) || + feature.EqualsWithConversion("CSS", PR_TRUE) || +// feature.EqualsWithConversion("CSS2", PR_TRUE) || + feature.EqualsWithConversion("Events", PR_TRUE) || +// feature.EqualsWithConversion("UIEvents", PR_TRUE) || + feature.EqualsWithConversion("MouseEvents", PR_TRUE) || + feature.EqualsWithConversion("HTMLEvents", PR_TRUE) || + feature.EqualsWithConversion("Range", PR_TRUE)) { + if (!aVersion.Length() || aVersion.Equals(NS_LITERAL_STRING("2.0"))) { *aReturn = PR_TRUE; } } @@ -681,7 +682,7 @@ nsGenericElement::InternalSupports(const nsString& aFeature, } nsresult -nsGenericElement::Supports(const nsString& aFeature, const nsString& aVersion, +nsGenericElement::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return InternalSupports(aFeature, aVersion, aReturn); @@ -706,7 +707,7 @@ nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes) } nsresult -nsGenericElement::GetTagName(nsString& aTagName) +nsGenericElement::GetTagName(nsAWritableString& aTagName) { aTagName.Truncate(); if (mNodeInfo) { @@ -716,7 +717,7 @@ nsGenericElement::GetTagName(nsString& aTagName) } nsresult -nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn) +nsGenericElement::GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { nsCOMPtr nameAtom(dont_AddRef(NS_NewAtom(aName))); @@ -726,13 +727,13 @@ nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn) } nsresult -nsGenericElement::SetAttribute(const nsString& aName, - const nsString& aValue) +nsGenericElement::SetAttribute(const nsAReadableString& aName, + const nsAReadableString& aValue) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp); } @@ -755,12 +756,12 @@ nsGenericElement::SetAttribute(const nsString& aName, } nsresult -nsGenericElement::RemoveAttribute(const nsString& aName) +nsGenericElement::RemoveAttribute(const nsAReadableString& aName) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp); } @@ -783,7 +784,7 @@ nsGenericElement::RemoveAttribute(const nsString& aName) } nsresult -nsGenericElement::GetAttributeNode(const nsString& aName, +nsGenericElement::GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { if (nsnull == aReturn) { @@ -864,7 +865,7 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute, } nsresult -nsGenericElement::GetElementsByTagName(const nsString& aTagname, +nsGenericElement::GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { nsIAtom* nameAtom; @@ -874,7 +875,7 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname, if (kStrictDOMLevel2) { PRInt32 pos = aTagname.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aTagname); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aTagname)); printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp); } @@ -901,8 +902,8 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname, } nsresult -nsGenericElement::GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) +nsGenericElement::GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { nsCOMPtr name(dont_AddRef(NS_NewAtom(aLocalName))); PRInt32 nsid; @@ -930,9 +931,9 @@ nsGenericElement::GetAttributeNS(const nsString& aNamespaceURI, } nsresult -nsGenericElement::SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) +nsGenericElement::SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { nsCOMPtr nimgr; mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); @@ -948,8 +949,8 @@ nsGenericElement::SetAttributeNS(const nsString& aNamespaceURI, nsresult -nsGenericElement::RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) +nsGenericElement::RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { nsCOMPtr name(dont_AddRef(NS_NewAtom(aLocalName))); PRInt32 nsid; @@ -977,8 +978,8 @@ nsGenericElement::RemoveAttributeNS(const nsString& aNamespaceURI, } nsresult -nsGenericElement::GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsGenericElement::GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1029,8 +1030,8 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr, } nsresult -nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsGenericElement::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsCOMPtr nameAtom(dont_AddRef(NS_NewAtom(aLocalName))); @@ -1038,7 +1039,7 @@ nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, nsContentList* list = nsnull; - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { nsCOMPtr nimgr; mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE); @@ -1065,7 +1066,7 @@ nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, } nsresult -nsGenericElement::HasAttribute(const nsString& aName, PRBool* aReturn) +nsGenericElement::HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1080,8 +1081,8 @@ nsGenericElement::HasAttribute(const nsString& aName, PRBool* aReturn) } nsresult -nsGenericElement::HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) +nsGenericElement::HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1679,7 +1680,7 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext, nsCOMPtr elt(do_QueryInterface(mContent)); viewCSS->GetComputedStyle(elt, empty, getter_AddRefs(cssDecl)); if (cssDecl) { - nsAutoString behavior; behavior.AssignWithConversion("behavior"); + nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("behavior")); nsAutoString value; cssDecl->GetPropertyValue(behavior, value); if (!value.IsEmpty()) { @@ -1777,7 +1778,7 @@ nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, js propName.Assign(NS_REINTERPRET_CAST(const PRUnichar*, JS_GetStringChars(JS_ValueToString(aContext, aID)))); if (propName.Length() > 2) prefix.Assign(propName.GetUnicode(), 2); - if (prefix.EqualsWithConversion("on")) { + if (prefix.Equals(NS_LITERAL_STRING("on"))) { nsCOMPtr atom = getter_AddRefs(NS_NewAtom(propName)); nsIEventListenerManager *manager = nsnull; @@ -2423,7 +2424,7 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext, nsresult nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, REFNSIID aIID) { nsresult ret = NS_OK; @@ -2504,7 +2505,7 @@ nsGenericElement::CutNameSpacePrefix(nsString& aString) struct nsGenericAttribute { - nsGenericAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue) + nsGenericAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue) : mNodeInfo(aNodeInfo), mValue(aValue) { @@ -2671,7 +2672,7 @@ nsGenericContainerElement::GetLastChild(nsIDOMNode** aNode) nsresult nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult rv; @@ -2689,7 +2690,7 @@ nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsresult nsGenericContainerElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -2750,7 +2751,7 @@ nsGenericContainerElement::SetAttribute(nsINodeInfo* aNodeInfo, nsresult nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const + nsAWritableString& aResult) const { nsCOMPtr prefix; return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult); @@ -2759,7 +2760,7 @@ nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsresult nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, - nsString& aResult) const + nsAWritableString& aResult) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); if (nsnull == aName) { @@ -2777,7 +2778,7 @@ nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, attr->mNodeInfo->NamespaceEquals(aNameSpaceID)) && (attr->mNodeInfo->Equals(aName))) { attr->mNodeInfo->GetPrefixAtom(aPrefix); - aResult = attr->mValue; + aResult.Assign(attr->mValue); if (0 < aResult.Length()) { rv = NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/layout/base/src/nsGenericElement.h b/layout/base/src/nsGenericElement.h index 1b4f42295eef..b189263a0002 100644 --- a/layout/base/src/nsGenericElement.h +++ b/layout/base/src/nsGenericElement.h @@ -131,49 +131,49 @@ public: void Init(nsIContent* aOuterContentObject, nsINodeInfo *aNodeInfo); // Implementation for nsIDOMNode - nsresult GetNodeValue(nsString& aNodeValue); - nsresult SetNodeValue(const nsString& aNodeValue); + nsresult GetNodeValue(nsAWritableString& aNodeValue); + nsresult SetNodeValue(const nsAReadableString& aNodeValue); nsresult GetNodeType(PRUint16* aNodeType); nsresult GetParentNode(nsIDOMNode** aParentNode); nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes); nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling); nsresult GetNextSibling(nsIDOMNode** aNextSibling); nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument); - nsresult GetNamespaceURI(nsString& aNamespaceURI); - nsresult GetPrefix(nsString& aPrefix); - nsresult SetPrefix(const nsString& aPrefix); + nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI); + nsresult GetPrefix(nsAWritableString& aPrefix); + nsresult SetPrefix(const nsAReadableString& aPrefix); nsresult Normalize(); - nsresult Supports(const nsString& aFeature, - const nsString& aVersion, PRBool* aReturn); + nsresult Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn); // Implementation for nsIDOMElement - nsresult GetTagName(nsString& aTagName); - nsresult GetAttribute(const nsString& aName, nsString& aReturn); - nsresult SetAttribute(const nsString& aName, const nsString& aValue); - nsresult RemoveAttribute(const nsString& aName); - nsresult GetAttributeNode(const nsString& aName, + nsresult GetTagName(nsAWritableString& aTagName); + nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn); + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue); + nsresult RemoveAttribute(const nsAReadableString& aName); + nsresult GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn); nsresult SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); nsresult RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn); - nsresult GetElementsByTagName(const nsString& aTagname, + nsresult GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn); - nsresult GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn); - nsresult SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue); - nsresult RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName); - nsresult GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + nsresult GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn); + nsresult SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue); + nsresult RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName); + nsresult GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn); nsresult SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); - nsresult GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + nsresult GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn); - nsresult HasAttribute(const nsString& aName, PRBool* aReturn); - nsresult HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn); + nsresult HasAttribute(const nsAReadableString& aName, PRBool* aReturn); + nsresult HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn); // nsIScriptObjectOwner interface nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -251,7 +251,7 @@ public: nsresult RenderFrame(nsIPresContext*); nsresult AddScriptEventListener(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, REFNSIID aIID); nsresult TriggerLink(nsIPresContext* aPresContext, @@ -273,8 +273,8 @@ public: static nsIAtom* CutNameSpacePrefix(nsString& aString); - static nsresult InternalSupports(const nsString& aFeature, - const nsString& aVersion, PRBool* aReturn); + static nsresult InternalSupports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn); nsDOMSlots *GetDOMSlots(); void MaybeClearDOMSlots(); @@ -303,11 +303,11 @@ public: PRBool aDeep); // Remainder of nsIDOMHTMLElement (and nsIDOMNode) - nsresult GetAttribute(const nsString& aName, nsString& aReturn) + nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return nsGenericElement::GetAttribute(aName, aReturn); } - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericElement::SetAttribute(aName, aValue); } @@ -337,14 +337,14 @@ public: // Remainder of nsIContent nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const; + nsAWritableString& aResult) const; nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const; + nsIAtom*& aPrefix, nsAWritableString& aResult) const; nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify); nsresult GetAttributeNameAt(PRInt32 aIndex, @@ -386,13 +386,13 @@ public: * NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); */ #define NS_IMPL_IDOMNODE_USING_GENERIC(_g) \ - NS_IMETHOD GetNodeName(nsString& aNodeName) { \ + NS_IMETHOD GetNodeName(nsAWritableString& aNodeName) { \ return _g.GetNodeName(aNodeName); \ } \ - NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \ + NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \ return _g.GetNodeValue(aNodeValue); \ } \ - NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \ + NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { \ return _g.SetNodeValue(aNodeValue); \ } \ NS_IMETHOD GetNodeType(PRUint16* aNodeType) { \ @@ -422,16 +422,16 @@ public: NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { \ return _g.GetAttributes(aAttributes); \ } \ - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI) { \ + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI) { \ return _g.GetNamespaceURI(aNamespaceURI); \ } \ - NS_IMETHOD GetPrefix(nsString& aPrefix) { \ + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { \ return _g.GetPrefix(aPrefix); \ } \ - NS_IMETHOD SetPrefix(const nsString& aPrefix) { \ + NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { \ return _g.SetPrefix(aPrefix); \ } \ - NS_IMETHOD GetLocalName(nsString& aLocalName) { \ + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \ return _g.GetLocalName(aLocalName); \ } \ NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, \ @@ -455,8 +455,8 @@ public: NS_IMETHOD Normalize() { \ return _g.Normalize(); \ } \ - NS_IMETHOD Supports(const nsString& aFeature, \ - const nsString& aVersion, PRBool* aReturn) { \ + NS_IMETHOD Supports(const nsAReadableString& aFeature, \ + const nsAReadableString& aVersion, PRBool* aReturn) { \ return _g.Supports(aFeature, aVersion, aReturn); \ } @@ -466,19 +466,19 @@ public: * nsGenericHTMLContainerContent) */ #define NS_IMPL_IDOMELEMENT_USING_GENERIC(_g) \ - NS_IMETHOD GetTagName(nsString& aTagName) { \ + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { \ return _g.GetTagName(aTagName); \ } \ - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { \ + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { \ return _g.GetAttribute(aName, aReturn); \ } \ - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { \ + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { \ return _g.SetAttribute(aName, aValue); \ } \ - NS_IMETHOD RemoveAttribute(const nsString& aName) { \ + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { \ return _g.RemoveAttribute(aName); \ } \ - NS_IMETHOD GetAttributeNode(const nsString& aName, \ + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, \ nsIDOMAttr** aReturn) { \ return _g.GetAttributeNode(aName, aReturn); \ } \ @@ -488,41 +488,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {\ return _g.RemoveAttributeNode(aOldAttr, aReturn); \ } \ - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, \ + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, \ nsIDOMNodeList** aReturn) { \ return _g.GetElementsByTagName(aTagname, aReturn); \ } \ - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, nsString& aReturn) { \ + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { \ return _g.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); \ } \ - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aQualifiedName, \ - const nsString& aValue) { \ + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aQualifiedName, \ + const nsAReadableString& aValue) { \ return _g.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); \ } \ - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName) { \ + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName) { \ return _g.RemoveAttributeNS(aNamespaceURI, aLocalName); \ } \ - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, \ + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, \ nsIDOMAttr** aReturn) { \ return _g.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); \ } \ NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { \ return _g.SetAttributeNodeNS(aNewAttr, aReturn); \ } \ - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, \ + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, \ nsIDOMNodeList** aReturn) { \ return _g.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); \ } \ - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { \ + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { \ return _g.HasAttribute(aName, aReturn); \ } \ - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, \ - const nsString& aLocalName, PRBool* aReturn) { \ + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, \ + const nsAReadableString& aLocalName, PRBool* aReturn) { \ return _g.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); \ } @@ -549,12 +549,12 @@ public: NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent) { \ return _g.HandleEvent(aEvent); \ } \ - NS_IMETHOD AddEventListener(const nsString& aType, \ + NS_IMETHOD AddEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.AddEventListener(aType, aListener, aUseCapture); \ } \ - NS_IMETHOD RemoveEventListener(const nsString& aType, \ + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, \ nsIDOMEventListener* aListener, \ PRBool aUseCapture) { \ return _g.RemoveEventListener(aType, aListener, aUseCapture); \ @@ -611,7 +611,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -621,19 +621,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -750,7 +750,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -760,19 +760,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -889,7 +889,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -899,19 +899,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -1026,7 +1026,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -1036,19 +1036,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -1167,7 +1167,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -1177,19 +1177,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ @@ -1300,7 +1300,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \ return _g.GetNodeInfo(aResult); \ } \ - NS_IMETHOD ParseAttributeString(const nsString& aStr, \ + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \ nsIAtom*& aName, \ PRInt32& aNameSpaceID) { \ return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \ @@ -1310,19 +1310,19 @@ public: return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \ } \ NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \ } \ NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \ - const nsString& aValue, PRBool aNotify) { \ + const nsAReadableString& aValue, PRBool aNotify) { \ return _g.SetAttribute(aNodeInfo, aValue, aNotify); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsString& aResult) const { \ + nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aResult); \ } \ NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \ - nsIAtom*& aPrefix, nsString& aResult) const { \ + nsIAtom*& aPrefix, nsAWritableString& aResult) const { \ return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \ } \ NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \ diff --git a/layout/base/src/nsNameSpaceManager.cpp b/layout/base/src/nsNameSpaceManager.cpp index 34844cf646d8..70e09972ec44 100644 --- a/layout/base/src/nsNameSpaceManager.cpp +++ b/layout/base/src/nsNameSpaceManager.cpp @@ -45,8 +45,6 @@ static PRInt32 gNameSpaceTableRefs; static nsHashtable* gURIToIDTable; static nsVoidArray* gURIArray; -MOZ_DECL_CTOR_COUNTER(NameSpaceURIKey); - static void AddRefTable() { if (0 == gNameSpaceTableRefs++) { @@ -96,7 +94,7 @@ static void ReleaseTable() } } -static PRInt32 FindNameSpaceID(const nsString& aURI) +static PRInt32 FindNameSpaceID(const nsAReadableString& aURI) { NS_ASSERTION(nsnull != gURIToIDTable, "no URI table"); nsStringKey key(aURI); @@ -121,7 +119,7 @@ public: NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, - const nsString& aURI); + const nsAReadableString& aURI); NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, @@ -133,7 +131,7 @@ public: NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const; NS_IMETHOD GetNameSpaceID(PRInt32& aID) const; - NS_IMETHOD GetNameSpaceURI(nsString& aURI) const; + NS_IMETHOD GetNameSpaceURI(nsAWritableString& aURI) const; NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const; NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const; @@ -142,7 +140,7 @@ public: NS_IMETHOD FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const; NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const; - NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI, + NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsAReadableString& aURI, nsINameSpace*& aChildNameSpace); NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID, nsINameSpace*& aChildNameSpace); @@ -162,7 +160,7 @@ public: NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, - const nsString& aURI) + const nsAReadableString& aURI) : mManager(aManager), mParent(aParent), mPrefix(aPrefix) @@ -217,7 +215,7 @@ NameSpaceImpl::GetNameSpaceID(PRInt32& aID) const } NS_IMETHODIMP -NameSpaceImpl::GetNameSpaceURI(nsString& aURI) const +NameSpaceImpl::GetNameSpaceURI(nsAWritableString& aURI) const { NS_ASSERTION(nsnull != mManager, "null namespace manager"); return mManager->GetNameSpaceURI(mID, aURI); @@ -295,7 +293,7 @@ NameSpaceImpl::FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) cons } NS_IMETHODIMP -NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI, +NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsAReadableString& aURI, nsINameSpace*& aChildNameSpace) { NameSpaceImpl* child = new NameSpaceImpl(mManager, this, aPrefix, aURI); @@ -335,11 +333,11 @@ public: NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace); - NS_IMETHOD RegisterNameSpace(const nsString& aURI, + NS_IMETHOD RegisterNameSpace(const nsAReadableString& aURI, PRInt32& aNameSpaceID); - NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI); - NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID); + NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI); + NS_IMETHOD GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID); private: // These are not supported and are not implemented! @@ -384,7 +382,7 @@ NameSpaceManagerImpl::CreateRootNameSpace(nsINameSpace*& aRootNameSpace) } NS_IMETHODIMP -NameSpaceManagerImpl::RegisterNameSpace(const nsString& aURI, +NameSpaceManagerImpl::RegisterNameSpace(const nsAReadableString& aURI, PRInt32& aNameSpaceID) { PRInt32 id = FindNameSpaceID(aURI); @@ -401,7 +399,7 @@ NameSpaceManagerImpl::RegisterNameSpace(const nsString& aURI, } NS_IMETHODIMP -NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) +NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI) { const nsString* result = FindNameSpaceURI(aNameSpaceID); if (nsnull != result) { @@ -413,7 +411,7 @@ NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) } NS_IMETHODIMP -NameSpaceManagerImpl::GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID) +NameSpaceManagerImpl::GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID) { aNameSpaceID = FindNameSpaceID(aURI); return NS_OK; diff --git a/layout/base/src/nsNodeInfo.cpp b/layout/base/src/nsNodeInfo.cpp index 076ac291a3e2..77617097d61b 100644 --- a/layout/base/src/nsNodeInfo.cpp +++ b/layout/base/src/nsNodeInfo.cpp @@ -96,7 +96,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS(nsNodeInfo, NS_GET_IID(nsINodeInfo)); // nsINodeInfo NS_IMETHODIMP -nsNodeInfo::GetName(nsString& aName) +nsNodeInfo::GetName(nsAWritableString& aName) { NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED); @@ -117,7 +117,7 @@ nsNodeInfo::GetNameAtom(nsIAtom*& aAtom) NS_IMETHODIMP -nsNodeInfo::GetQualifiedName(nsString& aQualifiedName) +nsNodeInfo::GetQualifiedName(nsAWritableString& aQualifiedName) { NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED); @@ -133,7 +133,7 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName) aQualifiedName.Append(name); if (kStrictDOMLevel2 && mInner.mPrefix) { - nsCAutoString tmp; tmp.AssignWithConversion(aQualifiedName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aQualifiedName)); printf ("Possible DOM Error: .name, .nodeName or .tagName requested on a namespace element/attribute with the qulaified name '%s', is this OK?\n", (const char *)tmp); } @@ -142,7 +142,7 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName) NS_IMETHODIMP -nsNodeInfo::GetLocalName(nsString& aLocalName) +nsNodeInfo::GetLocalName(nsAWritableString& aLocalName) { NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED); @@ -161,7 +161,7 @@ nsNodeInfo::GetLocalName(nsString& aLocalName) NS_IMETHODIMP -nsNodeInfo::GetPrefix(nsString& aPrefix) +nsNodeInfo::GetPrefix(nsAWritableString& aPrefix) { if (mInner.mPrefix) { mInner.mPrefix->ToString(aPrefix); @@ -184,7 +184,7 @@ nsNodeInfo::GetPrefixAtom(nsIAtom*& aAtom) NS_IMETHODIMP -nsNodeInfo::GetNamespaceURI(nsString& aNameSpaceURI) +nsNodeInfo::GetNamespaceURI(nsAWritableString& aNameSpaceURI) { NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED); nsresult rv = NS_OK; @@ -234,7 +234,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom) NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName) +nsNodeInfo::Equals(const nsAReadableString& aName) { if (!mInner.mName) return PR_FALSE; @@ -253,7 +253,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix) +nsNodeInfo::Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix) { if (!mInner.mName) return PR_FALSE; @@ -275,7 +275,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName, PRInt32 aNamespaceID) +nsNodeInfo::Equals(const nsAReadableString& aName, PRInt32 aNamespaceID) { if (!mInner.mName) return PR_FALSE; @@ -297,7 +297,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom, NS_IMETHODIMP_(PRBool) -nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix, +nsNodeInfo::Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID) { if (!mInner.mName) return PR_FALSE; @@ -321,7 +321,7 @@ nsNodeInfo::NamespaceEquals(PRInt32 aNamespaceID) NS_IMETHODIMP_(PRBool) -nsNodeInfo::NamespaceEquals(const nsString& aNamespaceURI) +nsNodeInfo::NamespaceEquals(const nsAReadableString& aNamespaceURI) { NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED); nsCOMPtr nsmgr; diff --git a/layout/base/src/nsNodeInfo.h b/layout/base/src/nsNodeInfo.h index dc2730481528..db5ee44452a9 100644 --- a/layout/base/src/nsNodeInfo.h +++ b/layout/base/src/nsNodeInfo.h @@ -65,29 +65,29 @@ public: NS_DECL_ISUPPORTS // nsINodeInfo - NS_IMETHOD GetName(nsString& aName); + NS_IMETHOD GetName(nsAWritableString& aName); NS_IMETHOD GetNameAtom(nsIAtom*& aAtom); - NS_IMETHOD GetQualifiedName(nsString& aQualifiedName); - NS_IMETHOD GetLocalName(nsString& aLocalName); - NS_IMETHOD GetPrefix(nsString& aPrefix); + NS_IMETHOD GetQualifiedName(nsAWritableString& aQualifiedName); + NS_IMETHOD GetLocalName(nsAWritableString& aLocalName); + NS_IMETHOD GetPrefix(nsAWritableString& aPrefix); NS_IMETHOD GetPrefixAtom(nsIAtom*& aAtom); - NS_IMETHOD GetNamespaceURI(nsString& aNameSpaceURI); + NS_IMETHOD GetNamespaceURI(nsAWritableString& aNameSpaceURI); NS_IMETHOD GetNamespaceID(PRInt32& aResult); NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom); - NS_IMETHOD_(PRBool) Equals(const nsString& aName); + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom); - NS_IMETHOD_(PRBool) Equals(const nsString& aName, - const nsString& aPrefix); + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, + const nsAReadableString& aPrefix); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID); - NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID); + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, PRInt32 aNamespaceID); NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom, PRInt32 aNamespaceID); - NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID); NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID); - NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI); + NS_IMETHOD_(PRBool) NamespaceEquals(const nsAReadableString& aNamespaceURI); NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult); NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult); diff --git a/layout/base/src/nsNodeInfoManager.cpp b/layout/base/src/nsNodeInfoManager.cpp index 702a8f7da1a0..392dc58ebdce 100644 --- a/layout/base/src/nsNodeInfoManager.cpp +++ b/layout/base/src/nsNodeInfoManager.cpp @@ -149,7 +149,7 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aName.Length()); @@ -162,7 +162,7 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aName.Length()); @@ -182,8 +182,8 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, - const nsString& aNamespaceURI, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aName.Length()); @@ -214,8 +214,8 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix, NS_IMETHODIMP -nsNodeInfoManager::GetNodeInfo(const nsString& aQualifiedName, - const nsString& aNamespaceURI, +nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aQualifiedName, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo) { NS_ENSURE_ARG(aQualifiedName.Length()); diff --git a/layout/base/src/nsNodeInfoManager.h b/layout/base/src/nsNodeInfoManager.h index f8585b59ccb6..131200be872f 100644 --- a/layout/base/src/nsNodeInfoManager.h +++ b/layout/base/src/nsNodeInfoManager.h @@ -40,15 +40,15 @@ public: NS_IMETHOD Init(nsINameSpaceManager *aNameSpaceManager); NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aName, nsIAtom *aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo); - NS_IMETHOD GetNodeInfo(const nsString& aQualifiedName, - const nsString& aNamespaceURI, + NS_IMETHOD GetNodeInfo(const nsAReadableString& aQualifiedName, + const nsAReadableString& aNamespaceURI, nsINodeInfo*& aNodeInfo); NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager); diff --git a/layout/base/src/nsPresState.cpp b/layout/base/src/nsPresState.cpp index 411ad3c6cc47..23ae965ec567 100644 --- a/layout/base/src/nsPresState.cpp +++ b/layout/base/src/nsPresState.cpp @@ -12,11 +12,11 @@ class nsPresState: public nsIPresState { NS_DECL_ISUPPORTS - NS_IMETHOD GetStatePropertyAsSupports(const nsString& aName, nsISupports** aResult); - NS_IMETHOD SetStatePropertyAsSupports(const nsString& aName, nsISupports* aValue); + NS_IMETHOD GetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports** aResult); + NS_IMETHOD SetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports* aValue); - NS_IMETHOD GetStateProperty(const nsString& aProperty, nsString& aResult); - NS_IMETHOD SetStateProperty(const nsString& aProperty, const nsString& aValue); + NS_IMETHOD GetStateProperty(const nsAReadableString& aProperty, nsAWritableString& aResult); + NS_IMETHOD SetStateProperty(const nsAReadableString& aProperty, const nsAReadableString& aValue); public: nsPresState(); @@ -56,18 +56,20 @@ nsPresState::~nsPresState(void) // nsIPresState Interface //////////////////////////////////////////////////////////////// NS_IMETHODIMP -nsPresState::GetStateProperty(const nsString& aName, nsString& aResult) +nsPresState::GetStateProperty(const nsAReadableString& aName, + nsAWritableString& aResult) { // Retrieve from hashtable. nsCOMPtr str; - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); if (mPropertyTable) str = dont_AddRef(NS_STATIC_CAST(nsISupportsWString*, mPropertyTable->Get(&key))); if (str) { PRUnichar* data; str->GetData(&data); - aResult = data; + aResult.Append(data); nsMemory::Free(data); } else { aResult.SetLength(0); @@ -76,31 +78,32 @@ nsPresState::GetStateProperty(const nsString& aName, nsString& aResult) } NS_IMETHODIMP -nsPresState::SetStateProperty(const nsString& aName, const nsString& aValue) +nsPresState::SetStateProperty(const nsAReadableString& aName, const nsAReadableString& aValue) { if (!mPropertyTable) mPropertyTable = new nsSupportsHashtable(8); // Add to hashtable - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); nsCOMPtr supportsStr; nsresult rv = nsComponentManager::CreateInstance(NS_SUPPORTS_WSTRING_PROGID, nsnull, NS_GET_IID(nsISupportsWString), getter_AddRefs(supportsStr)); - PRUnichar* val = aValue.ToNewUnicode(); - supportsStr->SetData(val); - nsMemory::Free(val); + supportsStr->SetData(nsPromiseFlatString(aValue)); + mPropertyTable->Put(&key, supportsStr); return NS_OK; } NS_IMETHODIMP -nsPresState::GetStatePropertyAsSupports(const nsString& aName, nsISupports** aResult) +nsPresState::GetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports** aResult) { // Retrieve from hashtable. nsCOMPtr supp; - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); if (mPropertyTable) supp = dont_AddRef(NS_STATIC_CAST(nsISupports*, mPropertyTable->Get(&key))); @@ -110,13 +113,14 @@ nsPresState::GetStatePropertyAsSupports(const nsString& aName, nsISupports** aRe } NS_IMETHODIMP -nsPresState::SetStatePropertyAsSupports(const nsString& aName, nsISupports* aValue) +nsPresState::SetStatePropertyAsSupports(const nsAReadableString& aName, nsISupports* aValue) { if (!mPropertyTable) mPropertyTable = new nsSupportsHashtable(8); // Add to hashtable - nsStringKey key(aName); + nsAutoString keyStr(aName); + nsStringKey key(keyStr); mPropertyTable->Put(&key, aValue); return NS_OK; } diff --git a/layout/base/src/nsRange.cpp b/layout/base/src/nsRange.cpp index 7c7ec19457b2..c115374aa1a8 100644 --- a/layout/base/src/nsRange.cpp +++ b/layout/base/src/nsRange.cpp @@ -1559,7 +1559,7 @@ nsresult nsRange::InsertNode(nsIDOMNode* aN) nsresult nsRange::SurroundContents(nsIDOMNode* aN) { return NS_ERROR_NOT_IMPLEMENTED; } -nsresult nsRange::ToString(nsString& aReturn) +nsresult nsRange::ToString(nsAWritableString& aReturn) { nsCOMPtr cStart( do_QueryInterface(mStartParent) ); nsCOMPtr cEnd( do_QueryInterface(mEndParent) ); @@ -1851,7 +1851,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged, // nsIDOMNSRange interface NS_IMETHODIMP -nsRange::CreateContextualFragment(const nsString& aFragment, +nsRange::CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn) { nsresult result = NS_OK; @@ -1924,7 +1924,7 @@ nsRange::CreateContextualFragment(const nsString& aFragment, } else { // Who're we kidding. This only works for html. - contentType.AssignWithConversion("text/html"); + contentType.Assign(NS_LITERAL_STRING("text/html")); } result = parser->ParseFragment(aFragment, (void*)0, @@ -1957,7 +1957,7 @@ nsRange::CreateContextualFragment(const nsString& aFragment, } NS_IMETHODIMP -nsRange::IsValidFragment(const nsString& aFragment, PRBool* aReturn) +nsRange::IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn) { nsresult result = NS_OK; nsCOMPtr parser; diff --git a/layout/base/src/nsRange.h b/layout/base/src/nsRange.h index 709bd1187b2f..c9089e13c7b8 100644 --- a/layout/base/src/nsRange.h +++ b/layout/base/src/nsRange.h @@ -88,12 +88,12 @@ public: NS_IMETHOD Clone(nsIDOMRange** aReturn); - NS_IMETHOD ToString(nsString& aReturn); + NS_IMETHOD ToString(nsAWritableString& aReturn); /*BEGIN nsIDOMNSRange interface implementations*/ - NS_IMETHOD CreateContextualFragment(const nsString& aFragment, + NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn); - NS_IMETHOD IsValidFragment(const nsString& aFragment, PRBool* aReturn); + NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn); NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aResult); diff --git a/layout/base/src/nsSelection.cpp b/layout/base/src/nsSelection.cpp index 264f88a06d90..04d32e04d117 100644 --- a/layout/base/src/nsSelection.cpp +++ b/layout/base/src/nsSelection.cpp @@ -147,7 +147,7 @@ public: NS_IMETHOD RemoveSelectionListener(nsIDOMSelectionListener* aListenerToRemove); NS_IMETHOD GetEnumerator(nsIEnumerator **aIterator); - NS_IMETHOD ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn); + NS_IMETHOD ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn); NS_IMETHOD SetHint(PRBool aHintRight); NS_IMETHOD GetHint(PRBool *aHintRight); @@ -1528,10 +1528,10 @@ nsSelection::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) //BEGIN nsIFrameSelection methods NS_IMETHODIMP -nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn) +nsDOMSelection::ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn) { nsresult rv = NS_OK; - + nsCOMPtr encoder; nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE ); formatType.AppendWithConversion(aFormatType); @@ -4342,7 +4342,7 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) content->GetTag(tag); if (tag) { - nsString tagString; + nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); @@ -5158,7 +5158,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) content->GetTag(tag); if (tag) { - nsString tagString; + nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); diff --git a/layout/base/src/nsTextFragment.cpp b/layout/base/src/nsTextFragment.cpp index 43ea0a63c3b9..fad38cd3065c 100644 --- a/layout/base/src/nsTextFragment.cpp +++ b/layout/base/src/nsTextFragment.cpp @@ -22,6 +22,8 @@ #include "nsTextFragment.h" #include "nsString.h" #include "nsCRT.h" +#include "nsReadableUtils.h" +#include "nsMemory.h" nsTextFragment::~nsTextFragment() { @@ -33,10 +35,10 @@ nsTextFragment::ReleaseText() { if (mState.mLength && m1b && mState.mInHeap) { if (mState.mIs2b) { - delete [] m2b; + nsMemory::Free(m2b); } else { - delete [] m1b; + nsMemory::Free(m1b); } } m1b = nsnull; @@ -105,9 +107,24 @@ nsTextFragment::operator=(const PRUnichar* aString) } nsTextFragment& -nsTextFragment::operator=(const nsString& aString) +nsTextFragment::operator=(const nsAReadableString& aString) { - SetTo(aString.GetUnicode(), aString.Length()); + ReleaseText(); + + PRUint32 length = aString.Length(); + if (length > 0) { + if (IsASCII(aString)) { + m1b = NS_REINTERPRET_CAST(unsigned char *, ToNewCString(aString)); + mState.mIs2b = 0; + } + else { + m2b = ToNewUnicode(aString); + mState.mIs2b = 1; + } + mState.mInHeap = 1; + mState.mLength = (PRInt32)length; + } + return *this; } @@ -141,7 +158,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength) if (need2) { // Use ucs2 storage because we have to - PRUnichar* nt = new PRUnichar[aLength]; + PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar)); if (nsnull != nt) { // Copy data nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength); @@ -155,7 +172,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength) } else { // Use 1 byte storage because we can - unsigned char* nt = new unsigned char[aLength]; + unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); if (nsnull != nt) { // Copy data unsigned char* cp = nt; @@ -179,7 +196,7 @@ nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength) { ReleaseText(); if (0 != aLength) { - unsigned char* nt = new unsigned char[aLength]; + unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); if (nsnull != nt) { nsCRT::memcpy(nt, aBuffer, sizeof(unsigned char) * aLength); diff --git a/layout/base/src/nsTextNode.cpp b/layout/base/src/nsTextNode.cpp index e480b9669434..35419ac60d41 100644 --- a/layout/base/src/nsTextNode.cpp +++ b/layout/base/src/nsTextNode.cpp @@ -135,9 +135,9 @@ nsTextNode::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsTextNode::GetNodeName(nsString& aNodeName) +nsTextNode::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#text"); + aNodeName.Assign(NS_LITERAL_STRING("#text")); return NS_OK; } diff --git a/layout/base/src/nsXIFConverter.cpp b/layout/base/src/nsXIFConverter.cpp index 00fc1f840125..8c7587b2cc51 100644 --- a/layout/base/src/nsXIFConverter.cpp +++ b/layout/base/src/nsXIFConverter.cpp @@ -23,7 +23,7 @@ #include "nsXIFConverter.h" #include #include "nsIDOMSelection.h" - +#include "nsReadableUtils.h" MOZ_DECL_CTOR_COUNTER(nsXIFConverter); @@ -59,16 +59,16 @@ nsXIFConverter::~nsXIFConverter() NS_IMETHODIMP -nsXIFConverter::Init(nsString &aBuffer) +nsXIFConverter::Init(nsAWritableString& aBuffer) { + // XXX This is wrong. It violates XPCOM string ownership rules. + // We're only getting away with this because instances of this + // class are restricted to single function scope. mBuffer = &aBuffer; NS_ENSURE_ARG_POINTER(mBuffer); - char* prolog = "\n"; - char* doctype = "\n"; - - mBuffer->AppendWithConversion(prolog); - mBuffer->AppendWithConversion(doctype); + mBuffer->Append(NS_LITERAL_STRING("\n")); + mBuffer->Append(NS_LITERAL_STRING("\n")); mAttr.AssignWithConversion("attr"); mName.AssignWithConversion("name"); @@ -132,7 +132,7 @@ nsXIFConverter::GetSelection(nsIDOMSelection** aSelection) NS_IMETHODIMP -nsXIFConverter::BeginStartTag(const nsString& aTag) +nsXIFConverter::BeginStartTag(const nsAReadableString& aTag) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); // Make all element names lowercase @@ -160,7 +160,7 @@ nsXIFConverter::BeginStartTag(nsIAtom* aTag) } NS_IMETHODIMP -nsXIFConverter::AddAttribute(const nsString& aName, const nsString& aValue) +nsXIFConverter::AddAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); // Make all attribute names lowercase @@ -178,7 +178,7 @@ nsXIFConverter::AddAttribute(const nsString& aName, const nsString& aValue) } NS_IMETHODIMP -nsXIFConverter::AddHTMLAttribute(const nsString& aName, const nsString& aValue) +nsXIFConverter::AddHTMLAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); BeginStartTag(mAttr); @@ -190,7 +190,7 @@ nsXIFConverter::AddHTMLAttribute(const nsString& aName, const nsString& aValue) NS_IMETHODIMP -nsXIFConverter::AddAttribute(const nsString& aName, nsIAtom* aValue) +nsXIFConverter::AddAttribute(const nsAReadableString& aName, nsIAtom* aValue) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); nsAutoString value(mNULL); @@ -203,7 +203,7 @@ nsXIFConverter::AddAttribute(const nsString& aName, nsIAtom* aValue) } NS_IMETHODIMP -nsXIFConverter::AddAttribute(const nsString& aName) +nsXIFConverter::AddAttribute(const nsAReadableString& aName) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); // A convention in XML DTD's is that ATTRIBUTE @@ -230,7 +230,7 @@ nsXIFConverter::AddAttribute(nsIAtom* aName) NS_IMETHODIMP -nsXIFConverter::FinishStartTag(const nsString& aTag, PRBool aIsEmpty, PRBool aAddReturn) +nsXIFConverter::FinishStartTag(const nsAReadableString& aTag, PRBool aIsEmpty, PRBool aAddReturn) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); if (aIsEmpty) @@ -261,7 +261,7 @@ nsXIFConverter::FinishStartTag(nsIAtom* aTag, PRBool aIsEmpty, PRBool aAddReturn } NS_IMETHODIMP -nsXIFConverter::AddStartTag(const nsString& aTag, PRBool aAddReturn) +nsXIFConverter::AddStartTag(const nsAReadableString& aTag, PRBool aAddReturn) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); BeginStartTag(aTag); @@ -283,7 +283,7 @@ nsXIFConverter::AddStartTag(nsIAtom* aTag, PRBool aAddReturn) NS_IMETHODIMP -nsXIFConverter::AddEndTag(const nsString& aTag, PRBool aDoIndent, PRBool aDoReturn) +nsXIFConverter::AddEndTag(const nsAReadableString& aTag, PRBool aDoIndent, PRBool aDoReturn) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); // A convention in XML DTD's is that ELEMENT @@ -346,7 +346,6 @@ nsXIFConverter::AddMarkupEntity(const PRUnichar aChar, PRBool *aReturn) NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); NS_ENSURE_ARG_POINTER(aReturn); nsAutoString data; - PRBool result = PR_TRUE; switch (aChar) { @@ -368,7 +367,7 @@ nsXIFConverter::AddMarkupEntity(const PRUnichar aChar, PRBool *aReturn) NS_IMETHODIMP -nsXIFConverter::AddContent(const nsString& aContent) +nsXIFConverter::AddContent(const nsAReadableString& aContent) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); nsAutoString tag(mContent); @@ -412,7 +411,7 @@ nsXIFConverter::AddContent(const nsString& aContent) // that would be a content comment. // NS_IMETHODIMP -nsXIFConverter::AddComment(const nsString& aContent) +nsXIFConverter::AddComment(const nsAReadableString& aContent) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); mBuffer->Append(mBeginComment); @@ -427,7 +426,7 @@ nsXIFConverter::AddComment(const nsString& aContent) // in the content sink on the other end when this is parsed. // NS_IMETHODIMP -nsXIFConverter::AddContentComment(const nsString& aContent) +nsXIFConverter::AddContentComment(const nsAReadableString& aContent) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); nsAutoString tag(mComment); @@ -442,7 +441,7 @@ nsXIFConverter::AddContentComment(const nsString& aContent) // not really classified as ** tags ** // NS_IMETHODIMP -nsXIFConverter::AddMarkupDeclaration(const nsString& aContent) +nsXIFConverter::AddMarkupDeclaration(const nsAReadableString& aContent) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); nsAutoString tag(mMarkupDeclarationOpen); @@ -485,7 +484,7 @@ nsXIFConverter::EndContainer(nsIAtom* aTag) NS_IMETHODIMP -nsXIFConverter::BeginContainer(const nsString& aTag) +nsXIFConverter::BeginContainer(const nsAReadableString& aTag) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); nsAutoString container(mContainer); @@ -495,14 +494,15 @@ nsXIFConverter::BeginContainer(const nsString& aTag) FinishStartTag(container,PR_FALSE,PR_FALSE); // Remember if we're inside a script tag: - if (aTag.EqualsWithConversion("script") || aTag.EqualsWithConversion("style")) + if (aTag.Equals(NS_LITERAL_STRING("script")) || + aTag.Equals(NS_LITERAL_STRING("style"))) mInScript = PR_TRUE; return NS_OK; } NS_IMETHODIMP -nsXIFConverter::EndContainer(const nsString& aTag) +nsXIFConverter::EndContainer(const nsAReadableString& aTag) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); nsAutoString container(mContainer); @@ -512,20 +512,21 @@ nsXIFConverter::EndContainer(const nsString& aTag) mBuffer->Append(mLF); // Remember if we're exiting a script tag: - if (aTag.EqualsWithConversion("script") || aTag.EqualsWithConversion("style")) + if (aTag.Equals(NS_LITERAL_STRING("script")) || + aTag.Equals(NS_LITERAL_STRING("style"))) mInScript = PR_FALSE; return NS_OK; } NS_IMETHODIMP -nsXIFConverter::BeginLeaf(const nsString& aTag) +nsXIFConverter::BeginLeaf(const nsAReadableString& aTag) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); // XXX: Complete hack to prevent the style leaf // From being created until the style sheet work // is redone. -- gpk 1/27/99 - if (aTag.EqualsIgnoreCase("STYLE")) + if (nsCRT::strcasecmp(nsPromiseFlatString(aTag), NS_LITERAL_STRING("STYLE")) == 0) return NS_OK; @@ -536,13 +537,13 @@ nsXIFConverter::BeginLeaf(const nsString& aTag) } NS_IMETHODIMP -nsXIFConverter::EndLeaf(const nsString& aTag) +nsXIFConverter::EndLeaf(const nsAReadableString& aTag) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); // XXX: Complete hack to prevent the style leaf // From being created until the style sheet work // is redone. -- gpk 1/27/99 - if (aTag.EqualsIgnoreCase("STYLE")) + if (nsCRT::strcasecmp(nsPromiseFlatString(aTag), NS_LITERAL_STRING("STYLE")) == 0) return NS_OK; @@ -605,7 +606,7 @@ NS_IMETHODIMP nsXIFConverter::EndCSSSelectors() -NS_IMETHODIMP nsXIFConverter::AddCSSSelectors(const nsString& aSelectors) +NS_IMETHODIMP nsXIFConverter::AddCSSSelectors(const nsAReadableString& aSelectors) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); AddAttribute(NS_ConvertToString("selectors"),aSelectors); @@ -635,7 +636,7 @@ NS_IMETHODIMP nsXIFConverter::BeginCSSDeclaration() return NS_OK; } -NS_IMETHODIMP nsXIFConverter::AddCSSDeclaration(const nsString& aName, const nsString& aValue) +NS_IMETHODIMP nsXIFConverter::AddCSSDeclaration(const nsAReadableString& aName, const nsAReadableString& aValue) { NS_ENSURE_TRUE(mBuffer,NS_ERROR_NOT_INITIALIZED); AddAttribute(NS_ConvertToString("property"),aName); @@ -671,7 +672,7 @@ NS_IMETHODIMP nsXIFConverter::WriteDebugFile() { #endif ofstream out(filename); - char* s = mBuffer->ToNewUTF8String(); + char* s = ToNewUTF8String(mBuffer); if (s) { out << s; Recycle(s); diff --git a/layout/base/src/nsXIFConverter.h b/layout/base/src/nsXIFConverter.h index 59dc06c1c0ee..87d1b6db8af5 100644 --- a/layout/base/src/nsXIFConverter.h +++ b/layout/base/src/nsXIFConverter.h @@ -33,7 +33,10 @@ class nsXIFConverter :public nsIXIFConverter private: PRInt32 mIndent; - nsString *mBuffer; + // XXX This is wrong. It violates XPCOM string ownership rules. + // We're only getting away with this because instances of this + // class are restricted to single function scope. + nsAWritableString *mBuffer; nsString mAttr; nsString mName; @@ -73,28 +76,28 @@ public: nsXIFConverter(); virtual ~nsXIFConverter(); - NS_IMETHOD Init(nsString &aBuffer); - NS_IMETHOD BeginStartTag(const nsString& aTag); + NS_IMETHOD Init(nsAWritableString& aBuffer); + NS_IMETHOD BeginStartTag(const nsAReadableString& aTag); NS_IMETHOD BeginStartTag(nsIAtom* aTag); - NS_IMETHOD AddAttribute(const nsString& aName, const nsString& aValue); - NS_IMETHOD AddAttribute(const nsString& aName, nsIAtom* aValue); - NS_IMETHOD AddAttribute(const nsString& aName); + NS_IMETHOD AddAttribute(const nsAReadableString& aName, const nsAReadableString& aValue); + NS_IMETHOD AddAttribute(const nsAReadableString& aName, nsIAtom* aValue); + NS_IMETHOD AddAttribute(const nsAReadableString& aName); NS_IMETHOD AddAttribute(nsIAtom* aName); - //parameters normally: const nsString& aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE - NS_IMETHOD FinishStartTag(const nsString& aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE); + //parameters normally: const nsAReadableString& aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE + NS_IMETHOD FinishStartTag(const nsAReadableString& aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE); //parameters normally: nsIAtom* aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE NS_IMETHOD FinishStartTag(nsIAtom* aTag, PRBool aIsEmpty = PR_FALSE, PRBool aAddReturn = PR_TRUE); // Short-cut for starting a new tag that has no attributes //default aAddReturn to true - NS_IMETHOD AddStartTag(const nsString& aTag, PRBool aAddReturn = PR_TRUE); + NS_IMETHOD AddStartTag(const nsAReadableString& aTag, PRBool aAddReturn = PR_TRUE); //default aAddReturn to true NS_IMETHOD AddStartTag(nsIAtom* aTag, PRBool aAddReturn = PR_TRUE); - //parameter defaults: const nsString& aTag,PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE - NS_IMETHOD AddEndTag(const nsString& aTag, PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE); + //parameter defaults: const nsAReadableString& aTag,PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE + NS_IMETHOD AddEndTag(const nsAReadableString& aTag, PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE); //parameter defaults: nsIAtom* aTag,PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE NS_IMETHOD AddEndTag(nsIAtom* aTag,PRBool aDoIndent = PR_TRUE, PRBool aDoReturn = PR_TRUE); @@ -103,19 +106,19 @@ public: NS_IMETHOD BeginContainer(nsIAtom* aTag); NS_IMETHOD EndContainer(nsIAtom* aTag); - NS_IMETHOD BeginContainer(const nsString& aTag); - NS_IMETHOD EndContainer(const nsString& aTag); + NS_IMETHOD BeginContainer(const nsAReadableString& aTag); + NS_IMETHOD EndContainer(const nsAReadableString& aTag); - NS_IMETHOD BeginLeaf(const nsString& aTag); - NS_IMETHOD EndLeaf(const nsString& aTag); + NS_IMETHOD BeginLeaf(const nsAReadableString& aTag); + NS_IMETHOD EndLeaf(const nsAReadableString& aTag); - NS_IMETHOD AddContent(const nsString& aContent); - NS_IMETHOD AddComment(const nsString& aComment); - NS_IMETHOD AddContentComment(const nsString& aComment); + NS_IMETHOD AddContent(const nsAReadableString& aContent); + NS_IMETHOD AddComment(const nsAReadableString& aComment); + NS_IMETHOD AddContentComment(const nsAReadableString& aComment); - NS_IMETHOD AddMarkupDeclaration(const nsString& aComment); + NS_IMETHOD AddMarkupDeclaration(const nsAReadableString& aComment); - NS_IMETHOD AddHTMLAttribute(const nsString& aName, const nsString& aValue); + NS_IMETHOD AddHTMLAttribute(const nsAReadableString& aName, const nsAReadableString& aValue); NS_IMETHOD BeginCSSStyleSheet(); @@ -125,12 +128,12 @@ public: NS_IMETHOD EndCSSRule(); NS_IMETHOD BeginCSSSelectors(); - NS_IMETHOD AddCSSSelectors(const nsString& aSelectors); + NS_IMETHOD AddCSSSelectors(const nsAReadableString& aSelectors); NS_IMETHOD EndCSSSelectors(); NS_IMETHOD BeginCSSDeclarationList(); NS_IMETHOD BeginCSSDeclaration(); - NS_IMETHOD AddCSSDeclaration(const nsString& aName, const nsString& aValue); + NS_IMETHOD AddCSSDeclaration(const nsAReadableString& aName, const nsAReadableString& aValue); NS_IMETHOD EndCSSDeclaration(); NS_IMETHOD EndCSSDeclarationList(); diff --git a/layout/events/public/nsIEventListenerManager.h b/layout/events/public/nsIEventListenerManager.h index 81a2113843f2..8fd308bbe4d9 100644 --- a/layout/events/public/nsIEventListenerManager.h +++ b/layout/events/public/nsIEventListenerManager.h @@ -67,13 +67,13 @@ public: * Sets events listeners of all types. * @param an event listener */ - virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0; + virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0; /** * Removes events listeners of all types. * @param an event listener */ - virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0; + virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0; /** * Creates a script event listener for the given script object with name mName and function @@ -83,7 +83,7 @@ public: virtual nsresult AddScriptEventListener(nsIScriptContext*aContext, nsIScriptObjectOwner *aScriptObjectOwner, nsIAtom *aName, - const nsString& aFunc, + const nsAReadableString& aFunc, REFNSIID aIID, PRBool aDeferCompilation) = 0; @@ -116,7 +116,7 @@ public: */ virtual nsresult CreateEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - const nsString& aEventType, + const nsAReadableString& aEventType, nsIDOMEvent** aDOMEvent) = 0; /** diff --git a/layout/events/public/nsIPrivateDOMEvent.h b/layout/events/public/nsIPrivateDOMEvent.h index de3bf0e88387..14f97f280f94 100644 --- a/layout/events/public/nsIPrivateDOMEvent.h +++ b/layout/events/public/nsIPrivateDOMEvent.h @@ -55,7 +55,7 @@ public: extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent); extern nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, - const nsString& aEventType, + const nsAReadableString& aEventType, nsEvent *aEvent); #endif // nsIPrivateDOMEvent_h__ diff --git a/layout/events/src/nsDOMEvent.cpp b/layout/events/src/nsDOMEvent.cpp index c8a2881f1a58..74a6cc26ad04 100644 --- a/layout/events/src/nsDOMEvent.cpp +++ b/layout/events/src/nsDOMEvent.cpp @@ -53,7 +53,7 @@ static char* mEventNames[] = { "scroll","overflow", "underflow", "overflowchanged" }; -nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsString& aEventType) { +nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType) { mPresContext = aPresContext; if (mPresContext) NS_ADDREF(mPresContext); @@ -63,15 +63,16 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsSt } else { //Allocate internal event - if (aEventType.EqualsIgnoreCase("MouseEvent")) { + nsAutoString eventType(aEventType); + if (eventType.EqualsIgnoreCase("MouseEvent")) { mEvent = PR_NEWZAP(nsMouseEvent); mEvent->eventStructType = NS_MOUSE_EVENT; } - else if (aEventType.EqualsIgnoreCase("KeyEvent")) { + else if (eventType.EqualsIgnoreCase("KeyEvent")) { mEvent = PR_NEWZAP(nsKeyEvent); mEvent->eventStructType = NS_KEY_EVENT; } - else if (aEventType.EqualsIgnoreCase("HTMLEvent")) { + else if (eventType.EqualsIgnoreCase("HTMLEvent")) { mEvent = PR_NEWZAP(nsEvent); mEvent->eventStructType = NS_EVENT; } @@ -144,12 +145,12 @@ NS_INTERFACE_MAP_BEGIN(nsDOMEvent) NS_INTERFACE_MAP_END // nsIDOMEventInterface -NS_METHOD nsDOMEvent::GetType(nsString& aType) +NS_METHOD nsDOMEvent::GetType(nsAWritableString& aType) { const char* mName = GetEventName(mEvent->message); if (nsnull != mName) { - aType.AssignWithConversion(mName); + aType.Assign(NS_ConvertASCIItoUCS2(mName)); return NS_OK; } @@ -886,7 +887,7 @@ NS_METHOD nsDOMEvent::GetPreventDefault(PRBool* aReturn) } nsresult -nsDOMEvent::SetEventType(const nsString& aEventTypeArg) +nsDOMEvent::SetEventType(const nsAReadableString& aEventTypeArg) { nsAutoString str; str.AssignWithConversion("on"); nsIAtom* atom; @@ -958,7 +959,7 @@ nsDOMEvent::SetEventType(const nsString& aEventTypeArg) } NS_IMETHODIMP -nsDOMEvent::InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg) +nsDOMEvent::InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg) { NS_ENSURE_SUCCESS(SetEventType(aEventTypeArg), NS_ERROR_FAILURE); mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE; @@ -968,13 +969,13 @@ nsDOMEvent::InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBoo } NS_IMETHODIMP -nsDOMEvent::InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg) +nsDOMEvent::InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg) { return NS_ERROR_FAILURE; } NS_IMETHODIMP -nsDOMEvent::InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg) +nsDOMEvent::InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg) { NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE); //mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE; @@ -983,7 +984,7 @@ nsDOMEvent::InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool } NS_IMETHODIMP -nsDOMEvent::InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg) +nsDOMEvent::InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg) { NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE); mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE; @@ -1166,7 +1167,7 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType) nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, - const nsString& aEventType, + const nsAReadableString& aEventType, nsEvent *aEvent) { nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent, aEventType); diff --git a/layout/events/src/nsDOMEvent.h b/layout/events/src/nsDOMEvent.h index 2a81f574be51..dcf6d6652348 100644 --- a/layout/events/src/nsDOMEvent.h +++ b/layout/events/src/nsDOMEvent.h @@ -90,13 +90,13 @@ public: eDOMEvents_overflowchanged }; - nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsString& aEventType); + nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType); virtual ~nsDOMEvent(); NS_DECL_ISUPPORTS // nsIDOMEvent Interface - NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD GetType(nsAWritableString& aType); NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget); NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget); NS_IMETHOD GetEventPhase(PRUint16* aEventPhase); @@ -107,12 +107,12 @@ public: NS_IMETHOD PreventBubble(); NS_IMETHOD PreventCapture(); NS_IMETHOD PreventDefault(); - NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg); + NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg); // nsIDOMUIEvent Interface NS_IMETHOD GetView(nsIDOMAbstractView** aView); NS_IMETHOD GetDetail(PRInt32* aDetail); - NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg); + NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg); // nsIDOMMouseEvent Interface and nsIDOMKeyEvent Interface NS_IMETHOD GetScreenX(PRInt32* aScreenX); @@ -127,8 +127,8 @@ public: NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget); NS_IMETHOD GetCharCode(PRUint32* aCharCode); NS_IMETHOD GetKeyCode(PRUint32* aKeyCode); - NS_IMETHOD InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg); - NS_IMETHOD InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg); + NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg); + NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg); // nsIDOMNSUIEvent interface NS_IMETHOD GetLayerX(PRInt32* aLayerX); @@ -166,7 +166,7 @@ protected: //Internal helper funcs nsresult GetScrollInfo(nsIScrollableView** aScrollableView, float* aP2T, float* aT2P); - nsresult SetEventType(const nsString& aEventTypeArg); + nsresult SetEventType(const nsAReadableString& aEventTypeArg); nsEvent* mEvent; PRBool mEventIsInternal; diff --git a/layout/events/src/nsEventListenerManager.cpp b/layout/events/src/nsEventListenerManager.cpp index cc88385e1252..d69b78bfdc1d 100644 --- a/layout/events/src/nsEventListenerManager.cpp +++ b/layout/events/src/nsEventListenerManager.cpp @@ -511,7 +511,7 @@ nsresult nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType, nsIID& aI } nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener, - const nsString& aType, PRInt32 aFlags) + const nsAReadableString& aType, PRInt32 aFlags) { PRInt32 subType; nsIID iid; @@ -531,7 +531,7 @@ nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aLi } nsresult nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener, - const nsString& aType, PRInt32 aFlags) + const nsAReadableString& aType, PRInt32 aFlags) { PRInt32 subType; nsIID iid; @@ -620,7 +620,7 @@ nsresult nsEventListenerManager::AddScriptEventListener(nsIScriptContext* aContext, nsIScriptObjectOwner *aScriptObjectOwner, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, REFNSIID aIID, PRBool aDeferCompilation) { @@ -1694,11 +1694,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, nsresult nsEventListenerManager::CreateEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - const nsString& aEventType, + const nsAReadableString& aEventType, nsIDOMEvent** aDOMEvent) { - if (!aEvent && !aEventType.EqualsIgnoreCase("MouseEvent") && !aEventType.EqualsIgnoreCase("KeyEvent") && - !aEventType.EqualsIgnoreCase("HTMLEvent")) { + nsAutoString str(aEventType); + if (!aEvent && !str.EqualsIgnoreCase("MouseEvent") && !str.EqualsIgnoreCase("KeyEvent") && + !str.EqualsIgnoreCase("HTMLEvent")) { return NS_ERROR_FAILURE; } @@ -1975,7 +1976,7 @@ nsresult nsEventListenerManager::SetListenerTarget(nsISupports* aTarget) // nsIDOMEventTarget interface NS_IMETHODIMP -nsEventListenerManager::AddEventListener(const nsString& aType, +nsEventListenerManager::AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { @@ -1985,7 +1986,7 @@ nsEventListenerManager::AddEventListener(const nsString& aType, } NS_IMETHODIMP -nsEventListenerManager::RemoveEventListener(const nsString& aType, +nsEventListenerManager::RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { diff --git a/layout/events/src/nsEventListenerManager.h b/layout/events/src/nsEventListenerManager.h index 27b0afc724ad..9c5b38b134fe 100644 --- a/layout/events/src/nsEventListenerManager.h +++ b/layout/events/src/nsEventListenerManager.h @@ -73,13 +73,13 @@ public: virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags); virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags); - virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags); - virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags) ; + virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags); + virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags) ; virtual nsresult AddScriptEventListener(nsIScriptContext*aContext, nsIScriptObjectOwner *aScriptObjectOwner, nsIAtom *aName, - const nsString& aFunc, + const nsAReadableString& aFunc, REFNSIID aIID, PRBool aDeferCompilation); virtual nsresult RegisterScriptEventListener(nsIScriptContext *aContext, @@ -100,7 +100,7 @@ public: virtual nsresult CreateEvent(nsIPresContext* aPresContext, nsEvent* aEvent, - const nsString& aEventType, + const nsAReadableString& aEventType, nsIDOMEvent** aDOMEvent); virtual nsresult RemoveAllListeners(PRBool aScriptOnly); @@ -110,10 +110,10 @@ public: static nsresult GetIdentifiersForType(nsIAtom* aType, nsIID& aIID, PRInt32* aSubType); // nsIDOMEventTarget interface - NS_IMETHOD AddEventListener(const nsString& aType, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index d8c532b56410..1f2d0a4e91f9 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -2063,7 +2063,7 @@ nsComboboxControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP -nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); @@ -2075,7 +2075,7 @@ nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName } NS_IMETHODIMP -nsComboboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +nsComboboxControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index 236454838540..6e220690323b 100644 --- a/layout/forms/nsComboboxControlFrame.h +++ b/layout/forms/nsComboboxControlFrame.h @@ -125,8 +125,8 @@ public: NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetName(nsString* aName); NS_IMETHOD GetType(PRInt32* aType) const; - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); virtual void InitializeControl(nsIPresContext* aPresContext); diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 9b83ff2dc5a6..603c82d09afc 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -611,7 +611,7 @@ nsresult nsFileControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, - const nsString& aValue) + const nsAReadableString& aValue) { nsresult rv = NS_OK; if (nsHTMLAtoms::value == aName) { @@ -626,7 +626,7 @@ NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP nsFileControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsFileControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If widget is null, assume the widget is GFX-rendered and return a member variable instead. diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index 2a15dd558fdc..955b5987daaf 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -75,8 +75,8 @@ public: nsFramePaintLayer aWhichLayer); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD Reflow(nsIPresContext* aCX, diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index 3b69c3242d99..019b8d4d2906 100644 --- a/layout/forms/nsFormControlFrame.cpp +++ b/layout/forms/nsFormControlFrame.cpp @@ -903,14 +903,15 @@ nsFormControlFrame::SetCurrentCheckState(PRBool aState) } NS_IMETHODIMP -nsFormControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +nsFormControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { return NS_OK; } NS_IMETHODIMP -nsFormControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +nsFormControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { + aValue.Truncate(); return NS_OK; } diff --git a/layout/forms/nsFormControlFrame.h b/layout/forms/nsFormControlFrame.h index 41a8710d2e32..37810728eeeb 100644 --- a/layout/forms/nsFormControlFrame.h +++ b/layout/forms/nsFormControlFrame.h @@ -209,9 +209,9 @@ public: nsSize& aSize); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); // Resize Reflow Optimiaztion Methods static void SetupCachedSizes(nsSize& aCacheSize, nsSize& aCachedMaxElementSize, diff --git a/layout/forms/nsFormControlHelper.cpp b/layout/forms/nsFormControlHelper.cpp index bf94eab0cf44..5bc252fe6a98 100644 --- a/layout/forms/nsFormControlHelper.cpp +++ b/layout/forms/nsFormControlHelper.cpp @@ -132,14 +132,16 @@ void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString) aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n")); } -PRBool nsFormControlHelper::GetBool(const nsString& aValue) +PRBool nsFormControlHelper::GetBool(const nsAReadableString& aValue) { - return aValue.EqualsWithConversion(NS_STRING_TRUE); + return aValue.Equals(NS_STRING_TRUE); } -void nsFormControlHelper::GetBoolString(const PRBool aValue, nsString& aResult) +void nsFormControlHelper::GetBoolString(const PRBool aValue, + nsAWritableString& aResult) { - aResult.AssignWithConversion( aValue ? NS_STRING_TRUE : NS_STRING_FALSE ); + aResult.Assign( aValue ? NS_STRING_TRUE : + NS_STRING_FALSE ); } diff --git a/layout/forms/nsFormControlHelper.h b/layout/forms/nsFormControlHelper.h index 8ea3b7c08c52..33ff8060902b 100644 --- a/layout/forms/nsFormControlHelper.h +++ b/layout/forms/nsFormControlHelper.h @@ -41,8 +41,8 @@ class nsFormFrame; #define CSS_NOTSET -1 #define ATTR_NOTSET -1 -#define NS_STRING_TRUE "1" -#define NS_STRING_FALSE "0" +#define NS_STRING_TRUE NS_LITERAL_STRING("1") +#define NS_STRING_FALSE NS_LITERAL_STRING("0") /** * Enumeration of possible mouse states used to detect mouse clicks @@ -145,7 +145,7 @@ public: * @returns PR_TRUE if aValue = "1", PR_FALSE otherwise */ - static PRBool GetBool(const nsString& aValue); + static PRBool GetBool(const nsAReadableString& aValue); /** * Utility to convert a PRBool to a string @@ -155,7 +155,7 @@ public: */ - static void GetBoolString(const PRBool aValue, nsString& aResult); + static void GetBoolString(const PRBool aValue, nsAWritableString& aResult); // XXX similar functionality needs to be added to widget library and these // need to change to use it. diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index 06cb2b294e84..a6c9260902c9 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -453,7 +453,7 @@ nsGfxCheckboxControlFrame::SetCheckboxState (nsIPresContext* aPresContext, } //------------------------------------------------------------ -void nsGfxCheckboxControlFrame::GetCheckboxControlFrameState(nsString& aValue) +void nsGfxCheckboxControlFrame::GetCheckboxControlFrameState(nsAWritableString& aValue) { CheckStateToString(GetCheckboxState(), aValue); } @@ -461,7 +461,7 @@ void nsGfxCheckboxControlFrame::GetCheckboxControlFrameState(nsString& aValue) //------------------------------------------------------------ void nsGfxCheckboxControlFrame::SetCheckboxControlFrameState(nsIPresContext* aPresContext, - const nsString& aValue) + const nsAReadableString& aValue) { CheckState state = StringToCheckState(aValue); SetCheckboxState(aPresContext, state); @@ -470,7 +470,7 @@ void nsGfxCheckboxControlFrame::SetCheckboxControlFrameState(nsIPresContext* aPr //------------------------------------------------------------ NS_IMETHODIMP nsGfxCheckboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, - const nsString& aValue) + const nsAReadableString& aValue) { if (nsHTMLAtoms::checked == aName) SetCheckboxControlFrameState(aPresContext, aValue); @@ -482,7 +482,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::SetProperty(nsIPresContext* aPresContex //------------------------------------------------------------ -NS_IMETHODIMP nsGfxCheckboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsGfxCheckboxControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { if (nsHTMLAtoms::checked == aName) GetCheckboxControlFrameState(aValue); @@ -548,19 +548,19 @@ nsGfxCheckboxControlFrame::Reset(nsIPresContext* aPresContext) // Converts from a CheckState to a string // void -nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& outStateAsString ) +nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsAWritableString& outStateAsString ) { switch ( inState ) { case eOn: - outStateAsString.AssignWithConversion(NS_STRING_TRUE); + outStateAsString.Assign(NS_STRING_TRUE); break; case eOff: - outStateAsString.AssignWithConversion(NS_STRING_FALSE); + outStateAsString.Assign(NS_STRING_FALSE); break; case eMixed: - outStateAsString.AssignWithConversion("2"); + outStateAsString.Assign(NS_LITERAL_STRING("2")); break; } } // CheckStateToString @@ -573,11 +573,11 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou // Converts from a string to a CheckState enum // nsGfxCheckboxControlFrame::CheckState -nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString ) +nsGfxCheckboxControlFrame::StringToCheckState ( const nsAReadableString & aStateAsString ) { - if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) ) + if ( aStateAsString.Equals(NS_STRING_TRUE) ) return eOn; - else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) ) + else if ( aStateAsString.Equals(NS_STRING_FALSE) ) return eOff; // not true and not false means mixed diff --git a/layout/forms/nsGfxCheckboxControlFrame.h b/layout/forms/nsGfxCheckboxControlFrame.h index 443cfbf782cc..2d1667d4c51a 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.h +++ b/layout/forms/nsGfxCheckboxControlFrame.h @@ -75,8 +75,8 @@ public: nsIStyleContext* aStyleContext); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); virtual void Reset(nsIPresContext* aPresContext); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, @@ -104,12 +104,12 @@ protected: // Utility methods for implementing SetProperty/GetProperty void SetCheckboxControlFrameState(nsIPresContext* aPresContext, - const nsString& aValue); - void GetCheckboxControlFrameState(nsString& aValue); + const nsAReadableString& aValue); + void GetCheckboxControlFrameState(nsAWritableString& aValue); // utility routine for converting from DOM values to internal enum - void CheckStateToString ( CheckState inState, nsString& outStateAsString ) ; - CheckState StringToCheckState ( const nsString & aStateAsString ) ; + void CheckStateToString ( CheckState inState, nsAWritableString& outStateAsString ) ; + CheckState StringToCheckState ( const nsAReadableString & aStateAsString ) ; // figure out if we're a tri-state checkbox. PRBool IsTristateCheckbox ( ) const { return mIsTristate; } diff --git a/layout/forms/nsGfxRadioControlFrame.cpp b/layout/forms/nsGfxRadioControlFrame.cpp index c2d5916fc6c9..982a94dc0ede 100644 --- a/layout/forms/nsGfxRadioControlFrame.cpp +++ b/layout/forms/nsGfxRadioControlFrame.cpp @@ -122,10 +122,10 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, } //-------------------------------------------------------------- -NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { if (nsHTMLAtoms::checked == aName) { - PRBool state = (aValue.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; + PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; // if there is no form than the radiobtn is an orphan @@ -147,7 +147,7 @@ NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, } //-------------------------------------------------------------- -NS_IMETHODIMP nsGfxRadioControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsGfxRadioControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If is null, assume the widget is GFX-rendered and return a member variable instead. diff --git a/layout/forms/nsGfxRadioControlFrame.h b/layout/forms/nsGfxRadioControlFrame.h index 01a6a19dd8fe..1594f1aa79a4 100644 --- a/layout/forms/nsGfxRadioControlFrame.h +++ b/layout/forms/nsGfxRadioControlFrame.h @@ -88,8 +88,8 @@ public: virtual void Reset(nsIPresContext* aPresContext); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); //nsIStatefulFrame NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType); diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index a9dc213b9c6d..6c9cdf83bf4c 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -750,13 +750,14 @@ nsresult nsHTMLButtonControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP nsHTMLButtonControlFrame::SetProperty(nsIPresContext* aPresContext, - nsIAtom* aName, const nsString& aValue) + nsIAtom* aName, const nsAReadableString& aValue) { return NS_OK; } -NS_IMETHODIMP nsHTMLButtonControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsHTMLButtonControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { + aValue.Truncate(); return NS_OK; } diff --git a/layout/forms/nsHTMLButtonControlFrame.h b/layout/forms/nsHTMLButtonControlFrame.h index ff27a5a01c67..a853015e392e 100644 --- a/layout/forms/nsHTMLButtonControlFrame.h +++ b/layout/forms/nsHTMLButtonControlFrame.h @@ -140,8 +140,8 @@ public: void GetDefaultLabel(nsString& aLabel); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); protected: diff --git a/layout/forms/nsIFormControlFrame.h b/layout/forms/nsIFormControlFrame.h index dfc0e096274c..0d496ccce10e 100644 --- a/layout/forms/nsIFormControlFrame.h +++ b/layout/forms/nsIFormControlFrame.h @@ -122,7 +122,7 @@ public: * @returns NS_OK if the property name is valid, otherwise an error code */ - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) = 0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) = 0; /** * Get a property from the form control frame @@ -132,7 +132,7 @@ public: * @returns NS_OK if the property name is valid, otherwise an error code */ - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue) = 0; + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue) = 0; diff --git a/layout/forms/nsImageControlFrame.cpp b/layout/forms/nsImageControlFrame.cpp index 84784efc8110..5dec9265503e 100644 --- a/layout/forms/nsImageControlFrame.cpp +++ b/layout/forms/nsImageControlFrame.cpp @@ -132,8 +132,8 @@ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); protected: @@ -507,13 +507,16 @@ nsresult nsImageControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP nsImageControlFrame::SetProperty(nsIPresContext* aPresContext, - nsIAtom* aName, const nsString& aValue) + nsIAtom* aName, + const nsAReadableString& aValue) { return NS_OK; } -NS_IMETHODIMP nsImageControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsImageControlFrame::GetProperty(nsIAtom* aName, + nsAWritableString& aValue) { + aValue.Truncate(); return NS_OK; } diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index d7ad9c5015e0..53f2545fd8a4 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -2445,14 +2445,16 @@ nsListControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue) //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, + const nsAReadableString& aValue) { if (nsHTMLAtoms::selected == aName) { return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec. } else if (nsHTMLAtoms::selectedindex == aName) { PRInt32 error = 0; - PRInt32 selectedIndex = aValue.ToInteger(&error, 10); // Get index from aValue + nsAutoString str(aValue); + PRInt32 selectedIndex = str.ToInteger(&error, 10); // Get index from aValue if (error) { return NS_ERROR_INVALID_ARG; // Couldn't convert to integer } else { @@ -2501,13 +2503,14 @@ nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, co //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +nsListControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Get the selected value of option from local cache (optimization vs. widget) if (nsHTMLAtoms::selected == aName) { + nsAutoString val(aValue); PRInt32 error = 0; PRBool selected = PR_FALSE; - PRInt32 indx = aValue.ToInteger(&error, 10); // Get index from aValue + PRInt32 indx = val.ToInteger(&error, 10); // Get index from aValue if (error == 0) selected = IsContentSelectedByIndex(indx); @@ -2521,7 +2524,8 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) { selectedIndex = 0; } - aValue.AppendInt(selectedIndex, 10); + nsAutoString str; str.AppendInt(selectedIndex, 10); + aValue.Append(str); } return NS_OK; diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h index e4a4d150b3a3..ba6a026f87f3 100644 --- a/layout/forms/nsListControlFrame.h +++ b/layout/forms/nsListControlFrame.h @@ -194,8 +194,8 @@ public: // nsIFormControlFrame NS_IMETHOD GetType(PRInt32* aType) const; NS_IMETHOD GetName(nsString* aName); - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, const nsFont*& aFont); diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 2b271d347b0a..63d2a95e61a3 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -88,8 +88,8 @@ private: /* ---------- abstract methods derived class must implement ---------- */ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)=0; - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue)=0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue)=0; + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue)=0; virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext* aPresContext)=0; diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 264f88a06d90..04d32e04d117 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -147,7 +147,7 @@ public: NS_IMETHOD RemoveSelectionListener(nsIDOMSelectionListener* aListenerToRemove); NS_IMETHOD GetEnumerator(nsIEnumerator **aIterator); - NS_IMETHOD ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn); + NS_IMETHOD ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn); NS_IMETHOD SetHint(PRBool aHintRight); NS_IMETHOD GetHint(PRBool *aHintRight); @@ -1528,10 +1528,10 @@ nsSelection::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) //BEGIN nsIFrameSelection methods NS_IMETHODIMP -nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn) +nsDOMSelection::ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn) { nsresult rv = NS_OK; - + nsCOMPtr encoder; nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE ); formatType.AppendWithConversion(aFormatType); @@ -4342,7 +4342,7 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) content->GetTag(tag); if (tag) { - nsString tagString; + nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); @@ -5158,7 +5158,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) content->GetTag(tag); if (tag) { - nsString tagString; + nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); diff --git a/layout/html/base/src/nsIHTMLContent.h b/layout/html/base/src/nsIHTMLContent.h index 81c7aa38749c..b2afaa32deb8 100644 --- a/layout/html/base/src/nsIHTMLContent.h +++ b/layout/html/base/src/nsIHTMLContent.h @@ -64,10 +64,10 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const = 0; + nsAWritableString& aResult) const = 0; NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) = 0; /** @@ -84,7 +84,7 @@ public: * but certain content carries a local base for backward * compatibility. */ - NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const = 0; + NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const = 0; /** * Translate this piece of content to html. Note that this only @@ -94,7 +94,7 @@ public: */ // XXX add in output character set information so that we know how // to encode non 7 bit characters - NS_IMETHOD ToHTMLString(nsString& aResult) const = 0; + NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const = 0; NS_IMETHOD ToHTML(FILE* out) const = 0; }; diff --git a/layout/html/content/public/nsIForm.h b/layout/html/content/public/nsIForm.h index 7d81714a9dfa..336c35c7ad22 100644 --- a/layout/html/content/public/nsIForm.h +++ b/layout/html/content/public/nsIForm.h @@ -60,7 +60,7 @@ public: * attributes. The name or id attributes of the form control * are used as a key into the table. */ - NS_IMETHOD AddElementToTable(nsIFormControl* aElement, const nsString& aName) = 0; + NS_IMETHOD AddElementToTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0; /** * Get the element at a specified index position @@ -95,7 +95,7 @@ public: * @param aName the name or id of the element to remove * @return NS_OK if the element was successfully removed. */ - NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsString& aName) = 0; + NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0; NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; }; diff --git a/layout/html/content/src/GenericElementCollection.cpp b/layout/html/content/src/GenericElementCollection.cpp index cc030cf043b3..b7536b6869b6 100644 --- a/layout/html/content/src/GenericElementCollection.cpp +++ b/layout/html/content/src/GenericElementCollection.cpp @@ -112,7 +112,7 @@ GenericElementCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -GenericElementCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +GenericElementCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; diff --git a/layout/html/content/src/GenericElementCollection.h b/layout/html/content/src/GenericElementCollection.h index d522604f2ddd..267376892c33 100644 --- a/layout/html/content/src/GenericElementCollection.h +++ b/layout/html/content/src/GenericElementCollection.h @@ -42,7 +42,7 @@ public: NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD ParentDestroyed(); diff --git a/layout/html/content/src/nsAttributeContent.cpp b/layout/html/content/src/nsAttributeContent.cpp index ac162bdccc47..9087969cd35f 100644 --- a/layout/html/content/src/nsAttributeContent.cpp +++ b/layout/html/content/src/nsAttributeContent.cpp @@ -113,7 +113,7 @@ public: } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { aName = nsnull; @@ -138,13 +138,13 @@ public: return NS_OK; } - NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } - NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, + NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) { return NS_OK; } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; } - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; } NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const { aName = nsnull; aPrefix = nsnull; @@ -194,10 +194,12 @@ public: // Implementation for nsITextContent NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult); NS_IMETHOD GetTextLength(PRInt32* aLengthResult); - NS_IMETHOD CopyText(nsString& aResult); + NS_IMETHOD CopyText(nsAWritableString& aResult); NS_IMETHOD SetText(const PRUnichar* aBuffer, PRInt32 aLength, PRBool aNotify); + NS_IMETHOD SetText(const nsAReadableString& aStr, + PRBool aNotify); NS_IMETHOD SetText(const char* aBuffer, PRInt32 aLength, PRBool aNotify); @@ -208,7 +210,7 @@ public: void ValidateTextFragment(); - void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; + void ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const; // Up pointer to the real content object that we are // supporting. Sometimes there is work that we just can't do @@ -353,7 +355,7 @@ nsAttributeContent::ConvertContentToXIF(nsIXIFConverter* ) const } void -nsAttributeContent::ToCString(nsString& aBuf, PRInt32 aOffset, +nsAttributeContent::ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const { } @@ -471,14 +473,14 @@ nsAttributeContent::GetTextLength(PRInt32* aLengthResult) } nsresult -nsAttributeContent::CopyText(nsString& aResult) +nsAttributeContent::CopyText(nsAWritableString& aResult) { ValidateTextFragment(); if (mText.Is2b()) { aResult.Assign(mText.Get2b(), mText.GetLength()); } else { - aResult.AssignWithConversion(mText.Get1b(), mText.GetLength()); + aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()), mText.GetLength()); } return NS_OK; } @@ -504,6 +506,19 @@ nsAttributeContent::SetText(const PRUnichar* aBuffer, PRInt32 aLength, return NS_OK; } +NS_IMETHODIMP +nsAttributeContent::SetText(const nsAReadableString& aStr, + PRBool aNotify) +{ + mText = aStr; + + // Trigger a reflow + if (aNotify && (nsnull != mDocument)) { + mDocument->ContentChanged(mContent, nsnull); + } + return NS_OK; +} + // XXX shouldn't these update mContent's attribute? nsresult nsAttributeContent::SetText(const char* aBuffer, diff --git a/layout/html/content/src/nsGenericDOMHTMLCollection.h b/layout/html/content/src/nsGenericDOMHTMLCollection.h index 031181b33d2f..838ef1ff79bc 100644 --- a/layout/html/content/src/nsGenericDOMHTMLCollection.h +++ b/layout/html/content/src/nsGenericDOMHTMLCollection.h @@ -53,7 +53,7 @@ public: // nsIDOMHTMLCollection interface NS_IMETHOD GetLength(PRUint32* aLength)=0; NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0; - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn)=0; + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0; protected: void* mScriptObject; diff --git a/layout/html/content/src/nsGenericHTMLElement.cpp b/layout/html/content/src/nsGenericHTMLElement.cpp index acd72beb112d..17e077703e44 100644 --- a/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/layout/html/content/src/nsGenericHTMLElement.cpp @@ -123,14 +123,14 @@ public: nsDOMCSSAttributeDeclaration(nsIHTMLContent *aContent); ~nsDOMCSSAttributeDeclaration(); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); virtual void DropReference(); virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl, PRBool aAllocate); virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl); - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl); virtual nsresult GetParent(nsISupports **aParent); @@ -156,8 +156,8 @@ nsDOMCSSAttributeDeclaration::~nsDOMCSSAttributeDeclaration() } NS_IMETHODIMP -nsDOMCSSAttributeDeclaration::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCOMPtr decl; nsresult rv = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE); @@ -272,7 +272,7 @@ nsDOMCSSAttributeDeclaration::SetCSSDeclaration(nsICSSDeclaration *aDecl) } nsresult -nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsString& aDecl, +nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) { @@ -471,13 +471,13 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent, } nsresult -nsGenericHTMLElement::GetTagName(nsString& aTagName) +nsGenericHTMLElement::GetTagName(nsAWritableString& aTagName) { return GetNodeName(aTagName); } nsresult -nsGenericHTMLElement::GetNodeName(nsString& aNodeName) +nsGenericHTMLElement::GetNodeName(nsAWritableString& aNodeName) { if (kStrictDOMLevel2) { mNodeInfo->GetPrefix(aNodeName); @@ -503,14 +503,14 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName) if (NS_SUCCEEDED(mNodeInfo->GetNamespaceID(id)) && id == kNameSpaceID_None) { // Only fold to uppercase if the HTML element has no namespace, i.e., // it was created as part of an HTML document. - aNodeName.ToUpperCase(); + ToUpperCase(aNodeName); } } if (kStrictDOMLevel2) { PRInt32 pos = aNodeName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aNodeName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aNodeName)); printf ("Possible DOM Error: .nodeName or .tagName requested on the HTML element '%s', is this OK?\n", (const char *)tmp); } } @@ -519,54 +519,54 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName) } nsresult -nsGenericHTMLElement::GetLocalName(nsString& aLocalName) +nsGenericHTMLElement::GetLocalName(nsAWritableString& aLocalName) { mNodeInfo->GetLocalName(aLocalName); // This doesn't work for XHTML - aLocalName.ToUpperCase(); + ToUpperCase(aLocalName); return NS_OK; } // Implementation for nsIDOMHTMLElement nsresult -nsGenericHTMLElement::GetId(nsString& aId) +nsGenericHTMLElement::GetId(nsAWritableString& aId) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, aId); return NS_OK; } nsresult -nsGenericHTMLElement::SetId(const nsString& aId) +nsGenericHTMLElement::SetId(const nsAReadableString& aId) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, aId, PR_TRUE); return NS_OK; } nsresult -nsGenericHTMLElement::GetTitle(nsString& aTitle) +nsGenericHTMLElement::GetTitle(nsAWritableString& aTitle) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::title, aTitle); return NS_OK; } nsresult -nsGenericHTMLElement::SetTitle(const nsString& aTitle) +nsGenericHTMLElement::SetTitle(const nsAReadableString& aTitle) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::title, aTitle, PR_TRUE); return NS_OK; } nsresult -nsGenericHTMLElement::GetLang(nsString& aLang) +nsGenericHTMLElement::GetLang(nsAWritableString& aLang) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::lang, aLang); return NS_OK; } nsresult -nsGenericHTMLElement::SetLang(const nsString& aLang) +nsGenericHTMLElement::SetLang(const nsAReadableString& aLang) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::lang, aLang, PR_TRUE); return NS_OK; @@ -579,7 +579,7 @@ static nsGenericHTMLElement::EnumTable kDirTable[] = { }; nsresult -nsGenericHTMLElement::GetDir(nsString& aDir) +nsGenericHTMLElement::GetDir(nsAWritableString& aDir) { nsHTMLValue value; nsresult result = GetHTMLAttribute(nsHTMLAtoms::dir, value); @@ -592,21 +592,21 @@ nsGenericHTMLElement::GetDir(nsString& aDir) } nsresult -nsGenericHTMLElement::SetDir(const nsString& aDir) +nsGenericHTMLElement::SetDir(const nsAReadableString& aDir) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::dir, aDir, PR_TRUE); return NS_OK; } nsresult -nsGenericHTMLElement::GetClassName(nsString& aClassName) +nsGenericHTMLElement::GetClassName(nsAWritableString& aClassName) { GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, aClassName); return NS_OK; } nsresult -nsGenericHTMLElement::SetClassName(const nsString& aClassName) +nsGenericHTMLElement::SetClassName(const nsAReadableString& aClassName) { SetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, aClassName, PR_TRUE); return NS_OK; @@ -852,7 +852,7 @@ nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent) } nsresult -nsGenericHTMLElement::GetInnerHTML(nsString& aInnerHTML) +nsGenericHTMLElement::GetInnerHTML(nsAWritableString& aInnerHTML) { aInnerHTML.Truncate(); @@ -910,7 +910,7 @@ nsGenericHTMLElement::GetInnerHTML(nsString& aInnerHTML) } nsresult -nsGenericHTMLElement::SetInnerHTML(const nsString& aInnerHTML) +nsGenericHTMLElement::SetInnerHTML(const nsAReadableString& aInnerHTML) { nsresult rv = NS_OK; @@ -1252,13 +1252,13 @@ nsGenericHTMLElement::GetNameSpaceID(PRInt32& aID) const } nsresult -nsGenericHTMLElement::ParseAttributeString(const nsString& aStr, +nsGenericHTMLElement::ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { // XXX need to validate/strip namespace prefix - nsAutoString lower; - aStr.ToLowerCase(lower); + nsAutoString lower(aStr); + lower.ToLowerCase(); aName = NS_NewAtom(lower); aNameSpaceID = kNameSpaceID_None; @@ -1276,7 +1276,7 @@ nsGenericHTMLElement::GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, nsresult nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult result = NS_OK; @@ -1417,7 +1417,7 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, nsresult nsGenericHTMLElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -1574,7 +1574,7 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsresult nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsIAtom*& aPrefix, nsString &aResult) const + nsIAtom*& aPrefix, nsAWritableString& aResult) const { aPrefix = nsnull; @@ -1583,7 +1583,7 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsresult nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, - nsString &aResult) const + nsAWritableString& aResult) const { #if 0 NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) || @@ -1602,7 +1602,6 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsresult result = mAttributes ? mAttributes->GetAttribute(aAttribute, &value) : NS_CONTENT_ATTR_NOT_THERE; - char cbuf[20]; nscolor color; if (NS_CONTENT_ATTR_HAS_VALUE == result) { nsIHTMLContent* htmlContent; @@ -1631,26 +1630,39 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, break; case eHTMLUnit_Integer: - aResult.Truncate(); - aResult.AppendInt(value->GetIntValue(), 10); - break; + { + nsAutoString intStr; + intStr.AppendInt(value->GetIntValue()); + + aResult.Assign(intStr); + break; + } case eHTMLUnit_Pixel: - aResult.Truncate(); - aResult.AppendInt(value->GetPixelValue(), 10); - break; + { + nsAutoString intStr; + intStr.AppendInt(value->GetPixelValue()); + + aResult.Assign(intStr); + break; + } case eHTMLUnit_Percent: - aResult.Truncate(); - aResult.AppendInt(PRInt32(value->GetPercentValue() * 100.0f), 10); - aResult.AppendWithConversion('%'); - break; + { + nsAutoString intStr; + intStr.AppendInt(PRInt32(value->GetPercentValue() * 100.0f)); + + aResult.Assign(intStr); + aResult.Append(PRUnichar('%')); + break; + } case eHTMLUnit_Color: + char cbuf[20]; color = nscolor(value->GetColorValue()); PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", NS_GET_R(color), NS_GET_G(color), NS_GET_B(color)); - aResult.AssignWithConversion(cbuf); + aResult.Assign(NS_ConvertASCIItoUCS2(cbuf)); break; default: @@ -1807,7 +1819,7 @@ nsGenericHTMLElement::GetBaseURL(const nsHTMLValue& aBaseHref, } nsresult -nsGenericHTMLElement::GetBaseTarget(nsString& aBaseTarget) const +nsGenericHTMLElement::GetBaseTarget(nsAWritableString& aBaseTarget) const { nsresult result = NS_OK; @@ -1989,7 +2001,7 @@ NS_QuoteForHTML(const nsString& aValue, nsString& aResult) { const PRUnichar* cp = aValue.GetUnicode(); const PRUnichar* end = aValue.GetUnicode() + aValue.Length(); - aResult.AssignWithConversion('"'); + aResult.Assign(NS_LITERAL_STRING("\"")); while (cp < end) { PRUnichar ch = *cp++; if ((ch >= 0x20) && (ch <= 0x7f)) { @@ -2010,16 +2022,16 @@ NS_QuoteForHTML(const nsString& aValue, nsString& aResult) } nsresult -nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const +nsGenericHTMLElement::ToHTMLString(nsAWritableString& aBuf) const { - aBuf.AssignWithConversion('<'); + aBuf.Assign(NS_LITERAL_STRING("<")); if (mNodeInfo) { nsAutoString tmp; mNodeInfo->GetQualifiedName(tmp); aBuf.Append(tmp); } else { - aBuf.AppendWithConversion("?NULL"); + aBuf.Append(NS_LITERAL_STRING("?NULL")); } if (nsnull != mAttributes) { @@ -2030,20 +2042,20 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const nsIAtom* atom = nsnull; mAttributes->GetAttributeNameAt(index, atom); atom->ToString(name); - aBuf.AppendWithConversion(' '); + aBuf.Append(NS_LITERAL_STRING(" ")); aBuf.Append(name); value.Truncate(); GetAttribute(kNameSpaceID_None, atom, value); NS_RELEASE(atom); if (value.Length() > 0) { - aBuf.AppendWithConversion('='); + aBuf.Append(NS_LITERAL_STRING("=")); NS_QuoteForHTML(value, quotedValue); aBuf.Append(quotedValue); } } } - aBuf.AppendWithConversion('>'); + aBuf.Append(NS_LITERAL_STRING(">")); return NS_OK; } @@ -2053,7 +2065,7 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const nsresult nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (nsHTMLAtoms::style == aAttribute) { if (eHTMLUnit_ISupports == aValue.GetUnit()) { @@ -2069,7 +2081,7 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, NS_RELEASE(cssRule); } else { - aResult.AssignWithConversion("Unknown rule type"); + aResult.Assign(NS_LITERAL_STRING("Unknown rule type")); } NS_RELEASE(rule); } @@ -2090,12 +2102,13 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, } PRBool -nsGenericHTMLElement::ParseEnumValue(const nsString& aValue, +nsGenericHTMLElement::ParseEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult) { + nsAutoString val(aValue); while (nsnull != aTable->tag) { - if (aValue.EqualsIgnoreCase(aTable->tag)) { + if (val.EqualsIgnoreCase(aTable->tag)) { aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated); return PR_TRUE; } @@ -2105,12 +2118,13 @@ nsGenericHTMLElement::ParseEnumValue(const nsString& aValue, } PRBool -nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue, +nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult) { + nsAutoString val(aValue); while (nsnull != aTable->tag) { - if (aValue.EqualsWithConversion(aTable->tag)) { + if (val.EqualsWithConversion(aTable->tag)) { aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated); return PR_TRUE; } @@ -2122,7 +2136,7 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue, PRBool nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, EnumTable* aTable, - nsString& aResult, + nsAWritableString& aResult, PRBool aFoldCase) { aResult.Truncate(0); @@ -2130,9 +2144,10 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, PRInt32 v = aValue.GetIntValue(); while (nsnull != aTable->tag) { if (aTable->value == v) { - aResult.AppendWithConversion(aTable->tag); + aResult.Append(NS_ConvertASCIItoUCS2(aTable->tag)); if (aFoldCase) { - aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0); + nsWritingIterator start(aResult.BeginWriting()); + *start.get() = nsCRT::ToUpper(*start.get()); } return PR_TRUE; } @@ -2143,7 +2158,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, } PRBool -nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString, +nsGenericHTMLElement::ParseValueOrPercent(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { @@ -2175,7 +2190,7 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString, * or proportional (n*) */ PRBool -nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString, +nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { @@ -2210,19 +2225,23 @@ nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString, PRBool nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { + nsAutoString intStr; aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.AppendInt(aValue.GetIntValue(), 10); + intStr.AppendInt(aValue.GetIntValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.AppendInt(aValue.GetPixelValue(), 10); + intStr.AppendInt(aValue.GetPixelValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Percent: - aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.AppendWithConversion('%'); + intStr.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f)); + aResult.Append(intStr); + aResult.Append(PRUnichar('%')); return PR_TRUE; default: break; @@ -2232,23 +2251,28 @@ nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue, PRBool nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { + nsAutoString intStr; aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.AppendInt(aValue.GetIntValue(), 10); + intStr.AppendInt(aValue.GetIntValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.AppendInt(aValue.GetPixelValue(), 10); + intStr.AppendInt(aValue.GetPixelValue()); + aResult.Append(intStr); return PR_TRUE; case eHTMLUnit_Percent: - aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.AppendWithConversion('%'); + intStr.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f)); + aResult.Append(intStr); + aResult.Append(NS_LITERAL_STRING("%")); return PR_TRUE; case eHTMLUnit_Proportional: - aResult.AppendInt(aValue.GetIntValue(), 10); - aResult.AppendWithConversion('*'); + intStr.AppendInt(aValue.GetIntValue()); + aResult.Append(intStr); + aResult.Append(NS_LITERAL_STRING("*")); return PR_TRUE; default: break; @@ -2257,10 +2281,11 @@ nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aV } PRBool -nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, +nsGenericHTMLElement::ParseValue(const nsAReadableString& aString, PRInt32 aMin, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { - PRInt32 ec, val = aString.ToInteger(&ec); + nsAutoString str(aString); + PRInt32 ec, val = str.ToInteger(&ec); if (NS_OK == ec) { if (val < aMin) val = aMin; if (eHTMLUnit_Pixel == aValueUnit) { @@ -2276,11 +2301,12 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, } PRBool -nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, +nsGenericHTMLElement::ParseValue(const nsAReadableString& aString, PRInt32 aMin, PRInt32 aMax, nsHTMLValue& aResult, nsHTMLUnit aValueUnit) { - PRInt32 ec, val = aString.ToInteger(&ec); + nsAutoString str(aString); + PRInt32 ec, val = str.ToInteger(&ec); if (NS_OK == ec) { if (val < aMin) val = aMin; if (val > aMax) val = aMax; @@ -2297,7 +2323,7 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin, } PRBool -nsGenericHTMLElement::ParseColor(const nsString& aString, +nsGenericHTMLElement::ParseColor(const nsAReadableString& aString, nsIDocument* aDocument, nsHTMLValue& aResult) { @@ -2320,7 +2346,8 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, } } else { - if (NS_LooseHexToRGB(aString, &color)) { // no space compression + nsAutoString str(aString); + if (NS_LooseHexToRGB(str, &color)) { // no space compression aResult.SetColorValue(color); return PR_TRUE; } @@ -2332,14 +2359,14 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, PRBool nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if (aValue.GetUnit() == eHTMLUnit_Color) { nscolor v = aValue.GetColorValue(); char buf[10]; PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x", NS_GET_R(v), NS_GET_G(v), NS_GET_B(v)); - aResult.AssignWithConversion(buf); + aResult.Assign(NS_ConvertASCIItoUCS2(buf)); return PR_TRUE; } if ((aValue.GetUnit() == eHTMLUnit_ColorName) || @@ -2511,7 +2538,7 @@ static nsGenericHTMLElement::EnumTable kTableVAlignTable[] = { PRBool nsGenericHTMLElement::ParseCommonAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (nsHTMLAtoms::dir == aAttribute) { @@ -2525,7 +2552,7 @@ nsGenericHTMLElement::ParseCommonAttribute(nsIAtom* aAttribute, } PRBool -nsGenericHTMLElement::ParseAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) { return ParseEnumValue(aString, kAlignTable, aResult); @@ -2555,7 +2582,7 @@ static nsGenericHTMLElement::EnumTable kCompatTableHAlignTable[] = { }; PRBool -nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseTableHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const { if (InNavQuirksMode(mDocument)) { @@ -2566,7 +2593,7 @@ nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (InNavQuirksMode(mDocument)) { return EnumValueToString(aValue, kCompatTableHAlignTable, aResult); @@ -2604,7 +2631,7 @@ static nsGenericHTMLElement::EnumTable kCompatTableCellHAlignTable[] = { }; PRBool -nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseTableCellHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const { if (InNavQuirksMode(mDocument)) { @@ -2615,7 +2642,7 @@ nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (InNavQuirksMode(mDocument)) { return EnumValueToString(aValue, kCompatTableCellHAlignTable, aResult); @@ -2626,7 +2653,7 @@ nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue, //---------------------------------------- PRBool -nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseTableVAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) { return ParseEnumValue(aString, kTableVAlignTable, aResult); @@ -2634,20 +2661,20 @@ nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::AlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { return EnumValueToString(aValue, kAlignTable, aResult); } PRBool nsGenericHTMLElement::TableVAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { return EnumValueToString(aValue, kTableVAlignTable, aResult); } PRBool -nsGenericHTMLElement::ParseDivAlignValue(const nsString& aString, +nsGenericHTMLElement::ParseDivAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const { return ParseEnumValue(aString, kDivAlignTable, aResult); @@ -2655,14 +2682,14 @@ nsGenericHTMLElement::ParseDivAlignValue(const nsString& aString, PRBool nsGenericHTMLElement::DivAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return EnumValueToString(aValue, kDivAlignTable, aResult); } PRBool nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult) { if ((aAttribute == nsHTMLAtoms::width) || @@ -2680,7 +2707,7 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute, PRBool nsGenericHTMLElement::ImageAttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if ((aAttribute == nsHTMLAtoms::width) || (aAttribute == nsHTMLAtoms::height) || @@ -2694,7 +2721,7 @@ nsGenericHTMLElement::ImageAttributeToString(nsIAtom* aAttribute, PRBool nsGenericHTMLElement::ParseFrameborderValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult) { if (aStandardMode) { @@ -2707,7 +2734,7 @@ nsGenericHTMLElement::ParseFrameborderValue(PRBool aStandardMode, PRBool nsGenericHTMLElement::FrameborderValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if (aStandardMode) { return EnumValueToString(aValue, kFrameborderStandardTable, aResult); @@ -2718,7 +2745,7 @@ nsGenericHTMLElement::FrameborderValueToString(PRBool aStandardMode, PRBool nsGenericHTMLElement::ParseScrollingValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult) { if (aStandardMode) { @@ -2731,7 +2758,7 @@ nsGenericHTMLElement::ParseScrollingValue(PRBool aStandardMode, PRBool nsGenericHTMLElement::ScrollingValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult) + nsAWritableString& aResult) { if (aStandardMode) { return EnumValueToString(aValue, kScrollingStandardTable, aResult); @@ -2759,7 +2786,7 @@ nsGenericHTMLElement::ReparseStyleAttribute(void) } nsresult -nsGenericHTMLElement::ParseStyleAttribute(const nsString& aValue, nsHTMLValue& aResult) +nsGenericHTMLElement::ParseStyleAttribute(const nsAReadableString& aValue, nsHTMLValue& aResult) { nsresult result = NS_OK; @@ -3128,10 +3155,9 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aPresContext->GetCompatibilityMode(&mode); if (eCompatibility_NavQuirks == mode && eHTMLUnit_Empty == value.GetUnit()) { - nsAutoString spec; nsStyleColor* color; color = (nsStyleColor*)aContext->GetMutableStyleData(eStyleStruct_Color); - color->mBackgroundImage = spec; + color->mBackgroundImage.Truncate(); color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE; color->mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY; } @@ -3626,7 +3652,7 @@ nsGenericHTMLContainerFormElement::SetForm(nsIForm* aForm) } nsresult -nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, +nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify) { // Add the control to the hash table @@ -3641,7 +3667,7 @@ nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* a nsresult nsGenericHTMLContainerFormElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -3713,7 +3739,9 @@ nsGenericHTMLLeafFormElement::SetForm(nsIForm* aForm) } nsresult -nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, +nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, + nsIAtom* aName, + const nsAReadableString& aValue, PRBool aNotify) { // Add the control to the hash table @@ -3728,12 +3756,13 @@ nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, mForm->AddElementToTable(control, aValue); } - return nsGenericHTMLElement::SetAttribute(aNameSpaceID, aName, aValue, aNotify); + return nsGenericHTMLElement::SetAttribute(aNameSpaceID, aName, aValue, + aNotify); } nsresult nsGenericHTMLLeafFormElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); diff --git a/layout/html/content/src/nsGenericHTMLElement.h b/layout/html/content/src/nsGenericHTMLElement.h index 842b2cf585de..5caff717e4ac 100644 --- a/layout/html/content/src/nsGenericHTMLElement.h +++ b/layout/html/content/src/nsGenericHTMLElement.h @@ -67,39 +67,39 @@ public: PRBool aDeep); // Implementation for nsIDOMNode - nsresult GetNodeName(nsString& aNodeName); - nsresult GetLocalName(nsString& aLocalName); + nsresult GetNodeName(nsAWritableString& aNodeName); + nsresult GetLocalName(nsAWritableString& aLocalName); // Implementation for nsIDOMElement - nsresult GetAttribute(const nsString& aName, nsString& aReturn) + nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return nsGenericElement::GetAttribute(aName, aReturn); } - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericElement::SetAttribute(aName, aValue); } - nsresult GetTagName(nsString& aTagName); + nsresult GetTagName(nsAWritableString& aTagName); // Implementation for nsIDOMHTMLElement - nsresult GetId(nsString& aId); - nsresult SetId(const nsString& aId); - nsresult GetTitle(nsString& aTitle); - nsresult SetTitle(const nsString& aTitle); - nsresult GetLang(nsString& aLang); - nsresult SetLang(const nsString& aLang); - nsresult GetDir(nsString& aDir); - nsresult SetDir(const nsString& aDir); - nsresult GetClassName(nsString& aClassName); - nsresult SetClassName(const nsString& aClassName); + nsresult GetId(nsAWritableString& aId); + nsresult SetId(const nsAReadableString& aId); + nsresult GetTitle(nsAWritableString& aTitle); + nsresult SetTitle(const nsAReadableString& aTitle); + nsresult GetLang(nsAWritableString& aLang); + nsresult SetLang(const nsAReadableString& aLang); + nsresult GetDir(nsAWritableString& aDir); + nsresult SetDir(const nsAReadableString& aDir); + nsresult GetClassName(nsAWritableString& aClassName); + nsresult SetClassName(const nsAReadableString& aClassName); nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle); nsresult GetOffsetTop(PRInt32* aOffsetTop); nsresult GetOffsetLeft(PRInt32* aOffsetLeft); nsresult GetOffsetWidth(PRInt32* aOffsetWidth); nsresult GetOffsetHeight(PRInt32* aOffsetHeight); nsresult GetOffsetParent(nsIDOMElement** aOffsetParent); - nsresult GetInnerHTML(nsString& aInnerHTML); - nsresult SetInnerHTML(const nsString& aInnerHTML); + nsresult GetInnerHTML(nsAWritableString& aInnerHTML); + nsresult SetInnerHTML(const nsAReadableString& aInnerHTML); nsresult GetOffsetRect(nsRect& aRect, nsIAtom* aOffsetParentTag, nsIContent** aOffsetParent); @@ -108,17 +108,17 @@ public: // Implementation for nsIContent nsresult GetNameSpaceID(PRInt32& aNameSpaceID) const; nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers); - nsresult ParseAttributeString(const nsString& aStr, + nsresult ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID); nsresult GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, nsIAtom*& aPrefix); - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const; - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const; + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aResult) const; + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsAWritableString& aResult) const; nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify); nsresult GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, @@ -153,8 +153,8 @@ public: nsresult GetContentStyleRules(nsISupportsArray* aRules); nsresult GetInlineStyleRules(nsISupportsArray* aRules); nsresult GetBaseURL(nsIURI*& aBaseURL) const; - nsresult GetBaseTarget(nsString& aBaseTarget) const; - nsresult ToHTMLString(nsString& aResult) const; + nsresult GetBaseTarget(nsAWritableString& aBaseTarget) const; + nsresult ToHTMLString(nsAWritableString& aResult) const; nsresult ToHTML(FILE* out) const; nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult, size_t aInstanceSize) const; @@ -162,7 +162,7 @@ public: //---------------------------------------- nsresult AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; void ListAttributes(FILE* out) const; @@ -176,100 +176,100 @@ public: PRInt32 value; }; - static PRBool ParseEnumValue(const nsString& aValue, + static PRBool ParseEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult); - static PRBool ParseCaseSensitiveEnumValue(const nsString& aValue, + static PRBool ParseCaseSensitiveEnumValue(const nsAReadableString& aValue, EnumTable* aTable, nsHTMLValue& aResult); static PRBool EnumValueToString(const nsHTMLValue& aValue, EnumTable* aTable, - nsString& aResult, + nsAWritableString& aResult, PRBool aFoldCase=PR_TRUE); - static PRBool ParseValueOrPercent(const nsString& aString, + static PRBool ParseValueOrPercent(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); - static PRBool ParseValueOrPercentOrProportional(const nsString& aString, + static PRBool ParseValueOrPercentOrProportional(const nsAReadableString& aString, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); static PRBool ValueOrPercentToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); - static PRBool ParseValue(const nsString& aString, PRInt32 aMin, + static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); - static PRBool ParseValue(const nsString& aString, PRInt32 aMin, PRInt32 aMax, + static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin, PRInt32 aMax, nsHTMLValue& aResult, nsHTMLUnit aValueUnit); - static PRBool ParseColor(const nsString& aString, nsIDocument* aDocument, + static PRBool ParseColor(const nsAReadableString& aString, nsIDocument* aDocument, nsHTMLValue& aResult); static PRBool ColorToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseCommonAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult); - static PRBool ParseAlignValue(const nsString& aString, nsHTMLValue& aResult); + static PRBool ParseAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult); - PRBool ParseDivAlignValue(const nsString& aString, + PRBool ParseDivAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const; PRBool DivAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; - PRBool ParseTableHAlignValue(const nsString& aString, + PRBool ParseTableHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const; PRBool TableHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; - PRBool ParseTableCellHAlignValue(const nsString& aString, + PRBool ParseTableCellHAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult) const; PRBool TableCellHAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult) const; + nsAWritableString& aResult) const; - static PRBool ParseTableVAlignValue(const nsString& aString, + static PRBool ParseTableVAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool TableVAlignValueToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool AlignValueToString(const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseImageAttribute(nsIAtom* aAttribute, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool ImageAttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseFrameborderValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool FrameborderValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); static PRBool ParseScrollingValue(PRBool aStandardMode, - const nsString& aString, + const nsAReadableString& aString, nsHTMLValue& aResult); static PRBool ScrollingValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, - nsString& aResult); + nsAWritableString& aResult); nsresult ReparseStyleAttribute(void); - nsresult ParseStyleAttribute(const nsString& aValue, nsHTMLValue& aResult); + nsresult ParseStyleAttribute(const nsAReadableString& aValue, nsHTMLValue& aResult); /** Attribute Mapping Helpers * @@ -466,11 +466,11 @@ public: ~nsGenericHTMLContainerFormElement(); nsresult SetForm(nsIForm* aForm); - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericHTMLElement::SetAttribute(aName, aValue); } @@ -487,11 +487,11 @@ public: ~nsGenericHTMLLeafFormElement(); nsresult SetForm(nsIForm* aForm); - nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue, + nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericHTMLElement::SetAttribute(aName, aValue); } @@ -508,34 +508,34 @@ public: * nsGenericHTMLContainerContent) */ #define NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(_g) \ - NS_IMETHOD GetId(nsString& aId) { \ + NS_IMETHOD GetId(nsAWritableString& aId) { \ return _g.GetId(aId); \ } \ - NS_IMETHOD SetId(const nsString& aId) { \ + NS_IMETHOD SetId(const nsAReadableString& aId) { \ return _g.SetId(aId); \ } \ - NS_IMETHOD GetTitle(nsString& aTitle) { \ + NS_IMETHOD GetTitle(nsAWritableString& aTitle) { \ return _g.GetTitle(aTitle); \ } \ - NS_IMETHOD SetTitle(const nsString& aTitle) { \ + NS_IMETHOD SetTitle(const nsAReadableString& aTitle) { \ return _g.SetTitle(aTitle); \ } \ - NS_IMETHOD GetLang(nsString& aLang) { \ + NS_IMETHOD GetLang(nsAWritableString& aLang) { \ return _g.GetLang(aLang); \ } \ - NS_IMETHOD SetLang(const nsString& aLang) { \ + NS_IMETHOD SetLang(const nsAReadableString& aLang) { \ return _g.SetLang(aLang); \ } \ - NS_IMETHOD GetDir(nsString& aDir) { \ + NS_IMETHOD GetDir(nsAWritableString& aDir) { \ return _g.GetDir(aDir); \ } \ - NS_IMETHOD SetDir(const nsString& aDir) { \ + NS_IMETHOD SetDir(const nsAReadableString& aDir) { \ return _g.SetDir(aDir); \ } \ - NS_IMETHOD GetClassName(nsString& aClassName) { \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName) { \ return _g.GetClassName(aClassName); \ } \ - NS_IMETHOD SetClassName(const nsString& aClassName) { \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName) { \ return _g.SetClassName(aClassName); \ } \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { \ @@ -556,10 +556,10 @@ public: NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) { \ return _g.GetOffsetParent(aOffsetParent); \ } \ - NS_IMETHOD GetInnerHTML(nsString& aInnerHTML) { \ + NS_IMETHOD GetInnerHTML(nsAWritableString& aInnerHTML) { \ return _g.GetInnerHTML(aInnerHTML); \ } \ - NS_IMETHOD SetInnerHTML(const nsString& aInnerHTML) { \ + NS_IMETHOD SetInnerHTML(const nsAReadableString& aInnerHTML) { \ return _g.SetInnerHTML(aInnerHTML); \ } @@ -594,21 +594,21 @@ public: NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \ return _g.GetBaseURL(aBaseURL); \ } \ - NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \ + NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const { \ return _g.GetBaseTarget(aBaseTarget); \ } \ - NS_IMETHOD ToHTMLString(nsString& aResult) const { \ + NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const { \ return _g.ToHTMLString(aResult); \ } \ NS_IMETHOD ToHTML(FILE* out) const { \ return _g.ToHTML(out); \ } \ NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \ - const nsString& aValue, \ + const nsAReadableString& aValue, \ nsHTMLValue& aResult); \ NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ - nsString& aResult) const; \ + nsAWritableString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ @@ -640,21 +640,21 @@ public: NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \ return _g.GetBaseURL(aBaseURL); \ } \ - NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \ + NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const { \ return _g.GetBaseTarget(aBaseTarget); \ } \ - NS_IMETHOD ToHTMLString(nsString& aResult) const { \ + NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const { \ return _g.ToHTMLString(aResult); \ } \ NS_IMETHOD ToHTML(FILE* out) const { \ return _g.ToHTML(out); \ } \ NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \ - const nsString& aValue, \ + const nsAReadableString& aValue, \ nsHTMLValue& aResult); \ NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \ const nsHTMLValue& aValue, \ - nsString& aResult) const; \ + nsAWritableString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ @@ -692,13 +692,13 @@ public: */ #define NS_IMPL_STRING_ATTR(_class, _method, _atom) \ NS_IMETHODIMP \ - _class::Get##_method(nsString& aValue) \ + _class::Get##_method(nsAWritableString& aValue) \ { \ mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue); \ return NS_OK; \ } \ NS_IMETHODIMP \ - _class::Set##_method(const nsString& aValue) \ + _class::Set##_method(const nsAReadableString& aValue) \ { \ return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue, PR_TRUE); \ } diff --git a/layout/html/content/src/nsHTMLAnchorElement.cpp b/layout/html/content/src/nsHTMLAnchorElement.cpp index 7d526bb3e081..123286f93bd8 100644 --- a/layout/html/content/src/nsHTMLAnchorElement.cpp +++ b/layout/html/content/src/nsHTMLAnchorElement.cpp @@ -46,6 +46,7 @@ #include "nsIPresShell.h" #include "nsIDocument.h" #include "nsIHTMLAttributes.h" +#include "prprf.h" // XXX suppress @@ -77,42 +78,10 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLAnchorElement - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetCharset(nsString& aCharset); - NS_IMETHOD SetCharset(const nsString& aCharset); - NS_IMETHOD GetCoords(nsString& aCoords); - NS_IMETHOD SetCoords(const nsString& aCoords); - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetHreflang(nsString& aHreflang); - NS_IMETHOD SetHreflang(const nsString& aHreflang); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetRel(nsString& aRel); - NS_IMETHOD SetRel(const nsString& aRel); - NS_IMETHOD GetRev(nsString& aRev); - NS_IMETHOD SetRev(const nsString& aRev); - NS_IMETHOD GetShape(nsString& aShape); - NS_IMETHOD SetShape(const nsString& aShape); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); - NS_IMETHOD Blur(); - NS_IMETHOD Focus(); + NS_DECL_IDOMHTMLANCHORELEMENT // nsIDOMNSHTMLAnchorElement - NS_IMETHOD GetProtocol(nsString& aProtocol); - NS_IMETHOD GetHost(nsString& aHost); - NS_IMETHOD GetHostname(nsString& aHostname); - NS_IMETHOD GetPathname(nsString& aPathname); - NS_IMETHOD GetSearch(nsString& aSearch); - NS_IMETHOD GetPort(nsString& aPort); - NS_IMETHOD GetHash(nsString& aHash); - NS_IMETHOD GetText(nsString& aText); + NS_DECL_IDOMNSHTMLANCHORELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -351,7 +320,7 @@ nsHTMLAnchorElement::RemoveFocus(nsIPresContext* aPresContext) NS_IMETHODIMP nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::tabindex) { @@ -361,7 +330,7 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::suppress) { - if (aValue.EqualsIgnoreCase("true")) { + if (nsCRT::strcasecmp(nsPromiseFlatString(aValue), NS_LITERAL_STRING("true"))) { aResult.SetEmptyValue(); // XXX? shouldn't just leave "true" return NS_CONTENT_ATTR_HAS_VALUE; } @@ -372,7 +341,7 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLAnchorElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -421,13 +390,13 @@ nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsHTMLAnchorElement::GetHref(nsString& aValue) +nsHTMLAnchorElement::GetHref(nsAWritableString& aValue) { char *buf; nsresult rv = GetHrefCString(buf); if (NS_FAILED(rv)) return rv; if (buf) { - aValue.AssignWithConversion(buf); + aValue.Assign(NS_ConvertASCIItoUCS2(buf)); nsCRT::free(buf); } // NS_IMPL_STRING_ATTR does nothing where we have (buf == null) @@ -435,7 +404,7 @@ nsHTMLAnchorElement::GetHref(nsString& aValue) } NS_IMETHODIMP -nsHTMLAnchorElement::SetHref(const nsString& aValue) +nsHTMLAnchorElement::SetHref(const nsAReadableString& aValue) { // Clobber our "cache", so we'll recompute it the next time // somebody asks for it. @@ -451,7 +420,7 @@ nsHTMLAnchorElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const } NS_IMETHODIMP -nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) +nsHTMLAnchorElement::GetProtocol(nsAWritableString& aProtocol) { nsAutoString href; nsIURI *url; @@ -464,8 +433,8 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.AssignWithConversion(protocol); - aProtocol.AppendWithConversion(":"); + aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol)); + aProtocol.Append(NS_LITERAL_STRING(":")); nsCRT::free(protocol); } NS_RELEASE(url); @@ -476,7 +445,7 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) } NS_IMETHODIMP -nsHTMLAnchorElement::GetHost(nsString& aHost) +nsHTMLAnchorElement::GetHost(nsAWritableString& aHost) { nsAutoString href; nsIURI *url; @@ -489,13 +458,15 @@ nsHTMLAnchorElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.AssignWithConversion(host); + aHost.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.AppendWithConversion(":"); - aHost.AppendInt(port, 10); + aHost.Append(NS_LITERAL_STRING(":")); + nsAutoString portStr; + portStr.AppendInt(port); + aHost.Append(portStr); } } NS_RELEASE(url); @@ -506,7 +477,7 @@ nsHTMLAnchorElement::GetHost(nsString& aHost) } NS_IMETHODIMP -nsHTMLAnchorElement::GetHostname(nsString& aHostname) +nsHTMLAnchorElement::GetHostname(nsAWritableString& aHostname) { nsAutoString href; nsIURI *url; @@ -519,7 +490,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.AssignWithConversion(host); + aHostname.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); } NS_RELEASE(url); @@ -530,7 +501,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname) } NS_IMETHODIMP -nsHTMLAnchorElement::GetPathname(nsString& aPathname) +nsHTMLAnchorElement::GetPathname(nsAWritableString& aPathname) { nsAutoString href; nsCOMPtr uri; @@ -560,14 +531,14 @@ nsHTMLAnchorElement::GetPathname(nsString& aPathname) return result; } - aPathname.AssignWithConversion(file); + aPathname.Assign(NS_ConvertASCIItoUCS2(file)); nsCRT::free(file); return result; } NS_IMETHODIMP -nsHTMLAnchorElement::GetSearch(nsString& aSearch) +nsHTMLAnchorElement::GetSearch(nsAWritableString& aSearch) { nsAutoString href; nsIURI *uri; @@ -585,8 +556,8 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.AssignWithConversion("?"); - aSearch.AppendWithConversion(search); + aSearch.Assign(NS_LITERAL_STRING("?")); + aSearch.Append(NS_ConvertASCIItoUCS2(search)); nsCRT::free(search); } else { @@ -600,7 +571,7 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch) } NS_IMETHODIMP -nsHTMLAnchorElement::GetPort(nsString& aPort) +nsHTMLAnchorElement::GetPort(nsAWritableString& aPort) { nsAutoString href; nsIURI *url; @@ -610,11 +581,13 @@ nsHTMLAnchorElement::GetPort(nsString& aPort) if (NS_OK == result) { result = NS_NewURI(&url, href); if (NS_OK == result) { - aPort.SetLength(0); + aPort.Truncate(0); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.AppendInt(port, 10); + nsAutoString portStr; + portStr.AppendInt(port); + aPort.Append(portStr); } NS_RELEASE(url); } @@ -624,7 +597,7 @@ nsHTMLAnchorElement::GetPort(nsString& aPort) } NS_IMETHODIMP -nsHTMLAnchorElement::GetHash(nsString& aHash) +nsHTMLAnchorElement::GetHash(nsAWritableString& aHash) { nsAutoString href; nsIURI *uri; @@ -643,8 +616,8 @@ nsHTMLAnchorElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.AssignWithConversion("#"); - aHash.AppendWithConversion(ref); + aHash.Assign(NS_LITERAL_STRING("#")); + aHash.Append(NS_ConvertASCIItoUCS2(ref)); nsCRT::free(ref); } else { @@ -658,7 +631,7 @@ nsHTMLAnchorElement::GetHash(nsString& aHash) } NS_IMETHODIMP -nsHTMLAnchorElement::GetText(nsString& aText) +nsHTMLAnchorElement::GetText(nsAWritableString& aText) { aText.Truncate(); diff --git a/layout/html/content/src/nsHTMLAppletElement.cpp b/layout/html/content/src/nsHTMLAppletElement.cpp index 4db86f67d363..d65a74db4df0 100644 --- a/layout/html/content/src/nsHTMLAppletElement.cpp +++ b/layout/html/content/src/nsHTMLAppletElement.cpp @@ -72,28 +72,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLAppletElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetAlt(nsString& aAlt); - NS_IMETHOD SetAlt(const nsString& aAlt); - NS_IMETHOD GetArchive(nsString& aArchive); - NS_IMETHOD SetArchive(const nsString& aArchive); - NS_IMETHOD GetCode(nsString& aCode); - NS_IMETHOD SetCode(const nsString& aCode); - NS_IMETHOD GetCodeBase(nsString& aCodeBase); - NS_IMETHOD SetCodeBase(const nsString& aCodeBase); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetHspace(nsString& aHspace); - NS_IMETHOD SetHspace(const nsString& aHspace); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetObject(nsString& aObject); - NS_IMETHOD SetObject(const nsString& aObject); - NS_IMETHOD GetVspace(nsString& aVspace); - NS_IMETHOD SetVspace(const nsString& aVspace); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLAPPLETELEMENT // nsIJSScriptObject virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, @@ -209,7 +188,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Width, width) NS_IMETHODIMP nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -227,7 +206,7 @@ nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLAreaElement.cpp b/layout/html/content/src/nsHTMLAreaElement.cpp index 25874c0cc1e8..e0b6ce7875e4 100644 --- a/layout/html/content/src/nsHTMLAreaElement.cpp +++ b/layout/html/content/src/nsHTMLAreaElement.cpp @@ -62,31 +62,10 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLAreaElement - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetAlt(nsString& aAlt); - NS_IMETHOD SetAlt(const nsString& aAlt); - NS_IMETHOD GetCoords(nsString& aCoords); - NS_IMETHOD SetCoords(const nsString& aCoords); - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetNoHref(PRBool* aNoHref); - NS_IMETHOD SetNoHref(PRBool aNoHref); - NS_IMETHOD GetShape(nsString& aShape); - NS_IMETHOD SetShape(const nsString& aShape); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); + NS_DECL_IDOMHTMLAREAELEMENT // nsIDOMNSHTMLAreaElement - NS_IMETHOD GetProtocol(nsString& aProtocol); - NS_IMETHOD GetHost(nsString& aHost); - NS_IMETHOD GetHostname(nsString& aHostname); - NS_IMETHOD GetPathname(nsString& aPathname); - NS_IMETHOD GetSearch(nsString& aSearch); - NS_IMETHOD GetPort(nsString& aPort); - NS_IMETHOD GetHash(nsString& aHash); + NS_DECL_IDOMNSHTMLAREAELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -187,7 +166,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Target, target) NS_IMETHODIMP nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::nohref) { @@ -206,7 +185,7 @@ nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLAreaElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -279,13 +258,13 @@ nsHTMLAreaElement::RemoveFocus(nsIPresContext* aPresContext) } NS_IMETHODIMP -nsHTMLAreaElement::GetHref(nsString& aValue) +nsHTMLAreaElement::GetHref(nsAWritableString& aValue) { char *buf; nsresult rv = GetHrefCString(buf); if (NS_FAILED(rv)) return rv; if (buf) { - aValue.AssignWithConversion(buf); + aValue.Assign(NS_ConvertASCIItoUCS2(buf)); nsCRT::free(buf); } // NS_IMPL_STRING_ATTR does nothing where we have (buf == null) @@ -293,7 +272,7 @@ nsHTMLAreaElement::GetHref(nsString& aValue) } NS_IMETHODIMP -nsHTMLAreaElement::SetHref(const nsString& aValue) +nsHTMLAreaElement::SetHref(const nsAReadableString& aValue) { // Clobber our "cache", so we'll recompute it the next time // somebody asks for it. @@ -309,7 +288,7 @@ nsHTMLAreaElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const } NS_IMETHODIMP -nsHTMLAreaElement::GetProtocol(nsString& aProtocol) +nsHTMLAreaElement::GetProtocol(nsAWritableString& aProtocol) { nsAutoString href; nsIURI *url; @@ -322,8 +301,8 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.AssignWithConversion(protocol); - aProtocol.AppendWithConversion(":"); + aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol)); + aProtocol.Append(NS_LITERAL_STRING(":")); nsCRT::free(protocol); } NS_RELEASE(url); @@ -334,7 +313,7 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol) } NS_IMETHODIMP -nsHTMLAreaElement::GetHost(nsString& aHost) +nsHTMLAreaElement::GetHost(nsAWritableString& aHost) { nsAutoString href; nsIURI *url; @@ -347,13 +326,15 @@ nsHTMLAreaElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.AssignWithConversion(host); + aHost.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.AppendWithConversion(":"); - aHost.AppendInt(port, 10); + aHost.Append(NS_LITERAL_STRING(":")); + nsAutoString portStr; + portStr.AppendInt(port, 10); + aHost.Append(portStr); } } NS_RELEASE(url); @@ -364,7 +345,7 @@ nsHTMLAreaElement::GetHost(nsString& aHost) } NS_IMETHODIMP -nsHTMLAreaElement::GetHostname(nsString& aHostname) +nsHTMLAreaElement::GetHostname(nsAWritableString& aHostname) { nsAutoString href; nsIURI *url; @@ -377,7 +358,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.AssignWithConversion(host); + aHostname.Assign(NS_ConvertASCIItoUCS2(host)); nsCRT::free(host); } NS_RELEASE(url); @@ -388,7 +369,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname) } NS_IMETHODIMP -nsHTMLAreaElement::GetPathname(nsString& aPathname) +nsHTMLAreaElement::GetPathname(nsAWritableString& aPathname) { nsAutoString href; nsCOMPtr uri; @@ -409,14 +390,14 @@ nsHTMLAreaElement::GetPathname(nsString& aPathname) result = url->GetFilePath(&file); NS_ENSURE_SUCCESS(result, result); - aPathname.AssignWithConversion(file); + aPathname.Assign(NS_ConvertASCIItoUCS2(file)); nsCRT::free(file); return result; } NS_IMETHODIMP -nsHTMLAreaElement::GetSearch(nsString& aSearch) +nsHTMLAreaElement::GetSearch(nsAWritableString& aSearch) { nsAutoString href; nsIURI *uri; @@ -434,8 +415,8 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.AssignWithConversion("?"); - aSearch.AppendWithConversion(search); + aSearch.Assign(NS_LITERAL_STRING("?")); + aSearch.Append(NS_ConvertASCIItoUCS2(search)); nsCRT::free(search); } else { @@ -449,7 +430,7 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch) } NS_IMETHODIMP -nsHTMLAreaElement::GetPort(nsString& aPort) +nsHTMLAreaElement::GetPort(nsAWritableString& aPort) { nsAutoString href; nsIURI *url; @@ -463,7 +444,9 @@ nsHTMLAreaElement::GetPort(nsString& aPort) PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.AppendInt(port, 10); + nsAutoString portStr; + portStr.AppendInt(port, 10); + aPort.Append(portStr); } NS_RELEASE(url); } @@ -473,7 +456,7 @@ nsHTMLAreaElement::GetPort(nsString& aPort) } NS_IMETHODIMP -nsHTMLAreaElement::GetHash(nsString& aHash) +nsHTMLAreaElement::GetHash(nsAWritableString& aHash) { nsAutoString href; nsIURI *uri; @@ -492,8 +475,8 @@ nsHTMLAreaElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.AssignWithConversion("#"); - aHash.AppendWithConversion(ref); + aHash.Assign(NS_LITERAL_STRING("#")); + aHash.Append(NS_ConvertASCIItoUCS2(ref)); nsCRT::free(ref); } else { diff --git a/layout/html/content/src/nsHTMLBRElement.cpp b/layout/html/content/src/nsHTMLBRElement.cpp index 75f5dbc0fcf5..4b49cdb82a05 100644 --- a/layout/html/content/src/nsHTMLBRElement.cpp +++ b/layout/html/content/src/nsHTMLBRElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBRElement - NS_IMETHOD GetClear(nsString& aClear); - NS_IMETHOD SetClear(const nsString& aClear); + NS_DECL_IDOMHTMLBRELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +136,7 @@ static nsGenericHTMLElement::EnumTable kClearTable[] = { NS_IMETHODIMP nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::clear) { @@ -151,7 +150,7 @@ nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBRElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::clear) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLBaseElement.cpp b/layout/html/content/src/nsHTMLBaseElement.cpp index b62883b1df20..f8fc9a137f34 100644 --- a/layout/html/content/src/nsHTMLBaseElement.cpp +++ b/layout/html/content/src/nsHTMLBaseElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBaseElement - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); + NS_DECL_IDOMHTMLBASEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBaseElement, Target, target) NS_IMETHODIMP nsHTMLBaseElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -140,7 +137,7 @@ nsHTMLBaseElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBaseElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLBaseFontElement.cpp b/layout/html/content/src/nsHTMLBaseFontElement.cpp index ccd45cda02c0..354957a740cd 100644 --- a/layout/html/content/src/nsHTMLBaseFontElement.cpp +++ b/layout/html/content/src/nsHTMLBaseFontElement.cpp @@ -54,12 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBaseElement - NS_IMETHOD GetColor(nsString& aColor); - NS_IMETHOD SetColor(const nsString& aColor); - NS_IMETHOD GetFace(nsString& aFace); - NS_IMETHOD SetFace(const nsString& aFace); - NS_IMETHOD GetSize(nsString& aSize); - NS_IMETHOD SetSize(const nsString& aSize); + NS_DECL_IDOMHTMLBASEFONTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -134,7 +129,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Size, size) NS_IMETHODIMP nsHTMLBaseFontElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -144,7 +139,7 @@ nsHTMLBaseFontElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLBodyElement.cpp b/layout/html/content/src/nsHTMLBodyElement.cpp index b3471aa7d13d..07b460b34e7e 100644 --- a/layout/html/content/src/nsHTMLBodyElement.cpp +++ b/layout/html/content/src/nsHTMLBodyElement.cpp @@ -193,18 +193,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLBodyElement - NS_IMETHOD GetALink(nsString& aALink); - NS_IMETHOD SetALink(const nsString& aALink); - NS_IMETHOD GetBackground(nsString& aBackground); - NS_IMETHOD SetBackground(const nsString& aBackground); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetLink(nsString& aLink); - NS_IMETHOD SetLink(const nsString& aLink); - NS_IMETHOD GetText(nsString& aText); - NS_IMETHOD SetText(const nsString& aText); - NS_IMETHOD GetVLink(nsString& aVLink); - NS_IMETHOD SetVLink(const nsString& aVLink); + NS_DECL_IDOMHTMLBODYELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -756,7 +745,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Text, text) NS_IMPL_STRING_ATTR(nsHTMLBodyElement, VLink, vlink) NS_IMETHODIMP -nsHTMLBodyElement::GetBgColor(nsString& aBgColor) +nsHTMLBodyElement::GetBgColor(nsAWritableString& aBgColor) { // If we don't have an attribute, find the actual color used for // (generally from the user agent style sheet) for compatibility @@ -805,14 +794,14 @@ nsHTMLBodyElement::GetBgColor(nsString& aBgColor) } NS_IMETHODIMP -nsHTMLBodyElement::SetBgColor(const nsString& aBgColor) +nsHTMLBodyElement::SetBgColor(const nsAReadableString& aBgColor) { return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor, PR_TRUE); } NS_IMETHODIMP nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if ((aAttribute == nsHTMLAtoms::bgcolor) || @@ -836,7 +825,7 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLBodyElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLButtonElement.cpp b/layout/html/content/src/nsHTMLButtonElement.cpp index 184cea0f03ea..28081d8ae86b 100644 --- a/layout/html/content/src/nsHTMLButtonElement.cpp +++ b/layout/html/content/src/nsHTMLButtonElement.cpp @@ -60,15 +60,15 @@ public: // nsIDOMElement // NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) - NS_IMETHOD GetTagName(nsString& aTagName) { + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { return mInner.GetTagName(aTagName); } - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn); - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue); - NS_IMETHOD RemoveAttribute(const nsString& aName) { + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn); + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue); + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { return mInner.RemoveAttribute(aName); } - NS_IMETHOD GetAttributeNode(const nsString& aName, + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNode(aName, aReturn); } @@ -78,41 +78,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return mInner.RemoveAttributeNode(aOldAttr, aReturn); } - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagName(aTagname, aReturn); } - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) { + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) { + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) { + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName); } - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return mInner.SetAttributeNodeNS(aNewAttr, aReturn); } - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { return mInner.HasAttribute(aName, aReturn); } - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) { + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } @@ -120,18 +120,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLButtonElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); + NS_DECL_IDOMHTMLBUTTONELEMENT // nsIDOMHTMLButtonElement NS_IMETHOD Blur(); @@ -215,14 +204,15 @@ nsHTMLButtonElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) } NS_IMETHODIMP -nsHTMLButtonElement::GetAttribute(const nsString& aName, nsString& aReturn) +nsHTMLButtonElement::GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { - if (aName.EqualsWithConversion("disabled", PR_TRUE)) { + nsAutoString name(aName); + if (name.EqualsWithConversion("disabled", PR_TRUE)) { nsresult rv = GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, aReturn); if (rv == NS_CONTENT_ATTR_NOT_THERE) { - aReturn.AssignWithConversion("false"); + aReturn.Assign(NS_LITERAL_STRING("false")); } else { - aReturn.AssignWithConversion("true"); + aReturn.Assign(NS_LITERAL_STRING("true")); } return NS_OK; @@ -232,10 +222,11 @@ nsHTMLButtonElement::GetAttribute(const nsString& aName, nsString& aReturn) } NS_IMETHODIMP -nsHTMLButtonElement::SetAttribute(const nsString& aName, const nsString& aValue) +nsHTMLButtonElement::SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { - if (aName.EqualsWithConversion("disabled", PR_TRUE) && - aValue.EqualsWithConversion("false", PR_TRUE)) { + nsAutoString name(aName), value(aValue); + if (name.EqualsWithConversion("disabled", PR_TRUE) && + value.EqualsWithConversion("false", PR_TRUE)) { return mInner.RemoveAttribute(aName); } @@ -285,7 +276,7 @@ nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm) return result; } NS_IMETHODIMP -nsHTMLButtonElement::GetType(nsString& aType) +nsHTMLButtonElement::GetType(nsAWritableString& aType) { return AttributeToString(nsHTMLAtoms::type, nsHTMLValue(mType, eHTMLUnit_Enumerated), @@ -387,7 +378,7 @@ static nsGenericHTMLElement::EnumTable kButtonTypeTable[] = { NS_IMETHODIMP nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::tabindex) { @@ -398,8 +389,9 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute, } else if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumTable *table = kButtonTypeTable; + nsAutoString val(aValue); while (nsnull != table->tag) { - if (aValue.EqualsIgnoreCase(table->tag)) { + if (val.EqualsIgnoreCase(table->tag)) { aResult.SetIntValue(table->value, eHTMLUnit_Enumerated); mType = table->value; return NS_CONTENT_ATTR_HAS_VALUE; @@ -417,7 +409,7 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLDListElement.cpp b/layout/html/content/src/nsHTMLDListElement.cpp index a6baf2a863ec..70b7819be8fa 100644 --- a/layout/html/content/src/nsHTMLDListElement.cpp +++ b/layout/html/content/src/nsHTMLDListElement.cpp @@ -129,7 +129,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLDListElement, Compact, compact) NS_IMETHODIMP nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::compact) { @@ -142,7 +142,7 @@ nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDListElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLDelElement.cpp b/layout/html/content/src/nsHTMLDelElement.cpp index a44dce8d4a48..d34dfb53e9e2 100644 --- a/layout/html/content/src/nsHTMLDelElement.cpp +++ b/layout/html/content/src/nsHTMLDelElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLModElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); - NS_IMETHOD GetDateTime(nsString& aDateTime); - NS_IMETHOD SetDateTime(const nsString& aDateTime); + NS_DECL_IDOMHTMLMODELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLDelElement, DateTime, datetime) NS_IMETHODIMP nsHTMLDelElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -141,7 +138,7 @@ nsHTMLDelElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDelElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLDirectoryElement.cpp b/layout/html/content/src/nsHTMLDirectoryElement.cpp index e0c3b8d51a87..60d9b0b0fbb1 100644 --- a/layout/html/content/src/nsHTMLDirectoryElement.cpp +++ b/layout/html/content/src/nsHTMLDirectoryElement.cpp @@ -133,7 +133,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLDirectoryElement, Compact, compact) NS_IMETHODIMP nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -157,7 +157,7 @@ nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDirectoryElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable, aResult); diff --git a/layout/html/content/src/nsHTMLDivElement.cpp b/layout/html/content/src/nsHTMLDivElement.cpp index b77d8134dba4..6571b1e0f398 100644 --- a/layout/html/content/src/nsHTMLDivElement.cpp +++ b/layout/html/content/src/nsHTMLDivElement.cpp @@ -57,8 +57,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLDivElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLDIVELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -130,7 +129,7 @@ NS_IMPL_STRING_ATTR(nsHTMLDivElement, Align, align) NS_IMETHODIMP nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -160,7 +159,7 @@ nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLDivElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLEmbedElement.cpp b/layout/html/content/src/nsHTMLEmbedElement.cpp index e84693d42fc1..d280ca1f4b63 100644 --- a/layout/html/content/src/nsHTMLEmbedElement.cpp +++ b/layout/html/content/src/nsHTMLEmbedElement.cpp @@ -155,7 +155,7 @@ nsHTMLEmbedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLEmbedElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -173,7 +173,7 @@ nsHTMLEmbedElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLEmbedElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLFieldSetElement.cpp b/layout/html/content/src/nsHTMLFieldSetElement.cpp index e7d07fca0f7f..ff6d850f9d2a 100644 --- a/layout/html/content/src/nsHTMLFieldSetElement.cpp +++ b/layout/html/content/src/nsHTMLFieldSetElement.cpp @@ -224,7 +224,7 @@ nsHTMLFieldSetElement::SetForm(nsIDOMHTMLFormElement* aForm) NS_IMETHODIMP nsHTMLFieldSetElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -233,7 +233,7 @@ nsHTMLFieldSetElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFieldSetElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLFontElement.cpp b/layout/html/content/src/nsHTMLFontElement.cpp index 170e0fd2bb46..5b1bd7bab4c0 100644 --- a/layout/html/content/src/nsHTMLFontElement.cpp +++ b/layout/html/content/src/nsHTMLFontElement.cpp @@ -58,12 +58,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLFontElement - NS_IMETHOD GetColor(nsString& aColor); - NS_IMETHOD SetColor(const nsString& aColor); - NS_IMETHOD GetFace(nsString& aFace); - NS_IMETHOD SetFace(const nsString& aFace); - NS_IMETHOD GetSize(nsString& aSize); - NS_IMETHOD SetSize(const nsString& aSize); + NS_DECL_IDOMHTMLFONTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -138,7 +133,7 @@ NS_IMPL_STRING_ATTR(nsHTMLFontElement, Size, size) NS_IMETHODIMP nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if ((aAttribute == nsHTMLAtoms::size) || @@ -167,22 +162,25 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if ((aAttribute == nsHTMLAtoms::size) || (aAttribute == nsHTMLAtoms::pointSize) || (aAttribute == nsHTMLAtoms::fontWeight)) { aResult.Truncate(); + nsAutoString intVal; if (aValue.GetUnit() == eHTMLUnit_Enumerated) { - aResult.AppendInt(aValue.GetIntValue(), 10); + intVal.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(intVal); return NS_CONTENT_ATTR_HAS_VALUE; } else if (aValue.GetUnit() == eHTMLUnit_Integer) { PRInt32 value = aValue.GetIntValue(); if (value >= 0) { - aResult.AppendWithConversion('+'); + aResult.Append(NS_LITERAL_STRING("+")); } - aResult.AppendInt(value, 10); + intVal.AppendInt(value, 10); + aResult.Append(intVal); return NS_CONTENT_ATTR_HAS_VALUE; } return NS_CONTENT_ATTR_NOT_THERE; diff --git a/layout/html/content/src/nsHTMLFormElement.cpp b/layout/html/content/src/nsHTMLFormElement.cpp index 705ea80bfa11..b8afa802a830 100644 --- a/layout/html/content/src/nsHTMLFormElement.cpp +++ b/layout/html/content/src/nsHTMLFormElement.cpp @@ -85,10 +85,7 @@ public: NS_DECL_IDOMHTMLFORMELEMENT // nsIDOMNSHTMLFormElement - NS_IMETHOD GetEncoding(nsString& aEncoding); - NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn); - NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); - + NS_DECL_IDOMNSHTMLFORMELEMENT // nsIContent NS_IMPL_ICONTENT_USING_GENERIC(mInner) @@ -113,11 +110,11 @@ public: // nsIForm NS_IMETHOD AddElement(nsIFormControl* aElement); - NS_IMETHOD AddElementToTable(nsIFormControl* aChild, const nsString& aName); + NS_IMETHOD AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName); NS_IMETHOD GetElementAt(PRInt32 aIndex, nsIFormControl** aElement) const; NS_IMETHOD GetElementCount(PRUint32* aCount) const; NS_IMETHOD RemoveElement(nsIFormControl* aElement); - NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsString& aName); + NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsAReadableString& aName); protected: nsFormControlList* mControls; @@ -145,8 +142,8 @@ public: nsresult GetNamedObject(JSContext* aContext, jsval aID, JSObject** aObj); - nsresult AddElementToTable(nsIFormControl* aChild, const nsString& aName); - nsresult RemoveElementFromTable(nsIFormControl* aChild, const nsString& aName); + nsresult AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName); + nsresult RemoveElementFromTable(nsIFormControl* aChild, const nsAReadableString& aName); #ifdef DEBUG nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; @@ -261,13 +258,13 @@ nsHTMLFormElement::GetElements(nsIDOMHTMLCollection** aElements) } NS_IMETHODIMP -nsHTMLFormElement::GetName(nsString& aValue) +nsHTMLFormElement::GetName(nsAWritableString& aValue) { return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, aValue); } NS_IMETHODIMP -nsHTMLFormElement::SetName(const nsString& aValue) +nsHTMLFormElement::SetName(const nsAReadableString& aValue) { return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, aValue, PR_TRUE); } @@ -361,7 +358,7 @@ static nsGenericHTMLElement::EnumTable kFormEnctypeTable[] = { NS_IMETHODIMP nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::method) { @@ -380,7 +377,7 @@ nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFormElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::method) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { @@ -500,7 +497,7 @@ nsHTMLFormElement::AddElement(nsIFormControl* aChild) } NS_IMETHODIMP -nsHTMLFormElement::AddElementToTable(nsIFormControl* aChild, const nsString& aName) +nsHTMLFormElement::AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName) { return mControls->AddElementToTable(aChild, aName); } @@ -516,13 +513,13 @@ nsHTMLFormElement::RemoveElement(nsIFormControl* aChild) NS_IMETHODIMP nsHTMLFormElement::RemoveElementFromTable(nsIFormControl* aElement, - const nsString& aName) + const nsAReadableString& aName) { return mControls->RemoveElementFromTable(aElement, aName); } NS_IMETHODIMP -nsHTMLFormElement::GetEncoding(nsString& aEncoding) +nsHTMLFormElement::GetEncoding(nsAWritableString& aEncoding) { return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::enctype, aEncoding); } @@ -888,7 +885,7 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID, JSObject** aOb if (mLookupTable) { // Get the hash entry - nsString ustr; ustr.AssignWithConversion(str); + nsAutoString ustr; ustr.AssignWithConversion(str); nsStringKey key(ustr); nsCOMPtr tmp = dont_AddRef((nsISupports *)mLookupTable->Get(&key)); @@ -952,7 +949,7 @@ nsFormControlList::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* a } NS_IMETHODIMP -nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsFormControlList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -985,7 +982,7 @@ nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) } nsresult -nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsString& aName) +nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName) { nsStringKey key(aName); if (!mLookupTable) { @@ -1054,9 +1051,8 @@ nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsString& aNa nsresult nsFormControlList::RemoveElementFromTable(nsIFormControl* aChild, - const nsString& aName) + const nsAReadableString& aName) { - nsAutoString name; nsCOMPtr content = do_QueryInterface(aChild); if (mLookupTable && content) { nsStringKey key(aName); diff --git a/layout/html/content/src/nsHTMLFrameElement.cpp b/layout/html/content/src/nsHTMLFrameElement.cpp index cdfe3d5654f3..c472fa0c3bec 100644 --- a/layout/html/content/src/nsHTMLFrameElement.cpp +++ b/layout/html/content/src/nsHTMLFrameElement.cpp @@ -61,24 +61,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLFrameElement - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder); - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder); - NS_IMETHOD GetLongDesc(nsString& aLongDesc); - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight); - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight); - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth); - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetNoResize(PRBool* aNoResize); - NS_IMETHOD SetNoResize(PRBool aNoResize); - NS_IMETHOD GetScrolling(nsString& aScrolling); - NS_IMETHOD SetScrolling(const nsString& aScrolling); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); - NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); + NS_DECL_IDOMHTMLFRAMEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -206,7 +189,7 @@ nsHTMLFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument) NS_IMETHODIMP nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::bordercolor) { @@ -247,7 +230,7 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFrameElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { nsGenericHTMLElement::FrameborderValueToString(PR_FALSE, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLFrameSetElement.cpp b/layout/html/content/src/nsHTMLFrameSetElement.cpp index 36559dd8d333..a4bba4d811a2 100644 --- a/layout/html/content/src/nsHTMLFrameSetElement.cpp +++ b/layout/html/content/src/nsHTMLFrameSetElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLFrameSetElement - NS_IMETHOD GetCols(nsString& aCols); - NS_IMETHOD SetCols(const nsString& aCols); - NS_IMETHOD GetRows(nsString& aRows); - NS_IMETHOD SetRows(const nsString& aRows); + NS_DECL_IDOMHTMLFRAMESETELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Rows, rows) NS_IMETHODIMP nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::bordercolor) { @@ -156,7 +153,7 @@ nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { // XXX need to check for correct mode diff --git a/layout/html/content/src/nsHTMLHRElement.cpp b/layout/html/content/src/nsHTMLHRElement.cpp index b98d9df918f4..56d07809802d 100644 --- a/layout/html/content/src/nsHTMLHRElement.cpp +++ b/layout/html/content/src/nsHTMLHRElement.cpp @@ -55,14 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHRElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetNoShade(PRBool* aNoShade); - NS_IMETHOD SetNoShade(PRBool aNoShade); - NS_IMETHOD GetSize(nsString& aSize); - NS_IMETHOD SetSize(const nsString& aSize); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLHRELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -170,7 +163,7 @@ static nsGenericHTMLElement::EnumTable kAlignTable[] = { NS_IMETHODIMP nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::width) { @@ -199,7 +192,7 @@ nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHRElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLHeadElement.cpp b/layout/html/content/src/nsHTMLHeadElement.cpp index 63836516d5d9..9bd2350088a5 100644 --- a/layout/html/content/src/nsHTMLHeadElement.cpp +++ b/layout/html/content/src/nsHTMLHeadElement.cpp @@ -54,8 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHeadElement - NS_IMETHOD GetProfile(nsString& aProfile); - NS_IMETHOD SetProfile(const nsString& aProfile); + NS_DECL_IDOMHTMLHEADELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -128,7 +127,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHeadElement, Profile, profile) NS_IMETHODIMP nsHTMLHeadElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -137,7 +136,7 @@ nsHTMLHeadElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHeadElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLHeadingElement.cpp b/layout/html/content/src/nsHTMLHeadingElement.cpp index 76ca3a5ce226..d13e146a6961 100644 --- a/layout/html/content/src/nsHTMLHeadingElement.cpp +++ b/layout/html/content/src/nsHTMLHeadingElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHeadingElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLHEADINGELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -129,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHeadingElement, Align, align) NS_IMETHODIMP nsHTMLHeadingElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -143,7 +142,7 @@ nsHTMLHeadingElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHeadingElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLHtmlElement.cpp b/layout/html/content/src/nsHTMLHtmlElement.cpp index ebdddd43de78..cdc9f3624931 100644 --- a/layout/html/content/src/nsHTMLHtmlElement.cpp +++ b/layout/html/content/src/nsHTMLHtmlElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLHtmlElement - NS_IMETHOD GetVersion(nsString& aVersion); - NS_IMETHOD SetVersion(const nsString& aVersion); + NS_DECL_IDOMHTMLHTMLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -134,7 +133,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHtmlElement, Version, version) NS_IMETHODIMP nsHTMLHtmlElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -143,7 +142,7 @@ nsHTMLHtmlElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLHtmlElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLIFrameElement.cpp b/layout/html/content/src/nsHTMLIFrameElement.cpp index de8d285ff6f4..417f4a54158b 100644 --- a/layout/html/content/src/nsHTMLIFrameElement.cpp +++ b/layout/html/content/src/nsHTMLIFrameElement.cpp @@ -62,28 +62,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLIFrameElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetFrameBorder(nsString& aFrameBorder); - NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetLongDesc(nsString& aLongDesc); - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); - NS_IMETHOD GetMarginHeight(nsString& aMarginHeight); - NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight); - NS_IMETHOD GetMarginWidth(nsString& aMarginWidth); - NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetScrolling(nsString& aScrolling); - NS_IMETHOD SetScrolling(const nsString& aScrolling); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); - NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); - NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); + NS_DECL_IDOMHTMLIFRAMEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -213,7 +192,7 @@ nsHTMLIFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument) NS_IMETHODIMP nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::marginwidth) { @@ -261,7 +240,7 @@ nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLIFrameElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { nsGenericHTMLElement::FrameborderValueToString(PR_TRUE, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLImageElement.cpp b/layout/html/content/src/nsHTMLImageElement.cpp index 75718e5afc76..7cf729fb62aa 100644 --- a/layout/html/content/src/nsHTMLImageElement.cpp +++ b/layout/html/content/src/nsHTMLImageElement.cpp @@ -86,37 +86,12 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLImageElement - NS_IMETHOD GetLowSrc(nsString& aLowSrc); - NS_IMETHOD SetLowSrc(const nsString& aLowSrc); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetAlt(nsString& aAlt); - NS_IMETHOD SetAlt(const nsString& aAlt); - NS_IMETHOD GetBorder(nsString& aBorder); - NS_IMETHOD SetBorder(const nsString& aBorder); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetHspace(nsString& aHspace); - NS_IMETHOD SetHspace(const nsString& aHspace); - NS_IMETHOD GetIsMap(PRBool* aIsMap); - NS_IMETHOD SetIsMap(PRBool aIsMap); - NS_IMETHOD GetLongDesc(nsString& aLongDesc); - NS_IMETHOD SetLongDesc(const nsString& aLongDesc); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetUseMap(nsString& aUseMap); - NS_IMETHOD SetUseMap(const nsString& aUseMap); - NS_IMETHOD GetVspace(nsString& aVspace); - NS_IMETHOD SetVspace(const nsString& aVspace); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLIMAGEELEMENT // nsIDOMImage // XXX Casing is different for backward compatibility - NS_IMETHOD GetLowsrc(nsString& aLowsrc); - NS_IMETHOD SetLowsrc(const nsString& aLowsrc); + NS_IMETHOD GetLowsrc(nsAWritableString& aLowsrc); + NS_IMETHOD SetLowsrc(const nsAReadableString& aLowsrc); NS_IMETHOD GetComplete(PRBool* aComplete); NS_IMETHOD GetBorder(PRInt32* aBorder); NS_IMETHOD SetBorder(PRInt32 aBorder); @@ -154,7 +129,7 @@ public: // nsIJSNativeInitializer NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj, PRUint32 argc, jsval *argv); - nsresult SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc); + nsresult SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc); nsresult GetCallerSourceURL(JSContext* cx, nsIURI** sourceURL); nsresult GetImageFrame(nsImageFrame** aImageFrame); @@ -342,7 +317,7 @@ nsHTMLImageElement::GetComplete(PRBool* aComplete) } NS_IMETHODIMP -nsHTMLImageElement::GetHeight(nsString& aValue) +nsHTMLImageElement::GetHeight(nsAWritableString& aValue) { nsresult rv = mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, aValue); @@ -354,8 +329,10 @@ nsHTMLImageElement::GetHeight(nsString& aValue) // A zero height most likely means that the image is not loaded yet. if (NS_SUCCEEDED(GetHeight(&height)) && height) { - aValue.AppendInt(height); - aValue.AppendWithConversion("px"); + nsAutoString heightStr; + heightStr.AppendInt(height); + aValue.Append(heightStr); + aValue.Append(NS_LITERAL_STRING("px")); } } @@ -363,7 +340,7 @@ nsHTMLImageElement::GetHeight(nsString& aValue) } NS_IMETHODIMP -nsHTMLImageElement::SetHeight(const nsString& aValue) +nsHTMLImageElement::SetHeight(const nsAReadableString& aValue) { return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, aValue, PR_TRUE); @@ -416,7 +393,7 @@ nsHTMLImageElement::SetHeight(PRInt32 aHeight) } NS_IMETHODIMP -nsHTMLImageElement::GetWidth(nsString& aValue) +nsHTMLImageElement::GetWidth(nsAWritableString& aValue) { nsresult rv = mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, aValue); @@ -428,8 +405,10 @@ nsHTMLImageElement::GetWidth(nsString& aValue) // A zero width most likely means that the image is not loaded yet. if (NS_SUCCEEDED(GetWidth(&width)) && width) { - aValue.AppendInt(width); - aValue.AppendWithConversion("px"); + nsAutoString widthStr; + widthStr.AppendInt(width); + aValue.Append(widthStr); + aValue.Append(NS_LITERAL_STRING("px")); } } @@ -437,7 +416,7 @@ nsHTMLImageElement::GetWidth(nsString& aValue) } NS_IMETHODIMP -nsHTMLImageElement::SetWidth(const nsString& aValue) +nsHTMLImageElement::SetWidth(const nsAReadableString& aValue) { return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, aValue, PR_TRUE); @@ -491,7 +470,7 @@ nsHTMLImageElement::SetWidth(PRInt32 aWidth) NS_IMETHODIMP nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -513,7 +492,7 @@ nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLImageElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { @@ -843,7 +822,7 @@ nsHTMLImageElement::SetDocument(nsIDocument* aDocument, } NS_IMETHODIMP -nsHTMLImageElement::GetSrc(nsString& aSrc) +nsHTMLImageElement::GetSrc(nsAWritableString& aSrc) { // Resolve url to an absolute url nsresult rv = NS_OK; @@ -869,7 +848,7 @@ nsHTMLImageElement::GetSrc(nsString& aSrc) } nsresult -nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc) +nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc) { nsresult result = NS_OK; @@ -947,7 +926,7 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc) } NS_IMETHODIMP -nsHTMLImageElement::SetSrc(const nsString& aSrc) +nsHTMLImageElement::SetSrc(const nsAReadableString& aSrc) { nsIURI* baseURL = nsnull; nsresult result = NS_OK; diff --git a/layout/html/content/src/nsHTMLInputElement.cpp b/layout/html/content/src/nsHTMLInputElement.cpp index fbbf8363bffa..4a727ff6f59a 100644 --- a/layout/html/content/src/nsHTMLInputElement.cpp +++ b/layout/html/content/src/nsHTMLInputElement.cpp @@ -97,13 +97,13 @@ public: // nsIDOMElement // can't use the macro here because input type=text needs to notify up to // frame system on SetAttribute("value"); - NS_IMETHOD GetTagName(nsString& aTagName) { + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { return mInner.GetTagName(aTagName); } - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return mInner.GetAttribute(aName, aReturn); } - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { nsAutoString valueAttribute; nsHTMLAtoms::value->ToString(valueAttribute); if (PR_TRUE==valueAttribute.Equals(aName)) { @@ -112,10 +112,10 @@ public: } return mInner.SetAttribute(aName, aValue); } - NS_IMETHOD RemoveAttribute(const nsString& aName) { + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { return mInner.RemoveAttribute(aName); } - NS_IMETHOD GetAttributeNode(const nsString& aName, + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNode(aName, aReturn); } @@ -125,41 +125,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return mInner.RemoveAttributeNode(aOldAttr, aReturn); } - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagName(aTagname, aReturn); } - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) { + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) { + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) { + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName); } - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return mInner.SetAttributeNodeNS(aNewAttr, aReturn); } - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { return mInner.HasAttribute(aName, aReturn); } - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) { + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } @@ -318,13 +318,13 @@ nsHTMLInputElement::GetForm(nsIDOMHTMLFormElement** aForm) } NS_IMETHODIMP -nsHTMLInputElement::GetDefaultValue(nsString& aDefaultValue) +nsHTMLInputElement::GetDefaultValue(nsAWritableString& aDefaultValue) { return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aDefaultValue); } NS_IMETHODIMP -nsHTMLInputElement::SetDefaultValue(const nsString& aDefaultValue) +nsHTMLInputElement::SetDefaultValue(const nsAReadableString& aDefaultValue) { return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aDefaultValue, PR_TRUE); } @@ -374,7 +374,7 @@ NS_IMPL_STRING_ATTR(nsHTMLInputElement, Type, type) //NS_IMPL_STRING_ATTR(nsHTMLInputElement, Value, value) NS_IMETHODIMP -nsHTMLInputElement::GetValue(nsString& aValue) +nsHTMLInputElement::GetValue(nsAWritableString& aValue) { PRInt32 type; GetType(&type); @@ -392,8 +392,7 @@ nsHTMLInputElement::GetValue(nsString& aValue) // Obtain the value property from the presentation state. if (presState) { - nsAutoString value; - presState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue); + presState->GetStateProperty(NS_LITERAL_STRING("value"), aValue); } } @@ -405,7 +404,7 @@ nsHTMLInputElement::GetValue(nsString& aValue) NS_IMETHODIMP -nsHTMLInputElement::SetValue(const nsString& aValue) +nsHTMLInputElement::SetValue(const nsAReadableString& aValue) { PRInt32 type; GetType(&type); @@ -444,7 +443,7 @@ nsHTMLInputElement::SetValue(const nsString& aValue) // Obtain the value property from the presentation state. if (presState) { - presState->SetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue); + presState->SetStateProperty(NS_LITERAL_STRING("value"), aValue); } } return NS_OK; @@ -1026,13 +1025,14 @@ static nsGenericHTMLElement::EnumTable kInputTypeTable[] = { NS_IMETHODIMP nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumTable *table = kInputTypeTable; + nsAutoString valueStr(aValue); while (nsnull != table->tag) { - if (aValue.EqualsIgnoreCase(table->tag)) { + if (valueStr.EqualsIgnoreCase(table->tag)) { aResult.SetIntValue(table->value, eHTMLUnit_Enumerated); mType = table->value; // set the type of this input return NS_CONTENT_ATTR_HAS_VALUE; @@ -1101,7 +1101,7 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLInputElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLInsElement.cpp b/layout/html/content/src/nsHTMLInsElement.cpp index 56aa6b1aac89..30d245dd6d73 100644 --- a/layout/html/content/src/nsHTMLInsElement.cpp +++ b/layout/html/content/src/nsHTMLInsElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLModElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); - NS_IMETHOD GetDateTime(nsString& aDateTime); - NS_IMETHOD SetDateTime(const nsString& aDateTime); + NS_DECL_IDOMHTMLMODELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLInsElement, DateTime, datetime) NS_IMETHODIMP nsHTMLInsElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -141,7 +138,7 @@ nsHTMLInsElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLInsElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLIsIndexElement.cpp b/layout/html/content/src/nsHTMLIsIndexElement.cpp index ac911b53d3fe..27a9b5ccc32f 100644 --- a/layout/html/content/src/nsHTMLIsIndexElement.cpp +++ b/layout/html/content/src/nsHTMLIsIndexElement.cpp @@ -54,9 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLIsIndexElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetPrompt(nsString& aPrompt); - NS_IMETHOD SetPrompt(const nsString& aPrompt); + NS_DECL_IDOMHTMLISINDEXELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +135,7 @@ NS_IMPL_STRING_ATTR(nsHTMLIsIndexElement, Prompt, prompt) NS_IMETHODIMP nsHTMLIsIndexElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -147,7 +145,7 @@ nsHTMLIsIndexElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLIsIndexElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLLIElement.cpp b/layout/html/content/src/nsHTMLLIElement.cpp index 6a89d5f1b237..784c9df4585e 100644 --- a/layout/html/content/src/nsHTMLLIElement.cpp +++ b/layout/html/content/src/nsHTMLLIElement.cpp @@ -55,10 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLIElement - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); - NS_IMETHOD GetValue(PRInt32* aValue); - NS_IMETHOD SetValue(PRInt32 aValue); + NS_DECL_IDOMHTMLLIELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -145,7 +142,7 @@ static nsGenericHTMLElement::EnumTable kListItemTypeTable[] = { NS_IMETHODIMP nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -166,7 +163,7 @@ nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLIElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { PRInt32 v = aValue.GetIntValue(); diff --git a/layout/html/content/src/nsHTMLLabelElement.cpp b/layout/html/content/src/nsHTMLLabelElement.cpp index 9dbd66cefb4f..29d287453eaf 100644 --- a/layout/html/content/src/nsHTMLLabelElement.cpp +++ b/layout/html/content/src/nsHTMLLabelElement.cpp @@ -64,31 +64,35 @@ public: // nsIDOMElement, because of the "htmlFor" attribute handling we can't // use the NS_IMPL_IDOMELEMENT_USING_GENERIC macro here... - NS_IMETHOD GetTagName(nsString& aTagName) { + NS_IMETHOD GetTagName(nsAWritableString& aTagName) { return mInner.GetTagName(aTagName); } - NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.GetAttribute(NS_ConvertASCIItoUCS2("for"), aReturn); + NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.GetAttribute(NS_LITERAL_STRING("for"), aReturn); } return mInner.GetAttribute(aName, aReturn); } - NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.SetAttribute(NS_ConvertASCIItoUCS2("for"), aValue); + NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.SetAttribute(NS_LITERAL_STRING("for"), aValue); } return mInner.SetAttribute(aName, aValue); } - NS_IMETHOD RemoveAttribute(const nsString& aName) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.RemoveAttribute(NS_ConvertASCIItoUCS2("for")); + NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.RemoveAttribute(NS_LITERAL_STRING("for")); } return mInner.RemoveAttribute(aName); } - NS_IMETHOD GetAttributeNode(const nsString& aName, + NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, nsIDOMAttr** aReturn) { - if (aName.EqualsIgnoreCase("htmlfor")) { - return mInner.GetAttributeNode(NS_ConvertASCIItoUCS2("for"), aReturn); + nsAutoString name(aName); + if (name.EqualsIgnoreCase("htmlfor")) { + return mInner.GetAttributeNode(NS_LITERAL_STRING("for"), aReturn); } return mInner.GetAttributeNode(aName, aReturn); } @@ -98,41 +102,41 @@ public: NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return mInner.RemoveAttributeNode(aOldAttr, aReturn); } - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, + NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagName(aTagname, aReturn); } - NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) { + NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsAWritableString& aReturn) { return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) { + NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); } - NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) { + NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName); } - NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); } NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return mInner.SetAttributeNodeNS(aNewAttr, aReturn); } - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } - NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { + NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { return HasAttribute(aName, aReturn); } - NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) { + NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, PRBool* aReturn) { return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); } @@ -140,12 +144,8 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLabelElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); + NS_DECL_IDOMHTMLLABELELEMENT NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -307,14 +307,14 @@ NS_IMPL_STRING_ATTR(nsHTMLLabelElement, AccessKey, accesskey) //NS_IMPL_STRING_ATTR(nsHTMLLabelElement, HtmlFor, _for) NS_IMETHODIMP -nsHTMLLabelElement::GetHtmlFor(nsString& aValue) +nsHTMLLabelElement::GetHtmlFor(nsAWritableString& aValue) { mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_for, aValue); return NS_OK; } NS_IMETHODIMP -nsHTMLLabelElement::SetHtmlFor(const nsString& aValue) +nsHTMLLabelElement::SetHtmlFor(const nsAReadableString& aValue) { // trim leading and trailing whitespace static char whitespace[] = " \r\n\t"; @@ -325,7 +325,7 @@ nsHTMLLabelElement::SetHtmlFor(const nsString& aValue) NS_IMETHODIMP nsHTMLLabelElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -334,7 +334,7 @@ nsHTMLLabelElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLabelElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLLayerElement.cpp b/layout/html/content/src/nsHTMLLayerElement.cpp index 7453d9c2b299..dcaeece50e16 100644 --- a/layout/html/content/src/nsHTMLLayerElement.cpp +++ b/layout/html/content/src/nsHTMLLayerElement.cpp @@ -61,21 +61,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLayerElement - NS_IMETHOD GetTop(PRInt32* aTop); - NS_IMETHOD SetTop(PRInt32 aTop); - NS_IMETHOD GetLeft(PRInt32* aLeft); - NS_IMETHOD SetLeft(PRInt32 aLeft); - NS_IMETHOD GetVisibility(nsString& aVisibility); - NS_IMETHOD SetVisibility(const nsString& aVisibility); - NS_IMETHOD GetBackground(nsString& aBackground); - NS_IMETHOD SetBackground(const nsString& aBackground); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetZIndex(PRInt32* aZIndex); - NS_IMETHOD SetZIndex(PRInt32 aZIndex); - NS_IMETHOD GetDocument(nsIDOMDocument** aReturn); + NS_DECL_IDOMHTMLLAYERELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -182,7 +168,7 @@ static nsGenericHTMLElement::EnumTable kVisibilityTable[] = { NS_IMETHODIMP nsHTMLLayerElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX CLIP @@ -218,7 +204,7 @@ nsHTMLLayerElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLayerElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::visibility) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLLegendElement.cpp b/layout/html/content/src/nsHTMLLegendElement.cpp index 18db6c42a796..54a181334a97 100644 --- a/layout/html/content/src/nsHTMLLegendElement.cpp +++ b/layout/html/content/src/nsHTMLLegendElement.cpp @@ -61,11 +61,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLegendElement - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLLEGENDELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -251,7 +247,7 @@ static nsGenericHTMLElement::EnumTable kAlignTable[] = { NS_IMETHODIMP nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -265,7 +261,7 @@ nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLegendElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLLinkElement.cpp b/layout/html/content/src/nsHTMLLinkElement.cpp index b3f4d5f15e58..701edd03dd41 100644 --- a/layout/html/content/src/nsHTMLLinkElement.cpp +++ b/layout/html/content/src/nsHTMLLinkElement.cpp @@ -66,24 +66,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLLinkElement - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetCharset(nsString& aCharset); - NS_IMETHOD SetCharset(const nsString& aCharset); - NS_IMETHOD GetHref(nsString& aHref); - NS_IMETHOD SetHref(const nsString& aHref); - NS_IMETHOD GetHreflang(nsString& aHreflang); - NS_IMETHOD SetHreflang(const nsString& aHreflang); - NS_IMETHOD GetMedia(nsString& aMedia); - NS_IMETHOD SetMedia(const nsString& aMedia); - NS_IMETHOD GetRel(nsString& aRel); - NS_IMETHOD SetRel(const nsString& aRel); - NS_IMETHOD GetRev(nsString& aRev); - NS_IMETHOD SetRev(const nsString& aRev); - NS_IMETHOD GetTarget(nsString& aTarget); - NS_IMETHOD SetTarget(const nsString& aTarget); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLLINKELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -237,13 +220,13 @@ NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Target, target) NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Type, type) NS_IMETHODIMP -nsHTMLLinkElement::GetHref(nsString& aValue) +nsHTMLLinkElement::GetHref(nsAWritableString& aValue) { char *buf; nsresult rv = GetHrefCString(buf); if (NS_FAILED(rv)) return rv; if (buf) { - aValue.AssignWithConversion(buf); + aValue.Assign(NS_ConvertASCIItoUCS2(buf)); nsCRT::free(buf); } // NS_IMPL_STRING_ATTR does nothing where we have (buf == null) @@ -251,7 +234,7 @@ nsHTMLLinkElement::GetHref(nsString& aValue) } NS_IMETHODIMP -nsHTMLLinkElement::SetHref(const nsString& aValue) +nsHTMLLinkElement::SetHref(const nsAReadableString& aValue) { // Clobber our "cache", so we'll recompute it the next time // somebody asks for it. @@ -282,7 +265,7 @@ nsHTMLLinkElement::GetStyleSheet(nsIStyleSheet*& aStyleSheet) NS_IMETHODIMP nsHTMLLinkElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -291,7 +274,7 @@ nsHTMLLinkElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLLinkElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLMapElement.cpp b/layout/html/content/src/nsHTMLMapElement.cpp index b0159871d523..d1debf13cfcd 100644 --- a/layout/html/content/src/nsHTMLMapElement.cpp +++ b/layout/html/content/src/nsHTMLMapElement.cpp @@ -59,9 +59,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLMapElement - NS_IMETHOD GetAreas(nsIDOMHTMLCollection** aAreas); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); + NS_DECL_IDOMHTMLMAPELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -115,7 +113,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -125,19 +123,19 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNameSpaceID, aName, aValue, aNotify); } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNodeInfo, aValue, aNotify); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -330,7 +328,7 @@ NS_IMPL_STRING_ATTR(nsHTMLMapElement, Name, name) NS_IMETHODIMP nsHTMLMapElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -339,7 +337,7 @@ nsHTMLMapElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLMapElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLMenuElement.cpp b/layout/html/content/src/nsHTMLMenuElement.cpp index 1a097bbab71d..309e41065dda 100644 --- a/layout/html/content/src/nsHTMLMenuElement.cpp +++ b/layout/html/content/src/nsHTMLMenuElement.cpp @@ -133,7 +133,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLMenuElement, Compact, compact) NS_IMETHODIMP nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -153,7 +153,7 @@ nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLMenuElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable, aResult); diff --git a/layout/html/content/src/nsHTMLMetaElement.cpp b/layout/html/content/src/nsHTMLMetaElement.cpp index 271740d70a51..cd6d887c8070 100644 --- a/layout/html/content/src/nsHTMLMetaElement.cpp +++ b/layout/html/content/src/nsHTMLMetaElement.cpp @@ -54,14 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLMetaElement - NS_IMETHOD GetContent(nsString& aContent); - NS_IMETHOD SetContent(const nsString& aContent); - NS_IMETHOD GetHttpEquiv(nsString& aHttpEquiv); - NS_IMETHOD SetHttpEquiv(const nsString& aHttpEquiv); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetScheme(nsString& aScheme); - NS_IMETHOD SetScheme(const nsString& aScheme); + NS_DECL_IDOMHTMLMETAELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -138,7 +131,7 @@ NS_IMPL_STRING_ATTR(nsHTMLMetaElement, Scheme, scheme) NS_IMETHODIMP nsHTMLMetaElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -147,7 +140,7 @@ nsHTMLMetaElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLMetaElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLModElement.cpp b/layout/html/content/src/nsHTMLModElement.cpp index e90abbf0384d..ad82f9d20894 100644 --- a/layout/html/content/src/nsHTMLModElement.cpp +++ b/layout/html/content/src/nsHTMLModElement.cpp @@ -54,10 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLModElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); - NS_IMETHOD GetDateTime(nsString& aDateTime); - NS_IMETHOD SetDateTime(const nsString& aDateTime); + NS_DECL_IDOMHTMLMODELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLModElement, DateTime, datetime) NS_IMETHODIMP nsHTMLModElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -141,7 +138,7 @@ nsHTMLModElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLModElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLOListElement.cpp b/layout/html/content/src/nsHTMLOListElement.cpp index ad2fb2b2e134..51aa6d3b41c4 100644 --- a/layout/html/content/src/nsHTMLOListElement.cpp +++ b/layout/html/content/src/nsHTMLOListElement.cpp @@ -55,12 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLOListElement - NS_IMETHOD GetCompact(PRBool* aCompact); - NS_IMETHOD SetCompact(PRBool aCompact); - NS_IMETHOD GetStart(PRInt32* aStart); - NS_IMETHOD SetStart(PRInt32 aStart); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLOLISTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -158,7 +153,7 @@ nsGenericHTMLElement::EnumTable kOldListTypeTable[] = { NS_IMETHODIMP nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -182,7 +177,7 @@ nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { PRInt32 v = aValue.GetIntValue(); diff --git a/layout/html/content/src/nsHTMLObjectElement.cpp b/layout/html/content/src/nsHTMLObjectElement.cpp index 3cbb866ffcdc..0b508e3f9e24 100644 --- a/layout/html/content/src/nsHTMLObjectElement.cpp +++ b/layout/html/content/src/nsHTMLObjectElement.cpp @@ -166,7 +166,7 @@ nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument) NS_IMETHODIMP nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -184,7 +184,7 @@ nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLOptGroupElement.cpp b/layout/html/content/src/nsHTMLOptGroupElement.cpp index 60fbdeb1d917..6cfeb327280f 100644 --- a/layout/html/content/src/nsHTMLOptGroupElement.cpp +++ b/layout/html/content/src/nsHTMLOptGroupElement.cpp @@ -57,10 +57,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLOptGroupElement - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetLabel(nsString& aLabel); - NS_IMETHOD SetLabel(const nsString& aLabel); + NS_DECL_IDOMHTMLOPTGROUPELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -134,7 +131,7 @@ NS_IMPL_STRING_ATTR(nsHTMLOptGroupElement, Label, label) NS_IMETHODIMP nsHTMLOptGroupElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -144,7 +141,7 @@ nsHTMLOptGroupElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLOptGroupElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLOptionElement.cpp b/layout/html/content/src/nsHTMLOptionElement.cpp index 59ad9b450086..9360333e2e84 100644 --- a/layout/html/content/src/nsHTMLOptionElement.cpp +++ b/layout/html/content/src/nsHTMLOptionElement.cpp @@ -305,14 +305,14 @@ nsHTMLOptionElement::SetDisabled(PRBool aDisabled) #endif NS_IMETHODIMP -nsHTMLOptionElement::GetLabel(nsString& aValue) +nsHTMLOptionElement::GetLabel(nsAWritableString& aValue) { mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::label, aValue); return NS_OK; } NS_IMETHODIMP -nsHTMLOptionElement::SetLabel(const nsString& aValue) +nsHTMLOptionElement::SetLabel(const nsAReadableString& aValue) { nsresult result = mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::label, aValue, PR_TRUE); if (NS_SUCCEEDED(result)) { @@ -398,7 +398,7 @@ nsHTMLOptionElement::GetIndex(PRInt32* aIndex) NS_IMETHODIMP nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::selected) { @@ -415,7 +415,7 @@ nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLOptionElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -466,7 +466,7 @@ nsHTMLOptionElement::HandleDOMEvent(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsHTMLOptionElement::GetText(nsString& aText) +nsHTMLOptionElement::GetText(nsAWritableString& aText) { aText.SetLength(0); PRInt32 numNodes; @@ -488,7 +488,7 @@ nsHTMLOptionElement::GetText(nsString& aText) nsAutoString compressText(aText); compressText.CompressWhitespace(PR_TRUE, PR_TRUE); if (compressText.Length() != 0) { - aText = compressText; + aText.Assign(compressText); } } NS_RELEASE(node); @@ -502,7 +502,7 @@ nsHTMLOptionElement::GetText(nsString& aText) } NS_IMETHODIMP -nsHTMLOptionElement::SetText(const nsString& aText) +nsHTMLOptionElement::SetText(const nsAReadableString& aText) { PRInt32 numNodes; PRBool usedExistingTextNode = PR_FALSE; // Do we need to create a text node? diff --git a/layout/html/content/src/nsHTMLParagraphElement.cpp b/layout/html/content/src/nsHTMLParagraphElement.cpp index f7852eac3e0d..5f826b9e4729 100644 --- a/layout/html/content/src/nsHTMLParagraphElement.cpp +++ b/layout/html/content/src/nsHTMLParagraphElement.cpp @@ -57,8 +57,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLParagraphElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLPARAGRAPHELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -136,7 +135,7 @@ NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align) NS_IMETHODIMP nsHTMLParagraphElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -150,7 +149,7 @@ nsHTMLParagraphElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLParagraphElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLParamElement.cpp b/layout/html/content/src/nsHTMLParamElement.cpp index 312b354312ca..cfe3667f99f7 100644 --- a/layout/html/content/src/nsHTMLParamElement.cpp +++ b/layout/html/content/src/nsHTMLParamElement.cpp @@ -54,14 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLParamElement - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); - NS_IMETHOD GetValueType(nsString& aValueType); - NS_IMETHOD SetValueType(const nsString& aValueType); + NS_DECL_IDOMHTMLPARAMELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +130,7 @@ NS_IMPL_STRING_ATTR(nsHTMLParamElement, ValueType, valuetype) NS_IMETHODIMP nsHTMLParamElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -147,7 +140,7 @@ nsHTMLParamElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLParamElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLPreElement.cpp b/layout/html/content/src/nsHTMLPreElement.cpp index 2a628d7474e6..0be5ed531881 100644 --- a/layout/html/content/src/nsHTMLPreElement.cpp +++ b/layout/html/content/src/nsHTMLPreElement.cpp @@ -131,7 +131,7 @@ NS_IMPL_INT_ATTR(nsHTMLPreElement, Width, width) NS_IMETHODIMP nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::cols) { @@ -147,7 +147,8 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::tabstop) { - PRInt32 ec, tabstop = aValue.ToInteger(&ec); + nsAutoString val(aValue); + PRInt32 ec, tabstop = val.ToInteger(&ec); if (tabstop <= 0) { tabstop = 8; } @@ -160,7 +161,7 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLPreElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLQuoteElement.cpp b/layout/html/content/src/nsHTMLQuoteElement.cpp index 01426593ee19..166cea4ea28a 100644 --- a/layout/html/content/src/nsHTMLQuoteElement.cpp +++ b/layout/html/content/src/nsHTMLQuoteElement.cpp @@ -54,8 +54,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLQuoteElement - NS_IMETHOD GetCite(nsString& aCite); - NS_IMETHOD SetCite(const nsString& aCite); + NS_DECL_IDOMHTMLQUOTEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -128,7 +127,7 @@ NS_IMPL_STRING_ATTR(nsHTMLQuoteElement, Cite, cite) NS_IMETHODIMP nsHTMLQuoteElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -138,7 +137,7 @@ nsHTMLQuoteElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLQuoteElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLScriptElement.cpp b/layout/html/content/src/nsHTMLScriptElement.cpp index 11784c27c736..8768781a8ca7 100644 --- a/layout/html/content/src/nsHTMLScriptElement.cpp +++ b/layout/html/content/src/nsHTMLScriptElement.cpp @@ -55,20 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLScriptElement - NS_IMETHOD GetText(nsString& aText); - NS_IMETHOD SetText(const nsString& aText); - NS_IMETHOD GetHtmlFor(nsString& aHtmlFor); - NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor); - NS_IMETHOD GetEvent(nsString& aEvent); - NS_IMETHOD SetEvent(const nsString& aEvent); - NS_IMETHOD GetCharset(nsString& aCharset); - NS_IMETHOD SetCharset(const nsString& aCharset); - NS_IMETHOD GetDefer(PRBool* aDefer); - NS_IMETHOD SetDefer(PRBool aDefer); - NS_IMETHOD GetSrc(nsString& aSrc); - NS_IMETHOD SetSrc(const nsString& aSrc); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLSCRIPTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -138,7 +125,7 @@ nsHTMLScriptElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsHTMLScriptElement::GetText(nsString& aValue) +nsHTMLScriptElement::GetText(nsAWritableString& aValue) { PRInt32 i, count = 0; nsresult rv = NS_OK; @@ -167,7 +154,7 @@ nsHTMLScriptElement::GetText(nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::SetText(const nsString& aValue) +nsHTMLScriptElement::SetText(const nsAReadableString& aValue) { nsCOMPtr content; PRInt32 i, count = 0; @@ -202,7 +189,7 @@ nsHTMLScriptElement::SetText(const nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::GetHtmlFor(nsString& aValue) +nsHTMLScriptElement::GetHtmlFor(nsAWritableString& aValue) { // XXX write me // mInner.GetAttribute(nsHTMLAtoms::charset, aValue); @@ -210,7 +197,7 @@ nsHTMLScriptElement::GetHtmlFor(nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::SetHtmlFor(const nsString& aValue) +nsHTMLScriptElement::SetHtmlFor(const nsAReadableString& aValue) { // XXX write me // return mInner.SetAttr(nsHTMLAtoms::charset, aValue); @@ -218,7 +205,7 @@ nsHTMLScriptElement::SetHtmlFor(const nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::GetEvent(nsString& aValue) +nsHTMLScriptElement::GetEvent(nsAWritableString& aValue) { // XXX write me // mInner.GetAttribute(nsHTMLAtoms::charset, aValue); @@ -226,7 +213,7 @@ nsHTMLScriptElement::GetEvent(nsString& aValue) } NS_IMETHODIMP -nsHTMLScriptElement::SetEvent(const nsString& aValue) +nsHTMLScriptElement::SetEvent(const nsAReadableString& aValue) { // XXX write me // return mInner.SetAttr(nsHTMLAtoms::charset, aValue); @@ -240,7 +227,7 @@ NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Type, type) NS_IMETHODIMP nsHTMLScriptElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -249,7 +236,7 @@ nsHTMLScriptElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLScriptElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLSelectElement.cpp b/layout/html/content/src/nsHTMLSelectElement.cpp index 932b7a3f8f96..0282ba3910b9 100644 --- a/layout/html/content/src/nsHTMLSelectElement.cpp +++ b/layout/html/content/src/nsHTMLSelectElement.cpp @@ -147,33 +147,10 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLSelectElement - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex); - NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); - NS_IMETHOD GetLength(PRUint32* aLength); - NS_IMETHOD SetLength(PRUint32 aLength); - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetOptions(nsIDOMNSHTMLOptionCollection** aOptions); - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetMultiple(PRBool* aMultiple); - NS_IMETHOD SetMultiple(PRBool aMultiple); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetSize(PRInt32* aSize); - NS_IMETHOD SetSize(PRInt32 aSize); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore); - NS_IMETHOD Remove(PRInt32 aIndex); - NS_IMETHOD Blur(); - NS_IMETHOD Focus(); + NS_DECL_IDOMHTMLSELECTELEMENT // nsIDOMNSHTMLSelectElement - NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_DECL_IDOMNSHTMLSELECTELEMENT // nsIContent //NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_NO_FOCUS_USING_GENERIC(mInner) @@ -215,7 +192,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -225,19 +202,19 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNameSpaceID, aName, aValue, aNotify); } NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify) { + const nsAReadableString& aValue, PRBool aNotify) { return mInner.SetAttribute(aNodeInfo, aValue, aNotify); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -580,7 +557,7 @@ nsHTMLSelectElement::GetOptions(nsIDOMNSHTMLOptionCollection** aValue) } NS_IMETHODIMP -nsHTMLSelectElement::GetType(nsString& aType) +nsHTMLSelectElement::GetType(nsAWritableString& aType) { PRBool isMultiple; nsresult result = NS_OK; @@ -588,10 +565,10 @@ nsHTMLSelectElement::GetType(nsString& aType) result = GetMultiple(&isMultiple); if (NS_OK == result) { if (isMultiple) { - aType.AssignWithConversion("select-multiple"); + aType.Assign(NS_LITERAL_STRING("select-multiple")); } else { - aType.AssignWithConversion("select-one"); + aType.Assign(NS_LITERAL_STRING("select-one")); } } @@ -854,7 +831,7 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex) //NS_IMPL_STRING_ATTR(nsHTMLSelectElement, Value, value) NS_IMETHODIMP -nsHTMLSelectElement::GetValue(nsString& aValue) +nsHTMLSelectElement::GetValue(nsAWritableString& aValue) { nsresult result = NS_OK; PRInt32 selectedIndex; @@ -911,7 +888,7 @@ nsHTMLSelectElement::GetValue(nsString& aValue) } NS_IMETHODIMP -nsHTMLSelectElement::SetValue(const nsString& aValue) +nsHTMLSelectElement::SetValue(const nsAReadableString& aValue) { nsresult result = NS_OK; nsCOMPtr options; @@ -1013,7 +990,7 @@ nsHTMLSelectElement::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsHTMLSelectElement::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsHTMLSelectElement::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (!mOptions) { Init(); @@ -1188,7 +1165,7 @@ nsHTMLSelectElement::DoneAddingContent(PRBool aIsDone) NS_IMETHODIMP nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::disabled) { @@ -1215,7 +1192,7 @@ nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLSelectElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -1603,7 +1580,7 @@ nsHTMLOptionCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsHTMLOptionCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsHTMLOptionCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (mDirty && (nsnull != mSelect)) { GetOptions(); diff --git a/layout/html/content/src/nsHTMLSpacerElement.cpp b/layout/html/content/src/nsHTMLSpacerElement.cpp index 4874b5932aef..e0d264e965e0 100644 --- a/layout/html/content/src/nsHTMLSpacerElement.cpp +++ b/layout/html/content/src/nsHTMLSpacerElement.cpp @@ -161,7 +161,7 @@ nsHTMLSpacerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::size) { @@ -187,7 +187,7 @@ nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLSpacerElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLSpanElement.cpp b/layout/html/content/src/nsHTMLSpanElement.cpp index a2ac1d60413b..d3ad7e052b79 100644 --- a/layout/html/content/src/nsHTMLSpanElement.cpp +++ b/layout/html/content/src/nsHTMLSpanElement.cpp @@ -114,7 +114,7 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLSpanElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -124,7 +124,7 @@ nsHTMLSpanElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLSpanElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); diff --git a/layout/html/content/src/nsHTMLStyleElement.cpp b/layout/html/content/src/nsHTMLStyleElement.cpp index ec2cf64349ed..3b2736514e5b 100644 --- a/layout/html/content/src/nsHTMLStyleElement.cpp +++ b/layout/html/content/src/nsHTMLStyleElement.cpp @@ -64,12 +64,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLStyleElement - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetMedia(nsString& aMedia); - NS_IMETHOD SetMedia(const nsString& aMedia); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLSTYLEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -223,7 +218,7 @@ nsHTMLStyleElement::GetStyleSheet(nsIStyleSheet*& aStyleSheet) NS_IMETHODIMP nsHTMLStyleElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -232,7 +227,7 @@ nsHTMLStyleElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLStyleElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLTableCaptionElement.cpp b/layout/html/content/src/nsHTMLTableCaptionElement.cpp index d4f69a0429c5..ccb82ff87284 100644 --- a/layout/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/layout/html/content/src/nsHTMLTableCaptionElement.cpp @@ -55,8 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableCaptionElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); + NS_DECL_IDOMHTMLTABLECAPTIONELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -137,7 +136,7 @@ static nsGenericHTMLElement::EnumTable kCaptionAlignTable[] = { NS_IMETHODIMP nsHTMLTableCaptionElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::align) { @@ -151,7 +150,7 @@ nsHTMLTableCaptionElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableCaptionElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { diff --git a/layout/html/content/src/nsHTMLTableCellElement.cpp b/layout/html/content/src/nsHTMLTableCellElement.cpp index d47faea6a934..81ba1e1e1711 100644 --- a/layout/html/content/src/nsHTMLTableCellElement.cpp +++ b/layout/html/content/src/nsHTMLTableCellElement.cpp @@ -70,36 +70,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableCellElement - NS_IMETHOD GetCellIndex(PRInt32* aCellIndex); - NS_IMETHOD SetCellIndex(PRInt32 aCellIndex); - NS_IMETHOD GetAbbr(nsString& aAbbr); - NS_IMETHOD SetAbbr(const nsString& aAbbr); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetAxis(nsString& aAxis); - NS_IMETHOD SetAxis(const nsString& aAxis); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetColSpan(PRInt32* aColSpan); - NS_IMETHOD SetColSpan(PRInt32 aColSpan); - NS_IMETHOD GetHeaders(nsString& aHeaders); - NS_IMETHOD SetHeaders(const nsString& aHeaders); - NS_IMETHOD GetHeight(nsString& aHeight); - NS_IMETHOD SetHeight(const nsString& aHeight); - NS_IMETHOD GetNoWrap(PRBool* aNoWrap); - NS_IMETHOD SetNoWrap(PRBool aNoWrap); - NS_IMETHOD GetRowSpan(PRInt32* aRowSpan); - NS_IMETHOD SetRowSpan(PRInt32 aRowSpan); - NS_IMETHOD GetScope(nsString& aScope); - NS_IMETHOD SetScope(const nsString& aScope); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLTABLECELLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -333,7 +304,7 @@ static nsGenericHTMLElement::EnumTable kCellScopeTable[] = { NS_IMETHODIMP nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -401,7 +372,7 @@ nsHTMLTableCellElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableCellElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings abbr, axis, ch, headers diff --git a/layout/html/content/src/nsHTMLTableColElement.cpp b/layout/html/content/src/nsHTMLTableColElement.cpp index b2cd73133deb..85b02ab5dcba 100644 --- a/layout/html/content/src/nsHTMLTableColElement.cpp +++ b/layout/html/content/src/nsHTMLTableColElement.cpp @@ -58,18 +58,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableColElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetSpan(PRInt32* aSpan); - NS_IMETHOD SetSpan(PRInt32 aSpan); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLTABLECOLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -156,7 +145,7 @@ NS_IMPL_STRING_ATTR(nsHTMLTableColElement, Width, width) NS_IMETHODIMP nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -198,7 +187,7 @@ nsHTMLTableColElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableColElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/layout/html/content/src/nsHTMLTableColGroupElement.cpp b/layout/html/content/src/nsHTMLTableColGroupElement.cpp index e2b69c6a3b42..74e34103d88a 100644 --- a/layout/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/layout/html/content/src/nsHTMLTableColGroupElement.cpp @@ -55,18 +55,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableColElement - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetSpan(PRInt32* aSpan); - NS_IMETHOD SetSpan(PRInt32 aSpan); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); + NS_DECL_IDOMHTMLTABLECOLELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -145,7 +134,7 @@ NS_IMPL_STRING_ATTR(nsHTMLTableColGroupElement, Width, width) NS_IMETHODIMP nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -187,7 +176,7 @@ nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableColGroupElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/layout/html/content/src/nsHTMLTableElement.cpp b/layout/html/content/src/nsHTMLTableElement.cpp index 904229c40347..3d481ae05609 100644 --- a/layout/html/content/src/nsHTMLTableElement.cpp +++ b/layout/html/content/src/nsHTMLTableElement.cpp @@ -72,40 +72,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableElement - NS_IMETHOD GetCaption(nsIDOMHTMLTableCaptionElement** aCaption); - NS_IMETHOD SetCaption(nsIDOMHTMLTableCaptionElement* aCaption); - NS_IMETHOD GetTHead(nsIDOMHTMLTableSectionElement** aTHead); - NS_IMETHOD SetTHead(nsIDOMHTMLTableSectionElement* aTHead); - NS_IMETHOD GetTFoot(nsIDOMHTMLTableSectionElement** aTFoot); - NS_IMETHOD SetTFoot(nsIDOMHTMLTableSectionElement* aTFoot); - NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); - NS_IMETHOD GetTBodies(nsIDOMHTMLCollection** aTBodies); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetBorder(nsString& aBorder); - NS_IMETHOD SetBorder(const nsString& aBorder); - NS_IMETHOD GetCellPadding(nsString& aCellPadding); - NS_IMETHOD SetCellPadding(const nsString& aCellPadding); - NS_IMETHOD GetCellSpacing(nsString& aCellSpacing); - NS_IMETHOD SetCellSpacing(const nsString& aCellSpacing); - NS_IMETHOD GetFrame(nsString& aFrame); - NS_IMETHOD SetFrame(const nsString& aFrame); - NS_IMETHOD GetRules(nsString& aRules); - NS_IMETHOD SetRules(const nsString& aRules); - NS_IMETHOD GetSummary(nsString& aSummary); - NS_IMETHOD SetSummary(const nsString& aSummary); - NS_IMETHOD GetWidth(nsString& aWidth); - NS_IMETHOD SetWidth(const nsString& aWidth); - NS_IMETHOD CreateTHead(nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteTHead(); - NS_IMETHOD CreateTFoot(nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteTFoot(); - NS_IMETHOD CreateCaption(nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteCaption(); - NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteRow(PRInt32 aIndex); + NS_DECL_IDOMHTMLTABLEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -136,7 +103,7 @@ public: NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD ParentDestroyed(); @@ -299,7 +266,7 @@ TableRowsCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } NS_IMETHODIMP -TableRowsCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn) +TableRowsCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -868,7 +835,7 @@ static nsGenericHTMLElement::EnumTable kLayoutTable[] = { NS_IMETHODIMP nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore summary, just a string */ @@ -962,7 +929,7 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore summary, just a string */ /* ignore attributes that are of standard types diff --git a/layout/html/content/src/nsHTMLTableRowElement.cpp b/layout/html/content/src/nsHTMLTableRowElement.cpp index 55b95e34ecde..6ebb9747552c 100644 --- a/layout/html/content/src/nsHTMLTableRowElement.cpp +++ b/layout/html/content/src/nsHTMLTableRowElement.cpp @@ -158,24 +158,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableRowElement - NS_IMETHOD GetRowIndex(PRInt32* aRowIndex); - NS_IMETHOD SetRowIndex(PRInt32 aRowIndex); - NS_IMETHOD GetSectionRowIndex(PRInt32* aSectionRowIndex); - NS_IMETHOD SetSectionRowIndex(PRInt32 aSectionRowIndex); - NS_IMETHOD GetCells(nsIDOMHTMLCollection** aCells); - NS_IMETHOD SetCells(nsIDOMHTMLCollection* aCells); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetBgColor(nsString& aBgColor); - NS_IMETHOD SetBgColor(const nsString& aBgColor); - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteCell(PRInt32 aIndex); + NS_DECL_IDOMHTMLTABLEROWELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -580,7 +563,7 @@ NS_IMPL_STRING_ATTR(nsHTMLTableRowElement, VAlign, valign) NS_IMETHODIMP nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -629,7 +612,7 @@ nsHTMLTableRowElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableRowElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/layout/html/content/src/nsHTMLTableSectionElement.cpp b/layout/html/content/src/nsHTMLTableSectionElement.cpp index 035f7a7e5314..8232d746f0f2 100644 --- a/layout/html/content/src/nsHTMLTableSectionElement.cpp +++ b/layout/html/content/src/nsHTMLTableSectionElement.cpp @@ -60,17 +60,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTableSectionElement - NS_IMETHOD GetCh(nsString& aCh); - NS_IMETHOD SetCh(const nsString& aCh); - NS_IMETHOD GetChOff(nsString& aChOff); - NS_IMETHOD SetChOff(const nsString& aChOff); - NS_IMETHOD GetAlign(nsString& aAlign); - NS_IMETHOD SetAlign(const nsString& aAlign); - NS_IMETHOD GetVAlign(nsString& aVAlign); - NS_IMETHOD SetVAlign(const nsString& aVAlign); - NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); - NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); - NS_IMETHOD DeleteRow(PRInt32 aIndex); + NS_DECL_IDOMHTMLTABLESECTIONELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -216,7 +206,7 @@ nsHTMLTableSectionElement::DeleteRow(PRInt32 aValue) NS_IMETHODIMP nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { /* ignore these attributes, stored simply as strings @@ -259,7 +249,7 @@ nsHTMLTableSectionElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTableSectionElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { /* ignore these attributes, stored already as strings ch diff --git a/layout/html/content/src/nsHTMLTextAreaElement.cpp b/layout/html/content/src/nsHTMLTextAreaElement.cpp index d2635a418e2f..21eb31664edb 100644 --- a/layout/html/content/src/nsHTMLTextAreaElement.cpp +++ b/layout/html/content/src/nsHTMLTextAreaElement.cpp @@ -80,29 +80,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTextAreaElement - NS_IMETHOD GetDefaultValue(nsString& aDefaultValue); - NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue); - NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); - NS_IMETHOD GetAccessKey(nsString& aAccessKey); - NS_IMETHOD SetAccessKey(const nsString& aAccessKey); - NS_IMETHOD GetCols(PRInt32* aCols); - NS_IMETHOD SetCols(PRInt32 aCols); - NS_IMETHOD GetDisabled(PRBool* aDisabled); - NS_IMETHOD SetDisabled(PRBool aDisabled); - NS_IMETHOD GetName(nsString& aName); - NS_IMETHOD SetName(const nsString& aName); - NS_IMETHOD GetReadOnly(PRBool* aReadOnly); - NS_IMETHOD SetReadOnly(PRBool aReadOnly); - NS_IMETHOD GetRows(PRInt32* aRows); - NS_IMETHOD SetRows(PRInt32 aRows); - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD GetValue(nsString& aValue); - NS_IMETHOD SetValue(const nsString& aValue); - NS_IMETHOD Blur(); - NS_IMETHOD Focus(); - NS_IMETHOD Select(); + NS_DECL_IDOMHTMLTEXTAREAELEMENT // nsIDOMNSHTMLTextAreaElement NS_DECL_IDOMNSHTMLTEXTAREAELEMENT @@ -364,19 +342,20 @@ NS_IMPL_INT_ATTR(nsHTMLTextAreaElement, TabIndex, tabindex) NS_IMETHODIMP -nsHTMLTextAreaElement::GetType(nsString& aType) +nsHTMLTextAreaElement::GetType(nsAWritableString& aType) { - aType.AssignWithConversion("textarea"); + aType.Assign(NS_LITERAL_STRING("textarea")); return NS_OK; } NS_IMETHODIMP -nsHTMLTextAreaElement::GetValue(nsString& aValue) +nsHTMLTextAreaElement::GetValue(nsAWritableString& aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { - formControlFrame->GetProperty(nsHTMLAtoms::value, aValue); - return NS_OK; + formControlFrame->GetProperty(nsHTMLAtoms::value, aValue); + + return NS_OK; } //XXX: Should this ASSERT instead of getting the default value here? return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue); @@ -384,7 +363,7 @@ nsHTMLTextAreaElement::GetValue(nsString& aValue) NS_IMETHODIMP -nsHTMLTextAreaElement::SetValue(const nsString& aValue) +nsHTMLTextAreaElement::SetValue(const nsAReadableString& aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { @@ -400,7 +379,7 @@ nsHTMLTextAreaElement::SetValue(const nsString& aValue) } NS_IMETHODIMP -nsHTMLTextAreaElement::GetDefaultValue(nsString& aDefaultValue) +nsHTMLTextAreaElement::GetDefaultValue(nsAWritableString& aDefaultValue) { mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::defaultvalue, aDefaultValue); @@ -409,7 +388,7 @@ nsHTMLTextAreaElement::GetDefaultValue(nsString& aDefaultValue) } NS_IMETHODIMP -nsHTMLTextAreaElement::SetDefaultValue(const nsString& aDefaultValue) +nsHTMLTextAreaElement::SetDefaultValue(const nsAReadableString& aDefaultValue) { nsAutoString defaultValue(aDefaultValue); @@ -431,7 +410,7 @@ nsHTMLTextAreaElement::SetDefaultValue(const nsString& aDefaultValue) NS_IMETHODIMP nsHTMLTextAreaElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::disabled) { @@ -463,7 +442,7 @@ nsHTMLTextAreaElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTextAreaElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/content/src/nsHTMLTitleElement.cpp b/layout/html/content/src/nsHTMLTitleElement.cpp index 1ad5edd453e5..6e946a78d184 100644 --- a/layout/html/content/src/nsHTMLTitleElement.cpp +++ b/layout/html/content/src/nsHTMLTitleElement.cpp @@ -33,11 +33,10 @@ #include "nsIXIFConverter.h" #include "nsIDOMText.h" #include "nsIDocument.h" -#include "nsIHTMLDocument.h" +#include "nsIDOMHTMLDocument.h" static NS_DEFINE_IID(kIDOMHTMLTitleElementIID, NS_IDOMHTMLTITLEELEMENT_IID); static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); -static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); class nsHTMLTitleElement : public nsIDOMHTMLTitleElement, public nsIJSScriptObject, @@ -60,8 +59,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLTitleElement - NS_IMETHOD GetText(nsString& aType); - NS_IMETHOD SetText(const nsString& aType); + NS_DECL_IDOMHTMLTITLEELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -132,7 +130,7 @@ nsHTMLTitleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLTitleElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -141,7 +139,7 @@ nsHTMLTitleElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLTitleElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } @@ -176,7 +174,7 @@ nsHTMLTitleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFu NS_IMETHODIMP -nsHTMLTitleElement::GetText(nsString& aTitle) +nsHTMLTitleElement::GetText(nsAWritableString& aTitle) { nsresult result = NS_OK; nsIDOMNode* child; @@ -197,7 +195,7 @@ nsHTMLTitleElement::GetText(nsString& aTitle) } NS_IMETHODIMP -nsHTMLTitleElement::SetText(const nsString& aTitle) +nsHTMLTitleElement::SetText(const nsAReadableString& aTitle) { nsresult result = NS_OK; nsIDOMNode* child; @@ -205,11 +203,9 @@ nsHTMLTitleElement::SetText(const nsString& aTitle) result = GetDocument(document); if (NS_OK == result) { - nsIHTMLDocument* htmlDoc; - result = document->QueryInterface(kIHTMLDocumentIID, (void**)&htmlDoc); - if (NS_OK == result) { + nsCOMPtr htmlDoc(do_QueryInterface(document)); + if (htmlDoc) { htmlDoc->SetTitle(aTitle); - NS_RELEASE(htmlDoc); } NS_RELEASE(document); } diff --git a/layout/html/content/src/nsHTMLUListElement.cpp b/layout/html/content/src/nsHTMLUListElement.cpp index 4aec9fbc0e98..6d1bf3324a9b 100644 --- a/layout/html/content/src/nsHTMLUListElement.cpp +++ b/layout/html/content/src/nsHTMLUListElement.cpp @@ -58,10 +58,7 @@ public: NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) // nsIDOMHTMLUListElement - NS_IMETHOD GetCompact(PRBool* aCompact); - NS_IMETHOD SetCompact(PRBool aCompact); - NS_IMETHOD GetType(nsString& aType); - NS_IMETHOD SetType(const nsString& aType); + NS_DECL_IDOMHTMLULISTELEMENT // nsIJSScriptObject NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner) @@ -135,7 +132,7 @@ NS_IMPL_STRING_ATTR(nsHTMLUListElement, Type, type) NS_IMETHODIMP nsHTMLUListElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { @@ -159,7 +156,7 @@ nsHTMLUListElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLUListElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::type) { PRInt32 v = aValue.GetIntValue(); diff --git a/layout/html/content/src/nsHTMLUnknownElement.cpp b/layout/html/content/src/nsHTMLUnknownElement.cpp index 97205d2bf75a..ef8e0c293316 100644 --- a/layout/html/content/src/nsHTMLUnknownElement.cpp +++ b/layout/html/content/src/nsHTMLUnknownElement.cpp @@ -114,7 +114,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -124,15 +124,15 @@ public: return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, PRBool aNotify); + const nsAReadableString& aValue, PRBool aNotify); NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, PRBool aNotify); + const nsAReadableString& aValue, PRBool aNotify); NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, @@ -256,7 +256,7 @@ nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLUnknownElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { // XXX write me @@ -266,7 +266,7 @@ nsHTMLUnknownElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLUnknownElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { // XXX write me return mInner.AttributeToString(aAttribute, aValue, aResult); @@ -342,7 +342,7 @@ static void ReleaseAttributes(nsIHTMLAttributes*& aAttributes) NS_IMETHODIMP nsHTMLUnknownElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult result = NS_OK; @@ -449,7 +449,7 @@ nsHTMLUnknownElement::SetAttribute(PRInt32 aNameSpaceID, NS_IMETHODIMP nsHTMLUnknownElement::SetAttribute(nsINodeInfo *aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); diff --git a/layout/html/content/src/nsHTMLWBRElement.cpp b/layout/html/content/src/nsHTMLWBRElement.cpp index eb53b2d49908..a1492245f876 100644 --- a/layout/html/content/src/nsHTMLWBRElement.cpp +++ b/layout/html/content/src/nsHTMLWBRElement.cpp @@ -126,7 +126,7 @@ nsHTMLWBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMETHODIMP nsHTMLWBRElement::StringToAttribute(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, nsHTMLValue& aResult) { return NS_CONTENT_ATTR_NOT_THERE; @@ -135,7 +135,7 @@ nsHTMLWBRElement::StringToAttribute(nsIAtom* aAttribute, NS_IMETHODIMP nsHTMLWBRElement::AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, - nsString& aResult) const + nsAWritableString& aResult) const { return mInner.AttributeToString(aAttribute, aValue, aResult); } diff --git a/layout/html/document/src/nsHTMLContentSink.cpp b/layout/html/document/src/nsHTMLContentSink.cpp index 02e52ce47f44..cb64b375bfa0 100644 --- a/layout/html/document/src/nsHTMLContentSink.cpp +++ b/layout/html/document/src/nsHTMLContentSink.cpp @@ -52,7 +52,7 @@ #include "nsIDOMText.h" #include "nsIDOMComment.h" -#include "nsIDOMDocument.h" +#include "nsIDOMHTMLDocument.h" #include "nsIDOMDOMImplementation.h" #include "nsIDOMDocumentType.h" @@ -2358,7 +2358,9 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel) } if (nsnull == mTitle) { - mHTMLDocument->SetTitle(nsString()); + nsCOMPtr domDoc(do_QueryInterface(mHTMLDocument)); + if (domDoc) + domDoc->SetTitle(nsString()); } // XXX this is silly; who cares? RickG cares. It's part of the regression test. So don't bug me. @@ -2618,7 +2620,10 @@ HTMLContentSink::SetTitle(const nsString& aValue) } ReduceEntities(*mTitle); mTitle->CompressWhitespace(PR_TRUE, PR_TRUE); - mHTMLDocument->SetTitle(*mTitle); + + nsCOMPtr domDoc(do_QueryInterface(mHTMLDocument)); + if (domDoc) + domDoc->SetTitle(*mTitle); nsCOMPtr nodeInfo; nsresult rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::title, nsnull, @@ -4178,15 +4183,15 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (NS_FAILED(rv)) return rv; PRInt32 millis = -1; - PRUnichar *uriAttrib = nsnull; - + nsAutoString uriAttrib; + PRInt32 semiColon = result.FindCharInSet(";,"); nsAutoString token; if (semiColon > -1) result.Left(token, semiColon); else token = result; - + PRBool done = PR_FALSE; while (!done && !token.IsEmpty()) { token.CompressWhitespace(); @@ -4205,7 +4210,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) break; ++iter; } - + if (tokenIsANumber) { PRInt32 err; millis = token.ToInteger(&err) * 1000; @@ -4220,7 +4225,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (loc > -1) token.Cut(0, loc+1); token.Trim(" \"'"); - uriAttrib = token.ToNewUnicode(); + uriAttrib.Assign(token); } else { // Increment to the next token. if (semiColon > -1) { @@ -4236,11 +4241,11 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) } // end while nsCOMPtr uri; - if (!uriAttrib) { + if (uriAttrib.Length() == 0) { uri = baseURI; } else { - rv = NS_NewURI(getter_AddRefs(uri), nsAutoString(uriAttrib), baseURI); - nsMemory::Free(uriAttrib); + rv = NS_NewURI(getter_AddRefs(uri), + uriAttrib, baseURI); } if (NS_SUCCEEDED(rv)) { diff --git a/layout/html/document/src/nsHTMLDocument.cpp b/layout/html/document/src/nsHTMLDocument.cpp index 8ffce7c91da9..2724a8009b2a 100644 --- a/layout/html/document/src/nsHTMLDocument.cpp +++ b/layout/html/document/src/nsHTMLDocument.cpp @@ -445,9 +445,9 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) } NS_IMETHODIMP -nsHTMLDocument::GetContentType(nsString& aContentType) const +nsHTMLDocument::GetContentType(nsAWritableString& aContentType) const { - aContentType.AssignWithConversion("text/html"); + aContentType.Assign(NS_LITERAL_STRING("text/html")); return NS_OK; } @@ -972,13 +972,13 @@ nsHTMLDocument::EndLoad() return nsDocument::EndLoad(); } -NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle) +NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsAReadableString& aTitle) { if (nsnull == mDocumentTitle) { mDocumentTitle = new nsString(aTitle); } else { - *mDocumentTitle = aTitle; + mDocumentTitle->Assign(aTitle); } // Pass on to any interested containers @@ -992,7 +992,7 @@ NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle) if (container) { nsCOMPtr docShell(do_QueryInterface(container)); if(docShell) { - docShell->SetTitle(aTitle.GetUnicode()); + docShell->SetTitle(mDocumentTitle->GetUnicode()); } } } @@ -1125,7 +1125,7 @@ nsHTMLDocument::GetBaseURL(nsIURI*& aURL) const } NS_IMETHODIMP -nsHTMLDocument:: SetBaseURL(const nsString& aURLSpec) +nsHTMLDocument:: SetBaseURL(const nsAReadableString& aURLSpec) { nsresult result = NS_OK; @@ -1139,10 +1139,10 @@ nsHTMLDocument:: SetBaseURL(const nsString& aURLSpec) } NS_IMETHODIMP -nsHTMLDocument:: GetBaseTarget(nsString& aTarget) const +nsHTMLDocument:: GetBaseTarget(nsAWritableString& aTarget) const { if (nsnull != mBaseTarget) { - aTarget = *mBaseTarget; + aTarget.Assign(*mBaseTarget); } else { aTarget.Truncate(); @@ -1151,14 +1151,14 @@ nsHTMLDocument:: GetBaseTarget(nsString& aTarget) const } NS_IMETHODIMP -nsHTMLDocument:: SetBaseTarget(const nsString& aTarget) +nsHTMLDocument:: SetBaseTarget(const nsAReadableString& aTarget) { if (0 < aTarget.Length()) { if (nsnull != mBaseTarget) { *mBaseTarget = aTarget; } else { - mBaseTarget = aTarget.ToNewString(); + mBaseTarget = new nsString(aTarget); } } else { @@ -1171,14 +1171,14 @@ nsHTMLDocument:: SetBaseTarget(const nsString& aTarget) } NS_IMETHODIMP -nsHTMLDocument::SetLastModified(const nsString& aLastModified) +nsHTMLDocument::SetLastModified(const nsAReadableString& aLastModified) { if (0 < aLastModified.Length()) { if (nsnull != mLastModified) { *mLastModified = aLastModified; } else { - mLastModified = aLastModified.ToNewString(); + mLastModified = new nsString(aLastModified); } } else if (nsnull != mLastModified) { @@ -1190,14 +1190,14 @@ nsHTMLDocument::SetLastModified(const nsString& aLastModified) } NS_IMETHODIMP -nsHTMLDocument::SetReferrer(const nsString& aReferrer) +nsHTMLDocument::SetReferrer(const nsAReadableString& aReferrer) { if (0 < aReferrer.Length()) { if (nsnull != mReferrer) { *mReferrer = aReferrer; } else { - mReferrer = aReferrer.ToNewString(); + mReferrer = new nsString(aReferrer); } } else if (nsnull != mReferrer) { @@ -1255,7 +1255,8 @@ nsHTMLDocument::SetDTDMode(nsDTDMode aMode) } NS_IMETHODIMP -nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) +nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, + const nsAReadableString& aData) { nsresult result = nsMarkupDocument::SetHeaderData(aHeaderField, aData); @@ -1273,8 +1274,9 @@ nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) if (PR_FALSE == type.Equals(textHtml)) { sheet->GetTitle(title); if (0 < title.Length()) { // if sheet has title + nsAutoString data(aData); PRBool disabled = ((0 == aData.Length()) || - (PR_FALSE == aData.EqualsIgnoreCase(title))); + (PR_FALSE == title.EqualsIgnoreCase(data))); SetStyleSheetDisabledState(sheet, disabled); } } @@ -1381,9 +1383,9 @@ nsHTMLDocument::FlushPendingNotifications() } NS_IMETHODIMP -nsHTMLDocument::CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - nsIDOMElement** aReturn) +nsHTMLDocument::CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + nsIDOMElement** aReturn) { nsresult rv = NS_OK; @@ -1420,7 +1422,7 @@ nsHTMLDocument::CreateElementNS(const nsString& aNamespaceURI, // nsIDOMDocument interface implementation // NS_IMETHODIMP -nsHTMLDocument::CreateElement(const nsString& aTagName, +nsHTMLDocument::CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1443,8 +1445,8 @@ nsHTMLDocument::CreateElement(const nsString& aTagName, } NS_IMETHODIMP -nsHTMLDocument::CreateProcessingInstruction(const nsString& aTarget, - const nsString& aData, +nsHTMLDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn) { // There are no PIs for HTML @@ -1454,7 +1456,7 @@ nsHTMLDocument::CreateProcessingInstruction(const nsString& aTarget, } NS_IMETHODIMP -nsHTMLDocument::CreateCDATASection(const nsString& aData, +nsHTMLDocument::CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn) { // There are no CDATASections in HTML @@ -1464,7 +1466,7 @@ nsHTMLDocument::CreateCDATASection(const nsString& aData, } NS_IMETHODIMP -nsHTMLDocument::CreateEntityReference(const nsString& aName, +nsHTMLDocument::CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn) { // There are no EntityReferences in HTML @@ -1499,25 +1501,25 @@ nsHTMLDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) } NS_IMETHODIMP -nsHTMLDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) +nsHTMLDocument::CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn) { return nsDocument::CreateComment(aData, aReturn); } NS_IMETHODIMP -nsHTMLDocument::CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) +nsHTMLDocument::CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn) { return nsDocument::CreateAttribute(aName, aReturn); } NS_IMETHODIMP -nsHTMLDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) +nsHTMLDocument::CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn) { return nsDocument::CreateTextNode(aData, aReturn); } NS_IMETHODIMP -nsHTMLDocument::GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn) +nsHTMLDocument::GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn) { nsAutoString tmp(aTagname); tmp.ToLowerCase(); // HTML elements are lower case internally. @@ -1580,19 +1582,19 @@ nsHTMLDocument::HasChildNodes(PRBool* aReturn) } NS_IMETHODIMP -nsHTMLDocument::GetNodeName(nsString& aNodeName) +nsHTMLDocument::GetNodeName(nsAWritableString& aNodeName) { return nsDocument::GetNodeName(aNodeName); } NS_IMETHODIMP -nsHTMLDocument::GetNodeValue(nsString& aNodeValue) +nsHTMLDocument::GetNodeValue(nsAWritableString& aNodeValue) { return nsDocument::GetNodeValue(aNodeValue); } NS_IMETHODIMP -nsHTMLDocument::SetNodeValue(const nsString& aNodeValue) +nsHTMLDocument::SetNodeValue(const nsAReadableString& aNodeValue) { return nsDocument::SetNodeValue(aNodeValue); } @@ -1604,25 +1606,25 @@ nsHTMLDocument::GetNodeType(PRUint16* aNodeType) } NS_IMETHODIMP -nsHTMLDocument::GetNamespaceURI(nsString& aNamespaceURI) +nsHTMLDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return nsDocument::GetNamespaceURI(aNamespaceURI); } NS_IMETHODIMP -nsHTMLDocument::GetPrefix(nsString& aPrefix) +nsHTMLDocument::GetPrefix(nsAWritableString& aPrefix) { return nsDocument::GetPrefix(aPrefix); } NS_IMETHODIMP -nsHTMLDocument::SetPrefix(const nsString& aPrefix) +nsHTMLDocument::SetPrefix(const nsAReadableString& aPrefix) { return nsDocument::SetPrefix(aPrefix); } NS_IMETHODIMP -nsHTMLDocument::GetLocalName(nsString& aLocalName) +nsHTMLDocument::GetLocalName(nsAWritableString& aLocalName) { return nsDocument::GetLocalName(aLocalName); } @@ -1670,7 +1672,7 @@ nsHTMLDocument::Normalize() } NS_IMETHODIMP -nsHTMLDocument::Supports(const nsString& aFeature, const nsString& aVersion, +nsHTMLDocument::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return nsDocument::Supports(aFeature, aVersion, aReturn); @@ -1684,19 +1686,21 @@ nsHTMLDocument::Supports(const nsString& aFeature, const nsString& aVersion, // for full specification. // NS_IMETHODIMP -nsHTMLDocument::GetTitle(nsString& aTitle) +nsHTMLDocument::GetTitle(nsAWritableString& aTitle) { if (nsnull != mDocumentTitle) { - aTitle=*mDocumentTitle; + aTitle.Assign(*mDocumentTitle); + } else { + aTitle.Truncate(); } return NS_OK; } NS_IMETHODIMP -nsHTMLDocument::GetReferrer(nsString& aReferrer) +nsHTMLDocument::GetReferrer(nsAWritableString& aReferrer) { if (nsnull != mReferrer) { - aReferrer = *mReferrer; + aReferrer.Assign(*mReferrer); } else { aReferrer.Truncate(); @@ -1719,7 +1723,7 @@ nsHTMLDocument::GetDomainURI(nsIURI **uri) NS_IMETHODIMP -nsHTMLDocument::GetDomain(nsString& aDomain) +nsHTMLDocument::GetDomain(nsAWritableString& aDomain) { nsCOMPtr uri; if (NS_FAILED(GetDomainURI(getter_AddRefs(uri)))) @@ -1728,14 +1732,14 @@ nsHTMLDocument::GetDomain(nsString& aDomain) char *hostName; if (NS_FAILED(uri->GetHost(&hostName))) return NS_ERROR_FAILURE; - aDomain.AssignWithConversion(hostName); + aDomain.Assign(NS_ConvertASCIItoUCS2(hostName)); nsCRT::free(hostName); return NS_OK; } NS_IMETHODIMP -nsHTMLDocument::SetDomain(const nsString& aDomain) +nsHTMLDocument::SetDomain(const nsAReadableString& aDomain) { // Check new domain @@ -1749,7 +1753,8 @@ nsHTMLDocument::SetDomain(const nsString& aDomain) nsAutoString suffix; current.Right(suffix, aDomain.Length()); PRUnichar c = current.CharAt(current.Length() - aDomain.Length() - 1); - if (aDomain.EqualsIgnoreCase(suffix) && (c == '.' || c == '/')) + if (suffix.EqualsIgnoreCase((const PRUnichar*)nsPromiseFlatString(aDomain)) && + (c == '.' || c == '/')) ok = PR_TRUE; } if (!ok) { @@ -1793,12 +1798,12 @@ nsHTMLDocument::SetDomain(const nsString& aDomain) } NS_IMETHODIMP -nsHTMLDocument::GetURL(nsString& aURL) +nsHTMLDocument::GetURL(nsAWritableString& aURL) { if (nsnull != mDocumentURL) { char* str; mDocumentURL->GetSpec(&str); - aURL.AssignWithConversion(str); + aURL.Assign(NS_ConvertASCIItoUCS2(str)); nsCRT::free(str); } return NS_OK; @@ -1960,23 +1965,25 @@ nsHTMLDocument::GetAnchors(nsIDOMHTMLCollection** aAnchors) } NS_IMETHODIMP -nsHTMLDocument::GetCookie(nsString& aCookie) +nsHTMLDocument::GetCookie(nsAWritableString& aCookie) { nsresult result = NS_OK; + nsAutoString str; NS_WITH_SERVICE(nsICookieService, service, kCookieServiceCID, &result); if ((NS_OK == result) && (nsnull != service) && (nsnull != mDocumentURL)) { - result = service->GetCookieString(mDocumentURL, aCookie); + result = service->GetCookieString(mDocumentURL, str); } + aCookie.Assign(str); return result; } NS_IMETHODIMP -nsHTMLDocument::SetCookie(const nsString& aCookie) +nsHTMLDocument::SetCookie(const nsAReadableString& aCookie) { nsresult result = NS_OK; NS_WITH_SERVICE(nsICookieService, service, kCookieServiceCID, &result); if ((NS_OK == result) && (nsnull != service) && (nsnull != mDocumentURL)) { - result = service->SetCookieString(mDocumentURL, aCookie); + result = service->SetCookieString(mDocumentURL, nsAutoString(aCookie)); } return result; } @@ -2166,7 +2173,7 @@ nsHTMLDocument::Close() } nsresult -nsHTMLDocument::WriteCommon(const nsString& aText, +nsHTMLDocument::WriteCommon(const nsAReadableString& aText, PRBool aNewlineTerminate) { nsresult result = NS_OK; @@ -2197,13 +2204,13 @@ nsHTMLDocument::WriteCommon(const nsString& aText, } NS_IMETHODIMP -nsHTMLDocument::Write(const nsString& aText) +nsHTMLDocument::Write(const nsAReadableString& aText) { return WriteCommon(aText, PR_FALSE); } NS_IMETHODIMP -nsHTMLDocument::Writeln(const nsString& aText) +nsHTMLDocument::Writeln(const nsAReadableString& aText) { return WriteCommon(aText, PR_TRUE); } @@ -2304,7 +2311,7 @@ nsHTMLDocument::Writeln(JSContext *cx, jsval *argv, PRUint32 argc) } nsIContent * -nsHTMLDocument::MatchName(nsIContent *aContent, const nsString& aName) +nsHTMLDocument::MatchName(nsIContent *aContent, const nsAReadableString& aName) { nsAutoString value; nsIContent *result = nsnull; @@ -2331,7 +2338,7 @@ nsHTMLDocument::MatchName(nsIContent *aContent, const nsString& aName) } NS_IMETHODIMP -nsHTMLDocument::GetElementById(const nsString& aElementId, nsIDOMElement** aReturn) +nsHTMLDocument::GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; @@ -2361,8 +2368,8 @@ nsHTMLDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsHTMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsHTMLDocument::CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -2370,8 +2377,8 @@ nsHTMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsHTMLDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsHTMLDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsAutoString tmp(aLocalName); @@ -2398,12 +2405,14 @@ nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, nsString* aData) } NS_IMETHODIMP -nsHTMLDocument::GetElementsByName(const nsString& aElementName, +nsHTMLDocument::GetElementsByName(const nsAReadableString& aElementName, nsIDOMNodeList** aReturn) { + nsAutoString name(aElementName); + nsContentList* elements = new nsContentList(this, MatchNameAttribute, - &aElementName); + &name); if (nsnull == elements) { return NS_ERROR_OUT_OF_MEMORY; } @@ -2523,7 +2532,7 @@ nsHTMLDocument::GetHeight(PRInt32* aHeight) } NS_IMETHODIMP -nsHTMLDocument::GetAlinkColor(nsString& aAlinkColor) +nsHTMLDocument::GetAlinkColor(nsAWritableString& aAlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2547,7 +2556,7 @@ nsHTMLDocument::GetAlinkColor(nsString& aAlinkColor) } NS_IMETHODIMP -nsHTMLDocument::SetAlinkColor(const nsString& aAlinkColor) +nsHTMLDocument::SetAlinkColor(const nsAReadableString& aAlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2569,7 +2578,7 @@ nsHTMLDocument::SetAlinkColor(const nsString& aAlinkColor) } NS_IMETHODIMP -nsHTMLDocument::GetLinkColor(nsString& aLinkColor) +nsHTMLDocument::GetLinkColor(nsAWritableString& aLinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2593,7 +2602,7 @@ nsHTMLDocument::GetLinkColor(nsString& aLinkColor) } NS_IMETHODIMP -nsHTMLDocument::SetLinkColor(const nsString& aLinkColor) +nsHTMLDocument::SetLinkColor(const nsAReadableString& aLinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2614,7 +2623,7 @@ nsHTMLDocument::SetLinkColor(const nsString& aLinkColor) } NS_IMETHODIMP -nsHTMLDocument::GetVlinkColor(nsString& aVlinkColor) +nsHTMLDocument::GetVlinkColor(nsAWritableString& aVlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2638,7 +2647,7 @@ nsHTMLDocument::GetVlinkColor(nsString& aVlinkColor) } NS_IMETHODIMP -nsHTMLDocument::SetVlinkColor(const nsString& aVlinkColor) +nsHTMLDocument::SetVlinkColor(const nsAReadableString& aVlinkColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2659,7 +2668,7 @@ nsHTMLDocument::SetVlinkColor(const nsString& aVlinkColor) } NS_IMETHODIMP -nsHTMLDocument::GetBgColor(nsString& aBgColor) +nsHTMLDocument::GetBgColor(nsAWritableString& aBgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2683,7 +2692,7 @@ nsHTMLDocument::GetBgColor(nsString& aBgColor) } NS_IMETHODIMP -nsHTMLDocument::SetBgColor(const nsString& aBgColor) +nsHTMLDocument::SetBgColor(const nsAReadableString& aBgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2704,7 +2713,7 @@ nsHTMLDocument::SetBgColor(const nsString& aBgColor) } NS_IMETHODIMP -nsHTMLDocument::GetFgColor(nsString& aFgColor) +nsHTMLDocument::GetFgColor(nsAWritableString& aFgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2728,7 +2737,7 @@ nsHTMLDocument::GetFgColor(nsString& aFgColor) } NS_IMETHODIMP -nsHTMLDocument::SetFgColor(const nsString& aFgColor) +nsHTMLDocument::SetFgColor(const nsAReadableString& aFgColor) { nsresult result = NS_OK; nsIDOMHTMLBodyElement* body; @@ -2750,13 +2759,13 @@ nsHTMLDocument::SetFgColor(const nsString& aFgColor) } NS_IMETHODIMP -nsHTMLDocument::GetLastModified(nsString& aLastModified) +nsHTMLDocument::GetLastModified(nsAWritableString& aLastModified) { if (nsnull != mLastModified) { - aLastModified = *mLastModified; + aLastModified.Assign(*mLastModified); } else { - aLastModified.AssignWithConversion("January 1, 1970 GMT"); + aLastModified.Assign(NS_LITERAL_STRING("January 1, 1970 GMT")); } return NS_OK; @@ -2818,7 +2827,7 @@ nsHTMLDocument::GetLayers(nsIDOMHTMLCollection** aLayers) #endif NS_IMETHODIMP -nsHTMLDocument::GetSelection(nsString& aReturn) +nsHTMLDocument::GetSelection(nsAWritableString& aReturn) { aReturn.Truncate(); @@ -2845,7 +2854,7 @@ nsHTMLDocument::GetSelection(nsString& aReturn) (do_GetService("mozilla.consoleservice.1")); if (consoleService) { - consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Deprecated method document.getSelection() called. Please use window.getSelection() instead.").GetUnicode()); + consoleService->LogStringMessage(NS_LITERAL_STRING("Deprecated method document.getSelection() called. Please use window.getSelection() instead.")); } return domSelection->ToString(NS_ConvertASCIItoUCS2("text/plain"), nsIDocumentEncoder::OutputFormatted |nsIDocumentEncoder::OutputSelectionOnly, 0, aReturn); @@ -3785,7 +3794,9 @@ static nsIDOMNode * FindDOMNode(nsIDOMNode * aNode, nsIContent * aContent) /** * Finds text in content */ -NS_IMETHODIMP nsHTMLDocument::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) +NS_IMETHODIMP nsHTMLDocument::FindNext(const nsAReadableString &aSearchStr, + PRBool aMatchCase, PRBool aSearchDown, + PRBool &aIsFound) { #if 0 aIsFound = PR_FALSE; diff --git a/layout/html/document/src/nsHTMLDocument.h b/layout/html/document/src/nsHTMLDocument.h index fc70f99571a0..dd7fc1d2fd6f 100644 --- a/layout/html/document/src/nsHTMLDocument.h +++ b/layout/html/document/src/nsHTMLDocument.h @@ -61,7 +61,7 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; NS_IMETHOD CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, @@ -91,17 +91,18 @@ public: NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader); NS_IMETHOD GetBaseURL(nsIURI*& aURL) const; - NS_IMETHOD SetBaseURL(const nsString& aURLSpec); - NS_IMETHOD GetBaseTarget(nsString& aTarget) const; - NS_IMETHOD SetBaseTarget(const nsString& aTarget); + NS_IMETHOD SetBaseURL(const nsAReadableString& aURLSpec); + NS_IMETHOD GetBaseTarget(nsAWritableString& aTarget) const; + NS_IMETHOD SetBaseTarget(const nsAReadableString& aTarget); - NS_IMETHOD SetLastModified(const nsString& aLastModified); - NS_IMETHOD SetReferrer(const nsString& aReferrer); + NS_IMETHOD SetLastModified(const nsAReadableString& aLastModified); + NS_IMETHOD SetReferrer(const nsAReadableString& aReferrer); NS_IMETHOD GetDTDMode(nsDTDMode& aMode); NS_IMETHOD SetDTDMode(nsDTDMode aMode); - NS_IMETHOD SetHeaderData(nsIAtom* aHeaderField, const nsString& aData); + NS_IMETHOD SetHeaderData(nsIAtom* aHeaderField, + const nsAReadableString& aData); NS_IMETHOD ContentAppended(nsIContent* aContainer, PRInt32 aNewIndexInContainer); @@ -138,7 +139,8 @@ public: /** * Finds text in content */ - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, + PRBool aSearchDown, PRBool &aIsFound); /* * Like nsDocument::IsInSelection except it always includes the body node @@ -196,7 +198,7 @@ protected: PRBool aInForm); void DeleteNamedItems(); - nsIContent *MatchName(nsIContent *aContent, const nsString& aName); + nsIContent *MatchName(nsIContent *aContent, const nsAReadableString& aName); virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex); @@ -212,7 +214,7 @@ protected: NS_IMETHOD GetDomainURI(nsIURI **uri); - nsresult WriteCommon(const nsString& aText, + nsresult WriteCommon(const nsAReadableString& aText, PRBool aNewlineTerminate); nsresult ScriptWriteCommon(JSContext *cx, jsval *argv, diff --git a/layout/html/document/src/nsIHTMLDocument.h b/layout/html/document/src/nsIHTMLDocument.h index 659789172bb8..800cd28792f1 100644 --- a/layout/html/document/src/nsIHTMLDocument.h +++ b/layout/html/document/src/nsIHTMLDocument.h @@ -46,8 +46,6 @@ class nsIHTMLDocument : public nsISupports { public: static const nsIID& GetIID() { static nsIID iid = NS_IHTMLDOCUMENT_IID; return iid; } - NS_IMETHOD SetTitle(const nsString& aTitle) = 0; - NS_IMETHOD AddImageMap(nsIDOMHTMLMapElement* aMap) = 0; NS_IMETHOD GetImageMap(const nsString& aMapName, @@ -59,13 +57,13 @@ public: NS_IMETHOD GetForms(nsIDOMHTMLCollection** aForms) = 0; - NS_IMETHOD SetBaseURL(const nsString& aURLSpec) = 0; + NS_IMETHOD SetBaseURL(const nsAReadableString& aURLSpec) = 0; - NS_IMETHOD GetBaseTarget(nsString& aTarget) const = 0; - NS_IMETHOD SetBaseTarget(const nsString& aTarget) = 0; + NS_IMETHOD GetBaseTarget(nsAWritableString& aTarget) const = 0; + NS_IMETHOD SetBaseTarget(const nsAReadableString& aTarget) = 0; - NS_IMETHOD SetLastModified(const nsString& aLastModified) = 0; - NS_IMETHOD SetReferrer(const nsString& aReferrer) = 0; + NS_IMETHOD SetLastModified(const nsAReadableString& aLastModified) = 0; + NS_IMETHOD SetReferrer(const nsAReadableString& aReferrer) = 0; /** * Access DTD compatibility mode for this document diff --git a/layout/html/forms/public/nsIFormControlFrame.h b/layout/html/forms/public/nsIFormControlFrame.h index dfc0e096274c..0d496ccce10e 100644 --- a/layout/html/forms/public/nsIFormControlFrame.h +++ b/layout/html/forms/public/nsIFormControlFrame.h @@ -122,7 +122,7 @@ public: * @returns NS_OK if the property name is valid, otherwise an error code */ - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) = 0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) = 0; /** * Get a property from the form control frame @@ -132,7 +132,7 @@ public: * @returns NS_OK if the property name is valid, otherwise an error code */ - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue) = 0; + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue) = 0; diff --git a/layout/html/forms/src/nsButtonControlFrame.h b/layout/html/forms/src/nsButtonControlFrame.h index 9fbb17259468..526a9d622452 100644 --- a/layout/html/forms/src/nsButtonControlFrame.h +++ b/layout/html/forms/src/nsButtonControlFrame.h @@ -36,8 +36,8 @@ public: nsresult RequiresWidget(PRBool &aHasWidget); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); #ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; diff --git a/layout/html/forms/src/nsCheckboxControlFrame.cpp b/layout/html/forms/src/nsCheckboxControlFrame.cpp index bdc91f74fb17..dc0e1f334ab1 100644 --- a/layout/html/forms/src/nsCheckboxControlFrame.cpp +++ b/layout/html/forms/src/nsCheckboxControlFrame.cpp @@ -310,7 +310,7 @@ void nsCheckboxControlFrame::SetCheckboxControlFrameState(nsIPresContext* aPresC NS_IMETHODIMP nsCheckboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, - const nsString& aValue) + const nsAReadableString& aValue) { if (nsHTMLAtoms::checked == aName) SetCheckboxControlFrameState(aPresContext, aValue); @@ -321,7 +321,7 @@ NS_IMETHODIMP nsCheckboxControlFrame::SetProperty(nsIPresContext* aPresContext, } -NS_IMETHODIMP nsCheckboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsCheckboxControlFrame::GetProperty(nsIAtom* aName, nsAReadableString& aValue) { if (nsHTMLAtoms::checked == aName) GetCheckboxControlFrameState(aValue); diff --git a/layout/html/forms/src/nsCheckboxControlFrame.h b/layout/html/forms/src/nsCheckboxControlFrame.h index 489f3c6d4694..d97494392dbd 100644 --- a/layout/html/forms/src/nsCheckboxControlFrame.h +++ b/layout/html/forms/src/nsCheckboxControlFrame.h @@ -73,8 +73,8 @@ public: virtual const nsIID& GetIID(); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); virtual void Reset(nsIPresContext* aPresContext); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index d8c532b56410..1f2d0a4e91f9 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -2063,7 +2063,7 @@ nsComboboxControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP -nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); @@ -2075,7 +2075,7 @@ nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName } NS_IMETHODIMP -nsComboboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +nsComboboxControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); diff --git a/layout/html/forms/src/nsComboboxControlFrame.h b/layout/html/forms/src/nsComboboxControlFrame.h index 236454838540..6e220690323b 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.h +++ b/layout/html/forms/src/nsComboboxControlFrame.h @@ -125,8 +125,8 @@ public: NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetName(nsString* aName); NS_IMETHOD GetType(PRInt32* aType) const; - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); virtual void InitializeControl(nsIPresContext* aPresContext); diff --git a/layout/html/forms/src/nsFileControlFrame.cpp b/layout/html/forms/src/nsFileControlFrame.cpp index 9b83ff2dc5a6..603c82d09afc 100644 --- a/layout/html/forms/src/nsFileControlFrame.cpp +++ b/layout/html/forms/src/nsFileControlFrame.cpp @@ -611,7 +611,7 @@ nsresult nsFileControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, - const nsString& aValue) + const nsAReadableString& aValue) { nsresult rv = NS_OK; if (nsHTMLAtoms::value == aName) { @@ -626,7 +626,7 @@ NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP nsFileControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsFileControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If widget is null, assume the widget is GFX-rendered and return a member variable instead. diff --git a/layout/html/forms/src/nsFileControlFrame.h b/layout/html/forms/src/nsFileControlFrame.h index 2a15dd558fdc..955b5987daaf 100644 --- a/layout/html/forms/src/nsFileControlFrame.h +++ b/layout/html/forms/src/nsFileControlFrame.h @@ -75,8 +75,8 @@ public: nsFramePaintLayer aWhichLayer); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD Reflow(nsIPresContext* aCX, diff --git a/layout/html/forms/src/nsFormControlFrame.cpp b/layout/html/forms/src/nsFormControlFrame.cpp index 3b69c3242d99..019b8d4d2906 100644 --- a/layout/html/forms/src/nsFormControlFrame.cpp +++ b/layout/html/forms/src/nsFormControlFrame.cpp @@ -903,14 +903,15 @@ nsFormControlFrame::SetCurrentCheckState(PRBool aState) } NS_IMETHODIMP -nsFormControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +nsFormControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { return NS_OK; } NS_IMETHODIMP -nsFormControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +nsFormControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { + aValue.Truncate(); return NS_OK; } diff --git a/layout/html/forms/src/nsFormControlFrame.h b/layout/html/forms/src/nsFormControlFrame.h index 41a8710d2e32..37810728eeeb 100644 --- a/layout/html/forms/src/nsFormControlFrame.h +++ b/layout/html/forms/src/nsFormControlFrame.h @@ -209,9 +209,9 @@ public: nsSize& aSize); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); // Resize Reflow Optimiaztion Methods static void SetupCachedSizes(nsSize& aCacheSize, nsSize& aCachedMaxElementSize, diff --git a/layout/html/forms/src/nsFormControlHelper.cpp b/layout/html/forms/src/nsFormControlHelper.cpp index bf94eab0cf44..5bc252fe6a98 100644 --- a/layout/html/forms/src/nsFormControlHelper.cpp +++ b/layout/html/forms/src/nsFormControlHelper.cpp @@ -132,14 +132,16 @@ void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString) aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n")); } -PRBool nsFormControlHelper::GetBool(const nsString& aValue) +PRBool nsFormControlHelper::GetBool(const nsAReadableString& aValue) { - return aValue.EqualsWithConversion(NS_STRING_TRUE); + return aValue.Equals(NS_STRING_TRUE); } -void nsFormControlHelper::GetBoolString(const PRBool aValue, nsString& aResult) +void nsFormControlHelper::GetBoolString(const PRBool aValue, + nsAWritableString& aResult) { - aResult.AssignWithConversion( aValue ? NS_STRING_TRUE : NS_STRING_FALSE ); + aResult.Assign( aValue ? NS_STRING_TRUE : + NS_STRING_FALSE ); } diff --git a/layout/html/forms/src/nsFormControlHelper.h b/layout/html/forms/src/nsFormControlHelper.h index 8ea3b7c08c52..33ff8060902b 100644 --- a/layout/html/forms/src/nsFormControlHelper.h +++ b/layout/html/forms/src/nsFormControlHelper.h @@ -41,8 +41,8 @@ class nsFormFrame; #define CSS_NOTSET -1 #define ATTR_NOTSET -1 -#define NS_STRING_TRUE "1" -#define NS_STRING_FALSE "0" +#define NS_STRING_TRUE NS_LITERAL_STRING("1") +#define NS_STRING_FALSE NS_LITERAL_STRING("0") /** * Enumeration of possible mouse states used to detect mouse clicks @@ -145,7 +145,7 @@ public: * @returns PR_TRUE if aValue = "1", PR_FALSE otherwise */ - static PRBool GetBool(const nsString& aValue); + static PRBool GetBool(const nsAReadableString& aValue); /** * Utility to convert a PRBool to a string @@ -155,7 +155,7 @@ public: */ - static void GetBoolString(const PRBool aValue, nsString& aResult); + static void GetBoolString(const PRBool aValue, nsAWritableString& aResult); // XXX similar functionality needs to be added to widget library and these // need to change to use it. diff --git a/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index 06cb2b294e84..a6c9260902c9 100644 --- a/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -453,7 +453,7 @@ nsGfxCheckboxControlFrame::SetCheckboxState (nsIPresContext* aPresContext, } //------------------------------------------------------------ -void nsGfxCheckboxControlFrame::GetCheckboxControlFrameState(nsString& aValue) +void nsGfxCheckboxControlFrame::GetCheckboxControlFrameState(nsAWritableString& aValue) { CheckStateToString(GetCheckboxState(), aValue); } @@ -461,7 +461,7 @@ void nsGfxCheckboxControlFrame::GetCheckboxControlFrameState(nsString& aValue) //------------------------------------------------------------ void nsGfxCheckboxControlFrame::SetCheckboxControlFrameState(nsIPresContext* aPresContext, - const nsString& aValue) + const nsAReadableString& aValue) { CheckState state = StringToCheckState(aValue); SetCheckboxState(aPresContext, state); @@ -470,7 +470,7 @@ void nsGfxCheckboxControlFrame::SetCheckboxControlFrameState(nsIPresContext* aPr //------------------------------------------------------------ NS_IMETHODIMP nsGfxCheckboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, - const nsString& aValue) + const nsAReadableString& aValue) { if (nsHTMLAtoms::checked == aName) SetCheckboxControlFrameState(aPresContext, aValue); @@ -482,7 +482,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::SetProperty(nsIPresContext* aPresContex //------------------------------------------------------------ -NS_IMETHODIMP nsGfxCheckboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsGfxCheckboxControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { if (nsHTMLAtoms::checked == aName) GetCheckboxControlFrameState(aValue); @@ -548,19 +548,19 @@ nsGfxCheckboxControlFrame::Reset(nsIPresContext* aPresContext) // Converts from a CheckState to a string // void -nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& outStateAsString ) +nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsAWritableString& outStateAsString ) { switch ( inState ) { case eOn: - outStateAsString.AssignWithConversion(NS_STRING_TRUE); + outStateAsString.Assign(NS_STRING_TRUE); break; case eOff: - outStateAsString.AssignWithConversion(NS_STRING_FALSE); + outStateAsString.Assign(NS_STRING_FALSE); break; case eMixed: - outStateAsString.AssignWithConversion("2"); + outStateAsString.Assign(NS_LITERAL_STRING("2")); break; } } // CheckStateToString @@ -573,11 +573,11 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou // Converts from a string to a CheckState enum // nsGfxCheckboxControlFrame::CheckState -nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString ) +nsGfxCheckboxControlFrame::StringToCheckState ( const nsAReadableString & aStateAsString ) { - if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) ) + if ( aStateAsString.Equals(NS_STRING_TRUE) ) return eOn; - else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) ) + else if ( aStateAsString.Equals(NS_STRING_FALSE) ) return eOff; // not true and not false means mixed diff --git a/layout/html/forms/src/nsGfxCheckboxControlFrame.h b/layout/html/forms/src/nsGfxCheckboxControlFrame.h index 443cfbf782cc..2d1667d4c51a 100644 --- a/layout/html/forms/src/nsGfxCheckboxControlFrame.h +++ b/layout/html/forms/src/nsGfxCheckboxControlFrame.h @@ -75,8 +75,8 @@ public: nsIStyleContext* aStyleContext); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); virtual void Reset(nsIPresContext* aPresContext); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, @@ -104,12 +104,12 @@ protected: // Utility methods for implementing SetProperty/GetProperty void SetCheckboxControlFrameState(nsIPresContext* aPresContext, - const nsString& aValue); - void GetCheckboxControlFrameState(nsString& aValue); + const nsAReadableString& aValue); + void GetCheckboxControlFrameState(nsAWritableString& aValue); // utility routine for converting from DOM values to internal enum - void CheckStateToString ( CheckState inState, nsString& outStateAsString ) ; - CheckState StringToCheckState ( const nsString & aStateAsString ) ; + void CheckStateToString ( CheckState inState, nsAWritableString& outStateAsString ) ; + CheckState StringToCheckState ( const nsAReadableString & aStateAsString ) ; // figure out if we're a tri-state checkbox. PRBool IsTristateCheckbox ( ) const { return mIsTristate; } diff --git a/layout/html/forms/src/nsGfxListControlFrame.cpp b/layout/html/forms/src/nsGfxListControlFrame.cpp index 3ab3cb177a88..269694413ccc 100644 --- a/layout/html/forms/src/nsGfxListControlFrame.cpp +++ b/layout/html/forms/src/nsGfxListControlFrame.cpp @@ -2641,14 +2641,15 @@ nsGfxListControlFrame::OptionDisabled(nsIContent * aContent) //--------------------------------------------------------- NS_IMETHODIMP -nsGfxListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +nsGfxListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { if (nsHTMLAtoms::selected == aName) { return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec. } else if (nsHTMLAtoms::selectedindex == aName) { PRInt32 error = 0; - PRInt32 selectedIndex = aValue.ToInteger(&error, 10); // Get index from aValue + nsAutoString str(aValue); + PRInt32 selectedIndex = str.ToInteger(&error, 10); // Get index from aValue if (error) { return NS_ERROR_INVALID_ARG; // Couldn't convert to integer } else { @@ -2691,13 +2692,14 @@ nsGfxListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, //--------------------------------------------------------- NS_IMETHODIMP -nsGfxListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +nsGfxListControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Get the selected value of option from local cache (optimization vs. widget) if (nsHTMLAtoms::selected == aName) { PRInt32 error = 0; PRBool selected = PR_FALSE; - PRInt32 indx = aValue.ToInteger(&error, 10); // Get index from aValue + nsAutoString str(aValue); + PRInt32 indx = str.ToInteger(&error, 10); // Get index from aValue if (error == 0) selected = IsContentSelectedByIndex(indx); @@ -2711,7 +2713,8 @@ nsGfxListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) { selectedIndex = 0; } - aValue.AppendInt(selectedIndex, 10); + nsAutoString str; str.AppendInt(selectedIndex, 10); + aValue.Append(str); } return NS_OK; diff --git a/layout/html/forms/src/nsGfxListControlFrame.h b/layout/html/forms/src/nsGfxListControlFrame.h index 439120aec4a5..a6a82f452c61 100644 --- a/layout/html/forms/src/nsGfxListControlFrame.h +++ b/layout/html/forms/src/nsGfxListControlFrame.h @@ -197,8 +197,8 @@ public: // nsIFormControlFrame NS_IMETHOD GetType(PRInt32* aType) const; NS_IMETHOD GetName(nsString* aName); - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, const nsFont*& aFont); diff --git a/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/layout/html/forms/src/nsGfxRadioControlFrame.cpp index c2d5916fc6c9..982a94dc0ede 100644 --- a/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -122,10 +122,10 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, } //-------------------------------------------------------------- -NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { if (nsHTMLAtoms::checked == aName) { - PRBool state = (aValue.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; + PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; // if there is no form than the radiobtn is an orphan @@ -147,7 +147,7 @@ NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, } //-------------------------------------------------------------- -NS_IMETHODIMP nsGfxRadioControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsGfxRadioControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If is null, assume the widget is GFX-rendered and return a member variable instead. diff --git a/layout/html/forms/src/nsGfxRadioControlFrame.h b/layout/html/forms/src/nsGfxRadioControlFrame.h index 01a6a19dd8fe..1594f1aa79a4 100644 --- a/layout/html/forms/src/nsGfxRadioControlFrame.h +++ b/layout/html/forms/src/nsGfxRadioControlFrame.h @@ -88,8 +88,8 @@ public: virtual void Reset(nsIPresContext* aPresContext); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); //nsIStatefulFrame NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType); diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp index 723f0ad0b1f2..c113d121d451 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -1815,7 +1815,7 @@ NS_IMETHODIMP nsGfxTextControlFrame::SetProperty(nsIPresContext* aPresContext, n return NS_OK; } -NS_IMETHODIMP nsGfxTextControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsGfxTextControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If widget is null, assume the widget is GFX-rendered and return a member variable instead. diff --git a/layout/html/forms/src/nsGfxTextControlFrame.h b/layout/html/forms/src/nsGfxTextControlFrame.h index 98678c389ac8..1a95a1abbe91 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.h +++ b/layout/html/forms/src/nsGfxTextControlFrame.h @@ -434,8 +434,8 @@ public: NS_IMETHOD CreateEditor(); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext* aPresContext); diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 864565f65bee..8ae068ce9299 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -2148,7 +2148,7 @@ nsGfxTextControlFrame2::GetFormContent(nsIContent*& aContent) const return rv; } -NS_IMETHODIMP nsGfxTextControlFrame2::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsGfxTextControlFrame2::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { if (!mIsProcessing)//some kind of lock. { @@ -2174,7 +2174,7 @@ NS_IMETHODIMP nsGfxTextControlFrame2::SetProperty(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP nsGfxTextControlFrame2::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsGfxTextControlFrame2::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If widget is null, assume the widget is GFX-rendered and return a member variable instead. @@ -2769,7 +2769,7 @@ nsGfxTextControlFrame2::GetCachedString() return mCachedState; } -void nsGfxTextControlFrame2::GetTextControlFrameState(nsString& aValue) +void nsGfxTextControlFrame2::GetTextControlFrameState(nsAWritableString& aValue) { aValue.SetLength(0); // initialize out param @@ -2801,7 +2801,7 @@ void nsGfxTextControlFrame2::GetTextControlFrameState(nsString& aValue) // END IMPLEMENTING NS_IFORMCONTROLFRAME void -nsGfxTextControlFrame2::SetTextControlFrameState(const nsString& aValue) +nsGfxTextControlFrame2::SetTextControlFrameState(const nsAReadableString& aValue) { if (mEditor) { @@ -2850,7 +2850,7 @@ nsGfxTextControlFrame2::SetTextControlFrameState(const nsString& aValue) if (!mCachedState) return; } - *mCachedState = aValue; //store value for later initialization; + mCachedState->Assign(aValue); //store value for later initialization; } } diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.h b/layout/html/forms/src/nsGfxTextControlFrame2.h index 7a6bfefedaa8..3adde2fb3cbd 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame2.h +++ b/layout/html/forms/src/nsGfxTextControlFrame2.h @@ -87,8 +87,8 @@ public: PRBool aCompileEventHandlers); // Utility methods to get and set current widget state - void GetTextControlFrameState(nsString& aValue); - void SetTextControlFrameState(const nsString& aValue); + void GetTextControlFrameState(nsAWritableString& aValue); + void SetTextControlFrameState(const nsAReadableString& aValue); NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame* aChildList); @@ -117,8 +117,8 @@ public: NS_IMETHOD GetFont(nsIPresContext* aPresContext, const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); //==== END NSIFORMCONTROLFRAME diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index a9dc213b9c6d..6c9cdf83bf4c 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -750,13 +750,14 @@ nsresult nsHTMLButtonControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP nsHTMLButtonControlFrame::SetProperty(nsIPresContext* aPresContext, - nsIAtom* aName, const nsString& aValue) + nsIAtom* aName, const nsAReadableString& aValue) { return NS_OK; } -NS_IMETHODIMP nsHTMLButtonControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsHTMLButtonControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { + aValue.Truncate(); return NS_OK; } diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.h b/layout/html/forms/src/nsHTMLButtonControlFrame.h index ff27a5a01c67..a853015e392e 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.h +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.h @@ -140,8 +140,8 @@ public: void GetDefaultLabel(nsString& aLabel); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); protected: diff --git a/layout/html/forms/src/nsImageControlFrame.cpp b/layout/html/forms/src/nsImageControlFrame.cpp index 84784efc8110..5dec9265503e 100644 --- a/layout/html/forms/src/nsImageControlFrame.cpp +++ b/layout/html/forms/src/nsImageControlFrame.cpp @@ -132,8 +132,8 @@ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); protected: @@ -507,13 +507,16 @@ nsresult nsImageControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP nsImageControlFrame::SetProperty(nsIPresContext* aPresContext, - nsIAtom* aName, const nsString& aValue) + nsIAtom* aName, + const nsAReadableString& aValue) { return NS_OK; } -NS_IMETHODIMP nsImageControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsImageControlFrame::GetProperty(nsIAtom* aName, + nsAWritableString& aValue) { + aValue.Truncate(); return NS_OK; } diff --git a/layout/html/forms/src/nsListControlFrame.cpp b/layout/html/forms/src/nsListControlFrame.cpp index d7ad9c5015e0..53f2545fd8a4 100644 --- a/layout/html/forms/src/nsListControlFrame.cpp +++ b/layout/html/forms/src/nsListControlFrame.cpp @@ -2445,14 +2445,16 @@ nsListControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue) //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, + const nsAReadableString& aValue) { if (nsHTMLAtoms::selected == aName) { return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec. } else if (nsHTMLAtoms::selectedindex == aName) { PRInt32 error = 0; - PRInt32 selectedIndex = aValue.ToInteger(&error, 10); // Get index from aValue + nsAutoString str(aValue); + PRInt32 selectedIndex = str.ToInteger(&error, 10); // Get index from aValue if (error) { return NS_ERROR_INVALID_ARG; // Couldn't convert to integer } else { @@ -2501,13 +2503,14 @@ nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, co //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +nsListControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Get the selected value of option from local cache (optimization vs. widget) if (nsHTMLAtoms::selected == aName) { + nsAutoString val(aValue); PRInt32 error = 0; PRBool selected = PR_FALSE; - PRInt32 indx = aValue.ToInteger(&error, 10); // Get index from aValue + PRInt32 indx = val.ToInteger(&error, 10); // Get index from aValue if (error == 0) selected = IsContentSelectedByIndex(indx); @@ -2521,7 +2524,8 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) { selectedIndex = 0; } - aValue.AppendInt(selectedIndex, 10); + nsAutoString str; str.AppendInt(selectedIndex, 10); + aValue.Append(str); } return NS_OK; diff --git a/layout/html/forms/src/nsListControlFrame.h b/layout/html/forms/src/nsListControlFrame.h index e4a4d150b3a3..ba6a026f87f3 100644 --- a/layout/html/forms/src/nsListControlFrame.h +++ b/layout/html/forms/src/nsListControlFrame.h @@ -194,8 +194,8 @@ public: // nsIFormControlFrame NS_IMETHOD GetType(PRInt32* aType) const; NS_IMETHOD GetName(nsString* aName); - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, const nsFont*& aFont); diff --git a/layout/html/forms/src/nsNativeSelectControlFrame.cpp b/layout/html/forms/src/nsNativeSelectControlFrame.cpp index 5a73c5276b7a..b2c98623a4db 100644 --- a/layout/html/forms/src/nsNativeSelectControlFrame.cpp +++ b/layout/html/forms/src/nsNativeSelectControlFrame.cpp @@ -144,8 +144,8 @@ public: virtual void ControlChanged(nsIPresContext* aPresContext); // nsIFormControLFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, @@ -1419,7 +1419,7 @@ NS_IMETHODIMP nsNativeSelectControlFrame::RemoveOption(nsIPresContext* aPresCont return NS_OK; } -NS_IMETHODIMP nsNativeSelectControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsNativeSelectControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Get the selected value of option from local cache (optimization vs. widget) if (nsHTMLAtoms::selected == aName) { diff --git a/layout/html/forms/src/nsNativeTextControlFrame.cpp b/layout/html/forms/src/nsNativeTextControlFrame.cpp index 6e234d924051..c8a3568a1493 100644 --- a/layout/html/forms/src/nsNativeTextControlFrame.cpp +++ b/layout/html/forms/src/nsNativeTextControlFrame.cpp @@ -581,7 +581,7 @@ void nsNativeTextControlFrame::SetTextControlFrameState(const nsString& aValue) NS_IMETHODIMP nsNativeTextControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, - const nsString& aValue) + const nsAReadableString& aValue) { nsresult rv = NS_OK; if (nsHTMLAtoms::value == aName) { @@ -609,7 +609,7 @@ NS_IMETHODIMP nsNativeTextControlFrame::SetProperty(nsIPresContext* aPresContext return rv; } -NS_IMETHODIMP nsNativeTextControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsNativeTextControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If widget is null, assume the widget is GFX-rendered and return a member variable instead. diff --git a/layout/html/forms/src/nsNativeTextControlFrame.h b/layout/html/forms/src/nsNativeTextControlFrame.h index 60e625d83505..39dfb58aab14 100644 --- a/layout/html/forms/src/nsNativeTextControlFrame.h +++ b/layout/html/forms/src/nsNativeTextControlFrame.h @@ -35,8 +35,8 @@ public: virtual ~nsNativeTextControlFrame(); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext* aPresContext); diff --git a/layout/html/forms/src/nsRadioControlFrame.cpp b/layout/html/forms/src/nsRadioControlFrame.cpp index bff09aaa852a..7f9ef489661f 100644 --- a/layout/html/forms/src/nsRadioControlFrame.cpp +++ b/layout/html/forms/src/nsRadioControlFrame.cpp @@ -235,7 +235,7 @@ void nsRadioControlFrame::SetRadioControlFrameState(nsIPresContext* aPresContext SetRadioState(aPresContext, state); } -NS_IMETHODIMP nsRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { if (nsHTMLAtoms::checked == aName) { // Set the current state for the radio button because @@ -253,7 +253,7 @@ NS_IMETHODIMP nsRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsI return NS_OK; } -NS_IMETHODIMP nsRadioControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsRadioControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Return the value of the property from the widget it is not null. // If is null, assume the widget is GFX-rendered and return a member variable instead. diff --git a/layout/html/forms/src/nsRadioControlFrame.h b/layout/html/forms/src/nsRadioControlFrame.h index 5751e4e095c9..1933f71a34f9 100644 --- a/layout/html/forms/src/nsRadioControlFrame.h +++ b/layout/html/forms/src/nsRadioControlFrame.h @@ -42,8 +42,8 @@ public: nsresult RequiresWidget(PRBool &aHasWidget); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); virtual void PostCreateWidget(nsIPresContext* aPresContext, diff --git a/layout/html/forms/src/nsSelectControlFrame.cpp b/layout/html/forms/src/nsSelectControlFrame.cpp index dabafd9a8654..4aaa753bfd78 100644 --- a/layout/html/forms/src/nsSelectControlFrame.cpp +++ b/layout/html/forms/src/nsSelectControlFrame.cpp @@ -126,8 +126,8 @@ public: virtual void ControlChanged(nsIPresContext* aPresContext); // nsIFormControLFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue); + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, @@ -1211,7 +1211,7 @@ nsSelectControlFrame::AttributeChanged(nsIPresContext* aPresContext, } -NS_IMETHODIMP nsSelectControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsSelectControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue) { if (nsHTMLAtoms::selected == aName) { return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec. @@ -1385,7 +1385,7 @@ NS_IMETHODIMP nsSelectControlFrame::SetProperty(nsIPresContext* aPresContext, ns return NS_OK; } -NS_IMETHODIMP nsSelectControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) +NS_IMETHODIMP nsSelectControlFrame::GetProperty(nsIAtom* aName, nsAWritableString& aValue) { // Get the selected value of option from local cache (optimization vs. widget) if (nsHTMLAtoms::selected == aName) { diff --git a/layout/html/forms/src/nsTextControlFrame.h b/layout/html/forms/src/nsTextControlFrame.h index 2b271d347b0a..63d2a95e61a3 100644 --- a/layout/html/forms/src/nsTextControlFrame.h +++ b/layout/html/forms/src/nsTextControlFrame.h @@ -88,8 +88,8 @@ private: /* ---------- abstract methods derived class must implement ---------- */ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)=0; - NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue)=0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAReadableString& aValue)=0; + NS_IMETHOD GetProperty(nsIAtom* aName, nsAWritableString& aValue)=0; virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext* aPresContext)=0; diff --git a/layout/html/style/public/nsICSSParser.h b/layout/html/style/public/nsICSSParser.h index 349cb71529ba..e7ff6cc15418 100644 --- a/layout/html/style/public/nsICSSParser.h +++ b/layout/html/style/public/nsICSSParser.h @@ -24,11 +24,11 @@ #include "nslayout.h" #include "nsISupports.h" +#include "nsAWritableString.h" class nsIStyleRule; class nsICSSStyleSheet; class nsIUnicharInputStream; class nsIURI; -class nsString; class nsICSSDeclaration; class nsICSSLoader; @@ -65,26 +65,26 @@ public: // Parse declarations assuming that the outer curly braces have // already been accounted for. aBaseURL is the base url to use for // relative links in the declaration. - NS_IMETHOD ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult) = 0; + NS_IMETHOD ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult) = 0; - NS_IMETHOD ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint) = 0; + NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint) = 0; // Charset management method: // Set the charset before calling any of the Parse emthods if you want the // charset to be anything other than the default // sets the out-param to the current charset, as set by SetCharset - NS_IMETHOD GetCharset(/*out*/nsString &aCharsetDest) const = 0; + NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const = 0; // SetCharset expects the charset to be the preferred charset // and it just records the string exactly as passed in (no alias resolution) - NS_IMETHOD SetCharset(/*in*/ const nsString &aCharsetSrc) = 0; + NS_IMETHOD SetCharset(/*in*/ const nsAReadableString &aCharsetSrc) = 0; }; // Values or'd in the GetInfoMask; other bits are reserved diff --git a/layout/html/style/public/nsIComputedDOMStyle.h b/layout/html/style/public/nsIComputedDOMStyle.h index 206a1b149018..9ee1025e1aa4 100644 --- a/layout/html/style/public/nsIComputedDOMStyle.h +++ b/layout/html/style/public/nsIComputedDOMStyle.h @@ -37,7 +37,7 @@ class nsIComputedDOMStyle : public nsIDOMCSSStyleDeclaration public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMPUTEDDOMSTYLE_IID) - NS_IMETHOD Init(nsIDOMElement *aElement, const nsString& aPseudoElt, + NS_IMETHOD Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell) = 0; }; diff --git a/layout/html/style/src/nsCSSDeclaration.cpp b/layout/html/style/src/nsCSSDeclaration.cpp index 39f7adef9f7e..395e93399870 100644 --- a/layout/html/style/src/nsCSSDeclaration.cpp +++ b/layout/html/style/src/nsCSSDeclaration.cpp @@ -995,21 +995,21 @@ public: NS_IMETHOD AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue); NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct); NS_IMETHOD SetValueImportant(nsCSSProperty aProperty); - NS_IMETHOD AppendComment(const nsString& aComment); + NS_IMETHOD AppendComment(const nsAReadableString& aComment); NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue); NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue); - NS_IMETHOD GetValue(nsCSSProperty aProperty, nsString& aValue); - NS_IMETHOD GetValue(const nsString& aProperty, nsString& aValue); + NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue); + NS_IMETHOD GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue); NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult); NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, PRBool& aIsImportant); - NS_IMETHOD GetValueIsImportant(const nsString& aProperty, PRBool& aIsImportant); + NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant); - PRBool AppendValueToString(nsCSSProperty aProperty, nsString& aResult); - PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult); - NS_IMETHOD ToString(nsString& aString); + NS_IMETHOD ToString(nsAWritableString& aString); NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const; @@ -1018,7 +1018,7 @@ public: virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize); NS_IMETHOD Count(PRUint32* aCount); - NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn); NS_IMETHOD GetStyleImpact(PRInt32* aHint) const; @@ -3313,7 +3313,7 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) } NS_IMETHODIMP -CSSDeclarationImpl::AppendComment(const nsString& aComment) +CSSDeclarationImpl::AppendComment(const nsAReadableString& aComment) { nsresult result = NS_ERROR_OUT_OF_MEMORY; @@ -3913,20 +3913,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(const nsString& aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(const nsAReadableString& aProperty, + nsAWritableString& aValue) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); return GetValue(propID, aValue); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult) { nsCSSValue value; GetValue(aProperty, value); return AppendValueToString(aProperty, value, aResult); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult) { nsCSSUnit unit = aValue.GetUnit(); @@ -3936,10 +3937,14 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aResult.Append(NS_LITERAL_STRING("url(")); + break; + case eCSSUnit_Attr: aResult.Append(NS_LITERAL_STRING("attr(")); + break; + case eCSSUnit_Counter: aResult.Append(NS_LITERAL_STRING("counter(")); + break; + case eCSSUnit_Counters: aResult.Append(NS_LITERAL_STRING("counters(")); + break; default: break; } nsAutoString buffer; @@ -3952,17 +3957,23 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns case eCSSProperty_background_color: { // we can lookup the property in the ColorTable and then // get a string mapping the name - nsCString str; + nsAutoString tmpStr; + nsCAutoString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.AppendWithConversion(str); + aResult.Append(NS_ConvertASCIItoUCS2(str)); } else { - aResult.AppendInt(aValue.GetIntValue(), 10); + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); } } break; default: - aResult.AppendInt(aValue.GetIntValue(), 10); + { + nsAutoString tmpStr; + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); + } } } else if (eCSSUnit_Enumerated == unit) { @@ -3974,119 +3985,136 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, mask))); intValue &= ~mask; if (0 != intValue) { // more left - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } } } } else { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE))); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND)))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.AppendWithConversion(' '); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.Append(PRUnichar(' ')); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND))); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX))); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT))); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP))); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER))); } } else { const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.AppendWithConversion(name); + aResult.Append(NS_ConvertASCIItoUCS2(name)); } } else if (eCSSUnit_Color == unit){ + nsAutoString tmpStr; nscolor color = aValue.GetColorValue(); - aResult.AppendWithConversion("rgb("); - aResult.AppendInt(NS_GET_R(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_G(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_B(color), 10); - aResult.AppendWithConversion(')'); + + aResult.Append(NS_LITERAL_STRING("rgb(")); + + tmpStr.AppendInt(NS_GET_R(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_G(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_B(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == unit) { - aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetPercentValue() * 100.0f); + aResult.Append(tmpStr); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.AppendFloat(aValue.GetFloatValue()); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetFloatValue()); + aResult.Append(tmpStr); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aResult.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aResult.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aResult.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aResult.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aResult.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; + case eCSSUnit_Counters: aResult.Append(PRUnichar(')')); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; + case eCSSUnit_Percent: aResult.Append(PRUnichar('%')); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; - case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; + case eCSSUnit_Inch: aResult.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aResult.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aResult.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aResult.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aResult.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aResult.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aResult.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aResult.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aResult.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aResult.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aResult.Append(NS_LITERAL_STRING("cc")); break; - case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; - case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; + case eCSSUnit_EM: aResult.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aResult.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aResult.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aResult.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aResult.Append(NS_LITERAL_STRING("ch")); break; - case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; + case eCSSUnit_Pixel: aResult.Append(NS_LITERAL_STRING("px")); break; - case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; + case eCSSUnit_Degree: aResult.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aResult.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aResult.Append(NS_LITERAL_STRING("rad")); break; - case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; + case eCSSUnit_Hertz: aResult.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aResult.Append(NS_LITERAL_STRING("kHz")); break; - case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; + case eCSSUnit_Seconds: aResult.Append(PRUnichar('s')); break; + case eCSSUnit_Milliseconds: aResult.Append(NS_LITERAL_STRING("ms")); break; } return PR_TRUE; @@ -4102,7 +4130,8 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns (eCSSUnit_Null != strct->rect->mLeft.GetUnit())) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, + nsAWritableString& aValue) { PRBool isImportant = PR_FALSE; GetValueIsImportant(aProperty, isImportant); @@ -4115,41 +4144,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(PRUnichar(' ')); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.AppendWithConversion("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); + aValue.Append(NS_LITERAL_STRING("rect(")); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.AppendWithConversion(")"); + aValue.Append(PRUnichar(')')); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -4160,62 +4189,62 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.AppendWithConversion('/'); + aValue.Append(PRUnichar('/')); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_pause_before, aValue); } break; case eCSSProperty_size: if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { AppendValueToString(eCSSProperty_size_width, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_size_height, aValue); } break; @@ -4224,13 +4253,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(PRUnichar(' ')); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(PRUnichar(' ')); shadow = shadow->mNext; } } @@ -4242,67 +4271,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -4313,7 +4342,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != content); } @@ -4324,13 +4353,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4341,13 +4370,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4356,7 +4385,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -4366,11 +4395,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != quotes); } @@ -4382,7 +4411,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != keyEquiv); } @@ -4408,7 +4437,7 @@ CSSDeclarationImpl::GetImportantValues(nsICSSDeclaration*& aResult) } NS_IMETHODIMP -CSSDeclarationImpl::GetValueIsImportant(const nsString& aProperty, +CSSDeclarationImpl::GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); @@ -4438,7 +4467,7 @@ CSSDeclarationImpl::GetValueIsImportant(nsCSSProperty aProperty, } NS_IMETHODIMP -CSSDeclarationImpl::ToString(nsString& aString) +CSSDeclarationImpl::ToString(nsAWritableString& aString) { if (nsnull != mOrder) { PRInt32 count = mOrder->Count(); @@ -4446,21 +4475,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); - aString.AppendWithConversion(": "); + aString.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); + aString.Append(NS_LITERAL_STRING(": ")); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.AppendWithConversion("; "); + aString.Append(NS_LITERAL_STRING("; ")); } } else { // is comment - aString.AppendWithConversion("/* "); + aString.Append(NS_LITERAL_STRING("/* ")); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.AppendWithConversion(" */ "); + aString.Append(NS_LITERAL_STRING(" */ ")); } } } @@ -4607,13 +4636,13 @@ CSSDeclarationImpl::Count(PRUint32* aCount) } NS_IMETHODIMP -CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) +CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) { - aReturn.SetLength(0); + aReturn.Truncate(); if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aReturn.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); } } diff --git a/layout/html/style/src/nsCSSParser.cpp b/layout/html/style/src/nsCSSParser.cpp index d8c4e957cf1c..4d5936ae3167 100644 --- a/layout/html/style/src/nsCSSParser.cpp +++ b/layout/html/style/src/nsCSSParser.cpp @@ -142,19 +142,19 @@ public: nsIURI* aInputURL, nsICSSStyleSheet*& aResult); - NS_IMETHOD ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult); + NS_IMETHOD ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult); - NS_IMETHOD ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint); + NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint); - NS_IMETHOD GetCharset(/*out*/nsString &aCharsetDest) const; + NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const; // sets the out-param to the current charset, as set by SetCharset - NS_IMETHOD SetCharset(/*in*/ const nsString &aCharsetSrc); + NS_IMETHOD SetCharset(/*in*/ const nsAReadableString &aCharsetSrc); // NOTE: SetCharset expects the charset to be the preferred charset // and it just records the string exactly as passed in (no alias resolution) @@ -517,9 +517,9 @@ CSSParserImpl::Parse(nsIUnicharInputStream* aInput, } NS_IMETHODIMP -CSSParserImpl::ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult) +CSSParserImpl::ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult) { NS_ASSERTION(nsnull != aBaseURL, "need base URL"); @@ -562,11 +562,11 @@ CSSParserImpl::ParseDeclarations(const nsString& aDeclaration, } NS_IMETHODIMP -CSSParserImpl::ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint) +CSSParserImpl::ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint) { // NS_ASSERTION(nsnull != aBaseURL, "need base URL"); @@ -4354,13 +4354,13 @@ PRBool CSSParserImpl::ParseTextShadow(PRInt32& aErrorCode, return PR_FALSE; } -NS_IMETHODIMP CSSParserImpl::GetCharset(/*out*/nsString &aCharsetDest) const +NS_IMETHODIMP CSSParserImpl::GetCharset(/*out*/nsAWritableString &aCharsetDest) const { aCharsetDest = mCharset; return NS_OK; } -NS_IMETHODIMP CSSParserImpl::SetCharset(/*in*/ const nsString &aCharsetSrc) +NS_IMETHODIMP CSSParserImpl::SetCharset(/*in*/ const nsAReadableString &aCharsetSrc) { mCharset = aCharsetSrc; return NS_OK; diff --git a/layout/html/style/src/nsCSSProps.cpp b/layout/html/style/src/nsCSSProps.cpp index 8b4c3180d963..cbff90538574 100644 --- a/layout/html/style/src/nsCSSProps.cpp +++ b/layout/html/style/src/nsCSSProps.cpp @@ -86,13 +86,9 @@ nsCSSProps::LookupProperty(const nsCString& aProperty) } nsCSSProperty -nsCSSProps::LookupProperty(const nsString& aProperty) -{ - NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); - if (gPropertyTable) { - return nsCSSProperty(gPropertyTable->Lookup(aProperty)); - } - return eCSSProperty_UNKNOWN; +nsCSSProps::LookupProperty(const nsAReadableString& aProperty) { + nsCAutoString theProp; theProp.AssignWithConversion(aProperty); + return LookupProperty(theProp); } const nsCString& diff --git a/layout/html/style/src/nsCSSProps.h b/layout/html/style/src/nsCSSProps.h index 316d3506d38b..4456b7bb82f5 100644 --- a/layout/html/style/src/nsCSSProps.h +++ b/layout/html/style/src/nsCSSProps.h @@ -23,9 +23,7 @@ #define nsCSSProps_h___ #include "nslayout.h" - -class nsCString; -class nsString; +#include "nsString.h" /* Declare the enum list using the magic of preprocessing @@ -49,7 +47,7 @@ public: static void ReleaseTable(void); // Given a property string, return the enum value - static nsCSSProperty LookupProperty(const nsString& aProperty); + static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); static nsCSSProperty LookupProperty(const nsCString& aProperty); // Given a property enum, get the string value diff --git a/layout/html/style/src/nsCSSStyleRule.cpp b/layout/html/style/src/nsCSSStyleRule.cpp index c4308979ab61..45dfc60e2565 100644 --- a/layout/html/style/src/nsCSSStyleRule.cpp +++ b/layout/html/style/src/nsCSSStyleRule.cpp @@ -793,14 +793,14 @@ public: DOMCSSDeclarationImpl(nsICSSStyleRule *aRule); ~DOMCSSDeclarationImpl(void); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); virtual void DropReference(void); virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl, PRBool aAllocate); virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl); - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl); virtual nsresult GetParent(nsISupports **aParent); @@ -826,8 +826,8 @@ DOMCSSDeclarationImpl::~DOMCSSDeclarationImpl(void) } NS_IMETHODIMP -DOMCSSDeclarationImpl::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +DOMCSSDeclarationImpl::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { aReturn.Truncate(); @@ -885,7 +885,7 @@ DOMCSSDeclarationImpl::SetCSSDeclaration(nsICSSDeclaration *aDecl) } nsresult -DOMCSSDeclarationImpl::ParseDeclaration(const nsString& aDecl, +DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) { @@ -3335,15 +3335,15 @@ CSSStyleRuleImpl::GetType(PRUint16* aType) } NS_IMETHODIMP -CSSStyleRuleImpl::GetCssText(nsString& aCssText) +CSSStyleRuleImpl::GetCssText(nsAWritableString& aCssText) { - aCssText = mSelectorText; + aCssText.Assign(mSelectorText); // XXX TBI append declaration too return NS_OK; } NS_IMETHODIMP -CSSStyleRuleImpl::SetCssText(const nsString& aCssText) +CSSStyleRuleImpl::SetCssText(const nsAReadableString& aCssText) { // XXX TBI - need to re-parse rule & declaration return NS_OK; @@ -3366,14 +3366,14 @@ CSSStyleRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule) } NS_IMETHODIMP -CSSStyleRuleImpl::GetSelectorText(nsString& aSelectorText) +CSSStyleRuleImpl::GetSelectorText(nsAWritableString& aSelectorText) { - aSelectorText = mSelectorText; + aSelectorText.Assign(mSelectorText); return NS_OK; } NS_IMETHODIMP -CSSStyleRuleImpl::SetSelectorText(const nsString& aSelectorText) +CSSStyleRuleImpl::SetSelectorText(const nsAReadableString& aSelectorText) { // XXX TBI - get a parser and re-parse the selectors, // XXX then need to re-compute the cascade diff --git a/layout/html/style/src/nsCSSStyleSheet.cpp b/layout/html/style/src/nsCSSStyleSheet.cpp index f06ad1af8249..2f0d70b0b1ca 100644 --- a/layout/html/style/src/nsCSSStyleSheet.cpp +++ b/layout/html/style/src/nsCSSStyleSheet.cpp @@ -793,7 +793,7 @@ DOMMediaListImpl::SetScriptObject(void* aScriptObject) } NS_IMETHODIMP -DOMMediaListImpl::GetMediaText(nsString& aMediaText) +DOMMediaListImpl::GetMediaText(nsAWritableString& aMediaText) { aMediaText.Truncate(); @@ -814,7 +814,7 @@ DOMMediaListImpl::GetMediaText(nsString& aMediaText) medium->GetUnicode(&buffer); aMediaText.Append(buffer); if (index < count) { - aMediaText.AppendWithConversion(", "); + aMediaText.Append(NS_LITERAL_STRING(", ")); } } @@ -822,7 +822,7 @@ DOMMediaListImpl::GetMediaText(nsString& aMediaText) } NS_IMETHODIMP -DOMMediaListImpl::SetMediaText(const nsString& aMediaText) +DOMMediaListImpl::SetMediaText(const nsAReadableString& aMediaText) { nsresult rv = Clear(); NS_ENSURE_SUCCESS(rv, rv); @@ -869,7 +869,7 @@ DOMMediaListImpl::GetLength(PRUint32* aLength) } NS_IMETHODIMP -DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn) +DOMMediaListImpl::Item(PRUint32 aIndex, nsAWritableString& aReturn) { nsCOMPtr tmp(dont_AddRef(ElementAt(aIndex))); @@ -888,7 +888,7 @@ DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn) } NS_IMETHODIMP -DOMMediaListImpl::Delete(const nsString& aOldMedium) +DOMMediaListImpl::Delete(const nsAReadableString& aOldMedium) { if (!aOldMedium.Length()) return NS_ERROR_DOM_NOT_FOUND_ERR; @@ -908,7 +908,7 @@ DOMMediaListImpl::Delete(const nsString& aOldMedium) } NS_IMETHODIMP -DOMMediaListImpl::Append(const nsString& aNewMedium) +DOMMediaListImpl::Append(const nsAReadableString& aNewMedium) { if (!aNewMedium.Length()) return NS_ERROR_DOM_NOT_FOUND_ERR; @@ -2302,9 +2302,9 @@ CSSStyleSheetImpl::SetModified(PRBool aModified) // nsIDOMStyleSheet interface NS_IMETHODIMP -CSSStyleSheetImpl::GetType(nsString& aType) +CSSStyleSheetImpl::GetType(nsAWritableString& aType) { - aType.AssignWithConversion("text/css"); + aType.Assign(NS_LITERAL_STRING("text/css")); return NS_OK; } @@ -2354,12 +2354,12 @@ CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) } NS_IMETHODIMP -CSSStyleSheetImpl::GetHref(nsString& aHref) +CSSStyleSheetImpl::GetHref(nsAWritableString& aHref) { if (mInner && mInner->mURL) { char* str = nsnull; mInner->mURL->GetSpec(&str); - aHref.AssignWithConversion(str); + aHref.Assign(NS_ConvertASCIItoUCS2(str)); if (str) { nsCRT::free(str); } @@ -2379,9 +2379,9 @@ CSSStyleSheetImpl::GetTitle(nsString& aTitle) const } NS_IMETHODIMP -CSSStyleSheetImpl::GetTitle(nsString& aTitle) +CSSStyleSheetImpl::GetTitle(nsAWritableString& aTitle) { - aTitle = mTitle; + aTitle.Assign(mTitle); return NS_OK; } @@ -2436,7 +2436,7 @@ CSSStyleSheetImpl::GetCssRules(nsIDOMCSSRuleList** aCssRules) } NS_IMETHODIMP -CSSStyleSheetImpl::InsertRule(const nsString& aRule, +CSSStyleSheetImpl::InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn) { diff --git a/layout/html/style/src/nsCSSValue.cpp b/layout/html/style/src/nsCSSValue.cpp index 9c7f317d1e8c..0ddd9b70e290 100644 --- a/layout/html/style/src/nsCSSValue.cpp +++ b/layout/html/style/src/nsCSSValue.cpp @@ -23,6 +23,7 @@ #include "nsString.h" #include "nsCSSProps.h" #include "nsUnitConversion.h" +#include "nsReadableUtils.h" //#include "nsStyleConsts.h" @@ -65,12 +66,12 @@ nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit) } } -nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit) +nsCSSValue::nsCSSValue(const nsAReadableString& aValue, nsCSSUnit aUnit) : mUnit(aUnit) { NS_ASSERTION((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters), "not a string value"); if ((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters)) { - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } else { mUnit = eCSSUnit_Null; @@ -235,13 +236,14 @@ void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit) } } -void nsCSSValue::SetStringValue(const nsString& aValue, nsCSSUnit aUnit) +void nsCSSValue::SetStringValue(const nsAReadableString& aValue, + nsCSSUnit aUnit) { NS_ASSERTION((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters), "not a string unit"); Reset(); if ((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters)) { mUnit = aUnit; - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } } @@ -276,103 +278,132 @@ void nsCSSValue::SetNormalValue(void) mUnit = eCSSUnit_Normal; } -void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const +void nsCSSValue::AppendToString(nsAWritableString& aBuffer, + nsCSSProperty aPropID) const { if (eCSSUnit_Null == mUnit) { return; } if (-1 < aPropID) { - aBuffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); - aBuffer.AppendWithConversion(": "); + aBuffer.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(aPropID))); + aBuffer.Append(NS_LITERAL_STRING(": ")); } if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) { switch (mUnit) { - case eCSSUnit_URL: aBuffer.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aBuffer.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aBuffer.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aBuffer.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aBuffer.Append(NS_LITERAL_STRING("url(")); break; + case eCSSUnit_Attr: aBuffer.Append(NS_LITERAL_STRING("attr(")); break; + case eCSSUnit_Counter: aBuffer.Append(NS_LITERAL_STRING("counter(")); break; + case eCSSUnit_Counters: aBuffer.Append(NS_LITERAL_STRING("counters(")); break; default: break; } if (nsnull != mValue.mString) { - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); aBuffer.Append(mValue.mString); - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); } else { - aBuffer.AppendWithConversion("null str"); + aBuffer.Append(NS_LITERAL_STRING("null str")); } } else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); + nsAutoString intStr; + intStr.AppendInt(mValue.mInt, 10); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING("[0x")); + + intStr.Truncate(); + intStr.AppendInt(mValue.mInt, 16); + aBuffer.Append(intStr); + + aBuffer.Append(PRUnichar(']')); } else if (eCSSUnit_Color == mUnit){ - aBuffer.AppendWithConversion("(0x"); - aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); - aBuffer.AppendWithConversion(')'); + aBuffer.Append(NS_LITERAL_STRING("(0x")); + + nsAutoString intStr; + intStr.AppendInt(NS_GET_R(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_G(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_B(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_A(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == mUnit) { - aBuffer.AppendFloat(mValue.mFloat * 100.0f); + nsAutoString floatString; + floatString.AppendFloat(mValue.mFloat * 100.0f); + aBuffer.Append(floatString); } else if (eCSSUnit_Percent < mUnit) { - aBuffer.AppendFloat(mValue.mFloat); + nsAutoString floatString; + floatString.AppendFloat(mValue.mFloat); + aBuffer.Append(floatString); } switch (mUnit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aBuffer.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aBuffer.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aBuffer.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aBuffer.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aBuffer.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aBuffer.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aBuffer.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aBuffer.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aBuffer.AppendWithConversion(')'); break; - case eCSSUnit_Integer: aBuffer.AppendWithConversion("int"); break; - case eCSSUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eCSSUnit_Color: aBuffer.AppendWithConversion("rbga"); break; - case eCSSUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eCSSUnit_Number: aBuffer.AppendWithConversion("#"); break; - case eCSSUnit_Inch: aBuffer.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aBuffer.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aBuffer.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aBuffer.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aBuffer.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aBuffer.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aBuffer.AppendWithConversion("km"); break; - case eCSSUnit_Point: aBuffer.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aBuffer.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aBuffer.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aBuffer.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aBuffer.AppendWithConversion("em"); break; - case eCSSUnit_EN: aBuffer.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aBuffer.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aBuffer.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aBuffer.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aBuffer.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aBuffer.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aBuffer.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aBuffer.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aBuffer.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aBuffer.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aBuffer.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aBuffer.AppendWithConversion("ms"); break; + case eCSSUnit_Counters: aBuffer.Append(NS_LITERAL_STRING(")")); break; + case eCSSUnit_Integer: aBuffer.Append(NS_LITERAL_STRING("int")); break; + case eCSSUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; + case eCSSUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; + case eCSSUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; + case eCSSUnit_Number: aBuffer.Append(NS_LITERAL_STRING("#")); break; + case eCSSUnit_Inch: aBuffer.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aBuffer.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aBuffer.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aBuffer.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aBuffer.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aBuffer.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aBuffer.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aBuffer.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aBuffer.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aBuffer.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aBuffer.Append(NS_LITERAL_STRING("cc")); break; + case eCSSUnit_EM: aBuffer.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aBuffer.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aBuffer.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aBuffer.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aBuffer.Append(NS_LITERAL_STRING("ch")); break; + case eCSSUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; + case eCSSUnit_Degree: aBuffer.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aBuffer.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aBuffer.Append(NS_LITERAL_STRING("rad")); break; + case eCSSUnit_Hertz: aBuffer.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aBuffer.Append(NS_LITERAL_STRING("kHz")); break; + case eCSSUnit_Seconds: aBuffer.Append(NS_LITERAL_STRING("s")); break; + case eCSSUnit_Milliseconds: aBuffer.Append(NS_LITERAL_STRING("ms")); break; } - aBuffer.AppendWithConversion(' '); + aBuffer.Append(NS_LITERAL_STRING(" ")); } -void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const +void nsCSSValue::ToString(nsAWritableString& aBuffer, + nsCSSProperty aPropID) const { aBuffer.Truncate(); AppendToString(aBuffer, aPropID); diff --git a/layout/html/style/src/nsCSSValue.h b/layout/html/style/src/nsCSSValue.h index 70f11fe34f08..0079fc41bcf9 100644 --- a/layout/html/style/src/nsCSSValue.h +++ b/layout/html/style/src/nsCSSValue.h @@ -96,7 +96,7 @@ public: nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null); // for valueless units only (null, auto, inherit, none, normal) nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit); nsCSSValue(float aValue, nsCSSUnit aUnit); - nsCSSValue(const nsString& aValue, nsCSSUnit aUnit); + nsCSSValue(const nsAReadableString& aValue, nsCSSUnit aUnit); nsCSSValue(nscolor aValue); nsCSSValue(const nsCSSValue& aCopy); ~nsCSSValue(void); @@ -122,7 +122,7 @@ public: PRInt32 GetIntValue(void) const; float GetPercentValue(void) const; float GetFloatValue(void) const; - nsString& GetStringValue(nsString& aBuffer) const; + nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; nscolor GetColorValue(void) const; nscoord GetLengthTwips(void) const; @@ -130,7 +130,7 @@ public: void SetIntValue(PRInt32 aValue, nsCSSUnit aUnit); void SetPercentValue(float aValue); void SetFloatValue(float aValue, nsCSSUnit aUnit); - void SetStringValue(const nsString& aValue, nsCSSUnit aUnit); + void SetStringValue(const nsAReadableString& aValue, nsCSSUnit aUnit); void SetColorValue(nscolor aValue); void SetAutoValue(void); void SetInheritValue(void); @@ -138,8 +138,8 @@ public: void SetNormalValue(void); // debugging methods only - void AppendToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; - void ToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; + void AppendToString(nsAWritableString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; + void ToString(nsAWritableString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; protected: nsCSSUnit mUnit; @@ -180,7 +180,7 @@ inline float nsCSSValue::GetFloatValue(void) const return 0.0f; } -inline nsString& nsCSSValue::GetStringValue(nsString& aBuffer) const +inline nsAWritableString& nsCSSValue::GetStringValue(nsAWritableString& aBuffer) const { NS_ASSERTION((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters), "not a string value"); aBuffer.Truncate(); diff --git a/layout/html/style/src/nsComputedDOMStyle.cpp b/layout/html/style/src/nsComputedDOMStyle.cpp index 1377424eb13a..102170bf8b34 100644 --- a/layout/html/style/src/nsComputedDOMStyle.cpp +++ b/layout/html/style/src/nsComputedDOMStyle.cpp @@ -50,7 +50,7 @@ public: NS_DECL_ISUPPORTS // nsIComputedDOMStyle - NS_IMETHOD Init(nsIDOMElement *aElement, const nsString& aPseudoElt, + NS_IMETHOD Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell); // nsIDOMCSSStyleDeclaration @@ -155,7 +155,7 @@ nsComputedDOMStyle::SetScriptObject(void* aScriptObject) NS_IMETHODIMP -nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsString& aPseudoElt, +nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell) { NS_ENSURE_ARG_POINTER(aElement); @@ -181,7 +181,7 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsString& aPseudoElt, } NS_IMETHODIMP -nsComputedDOMStyle::GetCssText(nsString& aCssText) +nsComputedDOMStyle::GetCssText(nsAWritableString& aCssText) { aCssText.Truncate(); return NS_OK; @@ -189,7 +189,7 @@ nsComputedDOMStyle::GetCssText(nsString& aCssText) NS_IMETHODIMP -nsComputedDOMStyle::SetCssText(const nsString& aCssText) +nsComputedDOMStyle::SetCssText(const nsAReadableString& aCssText) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -215,8 +215,8 @@ nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule) NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCOMPtr val; @@ -234,7 +234,7 @@ nsComputedDOMStyle::GetPropertyValue(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, +nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -246,6 +246,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, nsCOMPtr val; nsresult rv = NS_OK; + // XXX FIX THIS!!! nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName); switch (prop) { @@ -278,16 +279,16 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { aReturn.Truncate(); return NS_OK; @@ -295,16 +296,16 @@ nsComputedDOMStyle::GetPropertyPriority(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::SetProperty(const nsString& aPropertyName, - const nsString& aValue, - const nsString& aPriority) +nsComputedDOMStyle::SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, + const nsAReadableString& aPriority) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::Item(PRUint32 aIndex, nsString& aReturn) +nsComputedDOMStyle::Item(PRUint32 aIndex, nsAWritableString& aReturn) { aReturn.Truncate(); return NS_OK; @@ -316,43 +317,43 @@ nsComputedDOMStyle::Item(PRUint32 aIndex, nsString& aReturn) #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetAzimuth(nsString& aAzimuth) +nsComputedDOMStyle::GetAzimuth(nsAWritableString& aAzimuth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackground(nsString& aBackground) +nsComputedDOMStyle::GetBackground(nsAWritableString& aBackground) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundAttachment(nsString& aBackgroundAttachment) +nsComputedDOMStyle::GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundColor(nsString& aBackgroundColor) +nsComputedDOMStyle::GetBackgroundColor(nsAWritableString& aBackgroundColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundImage(nsString& aBackgroundImage) +nsComputedDOMStyle::GetBackgroundImage(nsAWritableString& aBackgroundImage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundPosition(nsString& aBackgroundPosition) +nsComputedDOMStyle::GetBackgroundPosition(nsAWritableString& aBackgroundPosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundRepeat(nsString& aBackgroundRepeat) +nsComputedDOMStyle::GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -400,133 +401,133 @@ nsComputedDOMStyle::GetBehavior(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetBorder(nsString& aBorder) +nsComputedDOMStyle::GetBorder(nsAWritableString& aBorder) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderCollapse(nsString& aBorderCollapse) +nsComputedDOMStyle::GetBorderCollapse(nsAWritableString& aBorderCollapse) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderColor(nsString& aBorderColor) +nsComputedDOMStyle::GetBorderColor(nsAWritableString& aBorderColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderSpacing(nsString& aBorderSpacing) +nsComputedDOMStyle::GetBorderSpacing(nsAWritableString& aBorderSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderStyle(nsString& aBorderStyle) +nsComputedDOMStyle::GetBorderStyle(nsAWritableString& aBorderStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTop(nsString& aBorderTop) +nsComputedDOMStyle::GetBorderTop(nsAWritableString& aBorderTop) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRight(nsString& aBorderRight) +nsComputedDOMStyle::GetBorderRight(nsAWritableString& aBorderRight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottom(nsString& aBorderBottom) +nsComputedDOMStyle::GetBorderBottom(nsAWritableString& aBorderBottom) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeft(nsString& aBorderLeft) +nsComputedDOMStyle::GetBorderLeft(nsAWritableString& aBorderLeft) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopColor(nsString& aBorderTopColor) +nsComputedDOMStyle::GetBorderTopColor(nsAWritableString& aBorderTopColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightColor(nsString& aBorderRightColor) +nsComputedDOMStyle::GetBorderRightColor(nsAWritableString& aBorderRightColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomColor(nsString& aBorderBottomColor) +nsComputedDOMStyle::GetBorderBottomColor(nsAWritableString& aBorderBottomColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftColor(nsString& aBorderLeftColor) +nsComputedDOMStyle::GetBorderLeftColor(nsAWritableString& aBorderLeftColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopStyle(nsString& aBorderTopStyle) +nsComputedDOMStyle::GetBorderTopStyle(nsAWritableString& aBorderTopStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightStyle(nsString& aBorderRightStyle) +nsComputedDOMStyle::GetBorderRightStyle(nsAWritableString& aBorderRightStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomStyle(nsString& aBorderBottomStyle) +nsComputedDOMStyle::GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftStyle(nsString& aBorderLeftStyle) +nsComputedDOMStyle::GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopWidth(nsString& aBorderTopWidth) +nsComputedDOMStyle::GetBorderTopWidth(nsAWritableString& aBorderTopWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightWidth(nsString& aBorderRightWidth) +nsComputedDOMStyle::GetBorderRightWidth(nsAWritableString& aBorderRightWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomWidth(nsString& aBorderBottomWidth) +nsComputedDOMStyle::GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftWidth(nsString& aBorderLeftWidth) +nsComputedDOMStyle::GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderWidth(nsString& aBorderWidth) +nsComputedDOMStyle::GetBorderWidth(nsAWritableString& aBorderWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -552,79 +553,79 @@ nsComputedDOMStyle::GetBottom(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetCaptionSide(nsString& aCaptionSide) +nsComputedDOMStyle::GetCaptionSide(nsAWritableString& aCaptionSide) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetClear(nsString& aClear) +nsComputedDOMStyle::GetClear(nsAWritableString& aClear) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetClip(nsString& aClip) +nsComputedDOMStyle::GetClip(nsAWritableString& aClip) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetColor(nsString& aColor) +nsComputedDOMStyle::GetColor(nsAWritableString& aColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetContent(nsString& aContent) +nsComputedDOMStyle::GetContent(nsAWritableString& aContent) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCounterIncrement(nsString& aCounterIncrement) +nsComputedDOMStyle::GetCounterIncrement(nsAWritableString& aCounterIncrement) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCounterReset(nsString& aCounterReset) +nsComputedDOMStyle::GetCounterReset(nsAWritableString& aCounterReset) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCssFloat(nsString& aCssFloat) +nsComputedDOMStyle::GetCssFloat(nsAWritableString& aCssFloat) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCue(nsString& aCue) +nsComputedDOMStyle::GetCue(nsAWritableString& aCue) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCueAfter(nsString& aCueAfter) +nsComputedDOMStyle::GetCueAfter(nsAWritableString& aCueAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCueBefore(nsString& aCueBefore) +nsComputedDOMStyle::GetCueBefore(nsAWritableString& aCueBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCursor(nsString& aCursor) +nsComputedDOMStyle::GetCursor(nsAWritableString& aCursor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetDirection(nsString& aDirection) +nsComputedDOMStyle::GetDirection(nsAWritableString& aDirection) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -700,61 +701,61 @@ nsComputedDOMStyle::GetDisplay(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetElevation(nsString& aElevation) +nsComputedDOMStyle::GetElevation(nsAWritableString& aElevation) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetEmptyCells(nsString& aEmptyCells) +nsComputedDOMStyle::GetEmptyCells(nsAWritableString& aEmptyCells) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFont(nsString& aFont) +nsComputedDOMStyle::GetFont(nsAWritableString& aFont) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontFamily(nsString& aFontFamily) +nsComputedDOMStyle::GetFontFamily(nsAWritableString& aFontFamily) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontSize(nsString& aFontSize) +nsComputedDOMStyle::GetFontSize(nsAWritableString& aFontSize) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontSizeAdjust(nsString& aFontSizeAdjust) +nsComputedDOMStyle::GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontStretch(nsString& aFontStretch) +nsComputedDOMStyle::GetFontStretch(nsAWritableString& aFontStretch) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontStyle(nsString& aFontStyle) +nsComputedDOMStyle::GetFontStyle(nsAWritableString& aFontStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontVariant(nsString& aFontVariant) +nsComputedDOMStyle::GetFontVariant(nsAWritableString& aFontVariant) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontWeight(nsString& aFontWeight) +nsComputedDOMStyle::GetFontWeight(nsAWritableString& aFontWeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -799,43 +800,43 @@ nsComputedDOMStyle::GetLeft(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetLetterSpacing(nsString& aLetterSpacing) +nsComputedDOMStyle::GetLetterSpacing(nsAWritableString& aLetterSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetLineHeight(nsString& aLineHeight) +nsComputedDOMStyle::GetLineHeight(nsAWritableString& aLineHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyle(nsString& aListStyle) +nsComputedDOMStyle::GetListStyle(nsAWritableString& aListStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyleImage(nsString& aListStyleImage) +nsComputedDOMStyle::GetListStyleImage(nsAWritableString& aListStyleImage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStylePosition(nsString& aListStylePosition) +nsComputedDOMStyle::GetListStylePosition(nsAWritableString& aListStylePosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyleType(nsString& aListStyleType) +nsComputedDOMStyle::GetListStyleType(nsAWritableString& aListStyleType) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMargin(nsString& aMargin) +nsComputedDOMStyle::GetMargin(nsAWritableString& aMargin) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -885,181 +886,181 @@ nsComputedDOMStyle::GetMarginLeft(nsIFrame *aFrame, } NS_IMETHODIMP -nsComputedDOMStyle::GetMarkerOffset(nsString& aMarkerOffset) +nsComputedDOMStyle::GetMarkerOffset(nsAWritableString& aMarkerOffset) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMarks(nsString& aMarks) +nsComputedDOMStyle::GetMarks(nsAWritableString& aMarks) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMaxHeight(nsString& aMaxHeight) +nsComputedDOMStyle::GetMaxHeight(nsAWritableString& aMaxHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMaxWidth(nsString& aMaxWidth) +nsComputedDOMStyle::GetMaxWidth(nsAWritableString& aMaxWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMinHeight(nsString& aMinHeight) +nsComputedDOMStyle::GetMinHeight(nsAWritableString& aMinHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMinWidth(nsString& aMinWidth) +nsComputedDOMStyle::GetMinWidth(nsAWritableString& aMinWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOrphans(nsString& aOrphans) +nsComputedDOMStyle::GetOrphans(nsAWritableString& aOrphans) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutline(nsString& aOutline) +nsComputedDOMStyle::GetOutline(nsAWritableString& aOutline) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineColor(nsString& aOutlineColor) +nsComputedDOMStyle::GetOutlineColor(nsAWritableString& aOutlineColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineStyle(nsString& aOutlineStyle) +nsComputedDOMStyle::GetOutlineStyle(nsAWritableString& aOutlineStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineWidth(nsString& aOutlineWidth) +nsComputedDOMStyle::GetOutlineWidth(nsAWritableString& aOutlineWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOverflow(nsString& aOverflow) +nsComputedDOMStyle::GetOverflow(nsAWritableString& aOverflow) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPadding(nsString& aPadding) +nsComputedDOMStyle::GetPadding(nsAWritableString& aPadding) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingTop(nsString& aPaddingTop) +nsComputedDOMStyle::GetPaddingTop(nsAWritableString& aPaddingTop) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingRight(nsString& aPaddingRight) +nsComputedDOMStyle::GetPaddingRight(nsAWritableString& aPaddingRight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingBottom(nsString& aPaddingBottom) +nsComputedDOMStyle::GetPaddingBottom(nsAWritableString& aPaddingBottom) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingLeft(nsString& aPaddingLeft) +nsComputedDOMStyle::GetPaddingLeft(nsAWritableString& aPaddingLeft) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPage(nsString& aPage) +nsComputedDOMStyle::GetPage(nsAWritableString& aPage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakAfter(nsString& aPageBreakAfter) +nsComputedDOMStyle::GetPageBreakAfter(nsAWritableString& aPageBreakAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakBefore(nsString& aPageBreakBefore) +nsComputedDOMStyle::GetPageBreakBefore(nsAWritableString& aPageBreakBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakInside(nsString& aPageBreakInside) +nsComputedDOMStyle::GetPageBreakInside(nsAWritableString& aPageBreakInside) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPause(nsString& aPause) +nsComputedDOMStyle::GetPause(nsAWritableString& aPause) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPauseAfter(nsString& aPauseAfter) +nsComputedDOMStyle::GetPauseAfter(nsAWritableString& aPauseAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPauseBefore(nsString& aPauseBefore) +nsComputedDOMStyle::GetPauseBefore(nsAWritableString& aPauseBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPitch(nsString& aPitch) +nsComputedDOMStyle::GetPitch(nsAWritableString& aPitch) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPitchRange(nsString& aPitchRange) +nsComputedDOMStyle::GetPitchRange(nsAWritableString& aPitchRange) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPlayDuring(nsString& aPlayDuring) +nsComputedDOMStyle::GetPlayDuring(nsAWritableString& aPlayDuring) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPosition(nsString& aPosition) +nsComputedDOMStyle::GetPosition(nsAWritableString& aPosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetQuotes(nsString& aQuotes) +nsComputedDOMStyle::GetQuotes(nsAWritableString& aQuotes) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetRichness(nsString& aRichness) +nsComputedDOMStyle::GetRichness(nsAWritableString& aRichness) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1085,79 +1086,79 @@ nsComputedDOMStyle::GetRight(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetSize(nsString& aSize) +nsComputedDOMStyle::GetSize(nsAWritableString& aSize) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeak(nsString& aSpeak) +nsComputedDOMStyle::GetSpeak(nsAWritableString& aSpeak) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakHeader(nsString& aSpeakHeader) +nsComputedDOMStyle::GetSpeakHeader(nsAWritableString& aSpeakHeader) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakNumeral(nsString& aSpeakNumeral) +nsComputedDOMStyle::GetSpeakNumeral(nsAWritableString& aSpeakNumeral) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakPunctuation(nsString& aSpeakPunctuation) +nsComputedDOMStyle::GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeechRate(nsString& aSpeechRate) +nsComputedDOMStyle::GetSpeechRate(nsAWritableString& aSpeechRate) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetStress(nsString& aStress) +nsComputedDOMStyle::GetStress(nsAWritableString& aStress) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTableLayout(nsString& aTableLayout) +nsComputedDOMStyle::GetTableLayout(nsAWritableString& aTableLayout) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextAlign(nsString& aTextAlign) +nsComputedDOMStyle::GetTextAlign(nsAWritableString& aTextAlign) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextDecoration(nsString& aTextDecoration) +nsComputedDOMStyle::GetTextDecoration(nsAWritableString& aTextDecoration) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextIndent(nsString& aTextIndent) +nsComputedDOMStyle::GetTextIndent(nsAWritableString& aTextIndent) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextShadow(nsString& aTextShadow) +nsComputedDOMStyle::GetTextShadow(nsAWritableString& aTextShadow) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextTransform(nsString& aTextTransform) +nsComputedDOMStyle::GetTextTransform(nsAWritableString& aTextTransform) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1183,43 +1184,43 @@ nsComputedDOMStyle::GetTop(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetUnicodeBidi(nsString& aUnicodeBidi) +nsComputedDOMStyle::GetUnicodeBidi(nsAWritableString& aUnicodeBidi) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVerticalAlign(nsString& aVerticalAlign) +nsComputedDOMStyle::GetVerticalAlign(nsAWritableString& aVerticalAlign) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVisibility(nsString& aVisibility) +nsComputedDOMStyle::GetVisibility(nsAWritableString& aVisibility) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVoiceFamily(nsString& aVoiceFamily) +nsComputedDOMStyle::GetVoiceFamily(nsAWritableString& aVoiceFamily) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVolume(nsString& aVolume) +nsComputedDOMStyle::GetVolume(nsAWritableString& aVolume) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetWhiteSpace(nsString& aWhiteSpace) +nsComputedDOMStyle::GetWhiteSpace(nsAWritableString& aWhiteSpace) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetWidows(nsString& aWidows) +nsComputedDOMStyle::GetWidows(nsAWritableString& aWidows) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1322,19 +1323,19 @@ nsComputedDOMStyle::GetWidth(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetWordSpacing(nsString& aWordSpacing) +nsComputedDOMStyle::GetWordSpacing(nsAWritableString& aWordSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetZIndex(nsString& aZIndex) +nsComputedDOMStyle::GetZIndex(nsAWritableString& aZIndex) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOpacity(nsString& aOpacity) +nsComputedDOMStyle::GetOpacity(nsAWritableString& aOpacity) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } diff --git a/layout/html/style/src/nsDOMCSSDeclaration.cpp b/layout/html/style/src/nsDOMCSSDeclaration.cpp index 702fde9fb2b9..d51295653546 100644 --- a/layout/html/style/src/nsDOMCSSDeclaration.cpp +++ b/layout/html/style/src/nsDOMCSSDeclaration.cpp @@ -115,7 +115,7 @@ nsDOMCSSDeclaration::SetScriptObject(void* aScriptObject) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCssText(nsString& aCssText) +nsDOMCSSDeclaration::GetCssText(nsAWritableString& aCssText) { aCssText.Truncate(); // XXX TBI @@ -123,7 +123,7 @@ nsDOMCSSDeclaration::GetCssText(nsString& aCssText) } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCssText(const nsString& aCssText) +nsDOMCSSDeclaration::SetCssText(const nsAReadableString& aCssText) { // XXX TBI return NS_OK; @@ -162,7 +162,7 @@ nsDOMCSSDeclaration::GetParentRule(nsIDOMCSSRule** aParentRule) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyCSSValue(const nsString& aPropertyName, +nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -174,7 +174,7 @@ nsDOMCSSDeclaration::GetPropertyCSSValue(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsString& aReturn) +nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsAWritableString& aReturn) { nsICSSDeclaration *decl; nsresult result = GetCSSDeclaration(&decl, PR_FALSE); @@ -189,8 +189,8 @@ nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsString& aReturn) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSDeclaration::GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCSSValue val; nsICSSDeclaration *decl; @@ -206,8 +206,8 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSDeclaration::GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsICSSDeclaration *decl; nsresult result = GetCSSDeclaration(&decl, PR_FALSE); @@ -219,7 +219,7 @@ nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, } if ((NS_OK == result) && isImportant) { - aReturn.AssignWithConversion("!important"); + aReturn.Assign(NS_LITERAL_STRING("!important")); } else { aReturn.SetLength(0); @@ -229,9 +229,9 @@ nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, - const nsString& aValue, - const nsString& aPriority) +nsDOMCSSDeclaration::SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, + const nsAReadableString& aPriority) { if (!aValue.Length()) { // If the new value of the property is an empty string we remove the @@ -243,7 +243,7 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, nsAutoString declString; declString.Assign(aPropertyName); - declString.AppendWithConversion(":"); + declString.Append(PRUnichar(':')); declString.Append(aValue); declString.Append(aPriority); @@ -251,1490 +251,1490 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::GetAzimuth(nsString& aAzimuth) +nsDOMCSSDeclaration::GetAzimuth(nsAWritableString& aAzimuth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("azimuth"), aAzimuth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetAzimuth(const nsString& aAzimuth) +nsDOMCSSDeclaration::SetAzimuth(const nsAReadableString& aAzimuth) { return SetProperty(NS_ConvertASCIItoUCS2("azimuth"), aAzimuth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackground(nsString& aBackground) +nsDOMCSSDeclaration::GetBackground(nsAWritableString& aBackground) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background"), aBackground); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackground(const nsString& aBackground) +nsDOMCSSDeclaration::SetBackground(const nsAReadableString& aBackground) { return SetProperty(NS_ConvertASCIItoUCS2("background"), aBackground, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundAttachment(nsString& aBackgroundAttachment) +nsDOMCSSDeclaration::GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-attachment"), aBackgroundAttachment); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundAttachment(const nsString& aBackgroundAttachment) +nsDOMCSSDeclaration::SetBackgroundAttachment(const nsAReadableString& aBackgroundAttachment) { return SetProperty(NS_ConvertASCIItoUCS2("background-attachment"), aBackgroundAttachment, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundColor(nsString& aBackgroundColor) +nsDOMCSSDeclaration::GetBackgroundColor(nsAWritableString& aBackgroundColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-color"), aBackgroundColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundColor(const nsString& aBackgroundColor) +nsDOMCSSDeclaration::SetBackgroundColor(const nsAReadableString& aBackgroundColor) { return SetProperty(NS_ConvertASCIItoUCS2("background-color"), aBackgroundColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundImage(nsString& aBackgroundImage) +nsDOMCSSDeclaration::GetBackgroundImage(nsAWritableString& aBackgroundImage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-image"), aBackgroundImage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundImage(const nsString& aBackgroundImage) +nsDOMCSSDeclaration::SetBackgroundImage(const nsAReadableString& aBackgroundImage) { return SetProperty(NS_ConvertASCIItoUCS2("background-image"), aBackgroundImage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundPosition(nsString& aBackgroundPosition) +nsDOMCSSDeclaration::GetBackgroundPosition(nsAWritableString& aBackgroundPosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-position"), aBackgroundPosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundPosition(const nsString& aBackgroundPosition) +nsDOMCSSDeclaration::SetBackgroundPosition(const nsAReadableString& aBackgroundPosition) { return SetProperty(NS_ConvertASCIItoUCS2("background-position"), aBackgroundPosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundRepeat(nsString& aBackgroundRepeat) +nsDOMCSSDeclaration::GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-repeat"), aBackgroundRepeat); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundRepeat(const nsString& aBackgroundRepeat) +nsDOMCSSDeclaration::SetBackgroundRepeat(const nsAReadableString& aBackgroundRepeat) { return SetProperty(NS_ConvertASCIItoUCS2("background-repeat"), aBackgroundRepeat, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBehavior(nsString& aBehavior) +nsDOMCSSDeclaration::GetBehavior(nsAWritableString& aBehavior) { return GetPropertyValue(NS_ConvertASCIItoUCS2("behavior"), aBehavior); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBehavior(const nsString& aBehavior) +nsDOMCSSDeclaration::SetBehavior(const nsAReadableString& aBehavior) { return SetProperty(NS_ConvertASCIItoUCS2("behavior"), aBehavior, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorder(nsString& aBorder) +nsDOMCSSDeclaration::GetBorder(nsAWritableString& aBorder) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border"), aBorder); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorder(const nsString& aBorder) +nsDOMCSSDeclaration::SetBorder(const nsAReadableString& aBorder) { return SetProperty(NS_ConvertASCIItoUCS2("border"), aBorder, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderCollapse(nsString& aBorderCollapse) +nsDOMCSSDeclaration::GetBorderCollapse(nsAWritableString& aBorderCollapse) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-collapse"), aBorderCollapse); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderCollapse(const nsString& aBorderCollapse) +nsDOMCSSDeclaration::SetBorderCollapse(const nsAReadableString& aBorderCollapse) { return SetProperty(NS_ConvertASCIItoUCS2("border-collapse"), aBorderCollapse, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderColor(nsString& aBorderColor) +nsDOMCSSDeclaration::GetBorderColor(nsAWritableString& aBorderColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-color"), aBorderColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderColor(const nsString& aBorderColor) +nsDOMCSSDeclaration::SetBorderColor(const nsAReadableString& aBorderColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-color"), aBorderColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderSpacing(nsString& aBorderSpacing) +nsDOMCSSDeclaration::GetBorderSpacing(nsAWritableString& aBorderSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-spacing"), aBorderSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderSpacing(const nsString& aBorderSpacing) +nsDOMCSSDeclaration::SetBorderSpacing(const nsAReadableString& aBorderSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("border-spacing"), aBorderSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderStyle(nsString& aBorderStyle) +nsDOMCSSDeclaration::GetBorderStyle(nsAWritableString& aBorderStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-style"), aBorderStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderStyle(const nsString& aBorderStyle) +nsDOMCSSDeclaration::SetBorderStyle(const nsAReadableString& aBorderStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-style"), aBorderStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTop(nsString& aBorderTop) +nsDOMCSSDeclaration::GetBorderTop(nsAWritableString& aBorderTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top"), aBorderTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTop(const nsString& aBorderTop) +nsDOMCSSDeclaration::SetBorderTop(const nsAReadableString& aBorderTop) { return SetProperty(NS_ConvertASCIItoUCS2("border-top"), aBorderTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRight(nsString& aBorderRight) +nsDOMCSSDeclaration::GetBorderRight(nsAWritableString& aBorderRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right"), aBorderRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRight(const nsString& aBorderRight) +nsDOMCSSDeclaration::SetBorderRight(const nsAReadableString& aBorderRight) { return SetProperty(NS_ConvertASCIItoUCS2("border-right"), aBorderRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottom(nsString& aBorderBottom) +nsDOMCSSDeclaration::GetBorderBottom(nsAWritableString& aBorderBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom"), aBorderBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottom(const nsString& aBorderBottom) +nsDOMCSSDeclaration::SetBorderBottom(const nsAReadableString& aBorderBottom) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom"), aBorderBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeft(nsString& aBorderLeft) +nsDOMCSSDeclaration::GetBorderLeft(nsAWritableString& aBorderLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left"), aBorderLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeft(const nsString& aBorderLeft) +nsDOMCSSDeclaration::SetBorderLeft(const nsAReadableString& aBorderLeft) { return SetProperty(NS_ConvertASCIItoUCS2("border-left"), aBorderLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopColor(nsString& aBorderTopColor) +nsDOMCSSDeclaration::GetBorderTopColor(nsAWritableString& aBorderTopColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-color"), aBorderTopColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopColor(const nsString& aBorderTopColor) +nsDOMCSSDeclaration::SetBorderTopColor(const nsAReadableString& aBorderTopColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-color"), aBorderTopColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightColor(nsString& aBorderRightColor) +nsDOMCSSDeclaration::GetBorderRightColor(nsAWritableString& aBorderRightColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-color"), aBorderRightColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightColor(const nsString& aBorderRightColor) +nsDOMCSSDeclaration::SetBorderRightColor(const nsAReadableString& aBorderRightColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-color"), aBorderRightColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomColor(nsString& aBorderBottomColor) +nsDOMCSSDeclaration::GetBorderBottomColor(nsAWritableString& aBorderBottomColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-color"), aBorderBottomColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomColor(const nsString& aBorderBottomColor) +nsDOMCSSDeclaration::SetBorderBottomColor(const nsAReadableString& aBorderBottomColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-color"), aBorderBottomColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftColor(nsString& aBorderLeftColor) +nsDOMCSSDeclaration::GetBorderLeftColor(nsAWritableString& aBorderLeftColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-color"), aBorderLeftColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftColor(const nsString& aBorderLeftColor) +nsDOMCSSDeclaration::SetBorderLeftColor(const nsAReadableString& aBorderLeftColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-color"), aBorderLeftColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopStyle(nsString& aBorderTopStyle) +nsDOMCSSDeclaration::GetBorderTopStyle(nsAWritableString& aBorderTopStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-style"), aBorderTopStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopStyle(const nsString& aBorderTopStyle) +nsDOMCSSDeclaration::SetBorderTopStyle(const nsAReadableString& aBorderTopStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-style"), aBorderTopStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightStyle(nsString& aBorderRightStyle) +nsDOMCSSDeclaration::GetBorderRightStyle(nsAWritableString& aBorderRightStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-style"), aBorderRightStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightStyle(const nsString& aBorderRightStyle) +nsDOMCSSDeclaration::SetBorderRightStyle(const nsAReadableString& aBorderRightStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-style"), aBorderRightStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomStyle(nsString& aBorderBottomStyle) +nsDOMCSSDeclaration::GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-style"), aBorderBottomStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomStyle(const nsString& aBorderBottomStyle) +nsDOMCSSDeclaration::SetBorderBottomStyle(const nsAReadableString& aBorderBottomStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-style"), aBorderBottomStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftStyle(nsString& aBorderLeftStyle) +nsDOMCSSDeclaration::GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-style"), aBorderLeftStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftStyle(const nsString& aBorderLeftStyle) +nsDOMCSSDeclaration::SetBorderLeftStyle(const nsAReadableString& aBorderLeftStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-style"), aBorderLeftStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopWidth(nsString& aBorderTopWidth) +nsDOMCSSDeclaration::GetBorderTopWidth(nsAWritableString& aBorderTopWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-width"), aBorderTopWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopWidth(const nsString& aBorderTopWidth) +nsDOMCSSDeclaration::SetBorderTopWidth(const nsAReadableString& aBorderTopWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-width"), aBorderTopWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightWidth(nsString& aBorderRightWidth) +nsDOMCSSDeclaration::GetBorderRightWidth(nsAWritableString& aBorderRightWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-width"), aBorderRightWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightWidth(const nsString& aBorderRightWidth) +nsDOMCSSDeclaration::SetBorderRightWidth(const nsAReadableString& aBorderRightWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-width"), aBorderRightWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomWidth(nsString& aBorderBottomWidth) +nsDOMCSSDeclaration::GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-width"), aBorderBottomWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomWidth(const nsString& aBorderBottomWidth) +nsDOMCSSDeclaration::SetBorderBottomWidth(const nsAReadableString& aBorderBottomWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-width"), aBorderBottomWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftWidth(nsString& aBorderLeftWidth) +nsDOMCSSDeclaration::GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-width"), aBorderLeftWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftWidth(const nsString& aBorderLeftWidth) +nsDOMCSSDeclaration::SetBorderLeftWidth(const nsAReadableString& aBorderLeftWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-width"), aBorderLeftWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderWidth(nsString& aBorderWidth) +nsDOMCSSDeclaration::GetBorderWidth(nsAWritableString& aBorderWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-width"), aBorderWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderWidth(const nsString& aBorderWidth) +nsDOMCSSDeclaration::SetBorderWidth(const nsAReadableString& aBorderWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-width"), aBorderWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBottom(nsString& aBottom) +nsDOMCSSDeclaration::GetBottom(nsAWritableString& aBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("bottom"), aBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBottom(const nsString& aBottom) +nsDOMCSSDeclaration::SetBottom(const nsAReadableString& aBottom) { return SetProperty(NS_ConvertASCIItoUCS2("bottom"), aBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCaptionSide(nsString& aCaptionSide) +nsDOMCSSDeclaration::GetCaptionSide(nsAWritableString& aCaptionSide) { return GetPropertyValue(NS_ConvertASCIItoUCS2("caption-side"), aCaptionSide); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCaptionSide(const nsString& aCaptionSide) +nsDOMCSSDeclaration::SetCaptionSide(const nsAReadableString& aCaptionSide) { return SetProperty(NS_ConvertASCIItoUCS2("caption-side"), aCaptionSide, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetClear(nsString& aClear) +nsDOMCSSDeclaration::GetClear(nsAWritableString& aClear) { return GetPropertyValue(NS_ConvertASCIItoUCS2("clear"), aClear); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetClear(const nsString& aClear) +nsDOMCSSDeclaration::SetClear(const nsAReadableString& aClear) { return SetProperty(NS_ConvertASCIItoUCS2("clear"), aClear, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetClip(nsString& aClip) +nsDOMCSSDeclaration::GetClip(nsAWritableString& aClip) { return GetPropertyValue(NS_ConvertASCIItoUCS2("clip"), aClip); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetClip(const nsString& aClip) +nsDOMCSSDeclaration::SetClip(const nsAReadableString& aClip) { return SetProperty(NS_ConvertASCIItoUCS2("clip"), aClip, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetColor(nsString& aColor) +nsDOMCSSDeclaration::GetColor(nsAWritableString& aColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("color"), aColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetColor(const nsString& aColor) +nsDOMCSSDeclaration::SetColor(const nsAReadableString& aColor) { return SetProperty(NS_ConvertASCIItoUCS2("color"), aColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetContent(nsString& aContent) +nsDOMCSSDeclaration::GetContent(nsAWritableString& aContent) { return GetPropertyValue(NS_ConvertASCIItoUCS2("content"), aContent); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetContent(const nsString& aContent) +nsDOMCSSDeclaration::SetContent(const nsAReadableString& aContent) { return SetProperty(NS_ConvertASCIItoUCS2("content"), aContent, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCounterIncrement(nsString& aCounterIncrement) +nsDOMCSSDeclaration::GetCounterIncrement(nsAWritableString& aCounterIncrement) { return GetPropertyValue(NS_ConvertASCIItoUCS2("counter-increment"), aCounterIncrement); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCounterIncrement(const nsString& aCounterIncrement) +nsDOMCSSDeclaration::SetCounterIncrement(const nsAReadableString& aCounterIncrement) { return SetProperty(NS_ConvertASCIItoUCS2("counter-increment"), aCounterIncrement, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCounterReset(nsString& aCounterReset) +nsDOMCSSDeclaration::GetCounterReset(nsAWritableString& aCounterReset) { return GetPropertyValue(NS_ConvertASCIItoUCS2("counter-reset"), aCounterReset); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCounterReset(const nsString& aCounterReset) +nsDOMCSSDeclaration::SetCounterReset(const nsAReadableString& aCounterReset) { return SetProperty(NS_ConvertASCIItoUCS2("counter-reset"), aCounterReset, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCssFloat(nsString& aCssFloat) +nsDOMCSSDeclaration::GetCssFloat(nsAWritableString& aCssFloat) { return GetPropertyValue(NS_ConvertASCIItoUCS2("float"), aCssFloat); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCssFloat(const nsString& aCssFloat) +nsDOMCSSDeclaration::SetCssFloat(const nsAReadableString& aCssFloat) { return SetProperty(NS_ConvertASCIItoUCS2("float"), aCssFloat, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCue(nsString& aCue) +nsDOMCSSDeclaration::GetCue(nsAWritableString& aCue) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue"), aCue); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCue(const nsString& aCue) +nsDOMCSSDeclaration::SetCue(const nsAReadableString& aCue) { return SetProperty(NS_ConvertASCIItoUCS2("cue"), aCue, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCueAfter(nsString& aCueAfter) +nsDOMCSSDeclaration::GetCueAfter(nsAWritableString& aCueAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue-after"), aCueAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCueAfter(const nsString& aCueAfter) +nsDOMCSSDeclaration::SetCueAfter(const nsAReadableString& aCueAfter) { return SetProperty(NS_ConvertASCIItoUCS2("cue-after"), aCueAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCueBefore(nsString& aCueBefore) +nsDOMCSSDeclaration::GetCueBefore(nsAWritableString& aCueBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue-before"), aCueBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCueBefore(const nsString& aCueBefore) +nsDOMCSSDeclaration::SetCueBefore(const nsAReadableString& aCueBefore) { return SetProperty(NS_ConvertASCIItoUCS2("cue-before"), aCueBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCursor(nsString& aCursor) +nsDOMCSSDeclaration::GetCursor(nsAWritableString& aCursor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cursor"), aCursor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCursor(const nsString& aCursor) +nsDOMCSSDeclaration::SetCursor(const nsAReadableString& aCursor) { return SetProperty(NS_ConvertASCIItoUCS2("cursor"), aCursor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetDirection(nsString& aDirection) +nsDOMCSSDeclaration::GetDirection(nsAWritableString& aDirection) { return GetPropertyValue(NS_ConvertASCIItoUCS2("direction"), aDirection); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetDirection(const nsString& aDirection) +nsDOMCSSDeclaration::SetDirection(const nsAReadableString& aDirection) { return SetProperty(NS_ConvertASCIItoUCS2("direction"), aDirection, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetDisplay(nsString& aDisplay) +nsDOMCSSDeclaration::GetDisplay(nsAWritableString& aDisplay) { return GetPropertyValue(NS_ConvertASCIItoUCS2("display"), aDisplay); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetDisplay(const nsString& aDisplay) +nsDOMCSSDeclaration::SetDisplay(const nsAReadableString& aDisplay) { return SetProperty(NS_ConvertASCIItoUCS2("display"), aDisplay, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetElevation(nsString& aElevation) +nsDOMCSSDeclaration::GetElevation(nsAWritableString& aElevation) { return GetPropertyValue(NS_ConvertASCIItoUCS2("elevation"), aElevation); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetElevation(const nsString& aElevation) +nsDOMCSSDeclaration::SetElevation(const nsAReadableString& aElevation) { return SetProperty(NS_ConvertASCIItoUCS2("elevation"), aElevation, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetEmptyCells(nsString& aEmptyCells) +nsDOMCSSDeclaration::GetEmptyCells(nsAWritableString& aEmptyCells) { return GetPropertyValue(NS_ConvertASCIItoUCS2("empty-cells"), aEmptyCells); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetEmptyCells(const nsString& aEmptyCells) +nsDOMCSSDeclaration::SetEmptyCells(const nsAReadableString& aEmptyCells) { return SetProperty(NS_ConvertASCIItoUCS2("empty-cells"), aEmptyCells, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFont(nsString& aFont) +nsDOMCSSDeclaration::GetFont(nsAWritableString& aFont) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font"), aFont); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFont(const nsString& aFont) +nsDOMCSSDeclaration::SetFont(const nsAReadableString& aFont) { return SetProperty(NS_ConvertASCIItoUCS2("font"), aFont, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontFamily(nsString& aFontFamily) +nsDOMCSSDeclaration::GetFontFamily(nsAWritableString& aFontFamily) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-family"), aFontFamily); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontFamily(const nsString& aFontFamily) +nsDOMCSSDeclaration::SetFontFamily(const nsAReadableString& aFontFamily) { return SetProperty(NS_ConvertASCIItoUCS2("font-family"), aFontFamily, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontSize(nsString& aFontSize) +nsDOMCSSDeclaration::GetFontSize(nsAWritableString& aFontSize) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-size"), aFontSize); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontSize(const nsString& aFontSize) +nsDOMCSSDeclaration::SetFontSize(const nsAReadableString& aFontSize) { return SetProperty(NS_ConvertASCIItoUCS2("font-size"), aFontSize, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontSizeAdjust(nsString& aFontSizeAdjust) +nsDOMCSSDeclaration::GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-size-adjust"), aFontSizeAdjust); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontSizeAdjust(const nsString& aFontSizeAdjust) +nsDOMCSSDeclaration::SetFontSizeAdjust(const nsAReadableString& aFontSizeAdjust) { return SetProperty(NS_ConvertASCIItoUCS2("font-size-adjust"), aFontSizeAdjust, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontStretch(nsString& aFontStretch) +nsDOMCSSDeclaration::GetFontStretch(nsAWritableString& aFontStretch) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-stretch"), aFontStretch); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontStretch(const nsString& aFontStretch) +nsDOMCSSDeclaration::SetFontStretch(const nsAReadableString& aFontStretch) { return SetProperty(NS_ConvertASCIItoUCS2("font-stretch"), aFontStretch, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontStyle(nsString& aFontStyle) +nsDOMCSSDeclaration::GetFontStyle(nsAWritableString& aFontStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-style"), aFontStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontStyle(const nsString& aFontStyle) +nsDOMCSSDeclaration::SetFontStyle(const nsAReadableString& aFontStyle) { return SetProperty(NS_ConvertASCIItoUCS2("font-style"), aFontStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontVariant(nsString& aFontVariant) +nsDOMCSSDeclaration::GetFontVariant(nsAWritableString& aFontVariant) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-variant"), aFontVariant); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontVariant(const nsString& aFontVariant) +nsDOMCSSDeclaration::SetFontVariant(const nsAReadableString& aFontVariant) { return SetProperty(NS_ConvertASCIItoUCS2("font-variant"), aFontVariant, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontWeight(nsString& aFontWeight) +nsDOMCSSDeclaration::GetFontWeight(nsAWritableString& aFontWeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-weight"), aFontWeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontWeight(const nsString& aFontWeight) +nsDOMCSSDeclaration::SetFontWeight(const nsAReadableString& aFontWeight) { return SetProperty(NS_ConvertASCIItoUCS2("font-weight"), aFontWeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetHeight(nsString& aHeight) +nsDOMCSSDeclaration::GetHeight(nsAWritableString& aHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("height"), aHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetHeight(const nsString& aHeight) +nsDOMCSSDeclaration::SetHeight(const nsAReadableString& aHeight) { return SetProperty(NS_ConvertASCIItoUCS2("height"), aHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLeft(nsString& aLeft) +nsDOMCSSDeclaration::GetLeft(nsAWritableString& aLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("left"), aLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLeft(const nsString& aLeft) +nsDOMCSSDeclaration::SetLeft(const nsAReadableString& aLeft) { return SetProperty(NS_ConvertASCIItoUCS2("left"), aLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLetterSpacing(nsString& aLetterSpacing) +nsDOMCSSDeclaration::GetLetterSpacing(nsAWritableString& aLetterSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("letter-spacing"), aLetterSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLetterSpacing(const nsString& aLetterSpacing) +nsDOMCSSDeclaration::SetLetterSpacing(const nsAReadableString& aLetterSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("letter-spacing"), aLetterSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLineHeight(nsString& aLineHeight) +nsDOMCSSDeclaration::GetLineHeight(nsAWritableString& aLineHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("line-height"), aLineHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLineHeight(const nsString& aLineHeight) +nsDOMCSSDeclaration::SetLineHeight(const nsAReadableString& aLineHeight) { return SetProperty(NS_ConvertASCIItoUCS2("line-height"), aLineHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyle(nsString& aListStyle) +nsDOMCSSDeclaration::GetListStyle(nsAWritableString& aListStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style"), aListStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyle(const nsString& aListStyle) +nsDOMCSSDeclaration::SetListStyle(const nsAReadableString& aListStyle) { return SetProperty(NS_ConvertASCIItoUCS2("list-style"), aListStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyleImage(nsString& aListStyleImage) +nsDOMCSSDeclaration::GetListStyleImage(nsAWritableString& aListStyleImage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-image"), aListStyleImage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyleImage(const nsString& aListStyleImage) +nsDOMCSSDeclaration::SetListStyleImage(const nsAReadableString& aListStyleImage) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-image"), aListStyleImage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStylePosition(nsString& aListStylePosition) +nsDOMCSSDeclaration::GetListStylePosition(nsAWritableString& aListStylePosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-position"), aListStylePosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStylePosition(const nsString& aListStylePosition) +nsDOMCSSDeclaration::SetListStylePosition(const nsAReadableString& aListStylePosition) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-position"), aListStylePosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyleType(nsString& aListStyleType) +nsDOMCSSDeclaration::GetListStyleType(nsAWritableString& aListStyleType) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-type"), aListStyleType); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyleType(const nsString& aListStyleType) +nsDOMCSSDeclaration::SetListStyleType(const nsAReadableString& aListStyleType) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-type"), aListStyleType, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMargin(nsString& aMargin) +nsDOMCSSDeclaration::GetMargin(nsAWritableString& aMargin) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin"), aMargin); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMargin(const nsString& aMargin) +nsDOMCSSDeclaration::SetMargin(const nsAReadableString& aMargin) { return SetProperty(NS_ConvertASCIItoUCS2("margin"), aMargin, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginTop(nsString& aMarginTop) +nsDOMCSSDeclaration::GetMarginTop(nsAWritableString& aMarginTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-top"), aMarginTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginTop(const nsString& aMarginTop) +nsDOMCSSDeclaration::SetMarginTop(const nsAReadableString& aMarginTop) { return SetProperty(NS_ConvertASCIItoUCS2("margin-top"), aMarginTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginRight(nsString& aMarginRight) +nsDOMCSSDeclaration::GetMarginRight(nsAWritableString& aMarginRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-right"), aMarginRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginRight(const nsString& aMarginRight) +nsDOMCSSDeclaration::SetMarginRight(const nsAReadableString& aMarginRight) { return SetProperty(NS_ConvertASCIItoUCS2("margin-right"), aMarginRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginBottom(nsString& aMarginBottom) +nsDOMCSSDeclaration::GetMarginBottom(nsAWritableString& aMarginBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-bottom"), aMarginBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginBottom(const nsString& aMarginBottom) +nsDOMCSSDeclaration::SetMarginBottom(const nsAReadableString& aMarginBottom) { return SetProperty(NS_ConvertASCIItoUCS2("margin-bottom"), aMarginBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginLeft(nsString& aMarginLeft) +nsDOMCSSDeclaration::GetMarginLeft(nsAWritableString& aMarginLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-left"), aMarginLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginLeft(const nsString& aMarginLeft) +nsDOMCSSDeclaration::SetMarginLeft(const nsAReadableString& aMarginLeft) { return SetProperty(NS_ConvertASCIItoUCS2("margin-left"), aMarginLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarkerOffset(nsString& aMarkerOffset) +nsDOMCSSDeclaration::GetMarkerOffset(nsAWritableString& aMarkerOffset) { return GetPropertyValue(NS_ConvertASCIItoUCS2("marker-offset"), aMarkerOffset); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarkerOffset(const nsString& aMarkerOffset) +nsDOMCSSDeclaration::SetMarkerOffset(const nsAReadableString& aMarkerOffset) { return SetProperty(NS_ConvertASCIItoUCS2("marker-offset"), aMarkerOffset, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarks(nsString& aMarks) +nsDOMCSSDeclaration::GetMarks(nsAWritableString& aMarks) { return GetPropertyValue(NS_ConvertASCIItoUCS2("marks"), aMarks); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarks(const nsString& aMarks) +nsDOMCSSDeclaration::SetMarks(const nsAReadableString& aMarks) { return SetProperty(NS_ConvertASCIItoUCS2("marks"), aMarks, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMaxHeight(nsString& aMaxHeight) +nsDOMCSSDeclaration::GetMaxHeight(nsAWritableString& aMaxHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("max-height"), aMaxHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMaxHeight(const nsString& aMaxHeight) +nsDOMCSSDeclaration::SetMaxHeight(const nsAReadableString& aMaxHeight) { return SetProperty(NS_ConvertASCIItoUCS2("max-height"), aMaxHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMaxWidth(nsString& aMaxWidth) +nsDOMCSSDeclaration::GetMaxWidth(nsAWritableString& aMaxWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("max-width"), aMaxWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMaxWidth(const nsString& aMaxWidth) +nsDOMCSSDeclaration::SetMaxWidth(const nsAReadableString& aMaxWidth) { return SetProperty(NS_ConvertASCIItoUCS2("max-width"), aMaxWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMinHeight(nsString& aMinHeight) +nsDOMCSSDeclaration::GetMinHeight(nsAWritableString& aMinHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("min-height"), aMinHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMinHeight(const nsString& aMinHeight) +nsDOMCSSDeclaration::SetMinHeight(const nsAReadableString& aMinHeight) { return SetProperty(NS_ConvertASCIItoUCS2("min-height"), aMinHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMinWidth(nsString& aMinWidth) +nsDOMCSSDeclaration::GetMinWidth(nsAWritableString& aMinWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("min-width"), aMinWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMinWidth(const nsString& aMinWidth) +nsDOMCSSDeclaration::SetMinWidth(const nsAReadableString& aMinWidth) { return SetProperty(NS_ConvertASCIItoUCS2("min-width"), aMinWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOrphans(nsString& aOrphans) +nsDOMCSSDeclaration::GetOrphans(nsAWritableString& aOrphans) { return GetPropertyValue(NS_ConvertASCIItoUCS2("orphans"), aOrphans); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOrphans(const nsString& aOrphans) +nsDOMCSSDeclaration::SetOrphans(const nsAReadableString& aOrphans) { return SetProperty(NS_ConvertASCIItoUCS2("orphans"), aOrphans, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutline(nsString& aOutline) +nsDOMCSSDeclaration::GetOutline(nsAWritableString& aOutline) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline"), aOutline); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutline(const nsString& aOutline) +nsDOMCSSDeclaration::SetOutline(const nsAReadableString& aOutline) { return SetProperty(NS_ConvertASCIItoUCS2("outline"), aOutline, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineColor(nsString& aOutlineColor) +nsDOMCSSDeclaration::GetOutlineColor(nsAWritableString& aOutlineColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-color"), aOutlineColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineColor(const nsString& aOutlineColor) +nsDOMCSSDeclaration::SetOutlineColor(const nsAReadableString& aOutlineColor) { return SetProperty(NS_ConvertASCIItoUCS2("outline-color"), aOutlineColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineStyle(nsString& aOutlineStyle) +nsDOMCSSDeclaration::GetOutlineStyle(nsAWritableString& aOutlineStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-style"), aOutlineStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineStyle(const nsString& aOutlineStyle) +nsDOMCSSDeclaration::SetOutlineStyle(const nsAReadableString& aOutlineStyle) { return SetProperty(NS_ConvertASCIItoUCS2("outline-style"), aOutlineStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineWidth(nsString& aOutlineWidth) +nsDOMCSSDeclaration::GetOutlineWidth(nsAWritableString& aOutlineWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-width"), aOutlineWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineWidth(const nsString& aOutlineWidth) +nsDOMCSSDeclaration::SetOutlineWidth(const nsAReadableString& aOutlineWidth) { return SetProperty(NS_ConvertASCIItoUCS2("outline-width"), aOutlineWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOverflow(nsString& aOverflow) +nsDOMCSSDeclaration::GetOverflow(nsAWritableString& aOverflow) { return GetPropertyValue(NS_ConvertASCIItoUCS2("overflow"), aOverflow); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOverflow(const nsString& aOverflow) +nsDOMCSSDeclaration::SetOverflow(const nsAReadableString& aOverflow) { return SetProperty(NS_ConvertASCIItoUCS2("overflow"), aOverflow, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPadding(nsString& aPadding) +nsDOMCSSDeclaration::GetPadding(nsAWritableString& aPadding) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding"), aPadding); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPadding(const nsString& aPadding) +nsDOMCSSDeclaration::SetPadding(const nsAReadableString& aPadding) { return SetProperty(NS_ConvertASCIItoUCS2("padding"), aPadding, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingTop(nsString& aPaddingTop) +nsDOMCSSDeclaration::GetPaddingTop(nsAWritableString& aPaddingTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-top"), aPaddingTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingTop(const nsString& aPaddingTop) +nsDOMCSSDeclaration::SetPaddingTop(const nsAReadableString& aPaddingTop) { return SetProperty(NS_ConvertASCIItoUCS2("padding-top"), aPaddingTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingRight(nsString& aPaddingRight) +nsDOMCSSDeclaration::GetPaddingRight(nsAWritableString& aPaddingRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-right"), aPaddingRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingRight(const nsString& aPaddingRight) +nsDOMCSSDeclaration::SetPaddingRight(const nsAReadableString& aPaddingRight) { return SetProperty(NS_ConvertASCIItoUCS2("padding-right"), aPaddingRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingBottom(nsString& aPaddingBottom) +nsDOMCSSDeclaration::GetPaddingBottom(nsAWritableString& aPaddingBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-bottom"), aPaddingBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingBottom(const nsString& aPaddingBottom) +nsDOMCSSDeclaration::SetPaddingBottom(const nsAReadableString& aPaddingBottom) { return SetProperty(NS_ConvertASCIItoUCS2("padding-bottom"), aPaddingBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingLeft(nsString& aPaddingLeft) +nsDOMCSSDeclaration::GetPaddingLeft(nsAWritableString& aPaddingLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-left"), aPaddingLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingLeft(const nsString& aPaddingLeft) +nsDOMCSSDeclaration::SetPaddingLeft(const nsAReadableString& aPaddingLeft) { return SetProperty(NS_ConvertASCIItoUCS2("padding-left"), aPaddingLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPage(nsString& aPage) +nsDOMCSSDeclaration::GetPage(nsAWritableString& aPage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page"), aPage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPage(const nsString& aPage) +nsDOMCSSDeclaration::SetPage(const nsAReadableString& aPage) { return SetProperty(NS_ConvertASCIItoUCS2("page"), aPage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakAfter(nsString& aPageBreakAfter) +nsDOMCSSDeclaration::GetPageBreakAfter(nsAWritableString& aPageBreakAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-after"), aPageBreakAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakAfter(const nsString& aPageBreakAfter) +nsDOMCSSDeclaration::SetPageBreakAfter(const nsAReadableString& aPageBreakAfter) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-after"), aPageBreakAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakBefore(nsString& aPageBreakBefore) +nsDOMCSSDeclaration::GetPageBreakBefore(nsAWritableString& aPageBreakBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-before"), aPageBreakBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakBefore(const nsString& aPageBreakBefore) +nsDOMCSSDeclaration::SetPageBreakBefore(const nsAReadableString& aPageBreakBefore) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-before"), aPageBreakBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakInside(nsString& aPageBreakInside) +nsDOMCSSDeclaration::GetPageBreakInside(nsAWritableString& aPageBreakInside) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-inside"), aPageBreakInside); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakInside(const nsString& aPageBreakInside) +nsDOMCSSDeclaration::SetPageBreakInside(const nsAReadableString& aPageBreakInside) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-inside"), aPageBreakInside, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPause(nsString& aPause) +nsDOMCSSDeclaration::GetPause(nsAWritableString& aPause) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause"), aPause); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPause(const nsString& aPause) +nsDOMCSSDeclaration::SetPause(const nsAReadableString& aPause) { return SetProperty(NS_ConvertASCIItoUCS2("pause"), aPause, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPauseAfter(nsString& aPauseAfter) +nsDOMCSSDeclaration::GetPauseAfter(nsAWritableString& aPauseAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause-after"), aPauseAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPauseAfter(const nsString& aPauseAfter) +nsDOMCSSDeclaration::SetPauseAfter(const nsAReadableString& aPauseAfter) { return SetProperty(NS_ConvertASCIItoUCS2("pause-after"), aPauseAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPauseBefore(nsString& aPauseBefore) +nsDOMCSSDeclaration::GetPauseBefore(nsAWritableString& aPauseBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause-before"), aPauseBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPauseBefore(const nsString& aPauseBefore) +nsDOMCSSDeclaration::SetPauseBefore(const nsAReadableString& aPauseBefore) { return SetProperty(NS_ConvertASCIItoUCS2("pause-before"), aPauseBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPitch(nsString& aPitch) +nsDOMCSSDeclaration::GetPitch(nsAWritableString& aPitch) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pitch"), aPitch); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPitch(const nsString& aPitch) +nsDOMCSSDeclaration::SetPitch(const nsAReadableString& aPitch) { return SetProperty(NS_ConvertASCIItoUCS2("pitch"), aPitch, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPitchRange(nsString& aPitchRange) +nsDOMCSSDeclaration::GetPitchRange(nsAWritableString& aPitchRange) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pitch-range"), aPitchRange); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPitchRange(const nsString& aPitchRange) +nsDOMCSSDeclaration::SetPitchRange(const nsAReadableString& aPitchRange) { return SetProperty(NS_ConvertASCIItoUCS2("pitch-range"), aPitchRange, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPlayDuring(nsString& aPlayDuring) +nsDOMCSSDeclaration::GetPlayDuring(nsAWritableString& aPlayDuring) { return GetPropertyValue(NS_ConvertASCIItoUCS2("play-during"), aPlayDuring); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPlayDuring(const nsString& aPlayDuring) +nsDOMCSSDeclaration::SetPlayDuring(const nsAReadableString& aPlayDuring) { return SetProperty(NS_ConvertASCIItoUCS2("play-during"), aPlayDuring, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPosition(nsString& aPosition) +nsDOMCSSDeclaration::GetPosition(nsAWritableString& aPosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("position"), aPosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPosition(const nsString& aPosition) +nsDOMCSSDeclaration::SetPosition(const nsAReadableString& aPosition) { return SetProperty(NS_ConvertASCIItoUCS2("position"), aPosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetQuotes(nsString& aQuotes) +nsDOMCSSDeclaration::GetQuotes(nsAWritableString& aQuotes) { return GetPropertyValue(NS_ConvertASCIItoUCS2("quotes"), aQuotes); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetQuotes(const nsString& aQuotes) +nsDOMCSSDeclaration::SetQuotes(const nsAReadableString& aQuotes) { return SetProperty(NS_ConvertASCIItoUCS2("quotes"), aQuotes, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetRichness(nsString& aRichness) +nsDOMCSSDeclaration::GetRichness(nsAWritableString& aRichness) { return GetPropertyValue(NS_ConvertASCIItoUCS2("richness"), aRichness); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetRichness(const nsString& aRichness) +nsDOMCSSDeclaration::SetRichness(const nsAReadableString& aRichness) { return SetProperty(NS_ConvertASCIItoUCS2("richness"), aRichness, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetRight(nsString& aRight) +nsDOMCSSDeclaration::GetRight(nsAWritableString& aRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("right"), aRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetRight(const nsString& aRight) +nsDOMCSSDeclaration::SetRight(const nsAReadableString& aRight) { return SetProperty(NS_ConvertASCIItoUCS2("right"), aRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSize(nsString& aSize) +nsDOMCSSDeclaration::GetSize(nsAWritableString& aSize) { return GetPropertyValue(NS_ConvertASCIItoUCS2("size"), aSize); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSize(const nsString& aSize) +nsDOMCSSDeclaration::SetSize(const nsAReadableString& aSize) { return SetProperty(NS_ConvertASCIItoUCS2("size"), aSize, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeak(nsString& aSpeak) +nsDOMCSSDeclaration::GetSpeak(nsAWritableString& aSpeak) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak"), aSpeak); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeak(const nsString& aSpeak) +nsDOMCSSDeclaration::SetSpeak(const nsAReadableString& aSpeak) { return SetProperty(NS_ConvertASCIItoUCS2("speak"), aSpeak, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakHeader(nsString& aSpeakHeader) +nsDOMCSSDeclaration::GetSpeakHeader(nsAWritableString& aSpeakHeader) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-header"), aSpeakHeader); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakHeader(const nsString& aSpeakHeader) +nsDOMCSSDeclaration::SetSpeakHeader(const nsAReadableString& aSpeakHeader) { return SetProperty(NS_ConvertASCIItoUCS2("speak-header"), aSpeakHeader, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakNumeral(nsString& aSpeakNumeral) +nsDOMCSSDeclaration::GetSpeakNumeral(nsAWritableString& aSpeakNumeral) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-numeral"), aSpeakNumeral); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakNumeral(const nsString& aSpeakNumeral) +nsDOMCSSDeclaration::SetSpeakNumeral(const nsAReadableString& aSpeakNumeral) { return SetProperty(NS_ConvertASCIItoUCS2("speak-numeral"), aSpeakNumeral, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakPunctuation(nsString& aSpeakPunctuation) +nsDOMCSSDeclaration::GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-punctuation"), aSpeakPunctuation); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakPunctuation(const nsString& aSpeakPunctuation) +nsDOMCSSDeclaration::SetSpeakPunctuation(const nsAReadableString& aSpeakPunctuation) { return SetProperty(NS_ConvertASCIItoUCS2("speak-punctuation"), aSpeakPunctuation, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeechRate(nsString& aSpeechRate) +nsDOMCSSDeclaration::GetSpeechRate(nsAWritableString& aSpeechRate) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speech-rate"), aSpeechRate); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeechRate(const nsString& aSpeechRate) +nsDOMCSSDeclaration::SetSpeechRate(const nsAReadableString& aSpeechRate) { return SetProperty(NS_ConvertASCIItoUCS2("speech-rate"), aSpeechRate, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetStress(nsString& aStress) +nsDOMCSSDeclaration::GetStress(nsAWritableString& aStress) { return GetPropertyValue(NS_ConvertASCIItoUCS2("stress"), aStress); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetStress(const nsString& aStress) +nsDOMCSSDeclaration::SetStress(const nsAReadableString& aStress) { return SetProperty(NS_ConvertASCIItoUCS2("stress"), aStress, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTableLayout(nsString& aTableLayout) +nsDOMCSSDeclaration::GetTableLayout(nsAWritableString& aTableLayout) { return GetPropertyValue(NS_ConvertASCIItoUCS2("table-layout"), aTableLayout); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTableLayout(const nsString& aTableLayout) +nsDOMCSSDeclaration::SetTableLayout(const nsAReadableString& aTableLayout) { return SetProperty(NS_ConvertASCIItoUCS2("table-layout"), aTableLayout, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextAlign(nsString& aTextAlign) +nsDOMCSSDeclaration::GetTextAlign(nsAWritableString& aTextAlign) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-align"), aTextAlign); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextAlign(const nsString& aTextAlign) +nsDOMCSSDeclaration::SetTextAlign(const nsAReadableString& aTextAlign) { return SetProperty(NS_ConvertASCIItoUCS2("text-align"), aTextAlign, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextDecoration(nsString& aTextDecoration) +nsDOMCSSDeclaration::GetTextDecoration(nsAWritableString& aTextDecoration) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-decoration"), aTextDecoration); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextDecoration(const nsString& aTextDecoration) +nsDOMCSSDeclaration::SetTextDecoration(const nsAReadableString& aTextDecoration) { return SetProperty(NS_ConvertASCIItoUCS2("text-decoration"), aTextDecoration, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextIndent(nsString& aTextIndent) +nsDOMCSSDeclaration::GetTextIndent(nsAWritableString& aTextIndent) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-indent"), aTextIndent); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextIndent(const nsString& aTextIndent) +nsDOMCSSDeclaration::SetTextIndent(const nsAReadableString& aTextIndent) { return SetProperty(NS_ConvertASCIItoUCS2("text-indent"), aTextIndent, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextShadow(nsString& aTextShadow) +nsDOMCSSDeclaration::GetTextShadow(nsAWritableString& aTextShadow) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-shadow"), aTextShadow); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextShadow(const nsString& aTextShadow) +nsDOMCSSDeclaration::SetTextShadow(const nsAReadableString& aTextShadow) { return SetProperty(NS_ConvertASCIItoUCS2("text-shadow"), aTextShadow, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextTransform(nsString& aTextTransform) +nsDOMCSSDeclaration::GetTextTransform(nsAWritableString& aTextTransform) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-transform"), aTextTransform); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextTransform(const nsString& aTextTransform) +nsDOMCSSDeclaration::SetTextTransform(const nsAReadableString& aTextTransform) { return SetProperty(NS_ConvertASCIItoUCS2("text-transform"), aTextTransform, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTop(nsString& aTop) +nsDOMCSSDeclaration::GetTop(nsAWritableString& aTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("top"), aTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTop(const nsString& aTop) +nsDOMCSSDeclaration::SetTop(const nsAReadableString& aTop) { return SetProperty(NS_ConvertASCIItoUCS2("top"), aTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetUnicodeBidi(nsString& aUnicodeBidi) +nsDOMCSSDeclaration::GetUnicodeBidi(nsAWritableString& aUnicodeBidi) { return GetPropertyValue(NS_ConvertASCIItoUCS2("unicode-bidi"), aUnicodeBidi); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetUnicodeBidi(const nsString& aUnicodeBidi) +nsDOMCSSDeclaration::SetUnicodeBidi(const nsAReadableString& aUnicodeBidi) { return SetProperty(NS_ConvertASCIItoUCS2("unicode-bidi"), aUnicodeBidi, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVerticalAlign(nsString& aVerticalAlign) +nsDOMCSSDeclaration::GetVerticalAlign(nsAWritableString& aVerticalAlign) { return GetPropertyValue(NS_ConvertASCIItoUCS2("vertical-align"), aVerticalAlign); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVerticalAlign(const nsString& aVerticalAlign) +nsDOMCSSDeclaration::SetVerticalAlign(const nsAReadableString& aVerticalAlign) { return SetProperty(NS_ConvertASCIItoUCS2("vertical-align"), aVerticalAlign, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVisibility(nsString& aVisibility) +nsDOMCSSDeclaration::GetVisibility(nsAWritableString& aVisibility) { return GetPropertyValue(NS_ConvertASCIItoUCS2("visibility"), aVisibility); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVisibility(const nsString& aVisibility) +nsDOMCSSDeclaration::SetVisibility(const nsAReadableString& aVisibility) { return SetProperty(NS_ConvertASCIItoUCS2("visibility"), aVisibility, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVoiceFamily(nsString& aVoiceFamily) +nsDOMCSSDeclaration::GetVoiceFamily(nsAWritableString& aVoiceFamily) { return GetPropertyValue(NS_ConvertASCIItoUCS2("voice-family"), aVoiceFamily); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVoiceFamily(const nsString& aVoiceFamily) +nsDOMCSSDeclaration::SetVoiceFamily(const nsAReadableString& aVoiceFamily) { return SetProperty(NS_ConvertASCIItoUCS2("voice-family"), aVoiceFamily, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVolume(nsString& aVolume) +nsDOMCSSDeclaration::GetVolume(nsAWritableString& aVolume) { return GetPropertyValue(NS_ConvertASCIItoUCS2("volume"), aVolume); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVolume(const nsString& aVolume) +nsDOMCSSDeclaration::SetVolume(const nsAReadableString& aVolume) { return SetProperty(NS_ConvertASCIItoUCS2("volume"), aVolume, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWhiteSpace(nsString& aWhiteSpace) +nsDOMCSSDeclaration::GetWhiteSpace(nsAWritableString& aWhiteSpace) { return GetPropertyValue(NS_ConvertASCIItoUCS2("white-space"), aWhiteSpace); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWhiteSpace(const nsString& aWhiteSpace) +nsDOMCSSDeclaration::SetWhiteSpace(const nsAReadableString& aWhiteSpace) { return SetProperty(NS_ConvertASCIItoUCS2("white-space"), aWhiteSpace, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWidows(nsString& aWidows) +nsDOMCSSDeclaration::GetWidows(nsAWritableString& aWidows) { return GetPropertyValue(NS_ConvertASCIItoUCS2("widows"), aWidows); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWidows(const nsString& aWidows) +nsDOMCSSDeclaration::SetWidows(const nsAReadableString& aWidows) { return SetProperty(NS_ConvertASCIItoUCS2("widows"), aWidows, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWidth(nsString& aWidth) +nsDOMCSSDeclaration::GetWidth(nsAWritableString& aWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("width"), aWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWidth(const nsString& aWidth) +nsDOMCSSDeclaration::SetWidth(const nsAReadableString& aWidth) { return SetProperty(NS_ConvertASCIItoUCS2("width"), aWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWordSpacing(nsString& aWordSpacing) +nsDOMCSSDeclaration::GetWordSpacing(nsAWritableString& aWordSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("word-spacing"), aWordSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWordSpacing(const nsString& aWordSpacing) +nsDOMCSSDeclaration::SetWordSpacing(const nsAReadableString& aWordSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("word-spacing"), aWordSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetZIndex(nsString& aZIndex) +nsDOMCSSDeclaration::GetZIndex(nsAWritableString& aZIndex) { return GetPropertyValue(NS_ConvertASCIItoUCS2("z-index"), aZIndex); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetZIndex(const nsString& aZIndex) +nsDOMCSSDeclaration::SetZIndex(const nsAReadableString& aZIndex) { return SetProperty(NS_ConvertASCIItoUCS2("z-index"), aZIndex, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOpacity(nsString& aOpacity) +nsDOMCSSDeclaration::GetOpacity(nsAWritableString& aOpacity) { return GetPropertyValue(NS_ConvertASCIItoUCS2("opacity"), aOpacity); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOpacity(const nsString& aOpacity) +nsDOMCSSDeclaration::SetOpacity(const nsAReadableString& aOpacity) { return SetProperty(NS_ConvertASCIItoUCS2("opacity"), aOpacity, nsAutoString()); } diff --git a/layout/html/style/src/nsDOMCSSDeclaration.h b/layout/html/style/src/nsDOMCSSDeclaration.h index 7f51d0bbe0b6..d9fbc15d9606 100644 --- a/layout/html/style/src/nsDOMCSSDeclaration.h +++ b/layout/html/style/src/nsDOMCSSDeclaration.h @@ -39,21 +39,22 @@ public: NS_DECL_ISUPPORTS // NS_DECL_IDOMCSSSTYLEDECLARATION - NS_IMETHOD GetCssText(nsString& aCssText); - NS_IMETHOD SetCssText(const nsString& aCssText); + NS_IMETHOD GetCssText(nsAWritableString& aCssText); + NS_IMETHOD SetCssText(const nsAReadableString& aCssText); NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule); - NS_IMETHOD GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn); - NS_IMETHOD GetPropertyCSSValue(const nsString& aPropertyName, + NS_IMETHOD GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); + NS_IMETHOD GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) = 0; - NS_IMETHOD GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn); - NS_IMETHOD SetProperty(const nsString& aPropertyName, - const nsString& aValue, const nsString& aPriority); - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) = 0; + NS_IMETHOD GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); + NS_IMETHOD SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, const nsAReadableString& aPriority); + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn); + NS_DECL_IDOMCSS2PROPERTIES @@ -67,7 +68,7 @@ public: // Note! This will only set the declaration if a style rule already exists virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl) = 0; - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) = 0; virtual nsresult GetParent(nsISupports **aParent) = 0; diff --git a/layout/html/style/src/nsHTMLAttributes.cpp b/layout/html/style/src/nsHTMLAttributes.cpp index 8a902412cfba..2fc2c087ef20 100644 --- a/layout/html/style/src/nsHTMLAttributes.cpp +++ b/layout/html/style/src/nsHTMLAttributes.cpp @@ -823,7 +823,7 @@ public: nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet, PRInt32& aAttrCount); - NS_IMETHOD SetAttributeFor(nsIAtom* aAttrName, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttrName, const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet); @@ -987,7 +987,7 @@ NS_IMPL_QUERY_INTERFACE(HTMLAttributesImpl, kIHTMLAttributesIID); const PRUnichar kNullCh = PRUnichar('\0'); -static void ParseClasses(const nsString& aClassString, nsClassList& aClassList) +static void ParseClasses(const nsAReadableString& aClassString, nsClassList& aClassList) { nsAutoString classStr(aClassString); // copy to work buffer classStr.Append(kNullCh); // put an extra null at the end @@ -1154,7 +1154,7 @@ HTMLAttributesImpl::UniqueMapped(nsIHTMLStyleSheet* aSheet) } NS_IMETHODIMP -HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName, const nsString& aValue, +HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName, const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet) { diff --git a/layout/html/style/src/nsHTMLStyleSheet.cpp b/layout/html/style/src/nsHTMLStyleSheet.cpp index c877aa8dec07..f0970abff9dd 100644 --- a/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -631,7 +631,8 @@ public: // Attribute management methods, aAttributes is an in/out param NS_IMETHOD SetAttributesFor(nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes); - NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, + const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes); @@ -1232,7 +1233,7 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent, nsI } NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes) diff --git a/layout/html/style/src/nsHTMLValue.cpp b/layout/html/style/src/nsHTMLValue.cpp index 86a8b2d6c687..6e7c540d03cc 100644 --- a/layout/html/style/src/nsHTMLValue.cpp +++ b/layout/html/style/src/nsHTMLValue.cpp @@ -22,6 +22,7 @@ #include "nsHTMLValue.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsISizeOfHandler.h" @@ -60,14 +61,14 @@ nsHTMLValue::nsHTMLValue(float aValue) mValue.mFloat = aValue; } -nsHTMLValue::nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit) +nsHTMLValue::nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit) : mUnit(aUnit) { NS_ASSERTION((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit), "not a string value"); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } else { mUnit = eHTMLUnit_Null; @@ -226,12 +227,13 @@ void nsHTMLValue::SetPercentValue(float aValue) mValue.mFloat = aValue; } -void nsHTMLValue::SetStringValue(const nsString& aValue, nsHTMLUnit aUnit) +void nsHTMLValue::SetStringValue(const nsAReadableString& aValue, + nsHTMLUnit aUnit) { Reset(); if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { mUnit = aUnit; - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } } @@ -256,7 +258,7 @@ void nsHTMLValue::SetEmptyValue(void) mUnit = eHTMLUnit_Empty; } -void nsHTMLValue::AppendToString(nsString& aBuffer) const +void nsHTMLValue::AppendToString(nsAWritableString& aBuffer) const { if (eHTMLUnit_Null == mUnit) { return; @@ -266,37 +268,48 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); aBuffer.Append(mValue.mString); - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); } else { - aBuffer.AppendWithConversion("null str"); + aBuffer.Append(NS_LITERAL_STRING("null str")); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.AppendWithConversion("0x"); - aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(NS_LITERAL_STRING("0x")); + nsAutoString intStr; + intStr.AppendInt((PRInt32)mValue.mISupports, 16); + aBuffer.Append(intStr); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.AppendWithConversion("(0x"); - aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); - aBuffer.AppendWithConversion(')'); + nsAutoString intStr; + intStr.Append(NS_LITERAL_STRING("(0x")); + intStr.AppendInt(NS_GET_R(mValue.mColor), 16); + intStr.Append(intStr); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_G(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_B(mValue.mColor), 16); + intStr.Append(NS_LITERAL_STRING(" 0x")); + intStr.AppendInt(NS_GET_A(mValue.mColor), 16); + intStr.Append(PRUnichar(')')); + + aBuffer.Append(intStr); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.AppendFloat(mValue.mFloat * 100.0f); + nsAutoString floatStr; + floatStr.AppendFloat(mValue.mFloat * 100.0f); + aBuffer.Append(floatStr); } else { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); + nsAutoString intStr; + intStr.AppendInt(mValue.mInt, 10); + intStr.Append(NS_LITERAL_STRING("[0x")); + intStr.AppendInt(mValue.mInt, 16); + intStr.Append(PRUnichar(']')); + + aBuffer.Append(intStr); } switch (mUnit) { @@ -304,18 +317,18 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.Append(NS_LITERAL_STRING("ptr")); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; - case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; - case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; + case eHTMLUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; + case eHTMLUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break; + case eHTMLUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; + case eHTMLUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; + case eHTMLUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; } - aBuffer.AppendWithConversion(' '); + aBuffer.Append(PRUnichar(' ')); } -void nsHTMLValue::ToString(nsString& aBuffer) const +void nsHTMLValue::ToString(nsAWritableString& aBuffer) const { aBuffer.Truncate(); AppendToString(aBuffer); diff --git a/layout/html/style/src/nsHTMLValue.h b/layout/html/style/src/nsHTMLValue.h index cfd8018c71ab..1c7ed08306f3 100644 --- a/layout/html/style/src/nsHTMLValue.h +++ b/layout/html/style/src/nsHTMLValue.h @@ -48,7 +48,7 @@ public: nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null); nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit); nsHTMLValue(float aValue); - nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); nsHTMLValue(nsISupports* aValue); nsHTMLValue(nscolor aValue); nsHTMLValue(const nsHTMLValue& aCopy); @@ -63,7 +63,7 @@ public: PRInt32 GetIntValue(void) const; PRInt32 GetPixelValue(void) const; float GetPercentValue(void) const; - nsString& GetStringValue(nsString& aBuffer) const; + nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; nsISupports* GetISupportsValue(void) const; nscolor GetColorValue(void) const; @@ -71,13 +71,13 @@ public: void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit); void SetPixelValue(PRInt32 aValue); void SetPercentValue(float aValue); - void SetStringValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); + void SetStringValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); void SetISupportsValue(nsISupports* aValue); void SetColorValue(nscolor aValue); void SetEmptyValue(void); - void AppendToString(nsString& aBuffer) const; - void ToString(nsString& aBuffer) const; + void AppendToString(nsAWritableString& aBuffer) const; + void ToString(nsAWritableString& aBuffer) const; protected: nsHTMLUnit mUnit; @@ -129,7 +129,7 @@ inline float nsHTMLValue::GetPercentValue(void) const return 0.0f; } -inline nsString& nsHTMLValue::GetStringValue(nsString& aBuffer) const +inline nsAWritableString& nsHTMLValue::GetStringValue(nsAWritableString& aBuffer) const { NS_ASSERTION((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName) || (mUnit == eHTMLUnit_Null), "not a string value"); diff --git a/layout/html/style/src/nsICSSDeclaration.h b/layout/html/style/src/nsICSSDeclaration.h index be9e031275fd..6af7d069f699 100644 --- a/layout/html/style/src/nsICSSDeclaration.h +++ b/layout/html/style/src/nsICSSDeclaration.h @@ -391,28 +391,32 @@ public: NS_IMETHOD GetData(const nsID& aIID, nsCSSStruct** aData) = 0; NS_IMETHOD EnsureData(const nsID& aSID, nsCSSStruct** aData) = 0; - NS_IMETHOD AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue) = 0; + NS_IMETHOD AppendValue(nsCSSProperty aProperty, + const nsCSSValue& aValue) = 0; NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct) = 0; NS_IMETHOD SetValueImportant(nsCSSProperty aProperty) = 0; - NS_IMETHOD AppendComment(const nsString& aComment) = 0; + NS_IMETHOD AppendComment(const nsAReadableString& aComment) = 0; NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) = 0; // XXX make nscolor a struct to avoid type conflicts NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) = 0; - NS_IMETHOD GetValue(nsCSSProperty aProperty, nsString& aValue) = 0; - NS_IMETHOD GetValue(const nsString& aProperty, nsString& aValue) = 0; + NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue) = 0; + NS_IMETHOD GetValue(const nsAReadableString& aProperty, + nsAWritableString& aValue) = 0; NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult) = 0; - NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, PRBool& aIsImportant) = 0; - NS_IMETHOD GetValueIsImportant(const nsString& aProperty, PRBool& aIsImportant) = 0; + NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, + PRBool& aIsImportant) = 0; + NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty, + PRBool& aIsImportant) = 0; NS_IMETHOD Count(PRUint32* aCount) = 0; - NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsString& aReturn) = 0; + NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) = 0; NS_IMETHOD GetStyleImpact(PRInt32* aHint) const = 0; - NS_IMETHOD ToString(nsString& aString) = 0; + NS_IMETHOD ToString(nsAWritableString& aString) = 0; NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const = 0; diff --git a/layout/html/style/src/nsIHTMLAttributes.h b/layout/html/style/src/nsIHTMLAttributes.h index e270e77b7ea5..f1a2fa21abc8 100644 --- a/layout/html/style/src/nsIHTMLAttributes.h +++ b/layout/html/style/src/nsIHTMLAttributes.h @@ -51,7 +51,7 @@ public: PRInt32& aAttrCount) = 0; // this string value version lets you avoid an extra string copy, // the value is still stored in a nsHTMLValue - NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLStyleSheet* aSheet) = 0; diff --git a/layout/html/style/src/nsIHTMLStyleSheet.h b/layout/html/style/src/nsIHTMLStyleSheet.h index 88530c1c6e9f..9ceea7880bb7 100644 --- a/layout/html/style/src/nsIHTMLStyleSheet.h +++ b/layout/html/style/src/nsIHTMLStyleSheet.h @@ -56,7 +56,8 @@ public: // Attribute management methods NS_IMETHOD SetAttributesFor(nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes) = 0; - NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, + const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes) = 0; diff --git a/layout/html/style/src/nsROCSSPrimitiveValue.cpp b/layout/html/style/src/nsROCSSPrimitiveValue.cpp index 0c669e8a9c60..ae69759a2bae 100644 --- a/layout/html/style/src/nsROCSSPrimitiveValue.cpp +++ b/layout/html/style/src/nsROCSSPrimitiveValue.cpp @@ -85,16 +85,18 @@ nsROCSSPrimitiveValue::SetScriptObject(void* aScriptObject) NS_IMETHODIMP -nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) +nsROCSSPrimitiveValue::GetCssText(nsAWritableString& aCssText) { + nsAutoString tmpStr; + aCssText.Truncate(); switch (mType) { case CSS_PX : { PRInt32 px = NSTwipsToIntPixels(mTwips, mT2P); - aCssText.AppendInt(px); - aCssText.AppendWithConversion("px"); + tmpStr.AppendInt(px); + tmpStr.AppendWithConversion("px"); break; } @@ -103,7 +105,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_CENTIMETERS(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("cm"); + tmpStr.AppendWithConversion("cm"); break; } case CSS_MM : @@ -111,7 +113,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_MILLIMETERS(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("mm"); + tmpStr.AppendWithConversion("mm"); break; } case CSS_IN : @@ -119,7 +121,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_INCHES(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("in"); + tmpStr.AppendWithConversion("in"); break; } case CSS_PT : @@ -127,12 +129,12 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NSTwipsToFloatPoints(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("pt"); + tmpStr.AppendWithConversion("pt"); break; } case CSS_STRING : { - aCssText.Append(mString); + tmpStr.Append(mString); break; } case CSS_PC : @@ -158,12 +160,14 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) return NS_ERROR_DOM_INVALID_ACCESS_ERR; } + aCssText.Assign(tmpStr); + return NS_OK; } NS_IMETHODIMP -nsROCSSPrimitiveValue::SetCssText(const nsString& aCssText) +nsROCSSPrimitiveValue::SetCssText(const nsAReadableString& aCssText) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -253,16 +257,16 @@ nsROCSSPrimitiveValue::GetFloatValue(PRUint16 aUnitType, float* aReturn) NS_IMETHODIMP nsROCSSPrimitiveValue::SetStringValue(PRUint16 aStringType, - const nsString& aStringValue) + const nsAReadableString& aStringValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsROCSSPrimitiveValue::GetStringValue(nsString& aReturn) +nsROCSSPrimitiveValue::GetStringValue(nsAWritableString& aReturn) { - aReturn = mString; + aReturn.Assign(mString); return NS_OK; } diff --git a/layout/html/tests/TestAttributes.cpp b/layout/html/tests/TestAttributes.cpp index b3c9b1fecdb9..f3b41d5e4059 100644 --- a/layout/html/tests/TestAttributes.cpp +++ b/layout/html/tests/TestAttributes.cpp @@ -190,19 +190,19 @@ public: return NS_OK; } - NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMElement** aReturn) { + NS_IMETHOD CreateElementNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn) { return NS_OK; } - NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMAttr** aReturn) { + NS_IMETHOD CreateAttributeNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { return NS_OK; } - NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn) { + NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { return NS_OK; } - NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn) { + NS_IMETHOD GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn) { return NS_OK; } diff --git a/layout/style/nsCSSDeclaration.cpp b/layout/style/nsCSSDeclaration.cpp index 39f7adef9f7e..395e93399870 100644 --- a/layout/style/nsCSSDeclaration.cpp +++ b/layout/style/nsCSSDeclaration.cpp @@ -995,21 +995,21 @@ public: NS_IMETHOD AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue); NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct); NS_IMETHOD SetValueImportant(nsCSSProperty aProperty); - NS_IMETHOD AppendComment(const nsString& aComment); + NS_IMETHOD AppendComment(const nsAReadableString& aComment); NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue); NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue); - NS_IMETHOD GetValue(nsCSSProperty aProperty, nsString& aValue); - NS_IMETHOD GetValue(const nsString& aProperty, nsString& aValue); + NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue); + NS_IMETHOD GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue); NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult); NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, PRBool& aIsImportant); - NS_IMETHOD GetValueIsImportant(const nsString& aProperty, PRBool& aIsImportant); + NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant); - PRBool AppendValueToString(nsCSSProperty aProperty, nsString& aResult); - PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult); - NS_IMETHOD ToString(nsString& aString); + NS_IMETHOD ToString(nsAWritableString& aString); NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const; @@ -1018,7 +1018,7 @@ public: virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize); NS_IMETHOD Count(PRUint32* aCount); - NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn); NS_IMETHOD GetStyleImpact(PRInt32* aHint) const; @@ -3313,7 +3313,7 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) } NS_IMETHODIMP -CSSDeclarationImpl::AppendComment(const nsString& aComment) +CSSDeclarationImpl::AppendComment(const nsAReadableString& aComment) { nsresult result = NS_ERROR_OUT_OF_MEMORY; @@ -3913,20 +3913,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(const nsString& aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(const nsAReadableString& aProperty, + nsAWritableString& aValue) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); return GetValue(propID, aValue); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult) { nsCSSValue value; GetValue(aProperty, value); return AppendValueToString(aProperty, value, aResult); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult) { nsCSSUnit unit = aValue.GetUnit(); @@ -3936,10 +3937,14 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aResult.Append(NS_LITERAL_STRING("url(")); + break; + case eCSSUnit_Attr: aResult.Append(NS_LITERAL_STRING("attr(")); + break; + case eCSSUnit_Counter: aResult.Append(NS_LITERAL_STRING("counter(")); + break; + case eCSSUnit_Counters: aResult.Append(NS_LITERAL_STRING("counters(")); + break; default: break; } nsAutoString buffer; @@ -3952,17 +3957,23 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns case eCSSProperty_background_color: { // we can lookup the property in the ColorTable and then // get a string mapping the name - nsCString str; + nsAutoString tmpStr; + nsCAutoString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.AppendWithConversion(str); + aResult.Append(NS_ConvertASCIItoUCS2(str)); } else { - aResult.AppendInt(aValue.GetIntValue(), 10); + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); } } break; default: - aResult.AppendInt(aValue.GetIntValue(), 10); + { + nsAutoString tmpStr; + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); + } } } else if (eCSSUnit_Enumerated == unit) { @@ -3974,119 +3985,136 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, mask))); intValue &= ~mask; if (0 != intValue) { // more left - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } } } } else { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE))); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND)))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.AppendWithConversion(' '); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.Append(PRUnichar(' ')); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND))); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX))); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT))); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP))); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER))); } } else { const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.AppendWithConversion(name); + aResult.Append(NS_ConvertASCIItoUCS2(name)); } } else if (eCSSUnit_Color == unit){ + nsAutoString tmpStr; nscolor color = aValue.GetColorValue(); - aResult.AppendWithConversion("rgb("); - aResult.AppendInt(NS_GET_R(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_G(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_B(color), 10); - aResult.AppendWithConversion(')'); + + aResult.Append(NS_LITERAL_STRING("rgb(")); + + tmpStr.AppendInt(NS_GET_R(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_G(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_B(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == unit) { - aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetPercentValue() * 100.0f); + aResult.Append(tmpStr); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.AppendFloat(aValue.GetFloatValue()); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetFloatValue()); + aResult.Append(tmpStr); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aResult.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aResult.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aResult.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aResult.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aResult.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; + case eCSSUnit_Counters: aResult.Append(PRUnichar(')')); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; + case eCSSUnit_Percent: aResult.Append(PRUnichar('%')); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; - case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; + case eCSSUnit_Inch: aResult.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aResult.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aResult.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aResult.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aResult.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aResult.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aResult.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aResult.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aResult.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aResult.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aResult.Append(NS_LITERAL_STRING("cc")); break; - case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; - case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; + case eCSSUnit_EM: aResult.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aResult.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aResult.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aResult.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aResult.Append(NS_LITERAL_STRING("ch")); break; - case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; + case eCSSUnit_Pixel: aResult.Append(NS_LITERAL_STRING("px")); break; - case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; + case eCSSUnit_Degree: aResult.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aResult.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aResult.Append(NS_LITERAL_STRING("rad")); break; - case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; + case eCSSUnit_Hertz: aResult.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aResult.Append(NS_LITERAL_STRING("kHz")); break; - case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; + case eCSSUnit_Seconds: aResult.Append(PRUnichar('s')); break; + case eCSSUnit_Milliseconds: aResult.Append(NS_LITERAL_STRING("ms")); break; } return PR_TRUE; @@ -4102,7 +4130,8 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns (eCSSUnit_Null != strct->rect->mLeft.GetUnit())) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, + nsAWritableString& aValue) { PRBool isImportant = PR_FALSE; GetValueIsImportant(aProperty, isImportant); @@ -4115,41 +4144,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(PRUnichar(' ')); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.AppendWithConversion("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); + aValue.Append(NS_LITERAL_STRING("rect(")); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.AppendWithConversion(")"); + aValue.Append(PRUnichar(')')); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -4160,62 +4189,62 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.AppendWithConversion('/'); + aValue.Append(PRUnichar('/')); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_pause_before, aValue); } break; case eCSSProperty_size: if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { AppendValueToString(eCSSProperty_size_width, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_size_height, aValue); } break; @@ -4224,13 +4253,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(PRUnichar(' ')); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(PRUnichar(' ')); shadow = shadow->mNext; } } @@ -4242,67 +4271,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -4313,7 +4342,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != content); } @@ -4324,13 +4353,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4341,13 +4370,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4356,7 +4385,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -4366,11 +4395,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != quotes); } @@ -4382,7 +4411,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != keyEquiv); } @@ -4408,7 +4437,7 @@ CSSDeclarationImpl::GetImportantValues(nsICSSDeclaration*& aResult) } NS_IMETHODIMP -CSSDeclarationImpl::GetValueIsImportant(const nsString& aProperty, +CSSDeclarationImpl::GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); @@ -4438,7 +4467,7 @@ CSSDeclarationImpl::GetValueIsImportant(nsCSSProperty aProperty, } NS_IMETHODIMP -CSSDeclarationImpl::ToString(nsString& aString) +CSSDeclarationImpl::ToString(nsAWritableString& aString) { if (nsnull != mOrder) { PRInt32 count = mOrder->Count(); @@ -4446,21 +4475,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); - aString.AppendWithConversion(": "); + aString.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); + aString.Append(NS_LITERAL_STRING(": ")); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.AppendWithConversion("; "); + aString.Append(NS_LITERAL_STRING("; ")); } } else { // is comment - aString.AppendWithConversion("/* "); + aString.Append(NS_LITERAL_STRING("/* ")); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.AppendWithConversion(" */ "); + aString.Append(NS_LITERAL_STRING(" */ ")); } } } @@ -4607,13 +4636,13 @@ CSSDeclarationImpl::Count(PRUint32* aCount) } NS_IMETHODIMP -CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) +CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) { - aReturn.SetLength(0); + aReturn.Truncate(); if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aReturn.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); } } diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index d8c4e957cf1c..4d5936ae3167 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -142,19 +142,19 @@ public: nsIURI* aInputURL, nsICSSStyleSheet*& aResult); - NS_IMETHOD ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult); + NS_IMETHOD ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult); - NS_IMETHOD ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint); + NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint); - NS_IMETHOD GetCharset(/*out*/nsString &aCharsetDest) const; + NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const; // sets the out-param to the current charset, as set by SetCharset - NS_IMETHOD SetCharset(/*in*/ const nsString &aCharsetSrc); + NS_IMETHOD SetCharset(/*in*/ const nsAReadableString &aCharsetSrc); // NOTE: SetCharset expects the charset to be the preferred charset // and it just records the string exactly as passed in (no alias resolution) @@ -517,9 +517,9 @@ CSSParserImpl::Parse(nsIUnicharInputStream* aInput, } NS_IMETHODIMP -CSSParserImpl::ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult) +CSSParserImpl::ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult) { NS_ASSERTION(nsnull != aBaseURL, "need base URL"); @@ -562,11 +562,11 @@ CSSParserImpl::ParseDeclarations(const nsString& aDeclaration, } NS_IMETHODIMP -CSSParserImpl::ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint) +CSSParserImpl::ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint) { // NS_ASSERTION(nsnull != aBaseURL, "need base URL"); @@ -4354,13 +4354,13 @@ PRBool CSSParserImpl::ParseTextShadow(PRInt32& aErrorCode, return PR_FALSE; } -NS_IMETHODIMP CSSParserImpl::GetCharset(/*out*/nsString &aCharsetDest) const +NS_IMETHODIMP CSSParserImpl::GetCharset(/*out*/nsAWritableString &aCharsetDest) const { aCharsetDest = mCharset; return NS_OK; } -NS_IMETHODIMP CSSParserImpl::SetCharset(/*in*/ const nsString &aCharsetSrc) +NS_IMETHODIMP CSSParserImpl::SetCharset(/*in*/ const nsAReadableString &aCharsetSrc) { mCharset = aCharsetSrc; return NS_OK; diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 8b4c3180d963..cbff90538574 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -86,13 +86,9 @@ nsCSSProps::LookupProperty(const nsCString& aProperty) } nsCSSProperty -nsCSSProps::LookupProperty(const nsString& aProperty) -{ - NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); - if (gPropertyTable) { - return nsCSSProperty(gPropertyTable->Lookup(aProperty)); - } - return eCSSProperty_UNKNOWN; +nsCSSProps::LookupProperty(const nsAReadableString& aProperty) { + nsCAutoString theProp; theProp.AssignWithConversion(aProperty); + return LookupProperty(theProp); } const nsCString& diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 316d3506d38b..4456b7bb82f5 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -23,9 +23,7 @@ #define nsCSSProps_h___ #include "nslayout.h" - -class nsCString; -class nsString; +#include "nsString.h" /* Declare the enum list using the magic of preprocessing @@ -49,7 +47,7 @@ public: static void ReleaseTable(void); // Given a property string, return the enum value - static nsCSSProperty LookupProperty(const nsString& aProperty); + static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); static nsCSSProperty LookupProperty(const nsCString& aProperty); // Given a property enum, get the string value diff --git a/layout/style/nsCSSStruct.cpp b/layout/style/nsCSSStruct.cpp index 39f7adef9f7e..395e93399870 100644 --- a/layout/style/nsCSSStruct.cpp +++ b/layout/style/nsCSSStruct.cpp @@ -995,21 +995,21 @@ public: NS_IMETHOD AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValue); NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct); NS_IMETHOD SetValueImportant(nsCSSProperty aProperty); - NS_IMETHOD AppendComment(const nsString& aComment); + NS_IMETHOD AppendComment(const nsAReadableString& aComment); NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue); NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue); - NS_IMETHOD GetValue(nsCSSProperty aProperty, nsString& aValue); - NS_IMETHOD GetValue(const nsString& aProperty, nsString& aValue); + NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue); + NS_IMETHOD GetValue(const nsAReadableString& aProperty, nsAWritableString& aValue); NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult); NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty, PRBool& aIsImportant); - NS_IMETHOD GetValueIsImportant(const nsString& aProperty, PRBool& aIsImportant); + NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant); - PRBool AppendValueToString(nsCSSProperty aProperty, nsString& aResult); - PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult); + PRBool AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult); - NS_IMETHOD ToString(nsString& aString); + NS_IMETHOD ToString(nsAWritableString& aString); NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const; @@ -1018,7 +1018,7 @@ public: virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize); NS_IMETHOD Count(PRUint32* aCount); - NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn); NS_IMETHOD GetStyleImpact(PRInt32* aHint) const; @@ -3313,7 +3313,7 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) } NS_IMETHODIMP -CSSDeclarationImpl::AppendComment(const nsString& aComment) +CSSDeclarationImpl::AppendComment(const nsAReadableString& aComment) { nsresult result = NS_ERROR_OUT_OF_MEMORY; @@ -3913,20 +3913,21 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(const nsString& aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(const nsAReadableString& aProperty, + nsAWritableString& aValue) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); return GetValue(propID, aValue); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, nsAWritableString& aResult) { nsCSSValue value; GetValue(aProperty, value); return AppendValueToString(aProperty, value, aResult); } -PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsString& aResult) +PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAWritableString& aResult) { nsCSSUnit unit = aValue.GetUnit(); @@ -3936,10 +3937,14 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aResult.Append(NS_LITERAL_STRING("url(")); + break; + case eCSSUnit_Attr: aResult.Append(NS_LITERAL_STRING("attr(")); + break; + case eCSSUnit_Counter: aResult.Append(NS_LITERAL_STRING("counter(")); + break; + case eCSSUnit_Counters: aResult.Append(NS_LITERAL_STRING("counters(")); + break; default: break; } nsAutoString buffer; @@ -3952,17 +3957,23 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns case eCSSProperty_background_color: { // we can lookup the property in the ColorTable and then // get a string mapping the name - nsCString str; + nsAutoString tmpStr; + nsCAutoString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.AppendWithConversion(str); + aResult.Append(NS_ConvertASCIItoUCS2(str)); } else { - aResult.AppendInt(aValue.GetIntValue(), 10); + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); } } break; default: - aResult.AppendInt(aValue.GetIntValue(), 10); + { + nsAutoString tmpStr; + tmpStr.AppendInt(aValue.GetIntValue(), 10); + aResult.Append(tmpStr); + } } } else if (eCSSUnit_Enumerated == unit) { @@ -3974,119 +3985,136 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, mask))); intValue &= ~mask; if (0 != intValue) { // more left - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } } } } else { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE))); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND)))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.AppendWithConversion(' '); - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.Append(PRUnichar(' ')); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND))); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX))); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT))); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP))); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.AppendWithConversion(' '); + aResult.Append(PRUnichar(' ')); } - aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.Append(NS_ConvertASCIItoUCS2(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER))); } } else { const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.AppendWithConversion(name); + aResult.Append(NS_ConvertASCIItoUCS2(name)); } } else if (eCSSUnit_Color == unit){ + nsAutoString tmpStr; nscolor color = aValue.GetColorValue(); - aResult.AppendWithConversion("rgb("); - aResult.AppendInt(NS_GET_R(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_G(color), 10); - aResult.AppendWithConversion(","); - aResult.AppendInt(NS_GET_B(color), 10); - aResult.AppendWithConversion(')'); + + aResult.Append(NS_LITERAL_STRING("rgb(")); + + tmpStr.AppendInt(NS_GET_R(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_G(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(',')); + + tmpStr.Truncate(); + tmpStr.AppendInt(NS_GET_B(color), 10); + aResult.Append(tmpStr); + + aResult.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == unit) { - aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetPercentValue() * 100.0f); + aResult.Append(tmpStr); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.AppendFloat(aValue.GetFloatValue()); + nsAutoString tmpStr; + tmpStr.AppendFloat(aValue.GetFloatValue()); + aResult.Append(tmpStr); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aResult.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aResult.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aResult.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aResult.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aResult.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; + case eCSSUnit_Counters: aResult.Append(PRUnichar(')')); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; + case eCSSUnit_Percent: aResult.Append(PRUnichar('%')); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; - case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; + case eCSSUnit_Inch: aResult.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aResult.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aResult.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aResult.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aResult.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aResult.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aResult.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aResult.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aResult.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aResult.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aResult.Append(NS_LITERAL_STRING("cc")); break; - case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; - case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; + case eCSSUnit_EM: aResult.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aResult.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aResult.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aResult.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aResult.Append(NS_LITERAL_STRING("ch")); break; - case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; + case eCSSUnit_Pixel: aResult.Append(NS_LITERAL_STRING("px")); break; - case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; + case eCSSUnit_Degree: aResult.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aResult.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aResult.Append(NS_LITERAL_STRING("rad")); break; - case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; + case eCSSUnit_Hertz: aResult.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aResult.Append(NS_LITERAL_STRING("kHz")); break; - case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; + case eCSSUnit_Seconds: aResult.Append(PRUnichar('s')); break; + case eCSSUnit_Milliseconds: aResult.Append(NS_LITERAL_STRING("ms")); break; } return PR_TRUE; @@ -4102,7 +4130,8 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns (eCSSUnit_Null != strct->rect->mLeft.GetUnit())) NS_IMETHODIMP -CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) +CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, + nsAWritableString& aValue) { PRBool isImportant = PR_FALSE; GetValueIsImportant(aProperty, isImportant); @@ -4115,41 +4144,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(PRUnichar(' ')); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.AppendWithConversion("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); + aValue.Append(NS_LITERAL_STRING("rect(")); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.AppendWithConversion(")"); + aValue.Append(PRUnichar(')')); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -4160,62 +4189,62 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.AppendWithConversion('/'); + aValue.Append(PRUnichar('/')); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_pause_before, aValue); } break; case eCSSProperty_size: if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { AppendValueToString(eCSSProperty_size_width, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_size_height, aValue); } break; @@ -4224,13 +4253,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(PRUnichar(' ')); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(PRUnichar(' ')); shadow = shadow->mNext; } } @@ -4242,67 +4271,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(PRUnichar(' ')); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(PRUnichar(' ')); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -4313,7 +4342,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != content); } @@ -4324,13 +4353,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4341,13 +4370,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != data); } @@ -4356,7 +4385,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -4366,11 +4395,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != quotes); } @@ -4382,7 +4411,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.AppendWithConversion(' '); + aValue.Append(PRUnichar(' ')); } } while (nsnull != keyEquiv); } @@ -4408,7 +4437,7 @@ CSSDeclarationImpl::GetImportantValues(nsICSSDeclaration*& aResult) } NS_IMETHODIMP -CSSDeclarationImpl::GetValueIsImportant(const nsString& aProperty, +CSSDeclarationImpl::GetValueIsImportant(const nsAReadableString& aProperty, PRBool& aIsImportant) { nsCSSProperty propID = nsCSSProps::LookupProperty(aProperty); @@ -4438,7 +4467,7 @@ CSSDeclarationImpl::GetValueIsImportant(nsCSSProperty aProperty, } NS_IMETHODIMP -CSSDeclarationImpl::ToString(nsString& aString) +CSSDeclarationImpl::ToString(nsAWritableString& aString) { if (nsnull != mOrder) { PRInt32 count = mOrder->Count(); @@ -4446,21 +4475,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); - aString.AppendWithConversion(": "); + aString.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); + aString.Append(NS_LITERAL_STRING(": ")); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.AppendWithConversion("; "); + aString.Append(NS_LITERAL_STRING("; ")); } } else { // is comment - aString.AppendWithConversion("/* "); + aString.Append(NS_LITERAL_STRING("/* ")); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.AppendWithConversion(" */ "); + aString.Append(NS_LITERAL_STRING(" */ ")); } } } @@ -4607,13 +4636,13 @@ CSSDeclarationImpl::Count(PRUint32* aCount) } NS_IMETHODIMP -CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) +CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) { - aReturn.SetLength(0); + aReturn.Truncate(); if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aReturn.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(property))); } } diff --git a/layout/style/nsCSSStyleRule.cpp b/layout/style/nsCSSStyleRule.cpp index c4308979ab61..45dfc60e2565 100644 --- a/layout/style/nsCSSStyleRule.cpp +++ b/layout/style/nsCSSStyleRule.cpp @@ -793,14 +793,14 @@ public: DOMCSSDeclarationImpl(nsICSSStyleRule *aRule); ~DOMCSSDeclarationImpl(void); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); virtual void DropReference(void); virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl, PRBool aAllocate); virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl); - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl); virtual nsresult GetParent(nsISupports **aParent); @@ -826,8 +826,8 @@ DOMCSSDeclarationImpl::~DOMCSSDeclarationImpl(void) } NS_IMETHODIMP -DOMCSSDeclarationImpl::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +DOMCSSDeclarationImpl::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { aReturn.Truncate(); @@ -885,7 +885,7 @@ DOMCSSDeclarationImpl::SetCSSDeclaration(nsICSSDeclaration *aDecl) } nsresult -DOMCSSDeclarationImpl::ParseDeclaration(const nsString& aDecl, +DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) { @@ -3335,15 +3335,15 @@ CSSStyleRuleImpl::GetType(PRUint16* aType) } NS_IMETHODIMP -CSSStyleRuleImpl::GetCssText(nsString& aCssText) +CSSStyleRuleImpl::GetCssText(nsAWritableString& aCssText) { - aCssText = mSelectorText; + aCssText.Assign(mSelectorText); // XXX TBI append declaration too return NS_OK; } NS_IMETHODIMP -CSSStyleRuleImpl::SetCssText(const nsString& aCssText) +CSSStyleRuleImpl::SetCssText(const nsAReadableString& aCssText) { // XXX TBI - need to re-parse rule & declaration return NS_OK; @@ -3366,14 +3366,14 @@ CSSStyleRuleImpl::GetParentRule(nsIDOMCSSRule** aParentRule) } NS_IMETHODIMP -CSSStyleRuleImpl::GetSelectorText(nsString& aSelectorText) +CSSStyleRuleImpl::GetSelectorText(nsAWritableString& aSelectorText) { - aSelectorText = mSelectorText; + aSelectorText.Assign(mSelectorText); return NS_OK; } NS_IMETHODIMP -CSSStyleRuleImpl::SetSelectorText(const nsString& aSelectorText) +CSSStyleRuleImpl::SetSelectorText(const nsAReadableString& aSelectorText) { // XXX TBI - get a parser and re-parse the selectors, // XXX then need to re-compute the cascade diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index f06ad1af8249..2f0d70b0b1ca 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -793,7 +793,7 @@ DOMMediaListImpl::SetScriptObject(void* aScriptObject) } NS_IMETHODIMP -DOMMediaListImpl::GetMediaText(nsString& aMediaText) +DOMMediaListImpl::GetMediaText(nsAWritableString& aMediaText) { aMediaText.Truncate(); @@ -814,7 +814,7 @@ DOMMediaListImpl::GetMediaText(nsString& aMediaText) medium->GetUnicode(&buffer); aMediaText.Append(buffer); if (index < count) { - aMediaText.AppendWithConversion(", "); + aMediaText.Append(NS_LITERAL_STRING(", ")); } } @@ -822,7 +822,7 @@ DOMMediaListImpl::GetMediaText(nsString& aMediaText) } NS_IMETHODIMP -DOMMediaListImpl::SetMediaText(const nsString& aMediaText) +DOMMediaListImpl::SetMediaText(const nsAReadableString& aMediaText) { nsresult rv = Clear(); NS_ENSURE_SUCCESS(rv, rv); @@ -869,7 +869,7 @@ DOMMediaListImpl::GetLength(PRUint32* aLength) } NS_IMETHODIMP -DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn) +DOMMediaListImpl::Item(PRUint32 aIndex, nsAWritableString& aReturn) { nsCOMPtr tmp(dont_AddRef(ElementAt(aIndex))); @@ -888,7 +888,7 @@ DOMMediaListImpl::Item(PRUint32 aIndex, nsString& aReturn) } NS_IMETHODIMP -DOMMediaListImpl::Delete(const nsString& aOldMedium) +DOMMediaListImpl::Delete(const nsAReadableString& aOldMedium) { if (!aOldMedium.Length()) return NS_ERROR_DOM_NOT_FOUND_ERR; @@ -908,7 +908,7 @@ DOMMediaListImpl::Delete(const nsString& aOldMedium) } NS_IMETHODIMP -DOMMediaListImpl::Append(const nsString& aNewMedium) +DOMMediaListImpl::Append(const nsAReadableString& aNewMedium) { if (!aNewMedium.Length()) return NS_ERROR_DOM_NOT_FOUND_ERR; @@ -2302,9 +2302,9 @@ CSSStyleSheetImpl::SetModified(PRBool aModified) // nsIDOMStyleSheet interface NS_IMETHODIMP -CSSStyleSheetImpl::GetType(nsString& aType) +CSSStyleSheetImpl::GetType(nsAWritableString& aType) { - aType.AssignWithConversion("text/css"); + aType.Assign(NS_LITERAL_STRING("text/css")); return NS_OK; } @@ -2354,12 +2354,12 @@ CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) } NS_IMETHODIMP -CSSStyleSheetImpl::GetHref(nsString& aHref) +CSSStyleSheetImpl::GetHref(nsAWritableString& aHref) { if (mInner && mInner->mURL) { char* str = nsnull; mInner->mURL->GetSpec(&str); - aHref.AssignWithConversion(str); + aHref.Assign(NS_ConvertASCIItoUCS2(str)); if (str) { nsCRT::free(str); } @@ -2379,9 +2379,9 @@ CSSStyleSheetImpl::GetTitle(nsString& aTitle) const } NS_IMETHODIMP -CSSStyleSheetImpl::GetTitle(nsString& aTitle) +CSSStyleSheetImpl::GetTitle(nsAWritableString& aTitle) { - aTitle = mTitle; + aTitle.Assign(mTitle); return NS_OK; } @@ -2436,7 +2436,7 @@ CSSStyleSheetImpl::GetCssRules(nsIDOMCSSRuleList** aCssRules) } NS_IMETHODIMP -CSSStyleSheetImpl::InsertRule(const nsString& aRule, +CSSStyleSheetImpl::InsertRule(const nsAReadableString& aRule, PRUint32 aIndex, PRUint32* aReturn) { diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 9c7f317d1e8c..0ddd9b70e290 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -23,6 +23,7 @@ #include "nsString.h" #include "nsCSSProps.h" #include "nsUnitConversion.h" +#include "nsReadableUtils.h" //#include "nsStyleConsts.h" @@ -65,12 +66,12 @@ nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit) } } -nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit) +nsCSSValue::nsCSSValue(const nsAReadableString& aValue, nsCSSUnit aUnit) : mUnit(aUnit) { NS_ASSERTION((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters), "not a string value"); if ((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters)) { - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } else { mUnit = eCSSUnit_Null; @@ -235,13 +236,14 @@ void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit) } } -void nsCSSValue::SetStringValue(const nsString& aValue, nsCSSUnit aUnit) +void nsCSSValue::SetStringValue(const nsAReadableString& aValue, + nsCSSUnit aUnit) { NS_ASSERTION((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters), "not a string unit"); Reset(); if ((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Counters)) { mUnit = aUnit; - mValue.mString = aValue.ToNewUnicode(); + mValue.mString = ToNewUnicode(aValue); } } @@ -276,103 +278,132 @@ void nsCSSValue::SetNormalValue(void) mUnit = eCSSUnit_Normal; } -void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const +void nsCSSValue::AppendToString(nsAWritableString& aBuffer, + nsCSSProperty aPropID) const { if (eCSSUnit_Null == mUnit) { return; } if (-1 < aPropID) { - aBuffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); - aBuffer.AppendWithConversion(": "); + aBuffer.Append(NS_ConvertASCIItoUCS2(nsCSSProps::GetStringValue(aPropID))); + aBuffer.Append(NS_LITERAL_STRING(": ")); } if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) { switch (mUnit) { - case eCSSUnit_URL: aBuffer.AppendWithConversion("url("); break; - case eCSSUnit_Attr: aBuffer.AppendWithConversion("attr("); break; - case eCSSUnit_Counter: aBuffer.AppendWithConversion("counter("); break; - case eCSSUnit_Counters: aBuffer.AppendWithConversion("counters("); break; + case eCSSUnit_URL: aBuffer.Append(NS_LITERAL_STRING("url(")); break; + case eCSSUnit_Attr: aBuffer.Append(NS_LITERAL_STRING("attr(")); break; + case eCSSUnit_Counter: aBuffer.Append(NS_LITERAL_STRING("counter(")); break; + case eCSSUnit_Counters: aBuffer.Append(NS_LITERAL_STRING("counters(")); break; default: break; } if (nsnull != mValue.mString) { - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); aBuffer.Append(mValue.mString); - aBuffer.AppendWithConversion('"'); + aBuffer.Append(PRUnichar('"')); } else { - aBuffer.AppendWithConversion("null str"); + aBuffer.Append(NS_LITERAL_STRING("null str")); } } else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); + nsAutoString intStr; + intStr.AppendInt(mValue.mInt, 10); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING("[0x")); + + intStr.Truncate(); + intStr.AppendInt(mValue.mInt, 16); + aBuffer.Append(intStr); + + aBuffer.Append(PRUnichar(']')); } else if (eCSSUnit_Color == mUnit){ - aBuffer.AppendWithConversion("(0x"); - aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); - aBuffer.AppendWithConversion(" 0x"); - aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); - aBuffer.AppendWithConversion(')'); + aBuffer.Append(NS_LITERAL_STRING("(0x")); + + nsAutoString intStr; + intStr.AppendInt(NS_GET_R(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_G(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_B(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(NS_LITERAL_STRING(" 0x")); + + intStr.Truncate(); + intStr.AppendInt(NS_GET_A(mValue.mColor), 16); + aBuffer.Append(intStr); + + aBuffer.Append(PRUnichar(')')); } else if (eCSSUnit_Percent == mUnit) { - aBuffer.AppendFloat(mValue.mFloat * 100.0f); + nsAutoString floatString; + floatString.AppendFloat(mValue.mFloat * 100.0f); + aBuffer.Append(floatString); } else if (eCSSUnit_Percent < mUnit) { - aBuffer.AppendFloat(mValue.mFloat); + nsAutoString floatString; + floatString.AppendFloat(mValue.mFloat); + aBuffer.Append(floatString); } switch (mUnit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aBuffer.AppendWithConversion("auto"); break; - case eCSSUnit_Inherit: aBuffer.AppendWithConversion("inherit"); break; - case eCSSUnit_None: aBuffer.AppendWithConversion("none"); break; - case eCSSUnit_Normal: aBuffer.AppendWithConversion("normal"); break; + case eCSSUnit_Auto: aBuffer.Append(NS_LITERAL_STRING("auto")); break; + case eCSSUnit_Inherit: aBuffer.Append(NS_LITERAL_STRING("inherit")); break; + case eCSSUnit_None: aBuffer.Append(NS_LITERAL_STRING("none")); break; + case eCSSUnit_Normal: aBuffer.Append(NS_LITERAL_STRING("normal")); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aBuffer.AppendWithConversion(')'); break; - case eCSSUnit_Integer: aBuffer.AppendWithConversion("int"); break; - case eCSSUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eCSSUnit_Color: aBuffer.AppendWithConversion("rbga"); break; - case eCSSUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eCSSUnit_Number: aBuffer.AppendWithConversion("#"); break; - case eCSSUnit_Inch: aBuffer.AppendWithConversion("in"); break; - case eCSSUnit_Foot: aBuffer.AppendWithConversion("ft"); break; - case eCSSUnit_Mile: aBuffer.AppendWithConversion("mi"); break; - case eCSSUnit_Millimeter: aBuffer.AppendWithConversion("mm"); break; - case eCSSUnit_Centimeter: aBuffer.AppendWithConversion("cm"); break; - case eCSSUnit_Meter: aBuffer.AppendWithConversion("m"); break; - case eCSSUnit_Kilometer: aBuffer.AppendWithConversion("km"); break; - case eCSSUnit_Point: aBuffer.AppendWithConversion("pt"); break; - case eCSSUnit_Pica: aBuffer.AppendWithConversion("pc"); break; - case eCSSUnit_Didot: aBuffer.AppendWithConversion("dt"); break; - case eCSSUnit_Cicero: aBuffer.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aBuffer.AppendWithConversion("em"); break; - case eCSSUnit_EN: aBuffer.AppendWithConversion("en"); break; - case eCSSUnit_XHeight: aBuffer.AppendWithConversion("ex"); break; - case eCSSUnit_CapHeight: aBuffer.AppendWithConversion("cap"); break; - case eCSSUnit_Char: aBuffer.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aBuffer.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aBuffer.AppendWithConversion("deg"); break; - case eCSSUnit_Grad: aBuffer.AppendWithConversion("grad"); break; - case eCSSUnit_Radian: aBuffer.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aBuffer.AppendWithConversion("Hz"); break; - case eCSSUnit_Kilohertz: aBuffer.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aBuffer.AppendWithConversion("s"); break; - case eCSSUnit_Milliseconds: aBuffer.AppendWithConversion("ms"); break; + case eCSSUnit_Counters: aBuffer.Append(NS_LITERAL_STRING(")")); break; + case eCSSUnit_Integer: aBuffer.Append(NS_LITERAL_STRING("int")); break; + case eCSSUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; + case eCSSUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; + case eCSSUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; + case eCSSUnit_Number: aBuffer.Append(NS_LITERAL_STRING("#")); break; + case eCSSUnit_Inch: aBuffer.Append(NS_LITERAL_STRING("in")); break; + case eCSSUnit_Foot: aBuffer.Append(NS_LITERAL_STRING("ft")); break; + case eCSSUnit_Mile: aBuffer.Append(NS_LITERAL_STRING("mi")); break; + case eCSSUnit_Millimeter: aBuffer.Append(NS_LITERAL_STRING("mm")); break; + case eCSSUnit_Centimeter: aBuffer.Append(NS_LITERAL_STRING("cm")); break; + case eCSSUnit_Meter: aBuffer.Append(NS_LITERAL_STRING("m")); break; + case eCSSUnit_Kilometer: aBuffer.Append(NS_LITERAL_STRING("km")); break; + case eCSSUnit_Point: aBuffer.Append(NS_LITERAL_STRING("pt")); break; + case eCSSUnit_Pica: aBuffer.Append(NS_LITERAL_STRING("pc")); break; + case eCSSUnit_Didot: aBuffer.Append(NS_LITERAL_STRING("dt")); break; + case eCSSUnit_Cicero: aBuffer.Append(NS_LITERAL_STRING("cc")); break; + case eCSSUnit_EM: aBuffer.Append(NS_LITERAL_STRING("em")); break; + case eCSSUnit_EN: aBuffer.Append(NS_LITERAL_STRING("en")); break; + case eCSSUnit_XHeight: aBuffer.Append(NS_LITERAL_STRING("ex")); break; + case eCSSUnit_CapHeight: aBuffer.Append(NS_LITERAL_STRING("cap")); break; + case eCSSUnit_Char: aBuffer.Append(NS_LITERAL_STRING("ch")); break; + case eCSSUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; + case eCSSUnit_Degree: aBuffer.Append(NS_LITERAL_STRING("deg")); break; + case eCSSUnit_Grad: aBuffer.Append(NS_LITERAL_STRING("grad")); break; + case eCSSUnit_Radian: aBuffer.Append(NS_LITERAL_STRING("rad")); break; + case eCSSUnit_Hertz: aBuffer.Append(NS_LITERAL_STRING("Hz")); break; + case eCSSUnit_Kilohertz: aBuffer.Append(NS_LITERAL_STRING("kHz")); break; + case eCSSUnit_Seconds: aBuffer.Append(NS_LITERAL_STRING("s")); break; + case eCSSUnit_Milliseconds: aBuffer.Append(NS_LITERAL_STRING("ms")); break; } - aBuffer.AppendWithConversion(' '); + aBuffer.Append(NS_LITERAL_STRING(" ")); } -void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const +void nsCSSValue::ToString(nsAWritableString& aBuffer, + nsCSSProperty aPropID) const { aBuffer.Truncate(); AppendToString(aBuffer, aPropID); diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index 70f11fe34f08..0079fc41bcf9 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -96,7 +96,7 @@ public: nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null); // for valueless units only (null, auto, inherit, none, normal) nsCSSValue(PRInt32 aValue, nsCSSUnit aUnit); nsCSSValue(float aValue, nsCSSUnit aUnit); - nsCSSValue(const nsString& aValue, nsCSSUnit aUnit); + nsCSSValue(const nsAReadableString& aValue, nsCSSUnit aUnit); nsCSSValue(nscolor aValue); nsCSSValue(const nsCSSValue& aCopy); ~nsCSSValue(void); @@ -122,7 +122,7 @@ public: PRInt32 GetIntValue(void) const; float GetPercentValue(void) const; float GetFloatValue(void) const; - nsString& GetStringValue(nsString& aBuffer) const; + nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; nscolor GetColorValue(void) const; nscoord GetLengthTwips(void) const; @@ -130,7 +130,7 @@ public: void SetIntValue(PRInt32 aValue, nsCSSUnit aUnit); void SetPercentValue(float aValue); void SetFloatValue(float aValue, nsCSSUnit aUnit); - void SetStringValue(const nsString& aValue, nsCSSUnit aUnit); + void SetStringValue(const nsAReadableString& aValue, nsCSSUnit aUnit); void SetColorValue(nscolor aValue); void SetAutoValue(void); void SetInheritValue(void); @@ -138,8 +138,8 @@ public: void SetNormalValue(void); // debugging methods only - void AppendToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; - void ToString(nsString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; + void AppendToString(nsAWritableString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; + void ToString(nsAWritableString& aBuffer, nsCSSProperty aPropID = eCSSProperty_UNKNOWN) const; protected: nsCSSUnit mUnit; @@ -180,7 +180,7 @@ inline float nsCSSValue::GetFloatValue(void) const return 0.0f; } -inline nsString& nsCSSValue::GetStringValue(nsString& aBuffer) const +inline nsAWritableString& nsCSSValue::GetStringValue(nsAWritableString& aBuffer) const { NS_ASSERTION((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters), "not a string value"); aBuffer.Truncate(); diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 1377424eb13a..102170bf8b34 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -50,7 +50,7 @@ public: NS_DECL_ISUPPORTS // nsIComputedDOMStyle - NS_IMETHOD Init(nsIDOMElement *aElement, const nsString& aPseudoElt, + NS_IMETHOD Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell); // nsIDOMCSSStyleDeclaration @@ -155,7 +155,7 @@ nsComputedDOMStyle::SetScriptObject(void* aScriptObject) NS_IMETHODIMP -nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsString& aPseudoElt, +nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell) { NS_ENSURE_ARG_POINTER(aElement); @@ -181,7 +181,7 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement, const nsString& aPseudoElt, } NS_IMETHODIMP -nsComputedDOMStyle::GetCssText(nsString& aCssText) +nsComputedDOMStyle::GetCssText(nsAWritableString& aCssText) { aCssText.Truncate(); return NS_OK; @@ -189,7 +189,7 @@ nsComputedDOMStyle::GetCssText(nsString& aCssText) NS_IMETHODIMP -nsComputedDOMStyle::SetCssText(const nsString& aCssText) +nsComputedDOMStyle::SetCssText(const nsAReadableString& aCssText) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -215,8 +215,8 @@ nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule) NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCOMPtr val; @@ -234,7 +234,7 @@ nsComputedDOMStyle::GetPropertyValue(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, +nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -246,6 +246,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, nsCOMPtr val; nsresult rv = NS_OK; + // XXX FIX THIS!!! nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName); switch (prop) { @@ -278,16 +279,16 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn) +nsComputedDOMStyle::GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { aReturn.Truncate(); return NS_OK; @@ -295,16 +296,16 @@ nsComputedDOMStyle::GetPropertyPriority(const nsString& aPropertyName, NS_IMETHODIMP -nsComputedDOMStyle::SetProperty(const nsString& aPropertyName, - const nsString& aValue, - const nsString& aPriority) +nsComputedDOMStyle::SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, + const nsAReadableString& aPriority) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::Item(PRUint32 aIndex, nsString& aReturn) +nsComputedDOMStyle::Item(PRUint32 aIndex, nsAWritableString& aReturn) { aReturn.Truncate(); return NS_OK; @@ -316,43 +317,43 @@ nsComputedDOMStyle::Item(PRUint32 aIndex, nsString& aReturn) #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetAzimuth(nsString& aAzimuth) +nsComputedDOMStyle::GetAzimuth(nsAWritableString& aAzimuth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackground(nsString& aBackground) +nsComputedDOMStyle::GetBackground(nsAWritableString& aBackground) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundAttachment(nsString& aBackgroundAttachment) +nsComputedDOMStyle::GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundColor(nsString& aBackgroundColor) +nsComputedDOMStyle::GetBackgroundColor(nsAWritableString& aBackgroundColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundImage(nsString& aBackgroundImage) +nsComputedDOMStyle::GetBackgroundImage(nsAWritableString& aBackgroundImage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundPosition(nsString& aBackgroundPosition) +nsComputedDOMStyle::GetBackgroundPosition(nsAWritableString& aBackgroundPosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBackgroundRepeat(nsString& aBackgroundRepeat) +nsComputedDOMStyle::GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -400,133 +401,133 @@ nsComputedDOMStyle::GetBehavior(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetBorder(nsString& aBorder) +nsComputedDOMStyle::GetBorder(nsAWritableString& aBorder) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderCollapse(nsString& aBorderCollapse) +nsComputedDOMStyle::GetBorderCollapse(nsAWritableString& aBorderCollapse) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderColor(nsString& aBorderColor) +nsComputedDOMStyle::GetBorderColor(nsAWritableString& aBorderColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderSpacing(nsString& aBorderSpacing) +nsComputedDOMStyle::GetBorderSpacing(nsAWritableString& aBorderSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderStyle(nsString& aBorderStyle) +nsComputedDOMStyle::GetBorderStyle(nsAWritableString& aBorderStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTop(nsString& aBorderTop) +nsComputedDOMStyle::GetBorderTop(nsAWritableString& aBorderTop) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRight(nsString& aBorderRight) +nsComputedDOMStyle::GetBorderRight(nsAWritableString& aBorderRight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottom(nsString& aBorderBottom) +nsComputedDOMStyle::GetBorderBottom(nsAWritableString& aBorderBottom) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeft(nsString& aBorderLeft) +nsComputedDOMStyle::GetBorderLeft(nsAWritableString& aBorderLeft) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopColor(nsString& aBorderTopColor) +nsComputedDOMStyle::GetBorderTopColor(nsAWritableString& aBorderTopColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightColor(nsString& aBorderRightColor) +nsComputedDOMStyle::GetBorderRightColor(nsAWritableString& aBorderRightColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomColor(nsString& aBorderBottomColor) +nsComputedDOMStyle::GetBorderBottomColor(nsAWritableString& aBorderBottomColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftColor(nsString& aBorderLeftColor) +nsComputedDOMStyle::GetBorderLeftColor(nsAWritableString& aBorderLeftColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopStyle(nsString& aBorderTopStyle) +nsComputedDOMStyle::GetBorderTopStyle(nsAWritableString& aBorderTopStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightStyle(nsString& aBorderRightStyle) +nsComputedDOMStyle::GetBorderRightStyle(nsAWritableString& aBorderRightStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomStyle(nsString& aBorderBottomStyle) +nsComputedDOMStyle::GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftStyle(nsString& aBorderLeftStyle) +nsComputedDOMStyle::GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderTopWidth(nsString& aBorderTopWidth) +nsComputedDOMStyle::GetBorderTopWidth(nsAWritableString& aBorderTopWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderRightWidth(nsString& aBorderRightWidth) +nsComputedDOMStyle::GetBorderRightWidth(nsAWritableString& aBorderRightWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderBottomWidth(nsString& aBorderBottomWidth) +nsComputedDOMStyle::GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderLeftWidth(nsString& aBorderLeftWidth) +nsComputedDOMStyle::GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetBorderWidth(nsString& aBorderWidth) +nsComputedDOMStyle::GetBorderWidth(nsAWritableString& aBorderWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -552,79 +553,79 @@ nsComputedDOMStyle::GetBottom(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetCaptionSide(nsString& aCaptionSide) +nsComputedDOMStyle::GetCaptionSide(nsAWritableString& aCaptionSide) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetClear(nsString& aClear) +nsComputedDOMStyle::GetClear(nsAWritableString& aClear) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetClip(nsString& aClip) +nsComputedDOMStyle::GetClip(nsAWritableString& aClip) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetColor(nsString& aColor) +nsComputedDOMStyle::GetColor(nsAWritableString& aColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetContent(nsString& aContent) +nsComputedDOMStyle::GetContent(nsAWritableString& aContent) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCounterIncrement(nsString& aCounterIncrement) +nsComputedDOMStyle::GetCounterIncrement(nsAWritableString& aCounterIncrement) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCounterReset(nsString& aCounterReset) +nsComputedDOMStyle::GetCounterReset(nsAWritableString& aCounterReset) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCssFloat(nsString& aCssFloat) +nsComputedDOMStyle::GetCssFloat(nsAWritableString& aCssFloat) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCue(nsString& aCue) +nsComputedDOMStyle::GetCue(nsAWritableString& aCue) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCueAfter(nsString& aCueAfter) +nsComputedDOMStyle::GetCueAfter(nsAWritableString& aCueAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCueBefore(nsString& aCueBefore) +nsComputedDOMStyle::GetCueBefore(nsAWritableString& aCueBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetCursor(nsString& aCursor) +nsComputedDOMStyle::GetCursor(nsAWritableString& aCursor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetDirection(nsString& aDirection) +nsComputedDOMStyle::GetDirection(nsAWritableString& aDirection) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -700,61 +701,61 @@ nsComputedDOMStyle::GetDisplay(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetElevation(nsString& aElevation) +nsComputedDOMStyle::GetElevation(nsAWritableString& aElevation) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetEmptyCells(nsString& aEmptyCells) +nsComputedDOMStyle::GetEmptyCells(nsAWritableString& aEmptyCells) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFont(nsString& aFont) +nsComputedDOMStyle::GetFont(nsAWritableString& aFont) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontFamily(nsString& aFontFamily) +nsComputedDOMStyle::GetFontFamily(nsAWritableString& aFontFamily) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontSize(nsString& aFontSize) +nsComputedDOMStyle::GetFontSize(nsAWritableString& aFontSize) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontSizeAdjust(nsString& aFontSizeAdjust) +nsComputedDOMStyle::GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontStretch(nsString& aFontStretch) +nsComputedDOMStyle::GetFontStretch(nsAWritableString& aFontStretch) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontStyle(nsString& aFontStyle) +nsComputedDOMStyle::GetFontStyle(nsAWritableString& aFontStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontVariant(nsString& aFontVariant) +nsComputedDOMStyle::GetFontVariant(nsAWritableString& aFontVariant) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetFontWeight(nsString& aFontWeight) +nsComputedDOMStyle::GetFontWeight(nsAWritableString& aFontWeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -799,43 +800,43 @@ nsComputedDOMStyle::GetLeft(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetLetterSpacing(nsString& aLetterSpacing) +nsComputedDOMStyle::GetLetterSpacing(nsAWritableString& aLetterSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetLineHeight(nsString& aLineHeight) +nsComputedDOMStyle::GetLineHeight(nsAWritableString& aLineHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyle(nsString& aListStyle) +nsComputedDOMStyle::GetListStyle(nsAWritableString& aListStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyleImage(nsString& aListStyleImage) +nsComputedDOMStyle::GetListStyleImage(nsAWritableString& aListStyleImage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStylePosition(nsString& aListStylePosition) +nsComputedDOMStyle::GetListStylePosition(nsAWritableString& aListStylePosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetListStyleType(nsString& aListStyleType) +nsComputedDOMStyle::GetListStyleType(nsAWritableString& aListStyleType) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMargin(nsString& aMargin) +nsComputedDOMStyle::GetMargin(nsAWritableString& aMargin) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -885,181 +886,181 @@ nsComputedDOMStyle::GetMarginLeft(nsIFrame *aFrame, } NS_IMETHODIMP -nsComputedDOMStyle::GetMarkerOffset(nsString& aMarkerOffset) +nsComputedDOMStyle::GetMarkerOffset(nsAWritableString& aMarkerOffset) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMarks(nsString& aMarks) +nsComputedDOMStyle::GetMarks(nsAWritableString& aMarks) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMaxHeight(nsString& aMaxHeight) +nsComputedDOMStyle::GetMaxHeight(nsAWritableString& aMaxHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMaxWidth(nsString& aMaxWidth) +nsComputedDOMStyle::GetMaxWidth(nsAWritableString& aMaxWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMinHeight(nsString& aMinHeight) +nsComputedDOMStyle::GetMinHeight(nsAWritableString& aMinHeight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetMinWidth(nsString& aMinWidth) +nsComputedDOMStyle::GetMinWidth(nsAWritableString& aMinWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOrphans(nsString& aOrphans) +nsComputedDOMStyle::GetOrphans(nsAWritableString& aOrphans) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutline(nsString& aOutline) +nsComputedDOMStyle::GetOutline(nsAWritableString& aOutline) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineColor(nsString& aOutlineColor) +nsComputedDOMStyle::GetOutlineColor(nsAWritableString& aOutlineColor) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineStyle(nsString& aOutlineStyle) +nsComputedDOMStyle::GetOutlineStyle(nsAWritableString& aOutlineStyle) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOutlineWidth(nsString& aOutlineWidth) +nsComputedDOMStyle::GetOutlineWidth(nsAWritableString& aOutlineWidth) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOverflow(nsString& aOverflow) +nsComputedDOMStyle::GetOverflow(nsAWritableString& aOverflow) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPadding(nsString& aPadding) +nsComputedDOMStyle::GetPadding(nsAWritableString& aPadding) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingTop(nsString& aPaddingTop) +nsComputedDOMStyle::GetPaddingTop(nsAWritableString& aPaddingTop) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingRight(nsString& aPaddingRight) +nsComputedDOMStyle::GetPaddingRight(nsAWritableString& aPaddingRight) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingBottom(nsString& aPaddingBottom) +nsComputedDOMStyle::GetPaddingBottom(nsAWritableString& aPaddingBottom) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPaddingLeft(nsString& aPaddingLeft) +nsComputedDOMStyle::GetPaddingLeft(nsAWritableString& aPaddingLeft) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPage(nsString& aPage) +nsComputedDOMStyle::GetPage(nsAWritableString& aPage) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakAfter(nsString& aPageBreakAfter) +nsComputedDOMStyle::GetPageBreakAfter(nsAWritableString& aPageBreakAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakBefore(nsString& aPageBreakBefore) +nsComputedDOMStyle::GetPageBreakBefore(nsAWritableString& aPageBreakBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPageBreakInside(nsString& aPageBreakInside) +nsComputedDOMStyle::GetPageBreakInside(nsAWritableString& aPageBreakInside) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPause(nsString& aPause) +nsComputedDOMStyle::GetPause(nsAWritableString& aPause) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPauseAfter(nsString& aPauseAfter) +nsComputedDOMStyle::GetPauseAfter(nsAWritableString& aPauseAfter) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPauseBefore(nsString& aPauseBefore) +nsComputedDOMStyle::GetPauseBefore(nsAWritableString& aPauseBefore) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPitch(nsString& aPitch) +nsComputedDOMStyle::GetPitch(nsAWritableString& aPitch) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPitchRange(nsString& aPitchRange) +nsComputedDOMStyle::GetPitchRange(nsAWritableString& aPitchRange) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPlayDuring(nsString& aPlayDuring) +nsComputedDOMStyle::GetPlayDuring(nsAWritableString& aPlayDuring) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetPosition(nsString& aPosition) +nsComputedDOMStyle::GetPosition(nsAWritableString& aPosition) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetQuotes(nsString& aQuotes) +nsComputedDOMStyle::GetQuotes(nsAWritableString& aQuotes) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetRichness(nsString& aRichness) +nsComputedDOMStyle::GetRichness(nsAWritableString& aRichness) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1085,79 +1086,79 @@ nsComputedDOMStyle::GetRight(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetSize(nsString& aSize) +nsComputedDOMStyle::GetSize(nsAWritableString& aSize) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeak(nsString& aSpeak) +nsComputedDOMStyle::GetSpeak(nsAWritableString& aSpeak) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakHeader(nsString& aSpeakHeader) +nsComputedDOMStyle::GetSpeakHeader(nsAWritableString& aSpeakHeader) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakNumeral(nsString& aSpeakNumeral) +nsComputedDOMStyle::GetSpeakNumeral(nsAWritableString& aSpeakNumeral) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeakPunctuation(nsString& aSpeakPunctuation) +nsComputedDOMStyle::GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetSpeechRate(nsString& aSpeechRate) +nsComputedDOMStyle::GetSpeechRate(nsAWritableString& aSpeechRate) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetStress(nsString& aStress) +nsComputedDOMStyle::GetStress(nsAWritableString& aStress) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTableLayout(nsString& aTableLayout) +nsComputedDOMStyle::GetTableLayout(nsAWritableString& aTableLayout) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextAlign(nsString& aTextAlign) +nsComputedDOMStyle::GetTextAlign(nsAWritableString& aTextAlign) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextDecoration(nsString& aTextDecoration) +nsComputedDOMStyle::GetTextDecoration(nsAWritableString& aTextDecoration) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextIndent(nsString& aTextIndent) +nsComputedDOMStyle::GetTextIndent(nsAWritableString& aTextIndent) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextShadow(nsString& aTextShadow) +nsComputedDOMStyle::GetTextShadow(nsAWritableString& aTextShadow) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetTextTransform(nsString& aTextTransform) +nsComputedDOMStyle::GetTextTransform(nsAWritableString& aTextTransform) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1183,43 +1184,43 @@ nsComputedDOMStyle::GetTop(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetUnicodeBidi(nsString& aUnicodeBidi) +nsComputedDOMStyle::GetUnicodeBidi(nsAWritableString& aUnicodeBidi) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVerticalAlign(nsString& aVerticalAlign) +nsComputedDOMStyle::GetVerticalAlign(nsAWritableString& aVerticalAlign) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVisibility(nsString& aVisibility) +nsComputedDOMStyle::GetVisibility(nsAWritableString& aVisibility) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVoiceFamily(nsString& aVoiceFamily) +nsComputedDOMStyle::GetVoiceFamily(nsAWritableString& aVoiceFamily) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetVolume(nsString& aVolume) +nsComputedDOMStyle::GetVolume(nsAWritableString& aVolume) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetWhiteSpace(nsString& aWhiteSpace) +nsComputedDOMStyle::GetWhiteSpace(nsAWritableString& aWhiteSpace) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetWidows(nsString& aWidows) +nsComputedDOMStyle::GetWidows(nsAWritableString& aWidows) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } @@ -1322,19 +1323,19 @@ nsComputedDOMStyle::GetWidth(nsIFrame *aFrame, #if 0 NS_IMETHODIMP -nsComputedDOMStyle::GetWordSpacing(nsString& aWordSpacing) +nsComputedDOMStyle::GetWordSpacing(nsAWritableString& aWordSpacing) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetZIndex(nsString& aZIndex) +nsComputedDOMStyle::GetZIndex(nsAWritableString& aZIndex) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } NS_IMETHODIMP -nsComputedDOMStyle::GetOpacity(nsString& aOpacity) +nsComputedDOMStyle::GetOpacity(nsAWritableString& aOpacity) { return NS_ERROR_DOM_NOT_SUPPORTED_ERR; } diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index 702fde9fb2b9..d51295653546 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -115,7 +115,7 @@ nsDOMCSSDeclaration::SetScriptObject(void* aScriptObject) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCssText(nsString& aCssText) +nsDOMCSSDeclaration::GetCssText(nsAWritableString& aCssText) { aCssText.Truncate(); // XXX TBI @@ -123,7 +123,7 @@ nsDOMCSSDeclaration::GetCssText(nsString& aCssText) } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCssText(const nsString& aCssText) +nsDOMCSSDeclaration::SetCssText(const nsAReadableString& aCssText) { // XXX TBI return NS_OK; @@ -162,7 +162,7 @@ nsDOMCSSDeclaration::GetParentRule(nsIDOMCSSRule** aParentRule) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyCSSValue(const nsString& aPropertyName, +nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -174,7 +174,7 @@ nsDOMCSSDeclaration::GetPropertyCSSValue(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsString& aReturn) +nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsAWritableString& aReturn) { nsICSSDeclaration *decl; nsresult result = GetCSSDeclaration(&decl, PR_FALSE); @@ -189,8 +189,8 @@ nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsString& aReturn) } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSDeclaration::GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsCSSValue val; nsICSSDeclaration *decl; @@ -206,8 +206,8 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn) +nsDOMCSSDeclaration::GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) { nsICSSDeclaration *decl; nsresult result = GetCSSDeclaration(&decl, PR_FALSE); @@ -219,7 +219,7 @@ nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, } if ((NS_OK == result) && isImportant) { - aReturn.AssignWithConversion("!important"); + aReturn.Assign(NS_LITERAL_STRING("!important")); } else { aReturn.SetLength(0); @@ -229,9 +229,9 @@ nsDOMCSSDeclaration::GetPropertyPriority(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, - const nsString& aValue, - const nsString& aPriority) +nsDOMCSSDeclaration::SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, + const nsAReadableString& aPriority) { if (!aValue.Length()) { // If the new value of the property is an empty string we remove the @@ -243,7 +243,7 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, nsAutoString declString; declString.Assign(aPropertyName); - declString.AppendWithConversion(":"); + declString.Append(PRUnichar(':')); declString.Append(aValue); declString.Append(aPriority); @@ -251,1490 +251,1490 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName, } NS_IMETHODIMP -nsDOMCSSDeclaration::GetAzimuth(nsString& aAzimuth) +nsDOMCSSDeclaration::GetAzimuth(nsAWritableString& aAzimuth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("azimuth"), aAzimuth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetAzimuth(const nsString& aAzimuth) +nsDOMCSSDeclaration::SetAzimuth(const nsAReadableString& aAzimuth) { return SetProperty(NS_ConvertASCIItoUCS2("azimuth"), aAzimuth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackground(nsString& aBackground) +nsDOMCSSDeclaration::GetBackground(nsAWritableString& aBackground) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background"), aBackground); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackground(const nsString& aBackground) +nsDOMCSSDeclaration::SetBackground(const nsAReadableString& aBackground) { return SetProperty(NS_ConvertASCIItoUCS2("background"), aBackground, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundAttachment(nsString& aBackgroundAttachment) +nsDOMCSSDeclaration::GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-attachment"), aBackgroundAttachment); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundAttachment(const nsString& aBackgroundAttachment) +nsDOMCSSDeclaration::SetBackgroundAttachment(const nsAReadableString& aBackgroundAttachment) { return SetProperty(NS_ConvertASCIItoUCS2("background-attachment"), aBackgroundAttachment, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundColor(nsString& aBackgroundColor) +nsDOMCSSDeclaration::GetBackgroundColor(nsAWritableString& aBackgroundColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-color"), aBackgroundColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundColor(const nsString& aBackgroundColor) +nsDOMCSSDeclaration::SetBackgroundColor(const nsAReadableString& aBackgroundColor) { return SetProperty(NS_ConvertASCIItoUCS2("background-color"), aBackgroundColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundImage(nsString& aBackgroundImage) +nsDOMCSSDeclaration::GetBackgroundImage(nsAWritableString& aBackgroundImage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-image"), aBackgroundImage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundImage(const nsString& aBackgroundImage) +nsDOMCSSDeclaration::SetBackgroundImage(const nsAReadableString& aBackgroundImage) { return SetProperty(NS_ConvertASCIItoUCS2("background-image"), aBackgroundImage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundPosition(nsString& aBackgroundPosition) +nsDOMCSSDeclaration::GetBackgroundPosition(nsAWritableString& aBackgroundPosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-position"), aBackgroundPosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundPosition(const nsString& aBackgroundPosition) +nsDOMCSSDeclaration::SetBackgroundPosition(const nsAReadableString& aBackgroundPosition) { return SetProperty(NS_ConvertASCIItoUCS2("background-position"), aBackgroundPosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBackgroundRepeat(nsString& aBackgroundRepeat) +nsDOMCSSDeclaration::GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat) { return GetPropertyValue(NS_ConvertASCIItoUCS2("background-repeat"), aBackgroundRepeat); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBackgroundRepeat(const nsString& aBackgroundRepeat) +nsDOMCSSDeclaration::SetBackgroundRepeat(const nsAReadableString& aBackgroundRepeat) { return SetProperty(NS_ConvertASCIItoUCS2("background-repeat"), aBackgroundRepeat, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBehavior(nsString& aBehavior) +nsDOMCSSDeclaration::GetBehavior(nsAWritableString& aBehavior) { return GetPropertyValue(NS_ConvertASCIItoUCS2("behavior"), aBehavior); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBehavior(const nsString& aBehavior) +nsDOMCSSDeclaration::SetBehavior(const nsAReadableString& aBehavior) { return SetProperty(NS_ConvertASCIItoUCS2("behavior"), aBehavior, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorder(nsString& aBorder) +nsDOMCSSDeclaration::GetBorder(nsAWritableString& aBorder) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border"), aBorder); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorder(const nsString& aBorder) +nsDOMCSSDeclaration::SetBorder(const nsAReadableString& aBorder) { return SetProperty(NS_ConvertASCIItoUCS2("border"), aBorder, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderCollapse(nsString& aBorderCollapse) +nsDOMCSSDeclaration::GetBorderCollapse(nsAWritableString& aBorderCollapse) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-collapse"), aBorderCollapse); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderCollapse(const nsString& aBorderCollapse) +nsDOMCSSDeclaration::SetBorderCollapse(const nsAReadableString& aBorderCollapse) { return SetProperty(NS_ConvertASCIItoUCS2("border-collapse"), aBorderCollapse, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderColor(nsString& aBorderColor) +nsDOMCSSDeclaration::GetBorderColor(nsAWritableString& aBorderColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-color"), aBorderColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderColor(const nsString& aBorderColor) +nsDOMCSSDeclaration::SetBorderColor(const nsAReadableString& aBorderColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-color"), aBorderColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderSpacing(nsString& aBorderSpacing) +nsDOMCSSDeclaration::GetBorderSpacing(nsAWritableString& aBorderSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-spacing"), aBorderSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderSpacing(const nsString& aBorderSpacing) +nsDOMCSSDeclaration::SetBorderSpacing(const nsAReadableString& aBorderSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("border-spacing"), aBorderSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderStyle(nsString& aBorderStyle) +nsDOMCSSDeclaration::GetBorderStyle(nsAWritableString& aBorderStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-style"), aBorderStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderStyle(const nsString& aBorderStyle) +nsDOMCSSDeclaration::SetBorderStyle(const nsAReadableString& aBorderStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-style"), aBorderStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTop(nsString& aBorderTop) +nsDOMCSSDeclaration::GetBorderTop(nsAWritableString& aBorderTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top"), aBorderTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTop(const nsString& aBorderTop) +nsDOMCSSDeclaration::SetBorderTop(const nsAReadableString& aBorderTop) { return SetProperty(NS_ConvertASCIItoUCS2("border-top"), aBorderTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRight(nsString& aBorderRight) +nsDOMCSSDeclaration::GetBorderRight(nsAWritableString& aBorderRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right"), aBorderRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRight(const nsString& aBorderRight) +nsDOMCSSDeclaration::SetBorderRight(const nsAReadableString& aBorderRight) { return SetProperty(NS_ConvertASCIItoUCS2("border-right"), aBorderRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottom(nsString& aBorderBottom) +nsDOMCSSDeclaration::GetBorderBottom(nsAWritableString& aBorderBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom"), aBorderBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottom(const nsString& aBorderBottom) +nsDOMCSSDeclaration::SetBorderBottom(const nsAReadableString& aBorderBottom) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom"), aBorderBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeft(nsString& aBorderLeft) +nsDOMCSSDeclaration::GetBorderLeft(nsAWritableString& aBorderLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left"), aBorderLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeft(const nsString& aBorderLeft) +nsDOMCSSDeclaration::SetBorderLeft(const nsAReadableString& aBorderLeft) { return SetProperty(NS_ConvertASCIItoUCS2("border-left"), aBorderLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopColor(nsString& aBorderTopColor) +nsDOMCSSDeclaration::GetBorderTopColor(nsAWritableString& aBorderTopColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-color"), aBorderTopColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopColor(const nsString& aBorderTopColor) +nsDOMCSSDeclaration::SetBorderTopColor(const nsAReadableString& aBorderTopColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-color"), aBorderTopColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightColor(nsString& aBorderRightColor) +nsDOMCSSDeclaration::GetBorderRightColor(nsAWritableString& aBorderRightColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-color"), aBorderRightColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightColor(const nsString& aBorderRightColor) +nsDOMCSSDeclaration::SetBorderRightColor(const nsAReadableString& aBorderRightColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-color"), aBorderRightColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomColor(nsString& aBorderBottomColor) +nsDOMCSSDeclaration::GetBorderBottomColor(nsAWritableString& aBorderBottomColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-color"), aBorderBottomColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomColor(const nsString& aBorderBottomColor) +nsDOMCSSDeclaration::SetBorderBottomColor(const nsAReadableString& aBorderBottomColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-color"), aBorderBottomColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftColor(nsString& aBorderLeftColor) +nsDOMCSSDeclaration::GetBorderLeftColor(nsAWritableString& aBorderLeftColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-color"), aBorderLeftColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftColor(const nsString& aBorderLeftColor) +nsDOMCSSDeclaration::SetBorderLeftColor(const nsAReadableString& aBorderLeftColor) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-color"), aBorderLeftColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopStyle(nsString& aBorderTopStyle) +nsDOMCSSDeclaration::GetBorderTopStyle(nsAWritableString& aBorderTopStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-style"), aBorderTopStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopStyle(const nsString& aBorderTopStyle) +nsDOMCSSDeclaration::SetBorderTopStyle(const nsAReadableString& aBorderTopStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-style"), aBorderTopStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightStyle(nsString& aBorderRightStyle) +nsDOMCSSDeclaration::GetBorderRightStyle(nsAWritableString& aBorderRightStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-style"), aBorderRightStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightStyle(const nsString& aBorderRightStyle) +nsDOMCSSDeclaration::SetBorderRightStyle(const nsAReadableString& aBorderRightStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-style"), aBorderRightStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomStyle(nsString& aBorderBottomStyle) +nsDOMCSSDeclaration::GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-style"), aBorderBottomStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomStyle(const nsString& aBorderBottomStyle) +nsDOMCSSDeclaration::SetBorderBottomStyle(const nsAReadableString& aBorderBottomStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-style"), aBorderBottomStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftStyle(nsString& aBorderLeftStyle) +nsDOMCSSDeclaration::GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-style"), aBorderLeftStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftStyle(const nsString& aBorderLeftStyle) +nsDOMCSSDeclaration::SetBorderLeftStyle(const nsAReadableString& aBorderLeftStyle) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-style"), aBorderLeftStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderTopWidth(nsString& aBorderTopWidth) +nsDOMCSSDeclaration::GetBorderTopWidth(nsAWritableString& aBorderTopWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-top-width"), aBorderTopWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderTopWidth(const nsString& aBorderTopWidth) +nsDOMCSSDeclaration::SetBorderTopWidth(const nsAReadableString& aBorderTopWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-top-width"), aBorderTopWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderRightWidth(nsString& aBorderRightWidth) +nsDOMCSSDeclaration::GetBorderRightWidth(nsAWritableString& aBorderRightWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-right-width"), aBorderRightWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderRightWidth(const nsString& aBorderRightWidth) +nsDOMCSSDeclaration::SetBorderRightWidth(const nsAReadableString& aBorderRightWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-right-width"), aBorderRightWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderBottomWidth(nsString& aBorderBottomWidth) +nsDOMCSSDeclaration::GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-bottom-width"), aBorderBottomWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderBottomWidth(const nsString& aBorderBottomWidth) +nsDOMCSSDeclaration::SetBorderBottomWidth(const nsAReadableString& aBorderBottomWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-bottom-width"), aBorderBottomWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderLeftWidth(nsString& aBorderLeftWidth) +nsDOMCSSDeclaration::GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-left-width"), aBorderLeftWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderLeftWidth(const nsString& aBorderLeftWidth) +nsDOMCSSDeclaration::SetBorderLeftWidth(const nsAReadableString& aBorderLeftWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-left-width"), aBorderLeftWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBorderWidth(nsString& aBorderWidth) +nsDOMCSSDeclaration::GetBorderWidth(nsAWritableString& aBorderWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("border-width"), aBorderWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBorderWidth(const nsString& aBorderWidth) +nsDOMCSSDeclaration::SetBorderWidth(const nsAReadableString& aBorderWidth) { return SetProperty(NS_ConvertASCIItoUCS2("border-width"), aBorderWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetBottom(nsString& aBottom) +nsDOMCSSDeclaration::GetBottom(nsAWritableString& aBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("bottom"), aBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetBottom(const nsString& aBottom) +nsDOMCSSDeclaration::SetBottom(const nsAReadableString& aBottom) { return SetProperty(NS_ConvertASCIItoUCS2("bottom"), aBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCaptionSide(nsString& aCaptionSide) +nsDOMCSSDeclaration::GetCaptionSide(nsAWritableString& aCaptionSide) { return GetPropertyValue(NS_ConvertASCIItoUCS2("caption-side"), aCaptionSide); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCaptionSide(const nsString& aCaptionSide) +nsDOMCSSDeclaration::SetCaptionSide(const nsAReadableString& aCaptionSide) { return SetProperty(NS_ConvertASCIItoUCS2("caption-side"), aCaptionSide, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetClear(nsString& aClear) +nsDOMCSSDeclaration::GetClear(nsAWritableString& aClear) { return GetPropertyValue(NS_ConvertASCIItoUCS2("clear"), aClear); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetClear(const nsString& aClear) +nsDOMCSSDeclaration::SetClear(const nsAReadableString& aClear) { return SetProperty(NS_ConvertASCIItoUCS2("clear"), aClear, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetClip(nsString& aClip) +nsDOMCSSDeclaration::GetClip(nsAWritableString& aClip) { return GetPropertyValue(NS_ConvertASCIItoUCS2("clip"), aClip); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetClip(const nsString& aClip) +nsDOMCSSDeclaration::SetClip(const nsAReadableString& aClip) { return SetProperty(NS_ConvertASCIItoUCS2("clip"), aClip, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetColor(nsString& aColor) +nsDOMCSSDeclaration::GetColor(nsAWritableString& aColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("color"), aColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetColor(const nsString& aColor) +nsDOMCSSDeclaration::SetColor(const nsAReadableString& aColor) { return SetProperty(NS_ConvertASCIItoUCS2("color"), aColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetContent(nsString& aContent) +nsDOMCSSDeclaration::GetContent(nsAWritableString& aContent) { return GetPropertyValue(NS_ConvertASCIItoUCS2("content"), aContent); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetContent(const nsString& aContent) +nsDOMCSSDeclaration::SetContent(const nsAReadableString& aContent) { return SetProperty(NS_ConvertASCIItoUCS2("content"), aContent, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCounterIncrement(nsString& aCounterIncrement) +nsDOMCSSDeclaration::GetCounterIncrement(nsAWritableString& aCounterIncrement) { return GetPropertyValue(NS_ConvertASCIItoUCS2("counter-increment"), aCounterIncrement); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCounterIncrement(const nsString& aCounterIncrement) +nsDOMCSSDeclaration::SetCounterIncrement(const nsAReadableString& aCounterIncrement) { return SetProperty(NS_ConvertASCIItoUCS2("counter-increment"), aCounterIncrement, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCounterReset(nsString& aCounterReset) +nsDOMCSSDeclaration::GetCounterReset(nsAWritableString& aCounterReset) { return GetPropertyValue(NS_ConvertASCIItoUCS2("counter-reset"), aCounterReset); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCounterReset(const nsString& aCounterReset) +nsDOMCSSDeclaration::SetCounterReset(const nsAReadableString& aCounterReset) { return SetProperty(NS_ConvertASCIItoUCS2("counter-reset"), aCounterReset, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCssFloat(nsString& aCssFloat) +nsDOMCSSDeclaration::GetCssFloat(nsAWritableString& aCssFloat) { return GetPropertyValue(NS_ConvertASCIItoUCS2("float"), aCssFloat); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCssFloat(const nsString& aCssFloat) +nsDOMCSSDeclaration::SetCssFloat(const nsAReadableString& aCssFloat) { return SetProperty(NS_ConvertASCIItoUCS2("float"), aCssFloat, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCue(nsString& aCue) +nsDOMCSSDeclaration::GetCue(nsAWritableString& aCue) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue"), aCue); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCue(const nsString& aCue) +nsDOMCSSDeclaration::SetCue(const nsAReadableString& aCue) { return SetProperty(NS_ConvertASCIItoUCS2("cue"), aCue, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCueAfter(nsString& aCueAfter) +nsDOMCSSDeclaration::GetCueAfter(nsAWritableString& aCueAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue-after"), aCueAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCueAfter(const nsString& aCueAfter) +nsDOMCSSDeclaration::SetCueAfter(const nsAReadableString& aCueAfter) { return SetProperty(NS_ConvertASCIItoUCS2("cue-after"), aCueAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCueBefore(nsString& aCueBefore) +nsDOMCSSDeclaration::GetCueBefore(nsAWritableString& aCueBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cue-before"), aCueBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCueBefore(const nsString& aCueBefore) +nsDOMCSSDeclaration::SetCueBefore(const nsAReadableString& aCueBefore) { return SetProperty(NS_ConvertASCIItoUCS2("cue-before"), aCueBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetCursor(nsString& aCursor) +nsDOMCSSDeclaration::GetCursor(nsAWritableString& aCursor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("cursor"), aCursor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetCursor(const nsString& aCursor) +nsDOMCSSDeclaration::SetCursor(const nsAReadableString& aCursor) { return SetProperty(NS_ConvertASCIItoUCS2("cursor"), aCursor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetDirection(nsString& aDirection) +nsDOMCSSDeclaration::GetDirection(nsAWritableString& aDirection) { return GetPropertyValue(NS_ConvertASCIItoUCS2("direction"), aDirection); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetDirection(const nsString& aDirection) +nsDOMCSSDeclaration::SetDirection(const nsAReadableString& aDirection) { return SetProperty(NS_ConvertASCIItoUCS2("direction"), aDirection, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetDisplay(nsString& aDisplay) +nsDOMCSSDeclaration::GetDisplay(nsAWritableString& aDisplay) { return GetPropertyValue(NS_ConvertASCIItoUCS2("display"), aDisplay); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetDisplay(const nsString& aDisplay) +nsDOMCSSDeclaration::SetDisplay(const nsAReadableString& aDisplay) { return SetProperty(NS_ConvertASCIItoUCS2("display"), aDisplay, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetElevation(nsString& aElevation) +nsDOMCSSDeclaration::GetElevation(nsAWritableString& aElevation) { return GetPropertyValue(NS_ConvertASCIItoUCS2("elevation"), aElevation); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetElevation(const nsString& aElevation) +nsDOMCSSDeclaration::SetElevation(const nsAReadableString& aElevation) { return SetProperty(NS_ConvertASCIItoUCS2("elevation"), aElevation, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetEmptyCells(nsString& aEmptyCells) +nsDOMCSSDeclaration::GetEmptyCells(nsAWritableString& aEmptyCells) { return GetPropertyValue(NS_ConvertASCIItoUCS2("empty-cells"), aEmptyCells); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetEmptyCells(const nsString& aEmptyCells) +nsDOMCSSDeclaration::SetEmptyCells(const nsAReadableString& aEmptyCells) { return SetProperty(NS_ConvertASCIItoUCS2("empty-cells"), aEmptyCells, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFont(nsString& aFont) +nsDOMCSSDeclaration::GetFont(nsAWritableString& aFont) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font"), aFont); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFont(const nsString& aFont) +nsDOMCSSDeclaration::SetFont(const nsAReadableString& aFont) { return SetProperty(NS_ConvertASCIItoUCS2("font"), aFont, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontFamily(nsString& aFontFamily) +nsDOMCSSDeclaration::GetFontFamily(nsAWritableString& aFontFamily) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-family"), aFontFamily); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontFamily(const nsString& aFontFamily) +nsDOMCSSDeclaration::SetFontFamily(const nsAReadableString& aFontFamily) { return SetProperty(NS_ConvertASCIItoUCS2("font-family"), aFontFamily, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontSize(nsString& aFontSize) +nsDOMCSSDeclaration::GetFontSize(nsAWritableString& aFontSize) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-size"), aFontSize); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontSize(const nsString& aFontSize) +nsDOMCSSDeclaration::SetFontSize(const nsAReadableString& aFontSize) { return SetProperty(NS_ConvertASCIItoUCS2("font-size"), aFontSize, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontSizeAdjust(nsString& aFontSizeAdjust) +nsDOMCSSDeclaration::GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-size-adjust"), aFontSizeAdjust); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontSizeAdjust(const nsString& aFontSizeAdjust) +nsDOMCSSDeclaration::SetFontSizeAdjust(const nsAReadableString& aFontSizeAdjust) { return SetProperty(NS_ConvertASCIItoUCS2("font-size-adjust"), aFontSizeAdjust, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontStretch(nsString& aFontStretch) +nsDOMCSSDeclaration::GetFontStretch(nsAWritableString& aFontStretch) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-stretch"), aFontStretch); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontStretch(const nsString& aFontStretch) +nsDOMCSSDeclaration::SetFontStretch(const nsAReadableString& aFontStretch) { return SetProperty(NS_ConvertASCIItoUCS2("font-stretch"), aFontStretch, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontStyle(nsString& aFontStyle) +nsDOMCSSDeclaration::GetFontStyle(nsAWritableString& aFontStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-style"), aFontStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontStyle(const nsString& aFontStyle) +nsDOMCSSDeclaration::SetFontStyle(const nsAReadableString& aFontStyle) { return SetProperty(NS_ConvertASCIItoUCS2("font-style"), aFontStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontVariant(nsString& aFontVariant) +nsDOMCSSDeclaration::GetFontVariant(nsAWritableString& aFontVariant) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-variant"), aFontVariant); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontVariant(const nsString& aFontVariant) +nsDOMCSSDeclaration::SetFontVariant(const nsAReadableString& aFontVariant) { return SetProperty(NS_ConvertASCIItoUCS2("font-variant"), aFontVariant, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetFontWeight(nsString& aFontWeight) +nsDOMCSSDeclaration::GetFontWeight(nsAWritableString& aFontWeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("font-weight"), aFontWeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetFontWeight(const nsString& aFontWeight) +nsDOMCSSDeclaration::SetFontWeight(const nsAReadableString& aFontWeight) { return SetProperty(NS_ConvertASCIItoUCS2("font-weight"), aFontWeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetHeight(nsString& aHeight) +nsDOMCSSDeclaration::GetHeight(nsAWritableString& aHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("height"), aHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetHeight(const nsString& aHeight) +nsDOMCSSDeclaration::SetHeight(const nsAReadableString& aHeight) { return SetProperty(NS_ConvertASCIItoUCS2("height"), aHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLeft(nsString& aLeft) +nsDOMCSSDeclaration::GetLeft(nsAWritableString& aLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("left"), aLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLeft(const nsString& aLeft) +nsDOMCSSDeclaration::SetLeft(const nsAReadableString& aLeft) { return SetProperty(NS_ConvertASCIItoUCS2("left"), aLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLetterSpacing(nsString& aLetterSpacing) +nsDOMCSSDeclaration::GetLetterSpacing(nsAWritableString& aLetterSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("letter-spacing"), aLetterSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLetterSpacing(const nsString& aLetterSpacing) +nsDOMCSSDeclaration::SetLetterSpacing(const nsAReadableString& aLetterSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("letter-spacing"), aLetterSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetLineHeight(nsString& aLineHeight) +nsDOMCSSDeclaration::GetLineHeight(nsAWritableString& aLineHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("line-height"), aLineHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetLineHeight(const nsString& aLineHeight) +nsDOMCSSDeclaration::SetLineHeight(const nsAReadableString& aLineHeight) { return SetProperty(NS_ConvertASCIItoUCS2("line-height"), aLineHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyle(nsString& aListStyle) +nsDOMCSSDeclaration::GetListStyle(nsAWritableString& aListStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style"), aListStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyle(const nsString& aListStyle) +nsDOMCSSDeclaration::SetListStyle(const nsAReadableString& aListStyle) { return SetProperty(NS_ConvertASCIItoUCS2("list-style"), aListStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyleImage(nsString& aListStyleImage) +nsDOMCSSDeclaration::GetListStyleImage(nsAWritableString& aListStyleImage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-image"), aListStyleImage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyleImage(const nsString& aListStyleImage) +nsDOMCSSDeclaration::SetListStyleImage(const nsAReadableString& aListStyleImage) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-image"), aListStyleImage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStylePosition(nsString& aListStylePosition) +nsDOMCSSDeclaration::GetListStylePosition(nsAWritableString& aListStylePosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-position"), aListStylePosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStylePosition(const nsString& aListStylePosition) +nsDOMCSSDeclaration::SetListStylePosition(const nsAReadableString& aListStylePosition) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-position"), aListStylePosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetListStyleType(nsString& aListStyleType) +nsDOMCSSDeclaration::GetListStyleType(nsAWritableString& aListStyleType) { return GetPropertyValue(NS_ConvertASCIItoUCS2("list-style-type"), aListStyleType); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetListStyleType(const nsString& aListStyleType) +nsDOMCSSDeclaration::SetListStyleType(const nsAReadableString& aListStyleType) { return SetProperty(NS_ConvertASCIItoUCS2("list-style-type"), aListStyleType, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMargin(nsString& aMargin) +nsDOMCSSDeclaration::GetMargin(nsAWritableString& aMargin) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin"), aMargin); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMargin(const nsString& aMargin) +nsDOMCSSDeclaration::SetMargin(const nsAReadableString& aMargin) { return SetProperty(NS_ConvertASCIItoUCS2("margin"), aMargin, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginTop(nsString& aMarginTop) +nsDOMCSSDeclaration::GetMarginTop(nsAWritableString& aMarginTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-top"), aMarginTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginTop(const nsString& aMarginTop) +nsDOMCSSDeclaration::SetMarginTop(const nsAReadableString& aMarginTop) { return SetProperty(NS_ConvertASCIItoUCS2("margin-top"), aMarginTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginRight(nsString& aMarginRight) +nsDOMCSSDeclaration::GetMarginRight(nsAWritableString& aMarginRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-right"), aMarginRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginRight(const nsString& aMarginRight) +nsDOMCSSDeclaration::SetMarginRight(const nsAReadableString& aMarginRight) { return SetProperty(NS_ConvertASCIItoUCS2("margin-right"), aMarginRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginBottom(nsString& aMarginBottom) +nsDOMCSSDeclaration::GetMarginBottom(nsAWritableString& aMarginBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-bottom"), aMarginBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginBottom(const nsString& aMarginBottom) +nsDOMCSSDeclaration::SetMarginBottom(const nsAReadableString& aMarginBottom) { return SetProperty(NS_ConvertASCIItoUCS2("margin-bottom"), aMarginBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarginLeft(nsString& aMarginLeft) +nsDOMCSSDeclaration::GetMarginLeft(nsAWritableString& aMarginLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("margin-left"), aMarginLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarginLeft(const nsString& aMarginLeft) +nsDOMCSSDeclaration::SetMarginLeft(const nsAReadableString& aMarginLeft) { return SetProperty(NS_ConvertASCIItoUCS2("margin-left"), aMarginLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarkerOffset(nsString& aMarkerOffset) +nsDOMCSSDeclaration::GetMarkerOffset(nsAWritableString& aMarkerOffset) { return GetPropertyValue(NS_ConvertASCIItoUCS2("marker-offset"), aMarkerOffset); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarkerOffset(const nsString& aMarkerOffset) +nsDOMCSSDeclaration::SetMarkerOffset(const nsAReadableString& aMarkerOffset) { return SetProperty(NS_ConvertASCIItoUCS2("marker-offset"), aMarkerOffset, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMarks(nsString& aMarks) +nsDOMCSSDeclaration::GetMarks(nsAWritableString& aMarks) { return GetPropertyValue(NS_ConvertASCIItoUCS2("marks"), aMarks); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMarks(const nsString& aMarks) +nsDOMCSSDeclaration::SetMarks(const nsAReadableString& aMarks) { return SetProperty(NS_ConvertASCIItoUCS2("marks"), aMarks, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMaxHeight(nsString& aMaxHeight) +nsDOMCSSDeclaration::GetMaxHeight(nsAWritableString& aMaxHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("max-height"), aMaxHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMaxHeight(const nsString& aMaxHeight) +nsDOMCSSDeclaration::SetMaxHeight(const nsAReadableString& aMaxHeight) { return SetProperty(NS_ConvertASCIItoUCS2("max-height"), aMaxHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMaxWidth(nsString& aMaxWidth) +nsDOMCSSDeclaration::GetMaxWidth(nsAWritableString& aMaxWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("max-width"), aMaxWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMaxWidth(const nsString& aMaxWidth) +nsDOMCSSDeclaration::SetMaxWidth(const nsAReadableString& aMaxWidth) { return SetProperty(NS_ConvertASCIItoUCS2("max-width"), aMaxWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMinHeight(nsString& aMinHeight) +nsDOMCSSDeclaration::GetMinHeight(nsAWritableString& aMinHeight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("min-height"), aMinHeight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMinHeight(const nsString& aMinHeight) +nsDOMCSSDeclaration::SetMinHeight(const nsAReadableString& aMinHeight) { return SetProperty(NS_ConvertASCIItoUCS2("min-height"), aMinHeight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetMinWidth(nsString& aMinWidth) +nsDOMCSSDeclaration::GetMinWidth(nsAWritableString& aMinWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("min-width"), aMinWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetMinWidth(const nsString& aMinWidth) +nsDOMCSSDeclaration::SetMinWidth(const nsAReadableString& aMinWidth) { return SetProperty(NS_ConvertASCIItoUCS2("min-width"), aMinWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOrphans(nsString& aOrphans) +nsDOMCSSDeclaration::GetOrphans(nsAWritableString& aOrphans) { return GetPropertyValue(NS_ConvertASCIItoUCS2("orphans"), aOrphans); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOrphans(const nsString& aOrphans) +nsDOMCSSDeclaration::SetOrphans(const nsAReadableString& aOrphans) { return SetProperty(NS_ConvertASCIItoUCS2("orphans"), aOrphans, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutline(nsString& aOutline) +nsDOMCSSDeclaration::GetOutline(nsAWritableString& aOutline) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline"), aOutline); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutline(const nsString& aOutline) +nsDOMCSSDeclaration::SetOutline(const nsAReadableString& aOutline) { return SetProperty(NS_ConvertASCIItoUCS2("outline"), aOutline, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineColor(nsString& aOutlineColor) +nsDOMCSSDeclaration::GetOutlineColor(nsAWritableString& aOutlineColor) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-color"), aOutlineColor); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineColor(const nsString& aOutlineColor) +nsDOMCSSDeclaration::SetOutlineColor(const nsAReadableString& aOutlineColor) { return SetProperty(NS_ConvertASCIItoUCS2("outline-color"), aOutlineColor, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineStyle(nsString& aOutlineStyle) +nsDOMCSSDeclaration::GetOutlineStyle(nsAWritableString& aOutlineStyle) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-style"), aOutlineStyle); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineStyle(const nsString& aOutlineStyle) +nsDOMCSSDeclaration::SetOutlineStyle(const nsAReadableString& aOutlineStyle) { return SetProperty(NS_ConvertASCIItoUCS2("outline-style"), aOutlineStyle, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOutlineWidth(nsString& aOutlineWidth) +nsDOMCSSDeclaration::GetOutlineWidth(nsAWritableString& aOutlineWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("outline-width"), aOutlineWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOutlineWidth(const nsString& aOutlineWidth) +nsDOMCSSDeclaration::SetOutlineWidth(const nsAReadableString& aOutlineWidth) { return SetProperty(NS_ConvertASCIItoUCS2("outline-width"), aOutlineWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOverflow(nsString& aOverflow) +nsDOMCSSDeclaration::GetOverflow(nsAWritableString& aOverflow) { return GetPropertyValue(NS_ConvertASCIItoUCS2("overflow"), aOverflow); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOverflow(const nsString& aOverflow) +nsDOMCSSDeclaration::SetOverflow(const nsAReadableString& aOverflow) { return SetProperty(NS_ConvertASCIItoUCS2("overflow"), aOverflow, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPadding(nsString& aPadding) +nsDOMCSSDeclaration::GetPadding(nsAWritableString& aPadding) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding"), aPadding); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPadding(const nsString& aPadding) +nsDOMCSSDeclaration::SetPadding(const nsAReadableString& aPadding) { return SetProperty(NS_ConvertASCIItoUCS2("padding"), aPadding, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingTop(nsString& aPaddingTop) +nsDOMCSSDeclaration::GetPaddingTop(nsAWritableString& aPaddingTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-top"), aPaddingTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingTop(const nsString& aPaddingTop) +nsDOMCSSDeclaration::SetPaddingTop(const nsAReadableString& aPaddingTop) { return SetProperty(NS_ConvertASCIItoUCS2("padding-top"), aPaddingTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingRight(nsString& aPaddingRight) +nsDOMCSSDeclaration::GetPaddingRight(nsAWritableString& aPaddingRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-right"), aPaddingRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingRight(const nsString& aPaddingRight) +nsDOMCSSDeclaration::SetPaddingRight(const nsAReadableString& aPaddingRight) { return SetProperty(NS_ConvertASCIItoUCS2("padding-right"), aPaddingRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingBottom(nsString& aPaddingBottom) +nsDOMCSSDeclaration::GetPaddingBottom(nsAWritableString& aPaddingBottom) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-bottom"), aPaddingBottom); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingBottom(const nsString& aPaddingBottom) +nsDOMCSSDeclaration::SetPaddingBottom(const nsAReadableString& aPaddingBottom) { return SetProperty(NS_ConvertASCIItoUCS2("padding-bottom"), aPaddingBottom, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPaddingLeft(nsString& aPaddingLeft) +nsDOMCSSDeclaration::GetPaddingLeft(nsAWritableString& aPaddingLeft) { return GetPropertyValue(NS_ConvertASCIItoUCS2("padding-left"), aPaddingLeft); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPaddingLeft(const nsString& aPaddingLeft) +nsDOMCSSDeclaration::SetPaddingLeft(const nsAReadableString& aPaddingLeft) { return SetProperty(NS_ConvertASCIItoUCS2("padding-left"), aPaddingLeft, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPage(nsString& aPage) +nsDOMCSSDeclaration::GetPage(nsAWritableString& aPage) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page"), aPage); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPage(const nsString& aPage) +nsDOMCSSDeclaration::SetPage(const nsAReadableString& aPage) { return SetProperty(NS_ConvertASCIItoUCS2("page"), aPage, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakAfter(nsString& aPageBreakAfter) +nsDOMCSSDeclaration::GetPageBreakAfter(nsAWritableString& aPageBreakAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-after"), aPageBreakAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakAfter(const nsString& aPageBreakAfter) +nsDOMCSSDeclaration::SetPageBreakAfter(const nsAReadableString& aPageBreakAfter) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-after"), aPageBreakAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakBefore(nsString& aPageBreakBefore) +nsDOMCSSDeclaration::GetPageBreakBefore(nsAWritableString& aPageBreakBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-before"), aPageBreakBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakBefore(const nsString& aPageBreakBefore) +nsDOMCSSDeclaration::SetPageBreakBefore(const nsAReadableString& aPageBreakBefore) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-before"), aPageBreakBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPageBreakInside(nsString& aPageBreakInside) +nsDOMCSSDeclaration::GetPageBreakInside(nsAWritableString& aPageBreakInside) { return GetPropertyValue(NS_ConvertASCIItoUCS2("page-break-inside"), aPageBreakInside); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPageBreakInside(const nsString& aPageBreakInside) +nsDOMCSSDeclaration::SetPageBreakInside(const nsAReadableString& aPageBreakInside) { return SetProperty(NS_ConvertASCIItoUCS2("page-break-inside"), aPageBreakInside, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPause(nsString& aPause) +nsDOMCSSDeclaration::GetPause(nsAWritableString& aPause) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause"), aPause); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPause(const nsString& aPause) +nsDOMCSSDeclaration::SetPause(const nsAReadableString& aPause) { return SetProperty(NS_ConvertASCIItoUCS2("pause"), aPause, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPauseAfter(nsString& aPauseAfter) +nsDOMCSSDeclaration::GetPauseAfter(nsAWritableString& aPauseAfter) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause-after"), aPauseAfter); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPauseAfter(const nsString& aPauseAfter) +nsDOMCSSDeclaration::SetPauseAfter(const nsAReadableString& aPauseAfter) { return SetProperty(NS_ConvertASCIItoUCS2("pause-after"), aPauseAfter, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPauseBefore(nsString& aPauseBefore) +nsDOMCSSDeclaration::GetPauseBefore(nsAWritableString& aPauseBefore) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pause-before"), aPauseBefore); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPauseBefore(const nsString& aPauseBefore) +nsDOMCSSDeclaration::SetPauseBefore(const nsAReadableString& aPauseBefore) { return SetProperty(NS_ConvertASCIItoUCS2("pause-before"), aPauseBefore, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPitch(nsString& aPitch) +nsDOMCSSDeclaration::GetPitch(nsAWritableString& aPitch) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pitch"), aPitch); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPitch(const nsString& aPitch) +nsDOMCSSDeclaration::SetPitch(const nsAReadableString& aPitch) { return SetProperty(NS_ConvertASCIItoUCS2("pitch"), aPitch, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPitchRange(nsString& aPitchRange) +nsDOMCSSDeclaration::GetPitchRange(nsAWritableString& aPitchRange) { return GetPropertyValue(NS_ConvertASCIItoUCS2("pitch-range"), aPitchRange); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPitchRange(const nsString& aPitchRange) +nsDOMCSSDeclaration::SetPitchRange(const nsAReadableString& aPitchRange) { return SetProperty(NS_ConvertASCIItoUCS2("pitch-range"), aPitchRange, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPlayDuring(nsString& aPlayDuring) +nsDOMCSSDeclaration::GetPlayDuring(nsAWritableString& aPlayDuring) { return GetPropertyValue(NS_ConvertASCIItoUCS2("play-during"), aPlayDuring); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPlayDuring(const nsString& aPlayDuring) +nsDOMCSSDeclaration::SetPlayDuring(const nsAReadableString& aPlayDuring) { return SetProperty(NS_ConvertASCIItoUCS2("play-during"), aPlayDuring, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetPosition(nsString& aPosition) +nsDOMCSSDeclaration::GetPosition(nsAWritableString& aPosition) { return GetPropertyValue(NS_ConvertASCIItoUCS2("position"), aPosition); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetPosition(const nsString& aPosition) +nsDOMCSSDeclaration::SetPosition(const nsAReadableString& aPosition) { return SetProperty(NS_ConvertASCIItoUCS2("position"), aPosition, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetQuotes(nsString& aQuotes) +nsDOMCSSDeclaration::GetQuotes(nsAWritableString& aQuotes) { return GetPropertyValue(NS_ConvertASCIItoUCS2("quotes"), aQuotes); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetQuotes(const nsString& aQuotes) +nsDOMCSSDeclaration::SetQuotes(const nsAReadableString& aQuotes) { return SetProperty(NS_ConvertASCIItoUCS2("quotes"), aQuotes, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetRichness(nsString& aRichness) +nsDOMCSSDeclaration::GetRichness(nsAWritableString& aRichness) { return GetPropertyValue(NS_ConvertASCIItoUCS2("richness"), aRichness); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetRichness(const nsString& aRichness) +nsDOMCSSDeclaration::SetRichness(const nsAReadableString& aRichness) { return SetProperty(NS_ConvertASCIItoUCS2("richness"), aRichness, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetRight(nsString& aRight) +nsDOMCSSDeclaration::GetRight(nsAWritableString& aRight) { return GetPropertyValue(NS_ConvertASCIItoUCS2("right"), aRight); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetRight(const nsString& aRight) +nsDOMCSSDeclaration::SetRight(const nsAReadableString& aRight) { return SetProperty(NS_ConvertASCIItoUCS2("right"), aRight, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSize(nsString& aSize) +nsDOMCSSDeclaration::GetSize(nsAWritableString& aSize) { return GetPropertyValue(NS_ConvertASCIItoUCS2("size"), aSize); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSize(const nsString& aSize) +nsDOMCSSDeclaration::SetSize(const nsAReadableString& aSize) { return SetProperty(NS_ConvertASCIItoUCS2("size"), aSize, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeak(nsString& aSpeak) +nsDOMCSSDeclaration::GetSpeak(nsAWritableString& aSpeak) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak"), aSpeak); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeak(const nsString& aSpeak) +nsDOMCSSDeclaration::SetSpeak(const nsAReadableString& aSpeak) { return SetProperty(NS_ConvertASCIItoUCS2("speak"), aSpeak, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakHeader(nsString& aSpeakHeader) +nsDOMCSSDeclaration::GetSpeakHeader(nsAWritableString& aSpeakHeader) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-header"), aSpeakHeader); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakHeader(const nsString& aSpeakHeader) +nsDOMCSSDeclaration::SetSpeakHeader(const nsAReadableString& aSpeakHeader) { return SetProperty(NS_ConvertASCIItoUCS2("speak-header"), aSpeakHeader, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakNumeral(nsString& aSpeakNumeral) +nsDOMCSSDeclaration::GetSpeakNumeral(nsAWritableString& aSpeakNumeral) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-numeral"), aSpeakNumeral); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakNumeral(const nsString& aSpeakNumeral) +nsDOMCSSDeclaration::SetSpeakNumeral(const nsAReadableString& aSpeakNumeral) { return SetProperty(NS_ConvertASCIItoUCS2("speak-numeral"), aSpeakNumeral, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeakPunctuation(nsString& aSpeakPunctuation) +nsDOMCSSDeclaration::GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speak-punctuation"), aSpeakPunctuation); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeakPunctuation(const nsString& aSpeakPunctuation) +nsDOMCSSDeclaration::SetSpeakPunctuation(const nsAReadableString& aSpeakPunctuation) { return SetProperty(NS_ConvertASCIItoUCS2("speak-punctuation"), aSpeakPunctuation, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetSpeechRate(nsString& aSpeechRate) +nsDOMCSSDeclaration::GetSpeechRate(nsAWritableString& aSpeechRate) { return GetPropertyValue(NS_ConvertASCIItoUCS2("speech-rate"), aSpeechRate); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetSpeechRate(const nsString& aSpeechRate) +nsDOMCSSDeclaration::SetSpeechRate(const nsAReadableString& aSpeechRate) { return SetProperty(NS_ConvertASCIItoUCS2("speech-rate"), aSpeechRate, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetStress(nsString& aStress) +nsDOMCSSDeclaration::GetStress(nsAWritableString& aStress) { return GetPropertyValue(NS_ConvertASCIItoUCS2("stress"), aStress); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetStress(const nsString& aStress) +nsDOMCSSDeclaration::SetStress(const nsAReadableString& aStress) { return SetProperty(NS_ConvertASCIItoUCS2("stress"), aStress, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTableLayout(nsString& aTableLayout) +nsDOMCSSDeclaration::GetTableLayout(nsAWritableString& aTableLayout) { return GetPropertyValue(NS_ConvertASCIItoUCS2("table-layout"), aTableLayout); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTableLayout(const nsString& aTableLayout) +nsDOMCSSDeclaration::SetTableLayout(const nsAReadableString& aTableLayout) { return SetProperty(NS_ConvertASCIItoUCS2("table-layout"), aTableLayout, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextAlign(nsString& aTextAlign) +nsDOMCSSDeclaration::GetTextAlign(nsAWritableString& aTextAlign) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-align"), aTextAlign); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextAlign(const nsString& aTextAlign) +nsDOMCSSDeclaration::SetTextAlign(const nsAReadableString& aTextAlign) { return SetProperty(NS_ConvertASCIItoUCS2("text-align"), aTextAlign, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextDecoration(nsString& aTextDecoration) +nsDOMCSSDeclaration::GetTextDecoration(nsAWritableString& aTextDecoration) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-decoration"), aTextDecoration); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextDecoration(const nsString& aTextDecoration) +nsDOMCSSDeclaration::SetTextDecoration(const nsAReadableString& aTextDecoration) { return SetProperty(NS_ConvertASCIItoUCS2("text-decoration"), aTextDecoration, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextIndent(nsString& aTextIndent) +nsDOMCSSDeclaration::GetTextIndent(nsAWritableString& aTextIndent) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-indent"), aTextIndent); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextIndent(const nsString& aTextIndent) +nsDOMCSSDeclaration::SetTextIndent(const nsAReadableString& aTextIndent) { return SetProperty(NS_ConvertASCIItoUCS2("text-indent"), aTextIndent, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextShadow(nsString& aTextShadow) +nsDOMCSSDeclaration::GetTextShadow(nsAWritableString& aTextShadow) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-shadow"), aTextShadow); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextShadow(const nsString& aTextShadow) +nsDOMCSSDeclaration::SetTextShadow(const nsAReadableString& aTextShadow) { return SetProperty(NS_ConvertASCIItoUCS2("text-shadow"), aTextShadow, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTextTransform(nsString& aTextTransform) +nsDOMCSSDeclaration::GetTextTransform(nsAWritableString& aTextTransform) { return GetPropertyValue(NS_ConvertASCIItoUCS2("text-transform"), aTextTransform); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTextTransform(const nsString& aTextTransform) +nsDOMCSSDeclaration::SetTextTransform(const nsAReadableString& aTextTransform) { return SetProperty(NS_ConvertASCIItoUCS2("text-transform"), aTextTransform, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetTop(nsString& aTop) +nsDOMCSSDeclaration::GetTop(nsAWritableString& aTop) { return GetPropertyValue(NS_ConvertASCIItoUCS2("top"), aTop); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetTop(const nsString& aTop) +nsDOMCSSDeclaration::SetTop(const nsAReadableString& aTop) { return SetProperty(NS_ConvertASCIItoUCS2("top"), aTop, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetUnicodeBidi(nsString& aUnicodeBidi) +nsDOMCSSDeclaration::GetUnicodeBidi(nsAWritableString& aUnicodeBidi) { return GetPropertyValue(NS_ConvertASCIItoUCS2("unicode-bidi"), aUnicodeBidi); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetUnicodeBidi(const nsString& aUnicodeBidi) +nsDOMCSSDeclaration::SetUnicodeBidi(const nsAReadableString& aUnicodeBidi) { return SetProperty(NS_ConvertASCIItoUCS2("unicode-bidi"), aUnicodeBidi, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVerticalAlign(nsString& aVerticalAlign) +nsDOMCSSDeclaration::GetVerticalAlign(nsAWritableString& aVerticalAlign) { return GetPropertyValue(NS_ConvertASCIItoUCS2("vertical-align"), aVerticalAlign); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVerticalAlign(const nsString& aVerticalAlign) +nsDOMCSSDeclaration::SetVerticalAlign(const nsAReadableString& aVerticalAlign) { return SetProperty(NS_ConvertASCIItoUCS2("vertical-align"), aVerticalAlign, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVisibility(nsString& aVisibility) +nsDOMCSSDeclaration::GetVisibility(nsAWritableString& aVisibility) { return GetPropertyValue(NS_ConvertASCIItoUCS2("visibility"), aVisibility); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVisibility(const nsString& aVisibility) +nsDOMCSSDeclaration::SetVisibility(const nsAReadableString& aVisibility) { return SetProperty(NS_ConvertASCIItoUCS2("visibility"), aVisibility, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVoiceFamily(nsString& aVoiceFamily) +nsDOMCSSDeclaration::GetVoiceFamily(nsAWritableString& aVoiceFamily) { return GetPropertyValue(NS_ConvertASCIItoUCS2("voice-family"), aVoiceFamily); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVoiceFamily(const nsString& aVoiceFamily) +nsDOMCSSDeclaration::SetVoiceFamily(const nsAReadableString& aVoiceFamily) { return SetProperty(NS_ConvertASCIItoUCS2("voice-family"), aVoiceFamily, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetVolume(nsString& aVolume) +nsDOMCSSDeclaration::GetVolume(nsAWritableString& aVolume) { return GetPropertyValue(NS_ConvertASCIItoUCS2("volume"), aVolume); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetVolume(const nsString& aVolume) +nsDOMCSSDeclaration::SetVolume(const nsAReadableString& aVolume) { return SetProperty(NS_ConvertASCIItoUCS2("volume"), aVolume, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWhiteSpace(nsString& aWhiteSpace) +nsDOMCSSDeclaration::GetWhiteSpace(nsAWritableString& aWhiteSpace) { return GetPropertyValue(NS_ConvertASCIItoUCS2("white-space"), aWhiteSpace); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWhiteSpace(const nsString& aWhiteSpace) +nsDOMCSSDeclaration::SetWhiteSpace(const nsAReadableString& aWhiteSpace) { return SetProperty(NS_ConvertASCIItoUCS2("white-space"), aWhiteSpace, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWidows(nsString& aWidows) +nsDOMCSSDeclaration::GetWidows(nsAWritableString& aWidows) { return GetPropertyValue(NS_ConvertASCIItoUCS2("widows"), aWidows); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWidows(const nsString& aWidows) +nsDOMCSSDeclaration::SetWidows(const nsAReadableString& aWidows) { return SetProperty(NS_ConvertASCIItoUCS2("widows"), aWidows, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWidth(nsString& aWidth) +nsDOMCSSDeclaration::GetWidth(nsAWritableString& aWidth) { return GetPropertyValue(NS_ConvertASCIItoUCS2("width"), aWidth); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWidth(const nsString& aWidth) +nsDOMCSSDeclaration::SetWidth(const nsAReadableString& aWidth) { return SetProperty(NS_ConvertASCIItoUCS2("width"), aWidth, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetWordSpacing(nsString& aWordSpacing) +nsDOMCSSDeclaration::GetWordSpacing(nsAWritableString& aWordSpacing) { return GetPropertyValue(NS_ConvertASCIItoUCS2("word-spacing"), aWordSpacing); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetWordSpacing(const nsString& aWordSpacing) +nsDOMCSSDeclaration::SetWordSpacing(const nsAReadableString& aWordSpacing) { return SetProperty(NS_ConvertASCIItoUCS2("word-spacing"), aWordSpacing, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetZIndex(nsString& aZIndex) +nsDOMCSSDeclaration::GetZIndex(nsAWritableString& aZIndex) { return GetPropertyValue(NS_ConvertASCIItoUCS2("z-index"), aZIndex); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetZIndex(const nsString& aZIndex) +nsDOMCSSDeclaration::SetZIndex(const nsAReadableString& aZIndex) { return SetProperty(NS_ConvertASCIItoUCS2("z-index"), aZIndex, nsAutoString()); } NS_IMETHODIMP -nsDOMCSSDeclaration::GetOpacity(nsString& aOpacity) +nsDOMCSSDeclaration::GetOpacity(nsAWritableString& aOpacity) { return GetPropertyValue(NS_ConvertASCIItoUCS2("opacity"), aOpacity); } NS_IMETHODIMP -nsDOMCSSDeclaration::SetOpacity(const nsString& aOpacity) +nsDOMCSSDeclaration::SetOpacity(const nsAReadableString& aOpacity) { return SetProperty(NS_ConvertASCIItoUCS2("opacity"), aOpacity, nsAutoString()); } diff --git a/layout/style/nsDOMCSSDeclaration.h b/layout/style/nsDOMCSSDeclaration.h index 7f51d0bbe0b6..d9fbc15d9606 100644 --- a/layout/style/nsDOMCSSDeclaration.h +++ b/layout/style/nsDOMCSSDeclaration.h @@ -39,21 +39,22 @@ public: NS_DECL_ISUPPORTS // NS_DECL_IDOMCSSSTYLEDECLARATION - NS_IMETHOD GetCssText(nsString& aCssText); - NS_IMETHOD SetCssText(const nsString& aCssText); + NS_IMETHOD GetCssText(nsAWritableString& aCssText); + NS_IMETHOD SetCssText(const nsAReadableString& aCssText); NS_IMETHOD GetLength(PRUint32* aLength); NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParentRule); - NS_IMETHOD GetPropertyValue(const nsString& aPropertyName, - nsString& aReturn); - NS_IMETHOD GetPropertyCSSValue(const nsString& aPropertyName, + NS_IMETHOD GetPropertyValue(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); + NS_IMETHOD GetPropertyCSSValue(const nsAReadableString& aPropertyName, nsIDOMCSSValue** aReturn); - NS_IMETHOD RemoveProperty(const nsString& aPropertyName, - nsString& aReturn) = 0; - NS_IMETHOD GetPropertyPriority(const nsString& aPropertyName, - nsString& aReturn); - NS_IMETHOD SetProperty(const nsString& aPropertyName, - const nsString& aValue, const nsString& aPriority); - NS_IMETHOD Item(PRUint32 aIndex, nsString& aReturn); + NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn) = 0; + NS_IMETHOD GetPropertyPriority(const nsAReadableString& aPropertyName, + nsAWritableString& aReturn); + NS_IMETHOD SetProperty(const nsAReadableString& aPropertyName, + const nsAReadableString& aValue, const nsAReadableString& aPriority); + NS_IMETHOD Item(PRUint32 aIndex, nsAWritableString& aReturn); + NS_DECL_IDOMCSS2PROPERTIES @@ -67,7 +68,7 @@ public: // Note! This will only set the declaration if a style rule already exists virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl) = 0; - virtual nsresult ParseDeclaration(const nsString& aDecl, + virtual nsresult ParseDeclaration(const nsAReadableString& aDecl, PRBool aParseOnlyOneDecl, PRBool aClearOldDecl) = 0; virtual nsresult GetParent(nsISupports **aParent) = 0; diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index c877aa8dec07..f0970abff9dd 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -631,7 +631,8 @@ public: // Attribute management methods, aAttributes is an in/out param NS_IMETHOD SetAttributesFor(nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes); - NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, const nsString& aValue, + NS_IMETHOD SetAttributeFor(nsIAtom* aAttribute, + const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes); @@ -1232,7 +1233,7 @@ NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributesFor(nsIHTMLContent* aContent, nsI } NS_IMETHODIMP HTMLStyleSheetImpl::SetAttributeFor(nsIAtom* aAttribute, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aMappedToStyle, nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes) diff --git a/layout/style/nsICSSParser.h b/layout/style/nsICSSParser.h index 349cb71529ba..e7ff6cc15418 100644 --- a/layout/style/nsICSSParser.h +++ b/layout/style/nsICSSParser.h @@ -24,11 +24,11 @@ #include "nslayout.h" #include "nsISupports.h" +#include "nsAWritableString.h" class nsIStyleRule; class nsICSSStyleSheet; class nsIUnicharInputStream; class nsIURI; -class nsString; class nsICSSDeclaration; class nsICSSLoader; @@ -65,26 +65,26 @@ public: // Parse declarations assuming that the outer curly braces have // already been accounted for. aBaseURL is the base url to use for // relative links in the declaration. - NS_IMETHOD ParseDeclarations(const nsString& aDeclaration, - nsIURI* aBaseURL, - nsIStyleRule*& aResult) = 0; + NS_IMETHOD ParseDeclarations(const nsAReadableString& aDeclaration, + nsIURI* aBaseURL, + nsIStyleRule*& aResult) = 0; - NS_IMETHOD ParseAndAppendDeclaration(const nsString& aBuffer, - nsIURI* aBaseURL, - nsICSSDeclaration* aDeclaration, - PRBool aParseOnlyOneDecl, - PRInt32* aHint) = 0; + NS_IMETHOD ParseAndAppendDeclaration(const nsAReadableString& aBuffer, + nsIURI* aBaseURL, + nsICSSDeclaration* aDeclaration, + PRBool aParseOnlyOneDecl, + PRInt32* aHint) = 0; // Charset management method: // Set the charset before calling any of the Parse emthods if you want the // charset to be anything other than the default // sets the out-param to the current charset, as set by SetCharset - NS_IMETHOD GetCharset(/*out*/nsString &aCharsetDest) const = 0; + NS_IMETHOD GetCharset(/*out*/nsAWritableString &aCharsetDest) const = 0; // SetCharset expects the charset to be the preferred charset // and it just records the string exactly as passed in (no alias resolution) - NS_IMETHOD SetCharset(/*in*/ const nsString &aCharsetSrc) = 0; + NS_IMETHOD SetCharset(/*in*/ const nsAReadableString &aCharsetSrc) = 0; }; // Values or'd in the GetInfoMask; other bits are reserved diff --git a/layout/style/nsIComputedDOMStyle.h b/layout/style/nsIComputedDOMStyle.h index 206a1b149018..9ee1025e1aa4 100644 --- a/layout/style/nsIComputedDOMStyle.h +++ b/layout/style/nsIComputedDOMStyle.h @@ -37,7 +37,7 @@ class nsIComputedDOMStyle : public nsIDOMCSSStyleDeclaration public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMPUTEDDOMSTYLE_IID) - NS_IMETHOD Init(nsIDOMElement *aElement, const nsString& aPseudoElt, + NS_IMETHOD Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt, nsIPresShell *aPresShell) = 0; }; diff --git a/layout/style/nsROCSSPrimitiveValue.cpp b/layout/style/nsROCSSPrimitiveValue.cpp index 0c669e8a9c60..ae69759a2bae 100644 --- a/layout/style/nsROCSSPrimitiveValue.cpp +++ b/layout/style/nsROCSSPrimitiveValue.cpp @@ -85,16 +85,18 @@ nsROCSSPrimitiveValue::SetScriptObject(void* aScriptObject) NS_IMETHODIMP -nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) +nsROCSSPrimitiveValue::GetCssText(nsAWritableString& aCssText) { + nsAutoString tmpStr; + aCssText.Truncate(); switch (mType) { case CSS_PX : { PRInt32 px = NSTwipsToIntPixels(mTwips, mT2P); - aCssText.AppendInt(px); - aCssText.AppendWithConversion("px"); + tmpStr.AppendInt(px); + tmpStr.AppendWithConversion("px"); break; } @@ -103,7 +105,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_CENTIMETERS(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("cm"); + tmpStr.AppendWithConversion("cm"); break; } case CSS_MM : @@ -111,7 +113,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_MILLIMETERS(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("mm"); + tmpStr.AppendWithConversion("mm"); break; } case CSS_IN : @@ -119,7 +121,7 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NS_TWIPS_TO_INCHES(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("in"); + tmpStr.AppendWithConversion("in"); break; } case CSS_PT : @@ -127,12 +129,12 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) float val = NSTwipsToFloatPoints(mTwips); char buf[64]; PR_snprintf(buf, 63, "%.2fcm", val); - aCssText.AppendWithConversion("pt"); + tmpStr.AppendWithConversion("pt"); break; } case CSS_STRING : { - aCssText.Append(mString); + tmpStr.Append(mString); break; } case CSS_PC : @@ -158,12 +160,14 @@ nsROCSSPrimitiveValue::GetCssText(nsString& aCssText) return NS_ERROR_DOM_INVALID_ACCESS_ERR; } + aCssText.Assign(tmpStr); + return NS_OK; } NS_IMETHODIMP -nsROCSSPrimitiveValue::SetCssText(const nsString& aCssText) +nsROCSSPrimitiveValue::SetCssText(const nsAReadableString& aCssText) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -253,16 +257,16 @@ nsROCSSPrimitiveValue::GetFloatValue(PRUint16 aUnitType, float* aReturn) NS_IMETHODIMP nsROCSSPrimitiveValue::SetStringValue(PRUint16 aStringType, - const nsString& aStringValue) + const nsAReadableString& aStringValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsROCSSPrimitiveValue::GetStringValue(nsString& aReturn) +nsROCSSPrimitiveValue::GetStringValue(nsAWritableString& aReturn) { - aReturn = mString; + aReturn.Assign(mString); return NS_OK; } diff --git a/layout/xbl/public/nsIBindingManager.h b/layout/xbl/public/nsIBindingManager.h index 985b21d298bd..e33153fc7b5f 100644 --- a/layout/xbl/public/nsIBindingManager.h +++ b/layout/xbl/public/nsIBindingManager.h @@ -59,9 +59,9 @@ public: NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult, PRBool* aMultipleInsertionPoints) = 0; - NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsString& aURL) = 0; - NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsString& aURL) = 0; - NS_IMETHOD LoadBindingDocument(nsIDocument* aDocument, const nsString& aURL) = 0; + NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) = 0; + NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) = 0; + NS_IMETHOD LoadBindingDocument(nsIDocument* aDocument, const nsAReadableString& aURL) = 0; NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding)=0; NS_IMETHOD ClearAttachedQueue()=0; diff --git a/layout/xbl/public/nsIXBLService.h b/layout/xbl/public/nsIXBLService.h index 045973e809c4..ae94b4915399 100644 --- a/layout/xbl/public/nsIXBLService.h +++ b/layout/xbl/public/nsIXBLService.h @@ -51,7 +51,7 @@ public: // This function loads a particular XBL file and installs all of the bindings // onto the element. - NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aAugmentFlag, + NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag, nsIXBLBinding** aBinding) = 0; // This function clears out the bindings on a given content node. diff --git a/layout/xbl/src/nsBindingManager.cpp b/layout/xbl/src/nsBindingManager.cpp index 89d3a7e87cbf..4b3e86b4d130 100644 --- a/layout/xbl/src/nsBindingManager.cpp +++ b/layout/xbl/src/nsBindingManager.cpp @@ -163,9 +163,9 @@ public: NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult, PRBool* aMultipleInsertionPoints); - NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsString& aURL); - NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsString& aURL); - NS_IMETHOD LoadBindingDocument(nsIDocument* aBoundDoc, const nsString& aURL); + NS_IMETHOD AddLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL); + NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL); + NS_IMETHOD LoadBindingDocument(nsIDocument* aBoundDoc, const nsAReadableString& aURL); NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding); NS_IMETHOD ClearAttachedQueue(); @@ -314,7 +314,7 @@ nsBindingManager::GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aRes } NS_IMETHODIMP -nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsString& aURL) +nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) { // First we need to load our binding. nsresult rv; @@ -334,7 +334,7 @@ nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsString& aURL) } NS_IMETHODIMP -nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, const nsString& aURL) +nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, const nsAReadableString& aURL) { /* nsCOMPtr binding; @@ -371,7 +371,7 @@ nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, const nsString& aUR } NS_IMETHODIMP -nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, const nsString& aURL) +nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, const nsAReadableString& aURL) { // First we need to load our binding. nsresult rv; @@ -380,7 +380,7 @@ nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc, const nsString& aU return rv; // Load the binding doc. - nsCString url; url.AssignWithConversion(aURL); + nsCString url; url.AssignWithConversion((const PRUnichar*)nsPromiseFlatString(aURL)); nsCOMPtr info; xblService->LoadBindingDocumentInfo(nsnull, aBoundDoc, url, nsCAutoString(), PR_TRUE, getter_AddRefs(info)); if (!info) diff --git a/layout/xbl/src/nsXBLService.cpp b/layout/xbl/src/nsXBLService.cpp index 374329928f24..0f2e0e4fce1a 100644 --- a/layout/xbl/src/nsXBLService.cpp +++ b/layout/xbl/src/nsXBLService.cpp @@ -577,7 +577,7 @@ nsXBLService::~nsXBLService(void) // This function loads a particular XBL file and installs all of the bindings // onto the element. NS_IMETHODIMP -nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aAugmentFlag, +nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag, nsIXBLBinding** aBinding) { *aBinding = nsnull; @@ -605,7 +605,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aA // See if the URIs match. nsCAutoString uri; styleBinding->GetBindingURI(uri); - if (uri.EqualsWithConversion(aURL)) + if (uri.EqualsWithConversion(nsPromiseFlatString(aURL))) return NS_OK; else { FlushStyleBindings(aContent); diff --git a/layout/xbl/src/nsXBLService.h b/layout/xbl/src/nsXBLService.h index 259324efad13..961cc3c504d4 100644 --- a/layout/xbl/src/nsXBLService.h +++ b/layout/xbl/src/nsXBLService.h @@ -49,7 +49,7 @@ class nsXBLService : public nsIXBLService, public nsIMemoryPressureObserver // This function loads a particular XBL file and installs all of the bindings // onto the element. - NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL, PRBool aAugmentFlag, + NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag, nsIXBLBinding** aBinding); // This method loads a binding doc and then builds the specific binding required. diff --git a/layout/xml/content/public/nsIXMLContent.h b/layout/xml/content/public/nsIXMLContent.h index 1c228c13dbb2..fb45ddc00021 100644 --- a/layout/xml/content/public/nsIXMLContent.h +++ b/layout/xml/content/public/nsIXMLContent.h @@ -75,32 +75,32 @@ NS_NewXMLElement(nsIXMLContent** aResult, nsINodeInfo* aNodeInfo); // XXX These belongs elsewhere extern nsresult NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult, - const nsString& aTarget, - const nsString& aData); + const nsAReadableString& aTarget, + const nsAReadableString& aData); extern nsresult NS_NewXMLEntity(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString aNotationName); + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aNotationName); extern nsresult NS_NewXMLNotation(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId); + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId); class nsIDOMNamedNodeMap; extern nsresult NS_NewXMLDocumentType(nsIContent** aInstancePtrResult, - const nsString& aName, + const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset); + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset); extern nsresult NS_NewXMLNamedNodeMap(nsIDOMNamedNodeMap** aInstancePtrResult, diff --git a/layout/xml/content/src/nsGenericXMLElement.cpp b/layout/xml/content/src/nsGenericXMLElement.cpp index 222909cd8a1f..a0f989837bf9 100644 --- a/layout/xml/content/src/nsGenericXMLElement.cpp +++ b/layout/xml/content/src/nsGenericXMLElement.cpp @@ -86,17 +86,17 @@ nsGenericXMLElement::CopyInnerTo(nsIContent* aSrcContent, return NS_OK; } - nsresult GetNodeName(nsString& aNodeName); - nsresult GetLocalName(nsString& aLocalName); + nsresult GetNodeName(nsAWritableString& aNodeName); + nsresult GetLocalName(nsAWritableString& aLocalName); nsresult -nsGenericXMLElement::GetNodeName(nsString& aNodeName) +nsGenericXMLElement::GetNodeName(nsAWritableString& aNodeName) { return mNodeInfo->GetQualifiedName(aNodeName); } nsresult -nsGenericXMLElement::GetLocalName(nsString& aLocalName) +nsGenericXMLElement::GetLocalName(nsAWritableString& aLocalName) { return mNodeInfo->GetLocalName(aLocalName); } @@ -176,7 +176,7 @@ nsGenericXMLElement::GetScriptObject(nsIScriptContext* aContext, } nsresult -nsGenericXMLElement::ParseAttributeString(const nsString& aStr, +nsGenericXMLElement::ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { diff --git a/layout/xml/content/src/nsGenericXMLElement.h b/layout/xml/content/src/nsGenericXMLElement.h index 2304fcac48e2..edb7cdd45049 100644 --- a/layout/xml/content/src/nsGenericXMLElement.h +++ b/layout/xml/content/src/nsGenericXMLElement.h @@ -41,46 +41,46 @@ public: nsGenericXMLElement* aDest, PRBool aDeep); - nsresult GetNodeName(nsString& aNodeName); - nsresult GetLocalName(nsString& aLocalName); + nsresult GetNodeName(nsAWritableString& aNodeName); + nsresult GetLocalName(nsAWritableString& aLocalName); // Implementation for nsIDOMElement - nsresult GetAttribute(const nsString& aName, nsString& aReturn) + nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { return nsGenericContainerElement::GetAttribute(aName, aReturn); } - nsresult SetAttribute(const nsString& aName, const nsString& aValue) + nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { return nsGenericContainerElement::SetAttribute(aName, aValue); } // nsIContent nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { return nsGenericContainerElement::SetAttribute(aNameSpaceID, aName, aValue, aNotify); } nsresult SetAttribute(nsINodeInfo *aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { return nsGenericContainerElement::SetAttribute(aNodeInfo, aValue, aNotify); } nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const + nsAWritableString& aResult) const { return nsGenericContainerElement::GetAttribute(aNameSpaceID, aName, aResult); } nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return nsGenericContainerElement::GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } - nsresult ParseAttributeString(const nsString& aStr, + nsresult ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID); nsresult GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, diff --git a/layout/xml/content/src/nsXMLCDATASection.cpp b/layout/xml/content/src/nsXMLCDATASection.cpp index 2829406d0ec2..7b02459bbcb2 100644 --- a/layout/xml/content/src/nsXMLCDATASection.cpp +++ b/layout/xml/content/src/nsXMLCDATASection.cpp @@ -142,9 +142,9 @@ nsXMLCDATASection::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLCDATASection::GetNodeName(nsString& aNodeName) +nsXMLCDATASection::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#cdata-section"); + aNodeName.Assign(NS_LITERAL_STRING("#cdata-section")); return NS_OK; } diff --git a/layout/xml/content/src/nsXMLDocumentType.cpp b/layout/xml/content/src/nsXMLDocumentType.cpp index cd55d339b4d6..4eea8346ee4e 100644 --- a/layout/xml/content/src/nsXMLDocumentType.cpp +++ b/layout/xml/content/src/nsXMLDocumentType.cpp @@ -41,12 +41,12 @@ class nsXMLDocumentType : public nsIDOMDocumentType, public nsIContent { public: - nsXMLDocumentType(const nsString& aName, + nsXMLDocumentType(const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset); + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset); virtual ~nsXMLDocumentType(); @@ -85,12 +85,12 @@ protected: nsresult NS_NewXMLDocumentType(nsIContent** aInstancePtrResult, - const nsString& aName, + const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset) + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); @@ -105,12 +105,12 @@ NS_NewXMLDocumentType(nsIContent** aInstancePtrResult, return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -nsXMLDocumentType::nsXMLDocumentType(const nsString& aName, +nsXMLDocumentType::nsXMLDocumentType(const nsAReadableString& aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString& aInternalSubset) : + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aInternalSubset) : mName(aName), mPublicId(aPublicId), mSystemId(aSystemId), @@ -184,9 +184,9 @@ nsXMLDocumentType::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_IMETHODIMP -nsXMLDocumentType::GetName(nsString& aName) +nsXMLDocumentType::GetName(nsAWritableString& aName) { - aName=mName; + aName.Assign(mName); return NS_OK; } @@ -218,25 +218,25 @@ nsXMLDocumentType::GetNotations(nsIDOMNamedNodeMap** aNotations) } NS_IMETHODIMP -nsXMLDocumentType::GetPublicId(nsString& aPublicId) +nsXMLDocumentType::GetPublicId(nsAWritableString& aPublicId) { - aPublicId = mPublicId; + aPublicId.Assign(mPublicId); return NS_OK; } NS_IMETHODIMP -nsXMLDocumentType::GetSystemId(nsString& aSystemId) +nsXMLDocumentType::GetSystemId(nsAWritableString& aSystemId) { - aSystemId = mSystemId; + aSystemId.Assign(mSystemId); return NS_OK; } NS_IMETHODIMP -nsXMLDocumentType::GetInternalSubset(nsString& aInternalSubset) +nsXMLDocumentType::GetInternalSubset(nsAWritableString& aInternalSubset) { - aInternalSubset = mInternalSubset; + aInternalSubset.Assign(mInternalSubset); return NS_OK; } @@ -292,9 +292,9 @@ nsXMLDocumentType::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLDocumentType::GetNodeName(nsString& aNodeName) +nsXMLDocumentType::GetNodeName(nsAWritableString& aNodeName) { - aNodeName=mName; + aNodeName.Assign(mName); return NS_OK; } diff --git a/layout/xml/content/src/nsXMLElement.cpp b/layout/xml/content/src/nsXMLElement.cpp index 2010ebcd54b6..9a20c7a21d9a 100644 --- a/layout/xml/content/src/nsXMLElement.cpp +++ b/layout/xml/content/src/nsXMLElement.cpp @@ -216,7 +216,7 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI) NS_IMETHODIMP nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { nsresult rv; @@ -233,13 +233,15 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, } NS_IMETHODIMP -nsXMLElement::SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, +nsXMLElement::SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); if (aNodeInfo->Equals(kTypeAtom, kNameSpaceID_XLink)) { - if (aValue.EqualsAtom(kSimpleAtom, PR_FALSE)) { + const PRUnichar* simpleStr; + kSimpleAtom->GetUnicode(&simpleStr); + if (aValue.Equals(simpleStr)) { // 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 @@ -271,10 +273,10 @@ static nsresult WebShellToPresContext(nsIWebShell *aShell, nsIPresContext **aPre } -static nsresult CheckLoadURI(nsIURI *aBaseURI, const nsString& aURI, nsIURI **aAbsURI) +static nsresult CheckLoadURI(nsIURI *aBaseURI, const nsAReadableString& aURI, nsIURI **aAbsURI) { // XXX URL escape? - nsCAutoString str; str.AssignWithConversion(aURI); + nsCAutoString str; str.Assign(NS_ConvertUCS2toUTF8(aURI)); *aAbsURI = nsnull; diff --git a/layout/xml/content/src/nsXMLElement.h b/layout/xml/content/src/nsXMLElement.h index 0de3db5cac21..d221eee50c81 100644 --- a/layout/xml/content/src/nsXMLElement.h +++ b/layout/xml/content/src/nsXMLElement.h @@ -110,7 +110,7 @@ public: NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { return mInner.GetNodeInfo(aResult); } - NS_IMETHOD ParseAttributeString(const nsString& aStr, + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID) { return mInner.ParseAttributeString(aStr, aName, aNameSpaceID); @@ -119,16 +119,16 @@ public: nsIAtom*& aPrefix) { return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); } - NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, + NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); - NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, + NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const { + nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aResult); } NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom*& aPrefix, nsString& aResult) const { + nsIAtom*& aPrefix, nsAWritableString& aResult) const { return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); } NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) { diff --git a/layout/xml/content/src/nsXMLEntity.cpp b/layout/xml/content/src/nsXMLEntity.cpp index aaa27524343c..0f93b97dd466 100644 --- a/layout/xml/content/src/nsXMLEntity.cpp +++ b/layout/xml/content/src/nsXMLEntity.cpp @@ -39,8 +39,10 @@ class nsXMLEntity : public nsIDOMEntity, public nsIContent { public: - nsXMLEntity(const nsString& aName, const nsString& aPublicId, - const nsString& aSystemId, const nsString aNotationName); + nsXMLEntity(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aNotationName); virtual ~nsXMLEntity(); // nsISupports @@ -50,9 +52,9 @@ public: NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner) // nsIDOMEntity - NS_IMETHOD GetPublicId(nsString& aPublicId); - NS_IMETHOD GetSystemId(nsString& aSystemId); - NS_IMETHOD GetNotationName(nsString& aNotationName); + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId); + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId); + NS_IMETHOD GetNotationName(nsAWritableString& aNotationName); // nsIScriptObjectOwner interface NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -78,9 +80,9 @@ protected: nsresult NS_NewXMLEntity(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId, + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, const nsString aNotationName) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); @@ -95,10 +97,10 @@ NS_NewXMLEntity(nsIContent** aInstancePtrResult, return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -nsXMLEntity::nsXMLEntity(const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId, - const nsString aNotationName) : +nsXMLEntity::nsXMLEntity(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId, + const nsAReadableString& aNotationName) : mName(aName), mPublicId(aPublicId), mSystemId(aSystemId), mNotationName(aNotationName) { NS_INIT_REFCNT(); @@ -161,25 +163,25 @@ nsXMLEntity::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_IMETHODIMP -nsXMLEntity::GetPublicId(nsString& aPublicId) +nsXMLEntity::GetPublicId(nsAWritableString& aPublicId) { - aPublicId=mPublicId; + aPublicId.Assign(mPublicId); return NS_OK; } NS_IMETHODIMP -nsXMLEntity::GetSystemId(nsString& aSystemId) +nsXMLEntity::GetSystemId(nsAWritableString& aSystemId) { - aSystemId=mSystemId; + aSystemId.Assign(mSystemId); return NS_OK; } NS_IMETHODIMP -nsXMLEntity::GetNotationName(nsString& aNotationName) +nsXMLEntity::GetNotationName(nsAWritableString& aNotationName) { - aNotationName=mNotationName; + aNotationName.Assign(mNotationName); return NS_OK; } @@ -235,9 +237,9 @@ nsXMLEntity::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLEntity::GetNodeName(nsString& aNodeName) +nsXMLEntity::GetNodeName(nsAWritableString& aNodeName) { - aNodeName=mName; + aNodeName.Assign(mName); return NS_OK; } diff --git a/layout/xml/content/src/nsXMLNamedNodeMap.cpp b/layout/xml/content/src/nsXMLNamedNodeMap.cpp index 7061c410a852..389a79224624 100644 --- a/layout/xml/content/src/nsXMLNamedNodeMap.cpp +++ b/layout/xml/content/src/nsXMLNamedNodeMap.cpp @@ -49,16 +49,16 @@ public: // nsIDOMNamedNodeMap NS_IMETHOD GetLength(PRUint32* aLength); - NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn); + NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn); NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); - NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, + NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn); NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn); - NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, + NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString&aLocalName, nsIDOMNode** aReturn); // nsIScriptObjectOwner interface @@ -145,7 +145,7 @@ nsXMLNamedNodeMap::GetLength(PRUint32* aLength) } NS_IMETHODIMP -nsXMLNamedNodeMap::GetNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXMLNamedNodeMap::GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (!aReturn) return NS_ERROR_NULL_POINTER; @@ -225,7 +225,7 @@ nsXMLNamedNodeMap::SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsXMLNamedNodeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXMLNamedNodeMap::RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn) { if (!aReturn) return NS_ERROR_NULL_POINTER; @@ -280,8 +280,8 @@ nsXMLNamedNodeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } nsresult -nsXMLNamedNodeMap::GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXMLNamedNodeMap::GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { return NS_ERROR_NOT_IMPLEMENTED; @@ -294,8 +294,8 @@ nsXMLNamedNodeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) } nsresult -nsXMLNamedNodeMap::RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, +nsXMLNamedNodeMap::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString&aLocalName, nsIDOMNode** aReturn) { return NS_ERROR_NOT_IMPLEMENTED; diff --git a/layout/xml/content/src/nsXMLNotation.cpp b/layout/xml/content/src/nsXMLNotation.cpp index 08ef59da9d37..83b52c098d1f 100644 --- a/layout/xml/content/src/nsXMLNotation.cpp +++ b/layout/xml/content/src/nsXMLNotation.cpp @@ -39,9 +39,9 @@ class nsXMLNotation : public nsIDOMNotation, public nsIContent { public: - nsXMLNotation(const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId); + nsXMLNotation(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId); virtual ~nsXMLNotation(); // nsISupports @@ -51,8 +51,8 @@ public: NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner) // nsIDOMNotation - NS_IMETHOD GetPublicId(nsString& aPublicId); - NS_IMETHOD GetSystemId(nsString& aSystemId); + NS_IMETHOD GetPublicId(nsAWritableString& aPublicId); + NS_IMETHOD GetSystemId(nsAWritableString& aSystemId); // nsIScriptObjectOwner interface NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); @@ -77,9 +77,9 @@ protected: nsresult NS_NewXMLNotation(nsIContent** aInstancePtrResult, - const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId) + const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { @@ -93,9 +93,9 @@ NS_NewXMLNotation(nsIContent** aInstancePtrResult, return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -nsXMLNotation::nsXMLNotation(const nsString& aName, - const nsString& aPublicId, - const nsString& aSystemId) : +nsXMLNotation::nsXMLNotation(const nsAReadableString& aName, + const nsAReadableString& aPublicId, + const nsAReadableString& aSystemId) : mName(aName), mPublicId(aPublicId), mSystemId(aSystemId) { NS_INIT_REFCNT(); @@ -158,17 +158,17 @@ nsXMLNotation::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_IMETHODIMP -nsXMLNotation::GetPublicId(nsString& aPublicId) +nsXMLNotation::GetPublicId(nsAWritableString& aPublicId) { - aPublicId=mPublicId; + aPublicId.Assign(mPublicId); return NS_OK; } NS_IMETHODIMP -nsXMLNotation::GetSystemId(nsString& aSystemId) +nsXMLNotation::GetSystemId(nsAWritableString& aSystemId) { - aSystemId=mSystemId; + aSystemId.Assign(mSystemId); return NS_OK; } @@ -224,9 +224,9 @@ nsXMLNotation::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLNotation::GetNodeName(nsString& aNodeName) +nsXMLNotation::GetNodeName(nsAWritableString& aNodeName) { - aNodeName=mName; + aNodeName.Assign(mName); return NS_OK; } diff --git a/layout/xml/content/src/nsXMLProcessingInstruction.cpp b/layout/xml/content/src/nsXMLProcessingInstruction.cpp index 75c2a435c8d3..0caaff1ffe3a 100644 --- a/layout/xml/content/src/nsXMLProcessingInstruction.cpp +++ b/layout/xml/content/src/nsXMLProcessingInstruction.cpp @@ -47,7 +47,7 @@ class nsXMLProcessingInstruction : public nsIDOMProcessingInstruction, public nsIContent { public: - nsXMLProcessingInstruction(const nsString& aTarget, const nsString& aData); + nsXMLProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData); virtual ~nsXMLProcessingInstruction(); // nsISupports @@ -85,8 +85,8 @@ protected: nsresult NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult, - const nsString& aTarget, - const nsString& aData) + const nsAReadableString& aTarget, + const nsAReadableString& aData) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { @@ -99,8 +99,8 @@ NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult, return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -nsXMLProcessingInstruction::nsXMLProcessingInstruction(const nsString& aTarget, - const nsString& aData) : +nsXMLProcessingInstruction::nsXMLProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData) : mTarget(aTarget) { NS_INIT_REFCNT(); @@ -170,21 +170,21 @@ nsXMLProcessingInstruction::QueryInterface(REFNSIID aIID, void** aInstancePtrRes } NS_IMETHODIMP -nsXMLProcessingInstruction::GetTarget(nsString& aTarget) +nsXMLProcessingInstruction::GetTarget(nsAWritableString& aTarget) { - aTarget=mTarget; + aTarget.Assign(mTarget); return NS_OK; } NS_IMETHODIMP -nsXMLProcessingInstruction::GetData(nsString& aData) +nsXMLProcessingInstruction::GetData(nsAWritableString& aData) { return mInner.GetData(aData); } NS_IMETHODIMP -nsXMLProcessingInstruction::SetData(const nsString& aData) +nsXMLProcessingInstruction::SetData(const nsAReadableString& aData) { // XXX Check if this is a stylesheet PI. If so, we may need // to parse the contents and see if anything has changed. @@ -344,9 +344,9 @@ nsXMLProcessingInstruction::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXMLProcessingInstruction::GetNodeName(nsString& aNodeName) +nsXMLProcessingInstruction::GetNodeName(nsAWritableString& aNodeName) { - aNodeName=mTarget; + aNodeName.Assign(mTarget); return NS_OK; } diff --git a/layout/xml/document/src/nsXMLDocument.cpp b/layout/xml/document/src/nsXMLDocument.cpp index 9633309212bb..bdd4eeb4bf46 100644 --- a/layout/xml/document/src/nsXMLDocument.cpp +++ b/layout/xml/document/src/nsXMLDocument.cpp @@ -128,8 +128,8 @@ MyPrefChangedCallback(const char*aPrefName, void* instance_data) NS_LAYOUT nsresult NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult, - const nsString& aNamespaceURI, - const nsString& aQualifiedName, + const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIURI* aBaseURI) { @@ -274,15 +274,15 @@ nsXMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) } NS_IMETHODIMP -nsXMLDocument::GetContentType(nsString& aContentType) const +nsXMLDocument::GetContentType(nsAWritableString& aContentType) const { // XXX Should get document type from incoming stream - aContentType.AssignWithConversion("text/xml"); + aContentType.Assign(NS_LITERAL_STRING("text/xml")); return NS_OK; } NS_IMETHODIMP -nsXMLDocument::Load(const nsString& aUrl) +nsXMLDocument::Load(const nsAReadableString& aUrl) { nsCOMPtr channel; nsCOMPtr uri; @@ -685,7 +685,7 @@ nsXMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType) } NS_IMETHODIMP -nsXMLDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) +nsXMLDocument::CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn) { nsIContent* content; nsresult rv = NS_NewXMLCDATASection(&content); @@ -700,15 +700,15 @@ nsXMLDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aR } NS_IMETHODIMP -nsXMLDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn) +nsXMLDocument::CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn) { *aReturn = nsnull; return NS_OK; } NS_IMETHODIMP -nsXMLDocument::CreateProcessingInstruction(const nsString& aTarget, - const nsString& aData, +nsXMLDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn) { nsIContent* content; @@ -725,7 +725,7 @@ nsXMLDocument::CreateProcessingInstruction(const nsString& aTarget, } NS_IMETHODIMP -nsXMLDocument::CreateElement(const nsString& aTagName, +nsXMLDocument::CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -749,8 +749,8 @@ nsXMLDocument::CreateElement(const nsString& aTagName, } NS_IMETHODIMP -nsXMLDocument::CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, +nsXMLDocument::CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn) { printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n"); @@ -864,8 +864,8 @@ nsXMLDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsXMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXMLDocument::CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -873,8 +873,8 @@ nsXMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXMLDocument::CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXMLDocument::CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn) { nsresult rv = NS_OK; @@ -908,7 +908,7 @@ nsXMLDocument::CreateElementNS(const nsString& aNamespaceURI, } static nsIContent * -MatchName(nsIContent *aContent, const nsString& aName) +MatchName(nsIContent *aContent, const nsAReadableString& aName) { nsAutoString value; nsIContent *result = nsnull; @@ -939,7 +939,7 @@ MatchName(nsIContent *aContent, const nsString& aName) } NS_IMETHODIMP -nsXMLDocument::GetElementById(const nsString& aElementId, +nsXMLDocument::GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn) { // XXX Since we don't have a validating parser, the only content diff --git a/layout/xml/document/src/nsXMLDocument.h b/layout/xml/document/src/nsXMLDocument.h index 9a8761859b9b..b02e770b253e 100644 --- a/layout/xml/document/src/nsXMLDocument.h +++ b/layout/xml/document/src/nsXMLDocument.h @@ -48,7 +48,7 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, @@ -64,26 +64,26 @@ public: // nsIDOMDocument interface NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType); - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); - NS_IMETHOD CreateElement(const nsString& aTagName, + NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn); + NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn); + NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn); + NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn); - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, + NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, nsIDOMElement** aReturn); NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, + NS_IMETHOD CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn); - NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, + NS_IMETHOD CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn); - NS_IMETHOD GetElementById(const nsString& aElementId, + NS_IMETHOD GetElementById(const nsAReadableString& aElementId, nsIDOMElement** aReturn); - NS_IMETHOD Load(const nsString& aUrl); + NS_IMETHOD Load(const nsAReadableString& aUrl); // nsIXMLDocument interface #ifdef MOZ_XSL diff --git a/layout/xul/base/src/nsTitledButtonFrame.cpp b/layout/xul/base/src/nsTitledButtonFrame.cpp index e4c2167385ed..77007de172f0 100644 --- a/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -1305,11 +1305,11 @@ nsTitledButtonFrame :: CheckStateToString ( CheckState inState, nsString& outSta { switch ( inState ) { case eOn: - outStateAsString.AssignWithConversion(NS_STRING_TRUE); + outStateAsString.Assign(NS_STRING_TRUE); break; case eOff: - outStateAsString.AssignWithConversion(NS_STRING_FALSE); + outStateAsString.Assign(NS_STRING_FALSE); break; case eMixed: diff --git a/mailnews/base/src/nsMsgPrintEngine.cpp b/mailnews/base/src/nsMsgPrintEngine.cpp index beb997bea1cd..6f82a1acf25c 100644 --- a/mailnews/base/src/nsMsgPrintEngine.cpp +++ b/mailnews/base/src/nsMsgPrintEngine.cpp @@ -214,7 +214,7 @@ nsMsgPrintEngine::SetWindow(nsIDOMWindow *aWin) NS_IMETHODIMP nsMsgPrintEngine::AddPrintURI(const PRUnichar *aMsgURI) { - mURIArray.AppendString(nsAutoString(aMsgURI)); + mURIArray.AppendString(nsLiteralString(aMsgURI)); return NS_OK; } diff --git a/mailnews/mime/src/nsMimeTransition.cpp b/mailnews/mime/src/nsMimeTransition.cpp index e82f5c86e135..5d23ce2f39c0 100644 --- a/mailnews/mime/src/nsMimeTransition.cpp +++ b/mailnews/mime/src/nsMimeTransition.cpp @@ -27,9 +27,6 @@ #include "nsMimeTransition.h" -#ifndef XP_MAC -#include "nsTextFragment.h" -#endif #include "msgCore.h" #include "mimebuf.h" diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index 4e350fb78d07..42a164d4bd28 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -2428,9 +2428,9 @@ public: virtual ~DOMMimeTypeImpl() { } - NS_METHOD GetDescription(nsString& aDescription) + NS_METHOD GetDescription(nsAWritableString& aDescription) { - aDescription = mDescription; + aDescription.Assign(mDescription); return NS_OK; } @@ -2441,15 +2441,15 @@ public: return NS_OK; } - NS_METHOD GetSuffixes(nsString& aSuffixes) + NS_METHOD GetSuffixes(nsAWritableString& aSuffixes) { - aSuffixes = mSuffixes; + aSuffixes.Assign(mSuffixes); return NS_OK; } - NS_METHOD GetType(nsString& aType) + NS_METHOD GetType(nsAWritableString& aType) { - aType = mType; + aType.Assign(mType); return NS_OK; } @@ -2473,21 +2473,21 @@ public: virtual ~DOMPluginImpl() { } - NS_METHOD GetDescription(nsString& aDescription) + NS_METHOD GetDescription(nsAWritableString& aDescription) { - aDescription.AssignWithConversion(mPluginTag.mDescription); + aDescription.Assign(NS_ConvertASCIItoUCS2(mPluginTag.mDescription)); return NS_OK; } - NS_METHOD GetFilename(nsString& aFilename) + NS_METHOD GetFilename(nsAWritableString& aFilename) { - aFilename.AssignWithConversion(mPluginTag.mFileName); + aFilename.Assign(NS_ConvertASCIItoUCS2(mPluginTag.mFileName)); return NS_OK; } - NS_METHOD GetName(nsString& aName) + NS_METHOD GetName(nsAWritableString& aName) { - aName.AssignWithConversion(mPluginTag.mName); + aName.Assign(NS_ConvertASCIItoUCS2(mPluginTag.mName)); return NS_OK; } @@ -2505,10 +2505,10 @@ public: return NS_OK; } - NS_METHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn) + NS_METHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn) { for (int index = mPluginTag.mVariants - 1; index >= 0; --index) { - if (aName.EqualsWithConversion(mPluginTag.mMimeTypeArray[index])) + if (aName.Equals(NS_ConvertASCIItoUCS2(mPluginTag.mMimeTypeArray[index]))) return Item(index, aReturn); } return NS_OK; diff --git a/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/modules/plugin/nglsrc/nsPluginHostImpl.cpp index 4e350fb78d07..42a164d4bd28 100644 --- a/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -2428,9 +2428,9 @@ public: virtual ~DOMMimeTypeImpl() { } - NS_METHOD GetDescription(nsString& aDescription) + NS_METHOD GetDescription(nsAWritableString& aDescription) { - aDescription = mDescription; + aDescription.Assign(mDescription); return NS_OK; } @@ -2441,15 +2441,15 @@ public: return NS_OK; } - NS_METHOD GetSuffixes(nsString& aSuffixes) + NS_METHOD GetSuffixes(nsAWritableString& aSuffixes) { - aSuffixes = mSuffixes; + aSuffixes.Assign(mSuffixes); return NS_OK; } - NS_METHOD GetType(nsString& aType) + NS_METHOD GetType(nsAWritableString& aType) { - aType = mType; + aType.Assign(mType); return NS_OK; } @@ -2473,21 +2473,21 @@ public: virtual ~DOMPluginImpl() { } - NS_METHOD GetDescription(nsString& aDescription) + NS_METHOD GetDescription(nsAWritableString& aDescription) { - aDescription.AssignWithConversion(mPluginTag.mDescription); + aDescription.Assign(NS_ConvertASCIItoUCS2(mPluginTag.mDescription)); return NS_OK; } - NS_METHOD GetFilename(nsString& aFilename) + NS_METHOD GetFilename(nsAWritableString& aFilename) { - aFilename.AssignWithConversion(mPluginTag.mFileName); + aFilename.Assign(NS_ConvertASCIItoUCS2(mPluginTag.mFileName)); return NS_OK; } - NS_METHOD GetName(nsString& aName) + NS_METHOD GetName(nsAWritableString& aName) { - aName.AssignWithConversion(mPluginTag.mName); + aName.Assign(NS_ConvertASCIItoUCS2(mPluginTag.mName)); return NS_OK; } @@ -2505,10 +2505,10 @@ public: return NS_OK; } - NS_METHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn) + NS_METHOD NamedItem(const nsAReadableString& aName, nsIDOMMimeType** aReturn) { for (int index = mPluginTag.mVariants - 1; index >= 0; --index) { - if (aName.EqualsWithConversion(mPluginTag.mMimeTypeArray[index])) + if (aName.Equals(NS_ConvertASCIItoUCS2(mPluginTag.mMimeTypeArray[index]))) return Item(index, aReturn); } return NS_OK; diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h index 299363df472a..8c390b2fb4da 100644 --- a/netwerk/base/public/nsNetUtil.h +++ b/netwerk/base/public/nsNetUtil.h @@ -30,6 +30,7 @@ #include "nsILoadGroup.h" #include "nsIInterfaceRequestor.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "nsIIOService.h" #include "nsIServiceManager.h" #include "nsIChannel.h" @@ -67,11 +68,11 @@ NS_NewURI(nsIURI* *result, inline nsresult NS_NewURI(nsIURI* *result, - const nsString& spec, + const nsAReadableString& spec, nsIURI* baseURI = nsnull, nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers { - char* specStr = spec.ToNewUTF8String(); // this forces a single byte char* + char* specStr = ToNewUTF8String(spec); // this forces a single byte char* if (specStr == nsnull) return NS_ERROR_OUT_OF_MEMORY; nsresult rv = NS_NewURI(result, specStr, baseURI, ioService); @@ -202,13 +203,13 @@ NS_MakeAbsoluteURI(char* *result, } inline nsresult -NS_MakeAbsoluteURI(nsString& result, - const nsString& spec, +NS_MakeAbsoluteURI(nsAWritableString& result, + const nsAReadableString& spec, nsIURI* baseURI = nsnull, nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers { char* resultStr; - char* specStr = spec.ToNewUTF8String(); + char* specStr = ToNewUTF8String(spec); if (!specStr) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/netwerk/streamconv/converters/nsFTPDirListingConv.h b/netwerk/streamconv/converters/nsFTPDirListingConv.h index c3512b743ee2..80ff10b01256 100644 --- a/netwerk/streamconv/converters/nsFTPDirListingConv.h +++ b/netwerk/streamconv/converters/nsFTPDirListingConv.h @@ -25,7 +25,7 @@ #include "nsIStreamConverter.h" #include "nsIChannel.h" #include "nsIURI.h" -#include "nsString2.h" +#include "nsString.h" #include "nsILocale.h" #include "nsIDateTimeFormat.h" diff --git a/parser/htmlparser/src/nsHTMLContentSinkStream.cpp b/parser/htmlparser/src/nsHTMLContentSinkStream.cpp index 1a963fdf7a8a..95f057fcd267 100644 --- a/parser/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/parser/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -128,8 +128,8 @@ nsHTMLContentSinkStream::nsHTMLContentSinkStream() NS_IMETHODIMP nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, - const nsString* aCharsetOverride, + nsAWritableString* aOutString, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags) { mDoFormat = (aFlags & nsIDocumentEncoder::OutputFormatted) ? PR_TRUE @@ -157,7 +157,7 @@ nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream, mStream = aOutStream; mString = aOutString; if (aCharsetOverride != nsnull) - mCharsetOverride.AssignWithConversion(aCharsetOverride->GetUnicode()); + mCharsetOverride.Assign(*aCharsetOverride); mPreLevel = 0; @@ -227,10 +227,10 @@ nsHTMLContentSinkStream::InitEncoders() // Initialize a charset encoder if we're using the stream interface if (mStream) { - nsAutoString charsetName; charsetName.AssignWithConversion(mCharsetOverride); + nsAutoString charsetName; charsetName.Assign(mCharsetOverride); NS_WITH_SERVICE(nsICharsetAlias, calias, kCharsetAliasCID, &res); if (NS_SUCCEEDED(res) && calias) { - nsAutoString temp; temp.AssignWithConversion(mCharsetOverride); + nsAutoString temp; temp.Assign(mCharsetOverride); res = calias->GetPreferred(temp, charsetName); } if (NS_FAILED(res)) @@ -374,7 +374,7 @@ void nsHTMLContentSinkStream::Write(const char* aData) } if (mString) { - mString->AppendWithConversion(aData); + mString->Append(NS_ConvertASCIItoUCS2(aData)); } } @@ -390,7 +390,7 @@ void nsHTMLContentSinkStream::Write(char aData) } if (mString) { - mString->AppendWithConversion(aData); + mString->Append(NS_ConvertASCIItoUCS2(aData)); } } @@ -1072,7 +1072,7 @@ nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode) { const nsString& value=aNode.GetValueAt(i); if (mCharsetOverride.IsEmpty()) - mCharsetOverride.AssignWithConversion(value.GetUnicode()); + mCharsetOverride.Assign(value); InitEncoders(); } else if (key.EqualsWithConversion("uri")) diff --git a/parser/htmlparser/src/nsHTMLContentSinkStream.h b/parser/htmlparser/src/nsHTMLContentSinkStream.h index a6fd3d91d579..cf44cab7ac0e 100644 --- a/parser/htmlparser/src/nsHTMLContentSinkStream.h +++ b/parser/htmlparser/src/nsHTMLContentSinkStream.h @@ -50,6 +50,7 @@ #include "nsISaveAsCharset.h" #include "nsIEntityConverter.h" #include "nsIURI.h" +#include "nsAWritableString.h" #define NS_IHTMLCONTENTSINKSTREAM_IID \ {0xa39c6bff, 0x15f0, 0x11d2, \ @@ -68,8 +69,8 @@ class nsIHTMLContentSinkStream : public nsIHTMLContentSink { NS_DEFINE_STATIC_CID_ACCESSOR(NS_HTMLCONTENTSINKSTREAM_CID) NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, - const nsString* aCharsetOverride, + nsAWritableString* aOutString, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags) = 0; }; @@ -97,8 +98,8 @@ class nsHTMLContentSinkStream : public nsIHTMLContentSinkStream // nsIHTMLContentSinkStream NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, - const nsString* aCharsetOverride, + nsAWritableString* aOutString, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags); @@ -167,7 +168,7 @@ protected: protected: nsIOutputStream* mStream; - nsString* mString; + nsAWritableString* mString; int mTabLevel; char* mBuffer; @@ -197,14 +198,14 @@ protected: nsCOMPtr mCharsetEncoder; nsCOMPtr mEntityConverter; - nsCAutoString mCharsetOverride; + nsString mCharsetOverride; }; inline nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult, nsIOutputStream* aOutStream, - const nsString* aCharsetOverride, + const nsAReadableString* aCharsetOverride, PRUint32 aFlags) { nsCOMPtr it; @@ -231,7 +232,7 @@ NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult, inline nsresult NS_New_HTML_ContentSinkStream(nsIHTMLContentSink** aInstancePtrResult, - nsString* aOutString, PRUint32 aFlags) + nsAWritableString* aOutString, PRUint32 aFlags) { nsCOMPtr it; nsresult rv; diff --git a/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp index 83fdf565a8c9..2418d37ac73d 100644 --- a/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -249,10 +249,13 @@ nsHTMLToTXTSinkStream::~nsHTMLToTXTSinkStream() */ NS_IMETHODIMP nsHTMLToTXTSinkStream::Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aFlags) { mStream = aOutStream; + // XXX This is wrong. It violates XPCOM string ownership rules. + // We're only getting away with this because instances of this + // class are restricted to single function scope. mString = aOutString; mFlags = aFlags; @@ -304,11 +307,11 @@ nsHTMLToTXTSinkStream::Initialize(nsIOutputStream* aOutStream, } NS_IMETHODIMP -nsHTMLToTXTSinkStream::SetCharsetOverride(const nsString* aCharset) +nsHTMLToTXTSinkStream::SetCharsetOverride(const nsAReadableString* aCharset) { if (aCharset) { - mCharsetOverride = *aCharset; + mCharsetOverride.Assign(*aCharset); InitEncoder(mCharsetOverride); } return NS_OK; @@ -1108,7 +1111,7 @@ void nsHTMLToTXTSinkStream::WriteSimple(nsString& aString) } if (mString != nsnull) { - mString->AppendWithConversion(mBuffer); + mString->Append(NS_ConvertASCIItoUCS2(mBuffer)); } } else diff --git a/parser/htmlparser/src/nsHTMLToTXTSinkStream.h b/parser/htmlparser/src/nsHTMLToTXTSinkStream.h index cd0df7990d94..2c5b631428e3 100644 --- a/parser/htmlparser/src/nsHTMLToTXTSinkStream.h +++ b/parser/htmlparser/src/nsHTMLToTXTSinkStream.h @@ -62,9 +62,9 @@ class nsIHTMLToTXTSinkStream : public nsIHTMLContentSink { NS_DEFINE_STATIC_CID_ACCESSOR(NS_HTMLTOTXTSINKSTREAM_CID) NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aFlags) = 0; - NS_IMETHOD SetCharsetOverride(const nsString* aCharset) = 0; + NS_IMETHOD SetCharsetOverride(const nsAReadableString* aCharset) = 0; NS_IMETHOD SetWrapColumn(PRUint32 aWrapCol) = 0; }; @@ -85,10 +85,10 @@ class nsHTMLToTXTSinkStream : public nsIHTMLToTXTSinkStream virtual ~nsHTMLToTXTSinkStream(); NS_IMETHOD Initialize(nsIOutputStream* aOutStream, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aFlags); - NS_IMETHOD SetCharsetOverride(const nsString* aCharset); + NS_IMETHOD SetCharsetOverride(const nsAReadableString* aCharset); // nsISupports NS_DECL_ISUPPORTS @@ -159,8 +159,11 @@ protected: protected: - nsIOutputStream* mStream; - nsString* mString; + nsIOutputStream* mStream; + // XXX This is wrong. It violates XPCOM string ownership rules. + // We're only getting away with this because instances of this + // class are restricted to single function scope. + nsAWritableString* mString; nsString mCurrentLine; PRInt32 mIndent; @@ -222,7 +225,7 @@ protected: inline nsresult NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult, nsIOutputStream* aOutStream, - const nsString* aCharsetOverride=nsnull, + const nsAReadableString* aCharsetOverride=nsnull, PRUint32 aWrapColumn=0, PRUint32 aFlags=0) { nsCOMPtr it; @@ -250,7 +253,7 @@ NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult, inline nsresult NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult, - nsString* aOutString, + nsAWritableString* aOutString, PRUint32 aWrapColumn=0, PRUint32 aFlags=0) { nsCOMPtr it; diff --git a/parser/htmlparser/src/nsIParser.h b/parser/htmlparser/src/nsIParser.h index 1728128d0401..c232bd4d2306 100644 --- a/parser/htmlparser/src/nsIParser.h +++ b/parser/htmlparser/src/nsIParser.h @@ -224,12 +224,12 @@ class nsIParser : public nsISupports { virtual nsresult Parse(nsIURI* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; - virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0; + virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Terminate(void) = 0; - virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; - virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; + virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; + virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0; /** * This method gets called when the tokens have been consumed, and it's time diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index 225cfcfffa6d..c073a886acd6 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -1609,17 +1609,12 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo * @param aMimeType tells us what type of content to expect in the given string * @return error code -- 0 if ok, non-zero if error. */ -nsresult nsParser::Parse(const nsString& aSourceBuffer,void* aKey,const nsString& +nsresult nsParser::Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){ //NOTE: Make sure that updates to this method don't cause // bug #2361 to break again! -#if 0 - //this is only for debug purposes - aSourceBuffer.DebugDump(); -#endif - nsresult result=NS_OK; nsParser* me = this; // Maintain a reference to ourselves so we don't go away @@ -1701,7 +1696,7 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){ * @param aMimeType tells us what kind of stuff you're inserting * @return TRUE if valid, otherwise FALSE */ -PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ +PRBool nsParser::IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ /************************************************************************************ This method works like this: @@ -1754,7 +1749,7 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta * @param * @return */ -nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ +nsresult nsParser::ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){ nsresult result=NS_OK; nsAutoString theContext; diff --git a/parser/htmlparser/src/nsParser.h b/parser/htmlparser/src/nsParser.h index 9257e3303cb8..ba846cbcc45c 100644 --- a/parser/htmlparser/src/nsParser.h +++ b/parser/htmlparser/src/nsParser.h @@ -200,10 +200,10 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, * @param appendTokens tells us whether we should insert tokens inline, or append them. * @return TRUE if all went well -- FALSE otherwise */ - virtual nsresult Parse(const nsString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect); + virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect); - virtual PRBool IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); - virtual nsresult ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); + virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); + virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect); /** diff --git a/parser/htmlparser/src/nsScanner.cpp b/parser/htmlparser/src/nsScanner.cpp index 7c0dfdb68913..8ffce4ff81bb 100644 --- a/parser/htmlparser/src/nsScanner.cpp +++ b/parser/htmlparser/src/nsScanner.cpp @@ -236,7 +236,7 @@ PRUint32 nsScanner::Mark(PRInt32 anIndex){ * @update harishd 01/12/99 * @return error code */ -PRBool nsScanner::Insert(const nsString& aBuffer) { +PRBool nsScanner::Insert(const nsAReadableString& aBuffer) { mBuffer.Insert(aBuffer,mOffset); mTotalRead+=aBuffer.Length(); @@ -250,7 +250,7 @@ PRBool nsScanner::Insert(const nsString& aBuffer) { * @update gess4/3/98 * @return error code */ -PRBool nsScanner::Append(const nsString& aBuffer) { +PRBool nsScanner::Append(const nsAReadableString& aBuffer) { PRUint32 theLen=mBuffer.Length(); diff --git a/parser/htmlparser/src/nsScanner.h b/parser/htmlparser/src/nsScanner.h index 1a0c3a6249d2..cb75d5b40dfd 100644 --- a/parser/htmlparser/src/nsScanner.h +++ b/parser/htmlparser/src/nsScanner.h @@ -247,7 +247,7 @@ class nsScanner { * @param * @return */ - PRBool Insert(const nsString& aBuffer); + PRBool Insert(const nsAReadableString& aBuffer); /** * @@ -256,7 +256,7 @@ class nsScanner { * @param * @return */ - PRBool Append(const nsString& aBuffer); + PRBool Append(const nsAReadableString& aBuffer); /** * diff --git a/rdf/content/public/nsIDOMXULCommandDispatcher.h b/rdf/content/public/nsIDOMXULCommandDispatcher.h index 025cb9e733c7..b5bc0a7a1d54 100644 --- a/rdf/content/public/nsIDOMXULCommandDispatcher.h +++ b/rdf/content/public/nsIDOMXULCommandDispatcher.h @@ -56,13 +56,13 @@ public: NS_IMETHOD GetActive(PRBool* aActive)=0; NS_IMETHOD SetActive(PRBool aActive)=0; - NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets)=0; + NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsAReadableString& aEvents, const nsAReadableString& aTargets)=0; NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater)=0; - NS_IMETHOD UpdateCommands(const nsString& aEventName)=0; + NS_IMETHOD UpdateCommands(const nsAReadableString& aEventName)=0; - NS_IMETHOD GetControllerForCommand(const nsString& aCommand, nsIController** aReturn)=0; + NS_IMETHOD GetControllerForCommand(const nsAReadableString& aCommand, nsIController** aReturn)=0; NS_IMETHOD GetControllers(nsIControllers** aReturn)=0; }; @@ -79,10 +79,10 @@ public: NS_IMETHOD SetSuppressFocusScroll(PRBool aSuppressFocusScroll); \ NS_IMETHOD GetActive(PRBool* aActive); \ NS_IMETHOD SetActive(PRBool aActive); \ - NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets); \ + NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsAReadableString& aEvents, const nsAReadableString& aTargets); \ NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater); \ - NS_IMETHOD UpdateCommands(const nsString& aEventName); \ - NS_IMETHOD GetControllerForCommand(const nsString& aCommand, nsIController** aReturn); \ + NS_IMETHOD UpdateCommands(const nsAReadableString& aEventName); \ + NS_IMETHOD GetControllerForCommand(const nsAReadableString& aCommand, nsIController** aReturn); \ NS_IMETHOD GetControllers(nsIControllers** aReturn); \ @@ -98,10 +98,10 @@ public: NS_IMETHOD SetSuppressFocusScroll(PRBool aSuppressFocusScroll) { return _to SetSuppressFocusScroll(aSuppressFocusScroll); } \ NS_IMETHOD GetActive(PRBool* aActive) { return _to GetActive(aActive); } \ NS_IMETHOD SetActive(PRBool aActive) { return _to SetActive(aActive); } \ - NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsString& aEvents, const nsString& aTargets) { return _to AddCommandUpdater(aUpdater, aEvents, aTargets); } \ + NS_IMETHOD AddCommandUpdater(nsIDOMElement* aUpdater, const nsAReadableString& aEvents, const nsAReadableString& aTargets) { return _to AddCommandUpdater(aUpdater, aEvents, aTargets); } \ NS_IMETHOD RemoveCommandUpdater(nsIDOMElement* aUpdater) { return _to RemoveCommandUpdater(aUpdater); } \ - NS_IMETHOD UpdateCommands(const nsString& aEventName) { return _to UpdateCommands(aEventName); } \ - NS_IMETHOD GetControllerForCommand(const nsString& aCommand, nsIController** aReturn) { return _to GetControllerForCommand(aCommand, aReturn); } \ + NS_IMETHOD UpdateCommands(const nsAReadableString& aEventName) { return _to UpdateCommands(aEventName); } \ + NS_IMETHOD GetControllerForCommand(const nsAReadableString& aCommand, nsIController** aReturn) { return _to GetControllerForCommand(aCommand, aReturn); } \ NS_IMETHOD GetControllers(nsIControllers** aReturn) { return _to GetControllers(aReturn); } \ diff --git a/rdf/content/public/nsIDOMXULDocument.h b/rdf/content/public/nsIDOMXULDocument.h index 78feb38e632c..b0225fc6aec8 100644 --- a/rdf/content/public/nsIDOMXULDocument.h +++ b/rdf/content/public/nsIDOMXULDocument.h @@ -56,9 +56,9 @@ public: NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls)=0; - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn)=0; - NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr)=0; + NS_IMETHOD Persist(const nsAReadableString& aId, const nsAReadableString& aAttr)=0; }; @@ -71,8 +71,8 @@ public: NS_IMETHOD GetWidth(PRInt32* aWidth); \ NS_IMETHOD GetHeight(PRInt32* aHeight); \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls); \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \ - NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr); \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn); \ + NS_IMETHOD Persist(const nsAReadableString& aId, const nsAReadableString& aAttr); \ @@ -85,8 +85,8 @@ public: NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \ NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls) { return _to GetControls(aControls); } \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ - NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr) { return _to Persist(aId, aAttr); } \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ + NS_IMETHOD Persist(const nsAReadableString& aId, const nsAReadableString& aAttr) { return _to Persist(aId, aAttr); } \ extern "C" NS_DOM nsresult NS_InitXULDocumentClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/rdf/content/public/nsIDOMXULElement.h b/rdf/content/public/nsIDOMXULElement.h index 219835ef1e05..7c5190e3c6eb 100644 --- a/rdf/content/public/nsIDOMXULElement.h +++ b/rdf/content/public/nsIDOMXULElement.h @@ -46,11 +46,11 @@ class nsIDOMXULElement : public nsIDOMElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULELEMENT_IID; return iid; } - NS_IMETHOD GetId(nsString& aId)=0; - NS_IMETHOD SetId(const nsString& aId)=0; + NS_IMETHOD GetId(nsAWritableString& aId)=0; + NS_IMETHOD SetId(const nsAReadableString& aId)=0; - NS_IMETHOD GetClassName(nsString& aClassName)=0; - NS_IMETHOD SetClassName(const nsString& aClassName)=0; + NS_IMETHOD GetClassName(nsAWritableString& aClassName)=0; + NS_IMETHOD SetClassName(const nsAReadableString& aClassName)=0; NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0; @@ -64,9 +64,9 @@ public: NS_IMETHOD GetBoxObject(nsIBoxObject** aBoxObject)=0; - NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0; + NS_IMETHOD AddBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement)=0; - NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0; + NS_IMETHOD RemoveBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement)=0; NS_IMETHOD DoCommand()=0; @@ -76,49 +76,49 @@ public: NS_IMETHOD Click()=0; - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0; + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn)=0; }; #define NS_DECL_IDOMXULELEMENT \ - NS_IMETHOD GetId(nsString& aId); \ - NS_IMETHOD SetId(const nsString& aId); \ - NS_IMETHOD GetClassName(nsString& aClassName); \ - NS_IMETHOD SetClassName(const nsString& aClassName); \ + NS_IMETHOD GetId(nsAWritableString& aId); \ + NS_IMETHOD SetId(const nsAReadableString& aId); \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName); \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName); \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \ NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \ NS_IMETHOD GetBuilder(nsIXULTemplateBuilder** aBuilder); \ NS_IMETHOD GetResource(nsIRDFResource** aResource); \ NS_IMETHOD GetControllers(nsIControllers** aControllers); \ NS_IMETHOD GetBoxObject(nsIBoxObject** aBoxObject); \ - NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \ - NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \ + NS_IMETHOD AddBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement); \ + NS_IMETHOD RemoveBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement); \ NS_IMETHOD DoCommand(); \ NS_IMETHOD Focus(); \ NS_IMETHOD Blur(); \ NS_IMETHOD Click(); \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn); \ #define NS_FORWARD_IDOMXULELEMENT(_to) \ - NS_IMETHOD GetId(nsString& aId) { return _to GetId(aId); } \ - NS_IMETHOD SetId(const nsString& aId) { return _to SetId(aId); } \ - NS_IMETHOD GetClassName(nsString& aClassName) { return _to GetClassName(aClassName); } \ - NS_IMETHOD SetClassName(const nsString& aClassName) { return _to SetClassName(aClassName); } \ + NS_IMETHOD GetId(nsAWritableString& aId) { return _to GetId(aId); } \ + NS_IMETHOD SetId(const nsAReadableString& aId) { return _to SetId(aId); } \ + NS_IMETHOD GetClassName(nsAWritableString& aClassName) { return _to GetClassName(aClassName); } \ + NS_IMETHOD SetClassName(const nsAReadableString& aClassName) { return _to SetClassName(aClassName); } \ NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \ NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \ NS_IMETHOD GetBuilder(nsIXULTemplateBuilder** aBuilder) { return _to GetBuilder(aBuilder); } \ NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \ NS_IMETHOD GetControllers(nsIControllers** aControllers) { return _to GetControllers(aControllers); } \ NS_IMETHOD GetBoxObject(nsIBoxObject** aBoxObject) { return _to GetBoxObject(aBoxObject); } \ - NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \ - NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \ + NS_IMETHOD AddBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \ + NS_IMETHOD RemoveBroadcastListener(const nsAReadableString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \ NS_IMETHOD DoCommand() { return _to DoCommand(); } \ NS_IMETHOD Focus() { return _to Focus(); } \ NS_IMETHOD Blur() { return _to Blur(); } \ NS_IMETHOD Click() { return _to Click(); } \ - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ + NS_IMETHOD GetElementsByAttribute(const nsAReadableString& aName, const nsAReadableString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ extern "C" NS_DOM nsresult NS_InitXULElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/rdf/content/public/nsIDOMXULMenuListElement.h b/rdf/content/public/nsIDOMXULMenuListElement.h index 2e314c7edf32..a8f02c2f400a 100644 --- a/rdf/content/public/nsIDOMXULMenuListElement.h +++ b/rdf/content/public/nsIDOMXULMenuListElement.h @@ -39,11 +39,11 @@ class nsIDOMXULMenuListElement : public nsIDOMXULElement { public: static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULMENULISTELEMENT_IID; return iid; } - NS_IMETHOD GetValue(nsString& aValue)=0; - NS_IMETHOD SetValue(const nsString& aValue)=0; + NS_IMETHOD GetValue(nsAWritableString& aValue)=0; + NS_IMETHOD SetValue(const nsAReadableString& aValue)=0; - NS_IMETHOD GetData(nsString& aData)=0; - NS_IMETHOD SetData(const nsString& aData)=0; + NS_IMETHOD GetData(nsAWritableString& aData)=0; + NS_IMETHOD SetData(const nsAReadableString& aData)=0; NS_IMETHOD GetSelectedItem(nsIDOMElement** aSelectedItem)=0; NS_IMETHOD SetSelectedItem(nsIDOMElement* aSelectedItem)=0; @@ -51,50 +51,50 @@ public: NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex)=0; NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex)=0; - NS_IMETHOD GetCrop(nsString& aCrop)=0; - NS_IMETHOD SetCrop(const nsString& aCrop)=0; + NS_IMETHOD GetCrop(nsAWritableString& aCrop)=0; + NS_IMETHOD SetCrop(const nsAReadableString& aCrop)=0; NS_IMETHOD GetDisabled(PRBool* aDisabled)=0; NS_IMETHOD SetDisabled(PRBool aDisabled)=0; - NS_IMETHOD GetSrc(nsString& aSrc)=0; - NS_IMETHOD SetSrc(const nsString& aSrc)=0; + NS_IMETHOD GetSrc(nsAWritableString& aSrc)=0; + NS_IMETHOD SetSrc(const nsAReadableString& aSrc)=0; }; #define NS_DECL_IDOMXULMENULISTELEMENT \ - NS_IMETHOD GetValue(nsString& aValue); \ - NS_IMETHOD SetValue(const nsString& aValue); \ - NS_IMETHOD GetData(nsString& aData); \ - NS_IMETHOD SetData(const nsString& aData); \ + NS_IMETHOD GetValue(nsAWritableString& aValue); \ + NS_IMETHOD SetValue(const nsAReadableString& aValue); \ + NS_IMETHOD GetData(nsAWritableString& aData); \ + NS_IMETHOD SetData(const nsAReadableString& aData); \ NS_IMETHOD GetSelectedItem(nsIDOMElement** aSelectedItem); \ NS_IMETHOD SetSelectedItem(nsIDOMElement* aSelectedItem); \ NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex); \ NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex); \ - NS_IMETHOD GetCrop(nsString& aCrop); \ - NS_IMETHOD SetCrop(const nsString& aCrop); \ + NS_IMETHOD GetCrop(nsAWritableString& aCrop); \ + NS_IMETHOD SetCrop(const nsAReadableString& aCrop); \ NS_IMETHOD GetDisabled(PRBool* aDisabled); \ NS_IMETHOD SetDisabled(PRBool aDisabled); \ - NS_IMETHOD GetSrc(nsString& aSrc); \ - NS_IMETHOD SetSrc(const nsString& aSrc); \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc); \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc); \ #define NS_FORWARD_IDOMXULMENULISTELEMENT(_to) \ - NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \ - NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \ - NS_IMETHOD GetData(nsString& aData) { return _to GetData(aData); } \ - NS_IMETHOD SetData(const nsString& aData) { return _to SetData(aData); } \ + NS_IMETHOD GetValue(nsAWritableString& aValue) { return _to GetValue(aValue); } \ + NS_IMETHOD SetValue(const nsAReadableString& aValue) { return _to SetValue(aValue); } \ + NS_IMETHOD GetData(nsAWritableString& aData) { return _to GetData(aData); } \ + NS_IMETHOD SetData(const nsAReadableString& aData) { return _to SetData(aData); } \ NS_IMETHOD GetSelectedItem(nsIDOMElement** aSelectedItem) { return _to GetSelectedItem(aSelectedItem); } \ NS_IMETHOD SetSelectedItem(nsIDOMElement* aSelectedItem) { return _to SetSelectedItem(aSelectedItem); } \ NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex) { return _to GetSelectedIndex(aSelectedIndex); } \ NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex) { return _to SetSelectedIndex(aSelectedIndex); } \ - NS_IMETHOD GetCrop(nsString& aCrop) { return _to GetCrop(aCrop); } \ - NS_IMETHOD SetCrop(const nsString& aCrop) { return _to SetCrop(aCrop); } \ + NS_IMETHOD GetCrop(nsAWritableString& aCrop) { return _to GetCrop(aCrop); } \ + NS_IMETHOD SetCrop(const nsAReadableString& aCrop) { return _to SetCrop(aCrop); } \ NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \ NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ - NS_IMETHOD GetSrc(nsString& aSrc) { return _to GetSrc(aSrc); } \ - NS_IMETHOD SetSrc(const nsString& aSrc) { return _to SetSrc(aSrc); } \ + NS_IMETHOD GetSrc(nsAWritableString& aSrc) { return _to GetSrc(aSrc); } \ + NS_IMETHOD SetSrc(const nsAReadableString& aSrc) { return _to SetSrc(aSrc); } \ extern "C" NS_DOM nsresult NS_InitXULMenuListElementClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/rdf/content/public/nsIXULContent.h b/rdf/content/public/nsIXULContent.h index d0832f301820..ccd463116259 100644 --- a/rdf/content/public/nsIXULContent.h +++ b/rdf/content/public/nsIXULContent.h @@ -95,7 +95,7 @@ public: /** * Add a script event listener to the element. */ - NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID) = 0; + NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsAReadableString& aValue, REFNSIID aIID) = 0; /** * Evil rotten hack to make mailnews work. They assume that we diff --git a/rdf/content/public/nsIXULContentUtils.h b/rdf/content/public/nsIXULContentUtils.h index c3792c8399ff..ea6aa78ed743 100644 --- a/rdf/content/public/nsIXULContentUtils.h +++ b/rdf/content/public/nsIXULContentUtils.h @@ -71,22 +71,22 @@ public: GetElementRefResource(nsIContent* aElement, nsIRDFResource** aResult) = 0; NS_IMETHOD - GetTextForNode(nsIRDFNode* aNode, nsString& aResult) = 0; + GetTextForNode(nsIRDFNode* aNode, nsAWritableString& aResult) = 0; NS_IMETHOD - GetElementLogString(nsIContent* aElement, nsString& aResult) = 0; + GetElementLogString(nsIContent* aElement, nsAWritableString& aResult) = 0; NS_IMETHOD - GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult) = 0; + GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsAWritableString& aResult) = 0; NS_IMETHOD - MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI) = 0; + MakeElementURI(nsIDocument* aDocument, const nsAReadableString& aElementID, nsCString& aURI) = 0; NS_IMETHOD - MakeElementResource(nsIDocument* aDocument, const nsString& aElementID, nsIRDFResource** aResult) = 0; + MakeElementResource(nsIDocument* aDocument, const nsAReadableString& aElementID, nsIRDFResource** aResult) = 0; NS_IMETHOD - MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID) = 0; + MakeElementID(nsIDocument* aDocument, const nsAReadableString& aURI, nsAWritableString& aElementID) = 0; NS_IMETHOD_(PRBool) IsContainedBy(nsIContent* aElement, nsIContent* aContainer) = 0; @@ -95,7 +95,7 @@ public: GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aResult) = 0; NS_IMETHOD - GetResource(PRInt32 aNameSpaceID, const nsString& aAttribute, nsIRDFResource** aResult) = 0; + GetResource(PRInt32 aNameSpaceID, const nsAReadableString& aAttribute, nsIRDFResource** aResult) = 0; NS_IMETHOD SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement) = 0; diff --git a/rdf/content/public/nsIXULDocument.h b/rdf/content/public/nsIXULDocument.h index ea38ca876396..d5e7c68ae4f6 100644 --- a/rdf/content/public/nsIXULDocument.h +++ b/rdf/content/public/nsIXULDocument.h @@ -70,19 +70,19 @@ public: /** * Add an entry to the ID-to-element map. */ - NS_IMETHOD AddElementForID(const nsString& aID, nsIContent* aElement) = 0; + NS_IMETHOD AddElementForID(const nsAReadableString& aID, nsIContent* aElement) = 0; /** * Remove an entry from the ID-to-element map. */ - NS_IMETHOD RemoveElementForID(const nsString& aID, nsIContent* aElement) = 0; + NS_IMETHOD RemoveElementForID(const nsAReadableString& aID, nsIContent* aElement) = 0; /** * Get the elements for a particular resource in the resource-to-element * map. The nsISupportsArray will be truncated and filled in with * nsIContent pointers. */ - NS_IMETHOD GetElementsForID(const nsString& aID, nsISupportsArray* aElements) = 0; + NS_IMETHOD GetElementsForID(const nsAReadableString& aID, nsISupportsArray* aElements) = 0; NS_IMETHOD CreateContents(nsIContent* aElement) = 0; diff --git a/rdf/content/public/nsIXULPrototypeDocument.h b/rdf/content/public/nsIXULPrototypeDocument.h index 487dd9be4018..c0c25419e132 100644 --- a/rdf/content/public/nsIXULPrototypeDocument.h +++ b/rdf/content/public/nsIXULPrototypeDocument.h @@ -30,6 +30,7 @@ #define nsIXULPrototypeDocument_h__ #include "nsISupports.h" +#include "nsAWritableString.h" class nsIAtom; class nsIPrincipal; @@ -67,8 +68,8 @@ public: NS_IMETHOD AddOverlayReference(nsIURI* aURI) = 0; NS_IMETHOD GetOverlayReferences(nsISupportsArray** aResult) = 0; - NS_IMETHOD GetHeaderData(nsIAtom* aField, nsString& aData) const = 0; - NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsString& aData) = 0; + NS_IMETHOD GetHeaderData(nsIAtom* aField, nsAWritableString& aData) const = 0; + NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsAReadableString& aData) = 0; NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aResult) = 0; NS_IMETHOD SetDocumentPrincipal(nsIPrincipal* aPrincipal) = 0; diff --git a/rdf/content/src/nsElementMap.cpp b/rdf/content/src/nsElementMap.cpp index 60bfe64496ba..bb0e660428c5 100644 --- a/rdf/content/src/nsElementMap.cpp +++ b/rdf/content/src/nsElementMap.cpp @@ -39,6 +39,7 @@ #include "nsElementMap.h" #include "nsISupportsArray.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "prlog.h" #ifdef PR_LOGGING @@ -146,27 +147,26 @@ nsElementMap::ReleaseContentList(PLHashEntry* aHashEntry, PRIntn aIndex, void* a nsresult -nsElementMap::Add(const nsString& aID, nsIContent* aContent) +nsElementMap::Add(const nsAReadableString& aID, nsIContent* aContent) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) return NS_ERROR_NOT_INITIALIZED; + const PRUnichar *id = nsPromiseFlatString(aID); + ContentListItem* head = - NS_STATIC_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode())); + NS_STATIC_CAST(ContentListItem*, PL_HashTableLookup(mMap, id)); if (! head) { head = new (mPool) ContentListItem(aContent); if (! head) return NS_ERROR_OUT_OF_MEMORY; - PRUnichar* key = new PRUnichar[aID.Length() + 1]; + PRUnichar* key = ToNewUnicode(aID); if (! key) return NS_ERROR_OUT_OF_MEMORY; - nsCRT::memcpy(key, aID.GetUnicode(), aID.Length() * sizeof(PRUnichar)); - key[aID.Length()] = PRUnichar(0); - PL_HashTableAdd(mMap, key, head); } else { @@ -193,7 +193,7 @@ nsElementMap::Add(const nsString& aID, nsIContent* aContent) nsCAutoString tagnameC, aidC; tagnameC.AssignWithConversion(tagname); - aidC.AssignWithConversion(aID); + aidC.AssignWithConversion(id, aID.Length()); PR_LOG(gMapLog, PR_LOG_ALWAYS, ("xulelemap(%p) dup %s[%p] <-- %s\n", this, @@ -230,7 +230,7 @@ nsElementMap::Add(const nsString& aID, nsIContent* aContent) nsCAutoString tagnameC, aidC; tagnameC.AssignWithConversion(tagname); - aidC.AssignWithConversion(aID); + aidC.AssignWithConversion(id, aID.Length()); PR_LOG(gMapLog, PR_LOG_ALWAYS, ("xulelemap(%p) add %s[%p] <-- %s\n", this, @@ -245,12 +245,14 @@ nsElementMap::Add(const nsString& aID, nsIContent* aContent) nsresult -nsElementMap::Remove(const nsString& aID, nsIContent* aContent) +nsElementMap::Remove(const nsAReadableString& aID, nsIContent* aContent) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) return NS_ERROR_NOT_INITIALIZED; + const PRUnichar *id = nsPromiseFlatString(aID); + #ifdef PR_LOGGING if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) { nsresult rv; @@ -265,7 +267,7 @@ nsElementMap::Remove(const nsString& aID, nsIContent* aContent) nsCAutoString tagnameC, aidC; tagnameC.AssignWithConversion(tagname); - aidC.AssignWithConversion(aID); + aidC.AssignWithConversion(id); PR_LOG(gMapLog, PR_LOG_ALWAYS, ("xulelemap(%p) remove %s[%p] <-- %s\n", this, @@ -276,8 +278,8 @@ nsElementMap::Remove(const nsString& aID, nsIContent* aContent) #endif PLHashEntry** hep = PL_HashTableRawLookup(mMap, - Hash(aID.GetUnicode()), - aID.GetUnicode()); + Hash(id), + id); // XXX Don't comment out this assert: if you get here, something // has gone dreadfully, horribly wrong. Curse. Scream. File a bug @@ -320,7 +322,7 @@ nsElementMap::Remove(const nsString& aID, nsIContent* aContent) nsresult -nsElementMap::Find(const nsString& aID, nsISupportsArray* aResults) +nsElementMap::Find(const nsAReadableString& aID, nsISupportsArray* aResults) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) @@ -328,7 +330,7 @@ nsElementMap::Find(const nsString& aID, nsISupportsArray* aResults) aResults->Clear(); ContentListItem* item = - NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode())); + NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, (const PRUnichar *)nsPromiseFlatString(aID))); while (item) { aResults->AppendElement(item->mContent); @@ -339,14 +341,14 @@ nsElementMap::Find(const nsString& aID, nsISupportsArray* aResults) nsresult -nsElementMap::FindFirst(const nsString& aID, nsIContent** aResult) +nsElementMap::FindFirst(const nsAReadableString& aID, nsIContent** aResult) { NS_PRECONDITION(mMap != nsnull, "not initialized"); if (! mMap) return NS_ERROR_NOT_INITIALIZED; ContentListItem* item = - NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode())); + NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, (const PRUnichar *)nsPromiseFlatString(aID))); if (item) { *aResult = item->mContent; diff --git a/rdf/content/src/nsElementMap.h b/rdf/content/src/nsElementMap.h index c8adc15d884f..252b218a0699 100644 --- a/rdf/content/src/nsElementMap.h +++ b/rdf/content/src/nsElementMap.h @@ -97,16 +97,16 @@ public: virtual ~nsElementMap(); nsresult - Add(const nsString& aID, nsIContent* aContent); + Add(const nsAReadableString& aID, nsIContent* aContent); nsresult - Remove(const nsString& aID, nsIContent* aContent); + Remove(const nsAReadableString& aID, nsIContent* aContent); nsresult - Find(const nsString& aID, nsISupportsArray* aResults); + Find(const nsAReadableString& aID, nsISupportsArray* aResults); nsresult - FindFirst(const nsString& aID, nsIContent** aContent); + FindFirst(const nsAReadableString& aID, nsIContent** aContent); typedef PRIntn (*nsElementMapEnumerator)(const PRUnichar* aID, nsIContent* aElement, diff --git a/rdf/content/src/nsXULAttributes.cpp b/rdf/content/src/nsXULAttributes.cpp index 635979b29bb3..8a131e96146f 100644 --- a/rdf/content/src/nsXULAttributes.cpp +++ b/rdf/content/src/nsXULAttributes.cpp @@ -50,6 +50,7 @@ #include "nsIURL.h" #include "nsXULAttributes.h" #include "nsLayoutCID.h" +#include "nsReadableUtils.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); @@ -93,7 +94,7 @@ nsClassList::GetClasses(nsClassList* aList, nsVoidArray& aArray) nsresult -nsClassList::ParseClasses(nsClassList** aList, const nsString& aClassString) +nsClassList::ParseClasses(nsClassList** aList, const nsAReadableString& aClassString) { static const PRUnichar kNullCh = PRUnichar('\0'); @@ -205,7 +206,7 @@ nsXULAttribute::operator delete(void* aObject, size_t aSize) nsXULAttribute::nsXULAttribute(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue) + const nsAReadableString& aValue) : mContent(aContent), mScriptObject(nsnull), mNodeInfo(aNodeInfo), @@ -234,7 +235,7 @@ nsXULAttribute::~nsXULAttribute() nsresult nsXULAttribute::Create(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, nsXULAttribute** aResult) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -281,20 +282,20 @@ nsXULAttribute::QueryInterface(REFNSIID aIID, void** aResult) // nsIDOMNode interface NS_IMETHODIMP -nsXULAttribute::GetNodeName(nsString& aNodeName) +nsXULAttribute::GetNodeName(nsAWritableString& aNodeName) { GetQualifiedName(aNodeName); return NS_OK; } NS_IMETHODIMP -nsXULAttribute::GetNodeValue(nsString& aNodeValue) +nsXULAttribute::GetNodeValue(nsAWritableString& aNodeValue) { return GetValueInternal(aNodeValue); } NS_IMETHODIMP -nsXULAttribute::SetNodeValue(const nsString& aNodeValue) +nsXULAttribute::SetNodeValue(const nsAReadableString& aNodeValue) { return SetValue(aNodeValue); } @@ -363,19 +364,19 @@ nsXULAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) } NS_IMETHODIMP -nsXULAttribute::GetNamespaceURI(nsString& aNamespaceURI) +nsXULAttribute::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return mNodeInfo->GetNamespaceURI(aNamespaceURI); } NS_IMETHODIMP -nsXULAttribute::GetPrefix(nsString& aPrefix) +nsXULAttribute::GetPrefix(nsAWritableString& aPrefix) { return mNodeInfo->GetPrefix(aPrefix); } NS_IMETHODIMP -nsXULAttribute::SetPrefix(const nsString& aPrefix) +nsXULAttribute::SetPrefix(const nsAReadableString& aPrefix) { // XXX: Validate the prefix string! @@ -397,7 +398,7 @@ nsXULAttribute::SetPrefix(const nsString& aPrefix) } NS_IMETHODIMP -nsXULAttribute::GetLocalName(nsString& aLocalName) +nsXULAttribute::GetLocalName(nsAWritableString& aLocalName) { return mNodeInfo->GetLocalName(aLocalName); } @@ -448,8 +449,9 @@ nsXULAttribute::Normalize() } NS_IMETHODIMP -nsXULAttribute::Supports(const nsString& aFeature, const nsString& aVersion, - PRBool* aReturn) +nsXULAttribute::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, + PRBool* aReturn) { NS_NOTYETIMPLEMENTED("write me"); return NS_ERROR_NOT_IMPLEMENTED; @@ -459,7 +461,7 @@ nsXULAttribute::Supports(const nsString& aFeature, const nsString& aVersion, // nsIDOMAttr interface NS_IMETHODIMP -nsXULAttribute::GetName(nsString& aName) +nsXULAttribute::GetName(nsAWritableString& aName) { GetQualifiedName(aName); return NS_OK; @@ -474,13 +476,13 @@ nsXULAttribute::GetSpecified(PRBool* aSpecified) } NS_IMETHODIMP -nsXULAttribute::GetValue(nsString& aValue) +nsXULAttribute::GetValue(nsAWritableString& aValue) { return GetValueInternal(aValue); } NS_IMETHODIMP -nsXULAttribute::SetValue(const nsString& aValue) +nsXULAttribute::SetValue(const nsAReadableString& aValue) { // We call back to the content node's SetValue() method so we can // share all of the work that it does. @@ -537,7 +539,7 @@ nsXULAttribute::SetScriptObject(void *aScriptObject) // Implementation methods void -nsXULAttribute::GetQualifiedName(nsString& aQualifiedName) +nsXULAttribute::GetQualifiedName(nsAWritableString& aQualifiedName) { // This should be removed, call sites should be replaced with mNodeInfo->Get... aQualifiedName.Truncate(); @@ -553,7 +555,7 @@ nsXULAttribute::GetQualifiedName(nsString& aQualifiedName) const PRUnichar *unicodeString; prefix->GetUnicode(&unicodeString); aQualifiedName.Append(unicodeString); - aQualifiedName.AppendWithConversion(':'); + aQualifiedName.Append(PRUnichar(':')); NS_RELEASE(prefix); } } @@ -572,7 +574,7 @@ nsXULAttribute::GetQualifiedName(nsString& aQualifiedName) nsresult -nsXULAttribute::SetValueInternal(const nsString& aValue) +nsXULAttribute::SetValueInternal(const nsAReadableString& aValue) { nsCOMPtr newAtom; @@ -582,7 +584,7 @@ nsXULAttribute::SetValueInternal(const nsString& aValue) // table is "unprimed" we see quite a bit of thrashing as the 'id' // value is repeatedly added and then removed from the atom table. if ((aValue.Length() <= kMaxAtomValueLength) || mNodeInfo->Equals(kIdAtom)) { - newAtom = getter_AddRefs( NS_NewAtom(aValue.GetUnicode()) ); + newAtom = getter_AddRefs( NS_NewAtom(aValue) ); } if (mValue) { @@ -597,12 +599,10 @@ nsXULAttribute::SetValueInternal(const nsString& aValue) } else { PRInt32 len = aValue.Length(); - PRUnichar* str = new PRUnichar[len + 1]; + PRUnichar* str = ToNewUnicode(aValue); if (! str) return NS_ERROR_OUT_OF_MEMORY; - nsCRT::memcpy(str, aValue.GetUnicode(), len * sizeof(PRUnichar)); - str[len] = PRUnichar(0); mValue = str; } @@ -711,7 +711,8 @@ nsXULAttributes::GetLength(PRUint32* aLength) } NS_IMETHODIMP -nsXULAttributes::GetNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXULAttributes::GetNamedItem(const nsAReadableString& aName, + nsIDOMNode** aReturn) { NS_PRECONDITION(aReturn != nsnull, "null ptr"); if (! aReturn) @@ -758,7 +759,8 @@ nsXULAttributes::SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) } NS_IMETHODIMP -nsXULAttributes::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) +nsXULAttributes::RemoveNamedItem(const nsAReadableString& aName, + nsIDOMNode** aReturn) { nsCOMPtr element( do_QueryInterface(mContent) ); if (element) { @@ -780,8 +782,8 @@ nsXULAttributes::Item(PRUint32 aIndex, nsIDOMNode** aReturn) } nsresult -nsXULAttributes::GetNamedItemNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULAttributes::GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -796,8 +798,8 @@ nsXULAttributes::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) } nsresult -nsXULAttributes::RemoveNamedItemNS(const nsString& aNamespaceURI, - const nsString&aLocalName, +nsXULAttributes::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNode** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -867,12 +869,12 @@ nsresult nsXULAttributes::SetClassList(nsClassList* aClassList) return NS_OK; } -nsresult nsXULAttributes::UpdateClassList(const nsString& aValue) +nsresult nsXULAttributes::UpdateClassList(const nsAReadableString& aValue) { return nsClassList::ParseClasses(&mClassList, aValue); } -nsresult nsXULAttributes::UpdateStyleRule(nsIURI* aDocURL, const nsString& aValue) +nsresult nsXULAttributes::UpdateStyleRule(nsIURI* aDocURL, const nsAReadableString& aValue) { if (aValue.IsEmpty()) { diff --git a/rdf/content/src/nsXULAttributes.h b/rdf/content/src/nsXULAttributes.h index 7819f771107e..dbcc92f333ba 100644 --- a/rdf/content/src/nsXULAttributes.h +++ b/rdf/content/src/nsXULAttributes.h @@ -89,7 +89,7 @@ public: GetClasses(nsClassList* aList, nsVoidArray& aArray); static nsresult - ParseClasses(nsClassList** aList, const nsString& aValue); + ParseClasses(nsClassList** aList, const nsAReadableString& aValue); }; //////////////////////////////////////////////////////////////////////// @@ -114,7 +114,7 @@ protected: nsXULAttribute(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue); + const nsAReadableString& aValue); virtual ~nsXULAttribute(); @@ -122,7 +122,7 @@ public: static nsresult Create(nsIContent* aContent, nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, nsXULAttribute** aResult); // nsISupports interface @@ -139,10 +139,10 @@ public: NS_IMETHOD SetScriptObject(void *aScriptObject); // Implementation methods - void GetQualifiedName(nsString& aAttributeName); + void GetQualifiedName(nsAWritableString& aAttributeName); nsINodeInfo* GetNodeInfo() const { return mNodeInfo; } - nsresult SetValueInternal(const nsString& aValue); + nsresult SetValueInternal(const nsAReadableString& aValue); nsresult GetValueAsAtom(nsIAtom** aResult); protected: @@ -168,7 +168,7 @@ protected: return (PRWord(mValue) & kTypeMask) == kStringType; } - nsresult GetValueInternal(nsString& aResult) { + nsresult GetValueInternal(nsAWritableString& aResult) { nsresult rv = NS_OK; if (! mValue) { aResult.Truncate(); @@ -185,7 +185,7 @@ protected: void ReleaseValue() { if (IsStringValue()) { - delete[] (PRUnichar*)(mValue); + nsMemory::Free(mValue); } else { nsIAtom* atom = (nsIAtom*)(PRWord(mValue) & ~PRWord(kTypeMask)); @@ -226,8 +226,8 @@ public: nsresult HasClass(nsIAtom* aClass) const; nsresult SetClassList(nsClassList* aClassList); - nsresult UpdateClassList(const nsString& aValue); - nsresult UpdateStyleRule(nsIURI* aDocURL, const nsString& aValue); + nsresult UpdateClassList(const nsAReadableString& aValue); + nsresult UpdateStyleRule(nsIURI* aDocURL, const nsAReadableString& aValue); nsresult SetInlineStyleRule(nsIStyleRule* aRule); nsresult GetInlineStyleRule(nsIStyleRule*& aRule); diff --git a/rdf/content/src/nsXULCommandDispatcher.cpp b/rdf/content/src/nsXULCommandDispatcher.cpp index a12de2ee4077..f2ce3d1ae7b7 100644 --- a/rdf/content/src/nsXULCommandDispatcher.cpp +++ b/rdf/content/src/nsXULCommandDispatcher.cpp @@ -148,7 +148,7 @@ nsXULCommandDispatcher::SetFocusedElement(nsIDOMElement* aElement) // Need to update focus commands when focus switches from // an element to no element, so don't test mCurrentElement // before updating. - UpdateCommands(NS_ConvertASCIItoUCS2("focus")); + UpdateCommands(NS_LITERAL_STRING("focus")); return NS_OK; } @@ -161,8 +161,8 @@ nsXULCommandDispatcher::SetFocusedWindow(nsIDOMWindow* aWindow) NS_IMETHODIMP nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, - const nsString& aEvents, - const nsString& aTargets) + const nsAReadableString& aEvents, + const nsAReadableString& aTargets) { NS_PRECONDITION(aElement != nsnull, "null ptr"); if (! aElement) @@ -174,11 +174,12 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, while (updater) { if (updater->mElement == aElement) { +#ifdef NS_DEBUG nsCAutoString eventsC, targetsC, aeventsC, atargetsC; eventsC.AssignWithConversion(updater->mEvents); targetsC.AssignWithConversion(updater->mTargets); - aeventsC.AssignWithConversion(aEvents); - atargetsC.AssignWithConversion(aTargets); + aeventsC.Assign(NS_ConvertUCS2toUTF8(aEvents)); + atargetsC.Assign(NS_ConvertUCS2toUTF8(aTargets)); PR_LOG(gLog, PR_LOG_ALWAYS, ("xulcmd[%p] replace %p(events=%s targets=%s) with (events=%s targets=%s)", this, aElement, @@ -186,6 +187,7 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, (const char*) targetsC, (const char*) aeventsC, (const char*) atargetsC)); +#endif // If the updater was already in the list, then replace // (?) the 'events' and 'targets' filters with the new @@ -198,15 +200,17 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, link = &(updater->mNext); updater = updater->mNext; } +#ifdef NS_DEBUG nsCAutoString aeventsC, atargetsC; - aeventsC.AssignWithConversion(aEvents); - atargetsC.AssignWithConversion(aTargets); + aeventsC.Assign(NS_ConvertUCS2toUTF8(aEvents)); + atargetsC.Assign(NS_ConvertUCS2toUTF8(aTargets)); PR_LOG(gLog, PR_LOG_ALWAYS, ("xulcmd[%p] add %p(events=%s targets=%s)", this, aElement, (const char*) aeventsC, (const char*) atargetsC)); +#endif // If we get here, this is a new updater. Append it to the list. updater = new Updater(aElement, aEvents, aTargets); @@ -229,6 +233,7 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement) while (updater) { if (updater->mElement == aElement) { +#ifdef NS_DEBUG nsCAutoString eventsC, targetsC; eventsC.AssignWithConversion(updater->mEvents); targetsC.AssignWithConversion(updater->mTargets); @@ -237,6 +242,7 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement) this, aElement, (const char*) eventsC, (const char*) targetsC)); +#endif *link = updater->mNext; delete updater; @@ -252,7 +258,7 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement) } NS_IMETHODIMP -nsXULCommandDispatcher::UpdateCommands(const nsString& aEventName) +nsXULCommandDispatcher::UpdateCommands(const nsAReadableString& aEventName) { nsresult rv; @@ -294,12 +300,14 @@ nsXULCommandDispatcher::UpdateCommands(const nsString& aEventName) if (! document) continue; +#ifdef NS_DEBUG nsCAutoString aeventnameC; - aeventnameC.AssignWithConversion(aEventName); + aeventnameC.Assign(NS_ConvertUCS2toUTF8(aEventName)); PR_LOG(gLog, PR_LOG_ALWAYS, ("xulcmd[%p] update %p event=%s", this, updater->mElement, (const char*) aeventnameC)); +#endif PRInt32 count = document->GetNumberOfShells(); for (PRInt32 i = 0; i < count; i++) { @@ -416,7 +424,7 @@ nsXULCommandDispatcher::Focus(nsIDOMEvent* aEvent) } if (!mCurrentElement) - UpdateCommands(NS_ConvertASCIItoUCS2("focus")); + UpdateCommands(NS_LITERAL_STRING("focus")); } } } @@ -493,12 +501,13 @@ nsXULCommandDispatcher::SetScriptObject(void *aScriptObject) PRBool -nsXULCommandDispatcher::Matches(const nsString& aList, const nsString& aElement) +nsXULCommandDispatcher::Matches(const nsString& aList, + const nsAReadableString& aElement) { - if (aList.EqualsWithConversion("*")) + if (aList.Equals(NS_LITERAL_STRING("*"))) return PR_TRUE; // match _everything_! - PRInt32 indx = aList.Find(aElement); + PRInt32 indx = aList.Find(nsPromiseFlatString(aElement)); if (indx == -1) return PR_FALSE; // not in the list at all @@ -537,15 +546,16 @@ nsXULCommandDispatcher::GetParentWindowFromDocument(nsIDOMDocument* aDocument, n } NS_IMETHODIMP -nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsIController** _retval) +nsXULCommandDispatcher::GetControllerForCommand(const nsAReadableString& aCommand, nsIController** _retval) { + const PRUnichar *command = nsPromiseFlatString(aCommand); *_retval = nsnull; nsCOMPtr controllers; GetControllers(getter_AddRefs(controllers)); if(controllers) { nsCOMPtr controller; - controllers->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller)); + controllers->GetControllerForCommand(command, getter_AddRefs(controller)); if(controller) { *_retval = controller; NS_ADDREF(*_retval); @@ -575,7 +585,7 @@ nsXULCommandDispatcher::GetControllerForCommand(const nsString& command, nsICont domWindow->GetControllers(getter_AddRefs(controllers2)); if(controllers2) { nsCOMPtr controller; - controllers2->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller)); + controllers2->GetControllerForCommand(command, getter_AddRefs(controller)); if(controller) { *_retval = controller; NS_ADDREF(*_retval); @@ -619,7 +629,7 @@ nsXULCommandDispatcher::SetSuppressFocus(PRBool aSuppressFocus) // we are unsuppressing after activating, so update focus-related commands // we need this to update commands in the case where an element is focussed. if (!aSuppressFocus && mCurrentElement) - UpdateCommands(NS_ConvertASCIItoUCS2("focus")); + UpdateCommands(NS_LITERAL_STRING("focus")); return NS_OK; } diff --git a/rdf/content/src/nsXULCommandDispatcher.h b/rdf/content/src/nsXULCommandDispatcher.h index a7a6594c2bad..3758d3d1cfab 100644 --- a/rdf/content/src/nsXULCommandDispatcher.h +++ b/rdf/content/src/nsXULCommandDispatcher.h @@ -95,8 +95,8 @@ protected: class Updater { public: Updater(nsIDOMElement* aElement, - const nsString& aEvents, - const nsString& aTargets) + const nsAReadableString& aEvents, + const nsAReadableString& aTargets) : mElement(aElement), mEvents(aEvents), mTargets(aTargets), @@ -111,7 +111,8 @@ protected: Updater* mUpdaters; - PRBool Matches(const nsString& aList, const nsString& aElement); + PRBool Matches(const nsString& aList, + const nsAReadableString& aElement); }; #endif // nsXULCommandDispatcher_h__ diff --git a/rdf/content/src/nsXULContentUtils.cpp b/rdf/content/src/nsXULContentUtils.cpp index 24826d9dcb04..208bb1f6cbcb 100644 --- a/rdf/content/src/nsXULContentUtils.cpp +++ b/rdf/content/src/nsXULContentUtils.cpp @@ -149,22 +149,22 @@ public: GetElementRefResource(nsIContent* aElement, nsIRDFResource** aResult); NS_IMETHOD - GetTextForNode(nsIRDFNode* aNode, nsString& aResult); + GetTextForNode(nsIRDFNode* aNode, nsAWritableString& aResult); NS_IMETHOD - GetElementLogString(nsIContent* aElement, nsString& aResult); + GetElementLogString(nsIContent* aElement, nsAWritableString& aResult); NS_IMETHOD - GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult); + GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsAWritableString& aResult); NS_IMETHOD - MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI); + MakeElementURI(nsIDocument* aDocument, const nsAReadableString& aElementID, nsCString& aURI); NS_IMETHOD - MakeElementResource(nsIDocument* aDocument, const nsString& aElementID, nsIRDFResource** aResult); + MakeElementResource(nsIDocument* aDocument, const nsAReadableString& aElementID, nsIRDFResource** aResult); NS_IMETHOD - MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID); + MakeElementID(nsIDocument* aDocument, const nsAReadableString& aURI, nsAWritableString& aElementID); NS_IMETHOD_(PRBool) IsContainedBy(nsIContent* aElement, nsIContent* aContainer); @@ -173,7 +173,7 @@ public: GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aResult); NS_IMETHOD - GetResource(PRInt32 aNameSpaceID, const nsString& aAttribute, nsIRDFResource** aResult); + GetResource(PRInt32 aNameSpaceID, const nsAReadableString& aAttribute, nsIRDFResource** aResult); NS_IMETHOD SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement); @@ -536,7 +536,7 @@ nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource** return NS_ERROR_UNEXPECTED; nsCAutoString uriStr; - uriStr.AssignWithConversion(uri); + uriStr.Assign(NS_ConvertUCS2toUTF8(uri)); rv = rdf_MakeAbsoluteURI(url, uriStr); if (NS_FAILED(rv)) return rv; @@ -556,7 +556,7 @@ nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource** */ NS_IMETHODIMP -nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) +nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAWritableString& aResult) { if (! aNode) { aResult.Truncate(); @@ -582,11 +582,13 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) rv = dateLiteral->GetValue(&value); if (NS_FAILED(rv)) return rv; + nsAutoString str; rv = gFormat->FormatPRTime(nsnull /* nsILocale* locale */, kDateFormatShort, kTimeFormatSeconds, PRTime(value), - aResult); + str); + aResult.Assign(str); if (NS_FAILED(rv)) return rv; @@ -600,7 +602,9 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) if (NS_FAILED(rv)) return rv; aResult.Truncate(); - aResult.AppendInt(value, 10); + nsAutoString intStr; + intStr.AppendInt(value, 10); + aResult.Append(intStr); return NS_OK; } @@ -610,7 +614,7 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) const char* p; rv = resource->GetValueConst(&p); if (NS_FAILED(rv)) return rv; - aResult.AssignWithConversion(p); + aResult.Assign(NS_ConvertASCIItoUCS2(p)); return NS_OK; } @@ -619,11 +623,11 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult) } NS_IMETHODIMP -nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) +nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsAWritableString& aResult) { nsresult rv; - aResult.AssignWithConversion('<'); + aResult.Assign(PRUnichar('<')); nsCOMPtr ns; @@ -632,7 +636,7 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) if (NS_FAILED(rv)) return rv; if (kNameSpaceID_HTML == elementNameSpaceID) { - aResult.AppendWithConversion("html:"); + aResult.Append(NS_LITERAL_STRING("html:")); } else { nsCOMPtr xml( do_QueryInterface(aElement) ); @@ -651,7 +655,7 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) const PRUnichar *unicodeString; prefix->GetUnicode(&unicodeString); aResult.Append(unicodeString); - aResult.AppendWithConversion(':'); + aResult.Append(NS_LITERAL_STRING(":")); } } } @@ -669,7 +673,7 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) if (NS_FAILED(rv)) return rv; for (PRInt32 i = 0; i < count; ++i) { - aResult.AppendWithConversion(' '); + aResult.Append(NS_LITERAL_STRING(" ")); PRInt32 nameSpaceID; nsCOMPtr name, prefix; @@ -680,23 +684,23 @@ nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult) nsXULContentUtils::GetAttributeLogString(aElement, nameSpaceID, name, attr); aResult.Append(attr); - aResult.AppendWithConversion("=\""); + aResult.Append(NS_LITERAL_STRING("=\"")); nsAutoString value; rv = aElement->GetAttribute(nameSpaceID, name, value); if (NS_FAILED(rv)) return rv; aResult.Append(value); - aResult.AppendWithConversion("\""); + aResult.Append(NS_LITERAL_STRING("\"")); } - aResult.AppendWithConversion('>'); + aResult.Append(NS_LITERAL_STRING(">")); return NS_OK; } NS_IMETHODIMP -nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult) +nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsAWritableString& aResult) { nsresult rv; @@ -727,7 +731,7 @@ nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpac const PRUnichar *unicodeString; prefix->GetUnicode(&unicodeString); aResult.Append(unicodeString); - aResult.AppendWithConversion(':'); + aResult.Append(NS_LITERAL_STRING(":")); } } } @@ -740,14 +744,14 @@ nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpac NS_IMETHODIMP -nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI) +nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsAReadableString& aElementID, nsCString& aURI) { // Convert an element's ID to a URI that can be used to refer to // the element in the XUL graph. if (aElementID.FindChar(':') > 0) { // Assume it's absolute already. Use as is. - aURI.AssignWithConversion(aElementID.GetUnicode()); + aURI.Assign(NS_ConvertUCS2toUTF8(aElementID)); } else { nsresult rv; @@ -791,7 +795,7 @@ nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aEleme NS_IMETHODIMP -nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsString& aID, nsIRDFResource** aResult) +nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsAReadableString& aID, nsIRDFResource** aResult) { nsresult rv; @@ -810,7 +814,7 @@ nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsString& a NS_IMETHODIMP -nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID) +nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsAReadableString& aURI, nsAWritableString& aElementID) { // Convert a URI into an element ID that can be accessed from the // DOM APIs. @@ -825,7 +829,9 @@ nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsString& aURI, n if (! spec) return NS_ERROR_FAILURE; - if (aURI.Find(spec) == 0) { + // XXX FIX ME to not do a copy + nsAutoString str(aURI); + if (str.Find(spec) == 0) { #ifdef USE_BROKEN_RELATIVE_PARSING static const PRInt32 kFudge = 1; // XXX assume '#' #else @@ -881,7 +887,7 @@ nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDF NS_IMETHODIMP -nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, const nsString& aAttribute, nsIRDFResource** aResult) +nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, const nsAReadableString& aAttribute, nsIRDFResource** aResult) { // construct a fully-qualified URI from the namespace/tag pair. @@ -947,13 +953,13 @@ nsXULContentUtils::SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElemen rv = aElement->GetAttribute(kNameSpaceID_None, kEventsAtom, events); if (rv != NS_CONTENT_ATTR_HAS_VALUE) - events.AssignWithConversion("*"); + events.Assign(NS_LITERAL_STRING("*")); nsAutoString targets; rv = aElement->GetAttribute(kNameSpaceID_None, kTargetsAtom, targets); if (rv != NS_CONTENT_ATTR_HAS_VALUE) - targets.AssignWithConversion("*"); + targets.Assign(NS_LITERAL_STRING("*")); nsCOMPtr domelement = do_QueryInterface(aElement); NS_ASSERTION(domelement != nsnull, "not a DOM element"); diff --git a/rdf/content/src/nsXULDocument.cpp b/rdf/content/src/nsXULDocument.cpp index 59beb1b039c7..b639716d4e4d 100644 --- a/rdf/content/src/nsXULDocument.cpp +++ b/rdf/content/src/nsXULDocument.cpp @@ -129,7 +129,7 @@ #include "nsINodeInfo.h" #include "nsIDOMDocumentType.h" #include "nsIXBLService.h" - +#include "nsReadableUtils.h" #include "nsIXIFConverter.h" // Used for the temporary DOM Level2 hack @@ -679,9 +679,9 @@ nsXULDocument::GetArena() } NS_IMETHODIMP -nsXULDocument::GetContentType(nsString& aContentType) const +nsXULDocument::GetContentType(nsAWritableString& aContentType) const { - aContentType.AssignWithConversion("text/xul"); + aContentType.Assign(NS_LITERAL_STRING("text/xul")); return NS_OK; } @@ -873,24 +873,22 @@ nsXULDocument::GetBaseURL(nsIURI*& aURL) const } NS_IMETHODIMP -nsXULDocument::GetDocumentCharacterSet(nsString& oCharSetID) +nsXULDocument::GetDocumentCharacterSet(nsAWritableString& oCharSetID) { - oCharSetID = mCharSetID; + oCharSetID.Assign(mCharSetID); return NS_OK; } NS_IMETHODIMP -nsXULDocument::SetDocumentCharacterSet(const nsString& aCharSetID) +nsXULDocument::SetDocumentCharacterSet(const nsAReadableString& aCharSetID) { - if (mCharSetID != aCharSetID) { - mCharSetID = aCharSetID; - nsAutoString charSetTopic; - charSetTopic.AssignWithConversion("charset"); + if (!mCharSetID.Equals(aCharSetID)) { + mCharSetID.Assign(aCharSetID); PRInt32 n = mCharSetObservers.Count(); for (PRInt32 i = 0; i < n; i++) { nsIObserver* observer = (nsIObserver*) mCharSetObservers.ElementAt(i); - observer->Observe((nsIDocument*) this, charSetTopic.GetUnicode(), - aCharSetID.GetUnicode()); + observer->Observe((nsIDocument*) this, NS_LITERAL_STRING("charset"), + nsPromiseFlatString(aCharSetID)); } } return NS_OK; @@ -978,13 +976,16 @@ nsXULDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker) NS_IMETHODIMP -nsXULDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const +nsXULDocument::GetHeaderData(nsIAtom* aHeaderField, + nsAWritableString& aData) const { + aData.Truncate(); return NS_OK; } NS_IMETHODIMP -nsXULDocument:: SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) +nsXULDocument:: SetHeaderData(nsIAtom* aHeaderField, + const nsAReadableString& aData) { return NS_OK; } @@ -992,9 +993,9 @@ nsXULDocument:: SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) NS_IMETHODIMP nsXULDocument::CreateShell(nsIPresContext* aContext, - nsIViewManager* aViewManager, - nsIStyleSet* aStyleSet, - nsIPresShell** aInstancePtrResult) + nsIViewManager* aViewManager, + nsIStyleSet* aStyleSet, + nsIPresShell** aInstancePtrResult) { NS_PRECONDITION(aInstancePtrResult, "null ptr"); if (! aInstancePtrResult) @@ -1872,7 +1873,7 @@ nsXULDocument::SelectAll() nsIContent * end = nsnull; nsIContent * body = nsnull; - nsAutoString bodyStr; bodyStr.AssignWithConversion("BODY"); + nsAutoString bodyStr; bodyStr.Assign(NS_LITERAL_STRING("BODY")); PRInt32 i, n; mRootContent->ChildCount(n); for (i=0;i= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aTagName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aTagName)); printf ("Possible DOM Error: CreateElement(\"%s\") called, use CreateElementNS() in stead!\n", (const char *)tmp); } @@ -2482,7 +2486,7 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) *getter_AddRefs(prefix)); if (NS_FAILED(rv)) { #ifdef PR_LOGGING - char* tagNameStr = aTagName.ToNewCString(); + char* tagNameStr = ToNewCString(aTagName); PR_LOG(gXULLog, PR_LOG_ERROR, ("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr)); nsCRT::free(tagNameStr); @@ -2493,7 +2497,7 @@ nsXULDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) #ifdef PR_LOGGING if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { - char* tagCStr = aTagName.ToNewCString(); + char* tagCStr = ToNewCString(aTagName); PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul[CreateElement] %s", tagCStr)); @@ -2532,7 +2536,8 @@ nsXULDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) NS_IMETHODIMP -nsXULDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) +nsXULDocument::CreateTextNode(const nsAReadableString& aData, + nsIDOMText** aReturn) { NS_PRECONDITION(aReturn != nsnull, "null ptr"); if (! aReturn) @@ -2544,7 +2549,7 @@ nsXULDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) rv = nsComponentManager::CreateInstance(kTextNodeCID, nsnull, NS_GET_IID(nsITextContent), getter_AddRefs(text)); if (NS_FAILED(rv)) return rv; - rv = text->SetText(aData.GetUnicode(), aData.Length(), PR_FALSE); + rv = text->SetText(aData, PR_FALSE); if (NS_FAILED(rv)) return rv; rv = text->QueryInterface(NS_GET_IID(nsIDOMText), (void**) aReturn); @@ -2556,7 +2561,8 @@ nsXULDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn) NS_IMETHODIMP -nsXULDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) +nsXULDocument::CreateComment(const nsAReadableString& aData, + nsIDOMComment** aReturn) { NS_NOTREACHED("nsXULDocument::CreateComment"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2564,7 +2570,8 @@ nsXULDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn) NS_IMETHODIMP -nsXULDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) +nsXULDocument::CreateCDATASection(const nsAReadableString& aData, + nsIDOMCDATASection** aReturn) { NS_NOTREACHED("nsXULDocument::CreateCDATASection"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2572,7 +2579,9 @@ nsXULDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aR NS_IMETHODIMP -nsXULDocument::CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn) +nsXULDocument::CreateProcessingInstruction(const nsAReadableString& aTarget, + const nsAReadableString& aData, + nsIDOMProcessingInstruction** aReturn) { NS_NOTREACHED("nsXULDocument::CreateProcessingInstruction"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2580,7 +2589,8 @@ nsXULDocument::CreateProcessingInstruction(const nsString& aTarget, const nsStri NS_IMETHODIMP -nsXULDocument::CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) +nsXULDocument::CreateAttribute(const nsAReadableString& aName, + nsIDOMAttr** aReturn) { NS_NOTREACHED("nsXULDocument::CreateAttribute"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2588,7 +2598,8 @@ nsXULDocument::CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) NS_IMETHODIMP -nsXULDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn) +nsXULDocument::CreateEntityReference(const nsAReadableString& aName, + nsIDOMEntityReference** aReturn) { NS_NOTREACHED("nsXULDocument::CreateEntityReference"); return NS_ERROR_NOT_IMPLEMENTED; @@ -2596,12 +2607,13 @@ nsXULDocument::CreateEntityReference(const nsString& aName, nsIDOMEntityReferenc NS_IMETHODIMP -nsXULDocument::GetElementsByTagName(const nsString& aTagName, nsIDOMNodeList** aReturn) +nsXULDocument::GetElementsByTagName(const nsAReadableString& aTagName, + nsIDOMNodeList** aReturn) { if (kStrictDOMLevel2) { PRInt32 pos = aTagName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aTagName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aTagName)); printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp); } } @@ -2628,8 +2640,9 @@ nsXULDocument::GetElementsByTagName(const nsString& aTagName, nsIDOMNodeList** a } NS_IMETHODIMP -nsXULDocument::GetElementsByAttribute(const nsString& aAttribute, const nsString& aValue, - nsIDOMNodeList** aReturn) +nsXULDocument::GetElementsByAttribute(const nsAReadableString& aAttribute, + const nsAReadableString& aValue, + nsIDOMNodeList** aReturn) { nsresult rv; nsRDFDOMNodeList* elements; @@ -2656,7 +2669,8 @@ nsXULDocument::GetElementsByAttribute(const nsString& aAttribute, const nsString NS_IMETHODIMP -nsXULDocument::Persist(const nsString& aID, const nsString& aAttr) +nsXULDocument::Persist(const nsAReadableString& aID, + const nsAReadableString& aAttr) { nsresult rv; @@ -2685,7 +2699,8 @@ nsXULDocument::Persist(const nsString& aID, const nsString& aAttr) nsresult -nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute) +nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID, + nsIAtom* aAttribute) { // First make sure we _have_ a local store to stuff the persited // information into. (We might not have one if profile information @@ -2792,23 +2807,16 @@ nsXULDocument::DestroyForwardReferences() // nsIDOMNSDocument interface // -NS_IMETHODIMP -nsXULDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets) -{ - NS_NOTREACHED("nsXULDocument::GetStyleSheets"); - return NS_ERROR_NOT_IMPLEMENTED; -} - NS_IMETHODIMP -nsXULDocument::GetCharacterSet(nsString& aCharacterSet) +nsXULDocument::GetCharacterSet(nsAWritableString& aCharacterSet) { return GetDocumentCharacterSet(aCharacterSet); } NS_IMETHODIMP -nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName, - const nsString& aNameSpace, - nsIDOMElement** aResult) +nsXULDocument::CreateElementWithNameSpace(const nsAReadableString& aTagName, + const nsAReadableString& aNameSpace, + nsIDOMElement** aResult) { printf ("Deprecated method CreateElementWithNameSpace() used, use CreateElementNS() in stead!\n"); @@ -2821,8 +2829,8 @@ nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName, #ifdef PR_LOGGING if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { - char* namespaceCStr = aNameSpace.ToNewCString(); - char* tagCStr = aTagName.ToNewCString(); + char* namespaceCStr = ToNewCString(aNameSpace); + char* tagCStr = ToNewCString(aTagName); PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr)); @@ -2832,7 +2840,7 @@ nsXULDocument::CreateElementWithNameSpace(const nsString& aTagName, } #endif - nsCOMPtr name = dont_AddRef(NS_NewAtom(aTagName.GetUnicode())); + nsCOMPtr name = dont_AddRef(NS_NewAtom(aTagName)); if (! name) return NS_ERROR_OUT_OF_MEMORY; @@ -2898,8 +2906,8 @@ nsXULDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView) nsresult nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, - PRInt32* aWidth, - PRInt32* aHeight) + PRInt32* aWidth, + PRInt32* aHeight) { nsresult result = NS_OK; nsSize size; @@ -3005,7 +3013,8 @@ nsXULDocument::GetHeight(PRInt32* aHeight) } NS_IMETHODIMP -nsXULDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) +nsXULDocument::AddBinding(nsIDOMElement* aContent, + const nsAReadableString& aURL) { nsCOMPtr bm; GetBindingManager(getter_AddRefs(bm)); @@ -3015,7 +3024,8 @@ nsXULDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsXULDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) +nsXULDocument::RemoveBinding(nsIDOMElement* aContent, + const nsAReadableString& aURL) { if (mBindingManager) { nsCOMPtr content(do_QueryInterface(aContent)); @@ -3026,7 +3036,7 @@ nsXULDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL) } NS_IMETHODIMP -nsXULDocument::LoadBindingDocument(const nsString& aURL) +nsXULDocument::LoadBindingDocument(const nsAReadableString& aURL) { if (mBindingManager) return mBindingManager->LoadBindingDocument(this, aURL); @@ -3034,7 +3044,8 @@ nsXULDocument::LoadBindingDocument(const nsString& aURL) } NS_IMETHODIMP -nsXULDocument::GetAnonymousNodes(nsIDOMElement* aElement, nsIDOMNodeList** aResult) +nsXULDocument::GetAnonymousNodes(nsIDOMElement* aElement, + nsIDOMNodeList** aResult) { nsresult rv; nsRDFDOMNodeList* elements; @@ -3084,7 +3095,7 @@ nsXULDocument::GetAnonymousNodes(nsIDOMElement* aElement, nsIDOMNodeList** aResu } NS_IMETHODIMP -nsXULDocument::Load(const nsString& aUrl) +nsXULDocument::Load(const nsAReadableString& aUrl) { NS_NOTREACHED("nsXULDocument::Load"); return NS_ERROR_NOT_IMPLEMENTED; @@ -3164,8 +3175,8 @@ nsXULDocument::ImportNode(nsIDOMNode* aImportedNode, } NS_IMETHODIMP -nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXULDocument::CreateElementNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -3174,8 +3185,8 @@ nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, #ifdef PR_LOGGING if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { - char* namespaceCStr = aNamespaceURI.ToNewCString(); - char* tagCStr = aQualifiedName.ToNewCString(); + char* namespaceCStr = ToNewCString(aNamespaceURI); + char* tagCStr = ToNewCString(aQualifiedName); PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr)); @@ -3192,7 +3203,7 @@ nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, *getter_AddRefs(prefix)); if (NS_FAILED(rv)) { #ifdef PR_LOGGING - char* tagNameStr = aQualifiedName.ToNewCString(); + char* tagNameStr = ToNewCString(aQualifiedName); PR_LOG(gXULLog, PR_LOG_ERROR, ("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr)); nsCRT::free(tagNameStr); @@ -3223,8 +3234,8 @@ nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULDocument::CreateAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, +nsXULDocument::CreateAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, nsIDOMAttr** aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -3232,7 +3243,8 @@ nsXULDocument::CreateAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) +nsXULDocument::GetElementById(const nsAReadableString& aId, + nsIDOMElement** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; @@ -3258,8 +3270,8 @@ nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) } NS_IMETHODIMP -nsXULDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { nsresult rv; @@ -3277,7 +3289,7 @@ nsXULDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, if (root) { PRInt32 nsid = kNameSpaceID_Unknown; - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { rv = mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nsid); NS_ENSURE_SUCCESS(rv, rv); @@ -3460,15 +3472,15 @@ nsXULDocument::RemoveElementsFromMapByContent(const PRUnichar* aID, // NS_IMETHODIMP -nsXULDocument::GetNodeName(nsString& aNodeName) +nsXULDocument::GetNodeName(nsAWritableString& aNodeName) { - aNodeName.AssignWithConversion("#document"); + aNodeName.Assign(NS_LITERAL_STRING("#document")); return NS_OK; } NS_IMETHODIMP -nsXULDocument::GetNodeValue(nsString& aNodeValue) +nsXULDocument::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; @@ -3476,9 +3488,9 @@ nsXULDocument::GetNodeValue(nsString& aNodeValue) NS_IMETHODIMP -nsXULDocument::SetNodeValue(const nsString& aNodeValue) +nsXULDocument::SetNodeValue(const nsAReadableString& aNodeValue) { - return NS_OK; + return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -3638,7 +3650,7 @@ nsXULDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) NS_IMETHODIMP -nsXULDocument::GetNamespaceURI(nsString& aNamespaceURI) +nsXULDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI) { aNamespaceURI.Truncate(); return NS_OK; @@ -3646,7 +3658,7 @@ nsXULDocument::GetNamespaceURI(nsString& aNamespaceURI) NS_IMETHODIMP -nsXULDocument::GetPrefix(nsString& aPrefix) +nsXULDocument::GetPrefix(nsAWritableString& aPrefix) { aPrefix.Truncate(); return NS_OK; @@ -3654,14 +3666,14 @@ nsXULDocument::GetPrefix(nsString& aPrefix) NS_IMETHODIMP -nsXULDocument::SetPrefix(const nsString& aPrefix) +nsXULDocument::SetPrefix(const nsAReadableString& aPrefix) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } NS_IMETHODIMP -nsXULDocument::GetLocalName(nsString& aLocalName) +nsXULDocument::GetLocalName(nsAWritableString& aLocalName) { aLocalName.Truncate(); return NS_OK; @@ -3718,7 +3730,8 @@ nsXULDocument::Normalize() NS_IMETHODIMP -nsXULDocument::Supports(const nsString& aFeature, const nsString& aVersion, +nsXULDocument::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { NS_NOTYETIMPLEMENTED("write me"); @@ -4200,7 +4213,7 @@ nsXULDocument::StartLayout(void) nsresult nsXULDocument::GetElementsByTagName(nsIContent *aContent, - const nsString& aName, + const nsAReadableString& aName, PRInt32 aNamespaceID, nsRDFDOMNodeList* aElements) { @@ -4217,7 +4230,7 @@ nsXULDocument::GetElementsByTagName(nsIContent *aContent, aContent->GetNodeInfo(*getter_AddRefs(ni)); NS_ENSURE_TRUE(ni, NS_OK); - if (aName.EqualsWithConversion("*")) { + if (aName.Equals(NS_LITERAL_STRING("*"))) { if (aNamespaceID == kNameSpaceID_Unknown || ni->NamespaceEquals(aNamespaceID)) { if (NS_FAILED(rv = aElements->AppendNode(element))) { @@ -4262,8 +4275,8 @@ nsXULDocument::GetElementsByTagName(nsIContent *aContent, nsresult nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttribute, - const nsString& aValue, + const nsAReadableString& aAttribute, + const nsAReadableString& aValue, nsRDFDOMNodeList* aElements) { nsresult rv; @@ -4279,7 +4292,7 @@ nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, return rv; } - if ((attrValue == aValue) || (attrValue.Length() > 0 && aValue.EqualsWithConversion("*"))) { + if ((attrValue.Equals(aValue)) || (attrValue.Length() > 0 && aValue.Equals(NS_LITERAL_STRING("*")))) { if (NS_FAILED(rv = aElements->AppendNode(aNode))) { NS_ERROR("unable to append element to node list"); return rv; @@ -4321,7 +4334,7 @@ nsXULDocument::GetElementsByAttribute(nsIDOMNode* aNode, nsresult -nsXULDocument::ParseTagString(const nsString& aTagName, nsIAtom*& aName, +nsXULDocument::ParseTagString(const nsAReadableString& aTagName, nsIAtom*& aName, nsIAtom*& aPrefix) { // Parse the tag into a name and prefix @@ -4371,8 +4384,9 @@ nsXULDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const ns } NS_IMETHODIMP -nsXULDocument::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULDocument::AddEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { nsIEventListenerManager *manager; @@ -4387,8 +4401,9 @@ nsXULDocument::AddEventListener(const nsString& aType, nsIDOMEventListener* aLis } NS_IMETHODIMP -nsXULDocument::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULDocument::RemoveEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { if (mListenerManager) { PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; @@ -4422,7 +4437,8 @@ nsXULDocument::DispatchEvent(nsIDOMEvent* aEvent) } NS_IMETHODIMP -nsXULDocument::CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn) +nsXULDocument::CreateEvent(const nsAReadableString& aEventType, + nsIDOMEvent** aReturn) { // Obtain a presentation context PRInt32 count = GetNumberOfShells(); @@ -4478,7 +4494,7 @@ nsXULDocument::HandleEvent(nsIDOMEvent *aEvent) } nsresult -nsXULDocument::CaptureEvent(const nsString& aType) +nsXULDocument::CaptureEvent(const nsAReadableString& aType) { nsIEventListenerManager *mManager; @@ -4491,7 +4507,7 @@ nsXULDocument::CaptureEvent(const nsString& aType) } nsresult -nsXULDocument::ReleaseEvent(const nsString& aType) +nsXULDocument::ReleaseEvent(const nsAReadableString& aType) { if (mListenerManager) { //mListenerManager->ReleaseEvent(aListener); @@ -6287,7 +6303,7 @@ nsXULDocument::BroadcasterHookup::~BroadcasterHookup() rv = mObservesElement->GetAttribute(kNameSpaceID_None, kObservesAtom, broadcasterID); if (NS_FAILED(rv)) return; - attribute.AssignWithConversion("*"); + attribute.Assign(NS_LITERAL_STRING("*")); } nsAutoString tagStr; @@ -6381,7 +6397,7 @@ nsXULDocument::CheckBroadcasterHookup(nsXULDocument* aDocument, listener = do_QueryInterface(aElement); - attribute.AssignWithConversion("*"); + attribute.Assign(NS_LITERAL_STRING("*")); } // Make sure we got a valid listener. @@ -6779,7 +6795,7 @@ nsXULDocument::ToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode) } NS_IMETHODIMP -nsXULDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) +nsXULDocument::CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection) { nsresult result=NS_OK; @@ -6793,28 +6809,28 @@ nsXULDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) converter->SetSelection(aSelection); - converter->AddStartTag( NS_ConvertToString("section") , PR_TRUE); - converter->AddStartTag( NS_ConvertToString("section_head") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section") , PR_TRUE); + converter->AddStartTag( NS_LITERAL_STRING("section_head") , PR_TRUE); - converter->BeginStartTag( NS_ConvertToString("document_info") ); - converter->AddAttribute(NS_ConvertToString("charset"),mCharSetID); + converter->BeginStartTag( NS_LITERAL_STRING("document_info") ); + converter->AddAttribute(NS_LITERAL_STRING("charset"),mCharSetID); /* nsCOMPtr uri (getter_AddRefs(GetDocumentURL())); if (uri) { char* spec = 0; if (NS_SUCCEEDED(uri->GetSpec(&spec)) && spec) { - converter->AddAttribute(NS_ConvertToString("uri"), NS_ConvertToString(spec)); + converter->AddAttribute(NS_LITERAL_STRING("uri"), NS_ConvertToString(spec)); Recycle(spec); } }*/ - converter->FinishStartTag(NS_ConvertToString("document_info"),PR_TRUE,PR_TRUE); + converter->FinishStartTag(NS_LITERAL_STRING("document_info"),PR_TRUE,PR_TRUE); - converter->AddEndTag(NS_ConvertToString("section_head"), PR_TRUE, PR_TRUE); - converter->AddStartTag(NS_ConvertToString("section_body"), PR_TRUE); + converter->AddEndTag(NS_LITERAL_STRING("section_head"), PR_TRUE, PR_TRUE); + converter->AddStartTag(NS_LITERAL_STRING("section_body"), PR_TRUE); //HACKHACKHACK DOCTYPE NOT DONE FOR XULDOCUMENTS>ASSIGN IN HTML nsString hack; - hack.AssignWithConversion("DOCTYPE html PUBLIC \"-//w3c//dtd html 4.0 transitional//en\""); + hack.Assign(NS_LITERAL_STRING("DOCTYPE html PUBLIC \"-//w3c//dtd html 4.0 transitional//en\"")); converter->AddMarkupDeclaration(hack); nsCOMPtr doctype; diff --git a/rdf/content/src/nsXULDocument.h b/rdf/content/src/nsXULDocument.h index 15068b886437..174bc0fbb765 100644 --- a/rdf/content/src/nsXULDocument.h +++ b/rdf/content/src/nsXULDocument.h @@ -116,7 +116,7 @@ public: // nsIDocument interface virtual nsIArena* GetArena(); - NS_IMETHOD GetContentType(nsString& aContentType) const; + NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, @@ -139,9 +139,9 @@ public: NS_IMETHOD GetBaseURL(nsIURI*& aURL) const; - NS_IMETHOD GetDocumentCharacterSet(nsString& oCharSetID); + NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharSetID); - NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID); + NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID); NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver); NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver); @@ -151,8 +151,10 @@ public: NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) ; NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) ; - NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const; - NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData); + NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, + nsAWritableString& aData) const; + NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, + const nsAReadableString& aData); NS_IMETHOD CreateShell(nsIPresContext* aContext, nsIViewManager* aViewManager, @@ -262,9 +264,9 @@ public: NS_IMETHOD SelectAll(); - NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); + NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); - NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection); + NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection); NS_IMETHOD ToXIF(nsIXIFConverter *aConverter, nsIDOMNode* aNode); @@ -308,9 +310,9 @@ public: #endif // nsIXULDocument interface - NS_IMETHOD AddElementForID(const nsString& aID, nsIContent* aElement); - NS_IMETHOD RemoveElementForID(const nsString& aID, nsIContent* aElement); - NS_IMETHOD GetElementsForID(const nsString& aID, nsISupportsArray* aElements); + NS_IMETHOD AddElementForID(const nsAReadableString& aID, nsIContent* aElement); + NS_IMETHOD RemoveElementForID(const nsAReadableString& aID, nsIContent* aElement); + NS_IMETHOD GetElementsForID(const nsAReadableString& aID, nsISupportsArray* aElements); NS_IMETHOD CreateContents(nsIContent* aElement); NS_IMETHOD AddContentModelBuilder(nsIRDFContentModelBuilder* aBuilder); NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); @@ -330,8 +332,8 @@ public: const char* aCommand ); // nsIDOMEventCapturer interface - NS_IMETHOD CaptureEvent(const nsString& aType); - NS_IMETHOD ReleaseEvent(const nsString& aType); + NS_IMETHOD CaptureEvent(const nsAReadableString& aType); + NS_IMETHOD ReleaseEvent(const nsAReadableString& aType); // nsIDOMEventReceiver interface (yuck. inherited from nsIDOMEventCapturer) NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID); @@ -341,9 +343,11 @@ public: NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent); // nsIDOMEventTarget interface - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); @@ -360,41 +364,13 @@ public: NS_DECL_IDOMDOCUMENTXBL // nsIDOMNSDocument interface - NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets); - NS_IMETHOD GetCharacterSet(nsString& aCharacterSet); - NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aResult); - NS_IMETHOD CreateRange(nsIDOMRange** aRange); - NS_IMETHOD Load (const nsString& aUrl); - NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); + NS_DECL_IDOMNSDOCUMENT // nsIDOMXULDocument interface NS_DECL_IDOMXULDOCUMENT // nsIDOMNode interface - NS_IMETHOD GetNodeName(nsString& aNodeName); - NS_IMETHOD GetNodeValue(nsString& aNodeValue); - NS_IMETHOD SetNodeValue(const nsString& aNodeValue); - NS_IMETHOD GetNodeType(PRUint16* aNodeType); - NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode); - NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes); - NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes); - NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild); - NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild); - NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling); - NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling); - NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes); - NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument); - NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI); - NS_IMETHOD GetPrefix(nsString& aPrefix); - NS_IMETHOD SetPrefix(const nsString& aPrefix); - NS_IMETHOD GetLocalName(nsString& aLocalName); - NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn); - NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn); - NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn); - NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn); - NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); - NS_IMETHOD Normalize(); - NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn); + NS_DECL_IDOMNODE // nsIJSScriptObject interface virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj, @@ -420,7 +396,7 @@ public: static nsresult GetElementsByTagName(nsIContent* aContent, - const nsString& aTagName, + const nsAReadableString& aTagName, PRInt32 aNamespaceID, nsRDFDOMNodeList* aElements); @@ -458,12 +434,12 @@ protected: static nsresult GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttribute, - const nsString& aValue, + const nsAReadableString& aAttribute, + const nsAReadableString& aValue, nsRDFDOMNodeList* aElements); nsresult - ParseTagString(const nsString& aTagName, nsIAtom*& aName, + ParseTagString(const nsAReadableString& aTagName, nsIAtom*& aName, nsIAtom*& aPrefix); void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; }; diff --git a/rdf/content/src/nsXULElement.cpp b/rdf/content/src/nsXULElement.cpp index d8070ff75aee..928edbf1a982 100644 --- a/rdf/content/src/nsXULElement.cpp +++ b/rdf/content/src/nsXULElement.cpp @@ -220,11 +220,12 @@ struct XULBroadcastListener nsVoidArray* mAttributeList; nsIDOMElement* mListener; - XULBroadcastListener(const nsString& aAttribute, nsIDOMElement* aListener) + XULBroadcastListener(const nsAReadableString& aAttribute, + nsIDOMElement* aListener) : mAttributeList(nsnull) { mListener = aListener; // WEAK REFERENCE - if (!aAttribute.EqualsWithConversion("*")) { + if (!aAttribute.Equals(NS_LITERAL_STRING("*"))) { mAttributeList = new nsVoidArray(); mAttributeList->AppendElement((void*)(new nsString(aAttribute))); } @@ -256,7 +257,7 @@ struct XULBroadcastListener return (count == 0); } - void RemoveAttribute(const nsString& aString) + void RemoveAttribute(const nsAReadableString& aString) { if (ObservingEverything()) return; @@ -265,7 +266,7 @@ struct XULBroadcastListener PRInt32 count = mAttributeList->Count(); for (PRInt32 i = 0; i < count; i++) { nsString* str = (nsString*)(mAttributeList->ElementAt(i)); - if (*str == aString) { + if (str->Equals(aString)) { mAttributeList->RemoveElementAt(i); delete str; break; @@ -279,7 +280,7 @@ struct XULBroadcastListener return (mAttributeList == nsnull); } - PRBool ObservingAttribute(const nsString& aString) + PRBool ObservingAttribute(const nsAReadableString& aString) { if (ObservingEverything()) return PR_TRUE; @@ -288,7 +289,7 @@ struct XULBroadcastListener PRInt32 count = mAttributeList->Count(); for (PRInt32 i = 0; i < count; i++) { nsString* str = (nsString*)(mAttributeList->ElementAt(i)); - if (*str == aString) + if (str->Equals(aString)) return PR_TRUE; } } @@ -626,21 +627,21 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result) // nsIDOMNode interface NS_IMETHODIMP -nsXULElement::GetNodeName(nsString& aNodeName) +nsXULElement::GetNodeName(nsAWritableString& aNodeName) { return NodeInfo()->GetQualifiedName(aNodeName); } NS_IMETHODIMP -nsXULElement::GetNodeValue(nsString& aNodeValue) +nsXULElement::GetNodeValue(nsAWritableString& aNodeValue) { aNodeValue.Truncate(); return NS_OK; } NS_IMETHODIMP -nsXULElement::SetNodeValue(const nsString& aNodeValue) +nsXULElement::SetNodeValue(const nsAReadableString& aNodeValue) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } @@ -847,21 +848,21 @@ nsXULElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) NS_IMETHODIMP -nsXULElement::GetNamespaceURI(nsString& aNamespaceURI) +nsXULElement::GetNamespaceURI(nsAWritableString& aNamespaceURI) { return NodeInfo()->GetNamespaceURI(aNamespaceURI); } NS_IMETHODIMP -nsXULElement::GetPrefix(nsString& aPrefix) +nsXULElement::GetPrefix(nsAWritableString& aPrefix) { return NodeInfo()->GetPrefix(aPrefix); } NS_IMETHODIMP -nsXULElement::SetPrefix(const nsString& aPrefix) +nsXULElement::SetPrefix(const nsAReadableString& aPrefix) { // XXX: Validate the prefix string! @@ -886,14 +887,15 @@ nsXULElement::SetPrefix(const nsString& aPrefix) NS_IMETHODIMP -nsXULElement::GetLocalName(nsString& aLocalName) +nsXULElement::GetLocalName(nsAWritableString& aLocalName) { return NodeInfo()->GetLocalName(aLocalName); } NS_IMETHODIMP -nsXULElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) +nsXULElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, + nsIDOMNode** aReturn) { NS_PRECONDITION(aNewChild != nsnull, "null ptr"); if (! aNewChild) @@ -980,7 +982,8 @@ nsXULElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMN NS_IMETHODIMP -nsXULElement::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) +nsXULElement::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, + nsIDOMNode** aReturn) { NS_PRECONDITION(aNewChild != nsnull, "null ptr"); if (! aNewChild) @@ -1173,7 +1176,8 @@ nsXULElement::Normalize() NS_IMETHODIMP -nsXULElement::Supports(const nsString& aFeature, const nsString& aVersion, +nsXULElement::Supports(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, PRBool* aReturn) { NS_NOTYETIMPLEMENTED("write me!"); @@ -1185,7 +1189,7 @@ nsXULElement::Supports(const nsString& aFeature, const nsString& aVersion, // nsIDOMElement interface NS_IMETHODIMP -nsXULElement::GetTagName(nsString& aTagName) +nsXULElement::GetTagName(nsAWritableString& aTagName) { return NodeInfo()->GetQualifiedName(aTagName); } @@ -1200,7 +1204,8 @@ nsXULElement::GetNodeInfo(nsINodeInfo*& aResult) const } NS_IMETHODIMP -nsXULElement::GetAttribute(const nsString& aName, nsString& aReturn) +nsXULElement::GetAttribute(const nsAReadableString& aName, + nsAWritableString& aReturn) { nsresult rv; PRInt32 nameSpaceID; @@ -1221,12 +1226,13 @@ nsXULElement::GetAttribute(const nsString& aName, nsString& aReturn) NS_IMETHODIMP -nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue) +nsXULElement::SetAttribute(const nsAReadableString& aName, + const nsAReadableString& aValue) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp); } @@ -1251,12 +1257,12 @@ nsXULElement::SetAttribute(const nsString& aName, const nsString& aValue) NS_IMETHODIMP -nsXULElement::RemoveAttribute(const nsString& aName) +nsXULElement::RemoveAttribute(const nsAReadableString& aName) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp); } @@ -1282,12 +1288,13 @@ nsXULElement::RemoveAttribute(const nsString& aName) NS_IMETHODIMP -nsXULElement::GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn) +nsXULElement::GetAttributeNode(const nsAReadableString& aName, + nsIDOMAttr** aReturn) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: GetAttributeNode(\"%s\") called, use GetAttributeNodeNS() in stead!\n", (const char *)tmp); } } @@ -1349,12 +1356,13 @@ nsXULElement::RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) NS_IMETHODIMP -nsXULElement::GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn) +nsXULElement::GetElementsByTagName(const nsAReadableString& aName, + nsIDOMNodeList** aReturn) { if (kStrictDOMLevel2) { PRInt32 pos = aName.FindChar(':'); if (pos >= 0) { - nsCAutoString tmp; tmp.AssignWithConversion(aName); + nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName)); printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp); } } @@ -1378,8 +1386,9 @@ nsXULElement::GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aRetu } NS_IMETHODIMP -nsXULElement::GetAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, nsString& aReturn) +nsXULElement::GetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + nsAWritableString& aReturn) { nsCOMPtr name(dont_AddRef(NS_NewAtom(aLocalName))); PRInt32 nsid; @@ -1399,9 +1408,9 @@ nsXULElement::GetAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::SetAttributeNS(const nsString& aNamespaceURI, - const nsString& aQualifiedName, - const nsString& aValue) +nsXULElement::SetAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aQualifiedName, + const nsAReadableString& aValue) { nsCOMPtr nimgr; nsresult rv = NodeInfo()->GetNodeInfoManager(*getter_AddRefs(nimgr)); @@ -1415,8 +1424,8 @@ nsXULElement::SetAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::RemoveAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName) +nsXULElement::RemoveAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName) { PRInt32 nameSpaceId; nsCOMPtr tag = dont_AddRef(NS_NewAtom(aLocalName)); @@ -1430,8 +1439,8 @@ nsXULElement::RemoveAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::GetAttributeNodeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULElement::GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMAttr** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1466,8 +1475,8 @@ nsXULElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr, } NS_IMETHODIMP -nsXULElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, - const nsString& aLocalName, +nsXULElement::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1481,7 +1490,7 @@ nsXULElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, nsCOMPtr kungFuGrip; kungFuGrip = dont_AddRef(NS_STATIC_CAST(nsIDOMNodeList *, elements)); - if (!aNamespaceURI.EqualsWithConversion("*")) { + if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) { gNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId); if (nameSpaceId == kNameSpaceID_Unknown) { @@ -1506,7 +1515,7 @@ nsXULElement::GetElementsByTagNameNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::HasAttribute(const nsString& aName, PRBool* aReturn) +nsXULElement::HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1525,8 +1534,9 @@ nsXULElement::HasAttribute(const nsString& aName, PRBool* aReturn) } NS_IMETHODIMP -nsXULElement::HasAttributeNS(const nsString& aNamespaceURI, - const nsString& aLocalName, PRBool* aReturn) +nsXULElement::HasAttributeNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + PRBool* aReturn) { NS_ENSURE_ARG_POINTER(aReturn); @@ -1551,9 +1561,9 @@ nsXULElement::HasAttributeNS(const nsString& aNamespaceURI, } NS_IMETHODIMP -nsXULElement::GetElementsByAttribute(const nsString& aAttribute, - const nsString& aValue, - nsIDOMNodeList** aReturn) +nsXULElement::GetElementsByAttribute(const nsAReadableString& aAttribute, + const nsAReadableString& aValue, + nsIDOMNodeList** aReturn) { nsresult rv; nsRDFDOMNodeList* elements; @@ -1698,7 +1708,7 @@ nsXULElement::GetLazyState(PRInt32 aFlag, PRBool& aResult) NS_IMETHODIMP -nsXULElement::AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID) +nsXULElement::AddScriptEventListener(nsIAtom* aName, const nsAReadableString& aValue, REFNSIID aIID) { if (! mDocument) return NS_OK; // XXX @@ -1728,14 +1738,16 @@ nsXULElement::AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REF nsCOMPtr owner = do_QueryInterface(global); - rv = manager->AddScriptEventListener(context, owner, aName, aValue, aIID, PR_FALSE); + rv = manager->AddScriptEventListener(context, owner, aName, + aValue, aIID, PR_FALSE); } else { nsCOMPtr manager; rv = GetListenerManager(getter_AddRefs(manager)); if (NS_FAILED(rv)) return rv; - rv = manager->AddScriptEventListener(context, this, aName, aValue, aIID, PR_TRUE); + rv = manager->AddScriptEventListener(context, this, aName, + aValue, aIID, PR_TRUE); } return rv; @@ -1809,8 +1821,9 @@ nsXULElement::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsI } NS_IMETHODIMP -nsXULElement::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULElement::AddEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { nsIEventListenerManager *manager; @@ -1825,8 +1838,9 @@ nsXULElement::AddEventListener(const nsString& aType, nsIDOMEventListener* aList } NS_IMETHODIMP -nsXULElement::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, - PRBool aUseCapture) +nsXULElement::RemoveEventListener(const nsAReadableString& aType, + nsIDOMEventListener* aListener, + PRBool aUseCapture) { if (mListenerManager) { PRInt32 flags = aUseCapture ? NS_EVENT_FLAG_CAPTURE : NS_EVENT_FLAG_BUBBLE; @@ -1956,7 +1970,7 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject) nsAutoString empty; viewCSS->GetComputedStyle(this, empty, getter_AddRefs(cssDecl)); if (cssDecl) { - nsAutoString behavior; behavior.AssignWithConversion("behavior"); + nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("behavior")); nsAutoString value; cssDecl->GetPropertyValue(behavior, value); if (!value.IsEmpty()) { @@ -2015,7 +2029,7 @@ NS_IMETHODIMP nsXULElement::CompileEventHandler(nsIScriptContext* aContext, void* aTarget, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, void** aHandler) { nsresult rv; @@ -2579,9 +2593,9 @@ nsXULElement::GetTag(nsIAtom*& aResult) const } NS_IMETHODIMP -nsXULElement::ParseAttributeString(const nsString& aStr, - nsIAtom*& aName, - PRInt32& aNameSpaceID) +nsXULElement::ParseAttributeString(const nsAReadableString& aStr, + nsIAtom*& aName, + PRInt32& aNameSpaceID) { static char kNameSpaceSeparator = ':'; @@ -2642,7 +2656,7 @@ nsXULElement::GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, NS_IMETHODIMP nsXULElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ASSERTION(kNameSpaceID_Unknown != aNameSpaceID, "must have name space ID"); @@ -2815,7 +2829,7 @@ nsXULElement::SetAttribute(PRInt32 aNameSpaceID, NS_IMETHODIMP nsXULElement::SetAttribute(nsINodeInfo* aNodeInfo, - const nsString& aValue, + const nsAReadableString& aValue, PRBool aNotify) { NS_ENSURE_ARG_POINTER(aNodeInfo); @@ -2834,7 +2848,7 @@ nsXULElement::SetAttribute(nsINodeInfo* aNodeInfo, NS_IMETHODIMP nsXULElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, - nsString& aResult) const + nsAWritableString& aResult) const { nsCOMPtr prefix; return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult); @@ -2844,7 +2858,7 @@ NS_IMETHODIMP nsXULElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, - nsString& aResult) const + nsAWritableString& aResult) const { NS_ASSERTION(nsnull != aName, "must have attribute name"); if (nsnull == aName) { @@ -2877,7 +2891,7 @@ nsXULElement::GetAttribute(PRInt32 aNameSpaceID, (aNameSpaceID == kNameSpaceID_Unknown) || (aNameSpaceID == kNameSpaceID_None)) && ni->Equals(aName)) { ni->GetPrefixAtom(aPrefix); - aResult = attr->mValue; + aResult.Assign(attr->mValue); rv = aResult.Length() ? NS_CONTENT_ATTR_HAS_VALUE : NS_CONTENT_ATTR_NO_VALUE; break; } @@ -2891,7 +2905,8 @@ nsXULElement::GetAttribute(PRInt32 aNameSpaceID, } NS_IMETHODIMP -nsXULElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) +nsXULElement::UnsetAttribute(PRInt32 aNameSpaceID, + nsIAtom* aName, PRBool aNotify) { NS_ASSERTION(nsnull != aName, "must have attribute name"); if (nsnull == aName) @@ -3386,7 +3401,8 @@ nsXULElement::DoCommand() } NS_IMETHODIMP -nsXULElement::AddBroadcastListener(const nsString& attr, nsIDOMElement* anElement) +nsXULElement::AddBroadcastListener(const nsAReadableString& attr, + nsIDOMElement* anElement) { // Add ourselves to the array. nsresult rv; @@ -3405,7 +3421,7 @@ nsXULElement::AddBroadcastListener(const nsString& attr, nsIDOMElement* anElemen // We need to sync up the initial attribute value. nsCOMPtr listener( do_QueryInterface(anElement) ); - if (attr.EqualsWithConversion("*")) { + if (attr.Equals(NS_LITERAL_STRING("*"))) { // All of the attributes found on this node should be set on the // listener. if (Attributes()) { @@ -3446,7 +3462,8 @@ nsXULElement::AddBroadcastListener(const nsString& attr, nsIDOMElement* anElemen NS_IMETHODIMP -nsXULElement::RemoveBroadcastListener(const nsString& attr, nsIDOMElement* anElement) +nsXULElement::RemoveBroadcastListener(const nsAReadableString& attr, + nsIDOMElement* anElement) { if (BroadcastListeners()) { // Find the element. @@ -3456,7 +3473,7 @@ nsXULElement::RemoveBroadcastListener(const nsString& attr, nsIDOMElement* anEle NS_REINTERPRET_CAST(XULBroadcastListener*, BroadcastListeners()->ElementAt(i)); if (xulListener->mListener == anElement) { - if (xulListener->ObservingEverything() || attr.EqualsWithConversion("*")) { + if (xulListener->ObservingEverything() || attr.Equals(NS_LITERAL_STRING("*"))) { // Do the removal. BroadcastListeners()->RemoveElementAt(i); delete xulListener; @@ -3560,7 +3577,7 @@ nsXULElement::EnsureContentsGenerated(void) const nsresult -nsXULElement::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName) +nsXULElement::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsAReadableString& attrName) { // Now we execute the onchange handler in the context of the // observer. We need to find the observer in order to @@ -3587,7 +3604,7 @@ nsXULElement::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString // attribute? nsAutoString listeningToAttribute; domElement->GetAttribute(NS_ConvertASCIItoUCS2("attribute"), listeningToAttribute); - if (listeningToAttribute == attrName) { + if (listeningToAttribute.Equals(attrName)) { // This is the right observes node. // Execute the onchange event handler nsEvent event; @@ -3645,7 +3662,7 @@ nsXULElement::ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent) nsresult nsXULElement::GetElementsByTagName(nsIDOMNode* aNode, - const nsString& aTagName, + const nsAReadableString& aTagName, nsRDFDOMNodeList* aElements) { nsresult rv; @@ -3678,7 +3695,7 @@ nsXULElement::GetElementsByTagName(nsIDOMNode* aNode, if (!element) continue; - if (aTagName.EqualsWithConversion("*")) { + if (aTagName.Equals(NS_LITERAL_STRING("*"))) { if (NS_FAILED(rv = aElements->AppendNode(child))) { NS_ERROR("unable to append element to node list"); return rv; @@ -3711,8 +3728,8 @@ nsXULElement::GetElementsByTagName(nsIDOMNode* aNode, nsresult nsXULElement::GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttribute, - const nsString& aValue, + const nsAReadableString& aAttribute, + const nsAReadableString& aValue, nsRDFDOMNodeList* aElements) { nsresult rv; @@ -3751,7 +3768,7 @@ nsXULElement::GetElementsByAttribute(nsIDOMNode* aNode, return rv; } - if ((attrValue == aValue) || (attrValue.Length() > 0 && aValue.EqualsWithConversion("*"))) { + if ((attrValue.Equals(aValue)) || (attrValue.Length() > 0 && aValue.Equals(NS_LITERAL_STRING("*")))) { if (NS_FAILED(rv = aElements->AppendNode(child))) { NS_ERROR("unable to append element to node list"); return rv; @@ -3990,30 +4007,30 @@ nsXULElement::GetBoxObject(nsIBoxObject** aResult) // Methods for setting/getting attributes from nsIDOMXULElement nsresult -nsXULElement::GetId(nsString& aId) +nsXULElement::GetId(nsAWritableString& aId) { - GetAttribute(NS_ConvertASCIItoUCS2("id"), aId); + GetAttribute(NS_LITERAL_STRING("id"), aId); return NS_OK; } nsresult -nsXULElement::SetId(const nsString& aId) +nsXULElement::SetId(const nsAReadableString& aId) { - SetAttribute(NS_ConvertASCIItoUCS2("id"), aId); + SetAttribute(NS_LITERAL_STRING("id"), aId); return NS_OK; } nsresult -nsXULElement::GetClassName(nsString& aClassName) +nsXULElement::GetClassName(nsAWritableString& aClassName) { - GetAttribute(NS_ConvertASCIItoUCS2("class"), aClassName); + GetAttribute(NS_LITERAL_STRING("class"), aClassName); return NS_OK; } nsresult -nsXULElement::SetClassName(const nsString& aClassName) +nsXULElement::SetClassName(const nsAReadableString& aClassName) { - SetAttribute(NS_ConvertASCIItoUCS2("class"), aClassName); + SetAttribute(NS_LITERAL_STRING("class"), aClassName); return NS_OK; } @@ -4370,7 +4387,7 @@ nsXULPrototypeAttribute::~nsXULPrototypeAttribute() // nsresult -nsXULPrototypeElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aValue) +nsXULPrototypeElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aValue) { for (PRInt32 i = 0; i < mNumAttributes; ++i) { if (mAttributes[i].mNodeInfo->Equals(aName, aNameSpaceID)) { diff --git a/rdf/content/src/nsXULElement.h b/rdf/content/src/nsXULElement.h index 7b29a574760f..da24dc371ed1 100644 --- a/rdf/content/src/nsXULElement.h +++ b/rdf/content/src/nsXULElement.h @@ -225,7 +225,7 @@ public: nsCOMPtr mInlineStyleRule; // [OWNER] nsClassList* mClassList; - nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aValue); + nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aValue); }; struct JSRuntime; @@ -358,12 +358,12 @@ public: NS_IMETHOD GetNameSpaceID(PRInt32& aNameSpeceID) const; NS_IMETHOD GetTag(nsIAtom*& aResult) const; NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const; - NS_IMETHOD ParseAttributeString(const nsString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID); + NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID); NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, nsIAtom*& aPrefix); - NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, PRBool aNotify); - NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue, PRBool aNotify); - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const; - NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const; + NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue, PRBool aNotify); + NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue, PRBool aNotify); + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aResult) const; + NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsAWritableString& aResult) const; NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify); NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const; @@ -414,7 +414,7 @@ public: NS_IMETHOD SetLazyState(PRInt32 aFlags); NS_IMETHOD ClearLazyState(PRInt32 aFlags); NS_IMETHOD GetLazyState(PRInt32 aFlag, PRBool& aValue); - NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID); + NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsAReadableString& aValue, REFNSIID aIID); NS_IMETHOD ForceElementToOwnResource(PRBool aForce); NS_IMETHOD InitTemplateRoot(nsIRDFCompositeDataSource* aDatabase, nsIXULTemplateBuilder* aBuilder); @@ -429,9 +429,9 @@ public: NS_DECL_IDOMXULELEMENT // nsIDOMEventTarget interface (from nsIDOMEventReceiver) - NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); - NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, + NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent); @@ -450,7 +450,7 @@ public: NS_IMETHOD CompileEventHandler(nsIScriptContext* aContext, void* aTarget, nsIAtom *aName, - const nsString& aBody, + const nsAReadableString& aBody, void** aHandler); NS_IMETHOD GetCompiledEventHandler(nsIAtom *aName, void** aHandler); @@ -483,7 +483,7 @@ protected: // Implementation methods nsresult EnsureContentsGenerated(void) const; - nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName); + nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsAReadableString& attrName); static nsresult ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent); @@ -491,13 +491,13 @@ protected: // Static helpers static nsresult GetElementsByTagName(nsIDOMNode* aNode, - const nsString& aTagName, + const nsAReadableString& aTagName, nsRDFDOMNodeList* aElements); static nsresult GetElementsByAttribute(nsIDOMNode* aNode, - const nsString& aAttributeName, - const nsString& aAttributeValue, + const nsAReadableString& aAttributeName, + const nsAReadableString& aAttributeValue, nsRDFDOMNodeList* aElements); static PRBool IsAncestor(nsIDOMNode* aParentNode, nsIDOMNode* aChildNode); diff --git a/rdf/content/src/nsXULMenuListElement.cpp b/rdf/content/src/nsXULMenuListElement.cpp index c2638ddfe51c..b8be358d1744 100644 --- a/rdf/content/src/nsXULMenuListElement.cpp +++ b/rdf/content/src/nsXULMenuListElement.cpp @@ -73,49 +73,49 @@ nsXULMenuListElement::~nsXULMenuListElement() } NS_IMETHODIMP -nsXULMenuListElement::GetValue(nsString& aValue) +nsXULMenuListElement::GetValue(nsAWritableString& aValue) { return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("value"), aValue); } NS_IMETHODIMP -nsXULMenuListElement::SetValue(const nsString& aValue) +nsXULMenuListElement::SetValue(const nsAReadableString& aValue) { return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("value"), aValue); } NS_IMETHODIMP -nsXULMenuListElement::GetCrop(nsString& aCrop) +nsXULMenuListElement::GetCrop(nsAWritableString& aCrop) { return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop); } NS_IMETHODIMP -nsXULMenuListElement::SetCrop(const nsString& aCrop) +nsXULMenuListElement::SetCrop(const nsAReadableString& aCrop) { return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("crop"), aCrop); } NS_IMETHODIMP -nsXULMenuListElement::GetSrc(nsString& aSrc) +nsXULMenuListElement::GetSrc(nsAWritableString& aSrc) { return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc); } NS_IMETHODIMP -nsXULMenuListElement::SetSrc(const nsString& aSrc) +nsXULMenuListElement::SetSrc(const nsAReadableString& aSrc) { return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("src"), aSrc); } NS_IMETHODIMP -nsXULMenuListElement::GetData(nsString& aData) +nsXULMenuListElement::GetData(nsAWritableString& aData) { return mOuter->GetAttribute(NS_ConvertASCIItoUCS2("data"), aData); } NS_IMETHODIMP -nsXULMenuListElement::SetData(const nsString& aData) +nsXULMenuListElement::SetData(const nsAReadableString& aData) { return mOuter->SetAttribute(NS_ConvertASCIItoUCS2("data"), aData); } diff --git a/rdf/content/src/nsXULPrototypeDocument.cpp b/rdf/content/src/nsXULPrototypeDocument.cpp index 52bfe95e81d1..0786f25a7f0d 100644 --- a/rdf/content/src/nsXULPrototypeDocument.cpp +++ b/rdf/content/src/nsXULPrototypeDocument.cpp @@ -113,8 +113,8 @@ public: NS_IMETHOD AddOverlayReference(nsIURI* aURI); NS_IMETHOD GetOverlayReferences(nsISupportsArray** aResult); - NS_IMETHOD GetHeaderData(nsIAtom* aField, nsString& aData) const; - NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsString& aData); + NS_IMETHOD GetHeaderData(nsIAtom* aField, nsAWritableString& aData) const; + NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsAReadableString& aData); NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aResult); NS_IMETHOD SetDocumentPrincipal(nsIPrincipal* aPrincipal); @@ -303,7 +303,7 @@ nsXULPrototypeDocument::GetOverlayReferences(nsISupportsArray** aResult) NS_IMETHODIMP -nsXULPrototypeDocument::GetHeaderData(nsIAtom* aField, nsString& aData) const +nsXULPrototypeDocument::GetHeaderData(nsIAtom* aField, nsAWritableString& aData) const { // XXX Not implemented aData.Truncate(); @@ -312,7 +312,7 @@ nsXULPrototypeDocument::GetHeaderData(nsIAtom* aField, nsString& aData) const NS_IMETHODIMP -nsXULPrototypeDocument::SetHeaderData(nsIAtom* aField, const nsString& aData) +nsXULPrototypeDocument::SetHeaderData(nsIAtom* aField, const nsAReadableString& aData) { // XXX Not implemented return NS_OK; diff --git a/string/obsolete/nsString.cpp b/string/obsolete/nsString.cpp index f4a5f6f1ec8c..5fcee41354b8 100644 --- a/string/obsolete/nsString.cpp +++ b/string/obsolete/nsString.cpp @@ -777,7 +777,7 @@ PRInt32 nsCString::ToInteger(PRInt32* anErrorCode,PRUint32 aRadix) const { if (done) { - //integer found + //integer found *anErrorCode = NS_OK; if (aRadix!=kAutoDetect) theRadix = aRadix; // override @@ -952,7 +952,56 @@ void nsCString::AssignWithConversion( const nsString& aString ) { AssignWithConversion(aString.GetUnicode(), aString.Length()); } +#ifdef NEW_STRING_APIS +void nsCString::AssignWithConversion( const nsAReadableString& aString ) { + nsStr::Truncate(*this,0); + PRInt32 count = aString.Length(); + if(count){ + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + PRUint32 fraglen = start.size_forward(); + + nsStr temp; + nsStr::Initialize(temp,eTwoByte); + temp.mUStr=(PRUnichar*)start.get(); + + temp.mLength=fraglen; + + StrAppend(*this,temp,0,fraglen); + + start += fraglen; + } + } +} +#endif + +#ifdef NEW_STRING_APIS +void nsCString::AppendWithConversion( const nsAReadableString& aString ) { + PRInt32 count = aString.Length(); + + if(count){ + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + PRUint32 fraglen = start.size_forward(); + + nsStr temp; + nsStr::Initialize(temp,eTwoByte); + temp.mUStr=(PRUnichar*)start.get(); + + temp.mLength=fraglen; + + StrAppend(*this,temp,0,fraglen); + + start += fraglen; + } + } +} +#endif /** * assign given unichar to this string @@ -1886,8 +1935,22 @@ void nsCString::DebugDump(void) const { //---------------------------------------------------------------------- +#ifdef NEW_STRING_APIS +NS_ConvertUCS2toUTF8::NS_ConvertUCS2toUTF8( const nsAReadableString& aString ) + { + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + nsReadableFragment frag(start.fragment()); + Append(frag.mStart, frag.mEnd - frag.mStart); + start += start.size_forward(); + } + } +#endif + void -NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) +NS_ConvertUCS2toUTF8::Append( const PRUnichar* aString, PRUint32 aLength ) { // Handle null string by just leaving us as a brand-new // uninitialized nsCAutoString. @@ -1911,12 +1974,12 @@ NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) // Make sure our buffer's big enough, so we don't need to do // multiple allocations. - if(PRUint32(utf8len+1) > sizeof(mBuffer)) - SetCapacity(utf8len+1); + if(mLength+PRUint32(utf8len+1) > sizeof(mBuffer)) + SetCapacity(mLength+utf8len+1); // |SetCapacity| normally doesn't guarantee the use we are putting it to here (see its interface comment in nsAWritableString.h), // we can only use it since our local implementation, |nsCString::SetCapacity|, is known to do what we want - char* out = mStr; + char* out = mStr+mLength; PRUint32 ucs4=0; for (p = aString, count = aLength; 0 != count && 0 != (*p); count--, p++) @@ -1978,7 +2041,7 @@ NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) } *out = '\0'; // null terminate - mLength = utf8len; + mLength += utf8len; } @@ -2003,6 +2066,11 @@ nsCAutoString::nsCAutoString( const nsCString& aString ) : nsCString(){ Append(aString); } +nsCAutoString::nsCAutoString( const nsAReadableCString& aString ) : nsCString(){ + Initialize(*this,mBuffer,sizeof(mBuffer)-1,0,eOneByte,PR_FALSE); + AddNullTerminator(*this); + Append(aString); +} nsCAutoString::nsCAutoString(const char* aCString) : nsCString() { Initialize(*this,mBuffer,sizeof(mBuffer)-1,0,eOneByte,PR_FALSE); diff --git a/string/obsolete/nsString.h b/string/obsolete/nsString.h index 62f1f10c94d7..47402f69ef89 100644 --- a/string/obsolete/nsString.h +++ b/string/obsolete/nsString.h @@ -110,7 +110,7 @@ public: nsCString(const nsCString& aString); #ifdef NEW_STRING_APIS - nsCString( const nsAReadableCString& ); + explicit nsCString( const nsAReadableCString& ); nsCString(const char*); nsCString(const char*, PRInt32); @@ -428,6 +428,9 @@ public: void AssignWithConversion(const PRUnichar*,PRInt32=-1); void AssignWithConversion( const nsString& aString ); +#ifdef NEW_STRING_APIS + void AssignWithConversion( const nsAReadableString& aString ); +#endif void AssignWithConversion(PRUnichar); #ifndef NEW_STRING_APIS @@ -472,6 +475,9 @@ public: void AppendWithConversion(const nsString&, PRInt32=-1); void AppendWithConversion(PRUnichar aChar); +#ifdef NEW_STRING_APIS + void AppendWithConversion( const nsAReadableString& aString ); +#endif void AppendWithConversion(const PRUnichar*, PRInt32=-1); // Why no |AppendWithConversion(const PRUnichar*, PRInt32)|? --- now I know, because implicit construction hid the need for this routine void AppendInt(PRInt32 aInteger,PRInt32 aRadix=10); //radix=8,10 or 16 @@ -834,6 +840,7 @@ public: nsCAutoString(); nsCAutoString(const nsCString& ); + nsCAutoString(const nsAReadableCString& aString); nsCAutoString(const char* aString); nsCAutoString(const char* aString,PRInt32 aLength); nsCAutoString(const CBufDescriptor& aBuffer); @@ -897,26 +904,30 @@ class NS_COM NS_ConvertUCS2toUTF8 public: NS_ConvertUCS2toUTF8( const PRUnichar* aString ) { - Init( aString, ~PRUint32(0) /* MAXINT */); + Append( aString, ~PRUint32(0) /* MAXINT */); } NS_ConvertUCS2toUTF8( const PRUnichar* aString, PRUint32 aLength ) { - Init( aString, aLength ); + Append( aString, aLength ); } NS_ConvertUCS2toUTF8( PRUnichar aChar ) { - Init( &aChar, 1 ); + Append( &aChar, 1 ); } +#ifdef NEW_STRING_APIS + NS_ConvertUCS2toUTF8( const nsAReadableString& aString ); +#endif + operator const char*() const { return GetBuffer(); } protected: - void Init( const PRUnichar* aString, PRUint32 aLength ); + void Append( const PRUnichar* aString, PRUint32 aLength ); private: // NOT TO BE IMPLEMENTED diff --git a/string/obsolete/nsString2.cpp b/string/obsolete/nsString2.cpp index a0d394fe3f30..80771e2f6079 100644 --- a/string/obsolete/nsString2.cpp +++ b/string/obsolete/nsString2.cpp @@ -2275,6 +2275,15 @@ nsAutoString::nsAutoString( const nsString& aString ) Append(aString); } +nsAutoString::nsAutoString( const nsAReadableString& aString ) + : nsString() +{ + Initialize(*this, mBuffer, (sizeof(mBuffer)>>eTwoByte)-1, 0, eTwoByte, PR_FALSE); + AddNullTerminator(*this); + Append(aString); +} + + /** * constructor that uses external buffer diff --git a/string/obsolete/nsString2.h b/string/obsolete/nsString2.h index cec472b57ecc..e40d5e6652b6 100644 --- a/string/obsolete/nsString2.h +++ b/string/obsolete/nsString2.h @@ -104,7 +104,7 @@ public: nsString(const nsString& aString); #ifdef NEW_STRING_APIS - nsString(const nsAReadableString&); + explicit nsString(const nsAReadableString&); nsString(const PRUnichar*); nsString(const PRUnichar*, PRInt32); @@ -924,6 +924,7 @@ public: virtual ~nsAutoString(); nsAutoString(); nsAutoString(const nsAutoString& aString); + nsAutoString(const nsAReadableString& aString); nsAutoString(const nsString& aString); nsAutoString(const PRUnichar* aString); nsAutoString(const PRUnichar* aString,PRInt32 aLength); diff --git a/string/public/nsAReadableString.h b/string/public/nsAReadableString.h index 7738ab87af25..6e55feebcfc6 100644 --- a/string/public/nsAReadableString.h +++ b/string/public/nsAReadableString.h @@ -40,6 +40,8 @@ // for |NS_MIN|, |NS_MAX|, and |NS_COUNT|... #endif +#include "nsMemory.h" + /* This file defines the abstract interfaces |nsAReadableString| and |nsAReadableCString| (the 'A' is for 'abstract', as opposed to the 'I' in @@ -310,7 +312,7 @@ class basic_nsAReadableString PRUint32 Right( basic_nsAWritableString&, PRUint32 ) const; // Find( ... ) const; - // FindChar( ... ) const; + PRInt32 FindChar( CharT, PRUint32 aOffset = 0 ) const; // FindCharInSet( ... ) const; // RFind( ... ) const; // RFindChar( ... ) const; @@ -625,7 +627,27 @@ basic_nsAReadableString::Right( basic_nsAWritableString& aResult, return Mid(aResult, myLength-aLengthToCopy, aLengthToCopy); } +template +PRInt32 +basic_nsAReadableString::FindChar( CharT aChar, PRUint32 aOffset ) const + { + nsReadingIterator start( BeginReading() ); + nsReadingIterator end( EndReading() ); + start += aOffset; + + PRUint32 pos = 0; + while (start != end) { + PRUint32 fraglen = start.size_forward(); + const CharT* findPtr = nsCharTraits::find(start.get(), fraglen, aChar); + if (findPtr) { + return pos + (findPtr-start.get()); + } + pos += fraglen; + start += fraglen; + } + return -1; + } template inline @@ -1126,11 +1148,11 @@ nsPromiseSubstring::GetReadableFragment( nsReadableFragment& aFrag { // if there's more physical data in the returned fragment than I logically have left... size_t logical_size_backward = aPosition - mStartPos; - if ( position_ptr - aFragment.mStart > logical_size_backward ) + if ( size_t(position_ptr - aFragment.mStart) > logical_size_backward ) aFragment.mStart = position_ptr - logical_size_backward; size_t logical_size_forward = mLength - logical_size_backward; - if ( aFragment.mEnd - position_ptr > logical_size_forward ) + if ( size_t(aFragment.mEnd - position_ptr) > logical_size_forward ) aFragment.mEnd = position_ptr + logical_size_forward; } @@ -1300,6 +1322,90 @@ operator+( const basic_nsLiteralString& lhs, const basic_nsLiteralString< return nsPromiseConcatenation(lhs, rhs); } +#define kDefaultFlatStringSize 64 + +template +class basic_nsPromiseFlatString : + public basic_nsAReadableString +{ + public: + explicit basic_nsPromiseFlatString( const basic_nsAReadableString& ); + virtual ~basic_nsPromiseFlatString( ) { + if (mOwnsBuffer) { + nsMemory::Free((void*)mBuffer); + } + } + + virtual PRUint32 Length() const { return mLength; } + virtual const CharT* GetReadableFragment( nsReadableFragment&, nsFragmentRequest, PRUint32 = 0 ) const; + + operator const CharT*() const { return mBuffer; } + + protected: + PRUint32 mLength; + const CharT *mBuffer; + PRBool mOwnsBuffer; + CharT mInlineBuffer[kDefaultFlatStringSize< +basic_nsPromiseFlatString::basic_nsPromiseFlatString( const basic_nsAReadableString& aString ) : mLength(aString.Length()), mOwnsBuffer(PR_FALSE) +{ + typedef basic_nsAReadableString::const_iterator iterator; + + iterator start( aString.BeginReading() ); + iterator end( aString.EndReading() ); + + // First count the number of buffers + PRInt32 buffer_count = 0; + while ( start != end ) { + buffer_count++; + start += start.size_forward(); + } + + // Now figure out what we want to do with the string + start = aString.BeginReading(); + // XXX Not guaranteed null-termination in the first case + // If it's a single buffer, we just use the implementation's buffer + if ( buffer_count == 1 ) + mBuffer = start.get(); + // If it's too big for our inline buffer, we allocate a new one + else if ( mLength > kDefaultFlatStringSize-1 ) { + CharT* result = NS_STATIC_CAST(CharT*, + nsMemory::Alloc((mLength+1) * sizeof(CharT))); + *copy_string(start, end, result) = CharT(0); + + mBuffer = result; + mOwnsBuffer = PR_TRUE; + } + // Otherwise copy into our internal buffer + else { + mBuffer = mInlineBuffer; + copy_string( start, end, mInlineBuffer ); + mInlineBuffer[mLength] = 0; + } +} + + +template +const CharT* +basic_nsPromiseFlatString::GetReadableFragment( nsReadableFragment& aFragment, + nsFragmentRequest aRequest, + PRUint32 aOffset ) const +{ + switch ( aRequest ) { + case kFirstFragment: + case kLastFragment: + case kFragmentAt: + aFragment.mEnd = (aFragment.mStart = mBuffer) + mLength; + return aFragment.mStart + aOffset; + + case kPrevFragment: + case kNextFragment: + default: + return 0; + } +} typedef basic_nsAReadableString nsAReadableString; @@ -1308,6 +1414,9 @@ typedef basic_nsAReadableString nsAReadableCString; typedef basic_nsLiteralString nsLiteralString; typedef basic_nsLiteralString nsLiteralCString; +typedef basic_nsPromiseFlatString nsPromiseFlatString; +typedef basic_nsPromiseFlatString nsPromiseFlatCString; + #ifdef HAVE_CPP_2BYTE_WCHAR_T #define NS_LITERAL_STRING(s) nsLiteralString(L##s, (sizeof(L##s)/sizeof(wchar_t))-1) diff --git a/string/public/nsReadableUtils.h b/string/public/nsReadableUtils.h index 0c769f996348..6431fe5e98b5 100755 --- a/string/public/nsReadableUtils.h +++ b/string/public/nsReadableUtils.h @@ -28,7 +28,10 @@ #include "nsAReadableString.h" #include "nsAWritableString.h" +#include "nsCRT.h" +NS_COM void CopyUCS2toASCII( const nsAReadableString& aSource, nsAWritableCString& aDest ); +NS_COM void CopyASCIItoUCS2( const nsAReadableCString& aSource, nsAWritableString& aDest ); /** * Returns a new |char| buffer containing a zero-terminated copy of |aSource|. @@ -55,6 +58,19 @@ NS_COM char* ToNewCString( const nsAReadableString& aSource ); */ NS_COM char* ToNewCString( const nsAReadableCString& aSource ); + /** + * Returns a new |char| buffer containing a zero-terminated copy of |aSource|. + * + * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|. + * Performs a encoding conversion by converting 16-bit wide characters down to UTF8 encoded 8-bits wide string copying |aSource| to your new buffer. + * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls. + * + * @param aSource a 16-bit wide string + * @return a new |char| buffer you must free with |nsMemory::Free|. + */ + +NS_COM char* ToNewUTF8String( const nsAReadableString& aSource ); + /** * Returns a new |PRUnichar| buffer containing a zero-terminated copy of |aSource|. @@ -81,6 +97,21 @@ NS_COM PRUnichar* ToNewUnicode( const nsAReadableString& aSource ); */ NS_COM PRUnichar* ToNewUnicode( const nsAReadableCString& aSource ); + /** + * Copies |aLength| 16-bit characters from the start of |aSource| to the + * |PRUnichar| buffer |aDest|. + * + * After this operation |aDest| is not null terminated. + * + * @param aSource a 16-bit wide string + * @param aDest a |PRUnichar| buffer + * @param aLength the number of 16-bit characters to copy + * @return pointer to destination buffer - identical to |aDest| + */ +NS_COM PRUnichar* CopyUnicodeTo( const nsAReadableString& aSource, + PRUnichar* aDest, + PRUint32 aLength ); + /** * Returns |PR_TRUE| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F). @@ -89,4 +120,52 @@ NS_COM PRUnichar* ToNewUnicode( const nsAReadableCString& aSource ); */ NS_COM PRBool IsASCII( const nsAReadableString& aString ); + + // + // |ToUpperCase(basic_nsAWritableString&)| + // +template +void +ToUpperCase(basic_nsAWritableString& aString) + { + nsWritingIterator start( aString.BeginWriting() ); + nsWritingIterator end( aString.EndWriting() ); + + while ( start != end ) { + PRUint32 fraglen = start.size_forward(); + CharT *buf = start.get(); + + while ( fraglen-- ) { + *buf = nsCRT::ToUpper(*buf); + ++buf; + } + + start += fraglen; + } + } + + // + // |ToUpperCase(basic_nsAWritableString&)| + // +template +void +ToLowerCase(basic_nsAWritableString& aString) + { + nsWritingIterator start( aString.BeginWriting() ); + nsWritingIterator end( aString.EndWriting() ); + + while ( start != end ) { + PRUint32 fraglen = start.size_forward(); + CharT *buf = start.get(); + + while ( fraglen-- ) { + *buf = nsCRT::ToLower(*buf); + ++buf; + } + + start += fraglen; + } + } + + #endif // !defined(nsReadableUtils_h___) diff --git a/string/src/nsReadableUtils.cpp b/string/src/nsReadableUtils.cpp index 1d37825cd89b..07bbaf8b8fad 100755 --- a/string/src/nsReadableUtils.cpp +++ b/string/src/nsReadableUtils.cpp @@ -25,6 +25,7 @@ #include "nsReadableUtils.h" #include "nsMemory.h" +#include "nsString.h" @@ -65,6 +66,24 @@ class LossyConvertEncoding }; +NS_COM +void +CopyUCS2toASCII( const nsAReadableString& aSource, nsAWritableCString& aDest ) + { + // right now, this won't work on multi-fragment destinations + aDest.SetLength(aSource.Length()); + copy_string(aSource.BeginReading(), aSource.EndReading(), LossyConvertEncoding(aDest.BeginWriting().get())); + } + +NS_COM +void +CopyASCIItoUCS2( const nsAReadableCString& aSource, nsAWritableString& aDest ) + { + // right now, this won't work on multi-fragment destinations + aDest.SetLength(aSource.Length()); + copy_string(aSource.BeginReading(), aSource.EndReading(), LossyConvertEncoding(aDest.BeginWriting().get())); + } + /** * A helper function that allocates a buffer of the desired character type big enough to hold a copy of the supplied string (plus a zero terminator). @@ -91,6 +110,30 @@ ToNewCString( const nsAReadableString& aSource ) return result; } +NS_COM +char* +ToNewUTF8String( const nsAReadableString& aSource ) + { + NS_ConvertUCS2toUTF8 temp(aSource); + + char* result; + if (temp.mOwnsBuffer) { + // We allocated. Trick the string into not freeing its buffer to + // avoid an extra allocation. + result = temp.mStr; + + temp.mStr=0; + temp.mOwnsBuffer = PR_FALSE; + } + else { + // We didn't allocate a buffer, so we need to copy it out of the + // nsCAutoString's storage. + result = nsCRT::strdup(temp.mStr); + } + + return result; + } + NS_COM char* ToNewCString( const nsAReadableCString& aSource ) @@ -122,6 +165,21 @@ ToNewUnicode( const nsAReadableCString& aSource ) return result; } +NS_COM +PRUnichar* +CopyUnicodeTo( const nsAReadableString& aSource, + PRUnichar* aDest, + PRUint32 aLength ) + { + typedef nsAReadableString::const_iterator iterator; + + iterator done_reading = aSource.BeginReading(); + done_reading += aLength; + + copy_string(aSource.BeginReading(), done_reading, aDest); + return aDest; + } + NS_COM PRBool IsASCII( const nsAReadableString& aString ) diff --git a/xpcom/build/dlldeps.cpp b/xpcom/build/dlldeps.cpp index 2c548bba259c..cdcee9779ce9 100644 --- a/xpcom/build/dlldeps.cpp +++ b/xpcom/build/dlldeps.cpp @@ -62,6 +62,7 @@ #include "nsIBinaryInputStream.h" #include "nsIInterfaceRequestor.h" #include "nsIByteArrayInputStream.h" +#include "nsReadableUtils.h" #include "nsStaticNameTable.h" #ifdef DEBUG #include "pure.h" @@ -143,4 +144,10 @@ void XXXNeverCalled() NS_NewLocalFile(NULL, PR_FALSE, NULL); NS_NewByteArrayInputStream (NULL, NULL, 0); nsStaticCaseInsensitiveNameTable(); + nsAutoString str1; + nsCAutoString str2; + ToNewUnicode(str1); + ToNewUnicode(str2); + ToNewCString(str1); + ToNewCString(str2); } diff --git a/xpcom/ds/nsAReadableString.h b/xpcom/ds/nsAReadableString.h index 7738ab87af25..6e55feebcfc6 100644 --- a/xpcom/ds/nsAReadableString.h +++ b/xpcom/ds/nsAReadableString.h @@ -40,6 +40,8 @@ // for |NS_MIN|, |NS_MAX|, and |NS_COUNT|... #endif +#include "nsMemory.h" + /* This file defines the abstract interfaces |nsAReadableString| and |nsAReadableCString| (the 'A' is for 'abstract', as opposed to the 'I' in @@ -310,7 +312,7 @@ class basic_nsAReadableString PRUint32 Right( basic_nsAWritableString&, PRUint32 ) const; // Find( ... ) const; - // FindChar( ... ) const; + PRInt32 FindChar( CharT, PRUint32 aOffset = 0 ) const; // FindCharInSet( ... ) const; // RFind( ... ) const; // RFindChar( ... ) const; @@ -625,7 +627,27 @@ basic_nsAReadableString::Right( basic_nsAWritableString& aResult, return Mid(aResult, myLength-aLengthToCopy, aLengthToCopy); } +template +PRInt32 +basic_nsAReadableString::FindChar( CharT aChar, PRUint32 aOffset ) const + { + nsReadingIterator start( BeginReading() ); + nsReadingIterator end( EndReading() ); + start += aOffset; + + PRUint32 pos = 0; + while (start != end) { + PRUint32 fraglen = start.size_forward(); + const CharT* findPtr = nsCharTraits::find(start.get(), fraglen, aChar); + if (findPtr) { + return pos + (findPtr-start.get()); + } + pos += fraglen; + start += fraglen; + } + return -1; + } template inline @@ -1126,11 +1148,11 @@ nsPromiseSubstring::GetReadableFragment( nsReadableFragment& aFrag { // if there's more physical data in the returned fragment than I logically have left... size_t logical_size_backward = aPosition - mStartPos; - if ( position_ptr - aFragment.mStart > logical_size_backward ) + if ( size_t(position_ptr - aFragment.mStart) > logical_size_backward ) aFragment.mStart = position_ptr - logical_size_backward; size_t logical_size_forward = mLength - logical_size_backward; - if ( aFragment.mEnd - position_ptr > logical_size_forward ) + if ( size_t(aFragment.mEnd - position_ptr) > logical_size_forward ) aFragment.mEnd = position_ptr + logical_size_forward; } @@ -1300,6 +1322,90 @@ operator+( const basic_nsLiteralString& lhs, const basic_nsLiteralString< return nsPromiseConcatenation(lhs, rhs); } +#define kDefaultFlatStringSize 64 + +template +class basic_nsPromiseFlatString : + public basic_nsAReadableString +{ + public: + explicit basic_nsPromiseFlatString( const basic_nsAReadableString& ); + virtual ~basic_nsPromiseFlatString( ) { + if (mOwnsBuffer) { + nsMemory::Free((void*)mBuffer); + } + } + + virtual PRUint32 Length() const { return mLength; } + virtual const CharT* GetReadableFragment( nsReadableFragment&, nsFragmentRequest, PRUint32 = 0 ) const; + + operator const CharT*() const { return mBuffer; } + + protected: + PRUint32 mLength; + const CharT *mBuffer; + PRBool mOwnsBuffer; + CharT mInlineBuffer[kDefaultFlatStringSize< +basic_nsPromiseFlatString::basic_nsPromiseFlatString( const basic_nsAReadableString& aString ) : mLength(aString.Length()), mOwnsBuffer(PR_FALSE) +{ + typedef basic_nsAReadableString::const_iterator iterator; + + iterator start( aString.BeginReading() ); + iterator end( aString.EndReading() ); + + // First count the number of buffers + PRInt32 buffer_count = 0; + while ( start != end ) { + buffer_count++; + start += start.size_forward(); + } + + // Now figure out what we want to do with the string + start = aString.BeginReading(); + // XXX Not guaranteed null-termination in the first case + // If it's a single buffer, we just use the implementation's buffer + if ( buffer_count == 1 ) + mBuffer = start.get(); + // If it's too big for our inline buffer, we allocate a new one + else if ( mLength > kDefaultFlatStringSize-1 ) { + CharT* result = NS_STATIC_CAST(CharT*, + nsMemory::Alloc((mLength+1) * sizeof(CharT))); + *copy_string(start, end, result) = CharT(0); + + mBuffer = result; + mOwnsBuffer = PR_TRUE; + } + // Otherwise copy into our internal buffer + else { + mBuffer = mInlineBuffer; + copy_string( start, end, mInlineBuffer ); + mInlineBuffer[mLength] = 0; + } +} + + +template +const CharT* +basic_nsPromiseFlatString::GetReadableFragment( nsReadableFragment& aFragment, + nsFragmentRequest aRequest, + PRUint32 aOffset ) const +{ + switch ( aRequest ) { + case kFirstFragment: + case kLastFragment: + case kFragmentAt: + aFragment.mEnd = (aFragment.mStart = mBuffer) + mLength; + return aFragment.mStart + aOffset; + + case kPrevFragment: + case kNextFragment: + default: + return 0; + } +} typedef basic_nsAReadableString nsAReadableString; @@ -1308,6 +1414,9 @@ typedef basic_nsAReadableString nsAReadableCString; typedef basic_nsLiteralString nsLiteralString; typedef basic_nsLiteralString nsLiteralCString; +typedef basic_nsPromiseFlatString nsPromiseFlatString; +typedef basic_nsPromiseFlatString nsPromiseFlatCString; + #ifdef HAVE_CPP_2BYTE_WCHAR_T #define NS_LITERAL_STRING(s) nsLiteralString(L##s, (sizeof(L##s)/sizeof(wchar_t))-1) diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index aeb404cabb27..5bf606fd3196 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -75,7 +75,12 @@ AtomImpl::~AtomImpl() { NS_PRECONDITION(nsnull != gAtomHashTable, "null atom hashtable"); if (nsnull != gAtomHashTable) { - PL_HashTableRemove(gAtomHashTable, mString); + // The hash table uses nsAReadableString& as the key so we must + // instanciate a nsAReadableString (nsLiteralString) and use that + // as the key + nsLiteralString key(mString); + + PL_HashTableRemove(gAtomHashTable, &key); nsrefcnt cnt = --gAtoms; if (0 == cnt) { // When the last atom is destroyed, the atom arena is destroyed @@ -88,17 +93,52 @@ AtomImpl::~AtomImpl() NS_IMPL_THREADSAFE_ISUPPORTS1(AtomImpl, nsIAtom) -void* AtomImpl::operator new(size_t size, const PRUnichar* us, PRInt32 uslen) +class CalculateHash + { + public: + typedef PRUnichar value_type; + + CalculateHash() : mHash(0), mLengthHashed(0) { } + + + PRUint32 + write( const PRUnichar* s, PRUint32 N ) + { + for ( PRUint32 n=0; nmString, us, uslen * sizeof(PRUnichar)); - ii->mString[uslen] = 0; + *copy_string(aString.BeginReading(), aString.EndReading(), ii->mString) = PRUnichar(0); return ii; } NS_IMETHODIMP -AtomImpl::ToString(nsString& aBuf) /*FIX: const */ +AtomImpl::ToString(nsAWritableString& aBuf) /*FIX: const */ { aBuf.SetLength(0); aBuf.Append(mString, nsCRT::strlen(mString)); @@ -124,57 +164,60 @@ AtomImpl::SizeOf(nsISizeOfHandler* aHandler, PRUint32* _retval) /*FIX: const */ //---------------------------------------------------------------------- -static PLHashNumber HashKey(const PRUnichar* k) +static PLHashNumber HashKey(const nsAReadableString* k) { - return (PLHashNumber) nsCRT::HashCode(k); + return (PLHashNumber) copy_string(k->BeginReading(), k->EndReading(), + CalculateHash()).GetHash(); } -static PRIntn CompareKeys(const PRUnichar* k1, const PRUnichar* k2) +static PRIntn CompareKeys( const nsAReadableString* k1, const PRUnichar* k2 ) { - return nsCRT::strcmp(k1, k2) == 0; + return Compare(*k1, k2) == 0; } NS_COM nsIAtom* NS_NewAtom(const char* isolatin1) { - nsAutoString tmp; - tmp.AssignWithConversion(isolatin1); - return NS_NewAtom(tmp.GetUnicode()); + return NS_NewAtom(NS_ConvertASCIItoUCS2(isolatin1)); } -NS_COM nsIAtom* NS_NewAtom(const nsString& aString) +NS_COM nsIAtom* NS_NewAtom( const nsAReadableString& aString ) { - return NS_NewAtom(aString.GetUnicode()); -} + if ( !gAtomHashTable ) + gAtomHashTable = PL_NewHashTable(2048, (PLHashFunction)HashKey, + (PLHashComparator)CompareKeys, + (PLHashComparator)0, 0, 0); -NS_COM nsIAtom* NS_NewAtom(const PRUnichar* us) - // Note: in a low memory condition, this routine could return |NULL| -{ - if (nsnull == gAtomHashTable) { - gAtomHashTable = PL_NewHashTable(2048, (PLHashFunction) HashKey, - (PLHashComparator) CompareKeys, - (PLHashComparator) nsnull, - nsnull, nsnull); - } - PRUint32 uslen; - PRUint32 hashCode = nsCRT::HashCode(us, &uslen); - PLHashEntry** hep = PL_HashTableRawLookup(gAtomHashTable, hashCode, us); - PLHashEntry* he = *hep; - if (nsnull != he) { - nsIAtom* id = (nsIAtom*) he->value; - NS_IF_ADDREF(id); - return id; - } + CalculateHash hasher = copy_string(aString.BeginReading(), + aString.EndReading(), CalculateHash()); - AtomImpl* id = new(us, uslen) AtomImpl(); - if ( id ) - { - PL_HashTableRawAdd(gAtomHashTable, hep, hashCode, id->mString, id); - NS_ADDREF(id); + PRUint32 hashCode = hasher.GetHash(); + + PLHashEntry** hep = PL_HashTableRawLookup(gAtomHashTable, hashCode, + &aString); + PLHashEntry* he = *hep; + + AtomImpl* id; + + if ( he ) { + // if we found one, great + id = NS_STATIC_CAST(AtomImpl*, he->value); + } else { + // otherwise, we'll make a new atom + id = new (aString) AtomImpl(); + if ( id ) { + PL_HashTableRawAdd(gAtomHashTable, hep, hashCode, id->mString, id); } + } + NS_IF_ADDREF(id); return id; } +NS_COM nsIAtom* NS_NewAtom( const PRUnichar* us ) +{ + return NS_NewAtom(nsLiteralString(us)); +} + NS_COM nsrefcnt NS_GetNumberOfAtoms(void) { if (nsnull != gAtomHashTable) { diff --git a/xpcom/ds/nsAtomTable.h b/xpcom/ds/nsAtomTable.h index 29adc05aa002..ac17b1a0d60c 100644 --- a/xpcom/ds/nsAtomTable.h +++ b/xpcom/ds/nsAtomTable.h @@ -33,7 +33,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIATOM - void* operator new(size_t size, const PRUnichar* us, PRInt32 uslen); + void* operator new(size_t size, const nsAReadableString& aString); void operator delete(void* ptr) { ::operator delete(ptr); diff --git a/xpcom/ds/nsCRT.cpp b/xpcom/ds/nsCRT.cpp index ccda6f66815c..b54b6fc8bc52 100644 --- a/xpcom/ds/nsCRT.cpp +++ b/xpcom/ds/nsCRT.cpp @@ -194,6 +194,26 @@ PRBool nsCRT::IsLower(PRUnichar aChar) return aChar != nsCRT::ToUpper(aChar); } +char nsCRT::ToUpper(char aChar) +{ + return (char)kLower2Upper[aChar]; +} + +char nsCRT::ToLower(char aChar) +{ + return (char)kUpper2Lower[aChar]; +} + +PRBool nsCRT::IsUpper(char aChar) +{ + return aChar != nsCRT::ToLower(aChar); +} + +PRBool nsCRT::IsLower(char aChar) +{ + return aChar != nsCRT::ToUpper(aChar); +} + //////////////////////////////////////////////////////////////////////////////// // My lovely strtok routine diff --git a/xpcom/ds/nsCRT.h b/xpcom/ds/nsCRT.h index 5b01364d156e..5d8bec4ba151 100644 --- a/xpcom/ds/nsCRT.h +++ b/xpcom/ds/nsCRT.h @@ -259,6 +259,14 @@ public: static PRBool IsLower(PRUnichar aChar); + static char ToUpper(char aChar); + + static char ToLower(char aChar); + + static PRBool IsUpper(char aChar); + + static PRBool IsLower(char aChar); + static PRBool IsAscii(PRUnichar aChar); static PRBool IsAscii(PRUnichar* aString); static PRBool IsAsciiAlpha(PRUnichar aChar); diff --git a/xpcom/ds/nsHashtable.cpp b/xpcom/ds/nsHashtable.cpp index 40f5801f7c5a..9263eb79d1a8 100644 --- a/xpcom/ds/nsHashtable.cpp +++ b/xpcom/ds/nsHashtable.cpp @@ -446,8 +446,8 @@ nsCStringKey::Clone() const //////////////////////////////////////////////////////////////////////////////// -nsStringKey::nsStringKey(const nsString& str) - : mStr((PRUnichar*)str.GetUnicode()), mStrLen(str.Length()), mOwnership(OWN_CLONE) +nsStringKey::nsStringKey(const nsAReadableString& str) + : mStr(NS_CONST_CAST(PRUnichar*, NS_STATIC_CAST(const PRUnichar *, nsPromiseFlatString(str)))), mStrLen(str.Length()), mOwnership(OWN_CLONE) { NS_ASSERTION(mStr, "null string key"); #ifdef DEBUG diff --git a/xpcom/ds/nsHashtable.h b/xpcom/ds/nsHashtable.h index d553142d3fa8..95582931ea10 100644 --- a/xpcom/ds/nsHashtable.h +++ b/xpcom/ds/nsHashtable.h @@ -37,6 +37,7 @@ #include "prlock.h" #include "nsCom.h" #include "nscore.h" +#include "nsString.h" class nsHashtable; class nsStringKey; @@ -304,7 +305,7 @@ public: }; nsStringKey(const PRUnichar* str, PRInt32 strLen = -1, Ownership own = OWN_CLONE); - nsStringKey(const nsString& str); + nsStringKey(const nsAReadableString& str); ~nsStringKey(void); PRUint32 HashCode(void) const; diff --git a/xpcom/ds/nsIAtom.idl b/xpcom/ds/nsIAtom.idl index 7acaba914ba3..8605231f340c 100644 --- a/xpcom/ds/nsIAtom.idl +++ b/xpcom/ds/nsIAtom.idl @@ -25,12 +25,10 @@ interface nsISizeOfHandler; - -[ref] native nsStringRef(nsString); -%{ C++ -class nsString; +%{C++ +#include "nsAWritableString.h" %} - +[ref] native nsStringRef(nsAWritableString); [scriptable, uuid(3d1b15b0-93b4-11d1-895b-006008911b81)] interface nsIAtom : nsISupports @@ -69,7 +67,7 @@ extern NS_COM nsIAtom* NS_NewAtom(const PRUnichar* unicode); /** * Find an atom that matches the given string. */ -extern NS_COM nsIAtom* NS_NewAtom(const nsString& aString); +extern NS_COM nsIAtom* NS_NewAtom(const nsAReadableString& aString); /** * Return a count of the total number of atoms currently diff --git a/xpcom/ds/nsReadableUtils.cpp b/xpcom/ds/nsReadableUtils.cpp index 1d37825cd89b..07bbaf8b8fad 100755 --- a/xpcom/ds/nsReadableUtils.cpp +++ b/xpcom/ds/nsReadableUtils.cpp @@ -25,6 +25,7 @@ #include "nsReadableUtils.h" #include "nsMemory.h" +#include "nsString.h" @@ -65,6 +66,24 @@ class LossyConvertEncoding }; +NS_COM +void +CopyUCS2toASCII( const nsAReadableString& aSource, nsAWritableCString& aDest ) + { + // right now, this won't work on multi-fragment destinations + aDest.SetLength(aSource.Length()); + copy_string(aSource.BeginReading(), aSource.EndReading(), LossyConvertEncoding(aDest.BeginWriting().get())); + } + +NS_COM +void +CopyASCIItoUCS2( const nsAReadableCString& aSource, nsAWritableString& aDest ) + { + // right now, this won't work on multi-fragment destinations + aDest.SetLength(aSource.Length()); + copy_string(aSource.BeginReading(), aSource.EndReading(), LossyConvertEncoding(aDest.BeginWriting().get())); + } + /** * A helper function that allocates a buffer of the desired character type big enough to hold a copy of the supplied string (plus a zero terminator). @@ -91,6 +110,30 @@ ToNewCString( const nsAReadableString& aSource ) return result; } +NS_COM +char* +ToNewUTF8String( const nsAReadableString& aSource ) + { + NS_ConvertUCS2toUTF8 temp(aSource); + + char* result; + if (temp.mOwnsBuffer) { + // We allocated. Trick the string into not freeing its buffer to + // avoid an extra allocation. + result = temp.mStr; + + temp.mStr=0; + temp.mOwnsBuffer = PR_FALSE; + } + else { + // We didn't allocate a buffer, so we need to copy it out of the + // nsCAutoString's storage. + result = nsCRT::strdup(temp.mStr); + } + + return result; + } + NS_COM char* ToNewCString( const nsAReadableCString& aSource ) @@ -122,6 +165,21 @@ ToNewUnicode( const nsAReadableCString& aSource ) return result; } +NS_COM +PRUnichar* +CopyUnicodeTo( const nsAReadableString& aSource, + PRUnichar* aDest, + PRUint32 aLength ) + { + typedef nsAReadableString::const_iterator iterator; + + iterator done_reading = aSource.BeginReading(); + done_reading += aLength; + + copy_string(aSource.BeginReading(), done_reading, aDest); + return aDest; + } + NS_COM PRBool IsASCII( const nsAReadableString& aString ) diff --git a/xpcom/ds/nsReadableUtils.h b/xpcom/ds/nsReadableUtils.h index 0c769f996348..6431fe5e98b5 100755 --- a/xpcom/ds/nsReadableUtils.h +++ b/xpcom/ds/nsReadableUtils.h @@ -28,7 +28,10 @@ #include "nsAReadableString.h" #include "nsAWritableString.h" +#include "nsCRT.h" +NS_COM void CopyUCS2toASCII( const nsAReadableString& aSource, nsAWritableCString& aDest ); +NS_COM void CopyASCIItoUCS2( const nsAReadableCString& aSource, nsAWritableString& aDest ); /** * Returns a new |char| buffer containing a zero-terminated copy of |aSource|. @@ -55,6 +58,19 @@ NS_COM char* ToNewCString( const nsAReadableString& aSource ); */ NS_COM char* ToNewCString( const nsAReadableCString& aSource ); + /** + * Returns a new |char| buffer containing a zero-terminated copy of |aSource|. + * + * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|. + * Performs a encoding conversion by converting 16-bit wide characters down to UTF8 encoded 8-bits wide string copying |aSource| to your new buffer. + * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls. + * + * @param aSource a 16-bit wide string + * @return a new |char| buffer you must free with |nsMemory::Free|. + */ + +NS_COM char* ToNewUTF8String( const nsAReadableString& aSource ); + /** * Returns a new |PRUnichar| buffer containing a zero-terminated copy of |aSource|. @@ -81,6 +97,21 @@ NS_COM PRUnichar* ToNewUnicode( const nsAReadableString& aSource ); */ NS_COM PRUnichar* ToNewUnicode( const nsAReadableCString& aSource ); + /** + * Copies |aLength| 16-bit characters from the start of |aSource| to the + * |PRUnichar| buffer |aDest|. + * + * After this operation |aDest| is not null terminated. + * + * @param aSource a 16-bit wide string + * @param aDest a |PRUnichar| buffer + * @param aLength the number of 16-bit characters to copy + * @return pointer to destination buffer - identical to |aDest| + */ +NS_COM PRUnichar* CopyUnicodeTo( const nsAReadableString& aSource, + PRUnichar* aDest, + PRUint32 aLength ); + /** * Returns |PR_TRUE| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F). @@ -89,4 +120,52 @@ NS_COM PRUnichar* ToNewUnicode( const nsAReadableCString& aSource ); */ NS_COM PRBool IsASCII( const nsAReadableString& aString ); + + // + // |ToUpperCase(basic_nsAWritableString&)| + // +template +void +ToUpperCase(basic_nsAWritableString& aString) + { + nsWritingIterator start( aString.BeginWriting() ); + nsWritingIterator end( aString.EndWriting() ); + + while ( start != end ) { + PRUint32 fraglen = start.size_forward(); + CharT *buf = start.get(); + + while ( fraglen-- ) { + *buf = nsCRT::ToUpper(*buf); + ++buf; + } + + start += fraglen; + } + } + + // + // |ToUpperCase(basic_nsAWritableString&)| + // +template +void +ToLowerCase(basic_nsAWritableString& aString) + { + nsWritingIterator start( aString.BeginWriting() ); + nsWritingIterator end( aString.EndWriting() ); + + while ( start != end ) { + PRUint32 fraglen = start.size_forward(); + CharT *buf = start.get(); + + while ( fraglen-- ) { + *buf = nsCRT::ToLower(*buf); + ++buf; + } + + start += fraglen; + } + } + + #endif // !defined(nsReadableUtils_h___) diff --git a/xpcom/ds/nsString.cpp b/xpcom/ds/nsString.cpp index f4a5f6f1ec8c..5fcee41354b8 100644 --- a/xpcom/ds/nsString.cpp +++ b/xpcom/ds/nsString.cpp @@ -777,7 +777,7 @@ PRInt32 nsCString::ToInteger(PRInt32* anErrorCode,PRUint32 aRadix) const { if (done) { - //integer found + //integer found *anErrorCode = NS_OK; if (aRadix!=kAutoDetect) theRadix = aRadix; // override @@ -952,7 +952,56 @@ void nsCString::AssignWithConversion( const nsString& aString ) { AssignWithConversion(aString.GetUnicode(), aString.Length()); } +#ifdef NEW_STRING_APIS +void nsCString::AssignWithConversion( const nsAReadableString& aString ) { + nsStr::Truncate(*this,0); + PRInt32 count = aString.Length(); + if(count){ + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + PRUint32 fraglen = start.size_forward(); + + nsStr temp; + nsStr::Initialize(temp,eTwoByte); + temp.mUStr=(PRUnichar*)start.get(); + + temp.mLength=fraglen; + + StrAppend(*this,temp,0,fraglen); + + start += fraglen; + } + } +} +#endif + +#ifdef NEW_STRING_APIS +void nsCString::AppendWithConversion( const nsAReadableString& aString ) { + PRInt32 count = aString.Length(); + + if(count){ + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + PRUint32 fraglen = start.size_forward(); + + nsStr temp; + nsStr::Initialize(temp,eTwoByte); + temp.mUStr=(PRUnichar*)start.get(); + + temp.mLength=fraglen; + + StrAppend(*this,temp,0,fraglen); + + start += fraglen; + } + } +} +#endif /** * assign given unichar to this string @@ -1886,8 +1935,22 @@ void nsCString::DebugDump(void) const { //---------------------------------------------------------------------- +#ifdef NEW_STRING_APIS +NS_ConvertUCS2toUTF8::NS_ConvertUCS2toUTF8( const nsAReadableString& aString ) + { + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + nsReadableFragment frag(start.fragment()); + Append(frag.mStart, frag.mEnd - frag.mStart); + start += start.size_forward(); + } + } +#endif + void -NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) +NS_ConvertUCS2toUTF8::Append( const PRUnichar* aString, PRUint32 aLength ) { // Handle null string by just leaving us as a brand-new // uninitialized nsCAutoString. @@ -1911,12 +1974,12 @@ NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) // Make sure our buffer's big enough, so we don't need to do // multiple allocations. - if(PRUint32(utf8len+1) > sizeof(mBuffer)) - SetCapacity(utf8len+1); + if(mLength+PRUint32(utf8len+1) > sizeof(mBuffer)) + SetCapacity(mLength+utf8len+1); // |SetCapacity| normally doesn't guarantee the use we are putting it to here (see its interface comment in nsAWritableString.h), // we can only use it since our local implementation, |nsCString::SetCapacity|, is known to do what we want - char* out = mStr; + char* out = mStr+mLength; PRUint32 ucs4=0; for (p = aString, count = aLength; 0 != count && 0 != (*p); count--, p++) @@ -1978,7 +2041,7 @@ NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) } *out = '\0'; // null terminate - mLength = utf8len; + mLength += utf8len; } @@ -2003,6 +2066,11 @@ nsCAutoString::nsCAutoString( const nsCString& aString ) : nsCString(){ Append(aString); } +nsCAutoString::nsCAutoString( const nsAReadableCString& aString ) : nsCString(){ + Initialize(*this,mBuffer,sizeof(mBuffer)-1,0,eOneByte,PR_FALSE); + AddNullTerminator(*this); + Append(aString); +} nsCAutoString::nsCAutoString(const char* aCString) : nsCString() { Initialize(*this,mBuffer,sizeof(mBuffer)-1,0,eOneByte,PR_FALSE); diff --git a/xpcom/ds/nsString.h b/xpcom/ds/nsString.h index 62f1f10c94d7..47402f69ef89 100644 --- a/xpcom/ds/nsString.h +++ b/xpcom/ds/nsString.h @@ -110,7 +110,7 @@ public: nsCString(const nsCString& aString); #ifdef NEW_STRING_APIS - nsCString( const nsAReadableCString& ); + explicit nsCString( const nsAReadableCString& ); nsCString(const char*); nsCString(const char*, PRInt32); @@ -428,6 +428,9 @@ public: void AssignWithConversion(const PRUnichar*,PRInt32=-1); void AssignWithConversion( const nsString& aString ); +#ifdef NEW_STRING_APIS + void AssignWithConversion( const nsAReadableString& aString ); +#endif void AssignWithConversion(PRUnichar); #ifndef NEW_STRING_APIS @@ -472,6 +475,9 @@ public: void AppendWithConversion(const nsString&, PRInt32=-1); void AppendWithConversion(PRUnichar aChar); +#ifdef NEW_STRING_APIS + void AppendWithConversion( const nsAReadableString& aString ); +#endif void AppendWithConversion(const PRUnichar*, PRInt32=-1); // Why no |AppendWithConversion(const PRUnichar*, PRInt32)|? --- now I know, because implicit construction hid the need for this routine void AppendInt(PRInt32 aInteger,PRInt32 aRadix=10); //radix=8,10 or 16 @@ -834,6 +840,7 @@ public: nsCAutoString(); nsCAutoString(const nsCString& ); + nsCAutoString(const nsAReadableCString& aString); nsCAutoString(const char* aString); nsCAutoString(const char* aString,PRInt32 aLength); nsCAutoString(const CBufDescriptor& aBuffer); @@ -897,26 +904,30 @@ class NS_COM NS_ConvertUCS2toUTF8 public: NS_ConvertUCS2toUTF8( const PRUnichar* aString ) { - Init( aString, ~PRUint32(0) /* MAXINT */); + Append( aString, ~PRUint32(0) /* MAXINT */); } NS_ConvertUCS2toUTF8( const PRUnichar* aString, PRUint32 aLength ) { - Init( aString, aLength ); + Append( aString, aLength ); } NS_ConvertUCS2toUTF8( PRUnichar aChar ) { - Init( &aChar, 1 ); + Append( &aChar, 1 ); } +#ifdef NEW_STRING_APIS + NS_ConvertUCS2toUTF8( const nsAReadableString& aString ); +#endif + operator const char*() const { return GetBuffer(); } protected: - void Init( const PRUnichar* aString, PRUint32 aLength ); + void Append( const PRUnichar* aString, PRUint32 aLength ); private: // NOT TO BE IMPLEMENTED diff --git a/xpcom/ds/nsString2.cpp b/xpcom/ds/nsString2.cpp index a0d394fe3f30..80771e2f6079 100644 --- a/xpcom/ds/nsString2.cpp +++ b/xpcom/ds/nsString2.cpp @@ -2275,6 +2275,15 @@ nsAutoString::nsAutoString( const nsString& aString ) Append(aString); } +nsAutoString::nsAutoString( const nsAReadableString& aString ) + : nsString() +{ + Initialize(*this, mBuffer, (sizeof(mBuffer)>>eTwoByte)-1, 0, eTwoByte, PR_FALSE); + AddNullTerminator(*this); + Append(aString); +} + + /** * constructor that uses external buffer diff --git a/xpcom/ds/nsString2.h b/xpcom/ds/nsString2.h index cec472b57ecc..e40d5e6652b6 100644 --- a/xpcom/ds/nsString2.h +++ b/xpcom/ds/nsString2.h @@ -104,7 +104,7 @@ public: nsString(const nsString& aString); #ifdef NEW_STRING_APIS - nsString(const nsAReadableString&); + explicit nsString(const nsAReadableString&); nsString(const PRUnichar*); nsString(const PRUnichar*, PRInt32); @@ -924,6 +924,7 @@ public: virtual ~nsAutoString(); nsAutoString(); nsAutoString(const nsAutoString& aString); + nsAutoString(const nsAReadableString& aString); nsAutoString(const nsString& aString); nsAutoString(const PRUnichar* aString); nsAutoString(const PRUnichar* aString,PRInt32 aLength); diff --git a/xpcom/ds/nsVoidArray.cpp b/xpcom/ds/nsVoidArray.cpp index acf8b38e4a26..8ebc665c9733 100644 --- a/xpcom/ds/nsVoidArray.cpp +++ b/xpcom/ds/nsVoidArray.cpp @@ -384,11 +384,11 @@ nsStringArray::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const } void -nsStringArray::StringAt(PRInt32 aIndex, nsString& aString) const +nsStringArray::StringAt(PRInt32 aIndex, nsAWritableString& aString) const { nsString* string = NS_STATIC_CAST(nsString*, nsVoidArray::ElementAt(aIndex)); if (nsnull != string) { - aString = *string; + aString.Assign(*string); } else { aString.Truncate(); @@ -402,7 +402,7 @@ nsStringArray::StringAt(PRInt32 aIndex) const } PRInt32 -nsStringArray::IndexOf(const nsString& aPossibleString) const +nsStringArray::IndexOf(const nsAReadableString& aPossibleString) const { if (mImpl) { void** ap = mImpl->mArray; @@ -419,14 +419,19 @@ nsStringArray::IndexOf(const nsString& aPossibleString) const } PRInt32 -nsStringArray::IndexOfIgnoreCase(const nsString& aPossibleString) const +nsStringArray::IndexOfIgnoreCase(const nsAReadableString& aPossibleString) const { + // XXX + // nsString::EqualsIgnoreCase() doesn't take a nsAReadableString& so we + // construct a stack based string here and do a copy... + nsAutoString possible_string(aPossibleString); + if (mImpl) { void** ap = mImpl->mArray; void** end = ap + mImpl->mCount; while (ap < end) { nsString* string = NS_STATIC_CAST(nsString*, *ap); - if (string->EqualsIgnoreCase(aPossibleString)) { + if (string->EqualsIgnoreCase(possible_string)) { return ap - mImpl->mArray; } ap++; @@ -436,7 +441,7 @@ nsStringArray::IndexOfIgnoreCase(const nsString& aPossibleString) const } PRBool -nsStringArray::InsertStringAt(const nsString& aString, PRInt32 aIndex) +nsStringArray::InsertStringAt(const nsAReadableString& aString, PRInt32 aIndex) { nsString* string = new nsString(aString); if (nsVoidArray::InsertElementAt(string, aIndex)) { @@ -447,7 +452,8 @@ nsStringArray::InsertStringAt(const nsString& aString, PRInt32 aIndex) } PRBool -nsStringArray::ReplaceStringAt(const nsString& aString, PRInt32 aIndex) +nsStringArray::ReplaceStringAt(const nsAReadableString& aString, + PRInt32 aIndex) { nsString* string = NS_STATIC_CAST(nsString*, nsVoidArray::ElementAt(aIndex)); if (nsnull != string) { @@ -458,7 +464,7 @@ nsStringArray::ReplaceStringAt(const nsString& aString, PRInt32 aIndex) } PRBool -nsStringArray::RemoveString(const nsString& aString) +nsStringArray::RemoveString(const nsAReadableString& aString) { PRInt32 index = IndexOf(aString); if (-1 < index) { @@ -468,7 +474,7 @@ nsStringArray::RemoveString(const nsString& aString) } PRBool -nsStringArray::RemoveStringIgnoreCase(const nsString& aString) +nsStringArray::RemoveStringIgnoreCase(const nsAReadableString& aString) { PRInt32 index = IndexOfIgnoreCase(aString); if (-1 < index) { diff --git a/xpcom/ds/nsVoidArray.h b/xpcom/ds/nsVoidArray.h index 3435e04d81af..3f1a05018671 100644 --- a/xpcom/ds/nsVoidArray.h +++ b/xpcom/ds/nsVoidArray.h @@ -24,6 +24,7 @@ #define nsVoidArray_h___ #include "nscore.h" +#include "nsAWritableString.h" class nsISizeOfHandler; // Enumerator callback function. Return PR_FALSE to stop @@ -138,23 +139,23 @@ public: return nsVoidArray::Count(); } - void StringAt(PRInt32 aIndex, nsString& aString) const; + void StringAt(PRInt32 aIndex, nsAWritableString& aString) const; nsString* StringAt(PRInt32 aIndex) const; nsString* operator[](PRInt32 aIndex) const { return StringAt(aIndex); } - PRInt32 IndexOf(const nsString& aPossibleString) const; - PRInt32 IndexOfIgnoreCase(const nsString& aPossibleString) const; + PRInt32 IndexOf(const nsAReadableString& aPossibleString) const; + PRInt32 IndexOfIgnoreCase(const nsAReadableString& aPossibleString) const; - PRBool InsertStringAt(const nsString& aString, PRInt32 aIndex); + PRBool InsertStringAt(const nsAReadableString& aString, PRInt32 aIndex); - PRBool ReplaceStringAt(const nsString& aString, PRInt32 aIndex); + PRBool ReplaceStringAt(const nsAReadableString& aString, PRInt32 aIndex); - PRBool AppendString(const nsString& aString) { + PRBool AppendString(const nsAReadableString& aString) { return InsertStringAt(aString, Count()); } - PRBool RemoveString(const nsString& aString); - PRBool RemoveStringIgnoreCase(const nsString& aString); + PRBool RemoveString(const nsAReadableString& aString); + PRBool RemoveStringIgnoreCase(const nsAReadableString& aString); PRBool RemoveStringAt(PRInt32 aIndex); void Clear(void); diff --git a/xpcom/string/obsolete/nsString.cpp b/xpcom/string/obsolete/nsString.cpp index f4a5f6f1ec8c..5fcee41354b8 100644 --- a/xpcom/string/obsolete/nsString.cpp +++ b/xpcom/string/obsolete/nsString.cpp @@ -777,7 +777,7 @@ PRInt32 nsCString::ToInteger(PRInt32* anErrorCode,PRUint32 aRadix) const { if (done) { - //integer found + //integer found *anErrorCode = NS_OK; if (aRadix!=kAutoDetect) theRadix = aRadix; // override @@ -952,7 +952,56 @@ void nsCString::AssignWithConversion( const nsString& aString ) { AssignWithConversion(aString.GetUnicode(), aString.Length()); } +#ifdef NEW_STRING_APIS +void nsCString::AssignWithConversion( const nsAReadableString& aString ) { + nsStr::Truncate(*this,0); + PRInt32 count = aString.Length(); + if(count){ + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + PRUint32 fraglen = start.size_forward(); + + nsStr temp; + nsStr::Initialize(temp,eTwoByte); + temp.mUStr=(PRUnichar*)start.get(); + + temp.mLength=fraglen; + + StrAppend(*this,temp,0,fraglen); + + start += fraglen; + } + } +} +#endif + +#ifdef NEW_STRING_APIS +void nsCString::AppendWithConversion( const nsAReadableString& aString ) { + PRInt32 count = aString.Length(); + + if(count){ + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + PRUint32 fraglen = start.size_forward(); + + nsStr temp; + nsStr::Initialize(temp,eTwoByte); + temp.mUStr=(PRUnichar*)start.get(); + + temp.mLength=fraglen; + + StrAppend(*this,temp,0,fraglen); + + start += fraglen; + } + } +} +#endif /** * assign given unichar to this string @@ -1886,8 +1935,22 @@ void nsCString::DebugDump(void) const { //---------------------------------------------------------------------- +#ifdef NEW_STRING_APIS +NS_ConvertUCS2toUTF8::NS_ConvertUCS2toUTF8( const nsAReadableString& aString ) + { + nsReadingIterator start(aString.BeginReading()); + nsReadingIterator end(aString.EndReading()); + + while (start != end) { + nsReadableFragment frag(start.fragment()); + Append(frag.mStart, frag.mEnd - frag.mStart); + start += start.size_forward(); + } + } +#endif + void -NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) +NS_ConvertUCS2toUTF8::Append( const PRUnichar* aString, PRUint32 aLength ) { // Handle null string by just leaving us as a brand-new // uninitialized nsCAutoString. @@ -1911,12 +1974,12 @@ NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) // Make sure our buffer's big enough, so we don't need to do // multiple allocations. - if(PRUint32(utf8len+1) > sizeof(mBuffer)) - SetCapacity(utf8len+1); + if(mLength+PRUint32(utf8len+1) > sizeof(mBuffer)) + SetCapacity(mLength+utf8len+1); // |SetCapacity| normally doesn't guarantee the use we are putting it to here (see its interface comment in nsAWritableString.h), // we can only use it since our local implementation, |nsCString::SetCapacity|, is known to do what we want - char* out = mStr; + char* out = mStr+mLength; PRUint32 ucs4=0; for (p = aString, count = aLength; 0 != count && 0 != (*p); count--, p++) @@ -1978,7 +2041,7 @@ NS_ConvertUCS2toUTF8::Init( const PRUnichar* aString, PRUint32 aLength ) } *out = '\0'; // null terminate - mLength = utf8len; + mLength += utf8len; } @@ -2003,6 +2066,11 @@ nsCAutoString::nsCAutoString( const nsCString& aString ) : nsCString(){ Append(aString); } +nsCAutoString::nsCAutoString( const nsAReadableCString& aString ) : nsCString(){ + Initialize(*this,mBuffer,sizeof(mBuffer)-1,0,eOneByte,PR_FALSE); + AddNullTerminator(*this); + Append(aString); +} nsCAutoString::nsCAutoString(const char* aCString) : nsCString() { Initialize(*this,mBuffer,sizeof(mBuffer)-1,0,eOneByte,PR_FALSE); diff --git a/xpcom/string/obsolete/nsString.h b/xpcom/string/obsolete/nsString.h index 62f1f10c94d7..47402f69ef89 100644 --- a/xpcom/string/obsolete/nsString.h +++ b/xpcom/string/obsolete/nsString.h @@ -110,7 +110,7 @@ public: nsCString(const nsCString& aString); #ifdef NEW_STRING_APIS - nsCString( const nsAReadableCString& ); + explicit nsCString( const nsAReadableCString& ); nsCString(const char*); nsCString(const char*, PRInt32); @@ -428,6 +428,9 @@ public: void AssignWithConversion(const PRUnichar*,PRInt32=-1); void AssignWithConversion( const nsString& aString ); +#ifdef NEW_STRING_APIS + void AssignWithConversion( const nsAReadableString& aString ); +#endif void AssignWithConversion(PRUnichar); #ifndef NEW_STRING_APIS @@ -472,6 +475,9 @@ public: void AppendWithConversion(const nsString&, PRInt32=-1); void AppendWithConversion(PRUnichar aChar); +#ifdef NEW_STRING_APIS + void AppendWithConversion( const nsAReadableString& aString ); +#endif void AppendWithConversion(const PRUnichar*, PRInt32=-1); // Why no |AppendWithConversion(const PRUnichar*, PRInt32)|? --- now I know, because implicit construction hid the need for this routine void AppendInt(PRInt32 aInteger,PRInt32 aRadix=10); //radix=8,10 or 16 @@ -834,6 +840,7 @@ public: nsCAutoString(); nsCAutoString(const nsCString& ); + nsCAutoString(const nsAReadableCString& aString); nsCAutoString(const char* aString); nsCAutoString(const char* aString,PRInt32 aLength); nsCAutoString(const CBufDescriptor& aBuffer); @@ -897,26 +904,30 @@ class NS_COM NS_ConvertUCS2toUTF8 public: NS_ConvertUCS2toUTF8( const PRUnichar* aString ) { - Init( aString, ~PRUint32(0) /* MAXINT */); + Append( aString, ~PRUint32(0) /* MAXINT */); } NS_ConvertUCS2toUTF8( const PRUnichar* aString, PRUint32 aLength ) { - Init( aString, aLength ); + Append( aString, aLength ); } NS_ConvertUCS2toUTF8( PRUnichar aChar ) { - Init( &aChar, 1 ); + Append( &aChar, 1 ); } +#ifdef NEW_STRING_APIS + NS_ConvertUCS2toUTF8( const nsAReadableString& aString ); +#endif + operator const char*() const { return GetBuffer(); } protected: - void Init( const PRUnichar* aString, PRUint32 aLength ); + void Append( const PRUnichar* aString, PRUint32 aLength ); private: // NOT TO BE IMPLEMENTED diff --git a/xpcom/string/obsolete/nsString2.cpp b/xpcom/string/obsolete/nsString2.cpp index a0d394fe3f30..80771e2f6079 100644 --- a/xpcom/string/obsolete/nsString2.cpp +++ b/xpcom/string/obsolete/nsString2.cpp @@ -2275,6 +2275,15 @@ nsAutoString::nsAutoString( const nsString& aString ) Append(aString); } +nsAutoString::nsAutoString( const nsAReadableString& aString ) + : nsString() +{ + Initialize(*this, mBuffer, (sizeof(mBuffer)>>eTwoByte)-1, 0, eTwoByte, PR_FALSE); + AddNullTerminator(*this); + Append(aString); +} + + /** * constructor that uses external buffer diff --git a/xpcom/string/obsolete/nsString2.h b/xpcom/string/obsolete/nsString2.h index cec472b57ecc..e40d5e6652b6 100644 --- a/xpcom/string/obsolete/nsString2.h +++ b/xpcom/string/obsolete/nsString2.h @@ -104,7 +104,7 @@ public: nsString(const nsString& aString); #ifdef NEW_STRING_APIS - nsString(const nsAReadableString&); + explicit nsString(const nsAReadableString&); nsString(const PRUnichar*); nsString(const PRUnichar*, PRInt32); @@ -924,6 +924,7 @@ public: virtual ~nsAutoString(); nsAutoString(); nsAutoString(const nsAutoString& aString); + nsAutoString(const nsAReadableString& aString); nsAutoString(const nsString& aString); nsAutoString(const PRUnichar* aString); nsAutoString(const PRUnichar* aString,PRInt32 aLength); diff --git a/xpcom/string/public/nsAReadableString.h b/xpcom/string/public/nsAReadableString.h index 7738ab87af25..6e55feebcfc6 100644 --- a/xpcom/string/public/nsAReadableString.h +++ b/xpcom/string/public/nsAReadableString.h @@ -40,6 +40,8 @@ // for |NS_MIN|, |NS_MAX|, and |NS_COUNT|... #endif +#include "nsMemory.h" + /* This file defines the abstract interfaces |nsAReadableString| and |nsAReadableCString| (the 'A' is for 'abstract', as opposed to the 'I' in @@ -310,7 +312,7 @@ class basic_nsAReadableString PRUint32 Right( basic_nsAWritableString&, PRUint32 ) const; // Find( ... ) const; - // FindChar( ... ) const; + PRInt32 FindChar( CharT, PRUint32 aOffset = 0 ) const; // FindCharInSet( ... ) const; // RFind( ... ) const; // RFindChar( ... ) const; @@ -625,7 +627,27 @@ basic_nsAReadableString::Right( basic_nsAWritableString& aResult, return Mid(aResult, myLength-aLengthToCopy, aLengthToCopy); } +template +PRInt32 +basic_nsAReadableString::FindChar( CharT aChar, PRUint32 aOffset ) const + { + nsReadingIterator start( BeginReading() ); + nsReadingIterator end( EndReading() ); + start += aOffset; + + PRUint32 pos = 0; + while (start != end) { + PRUint32 fraglen = start.size_forward(); + const CharT* findPtr = nsCharTraits::find(start.get(), fraglen, aChar); + if (findPtr) { + return pos + (findPtr-start.get()); + } + pos += fraglen; + start += fraglen; + } + return -1; + } template inline @@ -1126,11 +1148,11 @@ nsPromiseSubstring::GetReadableFragment( nsReadableFragment& aFrag { // if there's more physical data in the returned fragment than I logically have left... size_t logical_size_backward = aPosition - mStartPos; - if ( position_ptr - aFragment.mStart > logical_size_backward ) + if ( size_t(position_ptr - aFragment.mStart) > logical_size_backward ) aFragment.mStart = position_ptr - logical_size_backward; size_t logical_size_forward = mLength - logical_size_backward; - if ( aFragment.mEnd - position_ptr > logical_size_forward ) + if ( size_t(aFragment.mEnd - position_ptr) > logical_size_forward ) aFragment.mEnd = position_ptr + logical_size_forward; } @@ -1300,6 +1322,90 @@ operator+( const basic_nsLiteralString& lhs, const basic_nsLiteralString< return nsPromiseConcatenation(lhs, rhs); } +#define kDefaultFlatStringSize 64 + +template +class basic_nsPromiseFlatString : + public basic_nsAReadableString +{ + public: + explicit basic_nsPromiseFlatString( const basic_nsAReadableString& ); + virtual ~basic_nsPromiseFlatString( ) { + if (mOwnsBuffer) { + nsMemory::Free((void*)mBuffer); + } + } + + virtual PRUint32 Length() const { return mLength; } + virtual const CharT* GetReadableFragment( nsReadableFragment&, nsFragmentRequest, PRUint32 = 0 ) const; + + operator const CharT*() const { return mBuffer; } + + protected: + PRUint32 mLength; + const CharT *mBuffer; + PRBool mOwnsBuffer; + CharT mInlineBuffer[kDefaultFlatStringSize< +basic_nsPromiseFlatString::basic_nsPromiseFlatString( const basic_nsAReadableString& aString ) : mLength(aString.Length()), mOwnsBuffer(PR_FALSE) +{ + typedef basic_nsAReadableString::const_iterator iterator; + + iterator start( aString.BeginReading() ); + iterator end( aString.EndReading() ); + + // First count the number of buffers + PRInt32 buffer_count = 0; + while ( start != end ) { + buffer_count++; + start += start.size_forward(); + } + + // Now figure out what we want to do with the string + start = aString.BeginReading(); + // XXX Not guaranteed null-termination in the first case + // If it's a single buffer, we just use the implementation's buffer + if ( buffer_count == 1 ) + mBuffer = start.get(); + // If it's too big for our inline buffer, we allocate a new one + else if ( mLength > kDefaultFlatStringSize-1 ) { + CharT* result = NS_STATIC_CAST(CharT*, + nsMemory::Alloc((mLength+1) * sizeof(CharT))); + *copy_string(start, end, result) = CharT(0); + + mBuffer = result; + mOwnsBuffer = PR_TRUE; + } + // Otherwise copy into our internal buffer + else { + mBuffer = mInlineBuffer; + copy_string( start, end, mInlineBuffer ); + mInlineBuffer[mLength] = 0; + } +} + + +template +const CharT* +basic_nsPromiseFlatString::GetReadableFragment( nsReadableFragment& aFragment, + nsFragmentRequest aRequest, + PRUint32 aOffset ) const +{ + switch ( aRequest ) { + case kFirstFragment: + case kLastFragment: + case kFragmentAt: + aFragment.mEnd = (aFragment.mStart = mBuffer) + mLength; + return aFragment.mStart + aOffset; + + case kPrevFragment: + case kNextFragment: + default: + return 0; + } +} typedef basic_nsAReadableString nsAReadableString; @@ -1308,6 +1414,9 @@ typedef basic_nsAReadableString nsAReadableCString; typedef basic_nsLiteralString nsLiteralString; typedef basic_nsLiteralString nsLiteralCString; +typedef basic_nsPromiseFlatString nsPromiseFlatString; +typedef basic_nsPromiseFlatString nsPromiseFlatCString; + #ifdef HAVE_CPP_2BYTE_WCHAR_T #define NS_LITERAL_STRING(s) nsLiteralString(L##s, (sizeof(L##s)/sizeof(wchar_t))-1) diff --git a/xpcom/string/public/nsReadableUtils.h b/xpcom/string/public/nsReadableUtils.h index 0c769f996348..6431fe5e98b5 100755 --- a/xpcom/string/public/nsReadableUtils.h +++ b/xpcom/string/public/nsReadableUtils.h @@ -28,7 +28,10 @@ #include "nsAReadableString.h" #include "nsAWritableString.h" +#include "nsCRT.h" +NS_COM void CopyUCS2toASCII( const nsAReadableString& aSource, nsAWritableCString& aDest ); +NS_COM void CopyASCIItoUCS2( const nsAReadableCString& aSource, nsAWritableString& aDest ); /** * Returns a new |char| buffer containing a zero-terminated copy of |aSource|. @@ -55,6 +58,19 @@ NS_COM char* ToNewCString( const nsAReadableString& aSource ); */ NS_COM char* ToNewCString( const nsAReadableCString& aSource ); + /** + * Returns a new |char| buffer containing a zero-terminated copy of |aSource|. + * + * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|. + * Performs a encoding conversion by converting 16-bit wide characters down to UTF8 encoded 8-bits wide string copying |aSource| to your new buffer. + * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls. + * + * @param aSource a 16-bit wide string + * @return a new |char| buffer you must free with |nsMemory::Free|. + */ + +NS_COM char* ToNewUTF8String( const nsAReadableString& aSource ); + /** * Returns a new |PRUnichar| buffer containing a zero-terminated copy of |aSource|. @@ -81,6 +97,21 @@ NS_COM PRUnichar* ToNewUnicode( const nsAReadableString& aSource ); */ NS_COM PRUnichar* ToNewUnicode( const nsAReadableCString& aSource ); + /** + * Copies |aLength| 16-bit characters from the start of |aSource| to the + * |PRUnichar| buffer |aDest|. + * + * After this operation |aDest| is not null terminated. + * + * @param aSource a 16-bit wide string + * @param aDest a |PRUnichar| buffer + * @param aLength the number of 16-bit characters to copy + * @return pointer to destination buffer - identical to |aDest| + */ +NS_COM PRUnichar* CopyUnicodeTo( const nsAReadableString& aSource, + PRUnichar* aDest, + PRUint32 aLength ); + /** * Returns |PR_TRUE| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F). @@ -89,4 +120,52 @@ NS_COM PRUnichar* ToNewUnicode( const nsAReadableCString& aSource ); */ NS_COM PRBool IsASCII( const nsAReadableString& aString ); + + // + // |ToUpperCase(basic_nsAWritableString&)| + // +template +void +ToUpperCase(basic_nsAWritableString& aString) + { + nsWritingIterator start( aString.BeginWriting() ); + nsWritingIterator end( aString.EndWriting() ); + + while ( start != end ) { + PRUint32 fraglen = start.size_forward(); + CharT *buf = start.get(); + + while ( fraglen-- ) { + *buf = nsCRT::ToUpper(*buf); + ++buf; + } + + start += fraglen; + } + } + + // + // |ToUpperCase(basic_nsAWritableString&)| + // +template +void +ToLowerCase(basic_nsAWritableString& aString) + { + nsWritingIterator start( aString.BeginWriting() ); + nsWritingIterator end( aString.EndWriting() ); + + while ( start != end ) { + PRUint32 fraglen = start.size_forward(); + CharT *buf = start.get(); + + while ( fraglen-- ) { + *buf = nsCRT::ToLower(*buf); + ++buf; + } + + start += fraglen; + } + } + + #endif // !defined(nsReadableUtils_h___) diff --git a/xpcom/string/src/nsReadableUtils.cpp b/xpcom/string/src/nsReadableUtils.cpp index 1d37825cd89b..07bbaf8b8fad 100755 --- a/xpcom/string/src/nsReadableUtils.cpp +++ b/xpcom/string/src/nsReadableUtils.cpp @@ -25,6 +25,7 @@ #include "nsReadableUtils.h" #include "nsMemory.h" +#include "nsString.h" @@ -65,6 +66,24 @@ class LossyConvertEncoding }; +NS_COM +void +CopyUCS2toASCII( const nsAReadableString& aSource, nsAWritableCString& aDest ) + { + // right now, this won't work on multi-fragment destinations + aDest.SetLength(aSource.Length()); + copy_string(aSource.BeginReading(), aSource.EndReading(), LossyConvertEncoding(aDest.BeginWriting().get())); + } + +NS_COM +void +CopyASCIItoUCS2( const nsAReadableCString& aSource, nsAWritableString& aDest ) + { + // right now, this won't work on multi-fragment destinations + aDest.SetLength(aSource.Length()); + copy_string(aSource.BeginReading(), aSource.EndReading(), LossyConvertEncoding(aDest.BeginWriting().get())); + } + /** * A helper function that allocates a buffer of the desired character type big enough to hold a copy of the supplied string (plus a zero terminator). @@ -91,6 +110,30 @@ ToNewCString( const nsAReadableString& aSource ) return result; } +NS_COM +char* +ToNewUTF8String( const nsAReadableString& aSource ) + { + NS_ConvertUCS2toUTF8 temp(aSource); + + char* result; + if (temp.mOwnsBuffer) { + // We allocated. Trick the string into not freeing its buffer to + // avoid an extra allocation. + result = temp.mStr; + + temp.mStr=0; + temp.mOwnsBuffer = PR_FALSE; + } + else { + // We didn't allocate a buffer, so we need to copy it out of the + // nsCAutoString's storage. + result = nsCRT::strdup(temp.mStr); + } + + return result; + } + NS_COM char* ToNewCString( const nsAReadableCString& aSource ) @@ -122,6 +165,21 @@ ToNewUnicode( const nsAReadableCString& aSource ) return result; } +NS_COM +PRUnichar* +CopyUnicodeTo( const nsAReadableString& aSource, + PRUnichar* aDest, + PRUint32 aLength ) + { + typedef nsAReadableString::const_iterator iterator; + + iterator done_reading = aSource.BeginReading(); + done_reading += aLength; + + copy_string(aSource.BeginReading(), done_reading, aDest); + return aDest; + } + NS_COM PRBool IsASCII( const nsAReadableString& aString ) diff --git a/xpfe/bootstrap/nsDocLoadObserver.cpp b/xpfe/bootstrap/nsDocLoadObserver.cpp index cc027c196f47..1ea0789f6dbd 100644 --- a/xpfe/bootstrap/nsDocLoadObserver.cpp +++ b/xpfe/bootstrap/nsDocLoadObserver.cpp @@ -25,7 +25,7 @@ #include "nsError.h" #include "nsIObserverService.h" #include "nsIServiceManager.h" -#include "nsString2.h" +#include "nsString.h" #include "nsAEUtils.h" #include "nsAESpyglassSuiteHandler.h"