Files
palemoon27/accessible/xpcom/xpcAccessibleTextRange.cpp
roytam1 9d1d141038 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1194851. Change one instance of GetDisplayPort to HasDisplayPort. r=botond (ff16711347)
- Bug 1194851. Make ViewportHasDisplayPort only return a bool, not the displayport rect. r=botond (bfe7d49225)
- Bug 1194851. Change GetOrMaybeCreateDisplayPort into just MaybeCreateDisplayPort, and make it only return a bool, and not the displayport rect. r=botond (af2a6eedbc)
- Bug 1194851. Always store the displayport base relative to the scrollport (not the scroll frame). r=botond (841ff20d8c)
- Bug 1194851 - Remove the second parameter of IsFixedPosFrameInDisplayPort(). r=kats (7eca35088f)
- Bug 1229853 - Don't apply the displayport multiplier if we don't have a frame for the element the displayport is set on. r=tn (f0e829164e)
- Bug 1237086. When getting the displayport for a content node if there is no root scroll frame just use the primary frame of the content node. r=botond (35a1e1a2f6)
- Bug 1194851. Introduce GetDisplayPortRelativeToScrollFrame. r=botond (d209135b33)
- Bug 1194851. Change GetDisplayPortForVisibilityTesting into GetDisplayPortRelativeToScrollFrameForVisibilityTesting since it has only one user. r=botond (ba2f91af92)
- Bug 1194851. Split GetDisplayPort callers into GetDisplayPortRelative ToScrollPort and GetDisplayPortRelativeToScrollFrame. r=botond (4628829811)
- Bug 1194851. Rename GetDisplayPortRelativeToScrollPort back to GetDisplayPort. r=botond (e632511674)
- Bug 1194851. Change the GetDisplayPort API to take an optional RelativeTo parameter, instead of having that expressed in the function name. r=botond (8f0be47c51)
- Bug 1232561 part 1 - Replace AppliesToTransitionsLevel() with a cascade level enumeration; r=heycam (ca46bd9c5c)
- Bug 1229280 - Move animation generation from AnimationCollection to EffectSet; r=dbaron (7e15533b9f)
- Bug 1232561 part 2 - Move the animation style rules from AnimationCollection to EffectSet; r=heycam (6166363541)
- Bug 1232561 part 3 - Move AnimValuesStyleRule to a separate file; r=heycam (e2cc2f76c1)
- Bug 1232561 part 4 - Add EffectCompositor::ComposeAnimationRule; r=heycam (c29fef6a32)
- Bug 1232577 part 1 - Add EffectCompositor as a member of nsPresContext; r=heycam (027c5d9aa2)
- Bug 1232577 part 2 - Add a hashmap to ElementCompositor to track which (pseudo-) elements need to have their animation style rule updated; r=heycam (9d6e66d674)
- Bug 1232563 part 1 - Request a layer update if an animation is newly finished; r=heycam (9b73effbf2)
- Bug 1232563 part 2 - Move RequestRestyle calls to the effect; r=heycam (71eeb3a73d)
- Bug 1232563 part 3 - Drop check for an empty set of properties when requesting restyles from KeyframeEffectReadOnly; r=heycam (d4768a7394)
- Bug 1232563 part 4 - Don't perform style updates when the effect progress has not changed; r=heycam (8e92edd63e)
- Bug 1232577 part 3 - Move RestyleType to EffectCompositor; r=heycam (ded7dc780d)
- Bug 1232577 part 4 - Add and remove (pseudo-)elements needing an animation style rule update to the EffectCompositor; r=heycam (62f6220505)
- Bug 1232577 part 5 - Make sure CSSTransition::CancelFromStyle updates the transitions level of the cascade; r=heycam (e8912154f1)
- Bug 1232577 part 6 - Add animation rule refresh time to EffectSet; r=heycam (ba10c84ace)
- Bug 1232577 part 7 - Move call to SetNeedStyleFlush() to EffectCompositor::RequestRestyle; r=heycam (433ed32b4c)
- Bug 1232577 part 8 - Move call to PostRestyleForAnimation to EffectCompositor; r=heycam (be7dd74654)
- Bug 1232577 part 9 - Remove AnimationCollection::mStyleRuleRefreshTime; r=heycam (0fcc53cbfc)
- Bug 1232577 part 10 - Remove AnimationCollection::mStyleChanging; r=heycam (0737fe0747)
- Bug 1232577 part 11 - Remove AnimationCollection::mHasPendingAnimationRestyle; r=heycam (3d2aa0bfa4)
- Bug 1232577 part 12 - Move the remainder of RequestRestyle from AnimationCollection to EffectCompositor; r=heycam (1a180acbc2)
- Bug 1232577 part 13 - Move EnsureStyleRuleFor from AnimationCollection to EffectCompositor (dcce4b105b)
- Bug 1232577 part 14 - Move FlushAnimations to EffectCompositor; r=heycam (67e5019f44)
- Bug 1232577 part 15 - Drop LastStyleUpdateForAllAnimations flag from pres context; r=heycam (dce1abfd87)
- Bug 1232577 part 16 - Move GetAnimationRule to EffectCompositor; r=heycam (df45ee5e40)
- Bug 1232577 part 17 - Move AddStyleUpdatesTo to EffectCompositor; r=heycam (eb62d19b17)
- Bug 1232577 part 18 - Drop RestyleManager::mLastUpdateForThrottledAni…mations; r=heycam (066ca553d3)
- Bug 1232577 part 19 - Move ClearIsRunningOnCompositor to EffectCompositor; r=heycam (0bd47b0890)
- Bug 1237083 - Don't trigger layer flattening if the component alpha layer is directly on top of a forced active layer. r=roc (a54393afd9)
- Bug 1231818 - Make FrameLayerBuilder try harder to respect layers.max-active pref. r=mstange (e9cbb8d6bd)
- Bug 1231538 - Build a ContainerLayer for position:fixed and background-attachment:fixed content. r=roc (efbd221475)
- Bug 1235186 - Part 2: Fix -Wclass-varargs warning in layout/. r=dholbert (4222fbf329)
- Bug 1235186 - Part 1: Fix -Wformat warnings in layout/. r=dholbert (1f6be477be)
- Bug 1235678. Fix printing animated geometry roots of display items. r=dholbert (69dbeb290f)
- Bug 1239864 (part 9) - Use the new rect iterators in layout/ and ipc/. r=dholbert. (98626d2b36)
- Bug 1239864 (part 10) - Use the new rect iterators in view/ and widget/. r=roc. (53a86e19d6)
- Bug 1239864 (part 11) - Remove the old rect iterators. r=roc. (38d2fad35a)
- Bug 1204084 - Double tap gesture fails when tapping on a large element contained in an iframe or scrollable div. r=botond (71463b4cdf)
- Bug 1231517 - part 1, Move GetBoundingContentRect to nsLayoutUtils r=botond (3dbe9c6309)
- Bug 1231517 - part 2, Add support for APZ ZoomToRectBehavior flags r=kats (4a7f22a0cf)
- Bug 1235576 - Fix the indentation in dom/ipc, r=smaug (811a7de14f)
- Bug 1198459 - Update telemetry data based on the use of the forced enable pref. r=felipe (f33f0efc9a)
- Bug 1234210 - Restrict updates for accessibility.lastLoadDate to shutdown. r=trevor (5e484eb7ba)
- Bug 1231517 - part 3, Add ZoomToRect function to nsIWidget classes r=kats (57496a18cd)
- Bug 1229393 - Ensure that all the touch points from the original touch go to APZCCallbackHelper::SendSetTargetAPZCNotification. r=botond (45ce1737ac)
- Bug 1174323 part 1 - Add nsDOMWindowUtils::SendNativeMouseMove and EventUtils.sendNativeMouseMove. r=smaug (527439f71b)
- Bug 1180351 - Enable pointerlock tests on Windows and Linux. r=smaug (833fac9ba9)
- Bug 1180351 - Followup: Disable pointerlock tests on Windows for frequently failing tests. r=turning off tests (02525d24f4)
- Bug 1174323 part 2 - Use native mouse move to improve robustness of screenClientXYConst subtest. r=smaug (7e3fb884d3)
- Bug 1231517 - part 4, Add ZoomToFocusedInput function to nsDOMWindowUtils r=kats (a1f3e3b4fd)
- Bug 1153156 part.1 Move nsBaseWidget::OverrideSystemMouseScrollSpeed() to WidgetWheelEvent r=smaug, sr=smaug (8a95d65d55)
- bug 726265 don't activate ELAN swipe hack unless ScanCode is zero r=heycam (477a5ce06a)
- Bug 1235686 part.1 MouseScrollHandler should refresh the cache of system settings at handling wheel messages if the pref doesn't allow to cache system settings r=jimm (6cae8d2b07)
- Bug 1235686 part.2 Don't refresh the cache of system settings at handling wheel messages if the scroll amout values are initialized with prefs r=jimm (ead872b6bf)
- Bug 1235686 part.3 Don't trust system settings cache if SynTP of Synaptics is installed r=jimm (d56a034a42)
- Bug 1235686 part.4 Don't trust system settings cache if Apoint of Alps is installed r=jimm (85cb23e185)
- Bug 1153156 part.2 Make WidgetWheelEvent store if overriding system scroll speed is allowed and it shouldn't be allowed if scroll speed isn't system default settings on Windows r=smaug+jimm (3d5fc255db)
- Bug 1153156 part.3 Don't allow to override system scroll speed if the wheel event causes too fast scroll r=smaug+jimm (21e10640ac)
- Bug 1236750 - Rename ViewTransform to AsyncTransform. r=kats (1ccd8af262)
- Bug 1226826 - Record if painted displayport updates were due to repaints from the relevant layer tree or not. r=botond (e28315ec88)
- Bug 1228641. Add a initializer_list constructor to nsTArray. r=froydnj (448f69f610)
- Bug 962243 - Gtest for being able to pan after lifting a finger from a pinch. r=botond (a1687f190c)
- Bug 1031443 - Allow panning in the pinching state even if zooming is disabled;r=botond (aacb1a28bd)
- Bug 1231504 - Move some prefs from b2g.js to all.js. r=botond (c9801602ba)
- Bug 1092128 - Ensure the tests for touch action disabled actually disable touch action. r=botond (ec3fae4568)
- Bug 1014691 - Get TestAsyncPanZoomController to compile in its new location. r=kats (9dd104c6fd)
- Bug 1240244 - Split APZ gtests into several files. r=kats (0ce8bd4f80)
- Bug 1235994 - Add a flag to wheel events to track if they may have momentum following them. r=mstange (d5b2099244)
- Bug 1153156 part.4 Make APZC system scroll speed overriding aware r=mstange (f9d49eb79c)
- Bug 1233118 - implement IAccessible2_3::selectionRanges, r=yzen (d85fe6cf64)
- bug 1235965 - null check mDoc in AccessibleWrap::Shutdown() r=davidb (cb775e5c00)
- Bug 1130096 - Convert embedding/components/find/ to Gecko style. r=mccr8 (83d043e841)
- Bug 1164473 - Resolve issue when touches stop working after pen was activated. r=jimm (16ce68b032)
- Bug 1171712 - Implement separated InkColletor and InkCollectorEvent classes. r=smaug, r=jimm (8000e742b8)
- bug 1198656 interpret null ConvolverNode mBuffer as a buffer of zerosr=padenot (339e1f9904)
- bug 930257 finish Oscillator on processing last non-null block r=padenot (2719eee12b)
- Bug 1240411: P1. Clean up webaudio headers. r=cpearce (f169dc2789)
- Bug 1219711 - Don't rely on timer interval in fake audio track. r=jesup (f140fd848a)
- Bug 1223655 - Only check for track end if track exists in MediaEngineDefaultAudioSource. r=jesup (3055b4529f)
- Bug 1223655 - Also don't check time of data end if track has ended. r=jesup (bbdf7c5be5)
- Bug 1223655 - Fix opt build bustage on a CLOSED TREE. r=bustage (d546f4ba0b)
- Bug 1164463 followup: Add missing 'override' keyword to MediaEngineDefault::Shutdown(). rs=ehsan (33bf959d84)
- Bug 1240411: P2. Clean up webrtc headers. r=jesup (73c2bdf22d)
- Bug 1240411: P4. Clean up readers headers. r=cpearce (748d2bf9e8)
- Bug 1232527 - Remove GMPVideoDecoderTrialCreator and friends. r=jwwang (e0decf270f)
- Bug 1240411: P5. Clean up GMP headers. r=cpearce (0336b7fd9c)
- Bug 1240252: Add missing "mozilla::" namespace prefix before usage of type LayoutDeviceIntRegion, to fix local build bustage. r=njn (54d5a4a553)
- Bug 1245241 - part 1 - Close Shmem file handles after mapping them when possible to reduce exhaustion issues. r=billm (631c2b6da5)
2023-08-16 12:06:20 +08:00

