You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Alexey Ivanov <al...@gmail.com> on 2007/08/22 08:37:44 UTC

[classlib][swing][html] CSS is used to specify HTML tag behavior

Hello everyone,

There was created JIRA issue HARMONY-4662 [1], which says that
specifying the default presentation of HTML tags using CSS. I believe
this issue should be discussed here.

In short, Harmony implementation of HTML support has default.css file
which describes the default presentation of HTML elements. This
implementation is similar to that of RI. On the other hand, programmer
can remove (or disable) this style sheet. It leads to the situation
where almost all tags look like a plain text.

In my opinion, using CSS in this situation is the right thing to do.
1) We can easily make adjustments to the way HTML document looks by default.
2) It gives application developers freedom for their application.
Developer can create their own default style sheet and easily replace
the default one shipped with Harmony. Replacing is more effective than
just overriding because Harmony-provided style sheet will be excluded
from style resolution chain, which, in its turn, will free memory and
will save time.
3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
use the similar methods to specify the default look of HTML. The only
difference is that you cannot remove their default style sheet so
easily as in Swing.

Other opinions, comments?

Regards,
Alexey.


[1] https://issues.apache.org/jira/browse/HARMONY-4662

Other links of interest:
Sample style sheet suggested by W3C: http://www.w3.org/TR/REC-CSS2/sample.html
Index of HTML 4.01 elements: http://www.w3.org/TR/html401/index/elements.html

Re: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by Alexey Ivanov <al...@gmail.com>.
> I think the best solution would be to merge the default CSS with user's
> CSS.

Andrey,

There's no need to *merge* them. One should link them in a chain, and
it is what is performed in Swing.

Swing supports cascading of style sheets (probably with some bugs). I
mean you can create a chain of StyleSheet objects where attributes
will be looked up for rendering. And it is the feature that used for
default style sheet.

In more detail, HTMLDocument has StyleSheet instance where user
declarations (those in <style> tag and attributes) will go. On default
initialization, another StyleSheet instance is created; it gets
initialized with parsed default.css. Then default one is added to
document's one using addStyleSheet() method.

Similarly any other referenced style sheets -- be it @import statement
or <link> element -- also get parsed in other StyleSheet instances and
associated together with addStyleSheet() method. (Of course, if I
remember it all correctly.)


Regards,
Alexey.

2007/8/22, Pavlenko, Andrey A <an...@intel.com>:
> I think the best solution would be to merge the default CSS with user's
> CSS.
>
> Alexey, why do you think Harmony ignores the style attribute of HTML
> elements? I've just created a simple test and it works fine for me:
>
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
>
> public class SwingTest {
>
>         public static void main(String[] args) {
>                 JFrame f = new JFrame();
>                 f.add(new JEditorPane("text/html",
>                                 "<center style='color: red'>Hello
> world!</center>"));
>                 f.pack();
>                 f.setVisible(true);
>         }
> }
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 11:29 AM
> To: dev@harmony.apache.org
> Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Vasily,
>
> Yes, I agree with your considerations too.
>
> I guess we should create a mechanism to add another base.css that
> cannot be removed. I pointed to
> javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
> which serves as such mechanism currently. We should find a better
> approach here because user should be able to override the defaults
> specified there as well. At least browsers allow this but neither
> Harmony nor RI does. Harmony is even worse since it ignores the style
> specified the style attribute on HTML element. However, I don't think
> there are many users who'd want to change that but it's a nice feature
> to have, so that Harmony behaves closer to HTML browsers and thus
> provides better HTML support than RI does.
>
> Regards,
> Alexey.
>
> P.S. I knew all browser provided the feature to user style sheet but
> had never tried it. Additionally this feature is quite hidden in
> options dialog boxes.
>
> 2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> > Alexey,
> >
> > Thank you for your attention to this issue. I'm not sure it's a bug
> that
> > needs to be fixed (RI does the same, right), but I think it's an
> > important issue that worth keeping record of.
> >
> > I fully agree with all your considerations about using default
> > stylesheet for specyfying default document look. But there's look
> > (fonts, colors, sizes, weight, margins, padding etc.) and there's the
> > specified element behavior. For example, <center> tag is expected to
> > center text by default - and in our implementation (and in RI) it
> > doesn't. It seems strange, uncomfortable and confusing to me, and
> > probably to the users who would like to replace the default stylesheet
> > with their own. Making a user write "center { text-align: center}" in
> > his stylesheet is strange indeed. And by the way, IE allows replacing
> > the default stylesheet easily, and <center> tag works normally after
> > that.
> >
> > I'm not suggesting to remove the replace default stylesheet feature,
> and
> > I'm not suggesting to merge the existing default stylesheet with
> user's
> > one. I'm only suggesting to make some (not all) default stylesheet
> > declarations (specifying core elements behavior) actual even if
> default
> > stylesheet is removed.
> >
> > Particularly, I would expect <strong> behaving the same as <b> and
> <em>
> > the same as <i>, and <center> tag actually centering the text. Sure, I
> > don't care about font sizes, margins etc.
> >
> >  Vasily
> >
> >
> > -----Original Message-----
> > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > Sent: Wednesday, August 22, 2007 10:38 AM
> > To: dev@harmony.apache.org
> > Subject: [classlib][swing][html] CSS is used to specify HTML tag
> > behavior
> >
> > Hello everyone,
> >
> > There was created JIRA issue HARMONY-4662 [1], which says that
> > specifying the default presentation of HTML tags using CSS. I believe
> > this issue should be discussed here.
> >
> > In short, Harmony implementation of HTML support has default.css file
> > which describes the default presentation of HTML elements. This
> > implementation is similar to that of RI. On the other hand, programmer
> > can remove (or disable) this style sheet. It leads to the situation
> > where almost all tags look like a plain text.
> >
> > In my opinion, using CSS in this situation is the right thing to do.
> > 1) We can easily make adjustments to the way HTML document looks by
> > default.
> > 2) It gives application developers freedom for their application.
> > Developer can create their own default style sheet and easily replace
> > the default one shipped with Harmony. Replacing is more effective than
> > just overriding because Harmony-provided style sheet will be excluded
> > from style resolution chain, which, in its turn, will free memory and
> > will save time.
> > 3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
> > use the similar methods to specify the default look of HTML. The only
> > difference is that you cannot remove their default style sheet so
> > easily as in Swing.
> >
> > Other opinions, comments?
> >
> > Regards,
> > Alexey.
> >
> >
> > [1] https://issues.apache.org/jira/browse/HARMONY-4662
> >
> > Other links of interest:
> > Sample style sheet suggested by W3C:
> > http://www.w3.org/TR/REC-CSS2/sample.html
> > Index of HTML 4.01 elements:
> > http://www.w3.org/TR/html401/index/elements.html
> >
>

