MCPcopy Create free account
hub / github.com/dillo-browser/dillo / StyleEngine

Method StyleEngine

src/styleengine.cc:62–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60// ----------------------------------------------------------------------
61
62StyleEngine::StyleEngine (dw::core::Layout *layout,
63 const DilloUrl *pageUrl, const DilloUrl *baseUrl,
64 float zoom) {
65 StyleAttrs style_attrs;
66 FontAttrs font_attrs;
67
68 doctree = new Doctree ();
69 stack = new lout::misc::SimpleVector <Node> (1);
70 cssContext = new CssContext ();
71 buildUserStyle ();
72 this->layout = layout;
73 this->pageUrl = pageUrl ? a_Url_dup(pageUrl) : NULL;
74 this->baseUrl = baseUrl ? a_Url_dup(baseUrl) : NULL;
75 importDepth = 0;
76 dpmm = layout->dpiX () / 25.4; /* assume dpiX == dpiY */
77 this->zoom = zoom;
78
79 stackPush ();
80 Node *n = stack->getLastRef ();
81
82 /* Create a dummy font, attribute, and tag for the bottom of the stack. */
83 font_attrs.name = prefs.font_sans_serif;
84 font_attrs.size = roundInt(14 * prefs.font_factor * zoom);
85 if (font_attrs.size < prefs.font_min_size)
86 font_attrs.size = prefs.font_min_size;
87 if (font_attrs.size > prefs.font_max_size)
88 font_attrs.size = prefs.font_max_size;
89 font_attrs.weight = 400;
90 font_attrs.style = FONT_STYLE_NORMAL;
91 font_attrs.letterSpacing = 0;
92 font_attrs.fontVariant = FONT_VARIANT_NORMAL;
93
94 style_attrs.initValues ();
95 style_attrs.font = Font::create (layout, &font_attrs);
96 style_attrs.color = Color::create (layout, 0);
97 style_attrs.backgroundColor = Color::create (layout, prefs.bg_color);
98
99 n->style = Style::create (&style_attrs);
100}
101
102StyleEngine::~StyleEngine () {
103 while (doctree->top ())

Callers

nothing calls this directly

Calls 5

a_Url_dupFunction · 0.85
roundIntFunction · 0.85
initValuesMethod · 0.80
dpiXMethod · 0.45
getLastRefMethod · 0.45

Tested by

no test coverage detected