Bug 976533 - In case there is are both a MixBlendMode and BlendContainer wrapping the same stacking display list, reverse the order so that the BlendContainer comes first. This way, it will not isolate the legitimate MixBlendMode item. r=roc
authorHoria Iosif Olaru <olaru@adobe.com>
Fri, 28 Feb 2014 09:11:37 -0500
changeset 171505 3bbd029605a2533a891b8202c465e7d0ae017e59
parent 171504 f754248008d0be284782f33620d9f93d17821154
child 171506 43137b4b4b2a3a2ff37456063274ef93a298d03a
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersroc
bugs976533
milestone30.0a1
Bug 976533 - In case there is are both a MixBlendMode and BlendContainer wrapping the same stacking display list, reverse the order so that the BlendContainer comes first. This way, it will not isolate the legitimate MixBlendMode item. r=roc
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2024,30 +2024,38 @@ nsIFrame::BuildDisplayListForStackingCon
     if (Preserves3DChildren()) {
       WrapPreserve3DList(this, aBuilder, &resultList);
     } else {
       resultList.AppendNewToTop(
         new (aBuilder) nsDisplayTransform(aBuilder, this, &resultList));
     }
   }
 
+  /* If adding both a nsDisplayBlendContainer and a nsDisplayMixBlendMode to the
+   * same list, the nsDisplayBlendContainer should be added first. This only
+   * happens when the element creating this stacking context has mix-blend-mode
+   * and also contains a child which has mix-blend-mode.
+   * The nsDisplayBlendContainer must be added to the list first, so it does not
+   * isolate the containing element blending as well.
+   */
+
+  if (aBuilder->ContainsBlendMode()) {
+      resultList.AppendNewToTop(
+        new (aBuilder) nsDisplayBlendContainer(aBuilder, this, &resultList));
+  }
+
   /* If there's blending, wrap up the list in a blend-mode item. Note
    * that opacity can be applied before blending as the blend color is
    * not affected by foreground opacity (only background alpha).
    */
 
   if (useBlendMode && !resultList.IsEmpty()) {
     resultList.AppendNewToTop(
         new (aBuilder) nsDisplayMixBlendMode(aBuilder, this, &resultList));
   }
-  
-  if (aBuilder->ContainsBlendMode()) {
-      resultList.AppendNewToTop(
-        new (aBuilder) nsDisplayBlendContainer(aBuilder, this, &resultList));
-  }
 
   CreateOwnLayerIfNeeded(aBuilder, &resultList);
 
   aList->AppendToTop(&resultList);
 }
 
 static nsDisplayItem*
 WrapInWrapList(nsDisplayListBuilder* aBuilder,