Merge beta to m-r. a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 04 Aug 2015 16:39:57 +0200
changeset 328009 6cb7bf2959399d977be0c7dff1b2a746f1c738dc
parent 328008 f6321b14228d627d0c0511e805eabae63457f024 (current diff)
parent 291365 9a114caf7a2932f25b5a854818bf7907d86fbbc4 (diff)
child 328010 7c736ab19b007c19aaf4232f3be29e5790850dec
push id10322
push userdteller@mozilla.com
push dateTue, 02 Feb 2016 12:05:39 +0000
reviewersmerge
milestone40.0
Merge beta to m-r. a=merge
layout/reftests/percent-overflow-sizing/nestedHeight-ref.html
layout/reftests/percent-overflow-sizing/nestedHeight.html
layout/reftests/percent-overflow-sizing/nestedHeightQuirks-ref.html
layout/reftests/percent-overflow-sizing/nestedHeightQuirks.html
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -542,56 +542,34 @@ RestyleManager::RecomputePosition(nsIFra
     return true;
   }
 
   // Fall back to a reflow
   StyleChangeReflow(aFrame, nsChangeHint_NeedReflow);
   return false;
 }
 
-static bool
-HasBoxAncestor(nsIFrame* aFrame)
-{
-  for (nsIFrame* f = aFrame; f; f = f->GetParent()) {
-    if (f->IsBoxFrame()) {
-      return true;
-    }
-  }
-  return false;
-}
-
 void
 RestyleManager::StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint)
 {
   nsIPresShell::IntrinsicDirty dirtyType;
   if (aHint & nsChangeHint_ClearDescendantIntrinsics) {
     NS_ASSERTION(aHint & nsChangeHint_ClearAncestorIntrinsics,
                  "Please read the comments in nsChangeHint.h");
-    NS_ASSERTION(aHint & nsChangeHint_NeedDirtyReflow,
-                 "ClearDescendantIntrinsics requires NeedDirtyReflow");
-    dirtyType = nsIPresShell::eStyleChange;
-  } else if ((aHint & nsChangeHint_UpdateComputedBSize) &&
-             aFrame->HasAnyStateBits(NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)) {
     dirtyType = nsIPresShell::eStyleChange;
   } else if (aHint & nsChangeHint_ClearAncestorIntrinsics) {
     dirtyType = nsIPresShell::eTreeChange;
-  } else if ((aHint & nsChangeHint_UpdateComputedBSize) &&
-             HasBoxAncestor(aFrame)) {
-    // The frame's computed BSize is changing, and we have a box ancestor
-    // whose cached intrinsic height may need to be updated.
-    dirtyType = nsIPresShell::eTreeChange;
   } else {
     dirtyType = nsIPresShell::eResize;
   }
 
   nsFrameState dirtyBits;
   if (aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
     dirtyBits = nsFrameState(0);
-  } else if ((aHint & nsChangeHint_NeedDirtyReflow) ||
-             dirtyType == nsIPresShell::eStyleChange) {
+  } else if (aHint & nsChangeHint_NeedDirtyReflow) {
     dirtyBits = NS_FRAME_IS_DIRTY;
   } else {
     dirtyBits = NS_FRAME_HAS_DIRTY_CHILDREN;
   }
 
   // If we're not going to clear any intrinsic sizes on the frames, and
   // there are no dirty bits to set, then there's nothing to do.
   if (dirtyType == nsIPresShell::eResize && !dirtyBits)
@@ -4248,17 +4226,16 @@ RestyleManager::ChangeHintToString(nsCha
     "ClearDescendantIntrinsics", "NeedDirtyReflow", "SyncFrameView",
     "UpdateCursor", "UpdateEffects", "UpdateOpacityLayer",
     "UpdateTransformLayer", "ReconstructFrame", "UpdateOverflow",
     "UpdateSubtreeOverflow", "UpdatePostTransformOverflow",
     "UpdateParentOverflow",
     "ChildrenOnlyTransform", "RecomputePosition", "AddOrRemoveTransform",
     "BorderStyleNoneChange", "UpdateTextPath", "SchedulePaint",
     "NeutralChange", "InvalidateRenderingObservers"
-    "ReflowChangesSizeOrPosition", "UpdateComputedBSize"
   };
   uint32_t hint = aHint & ((1 << ArrayLength(names)) - 1);
   uint32_t rest = aHint & ~((1 << ArrayLength(names)) - 1);
   if (hint == nsChangeHint_Hints_NotHandledForDescendants) {
     result.AppendLiteral("nsChangeHint_Hints_NotHandledForDescendants");
     hint = 0;
     any = true;
   } else {
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -162,22 +162,17 @@ enum nsChangeHint {
    * different data would be cached information that would be re-calculated
    * to the same values, such as nsStyleBorder::mSubImages.)
    */
   nsChangeHint_NeutralChange = 0x200000,
 
   /**
    * This will cause rendering observers to be invalidated.
    */
-  nsChangeHint_InvalidateRenderingObservers = 0x400000,
-
-  /**
-   * Indicates that the style changes the computed BSize --- e.g. 'height'.
-   */
-  nsChangeHint_UpdateComputedBSize = 0x1000000,
+  nsChangeHint_InvalidateRenderingObservers = 0x400000
 
   // IMPORTANT NOTE: When adding new hints, consider whether you need to
   // add them to NS_HintsNotHandledForDescendantsIn() below.  Please also
   // add them to RestyleManager::ChangeHintToString.
 };
 
 // Redefine these operators to return nothing. This will catch any use
 // of these operators on hints. We should not be using these operators
@@ -232,33 +227,31 @@ inline bool NS_IsHintSubset(nsChangeHint
           nsChangeHint_UpdateOverflow | \
           nsChangeHint_UpdatePostTransformOverflow | \
           nsChangeHint_UpdateParentOverflow | \
           nsChangeHint_ChildrenOnlyTransform | \
           nsChangeHint_RecomputePosition | \
           nsChangeHint_AddOrRemoveTransform | \
           nsChangeHint_BorderStyleNoneChange | \
           nsChangeHint_NeedReflow | \
-          nsChangeHint_ClearAncestorIntrinsics | \
-          nsChangeHint_UpdateComputedBSize)
+          nsChangeHint_ClearAncestorIntrinsics)
 
 inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
   nsChangeHint result = nsChangeHint(aChangeHint & (
     nsChangeHint_UpdateTransformLayer |
     nsChangeHint_UpdateEffects |
     nsChangeHint_InvalidateRenderingObservers |
     nsChangeHint_UpdateOpacityLayer |
     nsChangeHint_UpdateOverflow |
     nsChangeHint_UpdatePostTransformOverflow |
     nsChangeHint_UpdateParentOverflow |
     nsChangeHint_ChildrenOnlyTransform |
     nsChangeHint_RecomputePosition |
     nsChangeHint_AddOrRemoveTransform |
-    nsChangeHint_BorderStyleNoneChange |
-    nsChangeHint_UpdateComputedBSize));
+    nsChangeHint_BorderStyleNoneChange));
 
   if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint) &&
       NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
     // If NeedDirtyReflow is *not* set, then NeedReflow is a
     // non-inherited hint.
     NS_UpdateHint(result, nsChangeHint_NeedReflow);
   }
 
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4265,27 +4265,16 @@ GetIntrinsicCoord(const nsStyleCoord& aS
 }
 
 #undef  DEBUG_INTRINSIC_WIDTH
 
 #ifdef DEBUG_INTRINSIC_WIDTH
 static int32_t gNoiseIndent = 0;
 #endif
 
