Bug 1931447 - Output scroll anchor logs in CSS units. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D229066
This commit is contained in:
Hiroyuki Ikezoe
2024-11-15 22:07:43 +00:00
parent c9573ccf0a
commit d3748fa0ce

View File

@@ -303,7 +303,8 @@ void ScrollAnchorContainer::SelectAnchor() {
// Calculate the position to use for scroll adjustments
if (mAnchorNode) {
mLastAnchorOffset = FindScrollAnchoringBoundingOffset(Frame(), mAnchorNode);
ANCHOR_LOG("Using last anchor offset = %d.\n", mLastAnchorOffset);
ANCHOR_LOG("Using last anchor offset = %s.\n",
ToString(CSSPixel::FromAppUnits(mLastAnchorOffset)).c_str());
} else {
mLastAnchorOffset = 0;
}
@@ -496,7 +497,9 @@ void ScrollAnchorContainer::ApplyAdjustments() {
nscoord logicalAdjustment = current - mLastAnchorOffset;
WritingMode writingMode = Frame()->GetWritingMode();
ANCHOR_LOG("Anchor has moved from %d to %d.\n", mLastAnchorOffset, current);
ANCHOR_LOG("Anchor has moved from %s to %s.\n",
ToString(CSSPixel::FromAppUnits(mLastAnchorOffset)).c_str(),
ToString(CSSPixel::FromAppUnits(current)).c_str());
auto maybeInvalidate = MakeScopeExit([&] {
if (mAnchorMightBeSubOptimal &&
@@ -521,8 +524,9 @@ void ScrollAnchorContainer::ApplyAdjustments() {
return;
}
ANCHOR_LOG("Applying anchor adjustment of %d in %s with anchor %p.\n",
logicalAdjustment, ToString(writingMode).c_str(), mAnchorNode);
ANCHOR_LOG("Applying anchor adjustment of %s in %s with anchor %p.\n",
ToString(CSSPixel::FromAppUnits(logicalAdjustment)).c_str(),
ToString(writingMode).c_str(), mAnchorNode);
AdjustmentMade(logicalAdjustment);
@@ -656,8 +660,7 @@ ScrollAnchorContainer::ExamineAnchorCandidate(nsIFrame* aFrame) const {
// Find the scroll anchoring bounding rect.
nsRect rect = FindScrollAnchoringBoundingRect(Frame(), aFrame);
ANCHOR_LOG("\t\trect = [%d %d x %d %d].\n", rect.x, rect.y, rect.width,
rect.height);
ANCHOR_LOG("\t\trect = %s.\n", ToString(CSSRect::FromAppUnits(rect)).c_str());
// Check if this frame is visible in the scroll port. This will exclude rects
// with zero sized area. The specification is ambiguous about this [1], but