| Index: third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp
|
| index 1c72d9b452487d87e062b1f1395fbc785e1379be..27fc66b4d13c28398441f7c4a80a75e2d6977cd8 100644
|
| --- a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp
|
| @@ -157,117 +157,6 @@ EditingStyle* EditingStyleUtilities::createStyleAtSelectionStart(
|
| 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 EditingStyleUtilities::textDirectionForSelection(
|
| - const VisibleSelection& selection,
|
| - EditingStyle* typingStyle,
|
| - bool& hasNestedOrMultipleEmbeddings) {
|
| - hasNestedOrMultipleEmbeddings = true;
|
| -
|
| - if (selection.isNone())
|
| - return NaturalWritingDirection;
|
| -
|
| - Position position = mostForwardCaretPosition(selection.start());
|
| -
|
| - Node* node = position.anchorNode();
|
| - if (!node)
|
| - return NaturalWritingDirection;
|
| -
|
| - Position end;
|
| - if (selection.isRange()) {
|
| - end = mostBackwardCaretPosition(selection.end());
|
| -
|
| - DCHECK(end.document());
|
| - const EphemeralRange caretRange(position.parentAnchoredEquivalent(),
|
| - end.parentAnchoredEquivalent());
|
| - for (Node& n : caretRange.nodes()) {
|
| - if (!n.isStyledElement())
|
| - continue;
|
| -
|
| - CSSComputedStyleDeclaration* style =
|
| - CSSComputedStyleDeclaration::create(&n);
|
| - const CSSValue* unicodeBidi =
|
| - style->getPropertyCSSValue(CSSPropertyUnicodeBidi);
|
| - if (!unicodeBidi || !unicodeBidi->isIdentifierValue())
|
| - continue;
|
| -
|
| - CSSValueID unicodeBidiValue =
|
| - toCSSIdentifierValue(unicodeBidi)->getValueID();
|
| - if (isUnicodeBidiNestedOrMultipleEmbeddings(unicodeBidiValue))
|
| - return NaturalWritingDirection;
|
| - }
|
| - }
|
| -
|
| - if (selection.isCaret()) {
|
| - WritingDirection direction;
|
| - if (typingStyle && typingStyle->textDirection(direction)) {
|
| - hasNestedOrMultipleEmbeddings = false;
|
| - return direction;
|
| - }
|
| - node = selection.visibleStart().deepEquivalent().anchorNode();
|
| - }
|
| - DCHECK(node);
|
| -
|
| - // The selection is either a caret with no typing attributes or a range in
|
| - // which no embedding is added, so just use the start position to decide.
|
| - Node* block = enclosingBlock(node);
|
| - WritingDirection foundDirection = NaturalWritingDirection;
|
| -
|
| - for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*node)) {
|
| - if (runner == block)
|
| - break;
|
| - if (!runner.isStyledElement())
|
| - continue;
|
| -
|
| - Element* element = &toElement(runner);
|
| - CSSComputedStyleDeclaration* style =
|
| - CSSComputedStyleDeclaration::create(element);
|
| - const CSSValue* unicodeBidi =
|
| - style->getPropertyCSSValue(CSSPropertyUnicodeBidi);
|
| - if (!unicodeBidi || !unicodeBidi->isIdentifierValue())
|
| - continue;
|
| -
|
| - CSSValueID unicodeBidiValue =
|
| - toCSSIdentifierValue(unicodeBidi)->getValueID();
|
| - if (unicodeBidiValue == CSSValueNormal)
|
| - continue;
|
| -
|
| - if (unicodeBidiValue == CSSValueBidiOverride)
|
| - return NaturalWritingDirection;
|
| -
|
| - DCHECK(isEmbedOrIsolate(unicodeBidiValue)) << unicodeBidiValue;
|
| - const CSSValue* direction =
|
| - style->getPropertyCSSValue(CSSPropertyDirection);
|
| - if (!direction || !direction->isIdentifierValue())
|
| - continue;
|
| -
|
| - int directionValue = toCSSIdentifierValue(direction)->getValueID();
|
| - if (directionValue != CSSValueLtr && directionValue != CSSValueRtl)
|
| - continue;
|
| -
|
| - if (foundDirection != NaturalWritingDirection)
|
| - return NaturalWritingDirection;
|
| -
|
| - // In the range case, make sure that the embedding element persists until
|
| - // the end of the range.
|
| - if (selection.isRange() && !end.anchorNode()->isDescendantOf(element))
|
| - return NaturalWritingDirection;
|
| -
|
| - foundDirection = directionValue == CSSValueLtr
|
| - ? LeftToRightWritingDirection
|
| - : RightToLeftWritingDirection;
|
| - }
|
| - hasNestedOrMultipleEmbeddings = false;
|
| - return foundDirection;
|
| -}
|
| -
|
| bool EditingStyleUtilities::isTransparentColorValue(const CSSValue* cssValue) {
|
| if (!cssValue)
|
| return true;
|
|
|