REGRESSION (r167818): editing/inserting/typing-space-to-trigger-smart-link.html fails...
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 May 2014 20:31:29 +0000 (20:31 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 May 2014 20:31:29 +0000 (20:31 +0000)
<https://bugs.webkit.org/show_bug.cgi?id=132207>
<rdar://problem/16730393>

Source/WebCore:
Reverts the previous workaround in favor of a more specific fix for the
null dereference.

Reviewed by Darin Adler.

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
Check whether the run's start and end are still in the document, as
removeConflictingInlineStyleFromRun() may have removed them.

* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::apply):
Reverted previous workaround.
(WebCore::ApplyEditCommand::ReentrancyGuard::isRecursiveCall): Deleted.
(WebCore::ApplyEditCommand::ReentrancyGuard::Scope::Scope): Deleted.
(WebCore::ApplyEditCommand::ReentrancyGuard::Scope::~Scope): Deleted.

LayoutTests:
Reviewed by Darin Adler.

* editing/apply-style-iframe-crash-expected.txt:
Rebased test result has one fewer new line.
* platform/mac-wk1/TestExpectations:
Remove test from list of expected failures.

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

LayoutTests/ChangeLog
LayoutTests/editing/apply-style-iframe-crash-expected.txt
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/editing/ApplyStyleCommand.cpp
Source/WebCore/editing/CompositeEditCommand.cpp

index b448ba8..d8adcd5 100644 (file)
@@ -1,3 +1,17 @@
+2014-05-09  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        REGRESSION (r167818): editing/inserting/typing-space-to-trigger-smart-link.html fails on WebKit1 bots
+
+        <https://bugs.webkit.org/show_bug.cgi?id=132207>
+        <rdar://problem/16730393>
+
+        Reviewed by Darin Adler.
+
+        * editing/apply-style-iframe-crash-expected.txt:
+        Rebased test result has one fewer new line.
+        * platform/mac-wk1/TestExpectations:
+        Remove test from list of expected failures.
+
 2014-05-12  Alex Christensen  <achristensen@webkit.org>
 
         Implement EXT_shader_texture_lod in WebGL.
index 9119a28..3db3bad 100644 (file)
@@ -15,8 +15,6 @@ webkit.org/b/118269 compositing/geometry/fixed-position-flipped-writing-mode.htm
 
 webkit.org/b/124318 fullscreen/anonymous-block-merge-crash.html [ Pass Failure ]
 
-webkit.org/b/132207 editing/inserting/typing-space-to-trigger-smart-link.html [ Failure ]
-
 ### END OF (1) Failures with bug reports
 ########################################
 
index bdab83c..6a1f43e 100644 (file)
@@ -1,3 +1,27 @@
+2014-05-09  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        REGRESSION (r167818): editing/inserting/typing-space-to-trigger-smart-link.html fails on WebKit1 bots
+
+        <https://bugs.webkit.org/show_bug.cgi?id=132207>
+        <rdar://problem/16730393>
+
+        Reverts the previous workaround in favor of a more specific fix for the
+        null dereference.
+
+        Reviewed by Darin Adler.
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
+        Check whether the run's start and end are still in the document, as
+        removeConflictingInlineStyleFromRun() may have removed them.
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::apply):
+        Reverted previous workaround.
+        (WebCore::ApplyEditCommand::ReentrancyGuard::isRecursiveCall): Deleted.
+        (WebCore::ApplyEditCommand::ReentrancyGuard::Scope::Scope): Deleted.
+        (WebCore::ApplyEditCommand::ReentrancyGuard::Scope::~Scope): Deleted.
+
 2014-05-12  Zan Dobersek  <zdobersek@igalia.com>
 
         Clean up CrossThreadTask
index 51dcfa6..f07d541 100644 (file)
@@ -812,9 +812,10 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, PassRef
         runs.append(InlineRunToApplyStyle(runStart, runEnd, pastEndNode));
     }
 
-    for (size_t i = 0; i < runs.size(); i++) {
-        removeConflictingInlineStyleFromRun(style, runs[i].start, runs[i].end, runs[i].pastEndNode);
-        runs[i].positionForStyleComputation = positionToComputeInlineStyleChange(runs[i].start, runs[i].dummyElement);
+    for (auto& run : runs) {
+        removeConflictingInlineStyleFromRun(style, run.start, run.end, run.pastEndNode);
+        if (run.startAndEndAreStillInDocument())
+            run.positionForStyleComputation = positionToComputeInlineStyleChange(run.start, run.dummyElement);
     }
 
     document().updateLayoutIgnorePendingStylesheets();
index 1517de1..c161c8b 100644 (file)
@@ -80,26 +80,6 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-namespace ApplyEditCommand {
-    
-class ReentrancyGuard {
-public:
-    static bool isRecursiveCall() { return s_nestingCounter; }
-
-    class Scope {
-    public:
-        Scope() { ++s_nestingCounter; }
-        ~Scope() { --s_nestingCounter; }
-    };
-    friend class Scope;
-
-private:
-    static unsigned s_nestingCounter;
-};
-unsigned ApplyEditCommand::ReentrancyGuard::s_nestingCounter;
-    
-} // namespace ApplyEditCommand
-
 PassRefPtr<EditCommandComposition> EditCommandComposition::create(Document& document,
     const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, EditAction editAction)
 {
@@ -214,12 +194,6 @@ CompositeEditCommand::~CompositeEditCommand()
 
 void CompositeEditCommand::apply()
 {
-    // It's possible to enter this recursively, but legitimate cases of that are rare, and it can cause crashes. As a
-    // temporary fix, guard against recursive calls.
-    // FIXME: <rdar://16701803> Remove this workaround when <rdar://15797536> is fixed.
-    if (ApplyEditCommand::ReentrancyGuard::isRecursiveCall())
-        return;
-
     if (!endingSelection().isContentRichlyEditable()) {
         switch (editingAction()) {
         case EditActionTyping:
@@ -247,7 +221,6 @@ void CompositeEditCommand::apply()
 
     {
         EventQueueScope eventQueueScope;
-        ApplyEditCommand::ReentrancyGuard::Scope reentrancyGuardScope;
 #if ENABLE(DELETION_UI)
         DeleteButtonControllerDisableScope deleteButtonControllerDisableScope(&frame());
 #endif