Bug 1326406 Part 5 - Update document about float manager's coordinate space. draft
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 23 Jan 2017 16:37:07 +0800
changeset 466056 3063178e7620c724e2d38d6141100162f291f416
parent 466055 24a44c6f264911e257e92fac4ee9029536fa5c4d
child 466057 6b6143aa3b716849a896367702ad01388f555bdb
push id42771
push userbmo:tlin@mozilla.com
push dateWed, 25 Jan 2017 05:31:10 +0000
bugs1326406
milestone54.0a1
Bug 1326406 Part 5 - Update document about float manager's coordinate space. MozReview-Commit-ID: LJVqs49CSqQ
layout/generic/nsFloatManager.h
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -59,16 +59,22 @@ struct nsFlowAreaRect {
  * nsFloatManager methods should be the containing block's writing mode.
  *
  * However, according to the abstract-to-physical mappings table [2], the
  * 'direction' property of the containing block doesn't affect the
  * interpretation of line-right and line-left. We actually implement this by
  * passing in the writing mode of the block formatting context (BFC), i.e.
  * the of BlockReflowInput's writing mode.
  *
+ * nsFloatManager uses a special logical coordinate space with inline
+ * coordinates on the line-axis and block coordinates on the block-axis
+ * based on the writing mode of the block formatting context. All the
+ * physical types like nsRect, nsPoint, etc. use this coordinate space. See
+ * FloatInfo::mRect for an example.
+ *
  * [1] https://drafts.csswg.org/css-writing-modes/#line-mappings
  * [2] https://drafts.csswg.org/css-writing-modes/#logical-to-physical
  */
 class nsFloatManager {
 public:
   explicit nsFloatManager(nsIPresShell* aPresShell, mozilla::WritingMode aWM);
   ~nsFloatManager();
 
@@ -102,17 +108,17 @@ public:
    * as a delta against the mRect, so repositioning the frame will
    * also reposition the float region.
    */
   static void StoreRegionFor(mozilla::WritingMode aWM,
                              nsIFrame* aFloat,
                              const mozilla::LogicalRect& aRegion,
                              const nsSize& aContainerSize);
 
-  // Structure that stores the current state of a frame manager for
+  // Structure that stores the current state of a float manager for
   // Save/Restore purposes.
   struct SavedState {
     explicit SavedState() {}
   private:
     uint32_t mFloatInfoCount;
     nscoord mLineLeft, mBlockStart;
     bool mPushedLeftFloatPastBreak;
     bool mPushedRightFloatPastBreak;
@@ -510,20 +516,20 @@ private:
 
 #ifdef NS_BUILD_REFCNT_LOGGING
     FloatInfo(FloatInfo&& aOther);
     ~FloatInfo();
 #endif
 
     // NB! This is really a logical rect in a writing mode suitable for
     // placing floats, which is not necessarily the actual writing mode
-    // either of the block which created the frame manager or the block
-    // that is calling the frame manager. The inline coordinates are in
-    // the line-relative axis of the frame manager and its block
-    // coordinates are in the frame manager's real block direction.
+    // either of the block which created the float manager or the block
+    // that is calling the float manager. The inline coordinates are in
+    // the line-relative axis of the float manager and its block
+    // coordinates are in the float manager's block direction.
     nsRect mRect;
     // Pointer to a concrete subclass of ShapeInfo or null, which means that
     // there is no shape-outside.
     mozilla::UniquePtr<ShapeInfo> mShapeInfo;
   };
 
 #ifdef DEBUG
   // Store the writing mode from the block frame which establishes the block