summaryrefslogtreecommitdiff
path: root/javax/swing/text/html/CSSBorder.java
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2006-12-01 14:43:42 +0000
committerRoman Kennke <roman@kennke.org>2006-12-01 14:43:42 +0000
commit5bce0abfef6817e4299bc0640baf46b5f873d530 (patch)
tree07707896fdf219b9fac9903a491fd67beaa0e22f /javax/swing/text/html/CSSBorder.java
parent73ee7fab7219cb0edb4ded57f73dea804846d6b2 (diff)
downloadclasspath-5bce0abfef6817e4299bc0640baf46b5f873d530.tar.gz
2006-11-30 Roman Kennke <kennke@aicas.com>
* gnu/javax/swing/text/html/css/Length.java (emBase): New field. (exBase): New field. (isFontEMRelative): New field. (isFontEXRelative): New field. (Length): Recognize and setup EM and EX relative values. (getValue): Handle EM and EX relative values. (isEMRelative): New method. (isEXRelative): New method. (setEMBase): New method. (setEXBase): New method. (setFontBases): New method. * gnu/javax/swing/text/html/parser/support/Parser.java (_handleEmptyTag): Use new isBlock() helper method. (_handleEndTag_remaining): Use new isBlock() helper method. (_handleStartTag): Consume whitespace after block start tag. (Comment): Consume whitespace after a comment. (isBlock): New helper method. (readAttributes): Consider all characters in unquoted attribute values. * javax/swing/text/html/BlockView.java (layoutMinorAxis): Use cached span value. (paint): Added debug code (commented out). (setPropertiesFromAttributes): Set the EM and EX base on lengths. * javax/swing/text/html/CSSBorder.java (CSSBorder): Take StyleSheet as argument. Call getBorderWidth() with stylesheet. (getBorderWidth): Set the EM and EX base on the length values. * javax/swing/text/html/HTMLDocument.java (HTMLReader.ParagraphAction.end): Do not set the inParagraph field. (HTMLReader.ParagraphAction.start): Do not set the inParagraph field. (HTMLReader.inImpliedParagraph): Removed. (HTMLReader.inParagraph): Removed. (HTMLReader.parseStack): New field. (HTMLReader.addContent): Use new paragraph handling. (HTMLReader.addSpecialElement): Use new paragraph handling. (HTMLReader.blockClose): Use new paragraph handling. (HTMLReader.blockOpen): Use new paragraph handling. (HTMLReader.inImpliedParagraph): New helper method. (HTMLReader.inParagraph): New helper method. * javax/swing/text/html/ImageView.java (attributes): New field. Caches view attributes. (spans): New field. Caches CSS spans. (getAttributes): Correctly setup CSS view attributes. (getPreferredSpan): Use caches spans. (getStyleSheet): Use the view's getDocument() method. (setPropertiesFromAttributes): Cache spans and setup EM and EX. (updateSize): Use cached spans. * javax/swing/text/html/ParagraphView.java (setPropertiesFromAttributes): Setup EM and EX. * javax/swing/text/html/StyleSheet.java (BoxPainter.BoxPainter): Setup EM and EX correctly. (getEMBase): New helper method. (getEXBase): New helper method. * javax/swing/text/html/TableView.java (width): New field. Caches the table width. (calculateMinorAxisRequirements): Use caches span. (setPropertiesFromAttributes): Cache span and setup EM/EX. (updateGrid): Correctly setup EM/EX.
Diffstat (limited to 'javax/swing/text/html/CSSBorder.java')
-rw-r--r--javax/swing/text/html/CSSBorder.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/javax/swing/text/html/CSSBorder.java b/javax/swing/text/html/CSSBorder.java
index 540955494..fff6b01a1 100644
--- a/javax/swing/text/html/CSSBorder.java
+++ b/javax/swing/text/html/CSSBorder.java
@@ -40,12 +40,10 @@ package javax.swing.text.html;
import gnu.javax.swing.text.html.css.BorderWidth;
import gnu.javax.swing.text.html.css.CSSColor;
-import gnu.javax.swing.text.html.css.Length;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
-import java.awt.Graphics2D;
import java.awt.Insets;
import javax.swing.border.Border;
@@ -140,7 +138,7 @@ class CSSBorder
*
* @param atts the attribute set that contains the border spec
*/
- CSSBorder(AttributeSet atts)
+ CSSBorder(AttributeSet atts, StyleSheet ss)
{
// Determine the border styles.
int style = getBorderStyle(atts, CSS.Attribute.BORDER_STYLE);
@@ -179,20 +177,20 @@ class CSSBorder
rightColor = color;
// Determine the border widths.
- int width = getBorderWidth(atts, CSS.Attribute.BORDER_WIDTH);
+ int width = getBorderWidth(atts, CSS.Attribute.BORDER_WIDTH, ss);
if (width == -1)
width = 0;
top = bottom = left = right = width;
- width = getBorderWidth(atts, CSS.Attribute.BORDER_TOP_WIDTH);
+ width = getBorderWidth(atts, CSS.Attribute.BORDER_TOP_WIDTH, ss);
if (width >= 0)
top = width;
- width = getBorderWidth(atts, CSS.Attribute.BORDER_BOTTOM_WIDTH);
+ width = getBorderWidth(atts, CSS.Attribute.BORDER_BOTTOM_WIDTH, ss);
if (width >= 0)
bottom = width;
- width = getBorderWidth(atts, CSS.Attribute.BORDER_LEFT_WIDTH);
+ width = getBorderWidth(atts, CSS.Attribute.BORDER_LEFT_WIDTH, ss);
if (width >= 0)
left = width;
- width = getBorderWidth(atts, CSS.Attribute.BORDER_RIGHT_WIDTH);
+ width = getBorderWidth(atts, CSS.Attribute.BORDER_RIGHT_WIDTH, ss);
if (width >= 0)
right = width;
}
@@ -264,12 +262,15 @@ class CSSBorder
*
* @return the width, or -1 of none has been set
*/
- private int getBorderWidth(AttributeSet atts, CSS.Attribute key)
+ private int getBorderWidth(AttributeSet atts, CSS.Attribute key,
+ StyleSheet ss)
{
int width = -1;
Object o = atts.getAttribute(key);
if (o instanceof BorderWidth)
{
+ BorderWidth w = (BorderWidth) o;
+ w.setFontBases(ss.getEMBase(atts), ss.getEXBase(atts));
width = (int) ((BorderWidth) o).getValue();
}
return width;