[webkit-changes] [WebKit/WebKit] def69b: Ruby in WebVTT are not rendered correctly

danae404 noreply at github.com
Mon Oct 2 14:08:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: def69bfc9d9e2333a4c6bc5a254169754f0f4116
      https://github.com/WebKit/WebKit/commit/def69bfc9d9e2333a4c6bc5a254169754f0f4116
  Author: Dana Estra <destra at apple.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    A LayoutTests/media/track/captions-webvtt/ruby.vtt
    A LayoutTests/media/track/webvtt-ruby-expected.txt
    A LayoutTests/media/track/webvtt-ruby.html
    M Source/WebCore/css/SelectorCheckerTestFunctions.h
    M Source/WebCore/dom/Node.h
    M Source/WebCore/html/RubyElement.h
    M Source/WebCore/html/RubyTextElement.h
    M Source/WebCore/html/track/VTTCue.cpp
    M Source/WebCore/html/track/WebVTTElement.cpp
    M Source/WebCore/html/track/WebVTTElement.h
    M Source/WebCore/html/track/WebVTTParser.cpp
    M Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
    M Source/WebCore/style/ElementRuleCollector.cpp

  Log Message:
  -----------
  Ruby in WebVTT are not rendered correctly
https://bugs.webkit.org/show_bug.cgi?id=262064
rdar://116011365

Reviewed by Jer Noble and Eric Carlson.

This patch creates a new class WebVTTRubyElement, a subclass of WebVTTElementImpl
And RubyElement. Now, each ruby tag in a VTT is associated with a WebVTTRubyElement,
Which has access to RubyElement::createElementRenderer() to render it appropriately.

Added a layout test to check that ruby elements in WebVTT cues are positioned correctly.

* LayoutTests/media/track/captions-webvtt/ruby.vtt: Added.
* LayoutTests/media/track/webvtt-ruby.html: Added.
* LayoutTests/media/track/webvtt-ruby-expected.txt: Added.
* Source/WebCore/css/SelectorCheckerTestFunctions.h:
(WebCore::matchesLangPseudoClass):
(WebCore::matchesFutureCuePseudoClass):
(WebCore::matchesPastCuePseudoClass):
* Source/WebCore/dom/Node.h:
(WebCore::Node::isWebVTTRubyElement const):
(WebCore::Node::isWebVTTRubyTextElement const):
* Source/WebCore/html/RubyElement.h:
(): Deleted.
* Source/WebCore/html/RubyTextElement.h:
(): Deleted.
* Source/WebCore/html/track/VTTCue.cpp:
(WebCore::VTTCue::markFutureAndPastNodes):
* Source/WebCore/html/track/WebVTTElement.cpp:
(WebCore::WebVTTElement::WebVTTElement):
(WebCore::WebVTTElementImpl::create):
(WebCore::WebVTTElementImpl::cloneElementWithoutAttributesAndChildren):
(WebCore::WebVTTElementImpl::createEquivalentHTMLElement):
(WebCore::WebVTTElement::create): Deleted.
(WebCore::WebVTTElement::cloneElementWithoutAttributesAndChildren): Deleted.
(WebCore::WebVTTElement::createEquivalentHTMLElement): Deleted.
* Source/WebCore/html/track/WebVTTElement.h:
(WebCore::WebVTTElementImpl::WebVTTElementImpl):
(isType):
* Source/WebCore/html/track/WebVTTParser.cpp:
(WebCore::WebVTTTreeBuilder::currentType const):
(WebCore::WebVTTTreeBuilder::buildFromString):
(WebCore::WebVTTTreeBuilder::constructTreeFromToken):
* Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::collectMatchingShadowPseudoElementRules):

Canonical link: https://commits.webkit.org/268746@main




More information about the webkit-changes mailing list