Class CalculatedStyle
- Direct Known Subclasses:
EmptyStyle
CssContext
be given to it, for some cases of property
resolution. Generally, a programmer will not use this class directly, but
will retrieve properties using a StyleReference
implementation.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate @Nullable BackgroundSize
private @Nullable BorderPropertySet
private boolean
private final Map
<String, CalculatedStyle> Cache child styles of this style that have the same cascaded propertiesprivate final @Nullable FSDerivedValue[]
Our main array of property values defined in this style, keyed by the CSSName assigned ID.private @Nullable FontSpecification
The derived Font for this styleprivate @Nullable FSFont
private @Nullable FSFontMetrics
private float
private boolean
private @Nullable RectPropertySet
private boolean
private @Nullable RectPropertySet
private boolean
private final @Nullable CalculatedStyle
The parent-style we inherit from -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Default constructor; as the instance is immutable after use, don't use this for class instantiation externally.private
CalculatedStyle
(@Nullable CalculatedStyle parent) private
CalculatedStyle
(CalculatedStyle parent, CascadedStyle matched) Constructor for the CalculatedStyle object. -
Method Summary
Modifier and TypeMethodDescriptionfloat
asLength
(CssContext c, CSSName cssName) String[]
asStringArray
(CSSName cssName) private static boolean
checkBordersAllowed
(IdentValue display) private static boolean
checkMarginsAllowed
(IdentValue display) private boolean
checkPaddingAllowed
(IdentValue display) createAnonymousStyle
(IdentValue display) private BackgroundSize
private void
derive
(CascadedStyle matched) Implements cascade/inherit/important logic.@NonNull CalculatedStyle
deriveStyle
(CascadedStyle matched) derives a child style from this style.private FSDerivedValue
deriveValue
(CSSName cssName, CSSPrimitiveValue value) boolean
private String
@Nullable FSColor
Convenience property accessor; returns a Color initialized with the background color value; Uses the actual value (computed actual value) for this element.getBorder
(@Nullable CssContext ctx) int
private static BorderPropertySet
getBorderProperty
(CalculatedStyle style, @Nullable CssContext ctx) int
getColor()
Convenience property accessor; returns a Color initialized with the foreground color Uses the actual value (computed actual value) for this element.int
@Nullable List
<CounterData> @Nullable List
<CounterData> @Nullable Cursor
float
getFloatPropertyProportionalHeight
(CSSName cssName, float parentHeight, CssContext ctx) float
getFloatPropertyProportionalTo
(CSSName cssName, float baseValue, CssContext ctx) float
getFloatPropertyProportionalWidth
(CSSName cssName, float parentWidth, CssContext ctx) getFont
(CssContext ctx) @Nullable FontSpecification
getFSFont
(CssContext cssContext) Gets the ident attribute of the CalculatedStyle objectint
getIntPropertyProportionalTo
(CSSName cssName, float baseValue, CssContext ctx) float
getLineHeight
(CssContext ctx) int
getMarginBorderPadding
(CssContext cssCtx, int cbWidth, CalculatedStyle.Edge edge) private static RectPropertySet
getMarginProperty
(CalculatedStyle style, float cbWidth, CssContext ctx, boolean useCache) getMarginRect
(float cbWidth, CssContext ctx) Convenience property accessor; returns a Border initialized with the four-sided margin width.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) private static RectPropertySet
getPaddingProperty
(CalculatedStyle style, float cbWidth, CssContext ctx) getPaddingRect
(float cbWidth, CssContext ctx) Convenience property accessor; returns a Border initialized with the four-sided padding width.@Nullable CalculatedStyle
int
getStringProperty
(CSSName cssName) @Nullable List
<FSDerivedValue> boolean
hasAbsoluteUnit
(CSSName cssName) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isFixed()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isIdent
(CSSName cssName, IdentValue val) Gets the ident attribute of the CalculatedStyle objectboolean
isInline()
boolean
boolean
boolean
boolean
boolean
boolean
isLengthOrNumber
(CSSName cssName) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isTable()
private static boolean
isTable
(IdentValue display) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
private static RectPropertySet
newRectInstance
(CalculatedStyle style, CSSName.CSSSideProperties sides, float cbWidth, CssContext ctx) boolean
private @Nullable IdentValue
void
setDefaultValue
(CSSName cssName, FSDerivedValue fsDerivedValue) toString()
valueByName
(CSSName cssName) Returns aFSDerivedValue
by name.
-
Field Details
-
_parent
The parent-style we inherit from -
_border
-
_margin
-
_padding
-
_lineHeight
private float _lineHeight -
_lineHeightResolved
private boolean _lineHeightResolved -
_FSFont
-
_FSFontMetrics
-
_marginsAllowed
private boolean _marginsAllowed -
_paddingAllowed
private boolean _paddingAllowed -
_bordersAllowed
private boolean _bordersAllowed -
_backgroundSize
-
_childCache
Cache child styles of this style that have the same cascaded properties -
_derivedValuesById
Our main array of property values defined in this style, keyed by the CSSName assigned ID. -
_font
The derived Font for this style
-
-
Constructor Details
-
CalculatedStyle
-
CalculatedStyle
protected CalculatedStyle()Default constructor; as the instance is immutable after use, don't use this for class instantiation externally. -
CalculatedStyle
Constructor for the CalculatedStyle object. To get a derived style, use the Styler objects getDerivedStyle which will cache styles
-
-
Method Details
-
checkPaddingAllowed
-
isTable
-
checkMarginsAllowed
-
checkBordersAllowed
-
deriveStyle
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
-
getParent
-
toString
-
asColor
-
asFloat
-
asString
-
asStringArray
-
setDefaultValue
-
hasAbsoluteUnit
-
isIdent
Gets the ident attribute of the CalculatedStyle object -
getIdent
Gets the ident attribute of the CalculatedStyle object -
getDisplay
-
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
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
-
getBackgroundSize
-
createBackgroundSize
-
getBackgroundPosition
-
getCounterReset
-
getCounterIncrement
-
getBorder
-
getFont
-
getFontSpecification
-
resolveAbsoluteFontSize
-
getIntPropertyProportionalTo
-
getFloatPropertyProportionalTo
-
getFloatPropertyProportionalWidth
-
getFloatPropertyProportionalHeight
public float getFloatPropertyProportionalHeight(CSSName cssName, float parentHeight, CssContext ctx) -
getLineHeight
-
getMarginRect
Convenience property accessor; returns a Border initialized with the four-sided margin width. Uses the actual value (computed actual value) for this element.- Returns:
- The marginWidth value
-
getMarginRect
-
getPaddingRect
Convenience property accessor; returns a Border initialized with the four-sided padding width. Uses the actual value (computed actual value) for this element.- Returns:
- The paddingWidth value
-
getStringProperty
-
isLength
-
isLengthOrNumber
-
valueByName
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"
-
derive
Implements cascade/inherit/important logic. This should result in the element for this style having a value for *each and every* (visual) property in the CSS2 spec. The implementation is based on the notion that the matched styles are given to us in a perfectly sorted order, such that properties appearing later in the rule-set always override properties appearing earlier. It also assumes that all properties in the CSS2 spec are defined somewhere across all the matched styles; for example, that the full-property set is given in the user-agent CSS that is always loaded with styles. The current implementation makes no attempt to check either of these assumptions. When this method exits, the derived property list for this class will be populated with the properties defined for this element, properly cascaded.
-
deriveValue
-
genStyleKey
-
getCachedPadding
-
getPaddingProperty
private static RectPropertySet getPaddingProperty(CalculatedStyle style, float cbWidth, CssContext ctx) -
getMarginProperty
private static RectPropertySet getMarginProperty(CalculatedStyle style, float cbWidth, CssContext ctx, boolean useCache) -
newRectInstance
private static RectPropertySet newRectInstance(CalculatedStyle style, CSSName.CSSSideProperties sides, float cbWidth, CssContext ctx) -
getBorderProperty
-
getMarginBorderPadding
-
getWhitespace
-
getFSFont
-
getFSFontMetrics
-
getWordWrap
-
getWordBreak
-
getHyphens
-
isClearLeft
public boolean isClearLeft() -
isClearRight
public boolean isClearRight() -
isCleared
public boolean isCleared() -
getBackgroundRepeat
-
getBackgroundAttachment
-
isFixedBackground
public boolean isFixedBackground() -
isInline
public boolean isInline() -
isInlineBlock
public boolean isInlineBlock() -
isTable
public boolean isTable() -
isInlineTable
public boolean isInlineTable() -
isUnderTableLayout
public boolean isUnderTableLayout() -
isTableCell
public boolean isTableCell() -
isTableSection
public boolean isTableSection() -
isTableCaption
public boolean isTableCaption() -
isTableHeader
public boolean isTableHeader() -
isTableRow
public boolean isTableRow() -
isDisplayNone
public boolean isDisplayNone() -
isSpecifiedAsBlock
public boolean isSpecifiedAsBlock() -
isBlockEquivalent
public boolean isBlockEquivalent() -
isLaidOutInInlineContext
public boolean isLaidOutInInlineContext() -
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() -
isPositionedOrFloated
public boolean isPositionedOrFloated() -
isPositioned
public boolean isPositioned() -
isAutoWidth
public boolean isAutoWidth() -
isAbsoluteWidth
public boolean isAbsoluteWidth() -
isAutoHeight
public boolean isAutoHeight() -
isAutoLeftMargin
public boolean isAutoLeftMargin() -
isAutoRightMargin
public boolean isAutoRightMargin() -
isAutoZIndex
public boolean isAutoZIndex() -
establishesBFC
public boolean establishesBFC() -
requiresLayer
public boolean requiresLayer() -
isRunning
public boolean isRunning() -
getRunningName
-
isOverflowApplies
public boolean isOverflowApplies() -
isOverflowVisible
public boolean isOverflowVisible() -
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
-
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() -
isBorderBox
public boolean isBorderBox() -
getMinWidth
-
getMaxWidth
-
getMinHeight
-
getMaxHeight
-
isCollapseBorders
public boolean isCollapseBorders() -
getBorderHSpacing
-
getBorderVSpacing
-
getRowSpan
public int getRowSpan() -
getColSpan
public int getColSpan() -
asLength
-
isShowEmptyCells
public boolean isShowEmptyCells() -
isHasBackground
public boolean isHasBackground() -
getTextDecorations
-
getCursor
-
isPaginateTable
public boolean isPaginateTable() -
isTextJustify
public boolean isTextJustify() -
isListMarkerInside
public boolean isListMarkerInside() -
isKeepWithInline
public boolean isKeepWithInline() -
isDynamicAutoWidth
public boolean isDynamicAutoWidth() -
isDynamicAutoWidthApplicable
public boolean isDynamicAutoWidthApplicable() -
isCanBeShrunkToFit
public boolean isCanBeShrunkToFit()
-