Title: [92441] trunk/Source/WebCore
Revision
92441
Author
[email protected]
Date
2011-08-04 20:25:53 -0700 (Thu, 04 Aug 2011)

Log Message

Reviewed by Ryosuke Niwa.

DocumentMarker: Type specific details should be separately held by other object.
https://bugs.webkit.org/show_bug.cgi?id=59855

- Introduced DocumentMarkerDetails abstract class and two its subclasses
  DocumentMarkerDescription and DocumentMarkerActiveMatch,

- Replacing DocumentMarker::m_description and
  DocumentMarker::m_activeMatch with these new details classes.

No new tests. No behavior change.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:
* dom/DocumentMarker.cpp: Added.
(WebCore::emptyDescription):
(WebCore::DocumentMarkerDetails::DocumentMarkerDetails):
(WebCore::DocumentMarkerDetails::~DocumentMarkerDetails):
(WebCore::DocumentMarkerDescription::description):
(WebCore::DocumentMarkerDescription::isDescription):
(WebCore::DocumentMarkerDescription::DocumentMarkerDescription):
(WebCore::DocumentMarkerDescription::createUnlessEmpty):
(WebCore::DocumentMarkerDescription::compatibleTypes):
(WebCore::DocumentMarkerTextMatch::activeMatch):
(WebCore::DocumentMarkerTextMatch::isTextMatch):
(WebCore::DocumentMarkerTextMatch::DocumentMarkerTextMatch):
(WebCore::DocumentMarkerTextMatch::instanceFor):
(WebCore::DocumentMarkerTextMatch::compatibleTypes):
(WebCore::DocumentMarker::DocumentMarker):
(WebCore::DocumentMarker::shiftOffsets):
(WebCore::DocumentMarker::setActiveMatch):
(WebCore::DocumentMarker::description):
(WebCore::DocumentMarker::activeMatch):
* dom/DocumentMarker.h:
(WebCore::DocumentMarker::details):
(WebCore::DocumentMarker::clearDetails):
(WebCore::DocumentMarkerDetails::isDescription):
(WebCore::DocumentMarkerDetails::isTextMatch):
(WebCore::DocumentMarkerDetails::isAllowedFor):
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (92440 => 92441)


--- trunk/Source/WebCore/CMakeLists.txt	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/CMakeLists.txt	2011-08-05 03:25:53 UTC (rev 92441)
@@ -515,6 +515,7 @@
     dom/DeviceOrientationEvent.cpp
     dom/Document.cpp
     dom/DocumentMarkerController.cpp
+    dom/DocumentMarker.cpp
     dom/DocumentFragment.cpp
     dom/DocumentParser.cpp
     dom/DocumentOrderedMap.cpp

Modified: trunk/Source/WebCore/ChangeLog (92440 => 92441)


