blob: 0e4e363181386a96806cc974e158200b940abbb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_FRAGMENT_MARKER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_FRAGMENT_MARKER_H_
#include "third_party/blink/renderer/core/editing/markers/text_marker_base.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
namespace blink {
// A subclass of TextMarkerBase used for indicating a text fragment on the
// page. See blink/renderer/core/page/scrolling/text_fragment_anchor.h.
class CORE_EXPORT TextFragmentMarker final : public TextMarkerBase {
public:
TextFragmentMarker(unsigned start_offset, unsigned end_offset);
// DocumentMarker implementations
MarkerType GetType() const final;
// TextMarkerBase implementations
bool IsActiveMatch() const final;
private:
DISALLOW_COPY_AND_ASSIGN(TextFragmentMarker);
};
template <>
struct DowncastTraits<TextFragmentMarker> {
static bool AllowFrom(const DocumentMarker& marker) {
return marker.GetType() == DocumentMarker::kTextFragment;
}
static bool AllowFrom(const TextMarkerBase& marker) {
return marker.GetType() == DocumentMarker::kTextFragment;
}
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_TEXT_FRAGMENT_MARKER_H_
|