Example usage for com.google.gwt.dom.client Style clearPadding

List of usage examples for com.google.gwt.dom.client Style clearPadding

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Style clearPadding.

Prototype

public void clearPadding() 

Source Link

Usage

From source file:com.sciencegadgets.client.ui.FitParentHTML.java

License:Open Source License

private double getFontPercent() {

    if (this.getParent() == null) {
        return 100;
    }/*  w  w  w  .  j a v a2  s .com*/

    Element htmlElement = this.getElement();
    Style htmlStyle = htmlElement.getStyle();

    htmlStyle.clearPadding();
    htmlStyle.clearFontSize();

    Element parentElement = this.getParent().getElement();

    double widthRatio = (double) parentElement.getOffsetWidth() / (double) htmlElement.getOffsetWidth();
    double heightRatio = (double) parentElement.getOffsetHeight() / (double) htmlElement.getOffsetHeight();

    double smallerRatio = (widthRatio > heightRatio) ? heightRatio : widthRatio;

    // *percentOfParent for looser fit, *100 for percent
    return smallerRatio * percentOfParent;

}