Re: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by Alexey Ivanov <al...@gmail.com>.
The default style sheet is added using that same addStyleSheet().

Adding something to every instance of StyleSheet is not a good idea, imho.


Regards,
Alexey.

2007/8/22, Zakharov, Vasily M <va...@intel.com>:
>
> Hmm, yes, the thing looks trickier than I thought it would be.
>
> Maybe we could use addStyleSheet() - sure, one could remove the base,
> but it would be a concsious action (replacing default style sheet is a
> concious action too, but a user would expect some basic behavior from
> the tags).
>
> Vasily
>
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 12:22 PM
> To: dev@harmony.apache.org
> Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Yes, it would resolve the problem. Another question is how to
> implement that. But how can you ensure non-replaceable CSS to be
> *non-replaceable*?
>
> The standard mechanism uses StyleSheet.addStyleSheet(), but you can't
> prevent anyone from using removeStyleSheet() for removing any of them.
> Additionally, it is possible to install a new StyleSheet right into
> HTMLDocument.
>
> The only way I see so far is to create a base static StyleSheet which
> will be looked up in View implementations in cases where no CSS rules
> are found in default StyleSheet associated with the View. Any way
> Views or Elements should be tweaked to just this feature.
> Nothing more comes into my mind... And I don't like this solution very
> much.
>
>
> Regards,
> Alexey.
>
> 2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> > Alexey,
> >
> > This is really not good, both Harmony and RI seem doing wrong here.
> >
> > Is there a way to specify the element behavior in Swing Java code so
> > that that behavior could be overridden with style?
> >
> > Maybe creating the base, non-replaceable CSS and specifying such
> things
> > there would resolve this problem.
> >
> > Vasily
> >
> >
> > -----Original Message-----
> > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > Sent: Wednesday, August 22, 2007 12:00 PM
> > To: dev@harmony.apache.org
> > Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> > behavior
> >
> > Andrey,
> >
> > I don't think that it ignores -- I know it honors them with some
> > exceptions. I talked about attributes special case for <b> tag. Try
> > this code:
> >
> > <b style="font-weight: normal">not bold</b>
> >
> > In Harmony it would be rendered with bold font despite this style
> rule.
> >
> > Additionally,
> > <html><head><style type="text/css">
> >     b { font-weight: normal }
> > </style></head><body>
> > <b>also not bold</b>
> > </body></html>
> >
> > would be rendered in normal font weight, *not bold*, in all the
> > browsers whereas both Harmony and RI would render it bold.
> >
> > That's what I talked about.
> >
> > 2007/8/22, Pavlenko, Andrey A <an...@intel.com>:
> > > I think the best solution would be to merge the default CSS with
> > user's
> > > CSS.
> > >
> > > Alexey, why do you think Harmony ignores the style attribute of HTML
> > > elements? I've just created a simple test and it works fine for me:
> > >
> > > import javax.swing.JEditorPane;
> > > import javax.swing.JFrame;
> > >
> > > public class SwingTest {
> > >
> > >         public static void main(String[] args) {
> > >                 JFrame f = new JFrame();
> > >                 f.add(new JEditorPane("text/html",
> > >                                 "<center style='color: red'>Hello
> > > world!</center>"));
> > >                 f.pack();
> > >                 f.setVisible(true);
> > >         }
> > > }
> > >
> > > -----Original Message-----
> > > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > > Sent: Wednesday, August 22, 2007 11:29 AM
> > > To: dev@harmony.apache.org
> > > Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> > > behavior
> > >
> > > Vasily,
> > >
> > > Yes, I agree with your considerations too.
> > >
> > > I guess we should create a mechanism to add another base.css that
> > > cannot be removed. I pointed to
> > > javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
> > > which serves as such mechanism currently. We should find a better
> > > approach here because user should be able to override the defaults
> > > specified there as well. At least browsers allow this but neither
> > > Harmony nor RI does. Harmony is even worse since it ignores the
> style
> > > specified the style attribute on HTML element. However, I don't
> think
> > > there are many users who'd want to change that but it's a nice
> feature
> > > to have, so that Harmony behaves closer to HTML browsers and thus
> > > provides better HTML support than RI does.
> > >
> > > Regards,
> > > Alexey.
> > >
> > > P.S. I knew all browser provided the feature to user style sheet but
> > > had never tried it. Additionally this feature is quite hidden in
> > > options dialog boxes.
> > >
> > > 2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> > > > Alexey,
> > > >
> > > > Thank you for your attention to this issue. I'm not sure it's a
> bug
> > > that
> > > > needs to be fixed (RI does the same, right), but I think it's an
> > > > important issue that worth keeping record of.
> > > >
> > > > I fully agree with all your considerations about using default
> > > > stylesheet for specyfying default document look. But there's look
> > > > (fonts, colors, sizes, weight, margins, padding etc.) and there's
> > the
> > > > specified element behavior. For example, <center> tag is expected
> to
> > > > center text by default - and in our implementation (and in RI) it
> > > > doesn't. It seems strange, uncomfortable and confusing to me, and
> > > > probably to the users who would like to replace the default
> > stylesheet
> > > > with their own. Making a user write "center { text-align: center}"
> > in
> > > > his stylesheet is strange indeed. And by the way, IE allows
> > replacing
> > > > the default stylesheet easily, and <center> tag works normally
> after
> > > > that.
> > > >
> > > > I'm not suggesting to remove the replace default stylesheet
> feature,
> > > and
> > > > I'm not suggesting to merge the existing default stylesheet with
> > > user's
> > > > one. I'm only suggesting to make some (not all) default stylesheet
> > > > declarations (specifying core elements behavior) actual even if
> > > default
> > > > stylesheet is removed.
> > > >
> > > > Particularly, I would expect <strong> behaving the same as <b> and
> > > <em>
> > > > the same as <i>, and <center> tag actually centering the text.
> Sure,
> > I
> > > > don't care about font sizes, margins etc.
> > > >
> > > >  Vasily
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > > > Sent: Wednesday, August 22, 2007 10:38 AM
> > > > To: dev@harmony.apache.org
> > > > Subject: [classlib][swing][html] CSS is used to specify HTML tag
> > > > behavior
> > > >
> > > > Hello everyone,
> > > >
> > > > There was created JIRA issue HARMONY-4662 [1], which says that
> > > > specifying the default presentation of HTML tags using CSS. I
> > believe
> > > > this issue should be discussed here.
> > > >
> > > > In short, Harmony implementation of HTML support has default.css
> > file
> > > > which describes the default presentation of HTML elements. This
> > > > implementation is similar to that of RI. On the other hand,
> > programmer
> > > > can remove (or disable) this style sheet. It leads to the
> situation
> > > > where almost all tags look like a plain text.
> > > >
> > > > In my opinion, using CSS in this situation is the right thing to
> do.
> > > > 1) We can easily make adjustments to the way HTML document looks
> by
> > > > default.
> > > > 2) It gives application developers freedom for their application.
> > > > Developer can create their own default style sheet and easily
> > replace
> > > > the default one shipped with Harmony. Replacing is more effective
> > than
> > > > just overriding because Harmony-provided style sheet will be
> > excluded
> > > > from style resolution chain, which, in its turn, will free memory
> > and
> > > > will save time.
> > > > 3) I believe all modern browsers (Internet Explorer, Firefox,
> Opera)
> > > > use the similar methods to specify the default look of HTML. The
> > only
> > > > difference is that you cannot remove their default style sheet so
> > > > easily as in Swing.
> > > >
> > > > Other opinions, comments?
> > > >
> > > > Regards,
> > > > Alexey.
> > > >
> > > >
> > > > [1] https://issues.apache.org/jira/browse/HARMONY-4662
> > > >
> > > > Other links of interest:
> > > > Sample style sheet suggested by W3C:
> > > > http://www.w3.org/TR/REC-CSS2/sample.html
> > > > Index of HTML 4.01 elements:
> > > > http://www.w3.org/TR/html401/index/elements.html
> > > >
> > >
> >
>

