Search in sources :

Example 1 with StyleElement

use of com.google.gwt.dom.client.StyleElement in project rstudio by rstudio.

the class FontSizer method injectStylesIntoDocument.

public static void injectStylesIntoDocument(Document doc) {
    StyleElement style = doc.createStyleElement();
    style.setType("text/css");
    style.setInnerText(styles.getText());
    doc.getBody().appendChild(style);
}
Also used : StyleElement(com.google.gwt.dom.client.StyleElement)

Example 2 with StyleElement

use of com.google.gwt.dom.client.StyleElement in project rstudio by rstudio.

the class FontSizer method setNormalFontSize.

public static void setNormalFontSize(Document document, double size) {
    // our resource class
    if (document == null || styles == null)
        return;
    size = size + BrowseCap.getFontSkew();
    final String STYLE_EL_ID = "__rstudio_normal_size";
    Element oldStyle = document.getElementById(STYLE_EL_ID);
    StyleElement style = document.createStyleElement();
    if (style == null)
        return;
    style.setAttribute("type", "text/css");
    style.setInnerText("." + styles.normalSize() + ", " + "." + styles.normalSize() + " td, " + "." + styles.normalSize() + " pre" + " {font-size:" + size + "pt !important;}");
    BodyElement body = document.getBody();
    if (body == null)
        return;
    body.appendChild(style);
    if (oldStyle != null)
        oldStyle.removeFromParent();
    style.setId(STYLE_EL_ID);
}
Also used : StyleElement(com.google.gwt.dom.client.StyleElement) Element(com.google.gwt.dom.client.Element) BodyElement(com.google.gwt.dom.client.BodyElement) BodyElement(com.google.gwt.dom.client.BodyElement) StyleElement(com.google.gwt.dom.client.StyleElement)

Aggregations

StyleElement (com.google.gwt.dom.client.StyleElement)2 BodyElement (com.google.gwt.dom.client.BodyElement)1 Element (com.google.gwt.dom.client.Element)1