Bug 1269321: Part 1 - Add a way to check if the current clip has rounded corners. r=mstange
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 30 Jun 2016 18:08:35 +0200
changeset 303331 4e492b8253d4fd9db6d180910cb3463f19551f7c
parent 303330 c9fa564222899eabcfd5e2c00e520359650fb6d1
child 303332 0391921abae7d485e286933948cb1328366121bb
push id30386
push usercbook@mozilla.com
push dateFri, 01 Jul 2016 09:17:55 +0000
treeherdermozilla-central@fdcee57b4e4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1269321
milestone50.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 1269321: Part 1 - Add a way to check if the current clip has rounded corners. r=mstange
layout/base/DisplayItemScrollClip.cpp
layout/base/DisplayItemScrollClip.h
layout/base/DisplayListClipState.h
--- a/layout/base/DisplayItemScrollClip.cpp
+++ b/layout/base/DisplayItemScrollClip.cpp
@@ -22,16 +22,28 @@ DisplayItemScrollClip::IsAncestor(const 
     if (sc == aAncestor) {
       return true;
     }
   }
 
   return false;
 }
 
+bool
+DisplayItemScrollClip::HasRoundedCorners() const
+{
+  for (const DisplayItemScrollClip* scrollClip = this;
+       scrollClip; scrollClip = scrollClip->mParent) {
+    if (scrollClip->mClip->GetRoundedRectCount() > 0) {
+      return true;
+    }
+  }
+  return false;
+}
+
 /* static */ nsCString
 DisplayItemScrollClip::ToString(const DisplayItemScrollClip* aScrollClip)
 {
   nsAutoCString str;
   for (const DisplayItemScrollClip* scrollClip = aScrollClip;
        scrollClip; scrollClip = scrollClip->mParent) {
     str.AppendPrintf("<%s>%s", scrollClip->mClip ? scrollClip->mClip->ToString().get() : "null",
                      scrollClip->mIsAsyncScrollable ? " [async-scrollable]" : "");
--- a/layout/base/DisplayItemScrollClip.h
+++ b/layout/base/DisplayItemScrollClip.h
@@ -85,16 +85,18 @@ public:
                          const DisplayItemScrollClip* aDescendant);
 
   /**
    * Return a string which contains the list of stringified clips for this
    * scroll clip and its ancestors. aScrollClip can be null.
    */
   static nsCString ToString(const DisplayItemScrollClip* aScrollClip);
 
+  bool HasRoundedCorners() const;
+
   /**
    * The previous (outer) scroll clip, or null.
    */
   const DisplayItemScrollClip* mParent;
 
   /**
    * The scrollable frame that this scroll clip is for. Always non-null.
    */
--- a/layout/base/DisplayListClipState.h
+++ b/layout/base/DisplayListClipState.h
@@ -264,16 +264,34 @@ public:
       //      contents" will be set to that scroll clip.
       //  (2) If one of our direct child items is a container item for which
       //      (1) or (2) happened.
       *aOutContainerSC = mState.CurrentAncestorScrollClipForStackingContextContents();
     }
     Restore();
   }
 
+  bool SavedStateHasRoundedCorners()
+  {
+    const DisplayItemScrollClip* scrollClip = mSavedState.GetCurrentInnermostScrollClip();
+    if (scrollClip && scrollClip->HasRoundedCorners()) {
+      return true;
+    }
+    const DisplayItemClip* clip = mSavedState.GetClipForContainingBlockDescendants();
+    if (clip && clip->GetRoundedRectCount() > 0) {
+      return true;
+    }
+
+    clip = mSavedState.GetClipForContentDescendants();
+    if (clip && clip->GetRoundedRectCount() > 0) {
+      return true;
+    }
+    return false;
+  }
+
   void TurnClipIntoScrollClipForContentDescendants(nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
   {
     NS_ASSERTION(!mRestored, "Already restored!");
     mState.TurnClipIntoScrollClipForContentDescendants(aBuilder, aScrollableFrame);
 #ifdef DEBUG
     mClipUsed = true;
 #endif
   }