RE: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by "Zakharov, Vasily M" <va...@intel.com>.
Hmm, yes, the thing looks trickier than I thought it would be.

Maybe we could use addStyleSheet() - sure, one could remove the base,
but it would be a concsious action (replacing default style sheet is a
concious action too, but a user would expect some basic behavior from
the tags).

Vasily


-----Original Message-----
From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com] 
Sent: Wednesday, August 22, 2007 12:22 PM
To: dev@harmony.apache.org
Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
behavior

Yes, it would resolve the problem. Another question is how to
implement that. But how can you ensure non-replaceable CSS to be
*non-replaceable*?

The standard mechanism uses StyleSheet.addStyleSheet(), but you can't
prevent anyone from using removeStyleSheet() for removing any of them.
Additionally, it is possible to install a new StyleSheet right into
HTMLDocument.

The only way I see so far is to create a base static StyleSheet which
will be looked up in View implementations in cases where no CSS rules
are found in default StyleSheet associated with the View. Any way
Views or Elements should be tweaked to just this feature.
Nothing more comes into my mind... And I don't like this solution very
much.


Regards,
Alexey.

2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> Alexey,
>
> This is really not good, both Harmony and RI seem doing wrong here.
>
> Is there a way to specify the element behavior in Swing Java code so
> that that behavior could be overridden with style?
>
> Maybe creating the base, non-replaceable CSS and specifying such
things
> there would resolve this problem.
>
> Vasily
>
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 12:00 PM
> To: dev@harmony.apache.org
> Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Andrey,
>
> I don't think that it ignores -- I know it honors them with some
> exceptions. I talked about attributes special case for <b> tag. Try
> this code:
>
> <b style="font-weight: normal">not bold</b>
>
> In Harmony it would be rendered with bold font despite this style
rule.
>
> Additionally,
> <html><head><style type="text/css">
>     b { font-weight: normal }
> </style></head><body>
> <b>also not bold</b>
> </body></html>
>
> would be rendered in normal font weight, *not bold*, in all the
> browsers whereas both Harmony and RI would render it bold.
>
> That's what I talked about.
>
> 2007/8/22, Pavlenko, Andrey A <an...@intel.com>:
> > I think the best solution would be to merge the default CSS with
> user's
> > CSS.
> >
> > Alexey, why do you think Harmony ignores the style attribute of HTML
> > elements? I've just created a simple test and it works fine for me:
> >
> > import javax.swing.JEditorPane;
> > import javax.swing.JFrame;
> >
> > public class SwingTest {
> >
> >         public static void main(String[] args) {
> >                 JFrame f = new JFrame();
> >                 f.add(new JEditorPane("text/html",
> >                                 "<center style='color: red'>Hello
> > world!</center>"));
> >                 f.pack();
> >                 f.setVisible(true);
> >         }
> > }
> >
> > -----Original Message-----
> > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > Sent: Wednesday, August 22, 2007 11:29 AM
> > To: dev@harmony.apache.org
> > Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> > behavior
> >
> > Vasily,
> >
> > Yes, I agree with your considerations too.
> >
> > I guess we should create a mechanism to add another base.css that
> > cannot be removed. I pointed to
> > javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
> > which serves as such mechanism currently. We should find a better
> > approach here because user should be able to override the defaults
> > specified there as well. At least browsers allow this but neither
> > Harmony nor RI does. Harmony is even worse since it ignores the
style
> > specified the style attribute on HTML element. However, I don't
think
> > there are many users who'd want to change that but it's a nice
feature
> > to have, so that Harmony behaves closer to HTML browsers and thus
> > provides better HTML support than RI does.
> >
> > Regards,
> > Alexey.
> >
> > P.S. I knew all browser provided the feature to user style sheet but
> > had never tried it. Additionally this feature is quite hidden in
> > options dialog boxes.
> >
> > 2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> > > Alexey,
> > >
> > > Thank you for your attention to this issue. I'm not sure it's a
bug
> > that
> > > needs to be fixed (RI does the same, right), but I think it's an
> > > important issue that worth keeping record of.
> > >
> > > I fully agree with all your considerations about using default
> > > stylesheet for specyfying default document look. But there's look
> > > (fonts, colors, sizes, weight, margins, padding etc.) and there's
> the
> > > specified element behavior. For example, <center> tag is expected
to
> > > center text by default - and in our implementation (and in RI) it
> > > doesn't. It seems strange, uncomfortable and confusing to me, and
> > > probably to the users who would like to replace the default
> stylesheet
> > > with their own. Making a user write "center { text-align: center}"
> in
> > > his stylesheet is strange indeed. And by the way, IE allows
> replacing
> > > the default stylesheet easily, and <center> tag works normally
after
> > > that.
> > >
> > > I'm not suggesting to remove the replace default stylesheet
feature,
> > and
> > > I'm not suggesting to merge the existing default stylesheet with
> > user's
> > > one. I'm only suggesting to make some (not all) default stylesheet
> > > declarations (specifying core elements behavior) actual even if
> > default
> > > stylesheet is removed.
> > >
> > > Particularly, I would expect <strong> behaving the same as <b> and
> > <em>
> > > the same as <i>, and <center> tag actually centering the text.
Sure,
> I
> > > don't care about font sizes, margins etc.
> > >
> > >  Vasily
> > >
> > >
> > > -----Original Message-----
> > > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > > Sent: Wednesday, August 22, 2007 10:38 AM
> > > To: dev@harmony.apache.org
> > > Subject: [classlib][swing][html] CSS is used to specify HTML tag
> > > behavior
> > >
> > > Hello everyone,
> > >
> > > There was created JIRA issue HARMONY-4662 [1], which says that
> > > specifying the default presentation of HTML tags using CSS. I
> believe
> > > this issue should be discussed here.
> > >
> > > In short, Harmony implementation of HTML support has default.css
> file
> > > which describes the default presentation of HTML elements. This
> > > implementation is similar to that of RI. On the other hand,
> programmer
> > > can remove (or disable) this style sheet. It leads to the
situation
> > > where almost all tags look like a plain text.
> > >
> > > In my opinion, using CSS in this situation is the right thing to
do.
> > > 1) We can easily make adjustments to the way HTML document looks
by
> > > default.
> > > 2) It gives application developers freedom for their application.
> > > Developer can create their own default style sheet and easily
> replace
> > > the default one shipped with Harmony. Replacing is more effective
> than
> > > just overriding because Harmony-provided style sheet will be
> excluded
> > > from style resolution chain, which, in its turn, will free memory
> and
> > > will save time.
> > > 3) I believe all modern browsers (Internet Explorer, Firefox,
Opera)
> > > use the similar methods to specify the default look of HTML. The
> only
> > > difference is that you cannot remove their default style sheet so
> > > easily as in Swing.
> > >
> > > Other opinions, comments?
> > >
> > > Regards,
> > > Alexey.
> > >
> > >
> > > [1] https://issues.apache.org/jira/browse/HARMONY-4662
> > >
> > > Other links of interest:
> > > Sample style sheet suggested by W3C:
> > > http://www.w3.org/TR/REC-CSS2/sample.html
> > > Index of HTML 4.01 elements:
> > > http://www.w3.org/TR/html401/index/elements.html
> > >
> >
>

