Skip to content

Commit

Permalink
#429 [refactor] make few fields in LineBreakContext immutable or no…
Browse files Browse the repository at this point in the history
…n-nullable
  • Loading branch information
asolntsev committed Oct 30, 2024
1 parent 0ab7acc commit 1aa5a3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,9 @@ public static void layoutContent(LayoutContext c, BlockBox box, int initialY, in
c, maxAvailableWidth, Edge.RIGHT);
}

LineBreakContext lbContext = new LineBreakContext();
lbContext.setMaster(iB.getText());
lbContext.setTextNode(iB.getTextNode());
if (iB.isDynamicFunction()) {
lbContext.setMaster(iB.getContentFunction().getLayoutReplacementText());
}
String master = iB.isDynamicFunction() ?
iB.getContentFunction().getLayoutReplacementText() : iB.getText();
LineBreakContext lbContext = new LineBreakContext(master, iB.getTextNode());

int q = 0;
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ public class LineBreakContext {
private boolean _needsNewLine;
private int _width;
private boolean _endsOnNL;
private Text _textNode;
private final Text _textNode;

public LineBreakContext(String master, Text textNode) {
this._master = master;
this._textNode = textNode;
}

public int getLast() {
return _master.length();
Expand Down Expand Up @@ -133,8 +138,4 @@ public void setEndsOnNL(boolean b) {
public Text getTextNode() {
return this._textNode;
}

public void setTextNode(Text _text) {
this._textNode = _text;
}
}

0 comments on commit 1aa5a3f

Please sign in to comment.