Package org.xhtmlrenderer.css.style
Class CalculatedStyle
- java.lang.Object
-
- org.xhtmlrenderer.css.style.CalculatedStyle
-
- Direct Known Subclasses:
EmptyStyle
public class CalculatedStyle extends java.lang.Object
A set of properties that apply to a single Element, derived from all matched properties following the rules for CSS cascade, inheritance, importance, specificity and sequence. A derived style is just like a style but (presumably) has additional information that allows relative properties to be assigned values, e.g. font attributes. Property values are fully resolved when this style is created. A property retrieved by name should always have only one value in this class (e.g. one-one map). Any methods to retrieve property values from an instance of this class require a validorg.xhtmlrenderer.layout.Context
be given to it, for some cases of property resolution. Generally, a programmer will not use this class directly, but will retrieve properties using aStyleReference
implementation.- Author:
- Torbj�rn Gannholm, Patrick Wright
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FSColor
asColor(CSSName cssName)
float
asFloat(CSSName cssName)
Length
asLength(CssContext c, CSSName cssName)
java.lang.String
asString(CSSName cssName)
java.lang.String[]
asStringArray(CSSName cssName)
int
countAssigned()
CalculatedStyle
createAnonymousStyle(IdentValue display)
CalculatedStyle
deriveStyle(CascadedStyle matched)
derives a child style from this style.boolean
establishesBFC()
IdentValue
getBackgroundAttachment()
FSColor
getBackgroundColor()
Convenience property accessor; returns a Color initialized with the background color value; Uses the actual value (computed actual value) for this element.BackgroundPosition
getBackgroundPosition()
IdentValue
getBackgroundRepeat()
BorderPropertySet
getBorder(CssContext ctx)
int
getBorderHSpacing(CssContext c)
int
getBorderVSpacing(CssContext c)
RectPropertySet
getCachedMargin()
RectPropertySet
getCachedPadding()
FSColor
getColor()
Convenience property accessor; returns a Color initialized with the foreground color Uses the actual value (computed actual value) for this element.int
getColSpan()
java.util.List
getCounterIncrement()
java.util.List
getCounterReset()
java.awt.Cursor
getCursor()
float
getFloatPropertyProportionalHeight(CSSName cssName, float parentHeight, CssContext ctx)
float
getFloatPropertyProportionalTo(CSSName cssName, float baseValue, CssContext ctx)
float
getFloatPropertyProportionalWidth(CSSName cssName, float parentWidth, CssContext ctx)
FontSpecification
getFont(CssContext ctx)
FSFont
getFSFont(CssContext cssContext)
FSFontMetrics
getFSFontMetrics(CssContext c)
IdentValue
getIdent(CSSName cssName)
Gets the ident attribute of the CalculatedStyle objectfloat
getLineHeight(CssContext ctx)
int
getMarginBorderPadding(CssContext cssCtx, int cbWidth, int which)
RectPropertySet
getMarginRect(float cbWidth, CssContext ctx)
Convenience property accessor; returns a Border initialized with the four-sided margin width.RectPropertySet
getMarginRect(float cbWidth, CssContext ctx, boolean useCache)
int
getMaxHeight(CssContext c, int cbHeight)
int
getMaxWidth(CssContext c, int cbWidth)
int
getMinHeight(CssContext c, int cbHeight)
int
getMinWidth(CssContext c, int cbWidth)
RectPropertySet
getPaddingRect(float cbWidth, CssContext ctx)
RectPropertySet
getPaddingRect(float cbWidth, CssContext ctx, boolean useCache)
Convenience property accessor; returns a Border initialized with the four-sided padding width.CalculatedStyle
getParent()
Returns the parent style.int
getRowSpan()
java.lang.String
getRunningName()
java.lang.String
getStringProperty(CSSName cssName)
java.util.List
getTextDecorations()
IdentValue
getWhitespace()
boolean
hasAbsoluteUnit(CSSName cssName)
boolean
isAbsFixedOrInlineBlockEquiv()
boolean
isAbsolute()
boolean
isAutoHeight()
boolean
isAutoWidth()
boolean
isAutoZIndex()
boolean
isAvoidPageBreakInside()
boolean
isBlockEquivalent()
boolean
isBottomAuto()
boolean
isCleared()
boolean
isClearLeft()
boolean
isClearRight()
boolean
isCollapseBorders()
boolean
isDisplayNone()
boolean
isFixed()
boolean
isFixedBackground()
boolean
isFloated()
boolean
isFloatedLeft()
boolean
isFloatedRight()
boolean
isForcePageBreakAfter()
boolean
isForcePageBreakBefore()
boolean
isHasBackground()
boolean
isHorizontalBackgroundRepeat()
boolean
isIdent(CSSName cssName, IdentValue val)
Gets the ident attribute of the CalculatedStyle objectboolean
isInline()
boolean
isInlineBlock()
boolean
isInlineTable()
boolean
isKeepWithInline()
boolean
isLayedOutInInlineContext()
boolean
isLength(CSSName cssName)
TODO: docboolean
isLengthOrNumber(CSSName cssName)
boolean
isListItem()
boolean
isListMarkerInside()
boolean
isMaxHeightNone()
boolean
isMaxWidthNone()
boolean
isMayCollapseMarginsWithChildren()
boolean
isNeedAutoMarginResolution()
boolean
isNonFlowContent()
boolean
isOverflowApplies()
boolean
isPaginateTable()
boolean
isPositioned()
boolean
isPostionedOrFloated()
boolean
isRelative()
boolean
isRunning()
boolean
isShowEmptyCells()
boolean
isSpecifiedAsBlock()
boolean
isTable()
boolean
isTableCaption()
boolean
isTableCell()
boolean
isTableFooter()
boolean
isTableHeader()
boolean
isTableRow()
boolean
isTableSection()
boolean
isTextJustify()
boolean
isTopAuto()
boolean
isVerticalBackgroundRepeat()
boolean
isVisible()
boolean
mayHaveFirstLetter()
boolean
mayHaveFirstLine()
boolean
requiresLayer()
java.lang.String
toString()
Converts to a String representation of the object.FSDerivedValue
valueByName(CSSName cssName)
Returns aFSDerivedValue
by name.
-
-
-
Field Detail
-
LEFT
public static final int LEFT
- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
- See Also:
- Constant Field Values
-
TOP
public static final int TOP
- See Also:
- Constant Field Values
-
BOTTOM
public static final int BOTTOM
- See Also:
- Constant Field Values
-
-
Method Detail
-
deriveStyle
public CalculatedStyle deriveStyle(CascadedStyle matched)
derives a child style from this style. depends on the ability to return the identical CascadedStyle each time a child style is needed- Parameters:
matched
- the CascadedStyle to apply- Returns:
- The derived child style
-
countAssigned
public int countAssigned()
-
getParent
public CalculatedStyle getParent()
Returns the parent style.- Returns:
- Returns the parent style
-
toString
public java.lang.String toString()
Converts to a String representation of the object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The borderWidth value
-
asFloat
public float asFloat(CSSName cssName)
-
asString
public java.lang.String asString(CSSName cssName)
-
asStringArray
public java.lang.String[] asStringArray(CSSName cssName)
-
hasAbsoluteUnit
public boolean hasAbsoluteUnit(CSSName cssName)
-
isIdent
public boolean isIdent(CSSName cssName, IdentValue val)
Gets the ident attribute of the CalculatedStyle object- Parameters:
cssName
- PARAMval
- PARAM- Returns:
- The ident value
-
getIdent
public IdentValue getIdent(CSSName cssName)
Gets the ident attribute of the CalculatedStyle object- Parameters:
cssName
- PARAM- Returns:
- The ident value
-
getColor
public FSColor getColor()
Convenience property accessor; returns a Color initialized with the foreground color Uses the actual value (computed actual value) for this element.- Returns:
- The color value
-
getBackgroundColor
public FSColor getBackgroundColor()
Convenience property accessor; returns a Color initialized with the background color value; Uses the actual value (computed actual value) for this element.- Returns:
- The backgroundColor value
-
getBackgroundPosition
public BackgroundPosition getBackgroundPosition()
-
getCounterReset
public java.util.List getCounterReset()
-
getCounterIncrement
public java.util.List getCounterIncrement()
-
getBorder
public BorderPropertySet getBorder(CssContext ctx)
-
getFont
public FontSpecification getFont(CssContext ctx)
-
getFloatPropertyProportionalTo
public float getFloatPropertyProportionalTo(CSSName cssName, float baseValue, CssContext ctx)
-
getFloatPropertyProportionalWidth
public float getFloatPropertyProportionalWidth(CSSName cssName, float parentWidth, CssContext ctx)
- Parameters:
cssName
-parentWidth
-ctx
-- Returns:
- TODO
-
getFloatPropertyProportionalHeight
public float getFloatPropertyProportionalHeight(CSSName cssName, float parentHeight, CssContext ctx)
- Parameters:
cssName
-parentHeight
-ctx
-- Returns:
- TODO
-
getLineHeight
public float getLineHeight(CssContext ctx)
-
getMarginRect
public RectPropertySet getMarginRect(float cbWidth, CssContext ctx)
Convenience property accessor; returns a Border initialized with the four-sided margin width. Uses the actual value (computed actual value) for this element.- Parameters:
cbWidth
-ctx
-- Returns:
- The marginWidth value
-
getMarginRect
public RectPropertySet getMarginRect(float cbWidth, CssContext ctx, boolean useCache)
-
getPaddingRect
public RectPropertySet getPaddingRect(float cbWidth, CssContext ctx, boolean useCache)
Convenience property accessor; returns a Border initialized with the four-sided padding width. Uses the actual value (computed actual value) for this element.- Parameters:
cbWidth
-ctx
-- Returns:
- The paddingWidth value
-
getPaddingRect
public RectPropertySet getPaddingRect(float cbWidth, CssContext ctx)
-
getStringProperty
public java.lang.String getStringProperty(CSSName cssName)
- Parameters:
cssName
-- Returns:
- TODO
-
isLength
public boolean isLength(CSSName cssName)
TODO: doc
-
isLengthOrNumber
public boolean isLengthOrNumber(CSSName cssName)
-
valueByName
public FSDerivedValue valueByName(CSSName cssName)
Returns aFSDerivedValue
by name. Because we are a derived style, the property will already be resolved at this point.- Parameters:
cssName
- The CSS property name, e.g. "font-family"- Returns:
- See desc.
-
getCachedPadding
public RectPropertySet getCachedPadding()
-
getCachedMargin
public RectPropertySet getCachedMargin()
-
getMarginBorderPadding
public int getMarginBorderPadding(CssContext cssCtx, int cbWidth, int which)
-
getWhitespace
public IdentValue getWhitespace()
-
getFSFont
public FSFont getFSFont(CssContext cssContext)
-
getFSFontMetrics
public FSFontMetrics getFSFontMetrics(CssContext c)
-
isClearLeft
public boolean isClearLeft()
-
isClearRight
public boolean isClearRight()
-
isCleared
public boolean isCleared()
-
getBackgroundRepeat
public IdentValue getBackgroundRepeat()
-
getBackgroundAttachment
public IdentValue getBackgroundAttachment()
-
isFixedBackground
public boolean isFixedBackground()
-
isInline
public boolean isInline()
-
isInlineBlock
public boolean isInlineBlock()
-
isTable
public boolean isTable()
-
isInlineTable
public boolean isInlineTable()
-
isTableCell
public boolean isTableCell()
-
isTableSection
public boolean isTableSection()
-
isTableCaption
public boolean isTableCaption()
-
isTableHeader
public boolean isTableHeader()
-
isTableFooter
public boolean isTableFooter()
-
isTableRow
public boolean isTableRow()
-
isDisplayNone
public boolean isDisplayNone()
-
isSpecifiedAsBlock
public boolean isSpecifiedAsBlock()
-
isBlockEquivalent
public boolean isBlockEquivalent()
-
isLayedOutInInlineContext
public boolean isLayedOutInInlineContext()
-
isNeedAutoMarginResolution
public boolean isNeedAutoMarginResolution()
-
isAbsolute
public boolean isAbsolute()
-
isFixed
public boolean isFixed()
-
isFloated
public boolean isFloated()
-
isFloatedLeft
public boolean isFloatedLeft()
-
isFloatedRight
public boolean isFloatedRight()
-
isRelative
public boolean isRelative()
-
isPostionedOrFloated
public boolean isPostionedOrFloated()
-
isPositioned
public boolean isPositioned()
-
isAutoWidth
public boolean isAutoWidth()
-
isAutoHeight
public boolean isAutoHeight()
-
isAutoZIndex
public boolean isAutoZIndex()
-
establishesBFC
public boolean establishesBFC()
-
requiresLayer
public boolean requiresLayer()
-
isRunning
public boolean isRunning()
-
getRunningName
public java.lang.String getRunningName()
-
isOverflowApplies
public boolean isOverflowApplies()
-
isHorizontalBackgroundRepeat
public boolean isHorizontalBackgroundRepeat()
-
isVerticalBackgroundRepeat
public boolean isVerticalBackgroundRepeat()
-
isTopAuto
public boolean isTopAuto()
-
isBottomAuto
public boolean isBottomAuto()
-
isListItem
public boolean isListItem()
-
isVisible
public boolean isVisible()
-
isForcePageBreakBefore
public boolean isForcePageBreakBefore()
-
isForcePageBreakAfter
public boolean isForcePageBreakAfter()
-
isAvoidPageBreakInside
public boolean isAvoidPageBreakInside()
-
createAnonymousStyle
public CalculatedStyle createAnonymousStyle(IdentValue display)
-
mayHaveFirstLine
public boolean mayHaveFirstLine()
-
mayHaveFirstLetter
public boolean mayHaveFirstLetter()
-
isNonFlowContent
public boolean isNonFlowContent()
-
isMayCollapseMarginsWithChildren
public boolean isMayCollapseMarginsWithChildren()
-
isAbsFixedOrInlineBlockEquiv
public boolean isAbsFixedOrInlineBlockEquiv()
-
isMaxWidthNone
public boolean isMaxWidthNone()
-
isMaxHeightNone
public boolean isMaxHeightNone()
-
getMinWidth
public int getMinWidth(CssContext c, int cbWidth)
-
getMaxWidth
public int getMaxWidth(CssContext c, int cbWidth)
-
getMinHeight
public int getMinHeight(CssContext c, int cbHeight)
-
getMaxHeight
public int getMaxHeight(CssContext c, int cbHeight)
-
isCollapseBorders
public boolean isCollapseBorders()
-
getBorderHSpacing
public int getBorderHSpacing(CssContext c)
-
getBorderVSpacing
public int getBorderVSpacing(CssContext c)
-
getRowSpan
public int getRowSpan()
-
getColSpan
public int getColSpan()
-
asLength
public Length asLength(CssContext c, CSSName cssName)
-
isShowEmptyCells
public boolean isShowEmptyCells()
-
isHasBackground
public boolean isHasBackground()
-
getTextDecorations
public java.util.List getTextDecorations()
-
getCursor
public java.awt.Cursor getCursor()
-
isPaginateTable
public boolean isPaginateTable()
-
isTextJustify
public boolean isTextJustify()
-
isListMarkerInside
public boolean isListMarkerInside()
-
isKeepWithInline
public boolean isKeepWithInline()
-
-