Re: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by Alexey Ivanov <al...@gmail.com>.
Yes, it would resolve the problem. Another question is how to
implement that. But how can you ensure non-replaceable CSS to be
*non-replaceable*?

The standard mechanism uses StyleSheet.addStyleSheet(), but you can't
prevent anyone from using removeStyleSheet() for removing any of them.
Additionally, it is possible to install a new StyleSheet right into
HTMLDocument.

The only way I see so far is to create a base static StyleSheet which
will be looked up in View implementations in cases where no CSS rules
are found in default StyleSheet associated with the View. Any way
Views or Elements should be tweaked to just this feature.
Nothing more comes into my mind... And I don't like this solution very much.


Regards,
Alexey.

2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> Alexey,
>
> This is really not good, both Harmony and RI seem doing wrong here.
>
> Is there a way to specify the element behavior in Swing Java code so
> that that behavior could be overridden with style?
>
> Maybe creating the base, non-replaceable CSS and specifying such things
> there would resolve this problem.
>
> Vasily
>
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 12:00 PM
> To: dev@harmony.apache.org
> Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Andrey,
>
> I don't think that it ignores -- I know it honors them with some
> exceptions. I talked about attributes special case for <b> tag. Try
> this code:
>
> <b style="font-weight: normal">not bold</b>
>
> In Harmony it would be rendered with bold font despite this style rule.
>
> Additionally,
> <html><head><style type="text/css">
>     b { font-weight: normal }
> </style></head><body>
> <b>also not bold</b>
> </body></html>
>
> would be rendered in normal font weight, *not bold*, in all the
> browsers whereas both Harmony and RI would render it bold.
>
> That's what I talked about.
>
> 2007/8/22, Pavlenko, Andrey A <an...@intel.com>:
> > I think the best solution would be to merge the default CSS with
> user's
> > CSS.
> >
> > Alexey, why do you think Harmony ignores the style attribute of HTML
> > elements? I've just created a simple test and it works fine for me:
> >
> > import javax.swing.JEditorPane;
> > import javax.swing.JFrame;
> >
> > public class SwingTest {
> >
> >         public static void main(String[] args) {
> >                 JFrame f = new JFrame();
> >                 f.add(new JEditorPane("text/html",
> >                                 "<center style='color: red'>Hello
> > world!</center>"));
> >                 f.pack();
> >                 f.setVisible(true);
> >         }
> > }
> >
> > -----Original Message-----
> > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > Sent: Wednesday, August 22, 2007 11:29 AM
> > To: dev@harmony.apache.org
> > Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> > behavior
> >
> > Vasily,
> >
> > Yes, I agree with your considerations too.
> >
> > I guess we should create a mechanism to add another base.css that
> > cannot be removed. I pointed to
> > javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
> > which serves as such mechanism currently. We should find a better
> > approach here because user should be able to override the defaults
> > specified there as well. At least browsers allow this but neither
> > Harmony nor RI does. Harmony is even worse since it ignores the style
> > specified the style attribute on HTML element. However, I don't think
> > there are many users who'd want to change that but it's a nice feature
> > to have, so that Harmony behaves closer to HTML browsers and thus
> > provides better HTML support than RI does.
> >
> > Regards,
> > Alexey.
> >
> > P.S. I knew all browser provided the feature to user style sheet but
> > had never tried it. Additionally this feature is quite hidden in
> > options dialog boxes.
> >
> > 2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> > > Alexey,
> > >
> > > Thank you for your attention to this issue. I'm not sure it's a bug
> > that
> > > needs to be fixed (RI does the same, right), but I think it's an
> > > important issue that worth keeping record of.
> > >
> > > I fully agree with all your considerations about using default
> > > stylesheet for specyfying default document look. But there's look
> > > (fonts, colors, sizes, weight, margins, padding etc.) and there's
> the
> > > specified element behavior. For example, <center> tag is expected to
> > > center text by default - and in our implementation (and in RI) it
> > > doesn't. It seems strange, uncomfortable and confusing to me, and
> > > probably to the users who would like to replace the default
> stylesheet
> > > with their own. Making a user write "center { text-align: center}"
> in
> > > his stylesheet is strange indeed. And by the way, IE allows
> replacing
> > > the default stylesheet easily, and <center> tag works normally after
> > > that.
> > >
> > > I'm not suggesting to remove the replace default stylesheet feature,
> > and
> > > I'm not suggesting to merge the existing default stylesheet with
> > user's
> > > one. I'm only suggesting to make some (not all) default stylesheet
> > > declarations (specifying core elements behavior) actual even if
> > default
> > > stylesheet is removed.
> > >
> > > Particularly, I would expect <strong> behaving the same as <b> and
> > <em>
> > > the same as <i>, and <center> tag actually centering the text. Sure,
> I
> > > don't care about font sizes, margins etc.
> > >
> > >  Vasily
> > >
> > >
> > > -----Original Message-----
> > > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > > Sent: Wednesday, August 22, 2007 10:38 AM
> > > To: dev@harmony.apache.org
> > > Subject: [classlib][swing][html] CSS is used to specify HTML tag
> > > behavior
> > >
> > > Hello everyone,
> > >
> > > There was created JIRA issue HARMONY-4662 [1], which says that
> > > specifying the default presentation of HTML tags using CSS. I
> believe
> > > this issue should be discussed here.
> > >
> > > In short, Harmony implementation of HTML support has default.css
> file
> > > which describes the default presentation of HTML elements. This
> > > implementation is similar to that of RI. On the other hand,
> programmer
> > > can remove (or disable) this style sheet. It leads to the situation
> > > where almost all tags look like a plain text.
> > >
> > > In my opinion, using CSS in this situation is the right thing to do.
> > > 1) We can easily make adjustments to the way HTML document looks by
> > > default.
> > > 2) It gives application developers freedom for their application.
> > > Developer can create their own default style sheet and easily
> replace
> > > the default one shipped with Harmony. Replacing is more effective
> than
> > > just overriding because Harmony-provided style sheet will be
> excluded
> > > from style resolution chain, which, in its turn, will free memory
> and
> > > will save time.
> > > 3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
> > > use the similar methods to specify the default look of HTML. The
> only
> > > difference is that you cannot remove their default style sheet so
> > > easily as in Swing.
> > >
> > > Other opinions, comments?
> > >
> > > Regards,
> > > Alexey.
> > >
> > >
> > > [1] https://issues.apache.org/jira/browse/HARMONY-4662
> > >
> > > Other links of interest:
> > > Sample style sheet suggested by W3C:
> > > http://www.w3.org/TR/REC-CSS2/sample.html
> > > Index of HTML 4.01 elements:
> > > http://www.w3.org/TR/html401/index/elements.html
> > >
> >
>

