Bug 1699327 - Add nsIFrame::GetMarginRect(), and comparison operators for LogicalMargin. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D107935
This commit is contained in:
Ting-Yu Lin 2021-03-18 01:06:03 +00:00
parent 3a2795a286
commit 8c90a87873
3 changed files with 15 additions and 0 deletions

View File

@ -1429,6 +1429,16 @@ class LogicalMargin {
mMargin.bottom == 0);
}
bool operator==(const LogicalMargin& aMargin) const {
CHECK_WRITING_MODE(aMargin.GetWritingMode());
return mMargin == aMargin.mMargin;
}
bool operator!=(const LogicalMargin& aMargin) const {
CHECK_WRITING_MODE(aMargin.GetWritingMode());
return mMargin != aMargin.mMargin;
}
LogicalMargin operator+(const LogicalMargin& aMargin) const {
CHECK_WRITING_MODE(aMargin.GetWritingMode());
return LogicalMargin(GetWritingMode(), BStart() + aMargin.BStart(),

View File

@ -1692,6 +1692,10 @@ WritingMode nsIFrame::WritingModeForLine(WritingMode aSelfWM,
return writingMode;
}
nsRect nsIFrame::GetMarginRect() const {
return GetMarginRectRelativeToSelf() + GetPosition();
}
nsRect nsIFrame::GetMarginRectRelativeToSelf() const {
nsMargin m = GetUsedMargin().ApplySkipSides(GetSkipSides());
nsRect r(0, 0, mRect.width, mRect.height);

View File

@ -1071,6 +1071,7 @@ class nsIFrame : public nsQueryFrame {
nsRect GetPaddingRectRelativeToSelf() const;
nsRect GetContentRect() const;
nsRect GetContentRectRelativeToSelf() const;
nsRect GetMarginRect() const;
nsRect GetMarginRectRelativeToSelf() const;
/**