Bug 1025669 - part 0.5, Add LogicalMargin::ApplySkipSides. r=jfkthame

This commit is contained in:
Mats Palmgren 2014-06-24 17:52:19 +00:00
Родитель 3e13115cf3
Коммит cb30f027c3
2 изменённых файлов: 25 добавлений и 8 удалений

Просмотреть файл

@ -36,6 +36,15 @@
#define CHECK_WRITING_MODE(param) \ #define CHECK_WRITING_MODE(param) \
NS_ASSERTION(param == mWritingMode, "writing-mode mismatch") 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 * mozilla::WritingMode is an immutable class representing a
* writing mode. * writing mode.
@ -833,6 +842,22 @@ public:
*this : LogicalMargin(aToMode, GetPhysicalMargin(aFromMode)); *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 bool IsEmpty() const
{ {
return (mMargin.left == 0 && mMargin.top == 0 && return (mMargin.left == 0 && mMargin.top == 0 &&

Просмотреть файл

@ -2315,14 +2315,6 @@ public:
* passed in, indicating that it should be used to determine if sides * passed in, indicating that it should be used to determine if sides
* should be skipped during reflow. * 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; int GetSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const;
virtual int virtual int
GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const { GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const {