RE: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by "Zakharov, Vasily M" <va...@intel.com>.
Alexey,

This is really not good, both Harmony and RI seem doing wrong here.

Is there a way to specify the element behavior in Swing Java code so
that that behavior could be overridden with style?

Maybe creating the base, non-replaceable CSS and specifying such things
there would resolve this problem.

Vasily


-----Original Message-----
From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com] 
Sent: Wednesday, August 22, 2007 12:00 PM
To: dev@harmony.apache.org
Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
behavior

Andrey,

I don't think that it ignores -- I know it honors them with some
exceptions. I talked about attributes special case for <b> tag. Try
this code:

<b style="font-weight: normal">not bold</b>

In Harmony it would be rendered with bold font despite this style rule.

Additionally,
<html><head><style type="text/css">
    b { font-weight: normal }
</style></head><body>
<b>also not bold</b>
</body></html>

would be rendered in normal font weight, *not bold*, in all the
browsers whereas both Harmony and RI would render it bold.

That's what I talked about.

2007/8/22, Pavlenko, Andrey A <an...@intel.com>:
> I think the best solution would be to merge the default CSS with
user's
> CSS.
>
> Alexey, why do you think Harmony ignores the style attribute of HTML
> elements? I've just created a simple test and it works fine for me:
>
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
>
> public class SwingTest {
>
>         public static void main(String[] args) {
>                 JFrame f = new JFrame();
>                 f.add(new JEditorPane("text/html",
>                                 "<center style='color: red'>Hello
> world!</center>"));
>                 f.pack();
>                 f.setVisible(true);
>         }
> }
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 11:29 AM
> To: dev@harmony.apache.org
> Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Vasily,
>
> Yes, I agree with your considerations too.
>
> I guess we should create a mechanism to add another base.css that
> cannot be removed. I pointed to
> javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
> which serves as such mechanism currently. We should find a better
> approach here because user should be able to override the defaults
> specified there as well. At least browsers allow this but neither
> Harmony nor RI does. Harmony is even worse since it ignores the style
> specified the style attribute on HTML element. However, I don't think
> there are many users who'd want to change that but it's a nice feature
> to have, so that Harmony behaves closer to HTML browsers and thus
> provides better HTML support than RI does.
>
> Regards,
> Alexey.
>
> P.S. I knew all browser provided the feature to user style sheet but
> had never tried it. Additionally this feature is quite hidden in
> options dialog boxes.
>
> 2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> > Alexey,
> >
> > Thank you for your attention to this issue. I'm not sure it's a bug
> that
> > needs to be fixed (RI does the same, right), but I think it's an
> > important issue that worth keeping record of.
> >
> > I fully agree with all your considerations about using default
> > stylesheet for specyfying default document look. But there's look
> > (fonts, colors, sizes, weight, margins, padding etc.) and there's
the
> > specified element behavior. For example, <center> tag is expected to
> > center text by default - and in our implementation (and in RI) it
> > doesn't. It seems strange, uncomfortable and confusing to me, and
> > probably to the users who would like to replace the default
stylesheet
> > with their own. Making a user write "center { text-align: center}"
in
> > his stylesheet is strange indeed. And by the way, IE allows
replacing
> > the default stylesheet easily, and <center> tag works normally after
> > that.
> >
> > I'm not suggesting to remove the replace default stylesheet feature,
> and
> > I'm not suggesting to merge the existing default stylesheet with
> user's
> > one. I'm only suggesting to make some (not all) default stylesheet
> > declarations (specifying core elements behavior) actual even if
> default
> > stylesheet is removed.
> >
> > Particularly, I would expect <strong> behaving the same as <b> and
> <em>
> > the same as <i>, and <center> tag actually centering the text. Sure,
I
> > don't care about font sizes, margins etc.
> >
> >  Vasily
> >
> >
> > -----Original Message-----
> > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > Sent: Wednesday, August 22, 2007 10:38 AM
> > To: dev@harmony.apache.org
> > Subject: [classlib][swing][html] CSS is used to specify HTML tag
> > behavior
> >
> > Hello everyone,
> >
> > There was created JIRA issue HARMONY-4662 [1], which says that
> > specifying the default presentation of HTML tags using CSS. I
believe
> > this issue should be discussed here.
> >
> > In short, Harmony implementation of HTML support has default.css
file
> > which describes the default presentation of HTML elements. This
> > implementation is similar to that of RI. On the other hand,
programmer
> > can remove (or disable) this style sheet. It leads to the situation
> > where almost all tags look like a plain text.
> >
> > In my opinion, using CSS in this situation is the right thing to do.
> > 1) We can easily make adjustments to the way HTML document looks by
> > default.
> > 2) It gives application developers freedom for their application.
> > Developer can create their own default style sheet and easily
replace
> > the default one shipped with Harmony. Replacing is more effective
than
> > just overriding because Harmony-provided style sheet will be
excluded
> > from style resolution chain, which, in its turn, will free memory
and
> > will save time.
> > 3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
> > use the similar methods to specify the default look of HTML. The
only
> > difference is that you cannot remove their default style sheet so
> > easily as in Swing.
> >
> > Other opinions, comments?
> >
> > Regards,
> > Alexey.
> >
> >
> > [1] https://issues.apache.org/jira/browse/HARMONY-4662
> >
> > Other links of interest:
> > Sample style sheet suggested by W3C:
> > http://www.w3.org/TR/REC-CSS2/sample.html
> > Index of HTML 4.01 elements:
> > http://www.w3.org/TR/html401/index/elements.html
> >
>

