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