Package com.openhtmltopdf.css.style
Class CalculatedStyle
java.lang.Object
com.openhtmltopdf.css.style.CalculatedStyle
- Direct Known Subclasses:
EmptyStyle
public class CalculatedStyle extends 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 valid
LayoutContext 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.- Author:
- Torbjoern Gannholm, Patrick Wright
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedCalculatedStyle()Default constructor; as the instance is immutable after use, don't use this for class instantiation externally. -
Method Summary
-
Field Details
-
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
-
-
Constructor Details
-
CalculatedStyle
protected CalculatedStyle()Default constructor; as the instance is immutable after use, don't use this for class instantiation externally.
-
-
Method Details
-
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
-
countAssigned
public int countAssigned() -
getParent
Returns the parent style.- Returns:
- Returns the parent style
-
toString
Converts to a String representation of the object. -
asColor
-
asFloat
-
asString
-
asStringArray
-
setDefaultValue
-
hasAbsoluteUnit
-
isIdent
Gets the ident attribute of the CalculatedStyle object- Parameters:
cssName- PARAMval- PARAM- Returns:
- The ident value
-
getIdent
Gets the ident attribute of the CalculatedStyle object- Parameters:
cssName- PARAM- Returns:
- The ident value
-
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
-
getBackgroundPosition
-
getCounterReset
-
getCounterIncrement
-
getBorder
-
getFont
-
getFontSpecification
-
getFloatPropertyProportionalTo
-
getFloatPropertyProportionalWidth
- Parameters:
cssName-parentWidth-ctx-- Returns:
- TODO
-
getFloatPropertyProportionalHeight
public float getFloatPropertyProportionalHeight(CSSName cssName, float parentHeight, CssContext ctx)- Parameters:
cssName-parentHeight-ctx-- Returns:
- TODO
-
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.- Parameters:
cbWidth-ctx-- 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.- Parameters:
cbWidth-ctx-- Returns:
- The paddingWidth value
-
getPaddingRect
-
getStringProperty
- Parameters:
cssName-- Returns:
- TODO
-
isLength
TODO: doc -
isLengthOrNumber
-
valueByName
Returns aFSDerivedValueby 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
-
getCachedMargin
-
getMarginBorderPadding
-
getWhitespace
-
getFSFont
-
getFSFontMetrics
-
getWordWrap
-
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() -
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() -
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() -
hasColumns
public boolean hasColumns() -
columnCount
public int columnCount() -
fsMaxOverflowPages
public int fsMaxOverflowPages() -
isVisible
Determine if the element is visible. This is normaly the case if visibility == visible. Only when visibilty is -fs-table-paginate-repeated-visible and we are in a repeated table header the element will also be visible. This allows to only show an element in the table header after a page break.- Parameters:
renderingContext- null or the current renderingContext. If null, then the -fs-table-paginate-repeated-visible logic will not work.thisElement- the element for which the visibility should be determined. Only required if -fs-table-paginate-repeated-visible is specified.- Returns:
- true if the element is visible
-
isForcePageBreakBefore
public boolean isForcePageBreakBefore() -
isForcePageBreakAfter
public boolean isForcePageBreakAfter() -
isColumnBreakBefore
public boolean isColumnBreakBefore() -
isColumnBreakAfter
public boolean isColumnBreakAfter() -
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() -
isImageRenderingPixelated
public boolean isImageRenderingPixelated() -
isImageRenderingInterpolate
public boolean isImageRenderingInterpolate() -
getMinWidth
-
getMaxWidth
-
getMinHeight
-
getMaxHeight
-
isCollapseBorders
public boolean isCollapseBorders() -
getBorderHSpacing
-
getBorderVSpacing
-
getRowSpan
public int getRowSpan() -
getColSpan
public int getColSpan() -
getFSPageBreakMinHeight
-
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() -
isDirectionLTR
public boolean isDirectionLTR() -
isDirectionRTL
public boolean isDirectionRTL() -
isDirectionAuto
public boolean isDirectionAuto() -
getDirection
-
hasLetterSpacing
public boolean hasLetterSpacing() -
isParagraphContainerForBidi
public boolean isParagraphContainerForBidi() -
isBorderBox
public boolean isBorderBox()- Returns:
- true for border-box, false for content-box.
-
getCSSMaxWidth
Aims to get the correct resolved max-width for a box in dots unit. Returns -1 if there is no max-width defined. Assumptions: box has a containing block. -
getCSSMaxHeight
Aims to get the correct resolved max-height for a box in dots unit. returns -1 if there is no max-height defined. Assumptions: box has a containing block.
-