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 464898 78ea31ae29f97736dac2f6f11749f99198cd6ac7
parent 464897 05989a2f40cc87e8aa03f6a1ef1a077a827671ab
child 464899 6e79d41e7f295ac0de07e8cca0d92341fd989bb9
push id42480
push userbmo:tlin@mozilla.com
push dateMon, 23 Jan 2017 09:21:26 +0000
bugs1326406
milestone53.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 that its inline
+ * coordinates are on the line-axis and its block coordinates are on the
+ * block-axis of 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