-static void
-AddStateBitToAncestors(nsIFrame* aFrame, nsFrameState aBit)
-{
-  for (nsIFrame* f = aFrame; f; f = f->GetParent()) {
-    if (f->HasAnyStateBits(aBit)) {
-      break;
-    }
-    f->AddStateBits(aBit);
-  }
-}
-
 /* static */ nscoord
 nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
                                      nsIFrame *aFrame,
                                      IntrinsicISizeType aType,
                                      uint32_t aFlags)
 {
   NS_PRECONDITION(aFrame, "null frame");
   NS_PRECONDITION(aFrame->GetParent(),
@@ -4412,19 +4401,16 @@ nsLayoutUtils::IntrinsicForContainer(nsR
         !(styleMinBSize.GetUnit() == eStyleUnit_Auto ||
           (styleMinBSize.GetUnit() == eStyleUnit_Coord &&
            styleMinBSize.GetCoordValue() == 0)) ||
         styleMaxBSize.GetUnit() != eStyleUnit_None) {
 
       LogicalSize ratio(wm, aFrame->GetIntrinsicRatio());
 
       if (ratio.BSize(wm) != 0) {
-        AddStateBitToAncestors(aFrame,
-            NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE);
-
         nscoord bSizeTakenByBoxSizing = 0;
         switch (boxSizing) {
         case NS_STYLE_BOX_SIZING_BORDER: {
           const nsStyleBorder* styleBorder = aFrame->StyleBorder();
           bSizeTakenByBoxSizing +=
             isVertical ? styleBorder->GetComputedBorder().LeftRight()
                        : styleBorder->GetComputedBorder().TopBottom();
           // fall through
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -8774,35 +8774,17 @@ nsIFrame::SetParent(nsContainerFrame* aP
 
   if (GetStateBits() & (NS_FRAME_HAS_VIEW | NS_FRAME_HAS_CHILD_WITH_VIEW)) {
     for (nsIFrame* f = aParent;
          f && !(f->GetStateBits() & NS_FRAME_HAS_CHILD_WITH_VIEW);
          f = f->GetParent()) {
       f->AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
     }
   }
-
-  if (HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
-    for (nsIFrame* f = aParent; f; f = f->GetParent()) {
-      if (f->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
-        break;
-      }
-      f->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
-    }
-  }
-
-  if (HasAnyStateBits(NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)) {
-    for (nsIFrame* f = aParent; f; f = f->GetParent()) {
-      if (f->HasAnyStateBits(NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)) {
-        break;
-      }
-      f->AddStateBits(NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE);
-    }
-  }
-
+  
   if (HasInvalidFrameInSubtree()) {
     for (nsIFrame* f = aParent;
          f && !f->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);
          f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
       f->AddStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);
     }
   }
 
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -170,21 +170,16 @@ FRAME_STATE_BIT(Generic, 19, NS_FRAME_RE
 // TEXT_IS_IN_TOKEN_MATHML.  That's OK because we only check the
 // NS_FRAME_IS_PUSHED_FLOAT bit on frames which we already know are
 // out-of-flow.
 FRAME_STATE_BIT(Generic, 32, NS_FRAME_IS_PUSHED_FLOAT)
 
 // This bit acts as a loop flag for recursive paint server drawing.
 FRAME_STATE_BIT(Generic, 33, NS_FRAME_DRAWING_AS_PAINTSERVER)
 
-// Intrinsic ISize depending on the frame's BSize is rare but possible.
-// This flag indicates that the frame has (or once had) a descendant in that
-// situation (possibly the frame itself).
-FRAME_STATE_BIT(Generic, 34, NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)
-
 // Frame is a display root and the retained layer tree needs to be updated
 // at the next paint via display list construction.
 // Only meaningful for display roots, so we don't really need a global state
 // bit; we could free up this bit with a little extra complexity.
 FRAME_STATE_BIT(Generic, 36, NS_FRAME_UPDATE_LAYER_TREE)
 
 // Frame can accept absolutely positioned children.
 FRAME_STATE_BIT(Generic, 37, NS_FRAME_HAS_ABSPOS_CHILDREN)
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -496,19 +496,16 @@ nsHTMLScrollFrame::ReflowScrolledFrame(S
   const nsMargin physicalPadding = padding.GetPhysicalMargin(wm);
   kidReflowState.Init(presContext, -1, -1, nullptr,
                       &physicalPadding);
   kidReflowState.mFlags.mAssumingHScrollbar = aAssumeHScroll;
   kidReflowState.mFlags.mAssumingVScrollbar = aAssumeVScroll;
   kidReflowState.SetComputedBSize(computedBSize);
   kidReflowState.ComputedMinBSize() = computedMinBSize;
   kidReflowState.ComputedMaxBSize() = computedMaxBSize;
-  if (aState->mReflowState.IsBResize()) {
-    kidReflowState.SetBResize(true);
-  }
 
   // Temporarily set mHasHorizontalScrollbar/mHasVerticalScrollbar to
   // reflect our assumptions while we reflow the child.
   bool didHaveHorizontalScrollbar = mHelper.mHasHorizontalScrollbar;
   bool didHaveVerticalScrollbar = mHelper.mHasVerticalScrollbar;
   mHelper.mHasHorizontalScrollbar = aAssumeHScroll;
   mHelper.mHasVerticalScrollbar = aAssumeVScroll;
 
deleted file mode 100644
--- a/layout/reftests/percent-overflow-sizing/nestedHeight-ref.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE HTML>
-<body>
-<div id="a" style="overflow:auto; width:200px">
-  <div style="overflow:auto">
-    <div style="background: green; height:100%"></div>
-  </div>
-</div>
-</body>
deleted file mode 100644
--- a/layout/reftests/percent-overflow-sizing/nestedHeight.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE HTML>
-<body onload="document.getElementById('a').style.removeProperty('height');">
-<div id="a" style="overflow:auto; height:200px; width:200px">
-  <div style="overflow:auto">
-    <div style="background: green; height:100%"></div>
-  </div>
-</div>
-</body>
deleted file mode 100644
--- a/layout/reftests/percent-overflow-sizing/nestedHeightQuirks-ref.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!-- Quirks mode -->
-<body>
-<div id="a" style="overflow:auto; width:200px">
-  <div style="overflow:auto">
-    <div style="background: green; height:100%"></div>
-  </div>
-</div>
-</body>
deleted file mode 100644
--- a/layout/reftests/percent-overflow-sizing/nestedHeightQuirks.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!-- Quirks mode -->
-<body onload="document.getElementById('a').style.removeProperty('height');">
-<div id="a" style="overflow:auto; height:200px; width:200px">
-  <div style="overflow:auto">
-    <div style="background: green; height:100%"></div>
-  </div>
-</div>
-</body>
--- a/layout/reftests/percent-overflow-sizing/reftest.list
+++ b/layout/reftests/percent-overflow-sizing/reftest.list
@@ -17,10 +17,8 @@ skip-if(B2G||Mulet) fails-if(Android&&br
 == simpleMinHeight100D.html greenbox.html
 == simpleAbsMinHeightD.html greenbox.html
 skip-if(B2G||Mulet) fails-if(Android&&browserIsRemote) == hScrollSimpleMinHeightD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) fails-if(Android&&browserIsRemote) == hScrollSimpleMinHeightQuirks-1D.html greenboxhbar.html # bug 650591, 732565 # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) fails-if(Android&&browserIsRemote) == hScrollSimpleMinHeightQuirks-3D.html greenboxhbar.html # bug 650591, 732565 # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) fails-if(Android&&browserIsRemote) == hScrollAbsMinHeightD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) fails-if(Android&&browserIsRemote) == hScrollAbsMinHeightQuirksD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
 == dynamicHeight100.html dynamicHeight100-ref.html
-== nestedHeight.html nestedHeight-ref.html
-== nestedHeightQuirks.html nestedHeightQuirks-ref.html
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1592,20 +1592,21 @@ nsChangeHint nsStylePosition::CalcDiffer
     NS_UpdateHint(hint, nsChangeHint_NeedReflow);
   }
 
   if (mHeight != aOther.mHeight ||
       mMinHeight != aOther.mMinHeight ||
       mMaxHeight != aOther.mMaxHeight) {
     // Height changes can affect descendant intrinsic sizes due to replaced
     // elements with percentage heights in descendants which also have
-    // percentage heights. This is handled via nsChangeHint_UpdateComputedBSize
-    // which clears intrinsic sizes for frames that have such replaced elements.
-    return NS_CombineHint(hint, nsChangeHint(nsChangeHint_NeedReflow |
-        nsChangeHint_UpdateComputedBSize));
+    // percentage heights.  And due to our not-so-great computation of mVResize
+    // in nsHTMLReflowState, they do need to force reflow of the whole subtree.
+    // XXXbz due to XUL caching heights as well, height changes also need to
+    // clear ancestor intrinsics!
+    return NS_CombineHint(hint, nsChangeHint_AllReflowHints);
   }
 
   if (mWidth != aOther.mWidth ||
       mMinWidth != aOther.mMinWidth ||
       mMaxWidth != aOther.mMaxWidth) {
     // None of our width differences can affect descendant intrinsic
     // sizes and none of them need to force children to reflow.
     return
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1340,18 +1340,17 @@ struct nsStylePosition {
     aContext->PresShell()->
       FreeByObjectID(nsPresArena::nsStylePosition_id, this);
   }
 
   nsChangeHint CalcDifference(const nsStylePosition& aOther) const;
   static nsChangeHint MaxDifference() {
     return NS_CombineHint(NS_STYLE_HINT_REFLOW,
                           nsChangeHint(nsChangeHint_RecomputePosition |
-                                       nsChangeHint_UpdateParentOverflow |
-                                       nsChangeHint_UpdateComputedBSize));
+                                       nsChangeHint_UpdateParentOverflow));
   }
   static nsChangeHint MaxDifferenceNeverInherited() {
     // CalcDifference can return both nsChangeHint_ClearAncestorIntrinsics and
     // nsChangeHint_NeedReflow as inherited hints.
     return nsChangeHint(0);
   }
 
   // XXXdholbert nsStyleBackground::Position should probably be moved to a
--- a/mobile/android/components/ContentDispatchChooser.js
+++ b/mobile/android/components/ContentDispatchChooser.js
@@ -45,18 +45,32 @@ ContentDispatchChooser.prototype =
     aHandler = this.protoSvc.getProtocolHandlerInfoFromOS(aURI.spec, {});
 
     // The first handler in the set is the Android Application Chooser (which will fall back to a default if one is set)
     // If we have more than one option, let the OS handle showing a list (if needed).
     if (aHandler.possibleApplicationHandlers.length > 1) {
       aHandler.launchWithURI(aURI, aWindowContext);
     } else {
       let win = this._getChromeWin();
-      if (win && win.BrowserApp) {
-        const UNKNOWN_PROTOCOL_URI_PREFIX = "about:neterror?e=unknownProtocolFound&u=";
-        let errorUri = UNKNOWN_PROTOCOL_URI_PREFIX + aURI.spec; // TODO: Is this encoded? Does it need to be?
-        win.BrowserApp.selectedTab.browser.loadURI(errorUri, null, null);
+      if (win && win.NativeWindow) {
+        let bundle = Services.strings.createBundle("chrome://browser/locale/handling.properties");
+        let failedText = bundle.GetStringFromName("protocol.failed");
+        let searchText = bundle.GetStringFromName("protocol.toast.search");
+
+        win.NativeWindow.toast.show(failedText, "long", {
+          button: {
+            label: searchText,
+            callback: function() {
+              let message = {
+                type: "Intent:Open",
+                url: "market://search?q=" + aURI.scheme,
+              };
+
+              Messaging.sendRequest(message);
+            }
+          }
+        });
       }
     }
   },
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentDispatchChooser]);