Index: third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_builder.h |
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_builder.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_builder.h |
index 03158f97d66e9974a1440e688896e35f0303c29b..0ee873f5f11538ee8f17e327e9fc8b6c30b8d37e 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_builder.h |
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_builder.h |
@@ -6,12 +6,15 @@ |
#define NGOffsetMappingBuilder_h |
#include "core/CoreExport.h" |
+#include "core/layout/LayoutText.h" |
#include "platform/wtf/Allocator.h" |
#include "platform/wtf/Vector.h" |
#include "platform/wtf/text/WTFString.h" |
namespace blink { |
+struct NGOffsetMappingResult; |
+ |
// This is the helper class for constructing the DOM-to-TextContent offset |
// mapping. It holds an offset mapping, and provides APIs to modify the mapping |
// step by step until the construction is finished. |
@@ -23,11 +26,9 @@ class CORE_EXPORT NGOffsetMappingBuilder { |
public: |
NGOffsetMappingBuilder(); |
- // TODO(xiaochengh): Add the following API when we implement the construction |
- // of the concatenated offset mapping. |
// Associate the offset mapping with a simple annotation with the given node |
// as its value. |
- // void Annotate(const Node&); |
+ void Annotate(const LayoutText*); |
// Append an identity offset mapping of the specified length with null |
// annotation to the builder. |
@@ -53,22 +54,18 @@ class CORE_EXPORT NGOffsetMappingBuilder { |
// This function changes the space into collapsed. |
void CollapseTrailingSpace(unsigned index); |
- // TODO(xiaochengh): Add the following API when we implement the construction |
- // of the concatenated offset mapping. |
// Concatenate the offset mapping held by another builder to this builder. |
- // void Concatenate(const OffsetMappingBuilder&); |
- |
- // TODO(xiaochengh): Add the following APIs when we implement the construction |
- // of the DOM-to-TextContent offset mapping. |
+ void Concatenate(const NGOffsetMappingBuilder&); |
// Composite the offset mapping held by another builder to this builder. |
- // void Composite(const OffsetMappingBuilder&); |
+ void Composite(const NGOffsetMappingBuilder&); |
// Finalize and return the offset mapping. |
- // OffsetMappingResult Build(); |
+ NGOffsetMappingResult Build() const; |
// Exposed for testing only. |
Vector<unsigned> DumpOffsetMappingForTesting() const; |
+ Vector<const LayoutText*> DumpAnnotationForTesting() const; |
private: |
// A mock implementation of the offset mapping builder that stores the mapping |
@@ -76,6 +73,10 @@ class CORE_EXPORT NGOffsetMappingBuilder { |
// will be replaced by a real efficient implementation. |
Vector<unsigned> mapping_; |
+ // A mock implementation that stores the annotation value of all offsets in |
+ // the plain way. It will be replaced by a real implementation for efficiency. |
+ Vector<const LayoutText*> annotation_; |
+ |
DISALLOW_COPY_AND_ASSIGN(NGOffsetMappingBuilder); |
}; |