/** * Constructor for the Context object * @deprecated This stuff should go in the renderers of a specific device. */ @Deprecated public SharedContext(UserAgentCallback uac, FontResolver fr, ReplacedElementFactory ref, TextRenderer tr, float dpi) { fontResolver = fr; replacedElementFactory = ref; setMedia("screen"); this.uac = uac; setCss(new StyleReference(uac)); XRLog.render("Using CSS implementation from: " + getCss().getClass().getName()); setTextRenderer(tr); setDPI(dpi); }
private void setDocument(Document doc, String url, NamespaceHandler nsh) { _doc = doc; /* * Apply potential DOM mutations */ for (FSDOMMutator domMutator : _domMutators) domMutator.mutateDocument(doc); //TODOgetFontResolver().flushFontFaceFonts(); if (Configuration.isTrue("xr.cache.stylesheets", true)) { _sharedContext.getCss().flushStyleSheets(); } else { _sharedContext.getCss().flushAllStyleSheets(); } _sharedContext.setBaseURL(url); _sharedContext.setNamespaceHandler(nsh); _sharedContext.getCss().setDocumentContext(_sharedContext, _sharedContext.getNamespaceHandler(), doc, new NullUserInterface()); getFontResolver().importFontFaces(_sharedContext.getCss().getFontFaceRules()); if (_svgImpl != null) { _svgImpl.importFontFaceRules(_sharedContext.getCss().getFontFaceRules(), _sharedContext); } if (_mathMLImpl != null) { _mathMLImpl.importFontFaceRules(_sharedContext.getCss().getFontFaceRules(), _sharedContext); } }
/** * Description of the Method * * @param node PARAM * @return Returns * @throws Exception Throws */ private TableModel tableModel(Node node) { if (node.getNodeType() != Node.ELEMENT_NODE) { Toolkit.getDefaultToolkit().beep(); return _defaultTableModel; } Map props = _sr.getCascadedPropertiesMap((Element) node); return new PropertiesTableModel(props); }
if (iB.getElement() != null) { if (iB.getPseudoElementOrClass() == null) { cs = c.getCss().getCascadedStyle(iB.getElement(), false); } else { cs = c.getCss().getPseudoElementStyle( iB.getElement(), iB.getPseudoElementOrClass());
private static void insertGeneratedContent( LayoutContext c, Element element, CalculatedStyle parentStyle, String peName, List children, ChildBoxInfo info) { CascadedStyle peStyle = c.getCss().getPseudoElementStyle(element, peName); if (peStyle != null) { PropertyDeclaration contentDecl = peStyle.propertyByName(CSSName.CONTENT);
public CalculatedStyle getStyle(Element e, boolean restyle) { if (styleMap == null) { styleMap = new HashMap<Element, CalculatedStyle>(1024, 0.75f); } CalculatedStyle result = null; if (! restyle) { result = styleMap.get(e); } if (result == null) { Node parent = e.getParentNode(); CalculatedStyle parentCalculatedStyle; if (parent instanceof Document) { parentCalculatedStyle = new EmptyStyle(); } else { parentCalculatedStyle = getStyle((Element)parent, false); } result = parentCalculatedStyle.deriveStyle(getCss().getCascadedStyle(e, restyle)); styleMap.put(e, result); } return result; }
public static PageBox createPageBox(CssContext c, String pseudoPage) { PageBox result = new PageBox(); String pageName = null; // HACK We only create pages during layout, but the OutputDevice // queries page positions and since pages are created lazily, changing // this method to use LayoutContext is tricky if (c instanceof LayoutContext) { pageName = ((LayoutContext)c).getPageName(); } PageInfo pageInfo = c.getCss().getPageStyle(pageName, pseudoPage); result.setPageInfo(pageInfo); CalculatedStyle cs = new EmptyStyle().deriveStyle(pageInfo.getPageStyle()); result.setStyle(cs); result.setOuterPageWidth(result.getWidth(c)); return result; }
block.setFirstLineStyle(c.getCss().getPseudoElementStyle(element, "first-line")); block.setFirstLetterStyle(c.getCss().getPseudoElementStyle(element, "first-letter"));
table.setFloatedBoxData(null); CascadedStyle original = c.getSharedContext().getCss().getCascadedStyle( table.getElement(), false); CascadedStyle modified = CascadedStyle.createLayoutStyle(
private void setDocumentP(Document doc, String url, NamespaceHandler nsh) { _doc = doc; /* * Apply potential DOM mutations */ for (FSDOMMutator domMutator : _domMutators) domMutator.mutateDocument(doc); getFontResolver().flushFontFaceFonts(); if (Configuration.isTrue("xr.cache.stylesheets", true)) { _sharedContext.getCss().flushStyleSheets(); } else { _sharedContext.getCss().flushAllStyleSheets(); } _sharedContext.setBaseURL(url); _sharedContext.setNamespaceHandler(nsh); _sharedContext.getCss().setDocumentContext(_sharedContext, _sharedContext.getNamespaceHandler(), doc, new NullUserInterface()); getFontResolver().importFontFaces(_sharedContext.getCss().getFontFaceRules()); if (_svgImpl != null) { _svgImpl.importFontFaceRules(_sharedContext.getCss().getFontFaceRules(), _sharedContext); } if (_mathmlImpl != null) { _mathmlImpl.importFontFaceRules(_sharedContext.getCss().getFontFaceRules(), _sharedContext); } }
_sharedContext.setCss(new StyleReference(uac));
if (e != null) { style = c.getSharedContext().getStyle(e, true); style = style.deriveStyle(c.getCss().getPseudoElementStyle(e, pe)); } else { BlockBox container = (BlockBox)getParent().getParent(); e = container.getElement(); style = c.getSharedContext().getStyle(e, true); style = style.deriveStyle(c.getCss().getPseudoElementStyle(e, pe)); style = style.createAnonymousStyle(IdentValue.INLINE);
private void setDocumentP(Document doc, String url, NamespaceHandler nsh) { _doc = doc; /* * Apply potential DOM mutations */ for (FSDOMMutator domMutator : _domMutators) domMutator.mutateDocument(doc); getFontResolver().flushFontFaceFonts(); if (Configuration.isTrue("xr.cache.stylesheets", true)) { _sharedContext.getCss().flushStyleSheets(); } else { _sharedContext.getCss().flushAllStyleSheets(); } _sharedContext.setBaseURL(url); _sharedContext.setNamespaceHandler(nsh); _sharedContext.getCss().setDocumentContext(_sharedContext, _sharedContext.getNamespaceHandler(), doc, new NullUserInterface()); getFontResolver().importFontFaces(_sharedContext.getCss().getFontFaceRules()); if (_svgImpl != null) { _svgImpl.importFontFaceRules(_sharedContext.getCss().getFontFaceRules(), _sharedContext); } if (_mathmlImpl != null) { _mathmlImpl.importFontFaceRules(_sharedContext.getCss().getFontFaceRules(), _sharedContext); } }
_sharedContext.setCss(new StyleReference(userAgent)); userAgent.setSharedContext(_sharedContext); _outputDevice.setSharedContext(_sharedContext);
_sharedContext.setCss(new StyleReference(userAgent)); userAgent.setSharedContext(_sharedContext); _outputDevice.setSharedContext(_sharedContext);