Commit 6f73fcda authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Add a use counter for `unicode-bidi: plaintext`

To measure the usage to help discussions.

Change-Id: Iaaada2de6899c38edd3f4be5624c832dfd119a14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2470896
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817016}
parent 239ac1b3
...@@ -3034,6 +3034,7 @@ enum WebFeature { ...@@ -3034,6 +3034,7 @@ enum WebFeature {
kNewLayoutOverflowDifferentFlex = 3703, kNewLayoutOverflowDifferentFlex = 3703,
kNewLayoutOverflowDifferentAndAlreadyScrollsBlock = 3704, kNewLayoutOverflowDifferentAndAlreadyScrollsBlock = 3704,
kNewLayoutOverflowDifferentAndAlreadyScrollsFlex = 3705, kNewLayoutOverflowDifferentAndAlreadyScrollsFlex = 3705,
kUnicodeBidiPlainText = 3706,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
......
...@@ -1085,7 +1085,7 @@ void NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::EnterBlock( ...@@ -1085,7 +1085,7 @@ void NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::EnterBlock(
has_bidi_controls_ = true; has_bidi_controls_ = true;
// It's not easy to compute which lines will change with `unicode-bidi: // It's not easy to compute which lines will change with `unicode-bidi:
// plaintext`. Since it is quite uncommon that just disable line cache. // plaintext`. Since it is quite uncommon that just disable line cache.
changes_may_affect_earlier_lines_ = true; has_unicode_bidi_plain_text_ = true;
break; break;
} }
} else { } else {
...@@ -1129,7 +1129,7 @@ void NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::EnterInline( ...@@ -1129,7 +1129,7 @@ void NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::EnterInline(
kPopDirectionalIsolateCharacter); kPopDirectionalIsolateCharacter);
break; break;
case UnicodeBidi::kPlaintext: case UnicodeBidi::kPlaintext:
changes_may_affect_earlier_lines_ = true; has_unicode_bidi_plain_text_ = true;
EnterBidiContext(node, kFirstStrongIsolateCharacter, EnterBidiContext(node, kFirstStrongIsolateCharacter,
kPopDirectionalIsolateCharacter); kPopDirectionalIsolateCharacter);
break; break;
...@@ -1251,7 +1251,7 @@ void NGInlineItemsBuilderTemplate< ...@@ -1251,7 +1251,7 @@ void NGInlineItemsBuilderTemplate<
data->has_ruby_ = has_ruby_; data->has_ruby_ = has_ruby_;
data->is_empty_inline_ = IsEmptyInline(); data->is_empty_inline_ = IsEmptyInline();
data->is_block_level_ = IsBlockLevel(); data->is_block_level_ = IsBlockLevel();
data->changes_may_affect_earlier_lines_ = ChangesMayAffectEarlierLines(); data->changes_may_affect_earlier_lines_ = HasUnicodeBidiPlainText();
} }
template <typename OffsetMappingBuilder> template <typename OffsetMappingBuilder>
......
...@@ -62,12 +62,10 @@ class NGInlineItemsBuilderTemplate { ...@@ -62,12 +62,10 @@ class NGInlineItemsBuilderTemplate {
bool IsBlockLevel() const { return is_block_level_; } bool IsBlockLevel() const { return is_block_level_; }
// True if changes to an item may affect different layout of earlier lines. // True if there were any `unicode-bidi: plaintext`. In this case, changes to
// May not be able to use line caches even when the line or earlier lines are // an item may affect different layout of earlier lines. May not be able to
// not dirty. // use line caches even when the line or earlier lines are not dirty.
bool ChangesMayAffectEarlierLines() const { bool HasUnicodeBidiPlainText() const { return has_unicode_bidi_plain_text_; }
return changes_may_affect_earlier_lines_;
}
// Append a string from |LayoutText|. // Append a string from |LayoutText|.
// //
...@@ -184,7 +182,7 @@ class NGInlineItemsBuilderTemplate { ...@@ -184,7 +182,7 @@ class NGInlineItemsBuilderTemplate {
bool has_ruby_ = false; bool has_ruby_ = false;
bool is_empty_inline_ = true; bool is_empty_inline_ = true;
bool is_block_level_ = true; bool is_block_level_ = true;
bool changes_may_affect_earlier_lines_ = false; bool has_unicode_bidi_plain_text_ = false;
// Append a character. // Append a character.
// Currently this function is for adding control characters such as // Currently this function is for adding control characters such as
......
...@@ -954,6 +954,9 @@ void NGInlineNode::CollectInlines(NGInlineNodeData* data, ...@@ -954,6 +954,9 @@ void NGInlineNode::CollectInlines(NGInlineNodeData* data,
NGInlineItemsBuilder builder(block, &data->items); NGInlineItemsBuilder builder(block, &data->items);
CollectInlinesInternal(&builder, previous_data); CollectInlinesInternal(&builder, previous_data);
builder.DidFinishCollectInlines(data); builder.DidFinishCollectInlines(data);
if (UNLIKELY(builder.HasUnicodeBidiPlainText()))
UseCounter::Count(GetDocument(), WebFeature::kUnicodeBidiPlainText);
} }
void NGInlineNode::SegmentText(NGInlineNodeData* data) const { void NGInlineNode::SegmentText(NGInlineNodeData* data) const {
......
...@@ -29918,6 +29918,7 @@ Called by update_use_counter_feature_enum.py.--> ...@@ -29918,6 +29918,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3703" label="NewLayoutOverflowDifferentFlex"/> <int value="3703" label="NewLayoutOverflowDifferentFlex"/>
<int value="3704" label="NewLayoutOverflowDifferentAndAlreadyScrollsBlock"/> <int value="3704" label="NewLayoutOverflowDifferentAndAlreadyScrollsBlock"/>
<int value="3705" label="NewLayoutOverflowDifferentAndAlreadyScrollsFlex"/> <int value="3705" label="NewLayoutOverflowDifferentAndAlreadyScrollsFlex"/>
<int value="3706" label="UnicodeBidiPlainText"/>
</enum> </enum>
<enum name="FeaturePolicyAllowlistType"> <enum name="FeaturePolicyAllowlistType">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment