Package org.xhtmlrenderer.render
Class InlineBox
java.lang.Object
org.xhtmlrenderer.render.InlineBox
- All Implemented Interfaces:
Styleable
A class which represents a portion of an inline element. If an inline element
does not contain any nested elements, then a single
InlineBox
object will contain the content for the entire element. Otherwise, multiple
InlineBox objects will be created corresponding to each
discrete chunk of text appearing in the element. It is not rendered directly
(and hence does not extend from Box), but does play an important
role in layout (for example, when calculating min/max widths). Note that it
does not contain children. Inline content is stored as a flat list in the
layout tree. However, InlineBox does contain enough
information to reconstruct the original element nesting and this is, in fact,
done during inline layout.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @Nullable ContentFunctionprivate @Nullable Elementprivate booleanprivate intprivate final @Nullable FSFunctionprivate intprivate booleanprivate intprivate Stringprivate final @Nullable Stringprivate booleanprivate booleanprivate @Nullable CalculatedStyleprivate Stringprivate final @Nullable Text -
Constructor Summary
ConstructorsConstructorDescriptionInlineBox(String text, @Nullable Text textNode, @Nullable ContentFunction contentFunction, @Nullable FSFunction function, @Nullable Element element, @Nullable String pseudoElementOrClass) InlineBox(String text, @Nullable Text textNode, @Nullable ContentFunction contentFunction, @Nullable FSFunction function, @Nullable Element element, @Nullable String pseudoElementOrClass, @Nullable CalculatedStyle style) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendPositioningInfo(StringBuilder result) voidprivate voidcalcMaxWidthFromLineLength(LayoutContext c, int cbWidth, boolean trim) voidcalcMinMaxWidth(LayoutContext c, int cbWidth, boolean trimLeadingSpace) private intcalcMinWidthFromWordLength(LayoutContext c, int cbWidth, boolean trimLeadingSpace, boolean includeWS) @Nullable ContentFunction@Nullable Elementint@Nullable FSFunctionprivate intgetInlineMBP(LayoutContext c, int cbWidth) private intintint@Nullable Stringint@Nullable CalculatedStylegetStyle()getText()private StringgetText(boolean trimLeadingSpace) @Nullable Textprivate intgetTextWidth(LayoutContext c, String s) intbooleanbooleanbooleanbooleanvoidsetElement(@Nullable Element element) voidsetEndsHere(boolean endsHere) voidsetRemovableWhitespace(boolean removableWhitespace) voidsetStartsHere(boolean startsHere) voidsetStyle(@Nullable CalculatedStyle style) voidprivate StringtoString()void
-
Field Details
-
_element
-
_originalText
-
_text
-
_removableWhitespace
private boolean _removableWhitespace -
_startsHere
private boolean _startsHere -
_endsHere
private boolean _endsHere -
_style
-
_contentFunction
-
_function
-
_minMaxCalculated
private boolean _minMaxCalculated -
_maxWidth
private int _maxWidth -
_minWidth
private int _minWidth -
_firstLineWidth
private int _firstLineWidth -
_pseudoElementOrClass
-
_textNode
-
-
Constructor Details
-
InlineBox
-
InlineBox
public InlineBox(String text, @Nullable Text textNode, @Nullable ContentFunction contentFunction, @Nullable FSFunction function, @Nullable Element element, @Nullable String pseudoElementOrClass) -
InlineBox
public InlineBox(String text, @Nullable Text textNode, @Nullable ContentFunction contentFunction, @Nullable FSFunction function, @Nullable Element element, @Nullable String pseudoElementOrClass, @Nullable CalculatedStyle style)
-
-
Method Details
-
getText
-
setText
-
applyTextTransform
public void applyTextTransform() -
isRemovableWhitespace
public boolean isRemovableWhitespace() -
setRemovableWhitespace
public void setRemovableWhitespace(boolean removableWhitespace) -
isEndsHere
public boolean isEndsHere() -
setEndsHere
public void setEndsHere(boolean endsHere) -
isStartsHere
public boolean isStartsHere() -
setStartsHere
public void setStartsHere(boolean startsHere) -
getStyle
-
setStyle
-
getElement
- Specified by:
getElementin interfaceStyleable
-
setElement
- Specified by:
setElementin interfaceStyleable
-
getContentFunction
-
isDynamicFunction
public boolean isDynamicFunction() -
getTextWidth
-
getMaxCharWidth
-
calcMaxWidthFromLineLength
-
getSpaceWidth
-
getTrailingSpaceWidth
-
calcMinWidthFromWordLength
private int calcMinWidthFromWordLength(LayoutContext c, int cbWidth, boolean trimLeadingSpace, boolean includeWS) -
getText
-
getInlineMBP
-
calcMinMaxWidth
-
getMaxWidth
public int getMaxWidth() -
getMinWidth
public int getMinWidth() -
getFirstLineWidth
public int getFirstLineWidth() -
getPseudoElementOrClass
- Specified by:
getPseudoElementOrClassin interfaceStyleable
-
toString
-
appendPositioningInfo
-
shortText
-
getFunction
-
truncateText
public void truncateText() -
getTextNode
-