/** * The width of the document's client area. * * @return the document's client width */ public final int getClientWidth() { return getViewportElement().getClientWidth(); }
/** * Get the maximum horizontal scroll position. * * @param scrollable the scrollable element * @return the maximum scroll position */ public int getMaximumHorizontalScrollPosition(Element scrollable) { return isRtl(scrollable) ? 0 : scrollable.getScrollWidth() - scrollable.getClientWidth(); }
/** * Get the minimum horizontal scroll position. * * @param scrollable the scrollable element * @return the minimum scroll position */ public int getMinimumHorizontalScrollPosition(Element scrollable) { return isRtl(scrollable) ? scrollable.getClientWidth() - scrollable.getScrollWidth() : 0; }
@Override public void setScrollLeft(Element elem, int left) { if (!isGecko19() && isRTL(elem)) { left += elem.getScrollWidth() - elem.getClientWidth(); } super.setScrollLeft(elem, left); }
@Override public void setScrollLeft(Element elem, int left) { if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) { left += elem.getScrollWidth() - elem.getClientWidth(); } super.setScrollLeft(elem, left); }
@Override public int getScrollLeft(Element elem) { if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) { return super.getScrollLeft(elem) - (elem.getScrollWidth() - elem.getClientWidth()); } return super.getScrollLeft(elem); }
@Override public int getScrollLeft(Element elem) { if (!isGecko19() && isRTL(elem)) { return super.getScrollLeft(elem) - (elem.getScrollWidth() - elem.getClientWidth()); } return super.getScrollLeft(elem); }
void scrollToEnd() { Element elem = getElement(); targetScrollLeft = elem.getScrollWidth() - elem.getClientWidth(); if (LocaleInfo.getCurrentLocale().isRTL()) { targetScrollLeft *= -1; } if (isAnimationEnabled()) { // Animate the scrolling. startScrollLeft = elem.getScrollLeft(); run(250, elem); } else { // Scroll instantly. onComplete(); } } }
public double getUnitSizeInPixels( Element parent, Unit unit, boolean vertical) { if (unit == null) { return 1; } switch (unit) { case PCT: return (vertical ? parent.getClientHeight() : parent.getClientWidth()) / 100.0; case EM: return relativeRuler.getOffsetWidth() / 10.0; case EX: return relativeRuler.getOffsetHeight() / 10.0; case CM: return fixedRuler.getOffsetWidth() * 0.1; // 1.0 cm / cm case MM: return fixedRuler.getOffsetWidth() * 0.01; // 0.1 cm / mm case IN: return fixedRuler.getOffsetWidth() * 0.254; // 2.54 cm / in case PT: return fixedRuler.getOffsetWidth() * 0.00353; // 0.0353 cm / pt case PC: return fixedRuler.getOffsetWidth() * 0.0423; // 0.423 cm / pc default: case PX: return 1; } }
int parentWidth = parentElem.getClientWidth(); int parentHeight = parentElem.getClientHeight(); for (Layer l : layers) {
/** * The width of the document's client area. * * @return the document's client width */ public final int getClientWidth() { return getViewportElement().getClientWidth(); }
/** * Get the minimum horizontal scroll position. * * @param scrollable the scrollable element * @return the minimum scroll position */ public int getMinimumHorizontalScrollPosition(Element scrollable) { return isRtl(scrollable) ? scrollable.getClientWidth() - scrollable.getScrollWidth() : 0; }
/** * Get the maximum horizontal scroll position. * * @param scrollable the scrollable element * @return the maximum scroll position */ public int getMaximumHorizontalScrollPosition(Element scrollable) { return isRtl(scrollable) ? 0 : scrollable.getScrollWidth() - scrollable.getClientWidth(); }
/** * Get the minimum horizontal scroll position. * * @param scrollable the scrollable element * @return the minimum scroll position */ public int getMinimumHorizontalScrollPosition(Element scrollable) { return isRtl(scrollable) ? scrollable.getClientWidth() - scrollable.getScrollWidth() : 0; }
/** * Recalculate the height and width of a native scrollbar. */ private static void maybeRecalculateNativeScrollbarSize() { // Check if the size has already been calculated. if (nativeHeight > -1) { return; } // Create a scrollable element and attach it to the body. Element scrollable = Document.get().createDivElement(); scrollable.getStyle().setPosition(Position.ABSOLUTE); scrollable.getStyle().setTop(-1000.0, Unit.PX); scrollable.getStyle().setLeft(-1000.0, Unit.PX); scrollable.getStyle().setHeight(100.0, Unit.PX); scrollable.getStyle().setWidth(100.0, Unit.PX); scrollable.getStyle().setOverflow(Overflow.SCROLL); scrollable.getStyle().setProperty("direction", "rtl"); Document.get().getBody().appendChild(scrollable); // Add some content. Element content = Document.get().createDivElement(); content.setInnerText("content"); scrollable.appendChild(content); // Measure the height and width. nativeHeight = scrollable.getOffsetHeight() - scrollable.getClientHeight(); nativeWidth = scrollable.getOffsetWidth() - scrollable.getClientWidth(); nativeRtl = (content.getAbsoluteLeft() > scrollable.getAbsoluteLeft()); // Detach the scrollable element. scrollable.removeFromParent(); }
@Override public void setScrollLeft(Element elem, int left) { if (!isGecko19() && isRTL(elem)) { left += elem.getScrollWidth() - elem.getClientWidth(); } super.setScrollLeft(elem, left); }
public int getWidth(Element e) { fixInlineElement(e); return (int) (e.getClientWidth() - num(curCSS(e, "paddingLeft", true)) - num(curCSS(e, "paddingRight", true))); }
@Override public int getScrollLeft(Element elem) { if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) { return super.getScrollLeft(elem) - (elem.getScrollWidth() - elem.getClientWidth()); } return super.getScrollLeft(elem); }
@Override public IDimension screenSize () { // TODO: inverse scale? screenSize.width = Document.get().getDocumentElement().getClientWidth(); screenSize.height = Document.get().getDocumentElement().getClientHeight(); return screenSize; }
@Override public int getScrollLeft(Element elem) { if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) { return super.getScrollLeft(elem) - (elem.getScrollWidth() - elem.getClientWidth()); } return super.getScrollLeft(elem); }