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

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

Issue 2908643002: [DMC #23] Add CompositionMarker (subclass of DocumentMarker) (Closed)
Patch Set: Attempt to fix Android build by using EXPECT_FALSE() 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 11c02f0bd9e56f9466e154446da3f831cf707a4f..7e9f2b187ca988119337768bfdf08f2a81a3c9c3 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp
@@ -63,45 +63,6 @@ inline DocumentMarkerDescription* ToDocumentMarkerDescription(
return 0;
}
-class TextCompositionMarkerDetails final : public DocumentMarkerDetails {
- public:
- static TextCompositionMarkerDetails* Create(Color underline_color,
- bool thick,
- Color background_color);
-
- bool IsComposition() const override { return true; }
- Color UnderlineColor() const { return underline_color_; }
- bool Thick() const { return thick_; }
- Color BackgroundColor() const { return background_color_; }
-
- private:
- TextCompositionMarkerDetails(Color underline_color,
- bool thick,
- Color background_color)
- : underline_color_(underline_color),
- background_color_(background_color),
- thick_(thick) {}
-
- Color underline_color_;
- Color background_color_;
- bool thick_;
-};
-
-TextCompositionMarkerDetails* TextCompositionMarkerDetails::Create(
- Color underline_color,
- bool thick,
- Color background_color) {
- return new TextCompositionMarkerDetails(underline_color, thick,
- background_color);
-}
-
-inline TextCompositionMarkerDetails* ToTextCompositionMarkerDetails(
- DocumentMarkerDetails* details) {
- if (details && details->IsComposition())
- return static_cast<TextCompositionMarkerDetails*>(details);
- return nullptr;
-}
-
DocumentMarker::DocumentMarker(MarkerType type,
unsigned start_offset,
unsigned end_offset)
@@ -120,18 +81,6 @@ DocumentMarker::DocumentMarker(MarkerType type,
? nullptr
: DocumentMarkerDescription::Create(description)) {}
-DocumentMarker::DocumentMarker(unsigned start_offset,
- unsigned end_offset,
- Color underline_color,
- bool thick,
- Color background_color)
- : type_(DocumentMarker::kComposition),
- start_offset_(start_offset),
- end_offset_(end_offset),
- details_(TextCompositionMarkerDetails::Create(underline_color,
- thick,
- background_color)) {}
-
Optional<DocumentMarker::MarkerOffsets>
DocumentMarker::ComputeOffsetsAfterShift(unsigned offset,
unsigned old_length,
@@ -190,27 +139,6 @@ const String& DocumentMarker::Description() const {
return g_empty_string;
}
-Color DocumentMarker::UnderlineColor() const {
- if (TextCompositionMarkerDetails* details =
- ToTextCompositionMarkerDetails(details_.Get()))
- return details->UnderlineColor();
- return Color::kTransparent;
-}
-
-bool DocumentMarker::Thick() const {
- if (TextCompositionMarkerDetails* details =
- ToTextCompositionMarkerDetails(details_.Get()))
- return details->Thick();
- return false;
-}
-
-Color DocumentMarker::BackgroundColor() const {
- if (TextCompositionMarkerDetails* details =
- ToTextCompositionMarkerDetails(details_.Get()))
- return details->BackgroundColor();
- return Color::kTransparent;
-}
-
DEFINE_TRACE(DocumentMarker) {
visitor->Trace(details_);
}

Powered by Google App Engine
This is Rietveld 408576698