From cb30f027c3390b62fd7d2485a2a75b4fac1bd93b Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Tue, 24 Jun 2014 17:52:19 +0000 Subject: [PATCH] Bug 1025669 - part 0.5, Add LogicalMargin::ApplySkipSides. r=jfkthame --- layout/generic/WritingModes.h | 25 +++++++++++++++++++++++++ layout/generic/nsIFrame.h | 8 -------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/layout/generic/WritingModes.h b/layout/generic/WritingModes.h index 9ff00520eca1..fe1bca8856f4 100644 --- a/layout/generic/WritingModes.h +++ b/layout/generic/WritingModes.h @@ -36,6 +36,15 @@ #define CHECK_WRITING_MODE(param) \ NS_ASSERTION(param == mWritingMode, "writing-mode mismatch") +#define LOGICAL_SIDE_B_START 1 +#define LOGICAL_SIDE_I_START 2 +#define LOGICAL_SIDE_B_END 4 +#define LOGICAL_SIDE_I_END 8 +#define LOGICAL_SIDES_I_BOTH (LOGICAL_SIDE_I_START | LOGICAL_SIDE_I_END) +#define LOGICAL_SIDES_B_BOTH (LOGICAL_SIDE_B_START | LOGICAL_SIDE_B_END) +#define LOGICAL_SIDES_ALL (LOGICAL_SIDE_I_START | LOGICAL_SIDE_I_END | \ + LOGICAL_SIDE_B_START | LOGICAL_SIDE_B_END) + /** * mozilla::WritingMode is an immutable class representing a * writing mode. @@ -833,6 +842,22 @@ public: *this : LogicalMargin(aToMode, GetPhysicalMargin(aFromMode)); } + void ApplySkipSides(int aSkipSides) + { + if (aSkipSides & LOGICAL_SIDE_B_START) { + BStart() = 0; + } + if (aSkipSides & LOGICAL_SIDE_B_END) { + BEnd() = 0; + } + if (aSkipSides & LOGICAL_SIDE_I_START) { + IStart() = 0; + } + if (aSkipSides & LOGICAL_SIDE_I_END) { + IEnd() = 0; + } + } + bool IsEmpty() const { return (mMargin.left == 0 && mMargin.top == 0 && diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 9a8fb93d47cc..3f74bd2bc7ff 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -2315,14 +2315,6 @@ public: * passed in, indicating that it should be used to determine if sides * should be skipped during reflow. */ -#define LOGICAL_SIDE_B_START 1 -#define LOGICAL_SIDE_I_START 2 -#define LOGICAL_SIDE_B_END 4 -#define LOGICAL_SIDE_I_END 8 -#define LOGICAL_SIDES_I_BOTH (LOGICAL_SIDE_I_START | LOGICAL_SIDE_I_END) -#define LOGICAL_SIDES_B_BOTH (LOGICAL_SIDE_B_START | LOGICAL_SIDE_B_END) -#define LOGICAL_SIDES_ALL (LOGICAL_SIDE_I_START | LOGICAL_SIDE_I_END | \ - LOGICAL_SIDE_B_START | LOGICAL_SIDE_B_END) int GetSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const; virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const {