From dev-return-28839-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Wed Aug 22 08:22:00 2007 Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 82240 invoked from network); 22 Aug 2007 08:21:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Aug 2007 08:21:59 -0000 Received: (qmail 15392 invoked by uid 500); 22 Aug 2007 08:21:55 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 15260 invoked by uid 500); 22 Aug 2007 08:21:54 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 15251 invoked by uid 99); 22 Aug 2007 08:21:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Aug 2007 01:21:54 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of alxey.ivanov@gmail.com designates 64.233.184.230 as permitted sender) Received: from [64.233.184.230] (HELO wr-out-0506.google.com) (64.233.184.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Aug 2007 08:21:54 +0000 Received: by wr-out-0506.google.com with SMTP id c48so90989wra for ; Wed, 22 Aug 2007 01:21:33 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Y7o4Mi6CGhCX/tK/0RHXtOFh80At4oLvg4O7iYNbZa+mhtpVJt5ZHGF9eF4bFBmg8HVTNYFqKNj4EW5g5VZB6aiCw1/Bki09RVPONAu6N1hMJg0luEQX7irw7/LjlmODGQ4ksB4Oc+zLmZ2dcfZlLk3pOBrbTv+johm7GlPEOjE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=o1HIkP3f3DTAEbNlcCjaYPIc966XEb7vycGsLuFp4XSJj4wWQX609nNR09eBJfRfeIwdy1q58YlPWoYIGdAngTptVrGLDSPrAiJe7qdmGQzuxdM2nn93ZXCelr1MdarI1Kc046IC55M5SJ7+s/AOPkLR1bMkZmKZOLSKeEop8Go= Received: by 10.90.29.18 with SMTP id c18mr3962376agc.1187770893133; Wed, 22 Aug 2007 01:21:33 -0700 (PDT) Received: by 10.90.119.11 with HTTP; Wed, 22 Aug 2007 01:21:33 -0700 (PDT) Message-ID: <1ab70d5f0708220121j1b6c2ba5mf7b6a1eff01c5fdd@mail.gmail.com> Date: Wed, 22 Aug 2007 12:21:33 +0400 From: "Alexey Ivanov" To: dev@harmony.apache.org Subject: Re: [classlib][swing][html] CSS is used to specify HTML tag behavior In-Reply-To: <3D8E84095C6A524A985B787423094E40013A6B4C@mssmsx411.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1ab70d5f0708220059h53674a4bk70e15a5c109ce559@mail.gmail.com> <3D8E84095C6A524A985B787423094E40013A6B4C@mssmsx411.ccr.corp.intel.com> X-Virus-Checked: Checked by ClamAV on apache.org 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 : > 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 tag. Try > this code: > > not bold > > In Harmony it would be rendered with bold font despite this style rule. > > Additionally, > > also not bold > > > 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 : > > 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", > > "
Hello > > world!
")); > > 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 : > > > 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,
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
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 behaving the same as and > > > > > the same as , and
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 > > > > > >