diff --git a/dom/base/IDTracker.cpp b/dom/base/IDTracker.cpp index 356bf484a2a46..1f4513611bde7 100644 --- a/dom/base/IDTracker.cpp +++ b/dom/base/IDTracker.cpp @@ -17,6 +17,24 @@ h # include " +mozilla +/ +dom +/ +DocumentOrShadowRoot +. +h +" +# +include +" +nsAtom +. +h +" +# +include +" nsContentUtils . h @@ -49,6 +67,13 @@ nsCycleCollectionParticipant . h " +# +include +" +nsStringFwd +. +h +" namespace mozilla { @@ -56,13 +81,58 @@ namespace dom { static +Element +* +LookupElement +( +DocumentOrShadowRoot +& +aDocOrShadow +const +nsAString +& +aRef +bool +aReferenceImage +) +{ +if +( +aReferenceImage +) +{ +return +aDocOrShadow +. +LookupImageElement +( +aRef +) +; +} +return +aDocOrShadow +. +GetElementById +( +aRef +) +; +} +static DocumentOrShadowRoot * -DocOrShadowFromContent +FindTreeToWatch ( nsIContent & aContent +const +nsAString +& +aID +bool +aReferenceImage ) { ShadowRoot @@ -97,6 +167,21 @@ use ) ) { +if +( +LookupElement +( +* +shadow +aID +aReferenceImage +) +) +{ +return +shadow +; +} shadow = shadow @@ -204,16 +289,6 @@ OwnerDoc ( ) ; -DocumentOrShadowRoot -* -docOrShadow -= -DocOrShadowFromContent -( -* -aFromContent -) -; auto encoding = @@ -319,6 +394,10 @@ GetDocumentURI isEqualExceptRef ) ; +DocumentOrShadowRoot +* +docOrShadow +; if ( NS_FAILED @@ -404,6 +483,19 @@ observer ; } } +else +{ +docOrShadow += +FindTreeToWatch +( +* +aFromContent +ref +aReferenceImage +) +; +} if ( aWatch @@ -464,23 +556,28 @@ mReferencingImage = false ; +nsDependentAtomString +str +( +aID +) +; DocumentOrShadowRoot * docOrShadow = -DocOrShadowFromContent +FindTreeToWatch ( aFrom +str +false ) ; HaveNewDocumentOrShadowRoot ( docOrShadow aWatch -nsDependentAtomString -( -aID -) +str ) ; } @@ -551,31 +648,19 @@ aDocOrShadow return ; } +if +( Element * e = -mReferencingImage -? -aDocOrShadow -- -> -LookupImageElement +LookupElement ( -aRef -) -: +* aDocOrShadow -- -> -GetElementById -( aRef +mReferencingImage ) -; -if -( -e ) { mElement @@ -877,7 +962,8 @@ aData { NS_ASSERTION ( -PL_strcmp +! +strcmp ( aTopic " @@ -890,9 +976,6 @@ document created " ) -= -= -0 " Unexpected topic diff --git a/layout/reftests/svg/fragid-shadow-7.html b/layout/reftests/svg/fragid-shadow-7.html index d66143d7665f1..501a8d2196ac3 100644 --- a/layout/reftests/svg/fragid-shadow-7.html +++ b/layout/reftests/svg/fragid-shadow-7.html @@ -155,7 +155,7 @@ fill = " -lime +red " width = @@ -204,7 +204,7 @@ fill = " -red +lime " width = diff --git a/layout/reftests/svg/fragid-shadow-8.html b/layout/reftests/svg/fragid-shadow-8.html index 51b05cf2655b7..6771b868dbddc 100644 --- a/layout/reftests/svg/fragid-shadow-8.html +++ b/layout/reftests/svg/fragid-shadow-8.html @@ -42,7 +42,7 @@ fill = " -lime +red " width = @@ -91,7 +91,7 @@ fill = " -red +lime " width =