[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: Next challenge: media support in <link> elements
From:       Lars Knoll <knoll () kde ! org>
Date:       2001-09-28 12:47:04
[Download RAW message or body]

On Friday 28 September 2001 14:06, Martijn Klingens wrote:
> @media works, but before I post a patch here I want to add <link
> media="..."> and @import media ... support as well. This because I expect
> those two elements to affect the current code a bit. Maybe they don't, but
> I'd rather make sure.
>
> Looking in the HTMLLinkElementImpl I found the following code:
>
> -----
> StyleSheetImpl *HTMLLinkElementImpl::sheet() const
> {
>     if ( khtml::printpainter ) {
>         // we're currently printing, return all and print style sheets
>         if( m_media.isNull() || m_media.contains("all") ||
> m_media.contains("print") )
>             return m_sheet;
>     } else {
>         if( m_media.isNull() || m_media.contains("screen") ||
> m_media.contains("all") )
>             return m_sheet;
>     }
>     return 0;
> }
> -----
>
> Could be just me, but is this function actually called again once
> khtml::printpainter is set to true? I actually wonder if it is. Besides,
> this is not generic enough to be able to work with other media types.
>
> For the @media support I added a setMediaType() call to XmlDocumentImpl,
> which works wonders for me and is truly generic.
>
> Back to the real issue: is this above method indeed the method that I need
> to change for generic media support or should I remove the current
> implementation and add my code elsewhere?

This one was a quick hack I once did, to get at least some media support. We 
need to create a new style selector once we are printing, and a more generic 
way of retrieving the sheets for a certain media type would surely be better.

Lars

>
> Martijn

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic