Add some more logical getters to nsIFrame.h. Bug 735577, r=jfkthame

This commit is contained in:
Simon Montagu 2014-04-16 01:03:30 -07:00
parent f8a68ec80e
commit f3f1e4c964
2 changed files with 41 additions and 0 deletions

View File

@ -839,6 +839,24 @@ public:
mMargin.right == 0 && mMargin.bottom == 0);
}
LogicalMargin operator+(const LogicalMargin& aMargin) {
CHECK_WRITING_MODE(aMargin.GetWritingMode());
return LogicalMargin(GetWritingMode(),
BStart() + aMargin.BStart(),
IEnd() + aMargin.IEnd(),
BEnd() + aMargin.BEnd(),
IStart() + aMargin.IStart());
}
LogicalMargin operator-(const LogicalMargin& aMargin) {
CHECK_WRITING_MODE(aMargin.GetWritingMode());
return LogicalMargin(GetWritingMode(),
BStart() - aMargin.BStart(),
IEnd() - aMargin.IEnd(),
BEnd() - aMargin.BEnd(),
IStart() - aMargin.IStart());
}
private:
friend class LogicalRect;

View File

@ -811,6 +811,13 @@ public:
* Return frame's position without relative positioning
*/
nsPoint GetNormalPosition() const;
mozilla::LogicalPoint
GetLogicalNormalPosition(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const
{
return mozilla::LogicalPoint(aWritingMode,
GetNormalPosition(), aContainerWidth);
}
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)
{ return aChild->GetPosition(); }
@ -908,6 +915,10 @@ public:
* having their original values.
*/
virtual nsMargin GetUsedMargin() const;
virtual mozilla::LogicalMargin
GetLogicalUsedMargin(mozilla::WritingMode aWritingMode) const {
return mozilla::LogicalMargin(aWritingMode, GetUsedMargin());
}
/**
* Return the distance between the border edge of the frame (which is
@ -920,6 +931,10 @@ public:
* for tables, particularly border-collapse tables.
*/
virtual nsMargin GetUsedBorder() const;
virtual mozilla::LogicalMargin
GetLogicalUsedBorder(mozilla::WritingMode aWritingMode) const {
return mozilla::LogicalMargin(aWritingMode, GetUsedBorder());
}
/**
* Return the distance between the padding edge of the frame and the
@ -927,10 +942,18 @@ public:
* as of the most recent reflow.
*/
virtual nsMargin GetUsedPadding() const;
virtual mozilla::LogicalMargin
GetLogicalUsedPadding(mozilla::WritingMode aWritingMode) const {
return mozilla::LogicalMargin(aWritingMode, GetUsedPadding());
}
nsMargin GetUsedBorderAndPadding() const {
return GetUsedBorder() + GetUsedPadding();
}
mozilla::LogicalMargin
GetLogicalUsedBorderAndPadding(mozilla::WritingMode aWritingMode) const {
return mozilla::LogicalMargin(aWritingMode, GetUsedBorderAndPadding());
}
/**
* Apply the result of GetSkipSides() on this frame to an nsMargin by