diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules-expected.txt index f0736425b1df3..a8f2650d4b67b 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/rendering/bidi-rendering/unicode-bidi-ua-rules-expected.txt @@ -108,10 +108,10 @@ PASS UA stylesheet rule for unicode-bidi, for PASS UA stylesheet rule for unicode-bidi, for PASS UA stylesheet rule for unicode-bidi, for PASS UA stylesheet rule for unicode-bidi, for -FAIL UA stylesheet rule for unicode-bidi, for assert_equals: with dir=auto expected "plaintext" but got "isolate" -FAIL UA stylesheet rule for unicode-bidi, for assert_equals: with dir=auto expected "plaintext" but got "isolate" -FAIL UA stylesheet rule for unicode-bidi, for assert_equals: with dir=auto expected "plaintext" but got "isolate" -FAIL UA stylesheet rule for unicode-bidi, for assert_equals: with dir=auto expected "plaintext" but got "isolate" +PASS UA stylesheet rule for unicode-bidi, for +PASS UA stylesheet rule for unicode-bidi, for +PASS UA stylesheet rule for unicode-bidi, for +PASS UA stylesheet rule for unicode-bidi, for PASS UA stylesheet rule for unicode-bidi, for PASS UA stylesheet rule for unicode-bidi, for PASS UA stylesheet rule for unicode-bidi, for diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css index b703c1673de6f..d73bc40e948ea 100644 --- a/Source/WebCore/css/html.css +++ b/Source/WebCore/css/html.css @@ -1412,6 +1412,10 @@ thead, tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output, unicode-bidi: isolate; } +textarea[dir=auto i], pre[dir=auto i] { + unicode-bidi: plaintext; +} + input[type=tel i]:dir(ltr) { direction: ltr; } bdo, bdo[dir] { diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index ad68f945b8752..db04f45830dcc 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -130,7 +130,9 @@ String HTMLElement::nodeName() const static inline CSSValueID unicodeBidiAttributeForDirAuto(HTMLElement& element) { ASSERT(!element.hasTagName(bdoTag)); - if (element.hasTagName(preTag) || element.hasTagName(textareaTag)) + ASSERT(!element.hasTagName(preTag)); + ASSERT(!element.hasTagName(textareaTag)); + if (RefPtr input = dynamicDowncast(element); input && (input->isTelephoneField() || input->isEmailField() || input->isSearchField() || input->isURLField())) return CSSValuePlaintext; return CSSValueIsolate; } @@ -246,7 +248,7 @@ void HTMLElement::collectPresentationalHintsForAttribute(const QualifiedName& na break; case AttributeNames::dirAttr: if (equalLettersIgnoringASCIICase(value, "auto"_s)) { - if (!hasTagName(bdoTag)) + if (!hasTagName(bdoTag) && !hasTagName(preTag) && !hasTagName(textareaTag)) addPropertyToPresentationalHintStyle(style, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(*this)); } else if (equalLettersIgnoringASCIICase(value, "rtl"_s) || equalLettersIgnoringASCIICase(value, "ltr"_s)) addPropertyToPresentationalHintStyle(style, CSSPropertyDirection, value);