com.gargoylesoftware.htmlunit.javascript.host.Window.jsxFunction_getComputedStyle()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 JavaScript  
字(6.0k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中com.gargoylesoftware.htmlunit.javascript.host.Window.jsxFunction_getComputedStyle()方法的一些代码示例,展示了Window.jsxFunction_getComputedStyle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.jsxFunction_getComputedStyle()方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.javascript.host.Window
类名称:Window
方法名:jsxFunction_getComputedStyle

Window.jsxFunction_getComputedStyle介绍

[英]Returns computed style of the element. Computed style represents the final computed values of all CSS properties for the element. This method's return value is of the same type as that of element.style, but the value returned by this method is read-only.
[中]返回元素的计算样式。Computed style表示元素的所有CSS属性的最终计算值。此方法的返回值与元素的返回值类型相同。但是这个方法返回的值是只读的。

代码示例

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the current (calculated) style object for this element.
 * @return the current (calculated) style object for this element
 */
public ComputedCSSStyleDeclaration jsxGet_currentStyle() {
  return getWindow().jsxFunction_getComputedStyle(this, null);
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns the current (calculated) style object for this element.
 * @return the current (calculated) style object for this element
 */
public ComputedCSSStyleDeclaration jsxGet_currentStyle() {
  return getWindow().jsxFunction_getComputedStyle(this, null);
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns the current (calculated) style object for this element.
 * @return the current (calculated) style object for this element
 */
public ComputedCSSStyleDeclaration jsxGet_currentStyle() {
  return getWindow().jsxFunction_getComputedStyle(this, null);
}

代码示例来源:origin: stackoverflow.com

WebClient webClient = new WebClient();
 XHtmlPage page = webClient.getPage("…");
 HtmlElement div = page.getHtmlElementById("elem_container");
 WebWindow window = webClient.getCurrentWindow();
 Window jscript = (Window) window.getScriptObject();
 HTMLElement element = (HTMLElement) jscript.makeScriptableFor(div);
 ComputedCSSStyleDeclaration style = jscript.jsxFunction_getComputedStyle(element, null);
 System.out.println(style);

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns "clientWidth" attribute.
 * @return the clientWidth attribute
 */
public int jsxGet_clientWidth() {
  final boolean includePadding = !getBrowserVersion().isIE();
  final ComputedCSSStyleDeclaration style = getWindow().jsxFunction_getComputedStyle(this, null);
  return style.getCalculatedWidth(false, includePadding);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns "clientHeight" attribute.
 * @return the clientHeight attribute
 */
public int jsxGet_clientHeight() {
  final boolean includePadding = !getBrowserVersion().isIE();
  final ComputedCSSStyleDeclaration style = getWindow().jsxFunction_getComputedStyle(this, null);
  return style.getCalculatedHeight(false, includePadding);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns "clientWidth" attribute.
 * @return the clientWidth attribute
 */
public int jsxGet_clientWidth() {
  final boolean includePadding = !getBrowserVersion().isIE();
  final ComputedCSSStyleDeclaration style = getWindow().jsxFunction_getComputedStyle(this, null);
  return style.getCalculatedWidth(false, includePadding);
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns "clientHeight" attribute.
 * @return the clientHeight attribute
 */
public int jsxGet_clientHeight() {
  final boolean includePadding = !getBrowserVersion().isIE();
  final ComputedCSSStyleDeclaration style = getWindow().jsxFunction_getComputedStyle(this, null);
  return style.getCalculatedHeight(false, includePadding);
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns "clientWidth" attribute.
 * @return the clientWidth attribute
 */
public int jsxGet_clientWidth() {
  final boolean includePadding = !getBrowserVersion().isIE();
  final ComputedCSSStyleDeclaration style = getWindow().jsxFunction_getComputedStyle(this, null);
  return style.getCalculatedWidth(false, includePadding);
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns "clientHeight" attribute.
 * @return the clientHeight attribute
 */
public int jsxGet_clientHeight() {
  final boolean includePadding = !getBrowserVersion().isIE();
  final ComputedCSSStyleDeclaration style = getWindow().jsxFunction_getComputedStyle(this, null);
  return style.getCalculatedHeight(false, includePadding);
}

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * {@inheritDoc}
 *
 * Overridden because some CSS properties are inherited from parent elements.
 */
@Override
protected String getStyleAttribute(final String name, final boolean camelCase) {
  String s = super.getStyleAttribute(name, camelCase);
  if (s.length() == 0 && isInheritable(name, camelCase)) {
    final HTMLElement parent = getElement().getParentHTMLElement();
    if (parent != null) {
      s = getWindow().jsxFunction_getComputedStyle(parent, null).getStyleAttribute(name, camelCase);
    }
  }
  return s;
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * {@inheritDoc}
 *
 * Overridden because some CSS properties are inherited from parent elements.
 */
@Override
protected String getStyleAttribute(final String name, final boolean camelCase) {
  String s = super.getStyleAttribute(name, camelCase);
  if (s.length() == 0 && isInheritable(name, camelCase)) {
    final HTMLElement parent = getElement().getParentHTMLElement();
    if (parent != null) {
      s = getWindow().jsxFunction_getComputedStyle(parent, null).getStyleAttribute(name, camelCase);
    }
  }
  return s;
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * {@inheritDoc}
 *
 * Overridden because some CSS properties are inherited from parent elements.
 */
@Override
protected String getStyleAttribute(final String name, final boolean camelCase) {
  String s = super.getStyleAttribute(name, camelCase);
  if (s.length() == 0 && isInheritable(name, camelCase)) {
    final HTMLElement parent = getElement().getParentHTMLElement();
    if (parent != null) {
      s = getWindow().jsxFunction_getComputedStyle(parent, null).getStyleAttribute(name, camelCase);
    }
  }
  return s;
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

final String parentWidth = getWindow().jsxFunction_getComputedStyle(parentJS, null).jsxGet_width();
width = pixelValue(parentWidth);

代码示例来源:origin: org.jenkins-ci/htmlunit

final String parentWidth = getWindow().jsxFunction_getComputedStyle(parentJS, null).jsxGet_width();
width = pixelValue(parentWidth);

代码示例来源:origin: org.jvnet.hudson/htmlunit

final String parentWidth = getWindow().jsxFunction_getComputedStyle(parentJS, null).jsxGet_width();
width = pixelValue(parentWidth);

相关文章

微信公众号