Bug 1596339 Part 2 - Implement operator<< for LogicalRect, and use it in frame tree dump. r=dholbert

This change uses parentheses, i.e. '(' and ')', to enclose the dimension
of LogicalRect. This match the output of BaseRect's operator<<.

Note: This introduces inconsistency in the frame tree dump because some
of the output format still use braces to enclose the data. But in later
patches, I'll gradually change the format to use parentheses.

Differential Revision: https://phabricator.services.mozilla.com/D52963

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2019-11-15 03:51:56 +00:00
Родитель 198f20c438
Коммит 9b33cffdf0
3 изменённых файлов: 11 добавлений и 7 удалений

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

@ -1825,6 +1825,12 @@ class LogicalRect {
return mISize > 0 && mBSize > 0; return mISize > 0 && mBSize > 0;
} }
friend std::ostream& operator<<(std::ostream& aStream,
const LogicalRect& aRect) {
return aStream << '(' << aRect.IStart() << ',' << aRect.BStart() << ','
<< aRect.ISize() << ',' << aRect.BSize() << ')';
}
private: private:
LogicalRect() = delete; LogicalRect() = delete;

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

@ -7857,10 +7857,9 @@ void nsIFrame::ListGeneric(nsACString& aTo, const char* aPrefix,
if (pWM.IsVertical() || pWM.IsBidiRTL()) { if (pWM.IsVertical() || pWM.IsBidiRTL()) {
nsSize containerSize = parent->mRect.Size(); nsSize containerSize = parent->mRect.Size();
LogicalRect lr(pWM, mRect, containerSize); LogicalRect lr(pWM, mRect, containerSize);
aTo += nsPrintfCString( aTo += nsPrintfCString(" parent-wm=%s cs={%d,%d} logical-rect=%s",
" parent-wm=%s cs={%d,%d} logical-rect={%d,%d,%d,%d}", ToString(pWM).c_str(), containerSize.width,
ToString(pWM).c_str(), containerSize.width, containerSize.height, containerSize.height, ToString(lr).c_str());
lr.IStart(pWM), lr.BStart(pWM), lr.ISize(pWM), lr.BSize(pWM));
} }
} }
nsIFrame* f = const_cast<nsIFrame*>(this); nsIFrame* f = const_cast<nsIFrame*>(this);

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

@ -245,10 +245,9 @@ void nsLineBox::List(FILE* out, const char* aPrefix, uint32_t aFlags) const {
str += nsPrintfCString("{%d,%d,%d,%d} ", bounds.x, bounds.y, bounds.width, str += nsPrintfCString("{%d,%d,%d,%d} ", bounds.x, bounds.y, bounds.width,
bounds.height); bounds.height);
if (mWritingMode.IsVertical() || mWritingMode.IsBidiRTL()) { if (mWritingMode.IsVertical() || mWritingMode.IsBidiRTL()) {
str += nsPrintfCString("wm=%s cs={%d,%d} logical-rect={%d,%d,%d,%d} ", str += nsPrintfCString("wm=%s cs={%d,%d} logical-rect=%s ",
ToString(mWritingMode).c_str(), mContainerSize.width, ToString(mWritingMode).c_str(), mContainerSize.width,
mContainerSize.height, IStart(), BStart(), ISize(), mContainerSize.height, ToString(mBounds).c_str());
BSize());
} }
if (mData && if (mData &&
(!mData->mOverflowAreas.VisualOverflow().IsEqualEdges(bounds) || (!mData->mOverflowAreas.VisualOverflow().IsEqualEdges(bounds) ||