use of com.google.gwt.dom.client.BodyElement in project gwt-test-utils by gwt-test-utils.
the class BodyElementTest method as.
@Test
public void as() {
// When
BodyElement asElement = BodyElement.as(b);
// Then
assertThat(asElement).isEqualTo(b);
}
use of com.google.gwt.dom.client.BodyElement in project gwt-test-utils by gwt-test-utils.
the class RootPanelPatcher method isElementChildOfWidget.
@PatchMethod
static boolean isElementChildOfWidget(Element element) {
// Walk up the DOM hierarchy, looking for any widget with an event
// listener
// set. Though it is not dependable in the general case that a widget will
// have set its element's event listener at all times, it *is* dependable
// if the widget is attached. Which it will be in this case.
element = element.getParentElement();
BodyElement body = Document.get().getBody();
while (element != null && body != element) {
if (Event.getEventListener(element) != null) {
return true;
}
element = element.getParentElement();
}
return false;
}
use of com.google.gwt.dom.client.BodyElement 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);
}
Aggregations