Title: [125760] trunk/Source/WebCore
Revision
125760
Author
[email protected]
Date
2012-08-16 01:54:22 -0700 (Thu, 16 Aug 2012)

Log Message

Unreviewed, rolling out r125751.
http://trac.webkit.org/changeset/125751
https://bugs.webkit.org/show_bug.cgi?id=94206

we shouldn't be rolling out this patch without a formal
review. (Requested by rniwa_ on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-08-16

* dom/CharacterData.cpp:
(WebCore::CharacterData::setDataAndUpdate):
* editing/FrameSelection.cpp:
(WebCore::updatePositionAfterAdoptingTextReplacement):
(WebCore::FrameSelection::textWasReplaced):
* editing/FrameSelection.h:
(FrameSelection):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125759 => 125760)


--- trunk/Source/WebCore/ChangeLog	2012-08-16 08:52:25 UTC (rev 125759)
+++ trunk/Source/WebCore/ChangeLog	2012-08-16 08:54:22 UTC (rev 125760)
@@ -1,3 +1,20 @@
+2012-08-16  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r125751.
+        http://trac.webkit.org/changeset/125751
+        https://bugs.webkit.org/show_bug.cgi?id=94206
+
+        we shouldn't be rolling out this patch without a formal
+        review. (Requested by rniwa_ on #webkit).
+
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::setDataAndUpdate):
+        * editing/FrameSelection.cpp:
+        (WebCore::updatePositionAfterAdoptingTextReplacement):
+        (WebCore::FrameSelection::textWasReplaced):
+        * editing/FrameSelection.h:
+        (FrameSelection):
+
 2012-08-16  Marja Hölttä  <[email protected]>
 
         FormController, FileInputType: Enable reading selected file names from document state

Modified: trunk/Source/WebCore/dom/CharacterData.cpp (125759 => 125760)


--- trunk/Source/WebCore/dom/CharacterData.cpp	2012-08-16 08:52:25 UTC (rev 125759)
+++ trunk/Source/WebCore/dom/CharacterData.cpp	2012-08-16 08:54:22 UTC (rev 125760)
@@ -183,11 +183,14 @@
 
 void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength)
 {
-    if (document()->frame())
-        document()->frame()->selection()->textWillBeReplaced(this, offsetOfReplacedData, oldLength, newLength);
     String oldData = m_data;
     m_data = newData;
+
     updateRenderer(offsetOfReplacedData, oldLength);
+
+    if (document()->frame())
+        document()->frame()->selection()->textWasReplaced(this, offsetOfReplacedData, oldLength, newLength);
+
     document()->incDOMTreeVersion();
     dispatchModifiedEvent(oldData);
 }

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (125759 => 125760)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2012-08-16 08:52:25 UTC (rev 125759)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2012-08-16 08:54:22 UTC (rev 125760)
@@ -422,6 +422,8 @@
     // (positionOffset > offset + oldLength) to avoid having a stale offset.
     if (positionOffset > offset + oldLength)
         position.moveToOffset(positionOffset - oldLength + newLength);
+
+    ASSERT(static_cast<unsigned>(position.offsetInContainerNode()) <= node->length());
 }
 
 static inline bool nodeIsDetachedFromDocument(Node* node)
@@ -431,7 +433,7 @@
     return highest->nodeType() == Node::DOCUMENT_FRAGMENT_NODE && !highest->isShadowRoot();
 }
 
-void FrameSelection::textWillBeReplaced(CharacterData* node, unsigned offset, unsigned oldLength, unsigned newLength)
+void FrameSelection::textWasReplaced(CharacterData* node, unsigned offset, unsigned oldLength, unsigned newLength)
 {
     // The fragment check is a performance optimization. See http://trac.webkit.org/changeset/30062.
     if (isNone() || !node || nodeIsDetachedFromDocument(node))

Modified: trunk/Source/WebCore/editing/FrameSelection.h (125759 => 125760)


--- trunk/Source/WebCore/editing/FrameSelection.h	2012-08-16 08:52:25 UTC (rev 125759)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2012-08-16 08:54:22 UTC (rev 125760)
@@ -204,7 +204,7 @@
     void debugRenderer(RenderObject*, bool selected) const;
 
     void nodeWillBeRemoved(Node*);
-    void textWillBeReplaced(CharacterData*, unsigned offset, unsigned oldLength, unsigned newLength);
+    void textWasReplaced(CharacterData*, unsigned offset, unsigned oldLength, unsigned newLength);
 
     void setCaretVisible(bool caretIsVisible) { setCaretVisibility(caretIsVisible ? Visible : Hidden); }
     void clearCaretRectIfNeeded();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to