org.openqa.selenium.devtools.layertree.model.StickyPositionConstraint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools Show documentation
Show all versions of selenium-devtools Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.layertree.model;
import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;
/**
* Sticky position constraints.
*/
public class StickyPositionConstraint {
private final org.openqa.selenium.devtools.dom.model.Rect stickyBoxRect;
private final org.openqa.selenium.devtools.dom.model.Rect containingBlockRect;
private final java.util.Optional nearestLayerShiftingStickyBox;
private final java.util.Optional nearestLayerShiftingContainingBlock;
public StickyPositionConstraint(org.openqa.selenium.devtools.dom.model.Rect stickyBoxRect, org.openqa.selenium.devtools.dom.model.Rect containingBlockRect, java.util.Optional nearestLayerShiftingStickyBox, java.util.Optional nearestLayerShiftingContainingBlock) {
this.stickyBoxRect = java.util.Objects.requireNonNull(stickyBoxRect, "stickyBoxRect is required");
this.containingBlockRect = java.util.Objects.requireNonNull(containingBlockRect, "containingBlockRect is required");
this.nearestLayerShiftingStickyBox = nearestLayerShiftingStickyBox;
this.nearestLayerShiftingContainingBlock = nearestLayerShiftingContainingBlock;
}
/**
* Layout rectangle of the sticky element before being shifted
*/
public org.openqa.selenium.devtools.dom.model.Rect getStickyBoxRect() {
return stickyBoxRect;
}
/**
* Layout rectangle of the containing block of the sticky element
*/
public org.openqa.selenium.devtools.dom.model.Rect getContainingBlockRect() {
return containingBlockRect;
}
/**
* The nearest sticky layer that shifts the sticky box
*/
public java.util.Optional getNearestLayerShiftingStickyBox() {
return nearestLayerShiftingStickyBox;
}
/**
* The nearest sticky layer that shifts the containing block
*/
public java.util.Optional getNearestLayerShiftingContainingBlock() {
return nearestLayerShiftingContainingBlock;
}
private static StickyPositionConstraint fromJson(JsonInput input) {
org.openqa.selenium.devtools.dom.model.Rect stickyBoxRect = null;
org.openqa.selenium.devtools.dom.model.Rect containingBlockRect = null;
java.util.Optional nearestLayerShiftingStickyBox = java.util.Optional.empty();
java.util.Optional nearestLayerShiftingContainingBlock = java.util.Optional.empty();
input.beginObject();
while (input.hasNext()) {
switch(input.nextName()) {
case "stickyBoxRect":
stickyBoxRect = input.read(org.openqa.selenium.devtools.dom.model.Rect.class);
break;
case "containingBlockRect":
containingBlockRect = input.read(org.openqa.selenium.devtools.dom.model.Rect.class);
break;
case "nearestLayerShiftingStickyBox":
nearestLayerShiftingStickyBox = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.layertree.model.LayerId.class));
break;
case "nearestLayerShiftingContainingBlock":
nearestLayerShiftingContainingBlock = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.layertree.model.LayerId.class));
break;
default:
input.skipValue();
break;
}
}
input.endObject();
return new StickyPositionConstraint(stickyBoxRect, containingBlockRect, nearestLayerShiftingStickyBox, nearestLayerShiftingContainingBlock);
}
}