Re: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by Alexey Ivanov <al...@gmail.com>.
Andrey,

I don't think that it ignores -- I know it honors them with some
exceptions. I talked about attributes special case for <b> tag. Try
this code:

<b style="font-weight: normal">not bold</b>

In Harmony it would be rendered with bold font despite this style rule.

Additionally,
<html><head><style type="text/css">
    b { font-weight: normal }
</style></head><body>
<b>also not bold</b>
</body></html>

would be rendered in normal font weight, *not bold*, in all the
browsers whereas both Harmony and RI would render it bold.

That's what I talked about.

2007/8/22, Pavlenko, Andrey A <an...@intel.com>:
> I think the best solution would be to merge the default CSS with user's
> CSS.
>
> Alexey, why do you think Harmony ignores the style attribute of HTML
> elements? I've just created a simple test and it works fine for me:
>
> import javax.swing.JEditorPane;
> import javax.swing.JFrame;
>
> public class SwingTest {
>
>         public static void main(String[] args) {
>                 JFrame f = new JFrame();
>                 f.add(new JEditorPane("text/html",
>                                 "<center style='color: red'>Hello
> world!</center>"));
>                 f.pack();
>                 f.setVisible(true);
>         }
> }
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 11:29 AM
> To: dev@harmony.apache.org
> Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Vasily,
>
> Yes, I agree with your considerations too.
>
> I guess we should create a mechanism to add another base.css that
> cannot be removed. I pointed to
> javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
> which serves as such mechanism currently. We should find a better
> approach here because user should be able to override the defaults
> specified there as well. At least browsers allow this but neither
> Harmony nor RI does. Harmony is even worse since it ignores the style
> specified the style attribute on HTML element. However, I don't think
> there are many users who'd want to change that but it's a nice feature
> to have, so that Harmony behaves closer to HTML browsers and thus
> provides better HTML support than RI does.
>
> Regards,
> Alexey.
>
> P.S. I knew all browser provided the feature to user style sheet but
> had never tried it. Additionally this feature is quite hidden in
> options dialog boxes.
>
> 2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> > Alexey,
> >
> > Thank you for your attention to this issue. I'm not sure it's a bug
> that
> > needs to be fixed (RI does the same, right), but I think it's an
> > important issue that worth keeping record of.
> >
> > I fully agree with all your considerations about using default
> > stylesheet for specyfying default document look. But there's look
> > (fonts, colors, sizes, weight, margins, padding etc.) and there's the
> > specified element behavior. For example, <center> tag is expected to
> > center text by default - and in our implementation (and in RI) it
> > doesn't. It seems strange, uncomfortable and confusing to me, and
> > probably to the users who would like to replace the default stylesheet
> > with their own. Making a user write "center { text-align: center}" in
> > his stylesheet is strange indeed. And by the way, IE allows replacing
> > the default stylesheet easily, and <center> tag works normally after
> > that.
> >
> > I'm not suggesting to remove the replace default stylesheet feature,
> and
> > I'm not suggesting to merge the existing default stylesheet with
> user's
> > one. I'm only suggesting to make some (not all) default stylesheet
> > declarations (specifying core elements behavior) actual even if
> default
> > stylesheet is removed.
> >
> > Particularly, I would expect <strong> behaving the same as <b> and
> <em>
> > the same as <i>, and <center> tag actually centering the text. Sure, I
> > don't care about font sizes, margins etc.
> >
> >  Vasily
> >
> >
> > -----Original Message-----
> > From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> > Sent: Wednesday, August 22, 2007 10:38 AM
> > To: dev@harmony.apache.org
> > Subject: [classlib][swing][html] CSS is used to specify HTML tag
> > behavior
> >
> > Hello everyone,
> >
> > There was created JIRA issue HARMONY-4662 [1], which says that
> > specifying the default presentation of HTML tags using CSS. I believe
> > this issue should be discussed here.
> >
> > In short, Harmony implementation of HTML support has default.css file
> > which describes the default presentation of HTML elements. This
> > implementation is similar to that of RI. On the other hand, programmer
> > can remove (or disable) this style sheet. It leads to the situation
> > where almost all tags look like a plain text.
> >
> > In my opinion, using CSS in this situation is the right thing to do.
> > 1) We can easily make adjustments to the way HTML document looks by
> > default.
> > 2) It gives application developers freedom for their application.
> > Developer can create their own default style sheet and easily replace
> > the default one shipped with Harmony. Replacing is more effective than
> > just overriding because Harmony-provided style sheet will be excluded
> > from style resolution chain, which, in its turn, will free memory and
> > will save time.
> > 3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
> > use the similar methods to specify the default look of HTML. The only
> > difference is that you cannot remove their default style sheet so
> > easily as in Swing.
> >
> > Other opinions, comments?
> >
> > Regards,
> > Alexey.
> >
> >
> > [1] https://issues.apache.org/jira/browse/HARMONY-4662
> >
> > Other links of interest:
> > Sample style sheet suggested by W3C:
> > http://www.w3.org/TR/REC-CSS2/sample.html
> > Index of HTML 4.01 elements:
> > http://www.w3.org/TR/html401/index/elements.html
> >
>

