diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index c2ea7b85b8f2..a786e8f07f3d 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -6859,7 +6859,6 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, break; case NS_STYLE_HINT_REFLOW: case NS_STYLE_HINT_VISUAL: - break; case NS_STYLE_HINT_CONTENT: // let the frame deal with it, since we don't know how to result = primaryFrame->AttributeChanged(aPresContext, aContent, aAttribute, maxHint); diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp index a54194a4e1c8..aef306f421b9 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -379,7 +379,8 @@ nsGfxTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, mEditor->EnableUndo(PR_FALSE); // wipe out undo info SetTextControlFrameState(value); // set new text value mEditor->EnableUndo(PR_TRUE); // fire up a new txn stack - nsFormFrame::StyleChangeReflow(aPresContext, this); + if (aHint != NS_STYLE_HINT_REFLOW) + nsFormFrame::StyleChangeReflow(aPresContext, this); } else if (nsHTMLAtoms::maxlength == aAttribute) { @@ -447,7 +448,7 @@ nsGfxTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, } mEditor->SetFlags(flags); } - else if (nsHTMLAtoms::size == aAttribute) { + else if (nsHTMLAtoms::size == aAttribute && aHint != NS_STYLE_HINT_REFLOW) { nsFormFrame::StyleChangeReflow(aPresContext, this); } // Allow the base class to handle common attributes supported diff --git a/layout/html/forms/src/nsNativeButtonControlFrame.cpp b/layout/html/forms/src/nsNativeButtonControlFrame.cpp index 0cf7af90d66d..3a7598379e64 100644 --- a/layout/html/forms/src/nsNativeButtonControlFrame.cpp +++ b/layout/html/forms/src/nsNativeButtonControlFrame.cpp @@ -57,9 +57,11 @@ nsNativeButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, /*XXXnsresult result = */GetValue(&value); button->SetLabel(value); NS_RELEASE(button); - nsFormFrame::StyleChangeReflow(aPresContext, this); + if (aHint != NS_STYLE_HINT_REFLOW) + nsFormFrame::StyleChangeReflow(aPresContext, this); } - } else if (nsHTMLAtoms::size == aAttribute) { + } else if (nsHTMLAtoms::size == aAttribute && + aHint != NS_STYLE_HINT_REFLOW) { nsFormFrame::StyleChangeReflow(aPresContext, this); } // Allow the base class to handle common attributes supported diff --git a/layout/html/forms/src/nsNativeTextControlFrame.cpp b/layout/html/forms/src/nsNativeTextControlFrame.cpp index 139a05424190..b7f48171a231 100644 --- a/layout/html/forms/src/nsNativeTextControlFrame.cpp +++ b/layout/html/forms/src/nsNativeTextControlFrame.cpp @@ -158,7 +158,8 @@ nsNativeTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, /*XXXnsresult rv = */GetText(&value, PR_TRUE); PRUint32 ignore; text->SetText(value, ignore); - nsFormFrame::StyleChangeReflow(aPresContext, this); + if (aHint != NS_STYLE_HINT_REFLOW) + nsFormFrame::StyleChangeReflow(aPresContext, this); } else if (nsHTMLAtoms::maxlength == aAttribute) { PRInt32 maxLength; nsresult rv = GetMaxLength(&maxLength); @@ -169,7 +170,8 @@ nsNativeTextControlFrame::AttributeChanged(nsIPresContext* aPresContext, PRBool oldReadOnly; text->SetReadOnly(nsFormFrame::GetReadonly(this),oldReadOnly); } - else if (nsHTMLAtoms::size == aAttribute) { + else if (nsHTMLAtoms::size == aAttribute && + aHint != NS_STYLE_HINT_REFLOW) { nsFormFrame::StyleChangeReflow(aPresContext, this); } // Allow the base class to handle common attributes supported diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index c2ea7b85b8f2..a786e8f07f3d 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -6859,7 +6859,6 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, break; case NS_STYLE_HINT_REFLOW: case NS_STYLE_HINT_VISUAL: - break; case NS_STYLE_HINT_CONTENT: // let the frame deal with it, since we don't know how to result = primaryFrame->AttributeChanged(aPresContext, aContent, aAttribute, maxHint); diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 16bf55c387b3..adcf9b656ec3 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -373,8 +373,40 @@ nsMenuFrame::ActivateMenu(PRBool aActivateFlag) } } +NS_IMETHODIMP +nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint) +{ + if (aAttribute == nsXULAtoms::open) { + nsAutoString openVal; + nsCOMPtr domElement = do_QueryInterface(aChild); + domElement->GetAttribute("open", openVal); + if (openVal == "true") + OpenMenuInternal(PR_TRUE); + else OpenMenuInternal(PR_FALSE); + } + + return NS_OK; +} + +void +nsMenuFrame::OpenMenu(PRBool aActivateFlag) +{ + nsCOMPtr domElement = do_QueryInterface(mContent); + if (aActivateFlag) { + // Now that the menu is opened, we should have a menupopup child built. + // Mark it as generated, which ensures a frame gets built. + MarkAsGenerated(); + + domElement->SetAttribute("open", "true"); + } + else domElement->RemoveAttribute("open"); +} + void -nsMenuFrame::OpenMenu(PRBool aActivateFlag) +nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag) { gEatMouseMove = PR_TRUE; @@ -386,12 +418,7 @@ nsMenuFrame::OpenMenu(PRBool aActivateFlag) if (!OnCreate()) return; - // Open the menu. - nsCOMPtr domElement = do_QueryInterface(mContent); - domElement->SetAttribute("open", "true"); - - // Now that the menu is opened, we should have a menupopup child built. - // Mark it as generated, which ensures a frame gets built. + // XXX Only have this here because of RDF-generated content. MarkAsGenerated(); nsIFrame* frame = mPopupFrames.FirstChild(); @@ -428,9 +455,6 @@ nsMenuFrame::OpenMenu(PRBool aActivateFlag) ActivateMenu(PR_FALSE); - nsCOMPtr domElement = do_QueryInterface(mContent); - domElement->RemoveAttribute("open"); - mMenuOpen = PR_FALSE; // Set the focus back to our view's widget. @@ -958,7 +982,15 @@ nsMenuFrame::OnCreate() nsMouseEvent event; event.eventStructType = NS_EVENT; event.message = NS_MENU_CREATE; - nsresult rv = mContent->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); + + nsCOMPtr child; + GetMenuChildrenElement(getter_AddRefs(child)); + + nsresult rv; + if (child) + rv = child->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); + else rv = mContent->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); + if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault ) return PR_FALSE; return PR_TRUE; @@ -971,7 +1003,15 @@ nsMenuFrame::OnDestroy() nsMouseEvent event; event.eventStructType = NS_EVENT; event.message = NS_MENU_DESTROY; - nsresult rv = mContent->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); + + nsCOMPtr child; + GetMenuChildrenElement(getter_AddRefs(child)); + + nsresult rv; + if (child) + rv = child->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); + else rv = mContent->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); + if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault ) return PR_FALSE; return PR_TRUE; diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h index afed4d0dd163..4062ac1b4102 100644 --- a/layout/xul/base/src/nsMenuFrame.h +++ b/layout/xul/base/src/nsMenuFrame.h @@ -114,7 +114,9 @@ public: void ToggleMenuState(); void SelectMenu(PRBool aActivateFlag); + void OpenMenu(PRBool aActivateFlag); + void ActivateMenu(PRBool aActivateFlag); PRBool IsMenu(); @@ -132,6 +134,7 @@ public: PRBool IsGenerated(); protected: + void OpenMenuInternal(PRBool aActivateFlag); void GetMenuChildrenElement(nsIContent** aResult); // Called to split the accesskey attribute up based on the specified string. @@ -149,6 +152,11 @@ protected: // Called as a hook just before the menu goes away. PRBool OnDestroy(); + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint); + protected: nsFrameList mPopupFrames; PRBool mIsMenu; // Whether or not we can even have children or not. diff --git a/layout/xul/base/src/nsProgressMeterFrame.cpp b/layout/xul/base/src/nsProgressMeterFrame.cpp index 6ab395f702ef..2fd6363bdae8 100644 --- a/layout/xul/base/src/nsProgressMeterFrame.cpp +++ b/layout/xul/base/src/nsProgressMeterFrame.cpp @@ -690,7 +690,9 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext, setMode(newValue); // needs to reflow so we start the timer. - Reflow(aPresContext); + if (aHint != NS_STYLE_HINT_REFLOW) + Reflow(aPresContext); + } else if (nsHTMLAtoms::align == aAttribute) { nsAutoString newValue; @@ -698,8 +700,8 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext, aChild->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, newValue); setAlignment(newValue); - - Reflow(aPresContext); + if (aHint != NS_STYLE_HINT_REFLOW) + Reflow(aPresContext); } return NS_OK; diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index 5e1b42157dfd..04535054df82 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -190,9 +190,10 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext, // if the current position changes if (aAttribute == nsXULAtoms::curpos) { CurrentPositionChanged(aPresContext); - } else if (aAttribute == nsXULAtoms::maxpos || + } else if ((aHint != NS_STYLE_HINT_REFLOW) && + (aAttribute == nsXULAtoms::maxpos || aAttribute == nsXULAtoms::pageincrement || - aAttribute == nsXULAtoms::increment) { + aAttribute == nsXULAtoms::increment)) { nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); diff --git a/layout/xul/base/src/nsTitledButtonFrame.cpp b/layout/xul/base/src/nsTitledButtonFrame.cpp index e1200f9cdc6f..b7bdb09b9f09 100644 --- a/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -155,17 +155,20 @@ nsTitledButtonFrame::AttributeChanged(nsIPresContext* aPresContext, mNeedsLayout = PR_TRUE; UpdateAttributes(*aPresContext); -#if 1 // added back in because boxes now handle only redraw what is reflowed. + // added back in because boxes now handle only redraw what is reflowed. // reflow nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); - nsCOMPtr reflowCmd; - nsresult rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this, - nsIReflowCommand::StyleChanged); - if (NS_SUCCEEDED(rv)) - shell->AppendReflowCommand(reflowCmd); -#endif + if (aHint != NS_STYLE_HINT_REFLOW && + (aAttribute == nsHTMLAtoms::align || aAttribute == nsHTMLAtoms::value || + aAttribute == nsHTMLAtoms::src || aAttribute == nsXULAtoms::crop)) { + nsCOMPtr reflowCmd; + nsresult rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this, + nsIReflowCommand::StyleChanged); + if (NS_SUCCEEDED(rv)) + shell->AppendReflowCommand(reflowCmd); + } // redraw mRenderer.Redraw(); diff --git a/layout/xul/base/src/nsTreeRowFrame.cpp b/layout/xul/base/src/nsTreeRowFrame.cpp index 08b247d815fc..38c7a08fffec 100644 --- a/layout/xul/base/src/nsTreeRowFrame.cpp +++ b/layout/xul/base/src/nsTreeRowFrame.cpp @@ -252,10 +252,10 @@ nsTreeRowFrame::GetCursor(nsIPresContext& aPresContext, nsRect rect; GetRect(rect); if (rect.x > aPoint.x || (rect.x+rect.width < aPoint.x)) { - aCursor = NS_STYLE_CURSOR_W_RESIZE; + aCursor = NS_STYLE_CURSOR_DEFAULT; } else { - aCursor = NS_STYLE_CURSOR_DEFAULT; + aCursor = NS_STYLE_CURSOR_W_RESIZE; } } else aCursor = NS_STYLE_CURSOR_DEFAULT;