W3C home > Mailing lists > Public > www-style@w3.org > July 1998

Re: OBJECT, inheritance, and rendering

From: Simon Richter <geier@psi5.com>
Date: Thu, 30 Jul 1998 03:16:18 +0200
Message-ID: <35BFC960.5158E77D@psi5.com>
To: braden@endoframe.com
CC: "'Todd Fahrner'" <fahrner@pobox.com>, www-style@w3.org, www-html@w3.org
Braden N. McDaniel wrote:

> >> Let's suppose that OBJECT has a plain text file as its data
> >> source.

> > Well, if I load the plain text file directly into a browser
> > window, it is
> > usually displayed as <PRE> text [...]

> > OBJECT: {
> >   inherit-colors: yes;
> >   background-color: white;
> > }

>         IMG { background-color: blue }

> [...]

>         <IMG SRC="myimage.png" ALT="My Image">
>
> Wouldn't you expect the transparent portions of the image to show through
> blue? I would. Therefore I'd also expect this code to render the same way:
>
>         <OBJECT DATA="myimage.png" TYPE="image/png"
>         STYLE="background-color: blue">My Image</OBJECT>
>
> It seems reasonable to extend this to text documents, and probably other
> media that do not inherently specify a background color.

Well, but I would at least like to see some mechanism to turn this off.

> I suggest a
> stickier situation is this:
>
>         <OBJECT DATA="mytext.txt" TYPE="text/plain"
>         STYLE="color: red" HEIGHT="100%" WIDTH="100%">My Text
>         </OBJECT>
>
> Obviously the (fallback) contents of the OBJECT element should be rendered
> in red. But what about the referenced text file?

I think the referenced text file should be rendered in red, but the fallback
contents should not be affected. There are many browsers (e.g. Netscape 4) out
there that do not support <OBJECT>, but do recognize style sheets. For
compatibility, those browsers should still be safe to ignore tags they don't
know. So the style attribute of the object tag should refer to the embedded
object, while the fallback text should be enclosed in <SPAN STYLE="">...</SPAN>.

> Should the text for it be
> rendered in red? Let's not think about this problem just for text files, but
> for *any* monochromatic inclusion via object; I think they should all be
> treated the same way.

Indeed. So what about this: Any style associated with the OBJECT refers to the
embedded content. When rendering the embedded content, only the UA's settings
(agent default, user preferences) and the style information associated with
<OBJECT> should be parsed. Additionally, you can tell <OBJECT> to pass certain
classes of information on (such as fg/bg/link colors, whitespace handling, ...),
so that the information is taken over from the containing element:

<TABLE>
  <TR>
    <TD STYLE="background-color: black;">
      <OBJECT DATA="text1.html" TYPE="text/html">
    </TD>
    <TD STYLE="background-color: blue;">
      <OBJECT DATA="text2.html" TYPE="text/html">
    </TD>
  </TR>
</TABLE>

Now in this example, I would certainly like to have the first OBJECT displayed
with a black background, the second with a blue one. If the HTML files (and
their style sheets) do not specify colors, this should be possible (if they
contain color information, their colors will be used). With your syntax, I would
need to give the OBJECTs ids, then set the background color in the stylesheet.
With "OBJECT {inherit-colors: yes;}" they could easily take over the table's
colors.

> > > Now suppose OBJECT references an HTML file. [...]

> [...] the HTML file in the <OBJECT>
> > sits in its own box, and should not be interfere with
> > what it outside. It can inherit stylesheet
> > settings from the outer HTML file, however.
>
> This, I submit, would be a mistake. AFAICT, there is no inheritance rule to
> deal with this.

Well, but there should be (same table example as above)... :-)

> > IMHO the inner HTML file's style information gains
> > precedence [...]
>
> In a browser that supports CSS, doesn't an HTML file *always* have its own
> style sheet, by virtue of the presence of defaults on the CSS properties? So
> the default style sheet has precendence, and (taking !important declarations
> out of consideration for the moment) replaces the styles in the outer
> document.

Well, okay, that was unclear... IMHO the style information that was specified in
the outer document to be handed down to the inner document should be parsed
after the UA default and user style sheets, but before the inner document's own
style sheet. Only this way we can specify things like background-color in the
outer document, but leave the option of overriding this in the inner document.

CU
   Simon
Received on Wednesday, 29 July 1998 22:24:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:55 GMT