Changeset 92441 in webkit
- Timestamp:
- Aug 4, 2011 8:25:53 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r92375 r92441 516 516 dom/Document.cpp 517 517 dom/DocumentMarkerController.cpp 518 dom/DocumentMarker.cpp 518 519 dom/DocumentFragment.cpp 519 520 dom/DocumentParser.cpp -
trunk/Source/WebCore/ChangeLog
r92439 r92441 1 2011-08-04 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Ryosuke Niwa. 4 5 DocumentMarker: Type specific details should be separately held by other object. 6 https://bugs.webkit.org/show_bug.cgi?id=59855 7 8 - Introduced DocumentMarkerDetails abstract class and two its subclasses 9 DocumentMarkerDescription and DocumentMarkerActiveMatch, 10 11 - Replacing DocumentMarker::m_description and 12 DocumentMarker::m_activeMatch with these new details classes. 13 14 No new tests. No behavior change. 15 16 * CMakeLists.txt: 17 * GNUmakefile.list.am: 18 * WebCore.gypi: 19 * WebCore.pro: 20 * WebCore.vcproj/WebCore.vcproj: 21 * WebCore.xcodeproj/project.pbxproj: 22 * dom/DOMAllInOne.cpp: 23 * dom/DocumentMarker.cpp: Added. 24 (WebCore::emptyDescription): 25 (WebCore::DocumentMarkerDetails::DocumentMarkerDetails): 26 (WebCore::DocumentMarkerDetails::~DocumentMarkerDetails): 27 (WebCore::DocumentMarkerDescription::description): 28 (WebCore::DocumentMarkerDescription::isDescription): 29 (WebCore::DocumentMarkerDescription::DocumentMarkerDescription): 30 (WebCore::DocumentMarkerDescription::createUnlessEmpty): 31 (WebCore::DocumentMarkerDescription::compatibleTypes): 32 (WebCore::DocumentMarkerTextMatch::activeMatch): 33 (WebCore::DocumentMarkerTextMatch::isTextMatch): 34 (WebCore::DocumentMarkerTextMatch::DocumentMarkerTextMatch): 35 (WebCore::DocumentMarkerTextMatch::instanceFor): 36 (WebCore::DocumentMarkerTextMatch::compatibleTypes): 37 (WebCore::DocumentMarker::DocumentMarker): 38 (WebCore::DocumentMarker::shiftOffsets): 39 (WebCore::DocumentMarker::setActiveMatch): 40 (WebCore::DocumentMarker::description): 41 (WebCore::DocumentMarker::activeMatch): 42 * dom/DocumentMarker.h: 43 (WebCore::DocumentMarker::details): 44 (WebCore::DocumentMarker::clearDetails): 45 (WebCore::DocumentMarkerDetails::isDescription): 46 (WebCore::DocumentMarkerDetails::isTextMatch): 47 (WebCore::DocumentMarkerDetails::isAllowedFor): 48 * dom/DocumentMarkerController.cpp: 49 (WebCore::DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange): 50 * editing/CompositeEditCommand.cpp: 51 (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): 52 1 53 2011-08-04 Scott Graham <scottmg@chromium.org> 2 54 -
trunk/Source/WebCore/GNUmakefile.list.am
r92375 r92441 1133 1133 Source/WebCore/dom/DocumentMarkerController.cpp \ 1134 1134 Source/WebCore/dom/DocumentMarkerController.h \ 1135 Source/WebCore/dom/DocumentMarker.cpp \ 1135 1136 Source/WebCore/dom/DocumentMarker.h \ 1136 1137 Source/WebCore/dom/DocumentOrderedMap.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r92390 r92441 5267 5267 'dom/DocumentFragment.cpp', 5268 5268 'dom/DocumentMarkerController.cpp', 5269 'dom/DocumentMarker.cpp', 5269 5270 'dom/DocumentOrderedMap.cpp', 5270 5271 'dom/DocumentParser.cpp', -
trunk/Source/WebCore/WebCore.pro
r92375 r92441 479 479 dom/DocumentFragment.cpp \ 480 480 dom/DocumentMarkerController.cpp \ 481 dom/DocumentMarker.cpp \ 481 482 dom/DocumentOrderedMap.cpp \ 482 483 dom/DocumentParser.cpp \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r92390 r92441 44751 44751 </File> 44752 44752 <File 44753 RelativePath="..\dom\DocumentMarker.cpp" 44754 > 44755 <FileConfiguration 44756 Name="Debug|Win32" 44757 ExcludedFromBuild="true" 44758 > 44759 <Tool 44760 Name="VCCLCompilerTool" 44761 /> 44762 </FileConfiguration> 44763 <FileConfiguration 44764 Name="Release|Win32" 44765 ExcludedFromBuild="true" 44766 > 44767 <Tool 44768 Name="VCCLCompilerTool" 44769 /> 44770 </FileConfiguration> 44771 <FileConfiguration 44772 Name="Debug_Cairo_CFLite|Win32" 44773 ExcludedFromBuild="true" 44774 > 44775 <Tool 44776 Name="VCCLCompilerTool" 44777 /> 44778 </FileConfiguration> 44779 <FileConfiguration 44780 Name="Release_Cairo_CFLite|Win32" 44781 ExcludedFromBuild="true" 44782 > 44783 <Tool 44784 Name="VCCLCompilerTool" 44785 /> 44786 </FileConfiguration> 44787 <FileConfiguration 44788 Name="Debug_All|Win32" 44789 ExcludedFromBuild="true" 44790 > 44791 <Tool 44792 Name="VCCLCompilerTool" 44793 /> 44794 </FileConfiguration> 44795 <FileConfiguration 44796 Name="Production|Win32" 44797 ExcludedFromBuild="true" 44798 > 44799 <Tool 44800 Name="VCCLCompilerTool" 44801 /> 44802 </FileConfiguration> 44803 </File> 44804 <File 44753 44805 RelativePath="..\dom\DocumentOrderedMap.cpp" 44754 44806 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r92375 r92441 3374 3374 A77B41A012E675A90054343D /* TextEventInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = A77B419F12E675A90054343D /* TextEventInputType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3375 3375 A77D0012133B0AEB00D6658C /* TextChecking.h in Headers */ = {isa = PBXBuildFile; fileRef = A77D0011133B0AEB00D6658C /* TextChecking.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3376 A781C6A713828B5D0012A62A /* DocumentMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A781C6A613828B5D0012A62A /* DocumentMarker.cpp */; }; 3376 3377 A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; }; 3377 3378 A78E526F1346BD1700AD9C31 /* MeterShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */; }; … … 9969 9970 A77B419F12E675A90054343D /* TextEventInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEventInputType.h; sourceTree = "<group>"; }; 9970 9971 A77D0011133B0AEB00D6658C /* TextChecking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextChecking.h; sourceTree = "<group>"; }; 9972 A781C6A613828B5D0012A62A /* DocumentMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarker.cpp; sourceTree = "<group>"; }; 9971 9973 A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; }; 9972 9974 A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MeterShadowElement.cpp; sourceTree = "<group>"; }; … … 19774 19776 490C47CD13E82D1800F7AB82 /* DispatchTask.h */, 19775 19777 A8185F3409765765005826D9 /* Document.cpp */, 19778 A781C6A613828B5D0012A62A /* DocumentMarker.cpp */, 19776 19779 A8185F3809765765005826D9 /* Document.h */, 19777 19780 6548E24809E1E04D00AF8020 /* Document.idl */, … … 23942 23945 93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */, 23943 23946 1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */, 23947 A781C6A713828B5D0012A62A /* DocumentMarker.cpp in Sources */, 23944 23948 CE057FA51220731100A476D5 /* DocumentMarkerController.cpp in Sources */, 23945 23949 14947FFD12F80CD200A0F631 /* DocumentOrderedMap.cpp in Sources */, -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r92365 r92441 59 59 #include "Document.cpp" 60 60 #include "DocumentFragment.cpp" 61 #include "DocumentMarker.cpp" 61 62 #include "DocumentMarkerController.cpp" 62 63 #include "DocumentOrderedMap.cpp" -
trunk/Source/WebCore/dom/DocumentMarker.h
r89452 r92441 26 26 #include "PlatformString.h" 27 27 #include <wtf/Forward.h> 28 #include <wtf/RefCounted.h> 29 #include <wtf/RefPtr.h> 28 30 29 31 30 32 namespace WebCore { 33 34 class DocumentMarkerDetails; 31 35 32 36 // A range of a node within a document that is "marked", such as the range of a misspelled word. … … 95 99 unsigned startOffset() const { return m_startOffset; } 96 100 unsigned endOffset() const { return m_endOffset; } 97 const String& description() const { return m_description; } 98 bool hasDescription() const { return !m_description.isEmpty(); } 99 bool activeMatch() const { return m_activeMatch; } 101 102 const String& description() const; 103 bool activeMatch() const; 104 DocumentMarkerDetails* details() const; 100 105 101 106 void setActiveMatch(bool); 102 void clearDe scription() { m_description = String(); }107 void clearDetails() { m_details.clear(); } 103 108 104 109 // Offset modifications are done by DocumentMarkerController. … … 122 127 unsigned m_startOffset; 123 128 unsigned m_endOffset; 124 String m_description; 125 bool m_activeMatch; 129 RefPtr<DocumentMarkerDetails> m_details; 126 130 }; 127 131 128 inline DocumentMarker::DocumentMarker() 129 : m_type(Spelling), m_startOffset(0), m_endOffset(0), m_activeMatch(false) 132 inline DocumentMarkerDetails* DocumentMarker::details() const 130 133 { 134 return m_details.get(); 131 135 } 132 136 133 inline DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset) 134 : m_type(type), m_startOffset(startOffset), m_endOffset(endOffset), m_activeMatch(false) 137 class DocumentMarkerDetails : public RefCounted<DocumentMarkerDetails> 135 138 { 136 } 137 138 inline DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset, const String& description) 139 : m_type(type), m_startOffset(startOffset), m_endOffset(endOffset), m_description(description), m_activeMatch(false) 140 { 141 ASSERT(type == DocumentMarker::Grammar || DocumentMarker::Autocorrected); 142 } 143 144 inline DocumentMarker::DocumentMarker(unsigned startOffset, unsigned endOffset, bool activeMatch) 145 : m_type(DocumentMarker::TextMatch), m_startOffset(startOffset), m_endOffset(endOffset), m_activeMatch(activeMatch) 146 { 147 } 148 149 inline void DocumentMarker::shiftOffsets(int delta) 150 { 151 m_startOffset += delta; 152 m_endOffset += delta; 153 } 154 155 inline void DocumentMarker::setActiveMatch(bool active) 156 { 157 ASSERT(m_type == DocumentMarker::TextMatch); 158 m_activeMatch = active; 159 } 139 public: 140 DocumentMarkerDetails() { } 141 virtual ~DocumentMarkerDetails(); 142 virtual bool isDescription() const { return false; } 143 virtual bool isTextMatch() const { return false; } 144 }; 160 145 161 146 } // namespace WebCore -
trunk/Source/WebCore/dom/DocumentMarkerController.cpp
r89513 r92441 653 653 } 654 654 655 marker.clearDe scription();655 marker.clearDetails(); 656 656 } 657 657 } -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r91308 r92441 354 354 replaceTextInNode(node, offset, count, replacementText); 355 355 RefPtr<Range> newRange = Range::create(document(), node, offset, node, offset + replacementText.length()); 356 for (size_t i = 0; i < markers.size(); ++i) { 357 if (markers[i].hasDescription()) 358 markerController->addMarker(newRange.get(), markers[i].type(), markers[i].description()); 359 else 360 markerController->addMarker(newRange.get(), markers[i].type()); 361 } 356 for (size_t i = 0; i < markers.size(); ++i) 357 markerController->addMarker(newRange.get(), markers[i].type(), markers[i].description()); 362 358 } 363 359
Note: See TracChangeset
for help on using the changeset viewer.