Ports should be able to control whether a media control element is rendered or not.
Created attachment 39891 [details] Draft This is a draft of deferring the decision on rendering a media control element to the RenderTheme. This is my first real dive into Element/RenderObject/Style/Theme interaction, so feel free to point out my mistakes :)
The overall change is: 1) Media control elements will always create a renderer 2) RenderTheme decides whether those renderers will be visible based on inspecting the HTMLMediaElement
Forgot I had left my previous bug open. Closing. *** This bug has been marked as a duplicate of bug 28689 ***
> + > + // Alternatively we could pass in the theme for fine-tuned adjustment. If > + // we keep it as simply setting display to NONE then I might rename this method > + // shouldDisplayMediaControlPart instead. > + if (!renderer->theme()->shouldRenderMediaControlPart(renderer)) > + style->setDisplay(NONE); This shouldn't be necessary. I think if have both MediaControlElement:: rendererIsNeeded and MediaControlInputElement:: rendererIsNeeded call the theme method it should just work. > bool MediaControlMuteButtonElement::rendererIsNeeded(RenderStyle* style) > { > - return MediaControlInputElement::rendererIsNeeded(style) && !disabled(); > + // All subclasses will probably end up NOT implementing this method anymore. > + return MediaControlInputElement::rendererIsNeeded(style); We do want to call the the base class method, an element could not need a renderer for other reasons (eg. CSS).
oops, wrong bug.