зеркало из https://github.com/mozilla/gecko-dev.git
Only make the check for sameness if there are listeners or if we plan to fire
notifications. Trying to fix small Tp regression. Bug still 209634, r=caillon, sr=jag
This commit is contained in:
Родитель
4e226fa4ff
Коммит
a786eb9afb
|
@ -1968,12 +1968,29 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute,
|
|||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// Do nothing if there is no change. Note that this assumes that two
|
||||
// attributes that have the same nsISupports value are in fact equal.
|
||||
nsHTMLValue oldValue;
|
||||
result = GetHTMLAttribute(aAttribute, oldValue);
|
||||
if (result != NS_CONTENT_ATTR_NOT_THERE && oldValue == aValue) {
|
||||
return NS_OK;
|
||||
PRBool haveListeners =
|
||||
mDocument &&
|
||||
nsGenericElement::HasMutationListeners(this,
|
||||
NS_EVENT_BITS_MUTATION_ATTRMODIFIED);
|
||||
|
||||
// If we have no listeners and aNotify is false, we are almost certainly
|
||||
// coming from the content sink and will almost certainly have no previous
|
||||
// value. Even if we do, setting the value is cheap when we have no
|
||||
// listeners and don't plan to notify. The check for aNotify here is an
|
||||
// optimization; the check for haveListeners is a correctness issue.
|
||||
if (haveListeners || aNotify) {
|
||||
// Do nothing if there is no change. Note that operator== on nsHTMLValue
|
||||
// assumes that two nsHTMLValues are the same if they have the same unit
|
||||
// and value. For nsHTMLValues whose value is an nsISupports, this means
|
||||
// that a new nsISupports pointer _must_ be created in order for attribute
|
||||
// changes to take proper effect. Currently, this only applies to inline
|
||||
// style, which satisfies this constraint because style rules are
|
||||
// immutable.
|
||||
nsHTMLValue oldValue;
|
||||
result = GetHTMLAttribute(aAttribute, oldValue);
|
||||
if (result != NS_CONTENT_ATTR_NOT_THERE && oldValue == aValue) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsChangeHint impact = NS_STYLE_HINT_NONE;
|
||||
|
@ -1981,9 +1998,6 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute,
|
|||
impact);
|
||||
nsCOMPtr<nsIHTMLStyleSheet> sheet;
|
||||
if (mDocument) {
|
||||
PRBool haveListeners =
|
||||
nsGenericElement::HasMutationListeners(this,
|
||||
NS_EVENT_BITS_MUTATION_ATTRMODIFIED);
|
||||
PRBool modification = PR_TRUE;
|
||||
nsAutoString oldValueStr;
|
||||
if (haveListeners) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче