mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 847983 - Skip script text nodes for content events; r=masayuki
This commit is contained in:
parent
af03a1e9c3
commit
ee94e60acd
@ -230,6 +230,10 @@ static uint32_t CountNewlinesInNativeLength(nsIContent* aContent,
|
|||||||
nsContentEventHandler::GetNativeTextLength(nsIContent* aContent, uint32_t aMaxLength)
|
nsContentEventHandler::GetNativeTextLength(nsIContent* aContent, uint32_t aMaxLength)
|
||||||
{
|
{
|
||||||
if (aContent->IsNodeOfType(nsINode::eTEXT)) {
|
if (aContent->IsNodeOfType(nsINode::eTEXT)) {
|
||||||
|
// Skip text nodes without frames, e.g. inside script elements
|
||||||
|
if (!aContent->GetPrimaryFrame()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
uint32_t textLengthDifference =
|
uint32_t textLengthDifference =
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
// On Mac, the length of a native newline ("\r") is equal to the length of
|
// On Mac, the length of a native newline ("\r") is equal to the length of
|
||||||
@ -309,6 +313,10 @@ static nsresult GenerateFlatTextContent(nsRange* aRange,
|
|||||||
nsIContent* content = static_cast<nsIContent*>(node);
|
nsIContent* content = static_cast<nsIContent*>(node);
|
||||||
|
|
||||||
if (content->IsNodeOfType(nsINode::eTEXT)) {
|
if (content->IsNodeOfType(nsINode::eTEXT)) {
|
||||||
|
// Skip text nodes without frames, e.g. inside script elements
|
||||||
|
if (!content->GetPrimaryFrame()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (content == startNode)
|
if (content == startNode)
|
||||||
AppendSubString(aString, content, aRange->StartOffset(),
|
AppendSubString(aString, content, aRange->StartOffset(),
|
||||||
content->TextLength() - aRange->StartOffset());
|
content->TextLength() - aRange->StartOffset());
|
||||||
|
Loading…
Reference in New Issue
Block a user