org.openqa.selenium.devtools.v90.domsnapshot.model.TextBoxSnapshot Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools-v90 Show documentation
Show all versions of selenium-devtools-v90 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.v90.domsnapshot.model;
import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;
/**
* Table of details of the post layout rendered text positions. The exact layout should not be regarded as
* stable and may change between versions.
*/
public class TextBoxSnapshot {
private final java.util.List layoutIndex;
private final java.util.List bounds;
private final java.util.List start;
private final java.util.List length;
public TextBoxSnapshot(java.util.List layoutIndex, java.util.List bounds, java.util.List start, java.util.List length) {
this.layoutIndex = java.util.Objects.requireNonNull(layoutIndex, "layoutIndex is required");
this.bounds = java.util.Objects.requireNonNull(bounds, "bounds is required");
this.start = java.util.Objects.requireNonNull(start, "start is required");
this.length = java.util.Objects.requireNonNull(length, "length is required");
}
/**
* Index of the layout tree node that owns this box collection.
*/
public java.util.List getLayoutIndex() {
return layoutIndex;
}
/**
* The absolute position bounding box.
*/
public java.util.List getBounds() {
return bounds;
}
/**
* The starting index in characters, for this post layout textbox substring. Characters that
* would be represented as a surrogate pair in UTF-16 have length 2.
*/
public java.util.List getStart() {
return start;
}
/**
* The number of characters in this post layout textbox substring. Characters that would be
* represented as a surrogate pair in UTF-16 have length 2.
*/
public java.util.List getLength() {
return length;
}
private static TextBoxSnapshot fromJson(JsonInput input) {
java.util.List layoutIndex = null;
java.util.List bounds = null;
java.util.List start = null;
java.util.List length = null;
input.beginObject();
while (input.hasNext()) {
switch(input.nextName()) {
case "layoutIndex":
layoutIndex = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
case "bounds":
bounds = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
case "start":
start = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
case "length":
length = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
default:
input.skipValue();
break;
}
}
input.endObject();
return new TextBoxSnapshot(layoutIndex, bounds, start, length);
}
}