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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.h

Issue 2749013003: [LayoutNG] Fix whitespace collapsing when a node is a newline (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.h
index adeb6f9ae1ac74131377be80045aeea515962ba3..4fe4e4254394d793275617d359383b211d4e3128 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.h
@@ -61,11 +61,7 @@ class CORE_EXPORT NGLayoutInlineItemsBuilder {
// LayoutObject.
void Append(UChar, const ComputedStyle* = nullptr, LayoutObject* = nullptr);
- // Append a character.
- // The character is opaque to space collapsing that spaces before this
- // character and after this character can collapse as if this character does
- // not exist.
- void AppendAsOpaqueToSpaceCollapsing(UChar);
+ // Append a Bidi control character, for LTR or RTL depends on the style.
void AppendBidiControl(const ComputedStyle*, UChar ltr, UChar rtl);
void EnterBlock(const ComputedStyle*);
@@ -83,8 +79,9 @@ class CORE_EXPORT NGLayoutInlineItemsBuilder {
} OnExitNode;
Vector<OnExitNode> exits_;
- bool is_last_collapsible_space_ = true;
- bool has_pending_newline_ = false;
+ enum class CollapsibleSpace { None, Space, Newline };
+
+ CollapsibleSpace last_collapsible_space_ = CollapsibleSpace::Space;
bool is_svgtext_ = false;
bool has_bidi_controls_ = false;
@@ -95,8 +92,14 @@ class CORE_EXPORT NGLayoutInlineItemsBuilder {
void ProcessPendingNewline(const String&, const ComputedStyle*);
// Removes the collapsible space at the end of |text_| if exists.
+ void RemoveTrailingCollapsibleSpaceIfExists(unsigned*);
void RemoveTrailingCollapsibleSpace(unsigned*);
+ void RemoveTrailingCollapsibleNewlineIfNeeded(unsigned*,
+ const String&,
+ unsigned,
+ const ComputedStyle*);
+
void Enter(LayoutObject*, UChar);
void Exit(LayoutObject*);
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_layout_inline_items_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698