Bug 1875199 - Move documentation of two methods in nsHTMLScrollFrame to nsIScrollableFrame. r=layout-reviewers,emilio DONTBUILD

The documentation for GetScrolledRect() and GetLogicalScrollPosition() in
nsHTMLScrollFrame are clearer and up-to-date [1], but they implements the
nsIScrollableFrame's interface. We should move the documentation to
nsIScrollableFrame.

[1] For example, nsXULScrollFrame has been removed in bug 1600542.

Differential Revision: https://phabricator.services.mozilla.com/D198909
This commit is contained in:
Ting-Yu Lin 2024-01-18 16:54:38 +00:00
Родитель d5083c74fc
Коммит ac1fd45c39
2 изменённых файлов: 8 добавлений и 25 удалений

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

@ -208,31 +208,11 @@ class nsHTMLScrollFrame : public nsContainerFrame,
}
return mScrollPort.Size();
}
/**
* GetScrolledRect is designed to encapsulate deciding which
* directions of overflow should be reachable by scrolling and which
* should not. Callers should NOT depend on it having any particular
* behavior.
*
* This should only be called when the scrolled frame has been
* reflowed with the scroll port size given in mScrollPort.
*
* Currently it allows scrolling down and to the right for
* nsHTMLScrollFrames with LTR directionality, and allows scrolling down and
* to the left for nsHTMLScrollFrames with RTL directionality.
*/
nsRect GetScrolledRect() const final;
nsRect GetScrollPortRect() const final { return mScrollPort; }
nsPoint GetScrollPosition() const final {
return mScrollPort.TopLeft() - mScrolledFrame->GetPosition();
}
/**
* For LTR frames, the logical scroll position is the offset of the top left
* corner of the frame from the top left corner of the scroll port (same as
* GetScrollPosition).
* For RTL frames, it is the offset of the top right corner of the frame from
* the top right corner of the scroll port
*/
nsPoint GetLogicalScrollPosition() const final {
nsPoint pt;
pt.x = IsPhysicalLTR()

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

@ -146,15 +146,14 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
* GetScrolledRect is designed to encapsulate deciding which
* directions of overflow should be reachable by scrolling and which
* should not. Callers should NOT depend on it having any particular
* behavior (although nsXULScrollFrame currently does).
* behavior.
*
* This should only be called when the scrolled frame has been
* reflowed with the scroll port size given in mScrollPort.
*
* Currently it allows scrolling down and to the right for
* nsHTMLScrollFrames with LTR directionality and for all
* nsXULScrollFrames, and allows scrolling down and to the left for
* nsHTMLScrollFrames with RTL directionality.
* nsHTMLScrollFrames with LTR directionality, and allows scrolling down and
* to the left for nsHTMLScrollFrames with RTL directionality.
*/
virtual nsRect GetScrolledRect() const = 0;
/**
@ -170,7 +169,11 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
*/
virtual nsPoint GetScrollPosition() const = 0;
/**
* As GetScrollPosition(), but uses the top-right as origin for RTL frames.
* For LTR frames, the logical scroll position is the offset of the top left
* corner of the frame from the top left corner of the scroll port (same as
* GetScrollPosition).
* For RTL frames, it is the offset of the top right corner of the frame from
* the top right corner of the scroll port.
*/
virtual nsPoint GetLogicalScrollPosition() const = 0;