Bug 1140534 - IPC Proxy for offsetAtPoint, r=tbsaunde

This commit is contained in:
Olli Pettay 2015-03-08 14:05:55 +02:00
parent 221a1a4b36
commit e8319937b3
6 changed files with 54 additions and 10 deletions

View File

@ -429,18 +429,28 @@ getOffsetAtPointCB(AtkText *aText,
AtkCoordType aCoords)
{
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return -1;
if (accWrap) {
HyperTextAccessible* text = accWrap->AsHyperText();
if (!text || !text->IsTextRole()) {
return -1;
}
HyperTextAccessible* text = accWrap->AsHyperText();
if (!text || !text->IsTextRole())
return -1;
return static_cast<gint>(
text->OffsetAtPoint(aX, aY,
(aCoords == ATK_XY_SCREEN ?
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE)));
}
return static_cast<gint>(
text->OffsetAtPoint(aX, aY,
(aCoords == ATK_XY_SCREEN ?
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE)));
if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
return static_cast<gint>(
proxy->OffsetAtPoint(aX, aY,
(aCoords == ATK_XY_SCREEN ?
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE)));
}
return -1;
}
static gint

View File

@ -392,5 +392,20 @@ DocAccessibleChild::RecvCharBounds(const uint64_t& aID,
return true;
}
bool
DocAccessibleChild::RecvOffsetAtPoint(const uint64_t& aID,
const int32_t& aX,
const int32_t& aY,
const uint32_t& aCoordType,
int32_t* aRetVal)
{
*aRetVal = -1;
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) {
*aRetVal = acc->OffsetAtPoint(aX, aY, aCoordType);
}
return true;
}
}
}

View File

@ -121,6 +121,12 @@ public:
const int32_t& aOffset,
const uint32_t& aCoordType,
nsIntRect* aRetVal) MOZ_OVERRIDE;
virtual bool RecvOffsetAtPoint(const uint64_t& aID,
const int32_t& aX,
const int32_t& aY,
const uint32_t& aCoordType,
int32_t* aRetVal) MOZ_OVERRIDE;
private:
bool PersistentPropertiesToArray(nsIPersistentProperties* aProps,
nsTArray<Attribute>* aAttributes);

View File

@ -91,6 +91,9 @@ child:
returns(nsIntRect aRetVal);
prio(high) sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType)
returns(nsIntRect aRetVal);
prio(high) sync OffsetAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aCoordType)
returns(int32_t aRetVal);
};
}

View File

@ -262,5 +262,13 @@ ProxyAccessible::CharBounds(int32_t aOffset, uint32_t aCoordType)
return rect;
}
int32_t
ProxyAccessible::OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType)
{
int32_t retVal = -1;
unused << mDoc->SendOffsetAtPoint(mID, aX, aY, aCoordType, &retVal);
return retVal;
}
}
}

View File

@ -138,6 +138,8 @@ public:
nsIntRect CharBounds(int32_t aOffset, uint32_t aCoordType);
int32_t OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType);
/**
* Allow the platform to store a pointers worth of data on us.
*/