Bug 29621

Summary: Add port-specific control over rendering of media control elements
Product: WebKit Reporter: Andrew Scherkus <scherkus>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: eric.carlson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: OS X 10.5   
Attachments:
Description Flags
Draft none

Description Andrew Scherkus 2009-09-21 16:08:42 PDT
Ports should be able to control whether a media control element is rendered or not.
Comment 1 Andrew Scherkus 2009-09-21 16:13:07 PDT
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 :)
Comment 2 Andrew Scherkus 2009-09-21 16:15:03 PDT
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
Comment 3 Andrew Scherkus 2009-09-21 18:38:56 PDT
Forgot I had left my previous bug open.  Closing.

*** This bug has been marked as a duplicate of bug 28689 ***
Comment 4 Eric Carlson 2009-09-22 08:39:37 PDT
> +
> +    // 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).
Comment 5 Eric Carlson 2009-09-22 08:42:38 PDT
oops, wrong bug.