Bug 851025 - Remove nsLayoutUtils::RectListBuilder::mRv; r=bz
authorMs2ger <ms2ger@gmail.com>
Sun, 17 Mar 2013 08:55:16 +0100
changeset 135435 03d31990c12b3a9e04757d950f602509be64355f
parent 135434 15452886f54eb55604b2b1c9bffa79144662f554
child 135436 08747ec5e575218c9cd2ac76162fbb21d33dda33
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs851025
milestone22.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 851025 - Remove nsLayoutUtils::RectListBuilder::mRv; r=bz
content/base/public/Element.h
content/base/src/Element.cpp
content/base/src/nsRange.cpp
content/base/src/nsRange.h
dom/webidl/Element.webidl
dom/webidl/Range.webidl
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -652,17 +652,17 @@ public:
   already_AddRefed<nsIDOMAttr> RemoveAttributeNode(nsIDOMAttr* aOldAttr,
                                                    ErrorResult& aError);
   nsIDOMAttr* GetAttributeNodeNS(const nsAString& aNamespaceURI,
                                  const nsAString& aLocalName,
                                  ErrorResult& aError);
   already_AddRefed<nsIDOMAttr> SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
                                                   ErrorResult& aError);
 
-  already_AddRefed<nsClientRectList> GetClientRects(ErrorResult& aError);
+  already_AddRefed<nsClientRectList> GetClientRects();
   already_AddRefed<nsClientRect> GetBoundingClientRect();
   void ScrollIntoView(bool aTop);
   int32_t ScrollTop()
   {
     nsIScrollableFrame* sf = GetScrollFrame();
     return sf ? sf->GetScrollPositionCSSPixels().y : 0;
   }
   void SetScrollTop(int32_t aScrollTop)
