diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 10:22:43 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 12:36:28 +0000 |
commit | 271a6c3487a14599023a9106329505597638d793 (patch) | |
tree | e040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc | |
parent | 7b2ffa587235a47d4094787d72f38102089f402a (diff) | |
download | qtwebengine-chromium-271a6c3487a14599023a9106329505597638d793.tar.gz |
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc b/chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc index 5837555ddcd..83320613a45 100644 --- a/chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc +++ b/chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc @@ -51,7 +51,7 @@ using namespace html_names; struct EntityDescription { UChar entity; - const CString& reference; + const std::string& reference; EntityMask mask; }; @@ -71,8 +71,8 @@ static inline void AppendCharactersReplacingEntitiesInternal( entity_maps[entity_index].mask & entity_mask) { result.Append(text + position_after_last_entity, i - position_after_last_entity); - const CString& replacement = entity_maps[entity_index].reference; - result.Append(replacement.data(), replacement.length()); + const std::string& replacement = entity_maps[entity_index].reference; + result.Append(replacement.c_str(), replacement.length()); position_after_last_entity = i + 1; break; } @@ -88,14 +88,14 @@ void MarkupFormatter::AppendCharactersReplacingEntities( unsigned offset, unsigned length, EntityMask entity_mask) { - DEFINE_STATIC_LOCAL(const CString, amp_reference, ("&")); - DEFINE_STATIC_LOCAL(const CString, lt_reference, ("<")); - DEFINE_STATIC_LOCAL(const CString, gt_reference, (">")); - DEFINE_STATIC_LOCAL(const CString, quot_reference, (""")); - DEFINE_STATIC_LOCAL(const CString, nbsp_reference, (" ")); - DEFINE_STATIC_LOCAL(const CString, tab_reference, ("	")); - DEFINE_STATIC_LOCAL(const CString, line_feed_reference, (" ")); - DEFINE_STATIC_LOCAL(const CString, carriage_return_reference, (" ")); + DEFINE_STATIC_LOCAL(const std::string, amp_reference, ("&")); + DEFINE_STATIC_LOCAL(const std::string, lt_reference, ("<")); + DEFINE_STATIC_LOCAL(const std::string, gt_reference, (">")); + DEFINE_STATIC_LOCAL(const std::string, quot_reference, (""")); + DEFINE_STATIC_LOCAL(const std::string, nbsp_reference, (" ")); + DEFINE_STATIC_LOCAL(const std::string, tab_reference, ("	")); + DEFINE_STATIC_LOCAL(const std::string, line_feed_reference, (" ")); + DEFINE_STATIC_LOCAL(const std::string, carriage_return_reference, (" ")); static const EntityDescription kEntityMaps[] = { {'&', amp_reference, kEntityAmp}, @@ -379,7 +379,7 @@ void MarkupFormatter::AppendCDATASection(StringBuilder& result, } EntityMask MarkupFormatter::EntityMaskForText(const Text& text) const { - if (!SerializeAsHTMLDocument(text)) + if (!SerializeAsHTML()) return kEntityMaskInPCDATA; // TODO(hajimehoshi): We need to switch EditingStrategy. @@ -405,7 +405,7 @@ EntityMask MarkupFormatter::EntityMaskForText(const Text& text) const { // separate end tag. // 4. Other elements self-close. bool MarkupFormatter::ShouldSelfClose(const Element& element) const { - if (SerializeAsHTMLDocument(element)) + if (SerializeAsHTML()) return false; if (element.HasChildren()) return false; @@ -414,10 +414,8 @@ bool MarkupFormatter::ShouldSelfClose(const Element& element) const { return true; } -bool MarkupFormatter::SerializeAsHTMLDocument(const Node& node) const { - if (serialization_type_ == SerializationType::kForcedXML) - return false; - return node.GetDocument().IsHTMLDocument(); +bool MarkupFormatter::SerializeAsHTML() const { + return serialization_type_ == SerializationType::kHTML; } } // namespace blink |