RE: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by "Pavlenko, Andrey A" <an...@intel.com>.
I think the best solution would be to merge the default CSS with user's
CSS.

Alexey, why do you think Harmony ignores the style attribute of HTML
elements? I've just created a simple test and it works fine for me:

import javax.swing.JEditorPane;
import javax.swing.JFrame;

public class SwingTest {

	public static void main(String[] args) {
		JFrame f = new JFrame();
		f.add(new JEditorPane("text/html",
				"<center style='color: red'>Hello
world!</center>"));
		f.pack();
		f.setVisible(true);
	}
} 

-----Original Message-----
From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com] 
Sent: Wednesday, August 22, 2007 11:29 AM
To: dev@harmony.apache.org
Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag
behavior

Vasily,

Yes, I agree with your considerations too.

I guess we should create a mechanism to add another base.css that
cannot be removed. I pointed to
javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
which serves as such mechanism currently. We should find a better
approach here because user should be able to override the defaults
specified there as well. At least browsers allow this but neither
Harmony nor RI does. Harmony is even worse since it ignores the style
specified the style attribute on HTML element. However, I don't think
there are many users who'd want to change that but it's a nice feature
to have, so that Harmony behaves closer to HTML browsers and thus
provides better HTML support than RI does.

Regards,
Alexey.

P.S. I knew all browser provided the feature to user style sheet but
had never tried it. Additionally this feature is quite hidden in
options dialog boxes.

2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> Alexey,
>
> Thank you for your attention to this issue. I'm not sure it's a bug
that
> needs to be fixed (RI does the same, right), but I think it's an
> important issue that worth keeping record of.
>
> I fully agree with all your considerations about using default
> stylesheet for specyfying default document look. But there's look
> (fonts, colors, sizes, weight, margins, padding etc.) and there's the
> specified element behavior. For example, <center> tag is expected to
> center text by default - and in our implementation (and in RI) it
> doesn't. It seems strange, uncomfortable and confusing to me, and
> probably to the users who would like to replace the default stylesheet
> with their own. Making a user write "center { text-align: center}" in
> his stylesheet is strange indeed. And by the way, IE allows replacing
> the default stylesheet easily, and <center> tag works normally after
> that.
>
> I'm not suggesting to remove the replace default stylesheet feature,
and
> I'm not suggesting to merge the existing default stylesheet with
user's
> one. I'm only suggesting to make some (not all) default stylesheet
> declarations (specifying core elements behavior) actual even if
default
> stylesheet is removed.
>
> Particularly, I would expect <strong> behaving the same as <b> and
<em>
> the same as <i>, and <center> tag actually centering the text. Sure, I
> don't care about font sizes, margins etc.
>
>  Vasily
>
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 10:38 AM
> To: dev@harmony.apache.org
> Subject: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Hello everyone,
>
> There was created JIRA issue HARMONY-4662 [1], which says that
> specifying the default presentation of HTML tags using CSS. I believe
> this issue should be discussed here.
>
> In short, Harmony implementation of HTML support has default.css file
> which describes the default presentation of HTML elements. This
> implementation is similar to that of RI. On the other hand, programmer
> can remove (or disable) this style sheet. It leads to the situation
> where almost all tags look like a plain text.
>
> In my opinion, using CSS in this situation is the right thing to do.
> 1) We can easily make adjustments to the way HTML document looks by
> default.
> 2) It gives application developers freedom for their application.
> Developer can create their own default style sheet and easily replace
> the default one shipped with Harmony. Replacing is more effective than
> just overriding because Harmony-provided style sheet will be excluded
> from style resolution chain, which, in its turn, will free memory and
> will save time.
> 3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
> use the similar methods to specify the default look of HTML. The only
> difference is that you cannot remove their default style sheet so
> easily as in Swing.
>
> Other opinions, comments?
>
> Regards,
> Alexey.
>
>
> [1] https://issues.apache.org/jira/browse/HARMONY-4662
>
> Other links of interest:
> Sample style sheet suggested by W3C:
> http://www.w3.org/TR/REC-CSS2/sample.html
> Index of HTML 4.01 elements:
> http://www.w3.org/TR/html401/index/elements.html
>

Re: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by Alexey Ivanov <al...@gmail.com>.
Vasily,

Yes, I agree with your considerations too.

