Bug 1117227 part 1 - Add IntersectRect method to LogicalRect. r=jfkthame
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 24 Apr 2015 10:15:32 +1200
changeset 240822 b76fcf24a2f7ec833425f7a7171ca3333adfe366
parent 240821 f65d5df4138be9f16d64346ed123442e5185cd09
child 240823 303979c9c80d53436b39ffdd1c6d332471e43292
push id58940
push userxquan@mozilla.com
push dateThu, 23 Apr 2015 22:19:58 +0000
treeherdermozilla-inbound@58f1b4f600d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1117227
milestone40.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 1117227 part 1 - Add IntersectRect method to LogicalRect. r=jfkthame
layout/generic/WritingModes.h
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -1726,16 +1726,27 @@ public:
                         nscoord aContainerWidth) const
   {
     CHECK_WRITING_MODE(aFromMode);
     return aToMode == aFromMode ?
       *this : LogicalRect(aToMode, GetPhysicalRect(aFromMode, aContainerWidth),
                           aContainerWidth);
   }
 
+  /**
+   * Set *this to be the rectangle containing the intersection of aRect1
+   * and aRect2, return whether the intersection is non-empty.
+   */
+  bool IntersectRect(const LogicalRect& aRect1, const LogicalRect& aRect2)
+  {
+    CHECK_WRITING_MODE(aRect1.mWritingMode);
+    CHECK_WRITING_MODE(aRect2.mWritingMode);
+    return mRect.IntersectRect(aRect1.mRect, aRect2.mRect);
+  }
+
 private:
   LogicalRect() = delete;
 
 #ifdef DEBUG
   WritingMode GetWritingMode() const { return mWritingMode; }
 #else
   WritingMode GetWritingMode() const { return WritingMode::Unknown(); }
 #endif