Bug 1367214, part 1 - Fix nsFrameManager::ChangeStyleContextInMap to work for direct children of a shadow root. r=dholbert draft
authorJonathan Watt <jwatt@jwatt.org>
Mon, 14 Aug 2017 16:00:56 +0100
changeset 646186 9d0db1e26537f7cfeaa17c6d2248aa2afb08f196
parent 645977 cfc37c6651dbe22f949a5f6aae8ea30a50471746
child 646187 d3d8de877ce87e75834fe494bfe11312f25a468c
push id74020
push userjwatt@jwatt.org
push dateMon, 14 Aug 2017 23:03:12 +0000
reviewersdholbert
bugs1367214
milestone57.0a1
Bug 1367214, part 1 - Fix nsFrameManager::ChangeStyleContextInMap to work for direct children of a shadow root. r=dholbert This makes the code for changing the style context consistent with the code for getting and setting a style context. MozReview-Commit-ID: 5uKARvk0hSV
layout/base/nsFrameManager.cpp
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -226,17 +226,19 @@ nsFrameManager::ChangeStyleContextInMap(
 {
   MOZ_ASSERT(aMap, "expecting a map");
 
 #if defined(DEBUG_UNDISPLAYED_MAP) || defined(DEBUG_DISPLAY_BOX_CONTENTS_MAP)
    static int i = 0;
    printf("ChangeStyleContextInMap(%d): p=%p \n", i++, (void *)aContent);
 #endif
 
-  for (UndisplayedNode* node = aMap->GetFirstNode(aContent->GetParent());
+  nsIContent* parent = ParentForUndisplayedMap(aContent);
+
+  for (UndisplayedNode* node = aMap->GetFirstNode(parent);
        node; node = node->getNext()) {
     if (node->mContent == aContent) {
       node->mStyle = aStyleContext;
       return;
     }
   }
 
   MOZ_CRASH("couldn't find the entry to change");