mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 630001, part 1 - fix AppendTextTo to not use nsIFrame::GetRenderedText, r=davidb, a=betaN
This commit is contained in:
parent
2677f39ab9
commit
b3a3aefaa7
@ -495,13 +495,11 @@ NotificationController::CoalesceTextChangeEventsFor(AccHideEvent* aTailEvent,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (aThisEvent->mNextSibling == aTailEvent->mAccessible) {
|
if (aThisEvent->mNextSibling == aTailEvent->mAccessible) {
|
||||||
aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText,
|
aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText);
|
||||||
0, PR_UINT32_MAX);
|
|
||||||
|
|
||||||
} else if (aThisEvent->mPrevSibling == aTailEvent->mAccessible) {
|
} else if (aThisEvent->mPrevSibling == aTailEvent->mAccessible) {
|
||||||
PRUint32 oldLen = textEvent->GetLength();
|
PRUint32 oldLen = textEvent->GetLength();
|
||||||
aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText,
|
aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText);
|
||||||
0, PR_UINT32_MAX);
|
|
||||||
textEvent->mStart -= textEvent->GetLength() - oldLen;
|
textEvent->mStart -= textEvent->GetLength() - oldLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,15 +518,14 @@ NotificationController::CoalesceTextChangeEventsFor(AccShowEvent* aTailEvent,
|
|||||||
aThisEvent->mAccessible->GetIndexInParent() + 1) {
|
aThisEvent->mAccessible->GetIndexInParent() + 1) {
|
||||||
// If tail target was inserted after this target, i.e. tail target is next
|
// If tail target was inserted after this target, i.e. tail target is next
|
||||||
// sibling of this target.
|
// sibling of this target.
|
||||||
aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText,
|
aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText);
|
||||||
0, PR_UINT32_MAX);
|
|
||||||
|
|
||||||
} else if (aTailEvent->mAccessible->GetIndexInParent() ==
|
} else if (aTailEvent->mAccessible->GetIndexInParent() ==
|
||||||
aThisEvent->mAccessible->GetIndexInParent() -1) {
|
aThisEvent->mAccessible->GetIndexInParent() -1) {
|
||||||
// If tail target was inserted before this target, i.e. tail target is
|
// If tail target was inserted before this target, i.e. tail target is
|
||||||
// previous sibling of this target.
|
// previous sibling of this target.
|
||||||
nsAutoString startText;
|
nsAutoString startText;
|
||||||
aTailEvent->mAccessible->AppendTextTo(startText, 0, PR_UINT32_MAX);
|
aTailEvent->mAccessible->AppendTextTo(startText);
|
||||||
textEvent->mModifiedText = startText + textEvent->mModifiedText;
|
textEvent->mModifiedText = startText + textEvent->mModifiedText;
|
||||||
textEvent->mStart -= startText.Length();
|
textEvent->mStart -= startText.Length();
|
||||||
}
|
}
|
||||||
@ -564,7 +561,7 @@ NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent)
|
|||||||
PRInt32 offset = textAccessible->GetChildOffset(aEvent->mAccessible);
|
PRInt32 offset = textAccessible->GetChildOffset(aEvent->mAccessible);
|
||||||
|
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
aEvent->mAccessible->AppendTextTo(text, 0, PR_UINT32_MAX);
|
aEvent->mAccessible->AppendTextTo(text);
|
||||||
if (text.IsEmpty())
|
if (text.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ nsAccUtils::TextLength(nsAccessible *aAccessible)
|
|||||||
// XXX In the future, list bullets may have frame and anon content, so
|
// XXX In the future, list bullets may have frame and anon content, so
|
||||||
// we should be able to remove this at that point
|
// we should be able to remove this at that point
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
aAccessible->AppendTextTo(text, 0, PR_UINT32_MAX); // Get all the text
|
aAccessible->AppendTextTo(text); // Get all the text
|
||||||
return text.Length();
|
return text.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2641,16 +2641,18 @@ nsAccessible::GetSelected(PRBool *aSelected)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
void
|
||||||
nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength)
|
nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||||
|
PRUint32 aLength)
|
||||||
{
|
{
|
||||||
// Return text representation of non-text accessible within hypertext
|
// Return text representation of non-text accessible within hypertext
|
||||||
// accessible. Text accessible overrides this method to return enclosed text.
|
// accessible. Text accessible overrides this method to return enclosed text.
|
||||||
if (aStartOffset != 0)
|
if (aStartOffset != 0 || aLength == 0)
|
||||||
return NS_OK;
|
return;
|
||||||
|
|
||||||
nsIFrame *frame = GetFrame();
|
nsIFrame *frame = GetFrame();
|
||||||
NS_ENSURE_STATE(frame);
|
if (!frame)
|
||||||
|
return;
|
||||||
|
|
||||||
if (frame->GetType() == nsAccessibilityAtoms::brFrame) {
|
if (frame->GetType() == nsAccessibilityAtoms::brFrame) {
|
||||||
aText += kForcedNewLineChar;
|
aText += kForcedNewLineChar;
|
||||||
@ -2661,8 +2663,6 @@ nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLe
|
|||||||
} else {
|
} else {
|
||||||
aText += kEmbeddedObjectChar;
|
aText += kEmbeddedObjectChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -341,12 +341,14 @@ public:
|
|||||||
* Returns text of accessible if accessible has text role otherwise empty
|
* Returns text of accessible if accessible has text role otherwise empty
|
||||||
* string.
|
* string.
|
||||||
*
|
*
|
||||||
* @param aText returned text of the accessible
|
* @param aText [in] returned text of the accessible
|
||||||
* @param aStartOffset start offset inside of the accesible
|
* @param aStartOffset [in, optional] start offset inside of the accessible,
|
||||||
* @param aLength required lenght of text
|
* if missed entire text is appended
|
||||||
|
* @param aLength [in, optional] required length of text, if missed
|
||||||
|
* then text form start offset till the end is appended
|
||||||
*/
|
*/
|
||||||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
|
||||||
PRUint32 aLength);
|
PRUint32 aLength = PR_UINT32_MAX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assert if child not in parent's cache if the cache was initialized at this
|
* Assert if child not in parent's cache if the cache was initialized at this
|
||||||
|
@ -57,13 +57,11 @@ nsTextAccessible::NativeRole()
|
|||||||
return nsIAccessibleRole::ROLE_TEXT_LEAF;
|
return nsIAccessibleRole::ROLE_TEXT_LEAF;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
void
|
||||||
nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength)
|
nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||||
|
PRUint32 aLength)
|
||||||
{
|
{
|
||||||
nsIFrame *frame = GetFrame();
|
aText.Append(Substring(mText, aStartOffset, aLength));
|
||||||
if (!frame) return NS_ERROR_FAILURE;//NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
return frame->GetRenderedText(&aText, nsnull, nsnull, aStartOffset, aLength);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -51,8 +51,8 @@ public:
|
|||||||
|
|
||||||
// nsAccessible
|
// nsAccessible
|
||||||
virtual PRUint32 NativeRole();
|
virtual PRUint32 NativeRole();
|
||||||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
|
||||||
PRUint32 aLength);
|
PRUint32 aLength = PR_UINT32_MAX);
|
||||||
|
|
||||||
// nsTextAccessible
|
// nsTextAccessible
|
||||||
void SetText(const nsAString& aText) { mText = aText; }
|
void SetText(const nsAString& aText) { mText = aText; }
|
||||||
|
@ -67,8 +67,8 @@ NS_IMETHODIMP
|
|||||||
nsHTMLTextAccessible::GetName(nsAString& aName)
|
nsHTMLTextAccessible::GetName(nsAString& aName)
|
||||||
{
|
{
|
||||||
// Text node, ARIA can't be used.
|
// Text node, ARIA can't be used.
|
||||||
aName.Truncate();
|
aName = mText;
|
||||||
return AppendTextTo(aName, 0, PR_UINT32_MAX);
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint32
|
PRUint32
|
||||||
@ -390,7 +390,7 @@ nsHTMLListBulletAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraS
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
void
|
||||||
nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||||
PRUint32 aLength)
|
PRUint32 aLength)
|
||||||
{
|
{
|
||||||
@ -405,7 +405,6 @@ nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset
|
|||||||
|
|
||||||
aText += Substring(bulletText, aStartOffset, aLength);
|
aText += Substring(bulletText, aStartOffset, aLength);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -142,8 +142,8 @@ public:
|
|||||||
// nsAccessible
|
// nsAccessible
|
||||||
virtual PRUint32 NativeRole();
|
virtual PRUint32 NativeRole();
|
||||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
|
||||||
PRUint32 aLength);
|
PRUint32 aLength = PR_UINT32_MAX);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// XXX: Ideally we'd get the bullet text directly from the bullet frame via
|
// XXX: Ideally we'd get the bullet text directly from the bullet frame via
|
||||||
|
Loading…
Reference in New Issue
Block a user