--- trunk/Source/WebCore/ChangeLog	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/ChangeLog	2011-08-05 03:25:53 UTC (rev 92441)
@@ -1,3 +1,55 @@
+2011-08-04  MORITA Hajime  <[email protected]>
+
+        Reviewed by Ryosuke Niwa.
+
+        DocumentMarker: Type specific details should be separately held by other object.
+        https://bugs.webkit.org/show_bug.cgi?id=59855
+
+        - Introduced DocumentMarkerDetails abstract class and two its subclasses
+          DocumentMarkerDescription and DocumentMarkerActiveMatch,
+        
+        - Replacing DocumentMarker::m_description and
+          DocumentMarker::m_activeMatch with these new details classes.
+        
+        No new tests. No behavior change.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMAllInOne.cpp:
+        * dom/DocumentMarker.cpp: Added.
+        (WebCore::emptyDescription):
+        (WebCore::DocumentMarkerDetails::DocumentMarkerDetails):
+        (WebCore::DocumentMarkerDetails::~DocumentMarkerDetails):
+        (WebCore::DocumentMarkerDescription::description):
+        (WebCore::DocumentMarkerDescription::isDescription):        
+        (WebCore::DocumentMarkerDescription::DocumentMarkerDescription):
+        (WebCore::DocumentMarkerDescription::createUnlessEmpty):
+        (WebCore::DocumentMarkerDescription::compatibleTypes):
+        (WebCore::DocumentMarkerTextMatch::activeMatch):    
+        (WebCore::DocumentMarkerTextMatch::isTextMatch):
+        (WebCore::DocumentMarkerTextMatch::DocumentMarkerTextMatch):
+        (WebCore::DocumentMarkerTextMatch::instanceFor):
+        (WebCore::DocumentMarkerTextMatch::compatibleTypes):
+        (WebCore::DocumentMarker::DocumentMarker):
+        (WebCore::DocumentMarker::shiftOffsets):
+        (WebCore::DocumentMarker::setActiveMatch):
+        (WebCore::DocumentMarker::description):
+        (WebCore::DocumentMarker::activeMatch):
+        * dom/DocumentMarker.h:
+        (WebCore::DocumentMarker::details):
+        (WebCore::DocumentMarker::clearDetails):
+        (WebCore::DocumentMarkerDetails::isDescription):
+        (WebCore::DocumentMarkerDetails::isTextMatch):
+        (WebCore::DocumentMarkerDetails::isAllowedFor):
+        * dom/DocumentMarkerController.cpp:
+        (WebCore::DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
+
 2011-08-04  Scott Graham  <[email protected]>
 
         Bad interaction between document destruction and unload events

Modified: trunk/Source/WebCore/GNUmakefile.list.am (92440 => 92441)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-08-05 03:25:53 UTC (rev 92441)
@@ -1132,6 +1132,7 @@
 	Source/WebCore/dom/Document.h \
 	Source/WebCore/dom/DocumentMarkerController.cpp \
 	Source/WebCore/dom/DocumentMarkerController.h \
+	Source/WebCore/dom/DocumentMarker.cpp \
 	Source/WebCore/dom/DocumentMarker.h \
 	Source/WebCore/dom/DocumentOrderedMap.cpp \
 	Source/WebCore/dom/DocumentOrderedMap.h \

Modified: trunk/Source/WebCore/WebCore.gypi (92440 => 92441)


--- trunk/Source/WebCore/WebCore.gypi	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/WebCore.gypi	2011-08-05 03:25:53 UTC (rev 92441)
@@ -5266,6 +5266,7 @@
             'dom/Document.cpp',
             'dom/DocumentFragment.cpp',
             'dom/DocumentMarkerController.cpp',
+            'dom/DocumentMarker.cpp',
             'dom/DocumentOrderedMap.cpp',
             'dom/DocumentParser.cpp',
             'dom/DocumentType.cpp',

Modified: trunk/Source/WebCore/WebCore.pro (92440 => 92441)


--- trunk/Source/WebCore/WebCore.pro	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/WebCore.pro	2011-08-05 03:25:53 UTC (rev 92441)
@@ -478,6 +478,7 @@
     dom/Document.cpp \
     dom/DocumentFragment.cpp \
     dom/DocumentMarkerController.cpp \
+    dom/DocumentMarker.cpp \
     dom/DocumentOrderedMap.cpp \
     dom/DocumentParser.cpp \
     dom/DocumentType.cpp \

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (92440 => 92441)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-08-05 03:25:53 UTC (rev 92441)
@@ -44750,6 +44750,58 @@
 				>
 			</File>
 			<File
+				RelativePath="..\dom\DocumentMarker.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_Cairo_CFLite|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release_Cairo_CFLite|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_All|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Production|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
 				RelativePath="..\dom\DocumentOrderedMap.cpp"
 				>
 				<FileConfiguration

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (92440 => 92441)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-08-05 03:25:53 UTC (rev 92441)
@@ -3373,6 +3373,7 @@
 		A77979290D6B9E64003851B9 /* JSImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A77979250D6B9E64003851B9 /* JSImageData.h */; };
 		A77B41A012E675A90054343D /* TextEventInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = A77B419F12E675A90054343D /* TextEventInputType.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A77D0012133B0AEB00D6658C /* TextChecking.h in Headers */ = {isa = PBXBuildFile; fileRef = A77D0011133B0AEB00D6658C /* TextChecking.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A781C6A713828B5D0012A62A /* DocumentMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A781C6A613828B5D0012A62A /* DocumentMarker.cpp */; };
 		A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; };
 		A78E526F1346BD1700AD9C31 /* MeterShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */; };
 		A78E52701346BD1700AD9C31 /* MeterShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A78E526E1346BD1700AD9C31 /* MeterShadowElement.h */; };
