Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp

Issue 2911723002: [DMC #24] Add SpellingMarker and GrammarMarker (subclasses of DocumentMarker) (Closed)
Patch Set: Add IsSpellCheckMarker() tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp
index 7e9f2b187ca988119337768bfdf08f2a81a3c9c3..7ecc32224ae3bf05816778252de2839a07336709 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp
@@ -35,52 +35,15 @@
namespace blink {
-DocumentMarkerDetails::~DocumentMarkerDetails() {}
-
-class DocumentMarkerDescription final : public DocumentMarkerDetails {
- public:
- static DocumentMarkerDescription* Create(const String&);
-
- const String& Description() const { return description_; }
- bool IsDescription() const override { return true; }
-
- private:
- explicit DocumentMarkerDescription(const String& description)
- : description_(description) {}
-
- String description_;
-};
-
-DocumentMarkerDescription* DocumentMarkerDescription::Create(
- const String& description) {
- return new DocumentMarkerDescription(description);
-}
-
-inline DocumentMarkerDescription* ToDocumentMarkerDescription(
- DocumentMarkerDetails* details) {
- if (details && details->IsDescription())
- return static_cast<DocumentMarkerDescription*>(details);
- return 0;
-}
+DocumentMarker::~DocumentMarker() = default;
DocumentMarker::DocumentMarker(MarkerType type,
unsigned start_offset,
unsigned end_offset)
: type_(type), start_offset_(start_offset), end_offset_(end_offset) {
- DCHECK_LT(start_offset, end_offset);
+ DCHECK_LT(start_offset_, end_offset_);
}
-DocumentMarker::DocumentMarker(MarkerType type,
- unsigned start_offset,
- unsigned end_offset,
- const String& description)
- : type_(type),
- start_offset_(start_offset),
- end_offset_(end_offset),
- details_(description.IsEmpty()
- ? nullptr
- : DocumentMarkerDescription::Create(description)) {}
-
Optional<DocumentMarker::MarkerOffsets>
DocumentMarker::ComputeOffsetsAfterShift(unsigned offset,
unsigned old_length,
@@ -132,15 +95,4 @@ void DocumentMarker::ShiftOffsets(int delta) {
end_offset_ += delta;
}
-const String& DocumentMarker::Description() const {
- if (DocumentMarkerDescription* details =
- ToDocumentMarkerDescription(details_.Get()))
- return details->Description();
- return g_empty_string;
-}
-
-DEFINE_TRACE(DocumentMarker) {
- visitor->Trace(details_);
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698