I guess we should create a mechanism to add another base.css that
cannot be removed. I pointed to
javax.swing.text.html.HTMLDocument.initDefaultCharacterAttributes
which serves as such mechanism currently. We should find a better
approach here because user should be able to override the defaults
specified there as well. At least browsers allow this but neither
Harmony nor RI does. Harmony is even worse since it ignores the style
specified the style attribute on HTML element. However, I don't think
there are many users who'd want to change that but it's a nice feature
to have, so that Harmony behaves closer to HTML browsers and thus
provides better HTML support than RI does.

Regards,
Alexey.

P.S. I knew all browser provided the feature to user style sheet but
had never tried it. Additionally this feature is quite hidden in
options dialog boxes.

2007/8/22, Zakharov, Vasily M <va...@intel.com>:
> Alexey,
>
> Thank you for your attention to this issue. I'm not sure it's a bug that
> needs to be fixed (RI does the same, right), but I think it's an
> important issue that worth keeping record of.
>
> I fully agree with all your considerations about using default
> stylesheet for specyfying default document look. But there's look
> (fonts, colors, sizes, weight, margins, padding etc.) and there's the
> specified element behavior. For example, <center> tag is expected to
> center text by default - and in our implementation (and in RI) it
> doesn't. It seems strange, uncomfortable and confusing to me, and
> probably to the users who would like to replace the default stylesheet
> with their own. Making a user write "center { text-align: center}" in
> his stylesheet is strange indeed. And by the way, IE allows replacing
> the default stylesheet easily, and <center> tag works normally after
> that.
>
> I'm not suggesting to remove the replace default stylesheet feature, and
> I'm not suggesting to merge the existing default stylesheet with user's
> one. I'm only suggesting to make some (not all) default stylesheet
> declarations (specifying core elements behavior) actual even if default
> stylesheet is removed.
>
> Particularly, I would expect <strong> behaving the same as <b> and <em>
> the same as <i>, and <center> tag actually centering the text. Sure, I
> don't care about font sizes, margins etc.
>
>  Vasily
>
>
> -----Original Message-----
> From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com]
> Sent: Wednesday, August 22, 2007 10:38 AM
> To: dev@harmony.apache.org
> Subject: [classlib][swing][html] CSS is used to specify HTML tag
> behavior
>
> Hello everyone,
>
> There was created JIRA issue HARMONY-4662 [1], which says that
> specifying the default presentation of HTML tags using CSS. I believe
> this issue should be discussed here.
>
> In short, Harmony implementation of HTML support has default.css file
> which describes the default presentation of HTML elements. This
> implementation is similar to that of RI. On the other hand, programmer
> can remove (or disable) this style sheet. It leads to the situation
> where almost all tags look like a plain text.
>
> In my opinion, using CSS in this situation is the right thing to do.
> 1) We can easily make adjustments to the way HTML document looks by
> default.
> 2) It gives application developers freedom for their application.
> Developer can create their own default style sheet and easily replace
> the default one shipped with Harmony. Replacing is more effective than
> just overriding because Harmony-provided style sheet will be excluded
> from style resolution chain, which, in its turn, will free memory and
> will save time.
> 3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
> use the similar methods to specify the default look of HTML. The only
> difference is that you cannot remove their default style sheet so
> easily as in Swing.
>
> Other opinions, comments?
>
> Regards,
> Alexey.
>
>
> [1] https://issues.apache.org/jira/browse/HARMONY-4662
>
> Other links of interest:
> Sample style sheet suggested by W3C:
> http://www.w3.org/TR/REC-CSS2/sample.html
> Index of HTML 4.01 elements:
> http://www.w3.org/TR/html401/index/elements.html
>

RE: [classlib][swing][html] CSS is used to specify HTML tag behavior

Posted by "Zakharov, Vasily M" <va...@intel.com>.
Alexey,

Thank you for your attention to this issue. I'm not sure it's a bug that
needs to be fixed (RI does the same, right), but I think it's an
important issue that worth keeping record of.

I fully agree with all your considerations about using default
stylesheet for specyfying default document look. But there's look
(fonts, colors, sizes, weight, margins, padding etc.) and there's the
specified element behavior. For example, <center> tag is expected to
center text by default - and in our implementation (and in RI) it
doesn't. It seems strange, uncomfortable and confusing to me, and
probably to the users who would like to replace the default stylesheet
with their own. Making a user write "center { text-align: center}" in
his stylesheet is strange indeed. And by the way, IE allows replacing
the default stylesheet easily, and <center> tag works normally after
that.

I'm not suggesting to remove the replace default stylesheet feature, and
I'm not suggesting to merge the existing default stylesheet with user's
one. I'm only suggesting to make some (not all) default stylesheet
declarations (specifying core elements behavior) actual even if default
stylesheet is removed.

Particularly, I would expect <strong> behaving the same as <b> and <em>
the same as <i>, and <center> tag actually centering the text. Sure, I
don't care about font sizes, margins etc.

 Vasily


-----Original Message-----
From: Alexey Ivanov [mailto:alxey.ivanov@gmail.com] 
Sent: Wednesday, August 22, 2007 10:38 AM
To: dev@harmony.apache.org
Subject: [classlib][swing][html] CSS is used to specify HTML tag
behavior

Hello everyone,

There was created JIRA issue HARMONY-4662 [1], which says that
specifying the default presentation of HTML tags using CSS. I believe
this issue should be discussed here.

In short, Harmony implementation of HTML support has default.css file
which describes the default presentation of HTML elements. This
implementation is similar to that of RI. On the other hand, programmer
can remove (or disable) this style sheet. It leads to the situation
where almost all tags look like a plain text.

In my opinion, using CSS in this situation is the right thing to do.
1) We can easily make adjustments to the way HTML document looks by
default.
2) It gives application developers freedom for their application.
Developer can create their own default style sheet and easily replace
the default one shipped with Harmony. Replacing is more effective than
just overriding because Harmony-provided style sheet will be excluded
from style resolution chain, which, in its turn, will free memory and
will save time.
3) I believe all modern browsers (Internet Explorer, Firefox, Opera)
use the similar methods to specify the default look of HTML. The only
difference is that you cannot remove their default style sheet so
easily as in Swing.

Other opinions, comments?

Regards,
Alexey.


[1] https://issues.apache.org/jira/browse/HARMONY-4662

Other links of interest:
Sample style sheet suggested by W3C:
http://www.w3.org/TR/REC-CSS2/sample.html
Index of HTML 4.01 elements:
http://www.w3.org/TR/html401/index/elements.html