@@ -1502,19 +1502,18 @@ NS_IMETHOD GetOnmouseleave(JSContext* cx
 }                                                                             \
 NS_IMETHOD SetOnmouseleave(JSContext* cx,                                     \
                            const JS::Value& aOnmouseleave) MOZ_FINAL          \
 {                                                                             \
   return Element::SetOnmouseleave(cx, aOnmouseleave);                         \
 }                                                                             \
 NS_IMETHOD GetClientRects(nsIDOMClientRectList** _retval) MOZ_FINAL           \
 {                                                                             \
-  mozilla::ErrorResult rv;                                                    \
-  *_retval = Element::GetClientRects(rv).get();                               \
-  return rv.ErrorCode();                                                      \
+  *_retval = Element::GetClientRects().get();                                 \
+  return NS_OK;                                                               \
 }                                                                             \
 NS_IMETHOD GetBoundingClientRect(nsIDOMClientRect** _retval) MOZ_FINAL        \
 {                                                                             \
   *_retval = Element::GetBoundingClientRect().get();                          \
   return NS_OK;                                                               \
 }                                                                             \
 NS_IMETHOD GetScrollTop(int32_t* aScrollTop) MOZ_FINAL                        \
 {                                                                             \
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -665,34 +665,30 @@ Element::GetBoundingClientRect()
   nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(frame,
           nsLayoutUtils::GetContainingBlockForClientRect(frame),
           nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
   rect->SetLayoutRect(r);
   return rect.forget();
 }
 
 already_AddRefed<nsClientRectList>
-Element::GetClientRects(ErrorResult& aError)
+Element::GetClientRects()
 {
   nsRefPtr<nsClientRectList> rectList = new nsClientRectList(this);
 
   nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
   if (!frame) {
     // display:none, perhaps? Return an empty list
     return rectList.forget();
   }
 
   nsLayoutUtils::RectListBuilder builder(rectList);
   nsLayoutUtils::GetAllInFlowRects(frame,
           nsLayoutUtils::GetContainingBlockForClientRect(frame), &builder,
           nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
-  if (NS_FAILED(builder.mRV)) {
-    aError.Throw(builder.mRV);
-    return nullptr;
-  }
   return rectList.forget();
 }
 
 
 //----------------------------------------------------------------------
 
 
 void
--- a/content/base/src/nsRange.cpp
+++ b/content/base/src/nsRange.cpp
@@ -2953,39 +2953,34 @@ nsRange::GetBoundingClientRect()
     accumulator.mResultRect;
   rect->SetLayoutRect(r);
   return rect.forget();
 }
 
 NS_IMETHODIMP
 nsRange::GetClientRects(nsIDOMClientRectList** aResult)
 {
-  ErrorResult rv;
-  *aResult = GetClientRects(rv).get();
-  return rv.ErrorCode();
+  *aResult = GetClientRects().get();
+  return NS_OK;
 }
 
 already_AddRefed<nsClientRectList>
-nsRange::GetClientRects(ErrorResult& rv)
+nsRange::GetClientRects()
 {
-  if (!mStartParent)
+  if (!mStartParent) {
     return nullptr;
+  }
 
   nsRefPtr<nsClientRectList> rectList =
     new nsClientRectList(static_cast<nsIDOMRange*>(this));
 
   nsLayoutUtils::RectListBuilder builder(rectList);
 
   CollectClientRects(&builder, this, mStartParent, mStartOffset, 
     mEndParent, mEndOffset);
-
-  if (NS_FAILED(builder.mRV)) {
-    rv.Throw(builder.mRV);
-    return nullptr;
-  }
   return rectList.forget();
 }
 
 NS_IMETHODIMP
 nsRange::GetUsedFontFaces(nsIDOMFontFaceList** aResult)
 {
   *aResult = nullptr;
 
--- a/content/base/src/nsRange.h
+++ b/content/base/src/nsRange.h
@@ -188,17 +188,17 @@ public:
   void SetEnd(nsINode& aNode, uint32_t aOffset, ErrorResult& aErr);
   void SetEndAfter(nsINode& aNode, ErrorResult& aErr);
   void SetEndBefore(nsINode& aNode, ErrorResult& aErr);
   void SetStart(nsINode& aNode, uint32_t aOffset, ErrorResult& aErr);
   void SetStartAfter(nsINode& aNode, ErrorResult& aErr);
   void SetStartBefore(nsINode& aNode, ErrorResult& aErr);
   void SurroundContents(nsINode& aNode, ErrorResult& aErr);
   already_AddRefed<nsIDOMClientRect> GetBoundingClientRect();
-  already_AddRefed<nsClientRectList> GetClientRects(ErrorResult& aErr);
+  already_AddRefed<nsClientRectList> GetClientRects();
 
   nsINode* GetParentObject() const { return mOwner; }
   virtual JSObject* WrapObject(JSContext* cx, JSObject* scope) MOZ_OVERRIDE MOZ_FINAL;
 
 private:
   // no copy's or assigns
   nsRange(const nsRange&);
   nsRange& operator=(const nsRange&);
--- a/dom/webidl/Element.webidl
+++ b/dom/webidl/Element.webidl
@@ -143,17 +143,16 @@ interface Element : Node {
   [Throws]
   Attr getAttributeNodeNS(DOMString? namespaceURI, DOMString localName);
   [Throws]
   Attr setAttributeNodeNS(Attr newAttr);
 };
 
 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
 partial interface Element {
-  [Throws]
   ClientRectList getClientRects();
   ClientRect getBoundingClientRect();
 
   // scrolling
   void scrollIntoView(optional boolean top = true);
   // None of the CSSOM attributes are [Pure], because they flush
            attribute long scrollTop;   // scroll on setting
            attribute long scrollLeft;  // scroll on setting
--- a/dom/webidl/Range.webidl
+++ b/dom/webidl/Range.webidl
@@ -79,12 +79,11 @@ interface Range {
 // http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
 partial interface Range {
   [Throws]
   DocumentFragment createContextualFragment(DOMString fragment);
 };
 
 // http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
 partial interface Range {
-  [Throws]
-  ClientRectList getClientRects();
+  ClientRectList? getClientRects();
   ClientRect getBoundingClientRect();
 };
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2256,17 +2256,19 @@ void nsLayoutUtils::RectAccumulator::Add
   mResultRect.UnionRect(mResultRect, aRect);
   if (!mSeenFirstRect) {
     mSeenFirstRect = true;
     mFirstRect = aRect;
   }
 }
 
 nsLayoutUtils::RectListBuilder::RectListBuilder(nsClientRectList* aList)
-  : mRectList(aList), mRV(NS_OK) {}
+  : mRectList(aList)
+{
+}
 
 void nsLayoutUtils::RectListBuilder::AddRect(const nsRect& aRect) {
   nsRefPtr<nsClientRect> rect = new nsClientRect();
 
   rect->SetLayoutRect(aRect);
   mRectList->Append(rect);
 }
 
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -771,20 +771,19 @@ public:
 
     RectAccumulator();
 
     virtual void AddRect(const nsRect& aRect);
   };
 
   struct RectListBuilder : public RectCallback {
     nsClientRectList* mRectList;
-    nsresult          mRV;
 
     RectListBuilder(nsClientRectList* aList);
-     virtual void AddRect(const nsRect& aRect);
+    virtual void AddRect(const nsRect& aRect);
   };
 
   static nsIFrame* GetContainingBlockForClientRect(nsIFrame* aFrame);
 
   enum {
     RECTS_ACCOUNT_FOR_TRANSFORMS = 0x01
   };
   /**