Bug 1400618 part 3 - Don't let <area>s mess up the frame's IsPrimaryFrame bit, since the frame is actually owned by the <img>. r=bz
authorMats Palmgren <mats@mozilla.com>
Tue, 07 Nov 2017 01:20:34 +0100
changeset 443694 50c2aba68909c45c8136fd5ba20865e9c0309b87
parent 443693 9a72b179c10dc970bd708ebfa551c8010e26d921
child 443695 82659642e0583a8e493bea4f0a7bfb75dc48accd
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1400618
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1400618 part 3 - Don't let <area>s mess up the frame's IsPrimaryFrame bit, since the frame is actually owned by the <img>. r=bz MozReview-Commit-ID: 7afxM9sWmiA
dom/base/nsIContentInlines.h
--- a/dom/base/nsIContentInlines.h
+++ b/dom/base/nsIContentInlines.h
@@ -29,19 +29,25 @@ nsIContent::IsInChromeDocument() const
 inline void
 nsIContent::SetPrimaryFrame(nsIFrame* aFrame)
 {
   MOZ_ASSERT(IsInUncomposedDoc() || IsInShadowTree(), "This will end badly!");
   NS_PRECONDITION(!aFrame || !mPrimaryFrame || aFrame == mPrimaryFrame,
                   "Losing track of existing primary frame");
 
   if (aFrame) {
-    aFrame->SetIsPrimaryFrame(true);
+    if (MOZ_LIKELY(!IsHTMLElement(nsGkAtoms::area)) ||
+        aFrame->GetContent() == this) {
+      aFrame->SetIsPrimaryFrame(true);
+    }
   } else if (nsIFrame* currentPrimaryFrame = GetPrimaryFrame()) {
-    currentPrimaryFrame->SetIsPrimaryFrame(false);
+    if (MOZ_LIKELY(!IsHTMLElement(nsGkAtoms::area)) ||
+        currentPrimaryFrame->GetContent() == this) {
+      currentPrimaryFrame->SetIsPrimaryFrame(false);
+    }
   }
 
   mPrimaryFrame = aFrame;
 }
 
 inline mozilla::dom::ShadowRoot* nsIContent::GetShadowRoot() const
 {
   if (!IsElement()) {