Examples of CSSStyleDeclaration


Examples of com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration

            // display: iterate top to bottom, because if a parent is display:none,
            // there's nothing that a child can do to override it
            for (final Node node : getAncestors(true)) {
                final ScriptableObject scriptableObject = ((DomNode) node).getScriptObject();
                if (scriptableObject instanceof HTMLElement) {
                    final CSSStyleDeclaration style = ((HTMLElement) scriptableObject).jsxGet_currentStyle();
                    final String display = style.jsxGet_display();
                    if ("none".equals(display)) {
                        return false;
                    }
                }
            }
            // visibility: iterate bottom to top, because children can override
            // the visibility used by parent nodes
            final boolean isNotIE = !((HtmlPage) page).getWebClient().getBrowserVersion().isIE();
            DomNode node = this;
            do {
                final ScriptableObject scriptableObject = node.getScriptObject();
                if (scriptableObject instanceof HTMLElement) {
                    final CSSStyleDeclaration style = ((HTMLElement) scriptableObject).jsxGet_currentStyle();
                    final String visibility = style.jsxGet_visibility();
                    if (visibility.length() > 0) {
                        if (visibility.equals("visible")) {
                            return true;
                        }
                        else if (visibility.equals("hidden") || (isNotIE && visibility.equals("collapse"))) {
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

    attachEvents();
  }
 
  private void setupClone() {
    clone.setClassName(element.getClassName());
    CSSStyleDeclaration style = clone.getStyle();
    style.setVisibility(CSSStyleDeclaration.Visibility.HIDDEN);
    style.setPosition(CSSStyleDeclaration.Position.ABSOLUTE);
    style.setOverflow(CSSStyleDeclaration.Overflow.AUTO);
    style.setLeft("-5000px");
    style.setTop("-5000px");
   
    clone.setRows(1);
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

  private void updateWidthAndHeight(Element dropdownElement) {
    /*
     * The 'outline' is drawn to the left of and above where the absolute top
     * and left are, so account for them in the top and right.
     */
    CSSStyleDeclaration style = dropdownElement.getStyle();

    /*
     * This width will either be 0 if we're being positioned by the mouse or the width of our
     * anchor.
     */
    int widthOfAnchorOrZero = positioner.getMinimumWidth();

    // set the minimum width
    int dropdownViewMinWidth =
        widthOfAnchorOrZero - (2 * res.defaultSimpleListCss().menuListBorderPx());
    style.setProperty("min-width", dropdownViewMinWidth + "px");

    // sets the maximum width
    boolean useWidthOfAnchor = maxWidth == Builder.WIDTH_OF_ANCHOR && widthOfAnchorOrZero != 0;
    if (maxWidth != 0 && useWidthOfAnchor) {
      int curMaxWidth = useWidthOfAnchor ? widthOfAnchorOrZero : maxWidth;
      style.setProperty("max-width", curMaxWidth + "px");
    }

    if (maxHeight != 0) {
      style.setProperty("max-height", maxHeight + "px");
    }
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

  /**
   * Sets an elements left and top to the provided values.
   */
  private void setElementLeftAndTop(double left, double top) {
    CSSStyleDeclaration style = element.getStyle();
    if (left != IGNORE) {
      style.setLeft(left, Unit.PX);
    }
    if (top != IGNORE) {
      style.setTop(top, Unit.PX);
    }
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

  /**
   * Resets an element's position by removing top/right/bottom/left and setting position to
   * absolute.
   */
  private void resetElementPosition() {
    CSSStyleDeclaration style = element.getStyle();
    style.setPosition("absolute");
    style.clearTop();
    style.clearRight();
    style.clearBottom();
    style.clearLeft();

    elementPositioner.appendElementToContainer(element);
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

    if (rectSum != 0) {
      return rect;
    }

    // We make an attempt to get an accurate measurement of the element
    CSSStyleDeclaration style = element.getStyle();
    String visibility = CssUtils.setAndSaveProperty(element, "visibility", "hidden");
    String display = style.getDisplay();

    // if display set to none we remove it and let its normal style show through
    if (style.getDisplay().equals("none")) {
      style.removeProperty("display");
    } else {
      // it's likely display: none in a css class so we just have to guess.
      // We guess display:block since that's common on containers.
      style.setDisplay("block");
    }
    rect = element.getBoundingClientRect();
    style.setDisplay(display);
    style.setVisibility(visibility);

    return rect;
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

  /**
   * Refreshes the background image of the image button.
   */
  private void refresh() {
    CSSStyleDeclaration declaration = CssUtils.getComputedStyle(buttonElement);
    if (StringUtils.isNullOrEmpty(declaration.getPropertyValue("background"))) {
      // bail if we're not attached to the dom
      return;
    }

    buttonElement.getStyle().removeProperty("background");
    String currentBackgroundImage = declaration.getPropertyValue("background");
    buttonElement.getStyle().setProperty("background", ourTopLayer + "," + currentBackgroundImage);
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

    positionController.updateElementPosition(x, y);
  }

  private void updateArrow(int x, int y) {
    Element arrow = getView().getArrow();
    CSSStyleDeclaration style = arrow.getStyle();

    HorizontalAlign alignment = positionController.getPositioner().getHorizontalAlignment();
    style.setLeft("auto");
    style.setRight("auto");
    if (alignment == HorizontalAlign.LEFT) {
      style.setLeft(-(x * 2), CSSStyleDeclaration.Unit.PX);
    } else {
      style.setRight((x * 2), CSSStyleDeclaration.Unit.PX);
    }
    style.setTop(-(y * 2), CSSStyleDeclaration.Unit.PX);
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

  }
 
  private static Element createPopupDummyElement(int lineHeight) {
    Element element = Elements.createDivElement();

    CSSStyleDeclaration style = element.getStyle();
    style.setDisplay(CSSStyleDeclaration.Display.INLINE_BLOCK);
    style.setPosition(CSSStyleDeclaration.Position.ABSOLUTE);
    style.setWidth(0, CSSStyleDeclaration.Unit.PX);
    style.setHeight(lineHeight, CSSStyleDeclaration.Unit.PX);
    style.setZIndex(1);

    // We do this so that custom CSS class (provided by textCssClassName in the #showPopup)
    // with cursor:pointer should work correctly.
    style.setProperty("pointer-events", "none");

    return element;
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

      /**
       * Show by fading+sliding in from the left.
       */
      void show(int startDelay, int duration) {
        CSSStyleDeclaration style = breadcrumb.getStyle();
        // TODO: extract constants
        style.setProperty("-webkit-transition-duration", duration + "ms");
        style.setProperty("-webkit-transition-delay", startDelay + "ms");
        breadcrumb.removeClassName(css.start());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.