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

Unified Diff: third_party/WebKit/Source/core/editing/EditingStyle.cpp

Issue 1463473002: Make unicode-bidi:isolate the default for elements with dir attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: leviw review Created 5 years 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/editing/EditingStyle.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingStyle.cpp b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
index 3a9cc01984370ff9b2e10be5888b8678a3c31040..015b29e715cdc84acd9a3b6d0f2b566860140272 100644
--- a/third_party/WebKit/Source/core/editing/EditingStyle.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
@@ -557,7 +557,7 @@ bool EditingStyle::textDirection(WritingDirection& writingDirection) const
return false;
CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())->getValueID();
- if (unicodeBidiValue == CSSValueEmbed) {
+ if (isEmbedOrIsolate(unicodeBidiValue)) {
RefPtrWillBeRawPtr<CSSValue> direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection);
if (!direction || !direction->isPrimitiveValue())
return false;
@@ -649,7 +649,7 @@ PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::extractAndRemoveTextDirection
{
RefPtrWillBeRawPtr<EditingStyle> textDirection = EditingStyle::create();
textDirection->m_mutableStyle = MutableStylePropertySet::create(HTMLQuirksMode);
- textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi));
+ textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueIsolate, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi));
textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableStyle->getPropertyValue(CSSPropertyDirection),
m_mutableStyle->propertyIsImportant(CSSPropertyDirection));
@@ -1346,6 +1346,13 @@ PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const V
return style;
}
+static bool isUnicodeBidiNestedOrMultipleEmbeddings(CSSValueID valueID)
+{
+ return valueID == CSSValueEmbed || valueID == CSSValueBidiOverride
+ || valueID == CSSValueWebkitIsolate || valueID == CSSValueWebkitIsolateOverride || valueID == CSSValueWebkitPlaintext
+ || valueID == CSSValueIsolate || valueID == CSSValueIsolateOverride || valueID == CSSValuePlaintext;
+}
+
WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection& selection, EditingStyle* typingStyle, bool& hasNestedOrMultipleEmbeddings)
{
hasNestedOrMultipleEmbeddings = true;
@@ -1375,7 +1382,7 @@ WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection&
continue;
CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())->getValueID();
- if (unicodeBidiValue == CSSValueEmbed || unicodeBidiValue == CSSValueBidiOverride)
+ if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue))
return NaturalWritingDirection;
}
}
@@ -1411,7 +1418,7 @@ WritingDirection EditingStyle::textDirectionForSelection(const VisibleSelection&
if (unicodeBidiValue == CSSValueBidiOverride)
return NaturalWritingDirection;
- ASSERT(unicodeBidiValue == CSSValueEmbed);
+ ASSERT(isEmbedOrIsolate(unicodeBidiValue));
RefPtrWillBeRawPtr<CSSValue> direction = style->getPropertyCSSValue(CSSPropertyDirection);
if (!direction || !direction->isPrimitiveValue())
continue;

Powered by Google App Engine
This is Rietveld 408576698