@@ -9968,6 +9969,7 @@
 		A77979250D6B9E64003851B9 /* JSImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSImageData.h; sourceTree = "<group>"; };
 		A77B419F12E675A90054343D /* TextEventInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEventInputType.h; sourceTree = "<group>"; };
 		A77D0011133B0AEB00D6658C /* TextChecking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextChecking.h; sourceTree = "<group>"; };
+		A781C6A613828B5D0012A62A /* DocumentMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarker.cpp; sourceTree = "<group>"; };
 		A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; };
 		A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MeterShadowElement.cpp; sourceTree = "<group>"; };
 		A78E526E1346BD1700AD9C31 /* MeterShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeterShadowElement.h; sourceTree = "<group>"; };
@@ -19773,6 +19775,7 @@
 				59A85EAA119D7B6E00DEF1EF /* DeviceOrientationEvent.idl */,
 				490C47CD13E82D1800F7AB82 /* DispatchTask.h */,
 				A8185F3409765765005826D9 /* Document.cpp */,
+				A781C6A613828B5D0012A62A /* DocumentMarker.cpp */,
 				A8185F3809765765005826D9 /* Document.h */,
 				6548E24809E1E04D00AF8020 /* Document.idl */,
 				A8185F3709765765005826D9 /* DocumentFragment.cpp */,
@@ -23941,6 +23944,7 @@
 				A8185F3F09765766005826D9 /* DocumentFragment.cpp in Sources */,
 				93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */,
 				1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */,
+				A781C6A713828B5D0012A62A /* DocumentMarker.cpp in Sources */,
 				CE057FA51220731100A476D5 /* DocumentMarkerController.cpp in Sources */,
 				14947FFD12F80CD200A0F631 /* DocumentOrderedMap.cpp in Sources */,
 				A8C2280E11D4A59700D5A7D3 /* DocumentParser.cpp in Sources */,

Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (92440 => 92441)


--- trunk/Source/WebCore/dom/DOMAllInOne.cpp	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp	2011-08-05 03:25:53 UTC (rev 92441)
@@ -58,6 +58,7 @@
 #include "DeviceOrientationEvent.cpp"
 #include "Document.cpp"
 #include "DocumentFragment.cpp"
+#include "DocumentMarker.cpp"
 #include "DocumentMarkerController.cpp"
 #include "DocumentOrderedMap.cpp"
 #include "DocumentParser.cpp"

Added: trunk/Source/WebCore/dom/DocumentMarker.cpp (0 => 92441)


