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

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc

Issue 2940153002: [LayoutNG] Implement more text-align values and BiDi base direction (Closed)
Patch Set: eae review Created 3 years, 6 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/layout/ng/inline/ng_inline_node.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc
index e00cfde3970536b3d8291ba69f13539787f66171..6befe478dc6a5fb0f6c07c94e3b0e09c4d7995f2 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc
@@ -192,8 +192,7 @@ void NGInlineNode::PrepareLayout() {
// Scan list of siblings collecting all in-flow non-atomic inlines. A single
// NGInlineNode represent a collection of adjacent non-atomic inlines.
CollectInlines(Data().start_inline_, GetLayoutBlockFlow());
- if (Data().is_bidi_enabled_)
- SegmentText();
+ SegmentText();
ShapeText();
}
@@ -282,21 +281,30 @@ LayoutObject* NGInlineNode::CollectInlines(LayoutObject* start,
}
void NGInlineNode::SegmentText() {
- // TODO(kojii): Move this to caller, this will be used again after line break.
+ NGInlineNodeData& data = MutableData();
+ if (!data.is_bidi_enabled_) {
+ data.SetBaseDirection(TextDirection::kLtr);
+ return;
+ }
+
NGBidiParagraph bidi;
- MutableData().text_content_.Ensure16Bit();
- if (!bidi.SetParagraph(Data().text_content_, Style())) {
+ data.text_content_.Ensure16Bit();
+ if (!bidi.SetParagraph(data.text_content_, Style())) {
// On failure, give up bidi resolving and reordering.
- MutableData().is_bidi_enabled_ = false;
+ data.is_bidi_enabled_ = false;
+ data.SetBaseDirection(TextDirection::kLtr);
return;
}
- if (bidi.Direction() == UBIDI_LTR) {
+
+ data.SetBaseDirection(bidi.BaseDirection());
+
+ if (bidi.IsUnidirectional() && IsLtr(bidi.BaseDirection())) {
// All runs are LTR, no need to reorder.
- MutableData().is_bidi_enabled_ = false;
+ data.is_bidi_enabled_ = false;
return;
}
- Vector<NGInlineItem>& items = MutableData().items_;
+ Vector<NGInlineItem>& items = data.items_;
unsigned item_index = 0;
for (unsigned start = 0; start < Data().text_content_.length();) {
UBiDiLevel level;

Powered by Google App Engine
This is Rietveld 408576698