WebCore:
authorjustin.garcia@apple.com <justin.garcia@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 May 2008 22:50:56 +0000 (22:50 +0000)
committerjustin.garcia@apple.com <justin.garcia@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 May 2008 22:50:56 +0000 (22:50 +0000)
2008-05-05  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by Darin.

        <rdar://problem/5865171> REGRESSION: Creating a new quote places caret at beginning of quote instead of the end

        Disable Range mutation on document modifications in Tiger and Leopard Mail,
        since they do their own mutation which interferes with ours.

        * WebCore.base.exp:
        * dom/Document.cpp:
        (WebCore::Document::nodeChildrenChanged):
        (WebCore::Document::nodeWillBeRemoved):
        (WebCore::Document::textInserted):
        (WebCore::Document::textRemoved):
        (WebCore::Document::textNodesMerged):
        (WebCore::Document::textNodeSplit):
        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        (WebCore::Settings::disableRangeMutationForOldAppleMail):
        * page/Settings.h:
        (WebCore::Settings::rangeMutationDisabledForOldAppleMail):

WebKit/mac:

2008-05-05  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by Darin.

        <rdar://problem/5865171> REGRESSION: Creating a new quote places caret at beginning of quote instead of the end

        * WebView/WebView.mm:
        (-[WebView _updateSettingsFromPreferences:]): Disable Range mutation on changes to
        the document for Tiger and Leopard Mail.  There is code in Mail that does it, and
        the two interfere.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@32883 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/dom/Document.cpp
WebCore/page/Settings.cpp
WebCore/page/Settings.h
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebView.mm

index c3d5fa8..73407ac 100644 (file)
@@ -1,3 +1,26 @@
+2008-05-05  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by Darin.
+
+        <rdar://problem/5865171> REGRESSION: Creating a new quote places caret at beginning of quote instead of the end
+        
+        Disable Range mutation on document modifications in Tiger and Leopard Mail,
+        since they do their own mutation which interferes with ours.
+
+        * WebCore.base.exp:
+        * dom/Document.cpp:
+        (WebCore::Document::nodeChildrenChanged):
+        (WebCore::Document::nodeWillBeRemoved):
+        (WebCore::Document::textInserted):
+        (WebCore::Document::textRemoved):
+        (WebCore::Document::textNodesMerged):
+        (WebCore::Document::textNodeSplit):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        (WebCore::Settings::disableRangeMutationForOldAppleMail):
+        * page/Settings.h:
+        (WebCore::Settings::rangeMutationDisabledForOldAppleMail):
+
 2008-05-05  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Tim Hatcher.
index 05974f4..4484300 100644 (file)
@@ -559,6 +559,7 @@ __ZN7WebCore8Settings29setAuthorAndUserStylesEnabledEb
 __ZN7WebCore8Settings29setWebArchiveDebugModeEnabledEb
 __ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb
 __ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
+__ZN7WebCore8Settings35disableRangeMutationForOldAppleMailEb
 __ZN7WebCore8Settings36setOfflineWebApplicationCacheEnabledEb
 __ZN7WebCore8Settings40setJavaScriptCanOpenWindowsAutomaticallyEb
 __ZN7WebCore8Settings41setNeedsKeyboardEventDisambiguationQuirksEb
index 4edf7b3..4990287 100644 (file)
@@ -2494,9 +2494,11 @@ void Document::detachNodeIterator(NodeIterator *ni)
 
 void Document::nodeChildrenChanged(ContainerNode* container)
 {
-    HashSet<Range*>::const_iterator end = m_ranges.end();
-    for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
-        (*it)->nodeChildrenChanged(container);
+    if (!page()->settings()->rangeMutationDisabledForOldAppleMail()) {
+        HashSet<Range*>::const_iterator end = m_ranges.end();
+        for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+            (*it)->nodeChildrenChanged(container);
+    }
 }
 
 void Document::nodeWillBeRemoved(Node* n)
@@ -2505,9 +2507,11 @@ void Document::nodeWillBeRemoved(Node* n)
     for (HashSet<NodeIterator*>::const_iterator it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it)
         (*it)->nodeWillBeRemoved(n);
 