--- trunk/Source/WebCore/dom/DocumentMarker.cpp	                        (rev 0)
+++ trunk/Source/WebCore/dom/DocumentMarker.cpp	2011-08-05 03:25:53 UTC (rev 92441)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DocumentMarker.h"
+
+namespace WebCore {
+
+DocumentMarkerDetails::~DocumentMarkerDetails()
+{
+}
+
+class DocumentMarkerDescription : public DocumentMarkerDetails {
+public:
+    static PassRefPtr<DocumentMarkerDescription> create(const String&);
+
+    const String& description() const { return m_description; }
+    virtual bool isDescription() const { return true; }
+
+private:
+    DocumentMarkerDescription(const String& description)
+        : m_description(description)
+    {
+    }
+
+    String m_description;
+};
+
+PassRefPtr<DocumentMarkerDescription> DocumentMarkerDescription::create(const String& description)
+{
+    return adoptRef(new DocumentMarkerDescription(description));
+}
+
+inline DocumentMarkerDescription* toDocumentMarkerDescription(DocumentMarkerDetails* details)
+{
+    if (details && details->isDescription())
+        return static_cast<DocumentMarkerDescription*>(details);
+    return 0;
+}
+
+
+class DocumentMarkerTextMatch : public DocumentMarkerDetails {
+public:
+    static PassRefPtr<DocumentMarkerTextMatch> instanceFor(bool);
+
+    bool activeMatch() const { return m_match; }
+    virtual bool isTextMatch() const { return true; }
+
+private:
+    explicit DocumentMarkerTextMatch(bool match)
+        : m_match(match)
+    {
+    }
+
+    bool m_match;
+};
+
+PassRefPtr<DocumentMarkerTextMatch> DocumentMarkerTextMatch::instanceFor(bool match)
+{
+    DEFINE_STATIC_LOCAL(RefPtr<DocumentMarkerTextMatch>, trueInstance, (adoptRef(new DocumentMarkerTextMatch(true))));
+    DEFINE_STATIC_LOCAL(RefPtr<DocumentMarkerTextMatch>, falseInstance, (adoptRef(new DocumentMarkerTextMatch(false))));
+    return match ? trueInstance : falseInstance;
+}
+
+inline DocumentMarkerTextMatch* toDocumentMarkerTextMatch(DocumentMarkerDetails* details)
+{
+    if (details && details->isTextMatch())
+        return static_cast<DocumentMarkerTextMatch*>(details);
+    return 0;
+}
+
+
+DocumentMarker::DocumentMarker() 
+    : m_type(Spelling), m_startOffset(0), m_endOffset(0)
+{
+}
+
+DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset)
+    : m_type(type), m_startOffset(startOffset), m_endOffset(endOffset)
+{
+}
+
+DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset, const String& description)
+    : m_type(type)
+    , m_startOffset(startOffset)
+    , m_endOffset(endOffset)
+    , m_details(description.isEmpty() ? 0 : DocumentMarkerDescription::create(description))
+{
+}
+
+DocumentMarker::DocumentMarker(unsigned startOffset, unsigned endOffset, bool activeMatch)
+    : m_type(DocumentMarker::TextMatch)
+    , m_startOffset(startOffset)
+    , m_endOffset(endOffset)
+    , m_details(DocumentMarkerTextMatch::instanceFor(activeMatch))
+{
+}
+
+void DocumentMarker::shiftOffsets(int delta)
+{
+    m_startOffset += delta;
+    m_endOffset +=  delta;
+}
+
+void DocumentMarker::setActiveMatch(bool active)
+{
+    m_details = DocumentMarkerTextMatch::instanceFor(active);
+}
+
+const String& DocumentMarker::description() const
+{
+    if (DocumentMarkerDescription* details = toDocumentMarkerDescription(m_details.get()))
+        return details->description();
+    return emptyString();
+}
+
+bool DocumentMarker::activeMatch() const
+{
+    if (DocumentMarkerTextMatch* details = toDocumentMarkerTextMatch(m_details.get()))
+        return details->activeMatch();
+    return false;
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/dom/DocumentMarker.h (92440 => 92441)


--- trunk/Source/WebCore/dom/DocumentMarker.h	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/dom/DocumentMarker.h	2011-08-05 03:25:53 UTC (rev 92441)
@@ -25,10 +25,14 @@
 
 #include "PlatformString.h"
 #include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 
 namespace WebCore {
 
+class DocumentMarkerDetails;
+
 // A range of a node within a document that is "marked", such as the range of a misspelled word.
 // It optionally includes a description that could be displayed in the user interface.
 // It also optionally includes a flag specifying whether the match is active, which is ignored
@@ -94,12 +98,13 @@
     MarkerType type() const { return m_type; }
     unsigned startOffset() const { return m_startOffset; }
     unsigned endOffset() const { return m_endOffset; }
-    const String& description() const { return m_description; }
-    bool hasDescription() const { return !m_description.isEmpty(); }
-    bool activeMatch() const { return m_activeMatch; }
 
+    const String& description() const;
+    bool activeMatch() const;
+    DocumentMarkerDetails* details() const;
+
     void setActiveMatch(bool);
-    void clearDescription() { m_description = String(); }
+    void clearDetails() { m_details.clear(); }
 
     // Offset modifications are done by DocumentMarkerController.
     // Other classes should not call following setters.
@@ -121,43 +126,23 @@
     MarkerType m_type;
     unsigned m_startOffset;
     unsigned m_endOffset;
-    String m_description;
-    bool m_activeMatch;
+    RefPtr<DocumentMarkerDetails> m_details;
 };
 
-inline DocumentMarker::DocumentMarker()
-    : m_type(Spelling), m_startOffset(0), m_endOffset(0), m_activeMatch(false)
+inline DocumentMarkerDetails* DocumentMarker::details() const
 {
+    return m_details.get();
 }
 
-inline DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset)
-    : m_type(type), m_startOffset(startOffset), m_endOffset(endOffset), m_activeMatch(false)
+class DocumentMarkerDetails : public RefCounted<DocumentMarkerDetails>
 {
-}
+public:
+    DocumentMarkerDetails() { }
+    virtual ~DocumentMarkerDetails();
+    virtual bool isDescription() const { return false; }
+    virtual bool isTextMatch() const { return false; }
+};
 
