Bug 758179. Part 2: Add flags parameter to GetContentOffsetsFromPoint(External). r=mats

This commit is contained in:
Robert O'Callahan 2012-05-30 01:13:36 +12:00
parent 3ce7640e85
commit a2a5e603d2
3 changed files with 12 additions and 6 deletions

View File

@ -1310,7 +1310,8 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
if (pointInFrame.x < frameSize.width && pointInFrame.y < frameSize.height) {
// Finished
if (frame->GetType() == nsGkAtoms::textFrame) {
nsIFrame::ContentOffsets contentOffsets = frame->GetContentOffsetsFromPointExternal(pointInFrame, true);
nsIFrame::ContentOffsets contentOffsets =
frame->GetContentOffsetsFromPointExternal(pointInFrame, nsIFrame::IGNORE_SELECTION_STYLE);
if (contentOffsets.IsNull() || contentOffsets.content != content) {
return NS_OK; // Not found, will return -1
}

View File

@ -3416,10 +3416,10 @@ static nsIFrame* AdjustFrameForSelectionStyles(nsIFrame* aFrame) {
nsIFrame::ContentOffsets nsIFrame::GetContentOffsetsFromPoint(nsPoint aPoint,
bool aIgnoreSelectionStyle)
PRUint32 aFlags)
{
nsIFrame *adjustedFrame;
if (aIgnoreSelectionStyle) {
if (aFlags & IGNORE_SELECTION_STYLE) {
adjustedFrame = this;
}
else {

View File

@ -1289,6 +1289,11 @@ public:
// to display on.
bool associateWithNext;
};
enum {
IGNORE_SELECTION_STYLE = 0x01,
// Treat visibility:hidden frames as non-selectable
SKIP_HIDDEN = 0x02
};
/**
* This function calculates the content offsets for selection relative to
* a point. Note that this should generally only be callled on the event
@ -1297,11 +1302,11 @@ public:
* @param aPoint point relative to this frame
*/
ContentOffsets GetContentOffsetsFromPoint(nsPoint aPoint,
bool aIgnoreSelectionStyle = false);
PRUint32 aFlags = 0);
virtual ContentOffsets GetContentOffsetsFromPointExternal(nsPoint aPoint,
bool aIgnoreSelectionStyle = false)
{ return GetContentOffsetsFromPoint(aPoint, aIgnoreSelectionStyle); }
PRUint32 aFlags = 0)
{ return GetContentOffsetsFromPoint(aPoint, aFlags); }
/**
* This structure holds information about a cursor. mContainer represents a