Bug 1896516 Part 8 - Remove nsIScrollableFrame usages under accessible/. r=layout-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D211495
This commit is contained in:
Ting-Yu Lin 2024-05-28 04:46:19 +00:00
Родитель 9ab65dbb68
Коммит 83578c4adb
6 изменённых файлов: 20 добавлений и 18 удалений

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

@ -9,7 +9,6 @@
#include "DocAccessibleChild.h"
#include "DocAccessibleWrap.h"
#include "nsIDocShell.h"
#include "nsIScrollableFrame.h"
#include "nsLayoutUtils.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"

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

@ -15,7 +15,6 @@
#include "nsIDocShell.h"
#include "nsIObserverService.h"
#include "nsPresContext.h"
#include "nsIScrollableFrame.h"
#include "nsISelectionController.h"
#include "nsISimpleEnumerator.h"
#include "mozilla/dom/TouchEvent.h"
@ -24,6 +23,7 @@
#include "mozilla/EventStateManager.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/TouchEvents.h"
#include "nsView.h"
#include "nsGkAtoms.h"
@ -253,21 +253,24 @@ nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
return NS_OK;
}
void nsCoreUtils::ScrollFrameToPoint(nsIFrame* aScrollableFrame,
void nsCoreUtils::ScrollFrameToPoint(nsIFrame* aScrollContainerFrame,
nsIFrame* aFrame,
const LayoutDeviceIntPoint& aPoint) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollableFrame);
if (!scrollableFrame) return;
ScrollContainerFrame* scrollContainerFrame =
do_QueryFrame(aScrollContainerFrame);
if (!scrollContainerFrame) {
return;
}
nsPoint point = LayoutDeviceIntPoint::ToAppUnits(
aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint = point - frameRect.TopLeft();
nsPoint scrollPoint = scrollableFrame->GetScrollPosition();
nsPoint scrollPoint = scrollContainerFrame->GetScrollPosition();
scrollPoint -= deltaPoint;
scrollableFrame->ScrollTo(scrollPoint, ScrollMode::Instant);
scrollContainerFrame->ScrollTo(scrollPoint, ScrollMode::Instant);
}
void nsCoreUtils::ConvertScrollTypeToPercents(uint32_t aScrollType,

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

@ -172,11 +172,12 @@ class nsCoreUtils {
* Scrolls the given frame to the point, used for implememntation of
* nsIAccessible::scrollToPoint and nsIAccessibleText::scrollSubstringToPoint.
*
* @param aScrollableFrame the scrollable frame
* @param aScrollContainerFrame the scroll container frame
* @param aFrame the frame to scroll
* @param aPoint the point scroll to (in dev pixels)
*/
static void ScrollFrameToPoint(nsIFrame* aScrollableFrame, nsIFrame* aFrame,
static void ScrollFrameToPoint(nsIFrame* aScrollContainerFrame,
nsIFrame* aFrame,
const mozilla::LayoutDeviceIntPoint& aPoint);
/**

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

@ -12,7 +12,6 @@
#include "nsAccessibilityService.h"
#include "NotificationController.h"
#include "States.h"
#include "nsIScrollableFrame.h"
#include "mozilla/dom/DocumentInlines.h"
#ifdef A11Y_LOG

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

@ -26,7 +26,6 @@
#include "nsContainerFrame.h"
#include "nsFrameSelection.h"
#include "nsILineIterator.h"
#include "nsIScrollableFrame.h"
#include "nsIMathMLFrame.h"
#include "nsLayoutUtils.h"
#include "nsRange.h"
@ -35,6 +34,7 @@
#include "mozilla/HTMLEditor.h"
#include "mozilla/IntegerRange.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/SelectionMovementUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLBRElement.h"
@ -894,8 +894,7 @@ void HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
bool initialScrolled = false;
nsIFrame* parentFrame = frame;
while ((parentFrame = parentFrame->GetParent())) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(parentFrame);
if (scrollableFrame) {
if (parentFrame->IsScrollContainerOrSubclass()) {
if (!initialScrolled) {
// Scroll substring to the given point. Turn the point into percents
// relative scrollable area to use nsCoreUtils::ScrollSubstringTo.

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

@ -320,10 +320,10 @@ uint64_t LocalAccessible::VisibilityState() const {
nsIFrame* parentFrame = curFrame->GetParent();
// If contained by scrollable frame then check that at least 12 pixels
// around the object is visible, otherwise the object is offscreen.
nsIScrollableFrame* scrollableFrame = do_QueryFrame(parentFrame);
const nscoord kMinPixels = nsPresContext::CSSPixelsToAppUnits(12);
if (scrollableFrame) {
nsRect scrollPortRect = scrollableFrame->GetScrollPortRect();
if (ScrollContainerFrame* scrollContainerFrame =
do_QueryFrame(parentFrame)) {
nsRect scrollPortRect = scrollContainerFrame->GetScrollPortRect();
nsRect frameRect = nsLayoutUtils::TransformFrameRectToAncestor(
frame, frame->GetRectRelativeToSelf(), parentFrame);
if (!scrollPortRect.Contains(frameRect)) {
@ -2256,8 +2256,9 @@ Relation LocalAccessible::RelationByType(RelationType aType) const {
if (frame) {
nsView* view = frame->GetView();
if (view) {
nsIScrollableFrame* scrollFrame = do_QueryFrame(frame);
if (scrollFrame || view->GetWidget() || !frame->GetParent()) {
ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(frame);
if (scrollContainerFrame || view->GetWidget() ||
!frame->GetParent()) {
rel.AppendTarget(LocalParent());
}
}