From 92b921aca3dbf03297deb33ddcbf391d0528759e Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Fri, 11 Jul 2003 21:16:12 +0000 Subject: [PATCH] Remove hint parameter from AttributeChanged methods and simplify style hint mechanism. b=211308 r+sr=bzbarsky --- content/base/public/nsIDocument.h | 3 +- content/base/public/nsIDocumentObserver.h | 10 +- content/base/public/nsIStyledContent.h | 23 +- content/base/src/nsContentList.cpp | 2 +- content/base/src/nsDocument.cpp | 5 +- content/base/src/nsDocument.h | 6 +- content/base/src/nsGenericElement.cpp | 23 +- content/base/src/nsGenericElement.h | 7 +- content/base/src/nsStyleSet.cpp | 9 +- .../html/content/src/nsGenericHTMLElement.cpp | 133 +++--- .../html/content/src/nsGenericHTMLElement.h | 46 +-- .../html/content/src/nsHTMLAppletElement.cpp | 20 +- content/html/content/src/nsHTMLBRElement.cpp | 19 +- .../content/src/nsHTMLBaseFontElement.cpp | 25 -- .../html/content/src/nsHTMLBodyElement.cpp | 34 +- .../html/content/src/nsHTMLDListElement.cpp | 22 +- .../content/src/nsHTMLDirectoryElement.cpp | 22 +- content/html/content/src/nsHTMLDivElement.cpp | 21 +- .../html/content/src/nsHTMLFontElement.cpp | 28 +- .../content/src/nsHTMLFrameSetElement.cpp | 37 +- content/html/content/src/nsHTMLHRElement.cpp | 40 +- .../html/content/src/nsHTMLHeadingElement.cpp | 24 +- .../html/content/src/nsHTMLIFrameElement.cpp | 29 +- .../html/content/src/nsHTMLImageElement.cpp | 48 ++- .../html/content/src/nsHTMLInputElement.cpp | 54 ++- content/html/content/src/nsHTMLLIElement.cpp | 20 +- content/html/content/src/nsHTMLMapElement.cpp | 30 +- .../html/content/src/nsHTMLMenuElement.cpp | 20 +- .../html/content/src/nsHTMLOListElement.cpp | 20 +- .../html/content/src/nsHTMLObjectElement.cpp | 20 +- .../html/content/src/nsHTMLOptionElement.cpp | 42 +- .../content/src/nsHTMLParagraphElement.cpp | 21 +- content/html/content/src/nsHTMLPreElement.cpp | 44 +- .../html/content/src/nsHTMLSelectElement.cpp | 40 +- .../content/src/nsHTMLSharedContainerElem.cpp | 25 +- .../html/content/src/nsHTMLSharedElement.cpp | 44 +- .../content/src/nsHTMLSharedLeafElement.cpp | 44 +- .../content/src/nsHTMLSharedObjectElement.cpp | 20 +- .../content/src/nsHTMLTableCaptionElement.cpp | 20 +- .../content/src/nsHTMLTableCellElement.cpp | 42 +- .../content/src/nsHTMLTableColElement.cpp | 49 +-- .../html/content/src/nsHTMLTableElement.cpp | 54 +-- .../content/src/nsHTMLTableRowElement.cpp | 24 +- .../content/src/nsHTMLTableSectionElement.cpp | 23 +- .../content/src/nsHTMLTextAreaElement.cpp | 36 +- .../html/content/src/nsHTMLUListElement.cpp | 20 +- .../html/content/src/nsHTMLUnknownElement.cpp | 11 +- content/html/document/src/nsHTMLDocument.cpp | 5 +- content/html/document/src/nsHTMLDocument.h | 3 +- content/html/style/src/nsHTMLStyleSheet.cpp | 7 +- content/shared/public/nsChangeHint.h | 45 +-- content/shared/src/nsStyleStruct.cpp | 14 +- content/svg/content/src/nsSVGAttributes.cpp | 5 +- content/xbl/src/nsBindingManager.cpp | 3 +- .../xml/document/src/nsXMLPrettyPrinter.cpp | 3 +- content/xul/content/src/nsXULElement.cpp | 52 +-- content/xul/content/src/nsXULElement.h | 7 +- content/xul/document/src/nsXULDocument.cpp | 5 +- content/xul/document/src/nsXULDocument.h | 3 +- .../xul/templates/src/nsXULContentBuilder.cpp | 8 +- .../templates/src/nsXULTemplateBuilder.cpp | 3 +- extensions/inspector/base/src/inDOMView.cpp | 2 +- .../source/xpath/nsXPathResult.cpp | 3 +- .../source/xslt/txMozillaXSLTProcessor.cpp | 3 +- layout/base/nsCSSFrameConstructor.cpp | 84 ++-- layout/base/nsCSSFrameConstructor.h | 3 +- layout/base/nsChangeHint.h | 45 +-- layout/base/nsPresShell.cpp | 5 +- layout/base/public/nsIFrame.h | 3 +- .../base/public/nsIStyleFrameConstruction.h | 3 +- layout/base/public/nsIStyleSet.h | 379 ------------------ layout/forms/nsFileControlFrame.cpp | 5 +- layout/forms/nsFileControlFrame.h | 3 +- layout/forms/nsGfxButtonControlFrame.cpp | 5 +- layout/forms/nsGfxButtonControlFrame.h | 3 +- layout/forms/nsIsIndexFrame.cpp | 5 +- layout/forms/nsIsIndexFrame.h | 3 +- layout/forms/nsTextControlFrame.cpp | 26 +- layout/forms/nsTextControlFrame.h | 3 +- layout/generic/nsAreaFrame.cpp | 5 +- layout/generic/nsAreaFrame.h | 3 +- layout/generic/nsBlockFrame.cpp | 6 +- layout/generic/nsBlockFrame.h | 3 +- layout/generic/nsFrame.cpp | 3 +- layout/generic/nsFrame.h | 3 +- layout/generic/nsFrameFrame.cpp | 6 +- layout/generic/nsFrameSetFrame.cpp | 3 +- layout/generic/nsIFrame.h | 3 +- layout/generic/nsImageFrame.cpp | 7 +- layout/generic/nsImageFrame.h | 3 +- layout/generic/nsImageMap.cpp | 3 +- layout/html/base/src/nsAreaFrame.cpp | 5 +- layout/html/base/src/nsAreaFrame.h | 3 +- layout/html/base/src/nsBlockFrame.cpp | 6 +- layout/html/base/src/nsBlockFrame.h | 3 +- layout/html/base/src/nsFrame.cpp | 3 +- layout/html/base/src/nsFrame.h | 3 +- layout/html/base/src/nsImageFrame.cpp | 7 +- layout/html/base/src/nsImageFrame.h | 3 +- layout/html/base/src/nsImageMap.cpp | 3 +- layout/html/base/src/nsPresShell.cpp | 5 +- layout/html/document/src/nsFrameFrame.cpp | 6 +- layout/html/document/src/nsFrameSetFrame.cpp | 3 +- layout/html/forms/src/nsFileControlFrame.cpp | 5 +- layout/html/forms/src/nsFileControlFrame.h | 3 +- .../forms/src/nsGfxButtonControlFrame.cpp | 5 +- .../html/forms/src/nsGfxButtonControlFrame.h | 3 +- layout/html/forms/src/nsIsIndexFrame.cpp | 5 +- layout/html/forms/src/nsIsIndexFrame.h | 3 +- layout/html/forms/src/nsTextControlFrame.cpp | 26 +- layout/html/forms/src/nsTextControlFrame.h | 3 +- .../html/style/src/nsCSSFrameConstructor.cpp | 84 ++-- layout/html/style/src/nsCSSFrameConstructor.h | 3 +- layout/html/table/src/nsTableCellFrame.cpp | 3 +- layout/html/table/src/nsTableCellFrame.h | 3 +- .../base/src/nsMathMLContainerFrame.cpp | 3 +- .../mathml/base/src/nsMathMLContainerFrame.h | 3 +- layout/mathml/base/src/nsMathMLTokenFrame.cpp | 5 +- layout/mathml/base/src/nsMathMLTokenFrame.h | 3 +- .../mathml/base/src/nsMathMLmfencedFrame.cpp | 5 +- layout/mathml/base/src/nsMathMLmfencedFrame.h | 3 +- layout/mathml/base/src/nsMathMLmfracFrame.cpp | 5 +- layout/mathml/base/src/nsMathMLmfracFrame.h | 3 +- layout/mathml/base/src/nsMathMLmoFrame.cpp | 5 +- layout/mathml/base/src/nsMathMLmoFrame.h | 3 +- layout/mathml/base/src/nsMathMLmoverFrame.cpp | 5 +- layout/mathml/base/src/nsMathMLmoverFrame.h | 3 +- .../mathml/base/src/nsMathMLmstyleFrame.cpp | 3 +- layout/mathml/base/src/nsMathMLmstyleFrame.h | 3 +- .../mathml/base/src/nsMathMLmunderFrame.cpp | 5 +- layout/mathml/base/src/nsMathMLmunderFrame.h | 3 +- .../base/src/nsMathMLmunderoverFrame.cpp | 5 +- .../mathml/base/src/nsMathMLmunderoverFrame.h | 3 +- layout/style/nsHTMLStyleSheet.cpp | 7 +- layout/style/nsStyleSet.cpp | 9 +- layout/style/nsStyleStruct.cpp | 14 +- .../base/src/nsSVGGenericContainerFrame.cpp | 13 +- layout/svg/base/src/nsSVGGraphicFrame.cpp | 308 -------------- layout/svg/base/src/nsSVGGraphicFrame.h | 124 ------ layout/svg/base/src/nsSVGOuterSVGFrame.cpp | 13 +- layout/tables/nsTableCellFrame.cpp | 3 +- layout/tables/nsTableCellFrame.h | 3 +- layout/xul/base/src/nsBoxFrame.cpp | 21 +- layout/xul/base/src/nsBoxFrame.h | 3 +- layout/xul/base/src/nsDeckFrame.cpp | 5 +- layout/xul/base/src/nsDeckFrame.h | 3 +- layout/xul/base/src/nsImageBoxFrame.cpp | 5 +- layout/xul/base/src/nsImageBoxFrame.h | 3 +- layout/xul/base/src/nsLeafBoxFrame.cpp | 18 +- layout/xul/base/src/nsLeafBoxFrame.h | 3 +- layout/xul/base/src/nsListBoxBodyFrame.cpp | 10 +- layout/xul/base/src/nsListBoxBodyFrame.h | 3 +- layout/xul/base/src/nsMenuFrame.cpp | 3 +- layout/xul/base/src/nsMenuFrame.h | 3 +- layout/xul/base/src/nsMenuPopupFrame.cpp | 6 +- layout/xul/base/src/nsMenuPopupFrame.h | 3 +- .../xul/base/src/nsNativeScrollbarFrame.cpp | 11 +- layout/xul/base/src/nsNativeScrollbarFrame.h | 4 +- layout/xul/base/src/nsProgressMeterFrame.cpp | 14 +- layout/xul/base/src/nsProgressMeterFrame.h | 3 +- layout/xul/base/src/nsResizerFrame.cpp | 6 +- layout/xul/base/src/nsResizerFrame.h | 3 +- layout/xul/base/src/nsScrollbarFrame.cpp | 12 +- layout/xul/base/src/nsScrollbarFrame.h | 3 +- layout/xul/base/src/nsSliderFrame.cpp | 13 +- layout/xul/base/src/nsSliderFrame.h | 3 +- layout/xul/base/src/nsSplitterFrame.cpp | 14 +- layout/xul/base/src/nsSplitterFrame.h | 3 +- layout/xul/base/src/nsTextBoxFrame.cpp | 3 +- layout/xul/base/src/nsTextBoxFrame.h | 3 +- .../xul/base/src/tree/src/nsTreeColFrame.cpp | 12 +- layout/xul/base/src/tree/src/nsTreeColFrame.h | 3 +- .../base/src/tree/src/nsTreeContentView.cpp | 3 +- widget/src/cocoa/nsIChangeManager.idl | 2 +- widget/src/cocoa/nsMenuBarX.cpp | 4 +- widget/src/cocoa/nsMenuItemX.cpp | 3 +- widget/src/cocoa/nsMenuX.cpp | 3 +- widget/src/mac/nsIChangeManager.idl | 2 +- widget/src/mac/nsMenu.cpp | 3 +- widget/src/mac/nsMenuBar.cpp | 4 +- widget/src/mac/nsMenuBarX.cpp | 4 +- widget/src/mac/nsMenuItem.cpp | 3 +- widget/src/mac/nsMenuItemX.cpp | 3 +- widget/src/mac/nsMenuX.cpp | 3 +- xpfe/appshell/src/nsWebShellWindow.cpp | 3 +- 185 files changed, 981 insertions(+), 2169 deletions(-) diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index c476782340a..743bfeb64af 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -400,8 +400,7 @@ public: NS_IMETHOD AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) = 0; + PRInt32 aModType) = 0; NS_IMETHOD ContentAppended(nsIContent* aContainer, PRInt32 aNewIndexInContainer) = 0; NS_IMETHOD ContentInserted(nsIContent* aContainer, diff --git a/content/base/public/nsIDocumentObserver.h b/content/base/public/nsIDocumentObserver.h index fcb29b9bd97..4028806afac 100644 --- a/content/base/public/nsIDocumentObserver.h +++ b/content/base/public/nsIDocumentObserver.h @@ -153,14 +153,12 @@ public: * @param aAttribute the atom name of the attribute * @param aModType Whether or not the attribute was added, changed, or removed. * The constants are defined in nsIDOMMutationEvent.h. - * @param aHint The style hint. */ NS_IMETHOD AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) = 0; + PRInt32 aModType) = 0; /** * Notifcation that the content model has had data appended to the @@ -362,8 +360,7 @@ public: nsIContent* aContent, \ PRInt32 aNameSpaceID, \ nsIAtom* aAttribute, \ - PRInt32 aModType, \ - nsChangeHint aHint); \ + PRInt32 aModType); \ NS_IMETHOD ContentAppended(nsIDocument* aDocument, \ nsIContent* aContainer, \ PRInt32 aNewIndexInContainer); \ @@ -466,8 +463,7 @@ _class::AttributeChanged(nsIDocument* aDocument, \ nsIContent* aContent, \ PRInt32 aNameSpaceID, \ nsIAtom* aAttribute, \ - PRInt32 aModType, \ - nsChangeHint aHint) \ + PRInt32 aModType) \ { \ return NS_OK; \ } \ diff --git a/content/base/public/nsIStyledContent.h b/content/base/public/nsIStyledContent.h index 8bdfee17a8e..3400f9ea37d 100644 --- a/content/base/public/nsIStyledContent.h +++ b/content/base/public/nsIStyledContent.h @@ -67,15 +67,22 @@ public: NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0; NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule) = 0; - /** NRA *** - * Get a hint that tells the style system what to do when - * an attribute on this node changes. - * This only applies to attributes that map their value - * DIRECTLY into style contexts via NON-CSS style rules - * All other attributes return NS_STYLE_HINT_CONTENT + /** + * Does the list of style rules walked by |WalkContentStyleRules| + * depend on the attribute? */ - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const = 0; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const = 0; + + + /** + * Get a hint that tells the style system what to do when + * an attribute on this node changes, if something needs to happen + * in response to the change *other* than the result of what is + * mapped into style data via any type of style rule. + */ + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const = 0; }; diff --git a/content/base/src/nsContentList.cpp b/content/base/src/nsContentList.cpp index 667e72c254b..40c381a9713 100644 --- a/content/base/src/nsContentList.cpp +++ b/content/base/src/nsContentList.cpp @@ -624,7 +624,7 @@ nsContentList::ContentChanged(nsIDocument* aDocument, nsIContent* aContent, NS_IMETHODIMP nsContentList::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, nsChangeHint aHint) + PRInt32 aModType) { return NS_OK; } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index d9cc90de3ca..20f593cffcb 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -2146,8 +2146,7 @@ nsDocument::AttributeWillChange(nsIContent* aChild, PRInt32 aNameSpaceID, NS_IMETHODIMP nsDocument::AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID, - nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint aHint) + nsIAtom* aAttribute, PRInt32 aModType) { NS_ABORT_IF_FALSE(aChild, "Null child!"); @@ -2158,7 +2157,7 @@ nsDocument::AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID, NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); nsresult rv2 = observer->AttributeChanged(this, aChild, aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); if (NS_FAILED(rv2) && NS_SUCCEEDED(rv)) rv = rv2; } diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 0ee991c0d77..e81ed968437 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -167,8 +167,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) { return NS_OK; } + PRInt32 aModType) { return NS_OK; } NS_IMETHOD ContentAppended(nsIDocument *aDocument, nsIContent* aContainer, PRInt32 aNewIndexInContainer) @@ -461,8 +460,7 @@ public: NS_IMETHOD AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); + PRInt32 aModType); NS_IMETHOD ContentAppended(nsIContent* aContainer, PRInt32 aNewIndexInContainer); NS_IMETHOD ContentInserted(nsIContent* aContainer, diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index ded2a460b27..e680513627b 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -2185,14 +2185,20 @@ nsGenericElement::GetInlineStyleRule(nsIStyleRule** aStyleRule) return NS_OK; } -NS_IMETHODIMP -nsGenericElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsGenericElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - aHint = NS_STYLE_HINT_CONTENT; // by default, never map attributes to style - return NS_OK; + return PR_FALSE; } +NS_IMETHODIMP +nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const +{ + aHint = nsChangeHint(0); + return NS_OK; +} NS_IMETHODIMP nsGenericElement::Compact() @@ -3590,8 +3596,7 @@ nsGenericContainerElement::SetAttr(nsINodeInfo* aNodeInfo, if (aNotify) { PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : PRInt32(nsIDOMMutationEvent::ADDITION); - mDocument->AttributeChanged(this, nameSpaceID, name, modHint, - NS_STYLE_HINT_UNKNOWN); + mDocument->AttributeChanged(this, nameSpaceID, name, modHint); mDocument->EndUpdate(); } } @@ -3745,8 +3750,8 @@ nsGenericContainerElement::UnsetAttr(PRInt32 aNameSpaceID, binding->AttributeChanged(aName, aNameSpaceID, PR_TRUE, aNotify); if (aNotify) { - mDocument->AttributeChanged(this, aNameSpaceID, aName, nsIDOMMutationEvent::REMOVAL, - NS_STYLE_HINT_UNKNOWN); + mDocument->AttributeChanged(this, aNameSpaceID, aName, + nsIDOMMutationEvent::REMOVAL); mDocument->EndUpdate(); } } diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 0141ca03a4d..d40a071e7f7 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -429,8 +429,11 @@ public: NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const; NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule); - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) + HasAttributeDependentStyle(const nsIAtom* aAttribute) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; // nsIXMLContent interface methods NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell); diff --git a/content/base/src/nsStyleSet.cpp b/content/base/src/nsStyleSet.cpp index 421f21c9920..8ea7c15d3c1 100644 --- a/content/base/src/nsStyleSet.cpp +++ b/content/base/src/nsStyleSet.cpp @@ -237,8 +237,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); // See nsStyleConsts fot hint values + PRInt32 aModType); // Notification that we were unable to render a replaced element. NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, @@ -1685,11 +1684,11 @@ StyleSetImpl::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { return mFrameConstructor->AttributeChanged(aPresContext, aContent, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); } NS_IMETHODIMP diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 2ad7e5e7e96..7b17b618d3e 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1726,10 +1726,7 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID, } // set as string value to avoid another string copy - nsChangeHint impact = NS_STYLE_HINT_NONE; - PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) - : PRInt32(nsIDOMMutationEvent::ADDITION); - GetMappedAttributeImpact(aAttribute, modHint, impact); + PRBool mapped = HasAttributeDependentStyle(aAttribute); nsCOMPtr sheet = dont_AddRef(GetAttrStyleSheet(mDocument)); @@ -1738,9 +1735,7 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID, result = NS_NewHTMLAttributes(&mAttributes); NS_ENSURE_SUCCESS(result, result); } - result = mAttributes->SetAttributeFor(aAttribute, aValue, - (impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural - | nsChangeHint_Content)) != 0, + result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped, this, sheet); } @@ -1785,8 +1780,7 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID, modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : PRInt32(nsIDOMMutationEvent::ADDITION); - mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, modHint, - NS_STYLE_HINT_UNKNOWN); + mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, modHint); mDocument->EndUpdate(); } } @@ -1880,8 +1874,7 @@ nsGenericHTMLElement::SetAttr(nsINodeInfo* aNodeInfo, PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : PRInt32(nsIDOMMutationEvent::ADDITION); - mDocument->AttributeChanged(this, namespaceID, localName, modHint, - NS_STYLE_HINT_UNKNOWN); + mDocument->AttributeChanged(this, namespaceID, localName, modHint); mDocument->EndUpdate(); } } @@ -1964,9 +1957,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, } } - nsChangeHint impact = NS_STYLE_HINT_NONE; - GetMappedAttributeImpact(aAttribute, nsIDOMMutationEvent::MODIFICATION, - impact); + PRBool mapped = HasAttributeDependentStyle(aAttribute); nsCOMPtr sheet; if (mDocument) { PRBool modification = PR_TRUE; @@ -1990,9 +1981,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, NS_ENSURE_SUCCESS(rv, rv); } PRInt32 count; - result = mAttributes->SetAttributeFor(aAttribute, aValue, - (impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural - | nsChangeHint_Content)) != 0, + result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped, this, sheet, count); if (0 == count) { delete mAttributes; @@ -2038,7 +2027,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, } if (aNotify) { - mDocument->AttributeChanged(this, kNameSpaceID_None, aAttribute, nsIDOMMutationEvent::MODIFICATION, impact); + mDocument->AttributeChanged(this, kNameSpaceID_None, aAttribute, nsIDOMMutationEvent::MODIFICATION); mDocument->EndUpdate(); } } @@ -2048,9 +2037,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, NS_ENSURE_SUCCESS(rv, rv); } PRInt32 count; - result = mAttributes->SetAttributeFor(aAttribute, aValue, - (impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural - | nsChangeHint_Content)) != 0, + result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped, this, sheet, count); if (0 == count) { delete mAttributes; @@ -2134,8 +2121,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, if (aNotify) { mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, - nsIDOMMutationEvent::REMOVAL, - NS_STYLE_HINT_UNKNOWN); + nsIDOMMutationEvent::REMOVAL); mDocument->EndUpdate(); } } @@ -2322,14 +2308,8 @@ nsresult nsGenericHTMLElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker) { nsresult result = NS_OK; - - if (aRuleWalker) { - if (mAttributes) { - result = mAttributes->WalkMappedAttributeStyleRules(aRuleWalker); - } - } - else { - result = NS_ERROR_NULL_POINTER; + if (mAttributes) { + result = mAttributes->WalkMappedAttributeStyleRules(aRuleWalker); } return result; } @@ -2600,18 +2580,14 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, return NS_CONTENT_ATTR_NOT_THERE; } -NS_IMETHODIMP -nsGenericHTMLElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsGenericHTMLElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap }; - FindAttributeImpact(aAttribute, aHint, - map, NS_ARRAY_LENGTH(map)); - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } /** @@ -3245,69 +3221,68 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAt -const nsGenericHTMLElement::AttributeImpactEntry +/* static */ const nsGenericHTMLElement::AttributeDependenceEntry nsGenericHTMLElement::sCommonAttributeMap[] = { - { &nsHTMLAtoms::dir, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::lang, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::_baseHref, NS_STYLE_HINT_VISUAL }, - { nsnull, NS_STYLE_HINT_NONE } + { &nsHTMLAtoms::dir }, + { &nsHTMLAtoms::lang }, + { nsnull } }; -const -nsGenericHTMLElement::AttributeImpactEntry -nsGenericHTMLElement::sImageAttributeMap[] = { - { &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::hspace, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::vspace, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } +/* static */ const nsGenericHTMLElement::AttributeDependenceEntry +nsGenericHTMLElement::sImageMarginSizeAttributeMap[] = { + { &nsHTMLAtoms::width }, + { &nsHTMLAtoms::height }, + { &nsHTMLAtoms::hspace }, + { &nsHTMLAtoms::vspace }, + { nsnull } }; -const nsGenericHTMLElement::AttributeImpactEntry +/* static */ const nsGenericHTMLElement::AttributeDependenceEntry nsGenericHTMLElement::sImageAlignAttributeMap[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, - { nsnull, NS_STYLE_HINT_NONE } + { &nsHTMLAtoms::align }, + { nsnull } }; -const nsGenericHTMLElement::AttributeImpactEntry +/* static */ const nsGenericHTMLElement::AttributeDependenceEntry +nsGenericHTMLElement::sDivAlignAttributeMap[] = { + { &nsHTMLAtoms::align }, + { nsnull } +}; + +/* static */ const nsGenericHTMLElement::AttributeDependenceEntry nsGenericHTMLElement::sImageBorderAttributeMap[] = { - { &nsHTMLAtoms::border, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + { &nsHTMLAtoms::border }, + { nsnull } }; - -const nsGenericHTMLElement::AttributeImpactEntry +/* static */ const nsGenericHTMLElement::AttributeDependenceEntry nsGenericHTMLElement::sBackgroundAttributeMap[] = { - { &nsHTMLAtoms::background, NS_STYLE_HINT_VISUAL }, - { &nsHTMLAtoms::bgcolor, NS_STYLE_HINT_VISUAL }, - { nsnull, NS_STYLE_HINT_NONE } + { &nsHTMLAtoms::background }, + { &nsHTMLAtoms::bgcolor }, + { nsnull } }; -void -nsGenericHTMLElement::FindAttributeImpact(const nsIAtom* aAttribute, - nsChangeHint& aHint, - const AttributeImpactEntry* const aMaps[], - PRUint32 aMapCount) +PRBool +nsGenericHTMLElement::FindAttributeDependence(const nsIAtom* aAttribute, + const AttributeDependenceEntry* const aMaps[], + PRUint32 aMapCount) { for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) { - const AttributeImpactEntry* map = aMaps[mapindex]; - while (map->attribute) { + for (const AttributeDependenceEntry* map = aMaps[mapindex]; + map->attribute; ++map) { if (aAttribute == *map->attribute) { - aHint = map->hint; - return; + return PR_TRUE; } - map++; } } - // fall-through - aHint = NS_STYLE_HINT_CONTENT; + return PR_FALSE; } void -nsGenericHTMLElement::MapAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, - nsRuleData* aRuleData) +nsGenericHTMLElement::MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsRuleData* aRuleData) { if (aRuleData->mSID == eStyleStruct_Display || aRuleData->mSID == eStyleStruct_TextReset) { nsHTMLValue value; @@ -3393,8 +3368,8 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsIHTMLMappedAttributes* } void -nsGenericHTMLElement::MapImagePositionAttributeInto(const nsIHTMLMappedAttributes* aAttributes, - nsRuleData* aData) +nsGenericHTMLElement::MapImageSizeAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsRuleData* aData) { if (!aAttributes || aData->mSID != eStyleStruct_Position || !aData->mPositionData) return; diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 38ac6080b59..a8073d68b5a 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -233,8 +233,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; #ifdef DEBUG @@ -493,32 +492,27 @@ public: */ static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aRuleData); - struct AttributeImpactEntry { + struct AttributeDependenceEntry { nsIAtom** attribute; - nsChangeHint hint; }; - static const AttributeImpactEntry sCommonAttributeMap[]; - static const AttributeImpactEntry sImageAttributeMap[]; - static const AttributeImpactEntry sImageBorderAttributeMap[]; - static const AttributeImpactEntry sImageAlignAttributeMap[]; - static const AttributeImpactEntry sBackgroundAttributeMap[]; + static const AttributeDependenceEntry sCommonAttributeMap[]; + static const AttributeDependenceEntry sImageMarginSizeAttributeMap[]; + static const AttributeDependenceEntry sImageBorderAttributeMap[]; + static const AttributeDependenceEntry sImageAlignAttributeMap[]; + static const AttributeDependenceEntry sDivAlignAttributeMap[]; + static const AttributeDependenceEntry sBackgroundAttributeMap[]; /** - * A common method where you can just pass in a list of maps to - * check for impact. Most implementations of GetMappedAttributeImpact - * should use this function as a default handler. - * - * @param aAttribute attribute that we care about - * @param aHint the resulting hint - * @param aImpactFlags the types of attributes that we care about - see the - * NS_*_ATTRIBUTE_IMPACT flags + * A common method where you can just pass in a list of maps to check + * for attribute dependence. Most implementations of + * HasAttributeDependentStyle should use this function as a default + * handler. */ - - static void - FindAttributeImpact(const nsIAtom* aAttribute, nsChangeHint& aHint, - const AttributeImpactEntry* const aMaps[], - PRUint32 aMapCount); + static PRBool + FindAttributeDependence(const nsIAtom* aAttribute, + const AttributeDependenceEntry* const aMaps[], + PRUint32 aMapCount); /** * Helper to map the align attribute into a style struct. * @@ -526,8 +520,8 @@ public: * @param aData the returned rule data [INOUT] * @see GetAttributeMappingFunction */ - static void MapAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, - nsRuleData* aData); + static void MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsRuleData* aData); /** * Helper to map the align attribute into a style struct for things @@ -565,8 +559,8 @@ public: * @param aData the returned rule data [INOUT] * @see GetAttributeMappingFunction */ - static void MapImagePositionAttributeInto(const nsIHTMLMappedAttributes* aAttributes, - nsRuleData* aData); + static void MapImageSizeAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsRuleData* aData); /** * Helper to map the background attributes (currently background and bgcolor) * into a style struct. diff --git a/content/html/content/src/nsHTMLAppletElement.cpp b/content/html/content/src/nsHTMLAppletElement.cpp index 6a1c5e98a4f..a40b95b55ea 100644 --- a/content/html/content/src/nsHTMLAppletElement.cpp +++ b/content/html/content/src/nsHTMLAppletElement.cpp @@ -83,8 +83,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; protected: PRBool mReflectedApplet; }; @@ -222,25 +221,22 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLAppletElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLAppletElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageAlignAttributeMap, sImageBorderAttributeMap }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLBRElement.cpp b/content/html/content/src/nsHTMLBRElement.cpp index 5c83eb6122e..5db86914a03 100644 --- a/content/html/content/src/nsHTMLBRElement.cpp +++ b/content/html/content/src/nsHTMLBRElement.cpp @@ -73,8 +73,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -211,22 +210,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLBRElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::clear, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::clear }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLBaseFontElement.cpp b/content/html/content/src/nsHTMLBaseFontElement.cpp index b8e68aed8bc..671bdbb32a6 100644 --- a/content/html/content/src/nsHTMLBaseFontElement.cpp +++ b/content/html/content/src/nsHTMLBaseFontElement.cpp @@ -65,9 +65,6 @@ public: // nsIDOMHTMLBaseElement NS_DECL_NSIDOMHTMLBASEFONTELEMENT - - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; }; nsresult @@ -202,25 +199,3 @@ nsHTMLBaseFontElement::SetSize(PRInt32 aSize) return SetHTMLAttribute(nsHTMLAtoms::size, value, PR_TRUE); } - -NS_IMETHODIMP -nsHTMLBaseFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const -{ - static const AttributeImpactEntry attributes[] = { - // XXX this seems a bit harsh, perhaps we need a reflow_all? - { &nsHTMLAtoms::color, NS_STYLE_HINT_RECONSTRUCT_ALL }, - { &nsHTMLAtoms::face, NS_STYLE_HINT_RECONSTRUCT_ALL }, - { &nsHTMLAtoms::size, NS_STYLE_HINT_RECONSTRUCT_ALL }, - { nsnull, NS_STYLE_HINT_NONE } - }; - - static const AttributeImpactEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; - - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; -} diff --git a/content/html/content/src/nsHTMLBodyElement.cpp b/content/html/content/src/nsHTMLBodyElement.cpp index c007dad11bc..645a11b90f9 100644 --- a/content/html/content/src/nsHTMLBodyElement.cpp +++ b/content/html/content/src/nsHTMLBodyElement.cpp @@ -121,8 +121,7 @@ public: PRBool aCompileEventHandlers); NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; protected: BodyRule* mContentStyleRule; @@ -627,27 +626,28 @@ nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker) return NS_OK; } -NS_IMETHODIMP -nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLBodyElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::link, NS_STYLE_HINT_VISUAL }, - { &nsHTMLAtoms::vlink, NS_STYLE_HINT_VISUAL }, - { &nsHTMLAtoms::alink, NS_STYLE_HINT_VISUAL }, - { &nsHTMLAtoms::text, NS_STYLE_HINT_VISUAL }, - { &nsHTMLAtoms::marginwidth, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::marginheight, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE }, + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::link }, + { &nsHTMLAtoms::vlink }, + { &nsHTMLAtoms::alink }, + { &nsHTMLAtoms::text }, + // These aren't mapped through attribute mapping, but they are + // mapped through a style rule, so it is attribute dependent style. + // XXXldb But we don't actually replace the body rule when we have + // dynamic changes... + { &nsHTMLAtoms::marginwidth }, + { &nsHTMLAtoms::marginheight }, + { nsnull }, }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, sBackgroundAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLDListElement.cpp b/content/html/content/src/nsHTMLDListElement.cpp index ac36829b7ed..ff39645033f 100644 --- a/content/html/content/src/nsHTMLDListElement.cpp +++ b/content/html/content/src/nsHTMLDListElement.cpp @@ -71,8 +71,7 @@ public: NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -174,23 +173,22 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLDListElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::compact, NS_STYLE_HINT_CONTENT }, // handled by ua.css? +#if 0 + static const AttributeDependenceEntry attributes[] = { + // { &nsHTMLAtoms::compact }, // handled by ua.css? { nsnull, NS_STYLE_HINT_NONE }, }; +#endif - static const AttributeImpactEntry* const map[] = { - attributes, + static const AttributeDependenceEntry* const map[] = { + // attributes, sCommonAttributeMap }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLDirectoryElement.cpp b/content/html/content/src/nsHTMLDirectoryElement.cpp index 6de494a9662..f68444fbb43 100644 --- a/content/html/content/src/nsHTMLDirectoryElement.cpp +++ b/content/html/content/src/nsHTMLDirectoryElement.cpp @@ -78,8 +78,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -218,24 +217,21 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLDirectoryElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLDirectoryElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::compact, NS_STYLE_HINT_CONTENT}, // XXX - { nsnull, NS_STYLE_HINT_NONE} + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::type }, + // { &nsHTMLAtoms::compact }, // XXX + { nsnull} }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLDivElement.cpp b/content/html/content/src/nsHTMLDivElement.cpp index 64c76657306..5a2c041cb9b 100644 --- a/content/html/content/src/nsHTMLDivElement.cpp +++ b/content/html/content/src/nsHTMLDivElement.cpp @@ -76,8 +76,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -216,23 +215,15 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLDivElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLDivElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } - }; - - static const AttributeImpactEntry* const map[] = { - attributes, + static const AttributeDependenceEntry* const map[] = { + sDivAlignAttributeMap, sCommonAttributeMap }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLFontElement.cpp b/content/html/content/src/nsHTMLFontElement.cpp index 41747c85759..586f0714d3c 100644 --- a/content/html/content/src/nsHTMLFontElement.cpp +++ b/content/html/content/src/nsHTMLFontElement.cpp @@ -77,8 +77,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -316,27 +315,24 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLFontElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::face, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::pointSize, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::size, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::fontWeight, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::color, NS_STYLE_HINT_VISUAL }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::face }, + { &nsHTMLAtoms::pointSize }, + { &nsHTMLAtoms::size }, + { &nsHTMLAtoms::fontWeight }, + { &nsHTMLAtoms::color }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLFrameSetElement.cpp b/content/html/content/src/nsHTMLFrameSetElement.cpp index 6c539858933..64d3394248e 100644 --- a/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -87,8 +87,9 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; private: nsresult ParseRowCol(const nsAString& aValue, PRInt32& aNumSpecs, @@ -107,7 +108,7 @@ private: PRInt32 mNumCols; /** * The style hint to return for the rows/cols attrs in - * GetMappedAttributeImpact + * GetAttributeChangeHint */ nsChangeHint mCurrentRowColHint; /** @@ -220,7 +221,7 @@ nsHTMLFrameSetElement::SetAttr(PRInt32 aNameSpaceID, * columns has changed. If it has, we need to reframe; otherwise * we want to reflow. So we set mCurrentRowColHint here, then call * nsGenericHTMLContainerElement::SetAttr, which will end up - * calling GetMappedAttributeImpact and notifying layout with that + * calling GetAttributeChangeHint and notifying layout with that * hint. Once nsGenericHTMLContainerElement::SetAttr returns, we * want to go back to our normal hint, which is * NS_STYLE_HINT_REFLOW. @@ -384,24 +385,18 @@ nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute, } NS_IMETHODIMP -nsHTMLFrameSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - // can't be static const because it uses mCurrentRowColHint - const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::rows, mCurrentRowColHint }, - { &nsHTMLAtoms::cols, mCurrentRowColHint }, - { nsnull, NS_STYLE_HINT_NONE }, - }; - - const AttributeImpactEntry* const map[] = { - attributes, - sCommonAttributeMap - }; - - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + nsresult rv = + nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::rows || + aAttribute == nsHTMLAtoms::cols) { + NS_UpdateHint(aHint, mCurrentRowColHint); + } + return rv; } nsresult diff --git a/content/html/content/src/nsHTMLHRElement.cpp b/content/html/content/src/nsHTMLHRElement.cpp index 2b1d96b7953..88befa9c390 100644 --- a/content/html/content/src/nsHTMLHRElement.cpp +++ b/content/html/content/src/nsHTMLHRElement.cpp @@ -73,8 +73,10 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -270,25 +272,35 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLHRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLHRElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::noshade, NS_STYLE_HINT_VISUAL }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::size, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE }, + nsresult rv = + nsGenericHTMLLeafElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::noshade) { + NS_UpdateHint(aHint, NS_STYLE_HINT_VISUAL); + } + return rv; +} + +NS_IMETHODIMP_(PRBool) +nsHTMLHRElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const +{ + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::align }, + { &nsHTMLAtoms::width }, + { &nsHTMLAtoms::size }, + { nsnull }, }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLHeadingElement.cpp b/content/html/content/src/nsHTMLHeadingElement.cpp index fd1348a0a37..c626d1e982a 100644 --- a/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/content/html/content/src/nsHTMLHeadingElement.cpp @@ -73,8 +73,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -198,24 +197,15 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLHeadingElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLHeadingElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE }, + static const AttributeDependenceEntry* const map[] = { + sDivAlignAttributeMap, + sCommonAttributeMap }; - static const AttributeImpactEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; - - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLIFrameElement.cpp b/content/html/content/src/nsHTMLIFrameElement.cpp index b5d457d92bd..ec660680455 100644 --- a/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/content/html/content/src/nsHTMLIFrameElement.cpp @@ -119,8 +119,7 @@ public: return nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, aNotify); } - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; protected: @@ -485,31 +484,27 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } } - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLIFrameElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::frameborder, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE }, + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::width }, + { &nsHTMLAtoms::height }, + { &nsHTMLAtoms::frameborder }, + { nsnull }, }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, + sImageAlignAttributeMap, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp index 67638d70e83..e91eaaf132e 100644 --- a/content/html/content/src/nsHTMLImageElement.cpp +++ b/content/html/content/src/nsHTMLImageElement.cpp @@ -122,9 +122,10 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, @@ -549,36 +550,39 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, { if (!aData || !aAttributes) return; - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } - NS_IMETHODIMP -nsHTMLImageElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::usemap, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::ismap, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, - { nsnull, NS_STYLE_HINT_NONE }, - }; + nsresult rv = + nsGenericHTMLLeafElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::usemap || + aAttribute == nsHTMLAtoms::ismap) { + NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE); + } + return rv; +} - static const AttributeImpactEntry* const map[] = { - attributes, +NS_IMETHODIMP_(PRBool) +nsHTMLImageElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const +{ + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap, - sImageAttributeMap, - sImageBorderAttributeMap + sImageMarginSizeAttributeMap, + sImageBorderAttributeMap, + sImageAlignAttributeMap }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 44db087fc03..a854da50c8e 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -181,8 +181,10 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, @@ -1955,9 +1957,9 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, value.GetIntValue() == NS_FORM_INPUT_IMAGE) { nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); // Images treat align as "float" - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); } else { // Everything else treats align as "text-align" nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData); @@ -1967,34 +1969,44 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLInputElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLInputElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - nsChangeHint valueHint = (mType == NS_FORM_INPUT_BUTTON || - mType == NS_FORM_INPUT_RESET || - mType == NS_FORM_INPUT_SUBMIT) ? - NS_STYLE_HINT_CONTENT : NS_STYLE_HINT_ATTRCHANGE; + nsresult rv = + nsGenericHTMLLeafFormElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::type) { + NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE); + } else if (aAttribute == nsHTMLAtoms::value) { + NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW); + } else if (aAttribute == nsHTMLAtoms::size && + (mType == NS_FORM_INPUT_TEXT || + mType == NS_FORM_INPUT_PASSWORD)) { + NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW); + } + return rv; +} - const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::value, valueHint }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::type, NS_STYLE_HINT_FRAMECHANGE }, - { nsnull, NS_STYLE_HINT_NONE }, +NS_IMETHODIMP_(PRBool) +nsHTMLInputElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const +{ + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::align }, + { &nsHTMLAtoms::type }, + { nsnull }, }; - const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageBorderAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } - NS_IMETHODIMP nsHTMLInputElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const { diff --git a/content/html/content/src/nsHTMLLIElement.cpp b/content/html/content/src/nsHTMLLIElement.cpp index 6dfc10170ad..6b699ca6813 100644 --- a/content/html/content/src/nsHTMLLIElement.cpp +++ b/content/html/content/src/nsHTMLLIElement.cpp @@ -73,8 +73,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -236,23 +235,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLLIElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLLIElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE }, + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::type }, + { nsnull }, }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLMapElement.cpp b/content/html/content/src/nsHTMLMapElement.cpp index d72acb3e0e3..487717275f1 100644 --- a/content/html/content/src/nsHTMLMapElement.cpp +++ b/content/html/content/src/nsHTMLMapElement.cpp @@ -70,8 +70,9 @@ public: // nsIDOMHTMLMapElement NS_DECL_NSIDOMHTMLMAPELEMENT - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers); @@ -212,20 +213,15 @@ NS_IMPL_STRING_ATTR(nsHTMLMapElement, Name, name) NS_IMETHODIMP -nsHTMLMapElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLMapElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::name, NS_STYLE_HINT_RECONSTRUCT_ALL }, - { nsnull, NS_STYLE_HINT_NONE } - }; - - static const AttributeImpactEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; - - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + nsresult rv = + nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::name) { + NS_UpdateHint(aHint, NS_STYLE_HINT_RECONSTRUCT_ALL); + } + return rv; } diff --git a/content/html/content/src/nsHTMLMenuElement.cpp b/content/html/content/src/nsHTMLMenuElement.cpp index d4060363a67..5793f2c7d4a 100644 --- a/content/html/content/src/nsHTMLMenuElement.cpp +++ b/content/html/content/src/nsHTMLMenuElement.cpp @@ -80,8 +80,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -218,23 +217,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLMenuElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLMenuElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::type }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLOListElement.cpp b/content/html/content/src/nsHTMLOListElement.cpp index 28b6d1957dd..64840bb5bd3 100644 --- a/content/html/content/src/nsHTMLOListElement.cpp +++ b/content/html/content/src/nsHTMLOListElement.cpp @@ -74,8 +74,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -254,23 +253,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLOListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLOListElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::type }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index 61cab351e7f..b05ad7c113d 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -86,8 +86,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -288,27 +287,24 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, if (!aData) return; - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLObjectElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageBorderAttributeMap, sImageAlignAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLOptionElement.cpp b/content/html/content/src/nsHTMLOptionElement.cpp index b17c12665a1..3965ea38839 100644 --- a/content/html/content/src/nsHTMLOptionElement.cpp +++ b/content/html/content/src/nsHTMLOptionElement.cpp @@ -109,9 +109,9 @@ public: NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; // nsIOptionElement NS_IMETHOD SetSelectedInternal(PRBool aValue, PRBool aNotify); @@ -491,35 +491,19 @@ nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute, } NS_IMETHODIMP -nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLOptionElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - nsIFormControlFrame* fcFrame = GetSelectFrame(); - - if (fcFrame) { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::label, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::text, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } - }; + nsresult rv = + nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); - static const AttributeImpactEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; - - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - } else { - // XXX don't we want to try common attributes here? - if (aAttribute == nsXULAtoms::menuactive) { - aHint = NS_STYLE_HINT_CONTENT; - } else { - aHint = NS_STYLE_HINT_NONE; - } + if (aAttribute == nsHTMLAtoms::label || + aAttribute == nsHTMLAtoms::text) { + NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW); } - - return NS_OK; + return rv; } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLParagraphElement.cpp b/content/html/content/src/nsHTMLParagraphElement.cpp index 89aa8056e87..a76d279725a 100644 --- a/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/content/html/content/src/nsHTMLParagraphElement.cpp @@ -76,8 +76,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -200,23 +199,15 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLParagraphElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLParagraphElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } - }; - - static const AttributeImpactEntry* const map[] = { - attributes, + static const AttributeDependenceEntry* const map[] = { + sDivAlignAttributeMap, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLPreElement.cpp b/content/html/content/src/nsHTMLPreElement.cpp index d34d82bfb3f..d0500ca7fac 100644 --- a/content/html/content/src/nsHTMLPreElement.cpp +++ b/content/html/content/src/nsHTMLPreElement.cpp @@ -75,8 +75,10 @@ public: NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsHTMLValue& aResult); - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -252,30 +254,38 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLPreElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLPreElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::variable, NS_STYLE_HINT_REFLOW}, - { &nsHTMLAtoms::wrap, NS_STYLE_HINT_REFLOW}, - { &nsHTMLAtoms::cols, NS_STYLE_HINT_REFLOW}, - { &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW}, - { &nsHTMLAtoms::tabstop, NS_STYLE_HINT_REFLOW}, - { nsnull, NS_STYLE_HINT_NONE }, + nsresult rv = + nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::tabstop) { + NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW); + } + return rv; +} + +NS_IMETHODIMP_(PRBool) +nsHTMLPreElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const +{ + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::variable }, + { &nsHTMLAtoms::wrap }, + { &nsHTMLAtoms::cols }, + { &nsHTMLAtoms::width }, + { nsnull }, }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } - - NS_IMETHODIMP nsHTMLPreElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const { diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index b670a53843b..bfb25abdb01 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -257,8 +257,10 @@ public: const nsAString& aValue, nsHTMLValue& aResult); NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; protected: @@ -1873,30 +1875,34 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, if (!aData || !aAttributes) return; - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } NS_IMETHODIMP -nsHTMLSelectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLSelectElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::multiple, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::size, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } - }; + nsresult rv = + nsGenericHTMLContainerFormElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::multiple || + aAttribute == nsHTMLAtoms::size) { + NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE); + } + return rv; +} - static const AttributeImpactEntry* const map[] = { - attributes, +NS_IMETHODIMP_(PRBool) +nsHTMLSelectElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const +{ + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap, + sImageAlignAttributeMap }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLSharedContainerElem.cpp b/content/html/content/src/nsHTMLSharedContainerElem.cpp index b1bea0839b6..a2ad24f84aa 100644 --- a/content/html/content/src/nsHTMLSharedContainerElem.cpp +++ b/content/html/content/src/nsHTMLSharedContainerElem.cpp @@ -95,9 +95,7 @@ public: NS_IMETHOD AttributeToString(nsIAtom* aAttribute, const nsHTMLValue& aValue, nsAString& aResult) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; }; @@ -324,29 +322,26 @@ nsHTMLSharedContainerElement::AttributeToString(nsIAtom* aAttribute, aResult); } -NS_IMETHODIMP -nsHTMLSharedContainerElement::GetMappedAttributeImpact(const nsIAtom* aAttr, - PRInt32 aModType, - PRInt32& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLSharedContainerElement::HasAttributeDependentStyle(const nsIAtom* aAttr) const { + if (nsGenericHTMLContainerElement::HasAttributeDependentStyle(aAttr)) { + return PR_TRUE; + } + if (mNodeInfo->Equals(nsHTMLAtoms::dir) || mNodeInfo->Equals(nsHTMLAtoms::menu) || mNodeInfo->Equals(nsHTMLAtoms::ol)) { if (aAttr == nsHTMLAtoms::type) { - aHint = NS_STYLE_HINT_REFLOW; - } else if (mNodeInfo->Equals(nsHTMLAtoms::dir) && - aAttr == nsHTMLAtoms::compact) { - aHint = NS_STYLE_HINT_CONTENT; // XXX + return PR_TRUE; } } else if (mNodeInfo->Equals(nsHTMLAtoms::caption)) { if (aAttr == nsHTMLAtoms::align) { - aHint = NS_STYLE_HINT_REFLOW; + return PR_TRUE; } } - return nsGenericHTMLContainerElement::GetMappedAttributeImpact(aAttr, - aModType, - aHint); + return PR_FALSE; } static void diff --git a/content/html/content/src/nsHTMLSharedElement.cpp b/content/html/content/src/nsHTMLSharedElement.cpp index b815ef1ff31..e5e2e741571 100644 --- a/content/html/content/src/nsHTMLSharedElement.cpp +++ b/content/html/content/src/nsHTMLSharedElement.cpp @@ -103,8 +103,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -301,7 +300,7 @@ SpacerMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, return; nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); if (aData->mPositionData) { nsHTMLValue value; @@ -390,8 +389,8 @@ EmbedMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } @@ -404,45 +403,40 @@ PlainMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } -NS_IMETHODIMP -nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLSharedLeafElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageAlignAttributeMap, sImageBorderAttributeMap }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::usemap, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::ismap, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + // XXXldb This is just wrong. + { &nsHTMLAtoms::usemap }, + { &nsHTMLAtoms::ismap }, + { &nsHTMLAtoms::align }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageBorderAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } - return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute, - aModType, aHint); + return nsGenericHTMLLeafElement::HasAttributeDependentStyle(aAttribute); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLSharedLeafElement.cpp b/content/html/content/src/nsHTMLSharedLeafElement.cpp index b815ef1ff31..e5e2e741571 100644 --- a/content/html/content/src/nsHTMLSharedLeafElement.cpp +++ b/content/html/content/src/nsHTMLSharedLeafElement.cpp @@ -103,8 +103,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -301,7 +300,7 @@ SpacerMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, return; nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); if (aData->mPositionData) { nsHTMLValue value; @@ -390,8 +389,8 @@ EmbedMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } @@ -404,45 +403,40 @@ PlainMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } -NS_IMETHODIMP -nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLSharedLeafElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageAlignAttributeMap, sImageBorderAttributeMap }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::usemap, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::ismap, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + // XXXldb This is just wrong. + { &nsHTMLAtoms::usemap }, + { &nsHTMLAtoms::ismap }, + { &nsHTMLAtoms::align }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageBorderAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } - return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute, - aModType, aHint); + return nsGenericHTMLLeafElement::HasAttributeDependentStyle(aAttribute); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp index 61cab351e7f..b05ad7c113d 100644 --- a/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -86,8 +86,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -288,27 +287,24 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, if (!aData) return; - nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLObjectElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { sCommonAttributeMap, - sImageAttributeMap, + sImageMarginSizeAttributeMap, sImageBorderAttributeMap, sImageAlignAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLTableCaptionElement.cpp b/content/html/content/src/nsHTMLTableCaptionElement.cpp index 2f46a31c518..8e31a0f38ce 100644 --- a/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -74,8 +74,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -213,23 +212,20 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLTableCaptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLTableCaptionElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::align }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLTableCellElement.cpp b/content/html/content/src/nsHTMLTableCellElement.cpp index 14728750e73..652a8ffb0c7 100644 --- a/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/content/html/content/src/nsHTMLTableCellElement.cpp @@ -84,8 +84,7 @@ public: nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; protected: // This does not return a nsresult since all we care about is if we @@ -247,6 +246,8 @@ nsHTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker) { // get table, add its rules too // XXX can we safely presume structure or do we need to QI on the way up? + // XXXldb This needs to handle the possibility (for XHTML) that + // there's no row-group. nsCOMPtr row; GetParent(getter_AddRefs(row)); @@ -510,32 +511,33 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLTableCellElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLTableCellElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::nowrap, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::abbr, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::axis, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::headers, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::scope, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::align }, + { &nsHTMLAtoms::valign }, + { &nsHTMLAtoms::nowrap }, +#if 0 + // XXXldb If these are implemented, they might need to move to + // GetAttributeChangeHint (depending on how, and preferably not). + { &nsHTMLAtoms::abbr }, + { &nsHTMLAtoms::axis }, + { &nsHTMLAtoms::headers }, + { &nsHTMLAtoms::scope }, +#endif + { &nsHTMLAtoms::width }, + { &nsHTMLAtoms::height }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, sBackgroundAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLTableColElement.cpp b/content/html/content/src/nsHTMLTableColElement.cpp index fd2a5f8b4aa..e7ec0386a72 100644 --- a/content/html/content/src/nsHTMLTableColElement.cpp +++ b/content/html/content/src/nsHTMLTableColElement.cpp @@ -83,8 +83,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -251,10 +250,9 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat if (!aAttributes || !aData) return; - nsHTMLValue value; - if (aData->mPositionData && aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) { // width + nsHTMLValue value; aAttributes->GetAttribute(nsHTMLAtoms::width, value); if (value.GetUnit() != eHTMLUnit_Null) { switch (value.GetUnit()) { @@ -306,8 +304,6 @@ void ColMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, if (!aAttributes || !aData) return; - nsHTMLValue value; - if (aData->mSID == eStyleStruct_Table && aData->mTableData && aData->mTableData->mSpan.GetUnit() == eCSSUnit_Null) { @@ -322,31 +318,38 @@ void ColMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, MapAttributesIntoRule(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLTableColElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLTableColElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - // we don't match "span" if we're a - nsIAtom** matchSpan = mNodeInfo->Equals(nsHTMLAtoms::col) ? - nsnull : &nsHTMLAtoms::span; - - const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW }, - { matchSpan, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::width }, + { &nsHTMLAtoms::align }, + { &nsHTMLAtoms::valign }, + { nsnull } }; - const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry span_attribute[] = { + { &nsHTMLAtoms::span } + }; + + static const AttributeDependenceEntry* const col_map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); + static const AttributeDependenceEntry* const colspan_map[] = { + attributes, + span_attribute, + sCommonAttributeMap, + }; - return NS_OK; + // we don't match "span" if we're a + // XXXldb Should this be reflected in the mapping function? + if (mNodeInfo->Equals(nsHTMLAtoms::col)) + return FindAttributeDependence(aAttribute, col_map, + NS_ARRAY_LENGTH(col_map)); + return FindAttributeDependence(aAttribute, colspan_map, + NS_ARRAY_LENGTH(colspan_map)); } diff --git a/content/html/content/src/nsHTMLTableElement.cpp b/content/html/content/src/nsHTMLTableElement.cpp index f7a23d23f5c..e130068ff68 100644 --- a/content/html/content/src/nsHTMLTableElement.cpp +++ b/content/html/content/src/nsHTMLTableElement.cpp @@ -90,8 +90,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; protected: GenericElementCollection *mTBodies; @@ -1231,6 +1230,16 @@ static void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aData) { + // XXX Bug 211636: This function is used by a single style rule + // that's used to match two different type of elements -- tables, and + // table cells. (nsHTMLTableCellElement overrides + // WalkContentStyleRules so that this happens.) This violates the + // nsIStyleRule contract, since it's the same style rule object doing + // the mapping in two different ways. It's also incorrect since it's + // testing the display type of the style context rather than checking + // which *element* it's matching (style rules should not stop matching + // when the display type is changed). + if (!aData) return; @@ -1492,41 +1501,38 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } } -NS_IMETHODIMP -nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLTableElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::layout, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::cellpadding, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::cellspacing, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::cols, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::border, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::frame, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::hspace, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::vspace, NS_STYLE_HINT_REFLOW }, + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::layout }, + { &nsHTMLAtoms::cellpadding }, + { &nsHTMLAtoms::cellspacing }, + { &nsHTMLAtoms::cols }, + { &nsHTMLAtoms::border }, + { &nsHTMLAtoms::frame }, + { &nsHTMLAtoms::width }, + { &nsHTMLAtoms::height }, + { &nsHTMLAtoms::hspace }, + { &nsHTMLAtoms::vspace }, - { &nsHTMLAtoms::bordercolor, NS_STYLE_HINT_VISUAL }, + { &nsHTMLAtoms::bordercolor }, // Changing to rules will force border-collapse. Unfortunately, if // border-collapse was already in effect, then a frame change is // not necessary. - { &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, - { &nsHTMLAtoms::rules, NS_STYLE_HINT_FRAMECHANGE }, - { nsnull, NS_STYLE_HINT_NONE } + { &nsHTMLAtoms::align }, + { &nsHTMLAtoms::rules }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, sBackgroundAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLTableRowElement.cpp b/content/html/content/src/nsHTMLTableRowElement.cpp index 65c29d33ee6..9046e7b3f08 100644 --- a/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/content/html/content/src/nsHTMLTableRowElement.cpp @@ -185,8 +185,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; protected: nsresult GetSection(nsIDOMHTMLTableSectionElement** aSection); @@ -641,26 +640,23 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLTableRowElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLTableRowElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::align }, + { &nsHTMLAtoms::valign }, + { &nsHTMLAtoms::height }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, sBackgroundAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLTableSectionElement.cpp b/content/html/content/src/nsHTMLTableSectionElement.cpp index 9496ad47053..1387a2e916b 100644 --- a/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -80,8 +80,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; protected: GenericElementCollection *mRows; @@ -395,25 +394,23 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLTableSectionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLTableSectionElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::align }, + { &nsHTMLAtoms::valign }, + { &nsHTMLAtoms::height }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, sBackgroundAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index da798bbf3ff..d83b7ed7f22 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -129,8 +129,10 @@ public: const nsAString& aValue, nsHTMLValue& aResult); NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsEventStatus* aEventStatus); @@ -631,27 +633,33 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, } NS_IMETHODIMP -nsHTMLTextAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsHTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { // XXX Bug 50280 - It is unclear why we need to do this here for // rows and cols and why the AttributeChanged method in // nsTextControlFrame does take care of the entire problem, but // it doesn't and this makes things better - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::rows, NS_STYLE_HINT_REFLOW }, - { &nsHTMLAtoms::cols, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } - }; + nsresult rv = + nsGenericHTMLContainerFormElement::GetAttributeChangeHint(aAttribute, + aModType, aHint); + if (aAttribute == nsHTMLAtoms::rows || + aAttribute == nsHTMLAtoms::cols) { + NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW); + } + return rv; +} - static const AttributeImpactEntry* const map[] = { - attributes, +NS_IMETHODIMP_(PRBool) +nsHTMLTextAreaElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const +{ + static const AttributeDependenceEntry* const map[] = { + sDivAlignAttributeMap, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } NS_IMETHODIMP diff --git a/content/html/content/src/nsHTMLUListElement.cpp b/content/html/content/src/nsHTMLUListElement.cpp index 220b6df0286..e88b4e30b56 100644 --- a/content/html/content/src/nsHTMLUListElement.cpp +++ b/content/html/content/src/nsHTMLUListElement.cpp @@ -77,8 +77,7 @@ public: const nsHTMLValue& aValue, nsAString& aResult) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; }; nsresult @@ -235,23 +234,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -NS_IMETHODIMP -nsHTMLUListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +NS_IMETHODIMP_(PRBool) +nsHTMLUListElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const { - static const AttributeImpactEntry attributes[] = { - { &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, - { nsnull, NS_STYLE_HINT_NONE } + static const AttributeDependenceEntry attributes[] = { + { &nsHTMLAtoms::type }, + { nsnull } }; - static const AttributeImpactEntry* const map[] = { + static const AttributeDependenceEntry* const map[] = { attributes, sCommonAttributeMap, }; - FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); - - return NS_OK; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } diff --git a/content/html/content/src/nsHTMLUnknownElement.cpp b/content/html/content/src/nsHTMLUnknownElement.cpp index 4b19781b0bc..a6cd400f16c 100644 --- a/content/html/content/src/nsHTMLUnknownElement.cpp +++ b/content/html/content/src/nsHTMLUnknownElement.cpp @@ -204,23 +204,20 @@ nsHTMLUnknownElement::SetAttribute(PRInt32 aNameSpaceID, } // set as string value to avoid another string copy - nsChangeHint impact = NS_STYLE_HINT_NONE; - GetMappedAttributeImpact(aAttribute, nsIDOMMutationEvent::MODIFICATION, impact); + PRBool mapped = HasAttributeDependentStyle(aAttribute); nsCOMPtr sheet(dont_AddRef(GetAttrStyleSheet(mDocument))); if (!mAttributes) { result = NS_NewHTMLAttributes(&mAttributes); NS_ENSURE_SUCCESS(result, result); } - result = mAttributes->SetAttributeFor(aAttribute, aValue, - (impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural - | nsChangeHint_Content)) != 0, + result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped, this, sheet); } if (aNotify && (mDocument)) { - result = mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, nsIDOMMutationEvent::MODIFICATION, - NS_STYLE_HINT_UNKNOWN); + result = mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, + nsIDOMMutationEvent::MODIFICATION); mDocument->EndUpdate(); } diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index f250119dd7e..20cd9b012fa 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1468,8 +1468,7 @@ nsHTMLDocument::AttributeWillChange(nsIContent* aContent, PRInt32 aNameSpaceID, NS_IMETHODIMP nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID, - nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint aHint) + nsIAtom* aAttribute, PRInt32 aModType) { NS_ABORT_IF_FALSE(aContent, "Null content!"); @@ -1503,7 +1502,7 @@ nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID, } return nsDocument::AttributeChanged(aContent, aNameSpaceID, aAttribute, - aModType, aHint); + aModType); } NS_IMETHODIMP diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index 521099f4fa8..05478a4aaa4 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -145,8 +145,7 @@ public: NS_IMETHOD AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); + PRInt32 aModType); NS_IMETHOD AttributeWillChange(nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute); diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index 96d93ff5ce9..a06dc25cf43 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -874,12 +874,7 @@ HTMLStyleSheetImpl::HasAttributeDependentStyle(AttributeRuleProcessorData* aData // Handle the content style rules. if (styledContent) { nsChangeHint hint = NS_STYLE_HINT_NONE; - styledContent->GetMappedAttributeImpact(aData->mAttribute, - aData->mModType, hint); - // This is the same test that nsGenericHTMLElement uses when calling - // nsHTMLAttributes::SetAttributeFor. - if ((hint & ~(nsChangeHint_AttrChange | nsChangeHint_Aural | - nsChangeHint_Content)) != 0) { + if (styledContent->HasAttributeDependentStyle(aData->mAttribute)) { *aResult = PR_TRUE; return NS_OK; } diff --git a/content/shared/public/nsChangeHint.h b/content/shared/public/nsChangeHint.h index b884d088340..653ed8a0356 100644 --- a/content/shared/public/nsChangeHint.h +++ b/content/shared/public/nsChangeHint.h @@ -42,17 +42,12 @@ // Defines for various style related constants enum nsChangeHint { - nsChangeHint_None = 0, // change has no impact - nsChangeHint_Unknown = 0x01, // change has unknown impact - nsChangeHint_AttrChange = 0x02, // change should cause notification to frame but nothing else - nsChangeHint_Aural = 0x04, // change was aural - nsChangeHint_Content = 0x08, // change was contentual (e.g., SRC=) - nsChangeHint_RepaintFrame = 0x10, // change was visual only (e.g., COLOR=) - nsChangeHint_ReflowFrame = 0x20, // change requires reflow (e.g., WIDTH=) - nsChangeHint_SyncFrameView = 0x40, // change requires view to be updated, if there is one (e.g., clip:) - nsChangeHint_ReconstructFrame = 0x80, // change requires frame change (e.g., display:) + nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=) + nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=) + nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:) + nsChangeHint_ReconstructFrame = 0x08, // change requires frame change (e.g., display:) // This subsumes all the above - nsChangeHint_ReconstructDoc = 0x100 + nsChangeHint_ReconstructDoc = 0x10 // change requires reconstruction of entire document (e.g., style sheet change) // This subsumes all the above @@ -99,25 +94,15 @@ inline PRBool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) { } // Redefine the old NS_STYLE_HINT constants in terms of the new hint structure -const nsChangeHint NS_STYLE_HINT_UNKNOWN = nsChangeHint_Unknown; -const nsChangeHint NS_STYLE_HINT_NONE = nsChangeHint_None; -const nsChangeHint NS_STYLE_HINT_ATTRCHANGE = nsChangeHint_AttrChange; -const nsChangeHint NS_STYLE_HINT_AURAL = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural); -const nsChangeHint NS_STYLE_HINT_CONTENT = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content); -const nsChangeHint NS_STYLE_HINT_VISUAL = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView); -const nsChangeHint NS_STYLE_HINT_REFLOW = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame); -const nsChangeHint NS_STYLE_HINT_FRAMECHANGE = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame); -const nsChangeHint NS_STYLE_HINT_RECONSTRUCT_ALL = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame - | nsChangeHint_ReconstructDoc); +#define NS_STYLE_HINT_NONE \ + nsChangeHint(0) +#define NS_STYLE_HINT_VISUAL \ + nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView) +#define NS_STYLE_HINT_REFLOW \ + nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame) +#define NS_STYLE_HINT_FRAMECHANGE \ + nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame) +#define NS_STYLE_HINT_RECONSTRUCT_ALL \ + nsChangeHint(NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_ReconstructDoc) #endif /* nsChangeHint_h___ */ diff --git a/content/shared/src/nsStyleStruct.cpp b/content/shared/src/nsStyleStruct.cpp index aa08a31e3bb..e09f96bd58e 100644 --- a/content/shared/src/nsStyleStruct.cpp +++ b/content/shared/src/nsStyleStruct.cpp @@ -1083,7 +1083,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource) nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const { - nsChangeHint hint = nsChangeHint_None; + nsChangeHint hint = nsChangeHint(0); if (mBinding != aOther.mBinding || mPosition != aOther.mPosition @@ -1395,10 +1395,8 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO if (mUserInput == aOther.mUserInput) { if (mUserModify == aOther.mUserModify) { - if (mUserFocus == aOther.mUserFocus) { - return NS_STYLE_HINT_NONE; - } - return NS_STYLE_HINT_CONTENT; + // ignore mUserFocus + return NS_STYLE_HINT_NONE; } return NS_STYLE_HINT_VISUAL; } @@ -1441,10 +1439,8 @@ nsChangeHint nsStyleUIReset::CalcDifference(const nsStyleUIReset& aOther) const if (mForceBrokenImageIcon == aOther.mForceBrokenImageIcon) { if (mResizer == aOther.mResizer && mUserSelect == aOther.mUserSelect) { - if (mKeyEquivalent == aOther.mKeyEquivalent) { - return NS_STYLE_HINT_NONE; - } - return NS_STYLE_HINT_CONTENT; + // ignore mKeyEquivalent + return NS_STYLE_HINT_NONE; } return NS_STYLE_HINT_VISUAL; } diff --git a/content/svg/content/src/nsSVGAttributes.cpp b/content/svg/content/src/nsSVGAttributes.cpp index a9602e63234..0684c7960ac 100644 --- a/content/svg/content/src/nsSVGAttributes.cpp +++ b/content/svg/content/src/nsSVGAttributes.cpp @@ -670,7 +670,7 @@ nsSVGAttributes::SetAttr(nsINodeInfo* aNodeInfo, PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : PRInt32(nsIDOMMutationEvent::ADDITION); document->AttributeChanged(mContent, nameSpaceID, name, - modHint, NS_STYLE_HINT_UNKNOWN); + modHint); document->EndUpdate(); } } @@ -746,8 +746,7 @@ nsSVGAttributes::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, if (aNotify) { document->AttributeChanged(mContent, aNameSpaceID, aName, - nsIDOMMutationEvent::REMOVAL, - NS_STYLE_HINT_UNKNOWN); + nsIDOMMutationEvent::REMOVAL); document->EndUpdate(); } } diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index 18e0ce931e0..9dbbf105207 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -1415,8 +1415,7 @@ nsBindingManager::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { return NS_OK; } diff --git a/content/xml/document/src/nsXMLPrettyPrinter.cpp b/content/xml/document/src/nsXMLPrettyPrinter.cpp index fb834079af1..2ac675fcae8 100644 --- a/content/xml/document/src/nsXMLPrettyPrinter.cpp +++ b/content/xml/document/src/nsXMLPrettyPrinter.cpp @@ -266,8 +266,7 @@ nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { MaybeUnhook(aContent); return NS_OK; diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 03993412a21..cc4be4c203f 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -405,22 +405,6 @@ static PRBool HasMutationListeners(nsIContent* aContent, PRUint32 aType) return PR_FALSE; } -//---------------------------------------------------------------------- - -static nsChangeHint -StyleHintFor(nsINodeInfo* aNodeInfo) -{ - nsCOMPtr tagName = aNodeInfo->GetNameAtom(); - if ((tagName == nsXULAtoms::broadcaster) || - (tagName == nsXULAtoms::command) || - (tagName == nsXULAtoms::key)) { - return NS_STYLE_HINT_NONE; - } - - return NS_STYLE_HINT_UNKNOWN; -} - - //---------------------------------------------------------------------- nsrefcnt nsXULElement::gRefCnt; @@ -2524,8 +2508,7 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo, ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : PRInt32(nsIDOMMutationEvent::ADDITION); - mDocument->AttributeChanged(this, attrns, attrName, modHint, - StyleHintFor(NodeInfo())); + mDocument->AttributeChanged(this, attrns, attrName, modHint); mDocument->EndUpdate(); } } @@ -2802,8 +2785,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, if (aNotify) { mDocument->AttributeChanged(this, aNameSpaceID, aName, - nsIDOMMutationEvent::REMOVAL, - StyleHintFor(NodeInfo())); + nsIDOMMutationEvent::REMOVAL); // XXXwaterson do we need to mDocument->EndUpdate() here? } @@ -3645,10 +3627,11 @@ nsXULElement::GetInlineStyleRule(nsIStyleRule** aStyleRule) } NS_IMETHODIMP -nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const +nsXULElement::GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const { - aHint = NS_STYLE_HINT_CONTENT; // by default, never map attributes to style + aHint = NS_STYLE_HINT_NONE; if (aAttribute == nsXULAtoms::value && (aModType == nsIDOMMutationEvent::REMOVAL || aModType == nsIDOMMutationEvent::ADDITION)) { @@ -3659,23 +3642,6 @@ nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModTy // XUL text frame. If the value attribute is being added or removed, then we need to return // a hint of frame change. (See bugzilla bug 95475 for details.) aHint = NS_STYLE_HINT_FRAMECHANGE; - else - aHint = NS_STYLE_HINT_ATTRCHANGE; - } - else if (aAttribute == nsXULAtoms::value || aAttribute == nsXULAtoms::flex || - aAttribute == nsXULAtoms::label || aAttribute == nsXULAtoms::mousethrough) { - // VERY IMPORTANT! This has a huge positive performance impact! - aHint = NS_STYLE_HINT_ATTRCHANGE; - } - else if (NodeInfo()->Equals(nsXULAtoms::window) || - NodeInfo()->Equals(nsXULAtoms::page) || - NodeInfo()->Equals(nsXULAtoms::dialog) || - NodeInfo()->Equals(nsXULAtoms::wizard)) { - // Ignore 'width', 'height', 'screenX', 'screenY' and 'sizemode' on a - if (nsXULAtoms::width == aAttribute || nsXULAtoms::height == aAttribute || - nsXULAtoms::screenX == aAttribute || nsXULAtoms::screenY == aAttribute || - nsXULAtoms::sizemode == aAttribute) - aHint = NS_STYLE_HINT_NONE; } else { // if left or top changes we reflow. This will happen in xul containers that // manage positioned children such as a bulletinboard. @@ -3686,6 +3652,12 @@ nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModTy return NS_OK; } +NS_IMETHODIMP_(PRBool) +nsXULElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const +{ + return PR_FALSE; +} + // Controllers Methods NS_IMETHODIMP nsXULElement::GetControllers(nsIControllers** aResult) diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index fbf2ccf1bbc..c3fc83c69de 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -472,9 +472,10 @@ public: NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule); - NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint& aHint) const; - + NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute, + PRInt32 aModType, + nsChangeHint& aHint) const; + NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const; // nsIXULContent NS_IMETHOD PeekChildCount(PRInt32& aCount) const; diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 89f3ca05b1b..940444c0c65 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -1092,8 +1092,7 @@ nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster, NS_IMETHODIMP nsXULDocument::AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, - nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint aHint) + nsIAtom* aAttribute, PRInt32 aModType) { nsresult rv; @@ -1152,7 +1151,7 @@ nsXULDocument::AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, - aModType, aHint); + aModType); } // See if there is anything we need to persist in the localstore. diff --git a/content/xul/document/src/nsXULDocument.h b/content/xul/document/src/nsXULDocument.h index 4a8b8050900..f9a5c952649 100644 --- a/content/xul/document/src/nsXULDocument.h +++ b/content/xul/document/src/nsXULDocument.h @@ -128,8 +128,7 @@ public: PRInt32 aIndexInContainer); NS_IMETHOD AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, - nsIAtom* aAttribute, PRInt32 aModType, - nsChangeHint aHint); + nsIAtom* aAttribute, PRInt32 aModType); NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, diff --git a/content/xul/templates/src/nsXULContentBuilder.cpp b/content/xul/templates/src/nsXULContentBuilder.cpp index 725c11cad60..0dd8eb49a0c 100644 --- a/content/xul/templates/src/nsXULContentBuilder.cpp +++ b/content/xul/templates/src/nsXULContentBuilder.cpp @@ -137,8 +137,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); + PRInt32 aModType); NS_IMETHOD DocumentWillBeDestroyed(nsIDocument* aDocument); @@ -1692,8 +1691,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { // Handle "open" and "close" cases. We do this handling before // we've notified the observer, so that content is already created @@ -1713,7 +1711,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument, } // Pass along to the generic template builder. - return nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID, aAttribute, aModType, aHint); + return nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID, aAttribute, aModType); } NS_IMETHODIMP diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index 76bf01c7ee2..8191d56d0e7 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -313,8 +313,7 @@ nsXULTemplateBuilder::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { // Check for a change to the 'ref' attribute on an atom, in which // case we may need to nuke and rebuild the entire content model diff --git a/extensions/inspector/base/src/inDOMView.cpp b/extensions/inspector/base/src/inDOMView.cpp index 2802ba1dd89..d7c56ce2397 100644 --- a/extensions/inspector/base/src/inDOMView.cpp +++ b/extensions/inspector/base/src/inDOMView.cpp @@ -638,7 +638,7 @@ NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(inDOMView) NS_IMETHODIMP inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, - nsIAtom* aAttribute, PRInt32 aModType, nsChangeHint aHint) + nsIAtom* aAttribute, PRInt32 aModType) { if (!mTree) { return NS_ERROR_FAILURE; diff --git a/extensions/transformiix/source/xpath/nsXPathResult.cpp b/extensions/transformiix/source/xpath/nsXPathResult.cpp index 77a84e5413c..f0a599aac30 100644 --- a/extensions/transformiix/source/xpath/nsXPathResult.cpp +++ b/extensions/transformiix/source/xpath/nsXPathResult.cpp @@ -216,8 +216,7 @@ nsXPathResult::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { Invalidate(); return NS_OK; diff --git a/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp b/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp index c2c5e4be3eb..bbc7817a228 100644 --- a/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp +++ b/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp @@ -865,8 +865,7 @@ txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { mStylesheet = nsnull; return NS_OK; diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 6f71429ec10..8778b104601 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -10229,8 +10229,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { nsresult result = NS_OK; @@ -10242,17 +10241,6 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, // Get the frame associated with the content which is the highest in the frame tree nsIFrame* primaryFrame; shell->GetPrimaryFrameFor(aContent, &primaryFrame); - // Get the frame associated with the content whose style context is highest in the style context tree - nsIFrame* primaryStyleFrame = primaryFrame; - if (primaryFrame) { - PRBool providerIsChild = PR_FALSE; - nsIFrame *styleContextProvider; - primaryFrame->GetParentStyleContextFrame(aPresContext, - &styleContextProvider, - &providerIsChild); - if (providerIsChild) - primaryStyleFrame = styleContextProvider; - } #if 0 NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, @@ -10261,17 +10249,15 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, #endif // the style tag has its own interpretation based on aHint - if (aHint & nsChangeHint_Unknown) { - nsCOMPtr styledContent = do_QueryInterface(aContent); - if (styledContent) { - // Get style hint from HTML content object. - styledContent->GetMappedAttributeImpact(aAttribute, aModType, aHint); - } - } + nsChangeHint hint = NS_STYLE_HINT_NONE; + nsCOMPtr styledContent = do_QueryInterface(aContent); + if (styledContent) { + // Get style hint from HTML content object. + styledContent->GetAttributeChangeHint(aAttribute, aModType, hint); + } - PRBool reconstruct = (aHint & nsChangeHint_ReconstructDoc) != 0; - PRBool reframe = (aHint & (nsChangeHint_ReconstructDoc | nsChangeHint_ReconstructFrame)) != 0; - PRBool restyle = (aHint & ~(nsChangeHint_AttrChange)) != 0; + PRBool reconstruct = (hint & nsChangeHint_ReconstructDoc) != 0; + PRBool reframe = (hint & (nsChangeHint_ReconstructDoc | nsChangeHint_ReconstructFrame)) != 0; #ifdef MOZ_XUL // The following listbox widget trap prevents offscreen listbox widget @@ -10323,23 +10309,17 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, } // apply changes - if (primaryFrame && (aHint & nsChangeHint_AttrChange) && !(aHint & ~(nsChangeHint_AttrChange))) { - result = primaryFrame->AttributeChanged(aPresContext, aContent, aNameSpaceID, aAttribute, aModType, aHint); - } - else if (reconstruct) { + if (reconstruct) { result = ReconstructDocElementHierarchy(aPresContext); } else if (reframe) { result = RecreateFramesForContent(aPresContext, aContent); } - else if (restyle) { - // If there is no frame then there is no point in re-styling it, - // is there? + else { if (primaryFrame) { - nsChangeHint maxHint = aHint; nsStyleChangeList changeList; // put primary frame on list to deal with, re-resolve may update or add next in flows - changeList.AppendChange(primaryFrame, aContent, maxHint); + changeList.AppendChange(primaryFrame, aContent, hint); nsCOMPtr frameManager; shell->GetFrameManager(getter_AddRefs(frameManager)); @@ -10347,42 +10327,34 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, frameManager->HasAttributeDependentStyle(aContent, aAttribute, aModType, &affects); if (affects) { -#ifdef DEBUG_shaver - fputc('+', stderr); -#endif // there is an effect, so compute it frameManager->ComputeStyleChangeFor(primaryFrame, aNameSpaceID, aAttribute, - changeList, aHint, maxHint); - } else { -#ifdef DEBUG_shaver - fputc('-', stderr); -#endif - // let this frame update itself, but don't walk the whole frame tree - maxHint = NS_STYLE_HINT_VISUAL; + changeList, hint, hint); } - // maxHint is hint for primary only - if (maxHint & nsChangeHint_ReconstructDoc) { + // hint is for primary only + if (hint & nsChangeHint_ReconstructDoc) { result = ReconstructDocElementHierarchy(aPresContext); changeList.Clear(); - } else if (maxHint & nsChangeHint_ReconstructFrame) { + } else if (hint & nsChangeHint_ReconstructFrame) { result = RecreateFramesForContent(aPresContext, aContent); changeList.Clear(); - } else if (maxHint & ~(nsChangeHint_AttrChange | nsChangeHint_Aural)) { - // let the frame deal with it, since we don't know how to - result = primaryFrame->AttributeChanged(aPresContext, aContent, aNameSpaceID, aAttribute, aModType, maxHint); + } else { + // let the frame deal with it, since we don't know how to + result = primaryFrame->AttributeChanged(aPresContext, aContent, + aNameSpaceID, aAttribute, + aModType); + // XXXwaterson should probably check for special IB siblings + // here, and propagate the AttributeChanged notification to + // them, as well. Currently, inline frames don't do anything on + // this notification, so it's not that big a deal. - // XXXwaterson should probably check for special IB siblings - // here, and propagate the AttributeChanged notification to - // them, as well. Currently, inline and block frames don't - // do anything on this notification, so it's not that big a - // deal. + // handle any children (primary may be on list too) + ProcessRestyledFrames(changeList, aPresContext); } - // handle any children (primary may be on list too) - ProcessRestyledFrames(changeList, aPresContext); } - else { // no frame now, possibly genetate one with new style data + else { result = MaybeRecreateFramesForContent(aPresContext, aContent); } } diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 2e27c190cac..7b83f029469 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -138,8 +138,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); + PRInt32 aModType); NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray, nsIPresContext* aPresContext); diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h index b884d088340..653ed8a0356 100644 --- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -42,17 +42,12 @@ // Defines for various style related constants enum nsChangeHint { - nsChangeHint_None = 0, // change has no impact - nsChangeHint_Unknown = 0x01, // change has unknown impact - nsChangeHint_AttrChange = 0x02, // change should cause notification to frame but nothing else - nsChangeHint_Aural = 0x04, // change was aural - nsChangeHint_Content = 0x08, // change was contentual (e.g., SRC=) - nsChangeHint_RepaintFrame = 0x10, // change was visual only (e.g., COLOR=) - nsChangeHint_ReflowFrame = 0x20, // change requires reflow (e.g., WIDTH=) - nsChangeHint_SyncFrameView = 0x40, // change requires view to be updated, if there is one (e.g., clip:) - nsChangeHint_ReconstructFrame = 0x80, // change requires frame change (e.g., display:) + nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=) + nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=) + nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:) + nsChangeHint_ReconstructFrame = 0x08, // change requires frame change (e.g., display:) // This subsumes all the above - nsChangeHint_ReconstructDoc = 0x100 + nsChangeHint_ReconstructDoc = 0x10 // change requires reconstruction of entire document (e.g., style sheet change) // This subsumes all the above @@ -99,25 +94,15 @@ inline PRBool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) { } // Redefine the old NS_STYLE_HINT constants in terms of the new hint structure -const nsChangeHint NS_STYLE_HINT_UNKNOWN = nsChangeHint_Unknown; -const nsChangeHint NS_STYLE_HINT_NONE = nsChangeHint_None; -const nsChangeHint NS_STYLE_HINT_ATTRCHANGE = nsChangeHint_AttrChange; -const nsChangeHint NS_STYLE_HINT_AURAL = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural); -const nsChangeHint NS_STYLE_HINT_CONTENT = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content); -const nsChangeHint NS_STYLE_HINT_VISUAL = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView); -const nsChangeHint NS_STYLE_HINT_REFLOW = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame); -const nsChangeHint NS_STYLE_HINT_FRAMECHANGE = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame); -const nsChangeHint NS_STYLE_HINT_RECONSTRUCT_ALL = (nsChangeHint) - (nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame - | nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame - | nsChangeHint_ReconstructDoc); +#define NS_STYLE_HINT_NONE \ + nsChangeHint(0) +#define NS_STYLE_HINT_VISUAL \ + nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView) +#define NS_STYLE_HINT_REFLOW \ + nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame) +#define NS_STYLE_HINT_FRAMECHANGE \ + nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame) +#define NS_STYLE_HINT_RECONSTRUCT_ALL \ + nsChangeHint(NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_ReconstructDoc) #endif /* nsChangeHint_h___ */ diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 16a81f3f05f..d2bfa7a4ac2 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5294,8 +5294,7 @@ PresShell::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { nsresult rv = NS_OK; // XXXwaterson it might be more elegant to wait until after the @@ -5303,7 +5302,7 @@ PresShell::AttributeChanged(nsIDocument *aDocument, // squelch any other inappropriate notifications as well. if (mDidInitialReflow) { WillCauseReflow(); - rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType, aHint); + rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType); VERIFY_STYLE_TREE; DidCauseReflow(); } diff --git a/layout/base/public/nsIFrame.h b/layout/base/public/nsIFrame.h index 3ab884f2122..9ebe166d28a 100644 --- a/layout/base/public/nsIFrame.h +++ b/layout/base/public/nsIFrame.h @@ -823,8 +823,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) = 0; + PRInt32 aModType) = 0; /** * Return how your frame can be split. diff --git a/layout/base/public/nsIStyleFrameConstruction.h b/layout/base/public/nsIStyleFrameConstruction.h index bdc1c84e3c9..7104df3b9b3 100644 --- a/layout/base/public/nsIStyleFrameConstruction.h +++ b/layout/base/public/nsIStyleFrameConstruction.h @@ -229,8 +229,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) = 0; + PRInt32 aModType) = 0; /** diff --git a/layout/base/public/nsIStyleSet.h b/layout/base/public/nsIStyleSet.h index a98a4dc9252..e69de29bb2d 100644 --- a/layout/base/public/nsIStyleSet.h +++ b/layout/base/public/nsIStyleSet.h @@ -1,379 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Daniel Glazman - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsStyleSet_h___ -#define nsStyleSet_h___ - -#include -#include "nsISupports.h" -#include "nsChangeHint.h" -#include "nsCOMPtr.h" - -class nsIAtom; -class nsIStyleRule; -class nsIStyleSheet; -class nsStyleContext; -class nsIStyleRuleSupplier; -class nsIStyleFrameConstruction; -class nsIPresContext; -class nsIPresShell; -class nsIContent; -class nsIFrame; -class nsIDocument; -class nsIFrameManager; -class nsISupportsArray; -class nsRuleNode; -struct nsFindFrameHint; -struct nsCachedStyleData; - -#include "nsVoidArray.h" - -class nsICSSPseudoComparator; - -// IID for the nsIStyleSet interface {e59396b0-b244-11d1-8031-006008159b5a} -#define NS_ISTYLE_SET_IID \ -{0xe59396b0, 0xb244, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}} - -class nsIStyleSet : public nsISupports { -public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_SET_IID) - - // Style sheets are ordered, most significant first - // NOTE: this is the reverse of the way documents store the sheets - virtual void AppendOverrideStyleSheet(nsIStyleSheet* aSheet) = 0; - virtual void InsertOverrideStyleSheetAfter(nsIStyleSheet* aSheet, - nsIStyleSheet* aAfterSheet) = 0; - virtual void InsertOverrideStyleSheetBefore(nsIStyleSheet* aSheet, - nsIStyleSheet* aBeforeSheet) = 0; - virtual void RemoveOverrideStyleSheet(nsIStyleSheet* aSheet) = 0; - virtual PRInt32 GetNumberOfOverrideStyleSheets() = 0; - virtual nsIStyleSheet* GetOverrideStyleSheetAt(PRInt32 aIndex) = 0; - - // the ordering of document style sheets is given by the document - virtual void AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) = 0; - virtual void RemoveDocStyleSheet(nsIStyleSheet* aSheet) = 0; - virtual PRInt32 GetNumberOfDocStyleSheets() = 0; - virtual nsIStyleSheet* GetDocStyleSheetAt(PRInt32 aIndex) = 0; - - virtual void AppendUserStyleSheet(nsIStyleSheet* aSheet) = 0; - virtual void InsertUserStyleSheetAfter(nsIStyleSheet* aSheet, - nsIStyleSheet* aAfterSheet) = 0; - virtual void InsertUserStyleSheetBefore(nsIStyleSheet* aSheet, - nsIStyleSheet* aBeforeSheet) = 0; - virtual void RemoveUserStyleSheet(nsIStyleSheet* aSheet) = 0; - virtual PRInt32 GetNumberOfUserStyleSheets() = 0; - virtual nsIStyleSheet* GetUserStyleSheetAt(PRInt32 aIndex) = 0; - virtual void ReplaceUserStyleSheets(nsISupportsArray* aNewSheets) = 0; - - virtual void AppendAgentStyleSheet(nsIStyleSheet* aSheet) = 0; - virtual void InsertAgentStyleSheetAfter(nsIStyleSheet* aSheet, - nsIStyleSheet* aAfterSheet) = 0; - virtual void InsertAgentStyleSheetBefore(nsIStyleSheet* aSheet, - nsIStyleSheet* aBeforeSheet) = 0; - virtual void RemoveAgentStyleSheet(nsIStyleSheet* aSheet) = 0; - virtual PRInt32 GetNumberOfAgentStyleSheets() = 0; - virtual nsIStyleSheet* GetAgentStyleSheetAt(PRInt32 aIndex) = 0; - virtual void ReplaceAgentStyleSheets(nsISupportsArray* aNewSheets) = 0; - - virtual nsresult GetRuleTree(nsRuleNode** aResult) = 0; - - // For getting the cached default data in case we hit out-of-memory. - // To be used only by nsRuleNode. - virtual nsCachedStyleData* GetDefaultStyleData() = 0; - - virtual nsresult GetStyleFrameConstruction(nsIStyleFrameConstruction** aResult) = 0; - - // Clear all style data cached in the style context tree and rule tree. - virtual nsresult ClearStyleData(nsIPresContext* aPresContext) = 0; - - // enable / disable the Quirk style sheet: - // returns NS_FAILURE if none is found, otherwise NS_OK - NS_IMETHOD EnableQuirkStyleSheet(PRBool aEnable) = 0; - - - NS_IMETHOD NotifyStyleSheetStateChanged(PRBool aApplicable) = 0; - - // get a style context for a non-pseudo frame. - virtual already_AddRefed - ResolveStyleFor(nsIPresContext* aPresContext, - nsIContent* aContent, - nsStyleContext* aParentContext) = 0; - - // Get a style context for a non-element (which no rules will match). - // Eventually, this should go away and we shouldn't even create style - // contexts for such content nodes. However, not doing any rule - // matching for them is a first step. - // - // XXX This is temporary. It should go away when we stop creating - // style contexts for text nodes and placeholder frames. (We also use - // it once to create a style context for the nsFirstLetterFrame that - // represents everything except the first letter.) - // - virtual already_AddRefed - ResolveStyleForNonElement(nsIPresContext* aPresContext, - nsStyleContext* aParentContext) = 0; - - // get a style context for a pseudo-element (i.e., - // |aPseudoTag == nsCOMPtr(do_GetAtom(":first-line"))|; - virtual already_AddRefed - ResolvePseudoStyleFor(nsIPresContext* aPresContext, - nsIContent* aParentContent, - nsIAtom* aPseudoTag, - nsStyleContext* aParentContext, - nsICSSPseudoComparator* aComparator = nsnull) = 0; - - // This funtions just like ResolvePseudoStyleFor except that it will - // return nsnull if there are no explicit style rules for that - // pseudo element. - virtual already_AddRefed - ProbePseudoStyleFor(nsIPresContext* aPresContext, - nsIContent* aParentContent, - nsIAtom* aPseudoTag, - nsStyleContext* aParentContext) = 0; - - NS_IMETHOD BeginShutdown(nsIPresContext* aPresContext) = 0; - - NS_IMETHOD Shutdown(nsIPresContext* aPresContext) = 0; - - NS_IMETHOD NotifyStyleContextDestroyed(nsIPresContext* aPresContext, - nsStyleContext* aStyleContext) = 0; - - // Get a new style context that lives in a different parent - // The new context will be the same as the old if the new parent == the old parent - virtual already_AddRefed - ReParentStyleContext(nsIPresContext* aPresContext, - nsStyleContext* aStyleContext, - nsStyleContext* aNewParentContext) = 0; - - // Test if style is dependent on content state - NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext, - nsIContent* aContent, - PRInt32 aStateMask, - PRBool* aResult) = 0; - - // Test if style is dependent on the presence of an attribute. - NS_IMETHOD HasAttributeDependentStyle(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIAtom* aAttribute, - PRInt32 aModType, - PRBool* aResult) = 0; - - // Create frames for the root content element and its child content - NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext, - nsIContent* aDocElement, - nsIFrame*& aFrameSubTree) = 0; - - // Causes reconstruction of a frame hierarchy rooted by the - // frame document element frame. This is often called when radical style - // change precludes incremental reflow. - NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0; - - // Notifications of changes to the content mpodel - NS_IMETHOD ContentAppended(nsIPresContext* aPresContext, - nsIContent* aContainer, - PRInt32 aNewIndexInContainer) = 0; - NS_IMETHOD ContentInserted(nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInContainer) = 0; - NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aOldChild, - nsIContent* aNewChild, - PRInt32 aIndexInContainer) = 0; - NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInContainer) = 0; - - NS_IMETHOD ContentChanged(nsIPresContext* aPresContext, - nsIContent* aContent, - nsISupports* aSubContent) = 0; - NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext, - nsIContent* aContent1, - nsIContent* aContent2, - PRInt32 aStateMask) = 0; - NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) = 0; - - // Notification that we were unable to render a replaced element. - // Called when the replaced element can not be rendered, and we should - // instead render the element's contents. - // The content object associated with aFrame should either be a IMG - // element or an OBJECT element. - NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, - nsIFrame* aFrame) = 0; - - // Request to create a continuing frame - NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext, - nsIFrame* aFrame, - nsIFrame* aParentFrame, - nsIFrame** aContinuingFrame) = 0; - - /** Request to find the primary frame associated with a given content object. - * This is typically called by the pres shell when there is no mapping in - * the pres shell hash table. - * @param aPresContext the pres context - * @param aFrameManager the frame manager - * @param aContent the content we need to find a frame for - * @param aFrame [OUT] the resulting frame - * @param aHint optional performance hint, may be null - * - * @return NS_OK. aFrame will be null if no frame could be found - */ - NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext, - nsIFrameManager* aFrameManager, - nsIContent* aContent, - nsIFrame** aFrame, - nsFindFrameHint* aHint=0) = 0; - - /** - * Return the point in the frame hierarchy where the frame that - * will be constructed for |aChildContent| ought be inserted. - * - * @param aPresShell the presentation shell - * @param aParentFrame the frame that will parent the frame that is - * created for aChildContent - * @param aChildContent the child content for which a frame is to be - * created - * @param aInsertionPoint [OUT] the frame that should parent the frame - * for |aChildContent|. - */ - NS_IMETHOD GetInsertionPoint(nsIPresShell* aPresShell, - nsIFrame* aParentFrame, - nsIContent* aChildContent, - nsIFrame** aInsertionPoint) = 0; - - // APIs for registering objects that can supply additional - // rules during processing. - NS_IMETHOD SetStyleRuleSupplier(nsIStyleRuleSupplier* aSupplier)=0; - NS_IMETHOD GetStyleRuleSupplier(nsIStyleRuleSupplier** aSupplier)=0; - -#ifdef DEBUG - virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0; - virtual void ListContexts(nsIFrame* aRootFrame, FILE* out = stdout, PRInt32 aIndent = 0) = 0; -#endif - - virtual void ResetUniqueStyleItems(void) = 0; -}; - -nsresult -NS_NewStyleSet(nsIStyleSet** aInstancePtrResult); - - -class nsUniqueStyleItems : private nsVoidArray -{ -public : - // return a singleton instance of the nsUniqueStyleItems object - static nsUniqueStyleItems *GetUniqueStyleItems( void ){ - if(mInstance == nsnull){ -#ifdef DEBUG - nsUniqueStyleItems *pInstance = -#endif - new nsUniqueStyleItems; - - NS_ASSERTION(pInstance == mInstance, "Singleton?"); - - // the ctor sets the mInstance static member variable... - // if it is null, then we just end up returning null... - } - return mInstance; - } - - void *GetItem(void *aPtr){ - PRInt32 index = nsVoidArray::IndexOf(aPtr); - if( index != -1){ - return nsVoidArray::ElementAt(index); - } else { - return nsnull; - } - } - - PRBool AddItem(void *aPtr){ - if(nsVoidArray::IndexOf(aPtr) == -1){ - return nsVoidArray::AppendElement(aPtr); - } else { - return PR_FALSE; - } - } - - PRBool RemoveItem(void *aPtr){ - return nsVoidArray::RemoveElement(aPtr); - } - - PRInt32 Count(void){ - return nsVoidArray::Count(); - } - - void Clear(void){ - nsVoidArray::Clear(); - } -protected: - // disallow these: - nsUniqueStyleItems( const nsUniqueStyleItems& src); - nsUniqueStyleItems& operator =(const nsUniqueStyleItems& src); - - // make this accessable to factory only - nsUniqueStyleItems(void) : nsVoidArray(){ - NS_ASSERTION(mInstance == nsnull, "singleton?"); - mInstance=this; - } - - static nsUniqueStyleItems *mInstance; -}; - -#define UNIQUE_STYLE_ITEMS(__ptr) \ - nsUniqueStyleItems* __ptr = nsUniqueStyleItems::GetUniqueStyleItems(); \ - NS_ASSERTION(__ptr != nsnull, "UniqueItems cannot be null: error in nsUniqueStyleItems factory"); - -/** a simple struct (that may someday be expanded) - * that contains data supplied by the caller to help - * the style set find a frame for a content node - */ -struct nsFindFrameHint -{ - nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame - nsFindFrameHint() { - mPrimaryFrameForPrevSibling = nsnull; - }; -}; - -#endif /* nsIStyleSet_h___ */ diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 187b18c5cff..24d8578486c 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -527,8 +527,7 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { // propagate disabled to text / button inputs if (aNameSpaceID == kNameSpaceID_None && @@ -540,7 +539,7 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, SyncAttr(aNameSpaceID, aAttribute, SYNC_TEXT); } - return nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + return nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } NS_IMETHODIMP diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index f94f10e7c5d..ecf3464188d 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -100,8 +100,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD_(PRInt32) GetType() const; diff --git a/layout/forms/nsGfxButtonControlFrame.cpp b/layout/forms/nsGfxButtonControlFrame.cpp index 8e9372c3536..7ef1cb9f3a1 100644 --- a/layout/forms/nsGfxButtonControlFrame.cpp +++ b/layout/forms/nsGfxButtonControlFrame.cpp @@ -337,8 +337,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = NS_OK; @@ -356,7 +355,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, // defer to HTMLButtonControlFrame } else { - rv = nsHTMLButtonControlFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + rv = nsHTMLButtonControlFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } return rv; } diff --git a/layout/forms/nsGfxButtonControlFrame.h b/layout/forms/nsGfxButtonControlFrame.h index a329831bdef..050bef2fd2e 100644 --- a/layout/forms/nsGfxButtonControlFrame.h +++ b/layout/forms/nsGfxButtonControlFrame.h @@ -99,8 +99,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/forms/nsIsIndexFrame.cpp b/layout/forms/nsIsIndexFrame.cpp index 0f73675aa44..1890468d492 100644 --- a/layout/forms/nsIsIndexFrame.cpp +++ b/layout/forms/nsIsIndexFrame.cpp @@ -347,14 +347,13 @@ nsIsIndexFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = NS_OK; if (nsHTMLAtoms::prompt == aAttribute) { rv = UpdatePromptLabel(); } else { - rv = nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + rv = nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } return rv; } diff --git a/layout/forms/nsIsIndexFrame.h b/layout/forms/nsIsIndexFrame.h index c5c9e448ac7..24f46086ecc 100644 --- a/layout/forms/nsIsIndexFrame.h +++ b/layout/forms/nsIsIndexFrame.h @@ -115,8 +115,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index 3ac2d8e8860..86ebdc67885 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -2663,20 +2663,12 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (!mEditor || !mSelCon) {return NS_ERROR_NOT_INITIALIZED;} nsresult rv = NS_OK; - if (nsHTMLAtoms::value == aAttribute) - { - // XXX If this should happen when value= attribute is set, shouldn't it - // happen when .value is set too? - if (aHint != NS_STYLE_HINT_REFLOW) - nsFormControlHelper::StyleChangeReflow(aPresContext, this); - } - else if (nsHTMLAtoms::maxlength == aAttribute) + if (nsHTMLAtoms::maxlength == aAttribute) { PRInt32 maxLength; nsresult rv = GetMaxLength(&maxLength); @@ -2744,22 +2736,10 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, } mEditor->SetFlags(flags); } - else if ((nsHTMLAtoms::size == aAttribute || - nsHTMLAtoms::rows == aAttribute || - nsHTMLAtoms::cols == aAttribute) && aHint != NS_STYLE_HINT_REFLOW) { - // XXX Bug 34573 & 50280 - // The following code should be all we need for these two bugs (it does work for bug 50280) - // This doesn't wrong entirely for rows/cols, the borders don't get painted - // to fix that I have added a REFLOW hint in nsHTMLTextAreaElement::GetMappedAttributeImpact - // but it appears there are some problems when you hold down the return key - mPrefSize.width = -1; - mPrefSize.height = -1; - nsFormControlHelper::StyleChangeReflow(aPresContext, this); - } // Allow the base class to handle common attributes supported // by all form elements... else { - rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } return rv; diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 21fc91427fb..0f69c85ba8f 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -179,8 +179,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD GetText(nsString* aText); diff --git a/layout/generic/nsAreaFrame.cpp b/layout/generic/nsAreaFrame.cpp index 126d572f107..86b1157f951 100644 --- a/layout/generic/nsAreaFrame.cpp +++ b/layout/generic/nsAreaFrame.cpp @@ -171,12 +171,11 @@ nsAreaFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsBlockFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, - aModType, aHint); + aModType); // If the accesskey changed, register for the new value // The old value has been unregistered in nsXULElement::SetAttr diff --git a/layout/generic/nsAreaFrame.h b/layout/generic/nsAreaFrame.h index b1299366dcb..15e58c41887 100644 --- a/layout/generic/nsAreaFrame.h +++ b/layout/generic/nsAreaFrame.h @@ -71,8 +71,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #endif /** diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 8244485789f..80ee8f6d30b 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -2778,11 +2778,11 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsBlockFrameSuper::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (NS_FAILED(rv)) { return rv; diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 7f975b80269..a97ca43aa63 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -163,8 +163,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #ifdef DO_SELECTION NS_IMETHOD HandleEvent(nsIPresContext* aPresContext, diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 1e05ea4fe02..32571c73abb 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2285,8 +2285,7 @@ nsFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { return NS_OK; } diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index e8d3948fad6..55140a92a11 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -232,8 +232,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; NS_IMETHOD SetPrevInFlow(nsIFrame*); diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index b7c797b81f9..f881de8690f 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -169,8 +169,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // if the content is "visibility:hidden", then just hide the view // and all our contents. We don't extend "visibility:hidden" to @@ -609,8 +608,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsCOMPtr type; aChild->GetTag(getter_AddRefs(type)); diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 8696078b3ed..e2bc145006a 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -300,8 +300,7 @@ nsHTMLFramesetFrame::Observe(nsISupports* aObject, const char* aAction, doc->AttributeChanged(mContent, kNameSpaceID_None, nsHTMLAtoms::frameborder, - nsIDOMMutationEvent::MODIFICATION, - NS_STYLE_HINT_REFLOW); + nsIDOMMutationEvent::MODIFICATION); doc->EndUpdate(); } } diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 3ab884f2122..9ebe166d28a 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -823,8 +823,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) = 0; + PRInt32 aModType) = 0; /** * Return how your frame can be split. diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index ee2b13df38f..275c3a47576 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1779,14 +1779,15 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsSplittableFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (NS_OK != rv) { return rv; } + // XXXldb Shouldn't width and height be handled by attribute mapping? if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute || nsHTMLAtoms::alt == aAttribute) { // XXX: could check for new width == old width, and make that a no-op nsCOMPtr presShell; diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 065f32a2c95..8fd80e661a4 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -122,8 +122,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp index 0b205b8d139..8189fd757cf 100644 --- a/layout/generic/nsImageMap.cpp +++ b/layout/generic/nsImageMap.cpp @@ -1060,8 +1060,7 @@ nsImageMap::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { // If the parent of the changing content node is our map then update // the map. diff --git a/layout/html/base/src/nsAreaFrame.cpp b/layout/html/base/src/nsAreaFrame.cpp index 126d572f107..86b1157f951 100644 --- a/layout/html/base/src/nsAreaFrame.cpp +++ b/layout/html/base/src/nsAreaFrame.cpp @@ -171,12 +171,11 @@ nsAreaFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsBlockFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, - aModType, aHint); + aModType); // If the accesskey changed, register for the new value // The old value has been unregistered in nsXULElement::SetAttr diff --git a/layout/html/base/src/nsAreaFrame.h b/layout/html/base/src/nsAreaFrame.h index b1299366dcb..15e58c41887 100644 --- a/layout/html/base/src/nsAreaFrame.h +++ b/layout/html/base/src/nsAreaFrame.h @@ -71,8 +71,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #endif /** diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 8244485789f..80ee8f6d30b 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -2778,11 +2778,11 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsBlockFrameSuper::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (NS_FAILED(rv)) { return rv; diff --git a/layout/html/base/src/nsBlockFrame.h b/layout/html/base/src/nsBlockFrame.h index 7f975b80269..a97ca43aa63 100644 --- a/layout/html/base/src/nsBlockFrame.h +++ b/layout/html/base/src/nsBlockFrame.h @@ -163,8 +163,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #ifdef DO_SELECTION NS_IMETHOD HandleEvent(nsIPresContext* aPresContext, diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index 1e05ea4fe02..32571c73abb 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -2285,8 +2285,7 @@ nsFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { return NS_OK; } diff --git a/layout/html/base/src/nsFrame.h b/layout/html/base/src/nsFrame.h index e8d3948fad6..55140a92a11 100644 --- a/layout/html/base/src/nsFrame.h +++ b/layout/html/base/src/nsFrame.h @@ -232,8 +232,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; NS_IMETHOD SetPrevInFlow(nsIFrame*); diff --git a/layout/html/base/src/nsImageFrame.cpp b/layout/html/base/src/nsImageFrame.cpp index ee2b13df38f..275c3a47576 100644 --- a/layout/html/base/src/nsImageFrame.cpp +++ b/layout/html/base/src/nsImageFrame.cpp @@ -1779,14 +1779,15 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsSplittableFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (NS_OK != rv) { return rv; } + // XXXldb Shouldn't width and height be handled by attribute mapping? if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute || nsHTMLAtoms::alt == aAttribute) { // XXX: could check for new width == old width, and make that a no-op nsCOMPtr presShell; diff --git a/layout/html/base/src/nsImageFrame.h b/layout/html/base/src/nsImageFrame.h index 065f32a2c95..8fd80e661a4 100644 --- a/layout/html/base/src/nsImageFrame.h +++ b/layout/html/base/src/nsImageFrame.h @@ -122,8 +122,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); diff --git a/layout/html/base/src/nsImageMap.cpp b/layout/html/base/src/nsImageMap.cpp index 0b205b8d139..8189fd757cf 100644 --- a/layout/html/base/src/nsImageMap.cpp +++ b/layout/html/base/src/nsImageMap.cpp @@ -1060,8 +1060,7 @@ nsImageMap::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { // If the parent of the changing content node is our map then update // the map. diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 16a81f3f05f..d2bfa7a4ac2 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -5294,8 +5294,7 @@ PresShell::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { nsresult rv = NS_OK; // XXXwaterson it might be more elegant to wait until after the @@ -5303,7 +5302,7 @@ PresShell::AttributeChanged(nsIDocument *aDocument, // squelch any other inappropriate notifications as well. if (mDidInitialReflow) { WillCauseReflow(); - rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType, aHint); + rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType); VERIFY_STYLE_TREE; DidCauseReflow(); } diff --git a/layout/html/document/src/nsFrameFrame.cpp b/layout/html/document/src/nsFrameFrame.cpp index b7c797b81f9..f881de8690f 100644 --- a/layout/html/document/src/nsFrameFrame.cpp +++ b/layout/html/document/src/nsFrameFrame.cpp @@ -169,8 +169,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // if the content is "visibility:hidden", then just hide the view // and all our contents. We don't extend "visibility:hidden" to @@ -609,8 +608,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsCOMPtr type; aChild->GetTag(getter_AddRefs(type)); diff --git a/layout/html/document/src/nsFrameSetFrame.cpp b/layout/html/document/src/nsFrameSetFrame.cpp index 8696078b3ed..e2bc145006a 100644 --- a/layout/html/document/src/nsFrameSetFrame.cpp +++ b/layout/html/document/src/nsFrameSetFrame.cpp @@ -300,8 +300,7 @@ nsHTMLFramesetFrame::Observe(nsISupports* aObject, const char* aAction, doc->AttributeChanged(mContent, kNameSpaceID_None, nsHTMLAtoms::frameborder, - nsIDOMMutationEvent::MODIFICATION, - NS_STYLE_HINT_REFLOW); + nsIDOMMutationEvent::MODIFICATION); doc->EndUpdate(); } } diff --git a/layout/html/forms/src/nsFileControlFrame.cpp b/layout/html/forms/src/nsFileControlFrame.cpp index 187b18c5cff..24d8578486c 100644 --- a/layout/html/forms/src/nsFileControlFrame.cpp +++ b/layout/html/forms/src/nsFileControlFrame.cpp @@ -527,8 +527,7 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { // propagate disabled to text / button inputs if (aNameSpaceID == kNameSpaceID_None && @@ -540,7 +539,7 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, SyncAttr(aNameSpaceID, aAttribute, SYNC_TEXT); } - return nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + return nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } NS_IMETHODIMP diff --git a/layout/html/forms/src/nsFileControlFrame.h b/layout/html/forms/src/nsFileControlFrame.h index f94f10e7c5d..ecf3464188d 100644 --- a/layout/html/forms/src/nsFileControlFrame.h +++ b/layout/html/forms/src/nsFileControlFrame.h @@ -100,8 +100,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD_(PRInt32) GetType() const; diff --git a/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/layout/html/forms/src/nsGfxButtonControlFrame.cpp index 8e9372c3536..7ef1cb9f3a1 100644 --- a/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -337,8 +337,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = NS_OK; @@ -356,7 +355,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, // defer to HTMLButtonControlFrame } else { - rv = nsHTMLButtonControlFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + rv = nsHTMLButtonControlFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } return rv; } diff --git a/layout/html/forms/src/nsGfxButtonControlFrame.h b/layout/html/forms/src/nsGfxButtonControlFrame.h index a329831bdef..050bef2fd2e 100644 --- a/layout/html/forms/src/nsGfxButtonControlFrame.h +++ b/layout/html/forms/src/nsGfxButtonControlFrame.h @@ -99,8 +99,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/forms/src/nsIsIndexFrame.cpp b/layout/html/forms/src/nsIsIndexFrame.cpp index 0f73675aa44..1890468d492 100644 --- a/layout/html/forms/src/nsIsIndexFrame.cpp +++ b/layout/html/forms/src/nsIsIndexFrame.cpp @@ -347,14 +347,13 @@ nsIsIndexFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = NS_OK; if (nsHTMLAtoms::prompt == aAttribute) { rv = UpdatePromptLabel(); } else { - rv = nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + rv = nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } return rv; } diff --git a/layout/html/forms/src/nsIsIndexFrame.h b/layout/html/forms/src/nsIsIndexFrame.h index c5c9e448ac7..24f46086ecc 100644 --- a/layout/html/forms/src/nsIsIndexFrame.h +++ b/layout/html/forms/src/nsIsIndexFrame.h @@ -115,8 +115,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); diff --git a/layout/html/forms/src/nsTextControlFrame.cpp b/layout/html/forms/src/nsTextControlFrame.cpp index 3ac2d8e8860..86ebdc67885 100644 --- a/layout/html/forms/src/nsTextControlFrame.cpp +++ b/layout/html/forms/src/nsTextControlFrame.cpp @@ -2663,20 +2663,12 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (!mEditor || !mSelCon) {return NS_ERROR_NOT_INITIALIZED;} nsresult rv = NS_OK; - if (nsHTMLAtoms::value == aAttribute) - { - // XXX If this should happen when value= attribute is set, shouldn't it - // happen when .value is set too? - if (aHint != NS_STYLE_HINT_REFLOW) - nsFormControlHelper::StyleChangeReflow(aPresContext, this); - } - else if (nsHTMLAtoms::maxlength == aAttribute) + if (nsHTMLAtoms::maxlength == aAttribute) { PRInt32 maxLength; nsresult rv = GetMaxLength(&maxLength); @@ -2744,22 +2736,10 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, } mEditor->SetFlags(flags); } - else if ((nsHTMLAtoms::size == aAttribute || - nsHTMLAtoms::rows == aAttribute || - nsHTMLAtoms::cols == aAttribute) && aHint != NS_STYLE_HINT_REFLOW) { - // XXX Bug 34573 & 50280 - // The following code should be all we need for these two bugs (it does work for bug 50280) - // This doesn't wrong entirely for rows/cols, the borders don't get painted - // to fix that I have added a REFLOW hint in nsHTMLTextAreaElement::GetMappedAttributeImpact - // but it appears there are some problems when you hold down the return key - mPrefSize.width = -1; - mPrefSize.height = -1; - nsFormControlHelper::StyleChangeReflow(aPresContext, this); - } // Allow the base class to handle common attributes supported // by all form elements... else { - rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } return rv; diff --git a/layout/html/forms/src/nsTextControlFrame.h b/layout/html/forms/src/nsTextControlFrame.h index 21fc91427fb..0f69c85ba8f 100644 --- a/layout/html/forms/src/nsTextControlFrame.h +++ b/layout/html/forms/src/nsTextControlFrame.h @@ -179,8 +179,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD GetText(nsString* aText); diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 6f71429ec10..8778b104601 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -10229,8 +10229,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { nsresult result = NS_OK; @@ -10242,17 +10241,6 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, // Get the frame associated with the content which is the highest in the frame tree nsIFrame* primaryFrame; shell->GetPrimaryFrameFor(aContent, &primaryFrame); - // Get the frame associated with the content whose style context is highest in the style context tree - nsIFrame* primaryStyleFrame = primaryFrame; - if (primaryFrame) { - PRBool providerIsChild = PR_FALSE; - nsIFrame *styleContextProvider; - primaryFrame->GetParentStyleContextFrame(aPresContext, - &styleContextProvider, - &providerIsChild); - if (providerIsChild) - primaryStyleFrame = styleContextProvider; - } #if 0 NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, @@ -10261,17 +10249,15 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, #endif // the style tag has its own interpretation based on aHint - if (aHint & nsChangeHint_Unknown) { - nsCOMPtr styledContent = do_QueryInterface(aContent); - if (styledContent) { - // Get style hint from HTML content object. - styledContent->GetMappedAttributeImpact(aAttribute, aModType, aHint); - } - } + nsChangeHint hint = NS_STYLE_HINT_NONE; + nsCOMPtr styledContent = do_QueryInterface(aContent); + if (styledContent) { + // Get style hint from HTML content object. + styledContent->GetAttributeChangeHint(aAttribute, aModType, hint); + } - PRBool reconstruct = (aHint & nsChangeHint_ReconstructDoc) != 0; - PRBool reframe = (aHint & (nsChangeHint_ReconstructDoc | nsChangeHint_ReconstructFrame)) != 0; - PRBool restyle = (aHint & ~(nsChangeHint_AttrChange)) != 0; + PRBool reconstruct = (hint & nsChangeHint_ReconstructDoc) != 0; + PRBool reframe = (hint & (nsChangeHint_ReconstructDoc | nsChangeHint_ReconstructFrame)) != 0; #ifdef MOZ_XUL // The following listbox widget trap prevents offscreen listbox widget @@ -10323,23 +10309,17 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, } // apply changes - if (primaryFrame && (aHint & nsChangeHint_AttrChange) && !(aHint & ~(nsChangeHint_AttrChange))) { - result = primaryFrame->AttributeChanged(aPresContext, aContent, aNameSpaceID, aAttribute, aModType, aHint); - } - else if (reconstruct) { + if (reconstruct) { result = ReconstructDocElementHierarchy(aPresContext); } else if (reframe) { result = RecreateFramesForContent(aPresContext, aContent); } - else if (restyle) { - // If there is no frame then there is no point in re-styling it, - // is there? + else { if (primaryFrame) { - nsChangeHint maxHint = aHint; nsStyleChangeList changeList; // put primary frame on list to deal with, re-resolve may update or add next in flows - changeList.AppendChange(primaryFrame, aContent, maxHint); + changeList.AppendChange(primaryFrame, aContent, hint); nsCOMPtr frameManager; shell->GetFrameManager(getter_AddRefs(frameManager)); @@ -10347,42 +10327,34 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, frameManager->HasAttributeDependentStyle(aContent, aAttribute, aModType, &affects); if (affects) { -#ifdef DEBUG_shaver - fputc('+', stderr); -#endif // there is an effect, so compute it frameManager->ComputeStyleChangeFor(primaryFrame, aNameSpaceID, aAttribute, - changeList, aHint, maxHint); - } else { -#ifdef DEBUG_shaver - fputc('-', stderr); -#endif - // let this frame update itself, but don't walk the whole frame tree - maxHint = NS_STYLE_HINT_VISUAL; + changeList, hint, hint); } - // maxHint is hint for primary only - if (maxHint & nsChangeHint_ReconstructDoc) { + // hint is for primary only + if (hint & nsChangeHint_ReconstructDoc) { result = ReconstructDocElementHierarchy(aPresContext); changeList.Clear(); - } else if (maxHint & nsChangeHint_ReconstructFrame) { + } else if (hint & nsChangeHint_ReconstructFrame) { result = RecreateFramesForContent(aPresContext, aContent); changeList.Clear(); - } else if (maxHint & ~(nsChangeHint_AttrChange | nsChangeHint_Aural)) { - // let the frame deal with it, since we don't know how to - result = primaryFrame->AttributeChanged(aPresContext, aContent, aNameSpaceID, aAttribute, aModType, maxHint); + } else { + // let the frame deal with it, since we don't know how to + result = primaryFrame->AttributeChanged(aPresContext, aContent, + aNameSpaceID, aAttribute, + aModType); + // XXXwaterson should probably check for special IB siblings + // here, and propagate the AttributeChanged notification to + // them, as well. Currently, inline frames don't do anything on + // this notification, so it's not that big a deal. - // XXXwaterson should probably check for special IB siblings - // here, and propagate the AttributeChanged notification to - // them, as well. Currently, inline and block frames don't - // do anything on this notification, so it's not that big a - // deal. + // handle any children (primary may be on list too) + ProcessRestyledFrames(changeList, aPresContext); } - // handle any children (primary may be on list too) - ProcessRestyledFrames(changeList, aPresContext); } - else { // no frame now, possibly genetate one with new style data + else { result = MaybeRecreateFramesForContent(aPresContext, aContent); } } diff --git a/layout/html/style/src/nsCSSFrameConstructor.h b/layout/html/style/src/nsCSSFrameConstructor.h index 2e27c190cac..7b83f029469 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.h +++ b/layout/html/style/src/nsCSSFrameConstructor.h @@ -138,8 +138,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); + PRInt32 aModType); NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray, nsIPresContext* aPresContext); diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 3c04ed0fe76..d6a23ae4f90 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -212,8 +212,7 @@ nsTableCellFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { // let the table frame decide what to do nsTableFrame* tableFrame = nsnull; diff --git a/layout/html/table/src/nsTableCellFrame.h b/layout/html/table/src/nsTableCellFrame.h index 406cf087301..db0a0e5e9aa 100644 --- a/layout/html/table/src/nsTableCellFrame.h +++ b/layout/html/table/src/nsTableCellFrame.h @@ -97,8 +97,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // table cells contain an area frame which does most of the work, and // so these functions should never be called. They assert and return diff --git a/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 3ab88c9e4c8..34bd6d33242 100644 --- a/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -1014,8 +1014,7 @@ nsMathMLContainerFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (aAttribute == nsMathMLAtoms::mathcolor_ || aAttribute == nsMathMLAtoms::color_ || diff --git a/layout/mathml/base/src/nsMathMLContainerFrame.h b/layout/mathml/base/src/nsMathMLContainerFrame.h index d9f7e69b2b2..d7ac9b1d268 100644 --- a/layout/mathml/base/src/nsMathMLContainerFrame.h +++ b/layout/mathml/base/src/nsMathMLContainerFrame.h @@ -193,8 +193,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // -------------------------------------------------------------------------- // Additional methods diff --git a/layout/mathml/base/src/nsMathMLTokenFrame.cpp b/layout/mathml/base/src/nsMathMLTokenFrame.cpp index ee41fada582..c1e7a87b424 100644 --- a/layout/mathml/base/src/nsMathMLTokenFrame.cpp +++ b/layout/mathml/base/src/nsMathMLTokenFrame.cpp @@ -259,8 +259,7 @@ nsMathMLTokenFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (nsMathMLAtoms::lquote_ == aAttribute || nsMathMLAtoms::rquote_ == aAttribute) { @@ -269,7 +268,7 @@ nsMathMLTokenFrame::AttributeChanged(nsIPresContext* aPresContext, return nsMathMLContainerFrame:: AttributeChanged(aPresContext, aContent, aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); } void diff --git a/layout/mathml/base/src/nsMathMLTokenFrame.h b/layout/mathml/base/src/nsMathMLTokenFrame.h index da0501f9dd3..7058d62f04c 100644 --- a/layout/mathml/base/src/nsMathMLTokenFrame.h +++ b/layout/mathml/base/src/nsMathMLTokenFrame.h @@ -69,8 +69,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: nsMathMLTokenFrame(); virtual ~nsMathMLTokenFrame(); diff --git a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index 1c0f1935a9e..370780a0686 100644 --- a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -93,15 +93,14 @@ nsMathMLmfencedFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { RemoveFencesAndSeparators(); CreateFencesAndSeparators(aPresContext); return nsMathMLContainerFrame:: AttributeChanged(aPresContext, aContent, aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); } nsresult diff --git a/layout/mathml/base/src/nsMathMLmfencedFrame.h b/layout/mathml/base/src/nsMathMLmfencedFrame.h index 27383263031..9e2ddef9879 100644 --- a/layout/mathml/base/src/nsMathMLmfencedFrame.h +++ b/layout/mathml/base/src/nsMathMLmfencedFrame.h @@ -67,8 +67,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // override the base method because we must keep separators in sync virtual nsresult diff --git a/layout/mathml/base/src/nsMathMLmfracFrame.cpp b/layout/mathml/base/src/nsMathMLmfracFrame.cpp index ce9dc539e95..258e637eedb 100644 --- a/layout/mathml/base/src/nsMathMLmfracFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmfracFrame.cpp @@ -442,8 +442,7 @@ nsMathMLmfracFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (nsMathMLAtoms::bevelled_ == aAttribute) { if (!IsBevelled()) { @@ -467,7 +466,7 @@ nsMathMLmfracFrame::AttributeChanged(nsIPresContext* aPresContext, } return nsMathMLContainerFrame:: AttributeChanged(aPresContext, aContent,aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); } NS_IMETHODIMP diff --git a/layout/mathml/base/src/nsMathMLmfracFrame.h b/layout/mathml/base/src/nsMathMLmfracFrame.h index ebfe0653bae..8b2d9d125c6 100644 --- a/layout/mathml/base/src/nsMathMLmfracFrame.h +++ b/layout/mathml/base/src/nsMathMLmfracFrame.h @@ -82,8 +82,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD Init(nsIPresContext* aPresContext, diff --git a/layout/mathml/base/src/nsMathMLmoFrame.cpp b/layout/mathml/base/src/nsMathMLmoFrame.cpp index e556387bac0..aee9330c498 100644 --- a/layout/mathml/base/src/nsMathMLmoFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmoFrame.cpp @@ -992,8 +992,7 @@ nsMathMLmoFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { // check if this is an attribute that can affect the embellished hierarchy // in a significant way and re-layout the entire hierarchy. @@ -1015,7 +1014,7 @@ nsMathMLmoFrame::AttributeChanged(nsIPresContext* aPresContext, return nsMathMLTokenFrame:: AttributeChanged(aPresContext, aContent, aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); } // ---------------------- diff --git a/layout/mathml/base/src/nsMathMLmoFrame.h b/layout/mathml/base/src/nsMathMLmoFrame.h index 1ddbf1d70f8..30e13f5c69e 100644 --- a/layout/mathml/base/src/nsMathMLmoFrame.h +++ b/layout/mathml/base/src/nsMathMLmoFrame.h @@ -73,8 +73,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // This method is called by the parent frame to ask // to stretch itself. diff --git a/layout/mathml/base/src/nsMathMLmoverFrame.cpp b/layout/mathml/base/src/nsMathMLmoverFrame.cpp index 8bf166087c0..4c8ab81cc84 100644 --- a/layout/mathml/base/src/nsMathMLmoverFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmoverFrame.cpp @@ -68,8 +68,7 @@ nsMathMLmoverFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (nsMathMLAtoms::accent_ == aAttribute) { // When we have automatic data to update within ourselves, we ask our @@ -79,7 +78,7 @@ nsMathMLmoverFrame::AttributeChanged(nsIPresContext* aPresContext, return nsMathMLContainerFrame:: AttributeChanged(aPresContext, aContent, aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); } NS_IMETHODIMP diff --git a/layout/mathml/base/src/nsMathMLmoverFrame.h b/layout/mathml/base/src/nsMathMLmoverFrame.h index eb8b842c4a5..56b119e5790 100644 --- a/layout/mathml/base/src/nsMathMLmoverFrame.h +++ b/layout/mathml/base/src/nsMathMLmoverFrame.h @@ -67,8 +67,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: nsMathMLmoverFrame(); diff --git a/layout/mathml/base/src/nsMathMLmstyleFrame.cpp b/layout/mathml/base/src/nsMathMLmstyleFrame.cpp index 4054e2bd94d..717467f74a7 100644 --- a/layout/mathml/base/src/nsMathMLmstyleFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmstyleFrame.cpp @@ -194,8 +194,7 @@ nsMathMLmstyleFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { // These attributes can affect too many things, ask our parent to re-layout // its children so that we can pick up changes in our attributes & transmit diff --git a/layout/mathml/base/src/nsMathMLmstyleFrame.h b/layout/mathml/base/src/nsMathMLmstyleFrame.h index 24f2d7a8aab..7e231942d2a 100644 --- a/layout/mathml/base/src/nsMathMLmstyleFrame.h +++ b/layout/mathml/base/src/nsMathMLmstyleFrame.h @@ -39,8 +39,7 @@ public: nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD InheritAutomaticData(nsIPresContext* aPresContext, diff --git a/layout/mathml/base/src/nsMathMLmunderFrame.cpp b/layout/mathml/base/src/nsMathMLmunderFrame.cpp index 43a454d01ee..f87f09f59d2 100644 --- a/layout/mathml/base/src/nsMathMLmunderFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmunderFrame.cpp @@ -68,8 +68,7 @@ nsMathMLmunderFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (nsMathMLAtoms::accentunder_ == aAttribute) { // When we have automatic data to update within ourselves, we ask our @@ -79,7 +78,7 @@ nsMathMLmunderFrame::AttributeChanged(nsIPresContext* aPresContext, return nsMathMLContainerFrame:: AttributeChanged(aPresContext, aContent, aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); } NS_IMETHODIMP diff --git a/layout/mathml/base/src/nsMathMLmunderFrame.h b/layout/mathml/base/src/nsMathMLmunderFrame.h index 59c8afb7736..15f3ab857ce 100644 --- a/layout/mathml/base/src/nsMathMLmunderFrame.h +++ b/layout/mathml/base/src/nsMathMLmunderFrame.h @@ -67,8 +67,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: nsMathMLmunderFrame(); diff --git a/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp b/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp index 9109802545b..50bd18a77f7 100644 --- a/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp @@ -68,8 +68,7 @@ nsMathMLmunderoverFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { if (nsMathMLAtoms::accent_ == aAttribute || nsMathMLAtoms::accentunder_ == aAttribute) { @@ -80,7 +79,7 @@ nsMathMLmunderoverFrame::AttributeChanged(nsIPresContext* aPresContext, return nsMathMLContainerFrame:: AttributeChanged(aPresContext, aContent, aNameSpaceID, - aAttribute, aModType, aHint); + aAttribute, aModType); } NS_IMETHODIMP diff --git a/layout/mathml/base/src/nsMathMLmunderoverFrame.h b/layout/mathml/base/src/nsMathMLmunderoverFrame.h index b42dd588287..ee39f92785e 100644 --- a/layout/mathml/base/src/nsMathMLmunderoverFrame.h +++ b/layout/mathml/base/src/nsMathMLmunderoverFrame.h @@ -67,8 +67,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: nsMathMLmunderoverFrame(); diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 96d93ff5ce9..a06dc25cf43 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -874,12 +874,7 @@ HTMLStyleSheetImpl::HasAttributeDependentStyle(AttributeRuleProcessorData* aData // Handle the content style rules. if (styledContent) { nsChangeHint hint = NS_STYLE_HINT_NONE; - styledContent->GetMappedAttributeImpact(aData->mAttribute, - aData->mModType, hint); - // This is the same test that nsGenericHTMLElement uses when calling - // nsHTMLAttributes::SetAttributeFor. - if ((hint & ~(nsChangeHint_AttrChange | nsChangeHint_Aural | - nsChangeHint_Content)) != 0) { + if (styledContent->HasAttributeDependentStyle(aData->mAttribute)) { *aResult = PR_TRUE; return NS_OK; } diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 421f21c9920..8ea7c15d3c1 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -237,8 +237,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint); // See nsStyleConsts fot hint values + PRInt32 aModType); // Notification that we were unable to render a replaced element. NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, @@ -1685,11 +1684,11 @@ StyleSetImpl::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { return mFrameConstructor->AttributeChanged(aPresContext, aContent, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); } NS_IMETHODIMP diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index aa08a31e3bb..e09f96bd58e 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1083,7 +1083,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource) nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const { - nsChangeHint hint = nsChangeHint_None; + nsChangeHint hint = nsChangeHint(0); if (mBinding != aOther.mBinding || mPosition != aOther.mPosition @@ -1395,10 +1395,8 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO if (mUserInput == aOther.mUserInput) { if (mUserModify == aOther.mUserModify) { - if (mUserFocus == aOther.mUserFocus) { - return NS_STYLE_HINT_NONE; - } - return NS_STYLE_HINT_CONTENT; + // ignore mUserFocus + return NS_STYLE_HINT_NONE; } return NS_STYLE_HINT_VISUAL; } @@ -1441,10 +1439,8 @@ nsChangeHint nsStyleUIReset::CalcDifference(const nsStyleUIReset& aOther) const if (mForceBrokenImageIcon == aOther.mForceBrokenImageIcon) { if (mResizer == aOther.mResizer && mUserSelect == aOther.mUserSelect) { - if (mKeyEquivalent == aOther.mKeyEquivalent) { - return NS_STYLE_HINT_NONE; - } - return NS_STYLE_HINT_CONTENT; + // ignore mKeyEquivalent + return NS_STYLE_HINT_NONE; } return NS_STYLE_HINT_VISUAL; } diff --git a/layout/svg/base/src/nsSVGGenericContainerFrame.cpp b/layout/svg/base/src/nsSVGGenericContainerFrame.cpp index a1e20b11912..f8c21bf998f 100644 --- a/layout/svg/base/src/nsSVGGenericContainerFrame.cpp +++ b/layout/svg/base/src/nsSVGGenericContainerFrame.cpp @@ -96,8 +96,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // nsISVGValueObserver NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); @@ -262,17 +261,13 @@ nsSVGGenericContainerFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { #ifdef DEBUG - printf("** nsSVGGenericContainerFrame::AttributeChanged("); nsAutoString str; aAttribute->ToString(str); - nsCAutoString cstr; - cstr.AssignWithConversion(str); - printf(cstr.get()); - printf(", hint:%d)\n",aHint); + printf("** nsSVGGenericContainerFrame::AttributeChanged(%s)\n", + NS_LossyConvertUCS2toASCII(str).get()); #endif return NS_OK; diff --git a/layout/svg/base/src/nsSVGGraphicFrame.cpp b/layout/svg/base/src/nsSVGGraphicFrame.cpp index 61e6a12ada0..e69de29bb2d 100644 --- a/layout/svg/base/src/nsSVGGraphicFrame.cpp +++ b/layout/svg/base/src/nsSVGGraphicFrame.cpp @@ -1,308 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ----- BEGIN LICENSE BLOCK ----- - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Mozilla SVG project. - * - * The Initial Developer of the Original Code is - * Crocodile Clips Ltd.. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Alex Fritze (original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ----- END LICENSE BLOCK ----- */ - -#include "nsSVGGraphicFrame.h" -#include "nsIPresContext.h" -#include "nsISVGFrame.h" -#include "nsSVGRenderingContext.h" -#include "nsSVGAtoms.h" -#include "nsIDOMSVGTransformable.h" -#include "nsIDOMSVGAnimTransformList.h" -#include "nsIDOMSVGMatrix.h" -#include "nsIDOMSVGElement.h" -#include "nsIDOMSVGSVGElement.h" -#include "nsIDOMSVGPoint.h" - -//////////////////////////////////////////////////////////////////////// -// nsSVGGraphicFrame - -nsSVGGraphicFrame::nsSVGGraphicFrame() - : mUpdateFlags(0) -{ -#ifdef DEBUG -// printf("nsSVGGraphicFrame %p CTOR\n", this); -#endif -} - -nsSVGGraphicFrame::~nsSVGGraphicFrame() -{ - nsCOMPtr transformable = do_QueryInterface(mContent); - NS_ASSERTION(transformable, "wrong content element"); - nsCOMPtr transforms; - transformable->GetTransform(getter_AddRefs(transforms)); - nsCOMPtr value = do_QueryInterface(transforms); - NS_ASSERTION(transformable, "interface not found"); - if (value) - value->RemoveObserver(this); - -#ifdef DEBUG -// printf("~nsSVGGraphicFrame %p\n", this); -#endif -} - - - -//---------------------------------------------------------------------- -// nsISupports methods - -NS_INTERFACE_MAP_BEGIN(nsSVGGraphicFrame) - NS_INTERFACE_MAP_ENTRY(nsISVGFrame) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) -NS_INTERFACE_MAP_END_INHERITING(nsSVGGraphicFrameBase) - -//---------------------------------------------------------------------- -// nsIFrame methods -NS_IMETHODIMP -nsSVGGraphicFrame::Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsStyleContext* aContext, - nsIFrame* aPrevInFlow) -{ -// rv = nsSVGGraphicFrameBase::Init(aPresContext, aContent, aParent, -// aContext, aPrevInFlow); - - mContent = aContent; - NS_IF_ADDREF(mContent); - mParent = aParent; - - Init(); - - SetStyleContext(aPresContext, aContext); - - return NS_OK; -} - -NS_IMETHODIMP -nsSVGGraphicFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) -{ - // we don't use this notification mechanism - -#ifdef DEBUG -// printf("** nsSVGGraphicFrame::AttributeChanged("); -// nsAutoString str; -// aAttribute->ToString(str); -// nsCAutoString cstr; -// cstr.AssignWithConversion(str); -// printf(cstr.get()); -// printf(")\n"); -#endif - - return NS_OK; -} - -NS_IMETHODIMP -nsSVGGraphicFrame::DidSetStyleContext(nsIPresContext* aPresContext) -{ - // XXX: we'd like to use the style_hint mechanism and the - // ContentStateChanged/AttributeChanged functions for style changes - // to get slightly finer granularity, but unfortunately the - // style_hints don't map very well onto svg. Here seems to be the - // best place to deal with style changes: - - UpdateGraphic(NS_SVGGRAPHIC_UPDATE_FLAGS_STYLECHANGE); - - return NS_OK; -} - - -//---------------------------------------------------------------------- -// nsISVGValueObserver methods: - -NS_IMETHODIMP -nsSVGGraphicFrame::WillModifySVGObservable(nsISVGValue* observable) -{ - return NS_OK; -} - - -NS_IMETHODIMP -nsSVGGraphicFrame::DidModifySVGObservable (nsISVGValue* observable) -{ - // the observables we're listening in on affect the path by default. - // We can specialize in the subclasses when needed. - - UpdateGraphic(NS_SVGGRAPHIC_UPDATE_FLAGS_PATHCHANGE); - - return NS_OK; -} - - -//---------------------------------------------------------------------- -// nsISVGFrame methods - -NS_IMETHODIMP -nsSVGGraphicFrame::Paint(nsSVGRenderingContext* renderingContext) -{ - mGraphic.Paint(renderingContext); - return NS_OK; -} - -NS_IMETHODIMP -nsSVGGraphicFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) -{ - *hit = nsnull; - if (mGraphic.IsMouseHit(x, y)) { - *hit = this; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsSVGGraphicFrame::NotifyCTMChanged() -{ - UpdateGraphic(NS_SVGGRAPHIC_UPDATE_FLAGS_CTMCHANGE); - - return NS_OK; -} - -NS_IMETHODIMP -nsSVGGraphicFrame::NotifyRedrawSuspended() -{ - // XXX should we cache the fact that redraw is suspended? - return NS_OK; -} - -NS_IMETHODIMP -nsSVGGraphicFrame::NotifyRedrawUnsuspended() -{ - if (mUpdateFlags != 0) { - ArtUta* uta = nsnull; - uta = mGraphic.Update(mUpdateFlags, this); - if (uta) - InvalidateRegion(uta, PR_TRUE); - mUpdateFlags = 0; - } - return NS_OK; -} - -NS_IMETHODIMP -nsSVGGraphicFrame::IsRedrawSuspended(PRBool* isSuspended) -{ - nsCOMPtr SVGFrame = do_QueryInterface(mParent); - if (!SVGFrame) { - NS_ASSERTION(SVGFrame, "no parent frame"); - *isSuspended = PR_FALSE; - return NS_OK; - } - - return SVGFrame->IsRedrawSuspended(isSuspended); -} - -NS_IMETHODIMP -nsSVGGraphicFrame::InvalidateRegion(ArtUta* uta, PRBool bRedraw) -{ - if (!uta && !bRedraw) return NS_OK; - - NS_ASSERTION(mParent, "need parent to invalidate!"); - if (!mParent) { - if (uta) - art_uta_free(uta); - return NS_OK; - } - - nsCOMPtr SVGFrame = do_QueryInterface(mParent); - NS_ASSERTION(SVGFrame, "wrong frame type!"); - if (!SVGFrame) { - if (uta) - art_uta_free(uta); - return NS_OK; - } - - return SVGFrame->InvalidateRegion(uta, bRedraw); -} - -//---------------------------------------------------------------------- -// nsASVGGraphicSource methods: - -void nsSVGGraphicFrame::GetCTM(nsIDOMSVGMatrix** ctm) -{ - *ctm = nsnull; - - nsCOMPtr transformable = do_QueryInterface(mContent); - NS_ASSERTION(transformable, "wrong content type"); - - transformable->GetCTM(ctm); -} - - -const nsStyleSVG* nsSVGGraphicFrame::GetStyle() -{ - return GetStyleSVG(); -} - - -//---------------------------------------------------------------------- -// - -nsresult nsSVGGraphicFrame::Init() -{ - nsCOMPtr transformable = do_QueryInterface(mContent); - NS_ASSERTION(transformable, "wrong content element"); - nsCOMPtr transforms; - transformable->GetTransform(getter_AddRefs(transforms)); - nsCOMPtr value = do_QueryInterface(transforms); - NS_ASSERTION(transformable, "interface not found"); - if (value) - value->AddObserver(this); - - return NS_OK; -} - -void nsSVGGraphicFrame::UpdateGraphic(nsSVGGraphicUpdateFlags flags) -{ - mUpdateFlags |= flags; - - PRBool suspended; - IsRedrawSuspended(&suspended); - if (!suspended) { - ArtUta* uta = nsnull; - uta = mGraphic.Update(mUpdateFlags, this); - if (uta) - InvalidateRegion(uta, PR_TRUE); - mUpdateFlags = 0; - } -} - diff --git a/layout/svg/base/src/nsSVGGraphicFrame.h b/layout/svg/base/src/nsSVGGraphicFrame.h index a940f97d391..e69de29bb2d 100644 --- a/layout/svg/base/src/nsSVGGraphicFrame.h +++ b/layout/svg/base/src/nsSVGGraphicFrame.h @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ----- BEGIN LICENSE BLOCK ----- - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Mozilla SVG project. - * - * The Initial Developer of the Original Code is - * Crocodile Clips Ltd.. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Alex Fritze (original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ----- END LICENSE BLOCK ----- */ - -#ifndef __NS_SVGGRAPHICFRAME_H__ -#define __NS_SVGGRAPHICFRAME_H__ - -#include "nsFrame.h" -#include "nsISVGFrame.h" -#include "nsWeakReference.h" -#include "nsISVGValue.h" -#include "nsISVGValueObserver.h" -#include "nsASVGGraphicSource.h" -#include "nsSVGGraphic.h" -#include "libart-incs.h" - -class nsIPresContext; -class nsSVGRenderingContext; -class nsIDOMSVGMatrix; - -typedef nsFrame nsSVGGraphicFrameBase; - -class nsSVGGraphicFrame : public nsSVGGraphicFrameBase, - public nsISVGFrame, - public nsISVGValueObserver, - public nsSupportsWeakReference, - public nsASVGGraphicSource -{ -protected: - nsSVGGraphicFrame(); - virtual ~nsSVGGraphicFrame(); - -public: - // nsISupports interface: - NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); -private: - NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } - NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } -public: - - // nsIFrame interface: - NS_IMETHOD - Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsStyleContext* aContext, - nsIFrame* aPrevInFlow); - - NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); - - NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext); - - - // nsISVGValueObserver - NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); - NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); - - // nsISupportsWeakReference - // implementation inherited from nsSupportsWeakReference - - // nsISVGFrame interface: - NS_IMETHOD Paint(nsSVGRenderingContext* renderingContext); - NS_IMETHOD GetFrameForPoint(float x, float y, nsIFrame** hit); - NS_IMETHOD NotifyCTMChanged(); - NS_IMETHOD NotifyRedrawSuspended(); - NS_IMETHOD NotifyRedrawUnsuspended(); - NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended); - NS_IMETHOD InvalidateRegion(ArtUta* uta, PRBool bRedraw); - - // nsASVGGraphicSource methods: - virtual void GetCTM(nsIDOMSVGMatrix** ctm); - virtual const nsStyleSVG* GetStyle(); - // to be implemented by subclass: - //virtual void ConstructPath(nsASVGPathBuilder* pathBuilder)=0; - -protected: - virtual nsresult Init(); - void UpdateGraphic(nsSVGGraphicUpdateFlags flags); - -private: - nsSVGGraphicUpdateFlags mUpdateFlags; - nsSVGGraphic mGraphic; -}; - -#endif // __NS_SVGGRAPHICFRAME_H__ diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index f480c2f7e2f..f303a0574d6 100644 --- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -115,8 +115,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, @@ -657,18 +656,14 @@ nsSVGOuterSVGFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { #ifdef DEBUG // { -// printf("** nsSVGOuterSVGFrame::AttributeChanged("); // nsAutoString str; // aAttribute->ToString(str); -// nsCAutoString cstr; -// cstr.AssignWithConversion(str); -// printf(cstr.get()); -// printf(", hint:%d)\n",aHint); +// printf("** nsSVGOuterSVGFrame::AttributeChanged(%s)\n", +// NS_LossyConvertUCS2toASCII(str).get()); // } #endif return NS_OK; diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 3c04ed0fe76..d6a23ae4f90 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -212,8 +212,7 @@ nsTableCellFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { // let the table frame decide what to do nsTableFrame* tableFrame = nsnull; diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index 406cf087301..db0a0e5e9aa 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -97,8 +97,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); // table cells contain an area frame which does most of the work, and // so these functions should never be called. They assert and return diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 9f6b968fe5d..024bf5d5689 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -1210,12 +1210,27 @@ nsBoxFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsContainerFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, - aModType, aHint); + aModType); + + // Ignore 'width', 'height', 'screenX', 'screenY' and 'sizemode' on a + // . + nsCOMPtr tag; + mContent->GetTag(getter_AddRefs(tag)); + if ((tag == nsXULAtoms::window || + tag == nsXULAtoms::page || + tag == nsXULAtoms::dialog || + tag == nsXULAtoms::wizard) && + (nsXULAtoms::width == aAttribute || + nsXULAtoms::height == aAttribute || + nsXULAtoms::screenX == aAttribute || + nsXULAtoms::screenY == aAttribute || + nsXULAtoms::sizemode == aAttribute)) { + return rv; + } if (aAttribute == nsHTMLAtoms::width || aAttribute == nsHTMLAtoms::height || diff --git a/layout/xul/base/src/nsBoxFrame.h b/layout/xul/base/src/nsBoxFrame.h index c445d5bc5c2..9a565a6639d 100644 --- a/layout/xul/base/src/nsBoxFrame.h +++ b/layout/xul/base/src/nsBoxFrame.h @@ -143,8 +143,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD Reflow(nsIPresContext* aPresContext, diff --git a/layout/xul/base/src/nsDeckFrame.cpp b/layout/xul/base/src/nsDeckFrame.cpp index 788411b6474..36f3f8a6ba5 100644 --- a/layout/xul/base/src/nsDeckFrame.cpp +++ b/layout/xul/base/src/nsDeckFrame.cpp @@ -104,12 +104,11 @@ nsDeckFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, - aModType, aHint); + aModType); // if the index changed hide the old element and make the now element visible diff --git a/layout/xul/base/src/nsDeckFrame.h b/layout/xul/base/src/nsDeckFrame.h index 3ff80414575..77e0cf7e7c1 100644 --- a/layout/xul/base/src/nsDeckFrame.h +++ b/layout/xul/base/src/nsDeckFrame.h @@ -60,8 +60,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD DoLayout(nsBoxLayoutState& aState); diff --git a/layout/xul/base/src/nsImageBoxFrame.cpp b/layout/xul/base/src/nsImageBoxFrame.cpp index 72e38fe8378..72888280a52 100644 --- a/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/layout/xul/base/src/nsImageBoxFrame.cpp @@ -262,10 +262,9 @@ nsImageBoxFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { - nsresult rv = nsLeafBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + nsresult rv = nsLeafBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); PRBool aResize; PRBool aRedraw; diff --git a/layout/xul/base/src/nsImageBoxFrame.h b/layout/xul/base/src/nsImageBoxFrame.h index 3c5edb50697..b52847dd260 100644 --- a/layout/xul/base/src/nsImageBoxFrame.h +++ b/layout/xul/base/src/nsImageBoxFrame.h @@ -87,8 +87,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD DidSetStyleContext (nsIPresContext* aPresContext); diff --git a/layout/xul/base/src/nsLeafBoxFrame.cpp b/layout/xul/base/src/nsLeafBoxFrame.cpp index 9ed39434658..857d05a939e 100644 --- a/layout/xul/base/src/nsLeafBoxFrame.cpp +++ b/layout/xul/base/src/nsLeafBoxFrame.cpp @@ -136,17 +136,17 @@ nsLeafBoxFrame::Init(nsIPresContext* aPresContext, NS_IMETHODIMP nsLeafBoxFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType) { - nsresult rv = nsLeafFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + nsresult rv = nsLeafFrame::AttributeChanged(aPresContext, aChild, + aNameSpaceID, aAttribute, + aModType); - if (aAttribute == nsXULAtoms::mousethrough) - UpdateMouseThrough(); + if (aAttribute == nsXULAtoms::mousethrough) + UpdateMouseThrough(); return rv; } diff --git a/layout/xul/base/src/nsLeafBoxFrame.h b/layout/xul/base/src/nsLeafBoxFrame.h index ab32fd81ab3..41bf893b9e7 100644 --- a/layout/xul/base/src/nsLeafBoxFrame.h +++ b/layout/xul/base/src/nsLeafBoxFrame.h @@ -86,8 +86,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: diff --git a/layout/xul/base/src/nsListBoxBodyFrame.cpp b/layout/xul/base/src/nsListBoxBodyFrame.cpp index 222d39b7d0c..c7b06581087 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.cpp +++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp @@ -283,9 +283,11 @@ nsListBoxBodyFrame::Destroy(nsIPresContext* aPresContext) } NS_IMETHODIMP -nsListBoxBodyFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, - PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, PRInt32 aHint) +nsListBoxBodyFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType) { nsresult rv = NS_OK; @@ -309,7 +311,7 @@ nsListBoxBodyFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* a } } else - rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); return rv; diff --git a/layout/xul/base/src/nsListBoxBodyFrame.h b/layout/xul/base/src/nsListBoxBodyFrame.h index de3d9e1182a..53ea51ee831 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.h +++ b/layout/xul/base/src/nsListBoxBodyFrame.h @@ -78,7 +78,8 @@ public: nsIFrame* aParent, nsStyleContext* aContext, nsIFrame* aPrevInFlow); NS_IMETHOD Destroy(nsIPresContext* aPresContext); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, - PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType, PRInt32 aHint) ; + PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRInt32 aModType); // nsIScrollbarMediator NS_IMETHOD PositionChanged(PRInt32 aOldIndex, PRInt32& aNewIndex); diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 1ede27debe6..ecf5824fb09 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -701,8 +701,7 @@ nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsAutoString value; diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h index e1248b7fc72..f72b15900ea 100644 --- a/layout/xul/base/src/nsMenuFrame.h +++ b/layout/xul/base/src/nsMenuFrame.h @@ -228,8 +228,7 @@ protected: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); virtual ~nsMenuFrame(); protected: diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index d924a20d6d5..5b8fd6b3ecc 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -2148,12 +2148,12 @@ nsMenuPopupFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (aAttribute == nsXULAtoms::left || aAttribute == nsXULAtoms::top) MoveToAttributePosition(); diff --git a/layout/xul/base/src/nsMenuPopupFrame.h b/layout/xul/base/src/nsMenuPopupFrame.h index f4db9dfc753..29d4a2fabcf 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.h +++ b/layout/xul/base/src/nsMenuPopupFrame.h @@ -126,8 +126,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD HandleEvent(nsIPresContext* aPresContext, nsGUIEvent* aEvent, diff --git a/layout/xul/base/src/nsNativeScrollbarFrame.cpp b/layout/xul/base/src/nsNativeScrollbarFrame.cpp index 3eb7a380bb5..430c333bafc 100644 --- a/layout/xul/base/src/nsNativeScrollbarFrame.cpp +++ b/layout/xul/base/src/nsNativeScrollbarFrame.cpp @@ -179,12 +179,15 @@ nsNativeScrollbarFrame::FindScrollbar(nsIFrame* start, nsIFrame** outFrame, nsIC // our native scrollbar with the correct values. // NS_IMETHODIMP -nsNativeScrollbarFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, - PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType, - PRInt32 aHint) +nsNativeScrollbarFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if ( aAttribute == nsXULAtoms::curpos || aAttribute == nsXULAtoms::maxpos || diff --git a/layout/xul/base/src/nsNativeScrollbarFrame.h b/layout/xul/base/src/nsNativeScrollbarFrame.h index 48bbbf51f12..8429d7daa84 100644 --- a/layout/xul/base/src/nsNativeScrollbarFrame.h +++ b/layout/xul/base/src/nsNativeScrollbarFrame.h @@ -76,8 +76,8 @@ public: // nsIFrame overrides NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, - PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType, - PRInt32 aHint); + PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRInt32 aModType); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } diff --git a/layout/xul/base/src/nsProgressMeterFrame.cpp b/layout/xul/base/src/nsProgressMeterFrame.cpp index 811be6e89b1..427bd805a07 100644 --- a/layout/xul/base/src/nsProgressMeterFrame.cpp +++ b/layout/xul/base/src/nsProgressMeterFrame.cpp @@ -97,20 +97,20 @@ nsProgressMeterFrame::SetInitialChildList(nsIPresContext* aPresContext, { // Set up our initial flexes. nsresult rv = nsBoxFrame::SetInitialChildList(aPresContext, aListName, aChildList); - AttributeChanged(aPresContext, mContent, kNameSpaceID_None, nsHTMLAtoms::value, 0, 0); + AttributeChanged(aPresContext, mContent, kNameSpaceID_None, nsHTMLAtoms::value, 0); return rv; } NS_IMETHODIMP nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (NS_OK != rv) { return rv; } diff --git a/layout/xul/base/src/nsProgressMeterFrame.h b/layout/xul/base/src/nsProgressMeterFrame.h index 10048b28da3..01fc0edec20 100644 --- a/layout/xul/base/src/nsProgressMeterFrame.h +++ b/layout/xul/base/src/nsProgressMeterFrame.h @@ -66,8 +66,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/layout/xul/base/src/nsResizerFrame.cpp b/layout/xul/base/src/nsResizerFrame.cpp index 9321d45669a..c6ef98b2972 100644 --- a/layout/xul/base/src/nsResizerFrame.cpp +++ b/layout/xul/base/src/nsResizerFrame.cpp @@ -342,11 +342,11 @@ nsResizerFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsTitleBarFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (aAttribute == nsXULAtoms::dir ) { diff --git a/layout/xul/base/src/nsResizerFrame.h b/layout/xul/base/src/nsResizerFrame.h index 97f57c4f895..f4433023f86 100644 --- a/layout/xul/base/src/nsResizerFrame.h +++ b/layout/xul/base/src/nsResizerFrame.h @@ -76,8 +76,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); virtual void MouseClicked (nsIPresContext* aPresContext); diff --git a/layout/xul/base/src/nsScrollbarFrame.cpp b/layout/xul/base/src/nsScrollbarFrame.cpp index 9eb9194524a..d0b61c1c6ea 100644 --- a/layout/xul/base/src/nsScrollbarFrame.cpp +++ b/layout/xul/base/src/nsScrollbarFrame.cpp @@ -113,14 +113,14 @@ NS_IMETHODIMP nsScrollbarFrame::IsPercentageBase(PRBool& aBase) const NS_IMETHODIMP nsScrollbarFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); // if the current position changes, notify any nsGfxScrollFrame // parent we may have diff --git a/layout/xul/base/src/nsScrollbarFrame.h b/layout/xul/base/src/nsScrollbarFrame.h index e9a05249677..d1468027a5e 100644 --- a/layout/xul/base/src/nsScrollbarFrame.h +++ b/layout/xul/base/src/nsScrollbarFrame.h @@ -67,8 +67,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index 229975e0dd8..7d20f235be4 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -237,11 +237,11 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); // if the current position changes if (aAttribute == nsXULAtoms::curpos) { rv = CurrentPositionChanged(aPresContext); @@ -279,10 +279,9 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext, } } - if ((aHint != NS_STYLE_HINT_REFLOW) && - (aAttribute == nsXULAtoms::maxpos || - aAttribute == nsXULAtoms::pageincrement || - aAttribute == nsXULAtoms::increment)) { + if (aAttribute == nsXULAtoms::maxpos || + aAttribute == nsXULAtoms::pageincrement || + aAttribute == nsXULAtoms::increment) { nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); diff --git a/layout/xul/base/src/nsSliderFrame.h b/layout/xul/base/src/nsSliderFrame.h index bd079d535ca..a15f914cf89 100644 --- a/layout/xul/base/src/nsSliderFrame.h +++ b/layout/xul/base/src/nsSliderFrame.h @@ -169,8 +169,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); virtual nsresult CurrentPositionChanged(nsIPresContext* aPresContext); diff --git a/layout/xul/base/src/nsSplitterFrame.cpp b/layout/xul/base/src/nsSplitterFrame.cpp index a5a5c0e0328..638a9886ca4 100644 --- a/layout/xul/base/src/nsSplitterFrame.cpp +++ b/layout/xul/base/src/nsSplitterFrame.cpp @@ -297,14 +297,14 @@ nsSplitterFrame::GetCursor(nsIPresContext* aPresContext, NS_IMETHODIMP nsSplitterFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); // if the alignment changed. Let the grippy know if (aAttribute == nsHTMLAtoms::align) { // tell the slider its attribute changed so it can @@ -312,7 +312,7 @@ nsSplitterFrame::AttributeChanged(nsIPresContext* aPresContext, nsIFrame* grippy = nsnull; nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::grippy, this, grippy); if (grippy) - grippy->AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); + grippy->AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType); } else if (aAttribute == nsXULAtoms::state) { mInner->UpdateState(); } diff --git a/layout/xul/base/src/nsSplitterFrame.h b/layout/xul/base/src/nsSplitterFrame.h index f457730bdb5..40fd2fe9ff4 100644 --- a/layout/xul/base/src/nsSplitterFrame.h +++ b/layout/xul/base/src/nsSplitterFrame.h @@ -68,8 +68,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); NS_IMETHOD Init(nsIPresContext* aPresContext, nsIContent* aContent, diff --git a/layout/xul/base/src/nsTextBoxFrame.cpp b/layout/xul/base/src/nsTextBoxFrame.cpp index 18ca00e2ab8..bd7444a5a89 100644 --- a/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/layout/xul/base/src/nsTextBoxFrame.cpp @@ -125,8 +125,7 @@ nsTextBoxFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + PRInt32 aModType) { mState |= NS_STATE_NEED_LAYOUT; PRBool aResize; diff --git a/layout/xul/base/src/nsTextBoxFrame.h b/layout/xul/base/src/nsTextBoxFrame.h index cbea0d2ad8f..f0eafb63d99 100644 --- a/layout/xul/base/src/nsTextBoxFrame.h +++ b/layout/xul/base/src/nsTextBoxFrame.h @@ -70,8 +70,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/layout/xul/base/src/tree/src/nsTreeColFrame.cpp b/layout/xul/base/src/tree/src/nsTreeColFrame.cpp index 82829078b61..21b97ec5a74 100644 --- a/layout/xul/base/src/tree/src/nsTreeColFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeColFrame.cpp @@ -175,14 +175,14 @@ nsTreeColFrame::GetFrameForPoint(nsIPresContext* aPresContext, NS_IMETHODIMP nsTreeColFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType) { nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); + aNameSpaceID, aAttribute, + aModType); if (aAttribute == nsHTMLAtoms::width || aAttribute == nsHTMLAtoms::hidden) { // Invalidate the tree. diff --git a/layout/xul/base/src/tree/src/nsTreeColFrame.h b/layout/xul/base/src/tree/src/nsTreeColFrame.h index dc78a6e2d02..36fc3d81aa2 100644 --- a/layout/xul/base/src/tree/src/nsTreeColFrame.h +++ b/layout/xul/base/src/tree/src/nsTreeColFrame.h @@ -72,8 +72,7 @@ public: nsIContent* aChild, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); + PRInt32 aModType); protected: diff --git a/layout/xul/base/src/tree/src/nsTreeContentView.cpp b/layout/xul/base/src/tree/src/nsTreeContentView.cpp index 93cd72ee1d1..e8a9a84d888 100644 --- a/layout/xul/base/src/tree/src/nsTreeContentView.cpp +++ b/layout/xul/base/src/tree/src/nsTreeContentView.cpp @@ -735,8 +735,7 @@ nsTreeContentView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { // Make sure this notification concerns us. // First check the tag to see if it's one that we care about. diff --git a/widget/src/cocoa/nsIChangeManager.idl b/widget/src/cocoa/nsIChangeManager.idl index 38084991847..f36a7c89772 100644 --- a/widget/src/cocoa/nsIChangeManager.idl +++ b/widget/src/cocoa/nsIChangeManager.idl @@ -39,7 +39,7 @@ interface nsIDocument; interface nsIChangeObserver : nsISupports { void AttributeChanged ( in nsIDocument aDocument, - in long aNameSpaceID, in nsIAtom aAttribute, in long aHint) ; + in long aNameSpaceID, in nsIAtom aAttribute ) ; void ContentRemoved ( in nsIDocument aDocument, in nsIContent aChild, in long aIndexInContainer ) ; diff --git a/widget/src/cocoa/nsMenuBarX.cpp b/widget/src/cocoa/nsMenuBarX.cpp index dc87a49f1d0..56e3625c86d 100644 --- a/widget/src/cocoa/nsMenuBarX.cpp +++ b/widget/src/cocoa/nsMenuBarX.cpp @@ -790,13 +790,13 @@ nsMenuBarX::DocumentWillBeDestroyed( nsIDocument * aDocument ) NS_IMETHODIMP nsMenuBarX::AttributeChanged( nsIDocument * aDocument, nsIContent * aContent, PRInt32 aNameSpaceID, - nsIAtom * aAttribute, PRInt32 aModType, nsChangeHint aHint) + nsIAtom * aAttribute, PRInt32 aModType) { // lookup and dispatch to registered thang. nsCOMPtr obs; Lookup ( aContent, getter_AddRefs(obs) ); if ( obs ) - obs->AttributeChanged ( aDocument, aNameSpaceID, aAttribute, (PRInt32)aHint ); + obs->AttributeChanged ( aDocument, aNameSpaceID, aAttribute ); return NS_OK; } diff --git a/widget/src/cocoa/nsMenuItemX.cpp b/widget/src/cocoa/nsMenuItemX.cpp index fc65cc8ab35..0c23b75657f 100644 --- a/widget/src/cocoa/nsMenuItemX.cpp +++ b/widget/src/cocoa/nsMenuItemX.cpp @@ -367,8 +367,7 @@ nsMenuItemX :: UncheckRadioSiblings(nsIContent* inCheckedContent) NS_IMETHODIMP -nsMenuItemX :: AttributeChanged ( nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute, - PRInt32 aHint) +nsMenuItemX :: AttributeChanged ( nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute ) { if (aAttribute == nsWidgetAtoms::checked) { // if we're a radio menu, uncheck our sibling radio items. No need to diff --git a/widget/src/cocoa/nsMenuX.cpp b/widget/src/cocoa/nsMenuX.cpp index 34073231a97..d396713eb8b 100644 --- a/widget/src/cocoa/nsMenuX.cpp +++ b/widget/src/cocoa/nsMenuX.cpp @@ -1297,8 +1297,7 @@ nsMenuX :: CountVisibleBefore ( PRUint32* outVisibleBefore ) NS_IMETHODIMP -nsMenuX::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute, - PRInt32 aHint) +nsMenuX::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute ) { if (gConstructingMenu) return NS_OK; diff --git a/widget/src/mac/nsIChangeManager.idl b/widget/src/mac/nsIChangeManager.idl index 38084991847..9a6262d86d8 100644 --- a/widget/src/mac/nsIChangeManager.idl +++ b/widget/src/mac/nsIChangeManager.idl @@ -39,7 +39,7 @@ interface nsIDocument; interface nsIChangeObserver : nsISupports { void AttributeChanged ( in nsIDocument aDocument, - in long aNameSpaceID, in nsIAtom aAttribute, in long aHint) ; + in long aNameSpaceID, in nsIAtom aAttribute ) ; void ContentRemoved ( in nsIDocument aDocument, in nsIContent aChild, in long aIndexInContainer ) ; diff --git a/widget/src/mac/nsMenu.cpp b/widget/src/mac/nsMenu.cpp index 6f697666619..d425d07dace 100644 --- a/widget/src/mac/nsMenu.cpp +++ b/widget/src/mac/nsMenu.cpp @@ -1482,8 +1482,7 @@ nsMenu::GetNextVisibleMenu(nsIMenu** outNextVisibleMenu) NS_IMETHODIMP -nsMenu::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute, - PRInt32 aHint) +nsMenu::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute) { if(gConstructingMenu) return NS_OK; diff --git a/widget/src/mac/nsMenuBar.cpp b/widget/src/mac/nsMenuBar.cpp index 75f30151885..0552343330c 100644 --- a/widget/src/mac/nsMenuBar.cpp +++ b/widget/src/mac/nsMenuBar.cpp @@ -685,13 +685,13 @@ nsMenuBar::DocumentWillBeDestroyed( nsIDocument * aDocument ) NS_IMETHODIMP nsMenuBar::AttributeChanged( nsIDocument * aDocument, nsIContent * aContent, PRInt32 aNameSpaceID, - nsIAtom * aAttribute, PRInt32 aModType, nsChangeHint aHint) + nsIAtom * aAttribute, PRInt32 aModType ) { // lookup and dispatch to registered thang. nsCOMPtr obs; Lookup ( aContent, getter_AddRefs(obs) ); if ( obs ) - obs->AttributeChanged ( aDocument, aNameSpaceID, aAttribute, (PRInt32)aHint ); + obs->AttributeChanged ( aDocument, aNameSpaceID, aAttribute ); return NS_OK; } diff --git a/widget/src/mac/nsMenuBarX.cpp b/widget/src/mac/nsMenuBarX.cpp index eced5103ae1..c934d284791 100644 --- a/widget/src/mac/nsMenuBarX.cpp +++ b/widget/src/mac/nsMenuBarX.cpp @@ -800,13 +800,13 @@ nsMenuBarX::DocumentWillBeDestroyed( nsIDocument * aDocument ) NS_IMETHODIMP nsMenuBarX::AttributeChanged( nsIDocument * aDocument, nsIContent * aContent, PRInt32 aNameSpaceID, - nsIAtom * aAttribute, PRInt32 aModType, nsChangeHint aHint) + nsIAtom * aAttribute, PRInt32 aModType ) { // lookup and dispatch to registered thang. nsCOMPtr obs; Lookup ( aContent, getter_AddRefs(obs) ); if ( obs ) - obs->AttributeChanged ( aDocument, aNameSpaceID, aAttribute, (PRInt32)aHint ); + obs->AttributeChanged ( aDocument, aNameSpaceID, aAttribute ); return NS_OK; } diff --git a/widget/src/mac/nsMenuItem.cpp b/widget/src/mac/nsMenuItem.cpp index 8dd61daa2f4..541a41541c3 100644 --- a/widget/src/mac/nsMenuItem.cpp +++ b/widget/src/mac/nsMenuItem.cpp @@ -393,8 +393,7 @@ nsMenuItem :: UncheckRadioSiblings ( nsIContent* inCheckedContent ) NS_IMETHODIMP -nsMenuItem :: AttributeChanged ( nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute, - PRInt32 aHint ) +nsMenuItem :: AttributeChanged ( nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute ) { if (aAttribute == nsWidgetAtoms::checked) { // if we're a radio menu, uncheck our sibling radio items. No need to diff --git a/widget/src/mac/nsMenuItemX.cpp b/widget/src/mac/nsMenuItemX.cpp index 269b9dc4688..d77fbbb48f0 100644 --- a/widget/src/mac/nsMenuItemX.cpp +++ b/widget/src/mac/nsMenuItemX.cpp @@ -338,8 +338,7 @@ nsMenuItemX :: UncheckRadioSiblings(nsIContent* inCheckedContent) NS_IMETHODIMP -nsMenuItemX :: AttributeChanged ( nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute, - PRInt32 aHint) +nsMenuItemX :: AttributeChanged ( nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute ) { if (aAttribute == nsWidgetAtoms::checked) { // if we're a radio menu, uncheck our sibling radio items. No need to diff --git a/widget/src/mac/nsMenuX.cpp b/widget/src/mac/nsMenuX.cpp index 4f3478096d9..de0a55f782b 100644 --- a/widget/src/mac/nsMenuX.cpp +++ b/widget/src/mac/nsMenuX.cpp @@ -1303,8 +1303,7 @@ nsMenuX :: CountVisibleBefore ( PRUint32* outVisibleBefore ) NS_IMETHODIMP -nsMenuX::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute, - PRInt32 aHint) +nsMenuX::AttributeChanged(nsIDocument *aDocument, PRInt32 aNameSpaceID, nsIAtom *aAttribute) { if (gConstructingMenu) return NS_OK; diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 5d03788a4fa..967953fec94 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -1535,8 +1535,7 @@ nsWebShellWindow::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttribute, - PRInt32 aModType, - nsChangeHint aHint) + PRInt32 aModType) { #if 0 //printf("AttributeChanged\n");