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 ContentFunction
private @Nullable Element
private boolean
private int
private final @Nullable FSFunction
private int
private boolean
private int
private String
private final @Nullable String
private boolean
private boolean
private @Nullable CalculatedStyle
private String
private 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 void
appendPositioningInfo
(StringBuilder result) void
private void
calcMaxWidthFromLineLength
(LayoutContext c, int cbWidth, boolean trim) void
calcMinMaxWidth
(LayoutContext c, int cbWidth, boolean trimLeadingSpace) private int
calcMinWidthFromWordLength
(LayoutContext c, int cbWidth, boolean trimLeadingSpace, boolean includeWS) @Nullable ContentFunction
@Nullable Element
int
@Nullable FSFunction
private int
getInlineMBP
(LayoutContext c, int cbWidth) private int
int
int
@Nullable String
int
@Nullable CalculatedStyle
getStyle()
getText()
private String
getText
(boolean trimLeadingSpace) @Nullable Text
private int
getTextWidth
(LayoutContext c, String s) int
boolean
boolean
boolean
boolean
void
setElement
(@Nullable Element element) void
setEndsHere
(boolean endsHere) void
setRemovableWhitespace
(boolean removableWhitespace) void
setStartsHere
(boolean startsHere) void
setStyle
(@Nullable CalculatedStyle style) void
private String
toString()
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:
getElement
in interfaceStyleable
-
setElement
- Specified by:
setElement
in 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:
getPseudoElementOrClass
in interfaceStyleable
-
toString
-
appendPositioningInfo
-
shortText
-
getFunction
-
truncateText
public void truncateText() -
getTextNode
-