Skip to content

Commit

Permalink
#429 [refactor] convert constants Layer.{AUTO|NEGATIVE|POSITIVE|ZERO}…
Browse files Browse the repository at this point in the history
… to enum Width
  • Loading branch information
asolntsev committed Oct 30, 2024
1 parent 8e31d9d commit f4e656c
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
import static java.util.Collections.sort;
import static java.util.Collections.unmodifiableList;
import static java.util.Comparator.comparingInt;
import static org.xhtmlrenderer.layout.Layer.Width.AUTO;
import static org.xhtmlrenderer.layout.Layer.Width.NEGATIVE;
import static org.xhtmlrenderer.layout.Layer.Width.POSITIVE;
import static org.xhtmlrenderer.layout.Layer.Width.ZERO;

/**
* All positioned content as well as content with an overflow value other
Expand Down Expand Up @@ -176,13 +180,10 @@ private void paintLayers(RenderingContext c, List<Layer> layers) {
}
}

private static final int POSITIVE = 1;
private static final int ZERO = 2;
private static final int NEGATIVE = 3;
private static final int AUTO = 4;
enum Width {POSITIVE, ZERO, NEGATIVE, AUTO}

@CheckReturnValue
private List<Layer> collectLayers(int which) {
private List<Layer> collectLayers(Width which) {
List<Layer> result = new ArrayList<>();

if (which != AUTO) {
Expand All @@ -203,7 +204,7 @@ private List<Layer> collectLayers(int which) {
}

@CheckReturnValue
private List<Layer> getStackingContextLayers(int which) {
private List<Layer> getStackingContextLayers(Width which) {
List<Layer> result = new ArrayList<>();

List<Layer> children = getChildren();
Expand All @@ -224,7 +225,7 @@ private List<Layer> getStackingContextLayers(int which) {
}

@CheckReturnValue
private List<Layer> getSortedLayers(int which) {
private List<Layer> getSortedLayers(Width which) {
List<Layer> result = collectLayers(which);
result.sort(new ZIndexComparator());
return result;
Expand Down

0 comments on commit f4e656c

Please sign in to comment.