From 50f80eb8ba3e1997ad334576d9fbab94434f2cea Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Wed, 23 Nov 2016 18:07:56 +0800 Subject: [PATCH] Bug 1319672 Part 1 - Add document related to writing-mode in nsFloatManager. r=dbaron MozReview-Commit-ID: 2Sr7UU6BQ9r --HG-- extra : rebase_source : 50840b749cf045221af9680dc3538406f0936286 --- layout/generic/nsFloatManager.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/layout/generic/nsFloatManager.h b/layout/generic/nsFloatManager.h index 1b2aafc194cf..3f65bda04c35 100644 --- a/layout/generic/nsFloatManager.h +++ b/layout/generic/nsFloatManager.h @@ -45,6 +45,26 @@ struct nsFlowAreaRect { #define NS_FLOAT_MANAGER_CACHE_SIZE 4 +/** + * nsFloatManager is responsible for implementing CSS's rules for + * positioning floats. An nsFloatManager object is created during reflow for + * any block with NS_BLOCK_FLOAT_MGR. During reflow, the float manager for + * the nearest such ancestor block is found in ReflowInput::mFloatManager. + * + * According to the line-relative mappings in CSS Writing Modes spec [1], + * line-right and line-left are calculated with respect to the writing mode + * of the containing block of the floats. All the writing modes passed to + * 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. + * + * [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); @@ -385,6 +405,8 @@ private: }; #ifdef DEBUG + // Store the writing mode from the block frame which establishes the block + // formatting context (BFC) when the nsFloatManager is created. mozilla::WritingMode mWritingMode; #endif