mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1145292 - IPC Proxy for ImageAccessible, r=tbsaunde
This commit is contained in:
parent
0326e5b8f2
commit
dca3be308d
@ -12,6 +12,7 @@
|
||||
#include "nsMai.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "nsIURI.h"
|
||||
#include "ProxyAccessible.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
@ -23,15 +24,19 @@ static void
|
||||
getImagePositionCB(AtkImage* aImage, gint* aAccX, gint* aAccY,
|
||||
AtkCoordType aCoordType)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
|
||||
if (!accWrap || !accWrap->IsImage())
|
||||
return;
|
||||
|
||||
ImageAccessible* image = accWrap->AsImage();
|
||||
nsIntPoint pos;
|
||||
uint32_t geckoCoordType = (aCoordType == ATK_XY_WINDOW) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
|
||||
nsIntPoint pos = image->Position(geckoCoordType);
|
||||
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
|
||||
if (accWrap && accWrap->IsImage()) {
|
||||
ImageAccessible* image = accWrap->AsImage();
|
||||
pos = image->Position(geckoCoordType);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aImage))) {
|
||||
pos = proxy->ImagePosition(geckoCoordType);
|
||||
}
|
||||
|
||||
*aAccX = pos.x;
|
||||
*aAccY = pos.y;
|
||||
}
|
||||
@ -45,11 +50,14 @@ getImageDescriptionCB(AtkImage* aImage)
|
||||
static void
|
||||
getImageSizeCB(AtkImage* aImage, gint* aAccWidth, gint* aAccHeight)
|
||||
{
|
||||
nsIntSize size;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
|
||||
if (!accWrap || !accWrap->IsImage())
|
||||
return;
|
||||
if (accWrap && accWrap->IsImage()) {
|
||||
size = accWrap->AsImage()->Size();
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aImage))) {
|
||||
size = proxy->ImageSize();
|
||||
}
|
||||
|
||||
nsIntSize size = accWrap->AsImage()->Size();
|
||||
*aAccWidth = size.width;
|
||||
*aAccHeight = size.height;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "ProxyAccessible.h"
|
||||
#include "Relation.h"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
#include "ImageAccessible.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
||||
@ -46,19 +47,26 @@ SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree)
|
||||
}
|
||||
|
||||
Accessible*
|
||||
DocAccessibleChild::IdToAccessible(const uint64_t& aID)
|
||||
DocAccessibleChild::IdToAccessible(const uint64_t& aID) const
|
||||
{
|
||||
return mDoc->GetAccessibleByUniqueID(reinterpret_cast<void*>(aID));
|
||||
}
|
||||
|
||||
HyperTextAccessible*
|
||||
DocAccessibleChild::IdToHyperTextAccessible(const uint64_t& aID)
|
||||
DocAccessibleChild::IdToHyperTextAccessible(const uint64_t& aID) const
|
||||
{
|
||||
Accessible* acc = IdToAccessible(aID);
|
||||
MOZ_ASSERT(!acc || acc->IsHyperText());
|
||||
return acc ? acc->AsHyperText() : nullptr;
|
||||
}
|
||||
|
||||
ImageAccessible*
|
||||
DocAccessibleChild::IdToImageAccessible(const uint64_t& aID) const
|
||||
{
|
||||
Accessible* acc = IdToAccessible(aID);
|
||||
return (acc && acc->IsImage()) ? acc->AsImage() : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessibleChild::ShowEvent(AccShowEvent* aShowEvent)
|
||||
{
|
||||
@ -584,5 +592,31 @@ DocAccessibleChild::RecvPasteText(const uint64_t& aID,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvImagePosition(const uint64_t& aID,
|
||||
const uint32_t& aCoordType,
|
||||
nsIntPoint* aRetVal)
|
||||
{
|
||||
ImageAccessible* acc = IdToImageAccessible(aID);
|
||||
if (acc) {
|
||||
*aRetVal = acc->Position(aCoordType);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvImageSize(const uint64_t& aID,
|
||||
nsIntSize* aRetVal)
|
||||
{
|
||||
|
||||
ImageAccessible* acc = IdToImageAccessible(aID);
|
||||
if (acc) {
|
||||
*aRetVal = acc->Size();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace mozilla {
|
||||
namespace a11y {
|
||||
class Accessible;
|
||||
class HyperTextAccessible;
|
||||
class ImageAccessible;
|
||||
|
||||
class AccShowEvent;
|
||||
|
||||
@ -34,9 +35,6 @@ public:
|
||||
MOZ_COUNT_DTOR(DocAccessibleChild);
|
||||
}
|
||||
|
||||
Accessible* IdToAccessible(const uint64_t& aID);
|
||||
HyperTextAccessible* IdToHyperTextAccessible(const uint64_t& aID);
|
||||
|
||||
void ShowEvent(AccShowEvent* aShowEvent);
|
||||
|
||||
/*
|
||||
@ -184,7 +182,19 @@ public:
|
||||
virtual bool RecvPasteText(const uint64_t& aID,
|
||||
const int32_t& aPosition) override;
|
||||
|
||||
virtual bool RecvImagePosition(const uint64_t& aID,
|
||||
const uint32_t& aCoordType,
|
||||
nsIntPoint* aRetVal) override;
|
||||
|
||||
virtual bool RecvImageSize(const uint64_t& aID,
|
||||
nsIntSize* aRetVal) override;
|
||||
|
||||
private:
|
||||
|
||||
Accessible* IdToAccessible(const uint64_t& aID) const;
|
||||
HyperTextAccessible* IdToHyperTextAccessible(const uint64_t& aID) const;
|
||||
ImageAccessible* IdToImageAccessible(const uint64_t& aID) const;
|
||||
|
||||
bool PersistentPropertiesToArray(nsIPersistentProperties* aProps,
|
||||
nsTArray<Attribute>* aAttributes);
|
||||
|
||||
|
@ -8,6 +8,8 @@ include protocol PContent;
|
||||
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using struct nsIntPoint from "nsRect.h";
|
||||
using struct nsIntSize from "nsRect.h";
|
||||
using struct nsIntRect from "nsRect.h";
|
||||
|
||||
namespace mozilla {
|
||||
@ -121,6 +123,9 @@ child:
|
||||
prio(high) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
|
||||
prio(high) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
|
||||
prio(high) sync PasteText(uint64_t aID, int32_t aPosition);
|
||||
|
||||
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal);
|
||||
prio(high) sync ImageSize(uint64_t aID) returns(nsIntSize aRetVal);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -363,5 +363,21 @@ ProxyAccessible::PasteText(int32_t aPosition)
|
||||
unused << mDoc->SendPasteText(mID, aPosition);
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
ProxyAccessible::ImagePosition(uint32_t aCoordType)
|
||||
{
|
||||
nsIntPoint retVal;
|
||||
unused << mDoc->SendImagePosition(mID, aCoordType, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
nsIntSize
|
||||
ProxyAccessible::ImageSize()
|
||||
{
|
||||
nsIntSize retVal;
|
||||
unused << mDoc->SendImageSize(mID, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,10 @@ public:
|
||||
|
||||
void PasteText(int32_t aPosition);
|
||||
|
||||
nsIntPoint ImagePosition(uint32_t aCoordType);
|
||||
|
||||
nsIntSize ImageSize();
|
||||
|
||||
/**
|
||||
* Allow the platform to store a pointers worth of data on us.
|
||||
*/
|
||||
|
@ -26,6 +26,24 @@ if CONFIG['ACCESSIBILITY']:
|
||||
'../generic',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ENABLE_GTK']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/atk',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/windows/ia2',
|
||||
'/accessible/windows/msaa',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/mac',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/other',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
Loading…
Reference in New Issue
Block a user