summaryrefslogtreecommitdiff
path: root/Source/WebCore/editing/htmlediting.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-25 13:35:59 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-25 13:35:59 +0200
commit79ad030d505ccf79cf10aa9f8189ca3e2f61f6f4 (patch)
tree0287b1a69d84492c901e8bc820e635e7133809a0 /Source/WebCore/editing/htmlediting.cpp
parent682ab87480e7757346802ce7f54cfdbdfeb2339e (diff)
downloadqtwebkit-79ad030d505ccf79cf10aa9f8189ca3e2f61f6f4.tar.gz
Imported WebKit commit c4b613825abd39ac739a47d7b4410468fcef66dc (http://svn.webkit.org/repository/webkit/trunk@121147)
New snapshot that includes Win32 debug build fix (use SVGAllInOne)
Diffstat (limited to 'Source/WebCore/editing/htmlediting.cpp')
-rw-r--r--Source/WebCore/editing/htmlediting.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp
index e180ccabd..7d8fc390d 100644
--- a/Source/WebCore/editing/htmlediting.cpp
+++ b/Source/WebCore/editing/htmlediting.cpp
@@ -145,12 +145,16 @@ Node* lowestEditableAncestor(Node* node)
return lowestRoot;
}
-bool isEditablePosition(const Position& p, EditableType editableType)
+bool isEditablePosition(const Position& p, EditableType editableType, EUpdateStyle updateStyle)
{
Node* node = p.deprecatedNode();
if (!node)
return false;
-
+ if (updateStyle == UpdateStyle)
+ node->document()->updateLayoutIgnorePendingStylesheets();
+ else
+ ASSERT(updateStyle == DoNotUpdateStyle);
+
if (node->renderer() && node->renderer()->isTable())
node = node->parentNode();
@@ -255,11 +259,15 @@ VisiblePosition firstEditablePositionAfterPositionInRoot(const Position& positio
return firstPositionInNode(highestRoot);
Position p = position;
-
- if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode())
- if (shadowAncestor != p.deprecatedNode())
- p = positionAfterNode(shadowAncestor);
-
+
+ if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
+ Node* shadowAncestor = highestRoot->treeScope()->ancestorInThisScope(p.deprecatedNode());
+ if (!shadowAncestor)
+ return VisiblePosition();
+
+ p = positionAfterNode(shadowAncestor);
+ }
+
while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))
p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(p.deprecatedNode()) : nextVisuallyDistinctCandidate(p);
@@ -277,9 +285,12 @@ VisiblePosition lastEditablePositionBeforePositionInRoot(const Position& positio
Position p = position;
- if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode()) {
- if (shadowAncestor != p.deprecatedNode())
- p = firstPositionInOrBeforeNode(shadowAncestor);
+ if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
+ Node* shadowAncestor = highestRoot->treeScope()->ancestorInThisScope(p.deprecatedNode());
+ if (!shadowAncestor)
+ return VisiblePosition();
+
+ p = firstPositionInOrBeforeNode(shadowAncestor);
}
while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))