-    HashSet<Range*>::const_iterator rangesEnd = m_ranges.end();
-    for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != rangesEnd; ++it)
-        (*it)->nodeWillBeRemoved(n);
+    if (!page()->settings()->rangeMutationDisabledForOldAppleMail()) {
+        HashSet<Range*>::const_iterator rangesEnd = m_ranges.end();
+        for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != rangesEnd; ++it)
+            (*it)->nodeWillBeRemoved(n);
+    }
 
     if (Frame* frame = this->frame()) {
         frame->selectionController()->nodeWillBeRemoved(n);
@@ -2517,9 +2521,11 @@ void Document::nodeWillBeRemoved(Node* n)
 
 void Document::textInserted(Node* text, unsigned offset, unsigned length)
 {
-    HashSet<Range*>::const_iterator end = m_ranges.end();
-    for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
-        (*it)->textInserted(text, offset, length);
+    if (!page()->settings()->rangeMutationDisabledForOldAppleMail()) {
+        HashSet<Range*>::const_iterator end = m_ranges.end();
+        for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+            (*it)->textInserted(text, offset, length);
+    }
 
     // Update the markers for spelling and grammar checking.
     shiftMarkers(text, offset, length);
@@ -2527,9 +2533,11 @@ void Document::textInserted(Node* text, unsigned offset, unsigned length)
 
 void Document::textRemoved(Node* text, unsigned offset, unsigned length)
 {
-    HashSet<Range*>::const_iterator end = m_ranges.end();
-    for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
-        (*it)->textRemoved(text, offset, length);
+    if (!page()->settings()->rangeMutationDisabledForOldAppleMail()) {
+        HashSet<Range*>::const_iterator end = m_ranges.end();
+        for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+            (*it)->textRemoved(text, offset, length);
+    }
 
     // Update the markers for spelling and grammar checking.
     removeMarkers(text, offset, length);
@@ -2538,19 +2546,23 @@ void Document::textRemoved(Node* text, unsigned offset, unsigned length)
 
 void Document::textNodesMerged(Text* oldNode, unsigned offset)
 {
-    NodeWithIndex oldNodeWithIndex(oldNode);
-    HashSet<Range*>::const_iterator end = m_ranges.end();
-    for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
-        (*it)->textNodesMerged(oldNodeWithIndex, offset);
+    if (!page()->settings()->rangeMutationDisabledForOldAppleMail()) {
+        NodeWithIndex oldNodeWithIndex(oldNode);
+        HashSet<Range*>::const_iterator end = m_ranges.end();
+        for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+            (*it)->textNodesMerged(oldNodeWithIndex, offset);
+    }
 
     // FIXME: This should update markers for spelling and grammar checking.
 }
 
 void Document::textNodeSplit(Text* oldNode)
 {
-    HashSet<Range*>::const_iterator end = m_ranges.end();
-    for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
-        (*it)->textNodeSplit(oldNode);
+    if (!page()->settings()->rangeMutationDisabledForOldAppleMail()) {
+        HashSet<Range*>::const_iterator end = m_ranges.end();
+        for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
+            (*it)->textNodeSplit(oldNode);
+    }
 
     // FIXME: This should update markers for spelling and grammar checking.
 }
index 583f881..3a51289 100644 (file)
@@ -76,6 +76,7 @@ Settings::Settings(Page* page)
     , m_webArchiveDebugModeEnabled(false)
     , m_inApplicationChromeMode(false)
     , m_offlineWebApplicationCacheEnabled(false)
+    , m_rangeMutationDisabledForOldAppleMail(false)
 {
     // A Frame may not have been created yet, so we initialize the AtomicString 
     // hash before trying to use it.
@@ -340,6 +341,11 @@ void Settings::setLocalStorageDatabasePath(const String& path)
     m_localStorageDatabasePath = path;
 }
 
+void Settings::disableRangeMutationForOldAppleMail(bool disable)
+{
+    m_rangeMutationDisabledForOldAppleMail = disable;
+}
+
 void Settings::setApplicationChromeMode(bool mode)
 {
     m_inApplicationChromeMode = mode;
index 09903a3..0008e1f 100644 (file)
@@ -156,6 +156,9 @@ namespace WebCore {
 
         void setLocalStorageDatabasePath(const String&);
         const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; }
+        
+        void disableRangeMutationForOldAppleMail(bool);
+        bool rangeMutationDisabledForOldAppleMail() const { return m_rangeMutationDisabledForOldAppleMail; }
 
         void setApplicationChromeMode(bool);
         bool inApplicationChromeMode() const { return m_inApplicationChromeMode; }
@@ -205,6 +208,7 @@ namespace WebCore {
         bool m_webArchiveDebugModeEnabled : 1;
         bool m_inApplicationChromeMode : 1;
         bool m_offlineWebApplicationCacheEnabled : 1;
+        bool m_rangeMutationDisabledForOldAppleMail : 1;
     };
 
 } // namespace WebCore
index aca9877..221f822 100644 (file)
@@ -1,3 +1,14 @@
+2008-05-05  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by Darin.
+        
+        <rdar://problem/5865171> REGRESSION: Creating a new quote places caret at beginning of quote instead of the end
+
+        * WebView/WebView.mm:
+        (-[WebView _updateSettingsFromPreferences:]): Disable Range mutation on changes to
+        the document for Tiger and Leopard Mail.  There is code in Mail that does it, and
+        the two interfere.
+
 2008-05-05  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Tim Hatcher.
index a6ff366..8f6770e 100644 (file)
@@ -995,6 +995,7 @@ static bool debugWidget = true;
     settings->setNeedsKeyboardEventDisambiguationQuirks([self _needsKeyboardEventDisambiguationQuirks]);
     settings->setNeedsSiteSpecificQuirks(_private->useSiteSpecificSpoofing);
     settings->setWebArchiveDebugModeEnabled([preferences webArchiveDebugModeEnabled]);
+    settings->disableRangeMutationForOldAppleMail(WKAppVersionCheckLessThan(@"com.apple.mail", -1, 4.0));
     settings->setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]);
 }