mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-06 12:43:53 +00:00
fix for 38253 r=mjudge
This commit is contained in:
parent
2284b35757
commit
a5c995336b
@ -1325,12 +1325,19 @@ nsSelection::MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aA
|
|||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||||
nsCOMPtr<nsIDOMNode> parentNode;
|
nsCOMPtr<nsIDOMNode> parentNode;
|
||||||
//we also need to check to see if the result frame's content's parent is equal to the weaknode used of course.
|
//we also need to check to see if the result frame's content's parent is equal to the weaknode used of course.
|
||||||
|
//except for special case of text frames where they are their own parent.
|
||||||
result = node->GetParentNode(getter_AddRefs(parentNode));
|
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(node);
|
||||||
if ((NS_FAILED(result) || parentNode != weakNodeUsed) && node != weakNodeUsed) //we are not pointing to same node! offset is meaningless
|
if (NS_SUCCEEDED(result) && textNode && node != weakNodeUsed)//then the offset is meaningless.
|
||||||
offsetused = -1;//0 because when grabbing a child content we grab the IDX'th object or: body has 2 children,
|
{
|
||||||
//index 0 of parent is the first child so if we say the first child is the frame then say offset is 0 we are correct
|
offsetused = 0;//0 because when grabbing a child content we grab the IDX'th object or: body has 2 children,
|
||||||
|
//index 0 of parent is the first child so if we say the first child is the frame then say offset is 0 we are correct
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = node->GetParentNode(getter_AddRefs(parentNode));
|
||||||
|
if ((NS_FAILED(result) || parentNode != weakNodeUsed) && node != weakNodeUsed) //we are not pointing to same node! offset is meaningless
|
||||||
|
offsetused = -1;
|
||||||
|
}
|
||||||
nsPeekOffsetStruct pos;
|
nsPeekOffsetStruct pos;
|
||||||
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
||||||
switch (aKeycode){
|
switch (aKeycode){
|
||||||
|
@ -1325,12 +1325,19 @@ nsSelection::MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aA
|
|||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||||
nsCOMPtr<nsIDOMNode> parentNode;
|
nsCOMPtr<nsIDOMNode> parentNode;
|
||||||
//we also need to check to see if the result frame's content's parent is equal to the weaknode used of course.
|
//we also need to check to see if the result frame's content's parent is equal to the weaknode used of course.
|
||||||
|
//except for special case of text frames where they are their own parent.
|
||||||
result = node->GetParentNode(getter_AddRefs(parentNode));
|
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(node);
|
||||||
if ((NS_FAILED(result) || parentNode != weakNodeUsed) && node != weakNodeUsed) //we are not pointing to same node! offset is meaningless
|
if (NS_SUCCEEDED(result) && textNode && node != weakNodeUsed)//then the offset is meaningless.
|
||||||
offsetused = -1;//0 because when grabbing a child content we grab the IDX'th object or: body has 2 children,
|
{
|
||||||
//index 0 of parent is the first child so if we say the first child is the frame then say offset is 0 we are correct
|
offsetused = 0;//0 because when grabbing a child content we grab the IDX'th object or: body has 2 children,
|
||||||
|
//index 0 of parent is the first child so if we say the first child is the frame then say offset is 0 we are correct
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = node->GetParentNode(getter_AddRefs(parentNode));
|
||||||
|
if ((NS_FAILED(result) || parentNode != weakNodeUsed) && node != weakNodeUsed) //we are not pointing to same node! offset is meaningless
|
||||||
|
offsetused = -1;
|
||||||
|
}
|
||||||
nsPeekOffsetStruct pos;
|
nsPeekOffsetStruct pos;
|
||||||
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
||||||
switch (aKeycode){
|
switch (aKeycode){
|
||||||
|
@ -1325,12 +1325,19 @@ nsSelection::MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aA
|
|||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||||
nsCOMPtr<nsIDOMNode> parentNode;
|
nsCOMPtr<nsIDOMNode> parentNode;
|
||||||
//we also need to check to see if the result frame's content's parent is equal to the weaknode used of course.
|
//we also need to check to see if the result frame's content's parent is equal to the weaknode used of course.
|
||||||
|
//except for special case of text frames where they are their own parent.
|
||||||
result = node->GetParentNode(getter_AddRefs(parentNode));
|
nsCOMPtr<nsIDOMText> textNode = do_QueryInterface(node);
|
||||||
if ((NS_FAILED(result) || parentNode != weakNodeUsed) && node != weakNodeUsed) //we are not pointing to same node! offset is meaningless
|
if (NS_SUCCEEDED(result) && textNode && node != weakNodeUsed)//then the offset is meaningless.
|
||||||
offsetused = -1;//0 because when grabbing a child content we grab the IDX'th object or: body has 2 children,
|
{
|
||||||
//index 0 of parent is the first child so if we say the first child is the frame then say offset is 0 we are correct
|
offsetused = 0;//0 because when grabbing a child content we grab the IDX'th object or: body has 2 children,
|
||||||
|
//index 0 of parent is the first child so if we say the first child is the frame then say offset is 0 we are correct
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = node->GetParentNode(getter_AddRefs(parentNode));
|
||||||
|
if ((NS_FAILED(result) || parentNode != weakNodeUsed) && node != weakNodeUsed) //we are not pointing to same node! offset is meaningless
|
||||||
|
offsetused = -1;
|
||||||
|
}
|
||||||
nsPeekOffsetStruct pos;
|
nsPeekOffsetStruct pos;
|
||||||
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
||||||
switch (aKeycode){
|
switch (aKeycode){
|
||||||
|
Loading…
Reference in New Issue
Block a user