222 lines
5.2 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "xpcAccessibleTextRange.h"
#include "TextRange-inl.h"
#include "xpcAccessibleDocument.h"
#include "nsIMutableArray.h"
#include "nsComponentManagerUtils.h"
#include "nsQueryObject.h"
using namespace mozilla;
using namespace mozilla::a11y;
// nsISupports and cycle collection
NS_IMPL_CYCLE_COLLECTION(xpcAccessibleTextRange,
mRange.mRoot,
mRange.mStartContainer,
mRange.mEndContainer)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(xpcAccessibleTextRange)
NS_INTERFACE_MAP_ENTRY(nsIAccessibleTextRange)
NS_INTERFACE_MAP_ENTRY(xpcAccessibleTextRange)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleTextRange)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(xpcAccessibleTextRange)
NS_IMPL_CYCLE_COLLECTING_RELEASE(xpcAccessibleTextRange)
// nsIAccessibleTextRange
NS_IMETHODIMP
xpcAccessibleTextRange::GetStartContainer(nsIAccessibleText** aAnchor)
{
NS_ENSURE_ARG_POINTER(aAnchor);
NS_IF_ADDREF(*aAnchor = ToXPCText(mRange.StartContainer()));
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::GetStartOffset(int32_t* aOffset)
{
NS_ENSURE_ARG_POINTER(aOffset);
*aOffset = mRange.StartOffset();
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::GetEndContainer(nsIAccessibleText** aAnchor)
{
NS_ENSURE_ARG_POINTER(aAnchor);
NS_IF_ADDREF(*aAnchor = ToXPCText(mRange.EndContainer()));
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::GetEndOffset(int32_t* aOffset)
{
NS_ENSURE_ARG_POINTER(aOffset);
*aOffset = mRange.EndOffset();
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::GetContainer(nsIAccessible** aContainer)
{
NS_ENSURE_ARG_POINTER(aContainer);
NS_IF_ADDREF(*aContainer = ToXPC(mRange.Container()));
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::GetEmbeddedChildren(nsIArray** aList)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMutableArray> xpcList =
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsTArray<Accessible*> objects;
mRange.EmbeddedChildren(&objects);
uint32_t len = objects.Length();
for (uint32_t idx = 0; idx < len; idx++)
xpcList->AppendElement(static_cast<nsIAccessible*>(ToXPC(objects[idx])), false);
xpcList.forget(aList);
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::Compare(nsIAccessibleTextRange* aOtherRange,
bool* aResult)
{
RefPtr<xpcAccessibleTextRange> xpcRange(do_QueryObject(aOtherRange));
if (!xpcRange || !aResult)
return NS_ERROR_INVALID_ARG;
*aResult = (mRange == xpcRange->mRange);
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::CompareEndPoints(uint32_t aEndPoint,
nsIAccessibleTextRange* aOtherRange,
uint32_t aOtherRangeEndPoint,
int32_t* aResult)
{
RefPtr<xpcAccessibleTextRange> xpcRange(do_QueryObject(aOtherRange));
if (!xpcRange || !aResult)
return NS_ERROR_INVALID_ARG;
TextPoint p = (aEndPoint == EndPoint_Start) ?
mRange.StartPoint() : mRange.EndPoint();
TextPoint otherPoint = (aOtherRangeEndPoint == EndPoint_Start) ?
xpcRange->mRange.StartPoint() : xpcRange->mRange.EndPoint();
if (p == otherPoint)
*aResult = 0;
else
*aResult = p < otherPoint ? -1 : 1;
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::GetText(nsAString& aText)
{
nsAutoString text;
mRange.Text(text);
aText.Assign(text);
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::GetBounds(nsIArray** aRectList)
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::Move(uint32_t aUnit, int32_t aCount)
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::MoveStart(uint32_t aUnit, int32_t aCount)
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::MoveEnd(uint32_t aUnit, int32_t aCount)
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::Normalize(uint32_t aUnit)
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::Crop(nsIAccessible* aContainer, bool* aSuccess)
{
Accessible* container = aContainer->ToInternalAccessible();
NS_ENSURE_TRUE(container, NS_ERROR_INVALID_ARG);
*aSuccess = mRange.Crop(container);
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::FindText(const nsAString& aText, bool aIsBackward,
bool aIsIgnoreCase,
nsIAccessibleTextRange** aRange)
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::FindAttr(uint32_t aAttr, nsIVariant* aVal,
bool aIsBackward,
nsIAccessibleTextRange** aRange)
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::AddToSelection()
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::RemoveFromSelection()
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::Select()
{
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleTextRange::ScrollIntoView(uint32_t aHow)
{
return NS_OK;
}