-inline DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset, const String& description)
-    : m_type(type), m_startOffset(startOffset), m_endOffset(endOffset), m_description(description), m_activeMatch(false)
-{
-    ASSERT(type == DocumentMarker::Grammar || DocumentMarker::Autocorrected);
-}
-
-inline DocumentMarker::DocumentMarker(unsigned startOffset, unsigned endOffset, bool activeMatch)
-    : m_type(DocumentMarker::TextMatch), m_startOffset(startOffset), m_endOffset(endOffset), m_activeMatch(activeMatch)
-{
-}
-
-inline void DocumentMarker::shiftOffsets(int delta)
-{
-    m_startOffset += delta;
-    m_endOffset +=  delta;
-}
-
-inline void DocumentMarker::setActiveMatch(bool active)
-{
-    ASSERT(m_type == DocumentMarker::TextMatch);
-    m_activeMatch = active;
-}
-
 } // namespace WebCore
 
 #endif // DocumentMarker_h

Modified: trunk/Source/WebCore/dom/DocumentMarkerController.cpp (92440 => 92441)


--- trunk/Source/WebCore/dom/DocumentMarkerController.cpp	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/dom/DocumentMarkerController.cpp	2011-08-05 03:25:53 UTC (rev 92441)
@@ -652,7 +652,7 @@
                 continue;
             }
 
-            marker.clearDescription();
+            marker.clearDetails();
         }
     }
 }

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (92440 => 92441)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2011-08-05 01:45:39 UTC (rev 92440)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2011-08-05 03:25:53 UTC (rev 92441)
@@ -353,12 +353,8 @@
     copyMarkers(markerController->markersInRange(Range::create(document(), node, offset, node, offset + count).get(), DocumentMarker::AllMarkers()), markers);
     replaceTextInNode(node, offset, count, replacementText);
     RefPtr<Range> newRange = Range::create(document(), node, offset, node, offset + replacementText.length());
-    for (size_t i = 0; i < markers.size(); ++i) {
-        if (markers[i].hasDescription())
-            markerController->addMarker(newRange.get(), markers[i].type(), markers[i].description());
-        else
-            markerController->addMarker(newRange.get(), markers[i].type());
-    }
+    for (size_t i = 0; i < markers.size(); ++i)
+        markerController->addMarker(newRange.get(), markers[i].type(), markers[i].description());
 }
 
 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to