dillo
3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java). Fossies Dox: dillo-3.0.5.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 12 #include "../dlib/dlib.h" 46 this->clientKey = clientKey;
70 this->layout = layout;
71 this->pageUrl = pageUrl ?
a_Url_dup(pageUrl) : NULL;
72 this->baseUrl = baseUrl ?
a_Url_dup(baseUrl) : NULL;
76 Node *n = stack->getLastRef ();
91 style_attrs.
font = Font::create (layout, &font_attrs);
92 style_attrs.
color = Color::create (layout, 0);
95 n->
style = Style::create (&style_attrs);
99 while (doctree->top ())
100 endElement (doctree->top ()->element);
103 assert (stack->size () == 0);
114 static const Node emptyNode = {
115 NULL, NULL, NULL, NULL, NULL, NULL,
false,
false, NULL
118 stack->setSize (stack->size () + 1, emptyNode);
122 Node *n = stack->getRef (stack->size () - 1);
133 stack->setSize (stack->size () - 1);
143 Node *n = stack->getLastRef ();
148 if (stack->size () > 1)
149 n->
displayNone = stack->getRef (stack->size () - 2)->displayNone;
158 assert (dn->
id == NULL);
166 const char *p1 = NULL;
171 if (*str !=
'\0' && *str != sep) {
189 assert (dn->
klass == NULL);
194 Node *n = stack->getRef (stack->size () - 1);
213 Node *pn = stack->getRef (stack->size () - 2);
216 Node *n = stack->getRef (stack->size () - 1);
221 if (origNonCssProperties)
224 delete origNonCssProperties;
229 Node *n = stack->getRef (stack->size () - 1);
242 stack->getRef (stack->size () - 1)->inheritBackgroundColor =
true;
246 for (
int i = 1; i < stack->size (); i++) {
247 Node *n = stack->getRef (i);
261 for (
int i = 1; i < stack->size (); i++) {
262 Node *n = stack->getRef (i);
296 assert (element == doctree->top ()->element);
304 if (stack->getRef (stack->size () - 2)->inheritBackgroundColor) {
306 stack->getRef (stack->size () - 2)->style->backgroundColor;
308 stack->getRef (stack->size () - 2)->style->backgroundImage;
310 stack->getRef (stack->size () - 2)->style->backgroundRepeat;
312 stack->getRef (stack->size () - 2)->style->backgroundAttachment;
314 stack->getRef (stack->size () - 2)->style->backgroundPositionX;
316 stack->getRef (stack->size () - 2)->style->backgroundPositionY;
318 attrs->
valign = stack->getRef (stack->size () - 2)->style->valign;
363 Font *parentFont = stack->get (i - 1).
style->font;
369 for (
int j = 0; j < props->
size (); j++) {
397 fontAttrs.
name = fontName;
400 memmove(p->
value.
strVal, c + 1, strlen(c + 1) + 1);
481 if (fontAttrs.
weight < 100)
483 if (fontAttrs.
weight > 900)
494 parentFont, parentFont->
size);
513 attrs->
font = Font::create (layout, &fontAttrs);
515 for (
int j = 0; j < props->
size (); j++) {
600 stack->getRef (i)->displayNone =
true;
609 }
else if (computeValue (&lineHeight, p->
value.
intVal,
714 !stack->getRef (i)->displayNone &&
749 dpmm = layout->dpiX () / 25.4;
779 int percentageBase) {
784 return computeValue (dest, value, font);
797 }
else if (computeValue (&v, value, font)) {
832 if (!stack->getRef (stack->size () - 1)->backgroundStyle) {
835 for (
int i = stack->size () - 1; i >= 0 && ! attrs.
backgroundColor; i--)
839 stack->getRef (stack->size () - 1)->backgroundStyle =
840 Style::create (&attrs);
842 return stack->getRef (stack->size () - 1)->backgroundStyle;
851 CssPropertyList props, *styleAttrProperties, *styleAttrPropertiesImportant;
854 StyleAttrs attrs = *stack->getRef (i - 1)->style;
862 assert (stack->getRef (i)->style == NULL);
866 preprocessAttrs (&attrs);
868 styleAttrProperties = stack->
getRef (i)->styleAttrProperties;
869 styleAttrPropertiesImportant = stack->
getRef(i)->styleAttrPropertiesImportant;
870 nonCssProperties = stack->
getRef (i)->nonCssProperties;
873 cssContext->apply (&props, doctree, stack->
getRef(i)->doctreeNode,
874 styleAttrProperties, styleAttrPropertiesImportant,
878 apply (i, &attrs, &props, bw);
880 postprocessAttrs (&attrs);
882 stack->getRef (i)->style = Style::create (&attrs);
884 return stack->getRef (i)->style;
891 if (stack->getRef (stack->size() - 1)->inheritBackgroundColor) {
900 attrs.
valign = style (bw)->valign;
902 stack->getRef(stack->size() - 1)->wordStyle = Style::create(&attrs);
903 return stack->getRef (stack->size () - 1)->wordStyle;
914 for (
int i = 1; i < stack->size (); i++) {
915 Node *n = stack->getRef (i);
935 if (importDepth > 10) {
936 MSG_WARN(
"Maximum depth of CSS @import reached--ignoring stylesheet.\n");
954 "big {font-size: 1.17em}" 955 "blockquote, dd {margin-left: 40px; margin-right: 40px}" 956 "center {text-align: center}" 957 "dt {font-weight: bolder}" 958 ":link {color: blue; text-decoration: underline; cursor: pointer}" 959 ":visited {color: #800080; text-decoration: underline; cursor: pointer}" 960 "h1, h2, h3, h4, h5, h6, b, strong {font-weight: bolder}" 961 "address, article, aside, center, div, figure, figcaption, footer," 962 " h1, h2, h3, h4, h5, h6, header, nav, ol, p, pre, section, ul" 964 "i, em, cite, address, var {font-style: italic}" 965 ":link img, :visited img {border: 1px solid}" 966 "frameset, ul, ol, dir {margin-left: 40px}" 971 "p {margin: 0.5em 0}" 972 "figure {margin: 1em 40px}" 973 "h1 {font-size: 2em; margin-top: .67em; margin-bottom: 0}" 974 "h2 {font-size: 1.5em; margin-top: .75em; margin-bottom: 0}" 975 "h3 {font-size: 1.17em; margin-top: .83em; margin-bottom: 0}" 976 "h4 {margin-top: 1.12em; margin-bottom: 0}" 977 "h5 {font-size: 0.83em; margin-top: 1.5em; margin-bottom: 0}" 978 "h6 {font-size: 0.75em; margin-top: 1.67em; margin-bottom: 0}" 979 "hr {width: 100%; border: 1px inset}" 980 "li {margin-top: 0.1em; display: list-item}" 981 "pre {white-space: pre}" 982 "ol {list-style-type: decimal}" 983 "ul {list-style-type: disc}" 984 "ul ul {list-style-type: circle}" 985 "ul ul ul {list-style-type: square}" 986 "ul ul ul ul {list-style-type: disc}" 987 "ins, u {text-decoration: underline}" 988 "small, sub, sup {font-size: 0.83em}" 989 "sub {vertical-align: sub}" 990 "sup {vertical-align: super}" 991 "s, strike, del {text-decoration: line-through}" 995 "mark {background: yellow; color: black;}" 996 "table {border-spacing: 2px}" 997 "td, th {padding: 2px}" 998 "thead, tbody, tfoot {vertical-align: middle}" 999 "th {font-weight: bolder; text-align: center}" 1000 "code, tt, pre, samp, kbd {font-family: monospace}" 1006 "table, caption {font-size: medium; font-weight: normal}";
TextTransform textTransform
void dStr_free(Dstr *ds, int all)
HTML document tree interface.
CssPropertyList * styleAttrProperties
static void parse(DilloHtml *html, const DilloUrl *baseUrl, CssContext *context, const char *buf, int buflen, CssOrigin origin)
Length backgroundPositionY
void a_Url_free(DilloUrl *url)
This class holds a CSS property and value pair.
static void parseDeclarationBlock(const DilloUrl *baseUrl, const char *buf, int buflen, CssPropertyList *props, CssPropertyList *propsImortant)
T * getRef(int i) const
Return the reference of one element.
void inheritBackgroundColor()
Use of the background color of the parent style as default. This is only used in table code to allow ...
void preprocessAttrs(dw::core::style::StyleAttrs *attrs)
void increase()
Increase the vector size by one.
Represents "auto" lengths.
StyleImageDeletionReceiver(int clientKey)
DilloWeb * a_Web_new(BrowserWindow *bw, const DilloUrl *url, const DilloUrl *requester)
static lout::misc::SimpleVector< char * > * splitStr(const char *str, char sep)
split a string at sep chars and return a SimpleVector of strings
BorderCollapse borderCollapse
void computeBorderWidth(int *dest, CssProperty *p, dw::core::style::Font *font)
char * dStrconcat(const char *s1,...)
bool_t load_background_images
Miscellaneous stuff, which does not fit anywhere else.
void a_Image_ref(DilloImage *Image)
ListStylePosition listStylePosition
#define D_ASCII_TOLOWER(c)
dw::core::style::Style * backgroundStyle(BrowserWindow *bw)
Similar to StyleEngine::style(), but with backgroundColor set. A normal style might have backgroundCo...
void resetValues()
Reset those style attributes to their standard values, which are not inherited, according to CSS.
void setPseudoVisited()
set the CSS pseudo class :visited.
BackgroundRepeat backgroundRepeat
void apply(CssPropertyList *props)
Merge properties into argument property list.
bool_t parse_embedded_css
void connectDeletion(DeletionReceiver *receiver)
char * dStrndup(const char *s, size_t sz)
ImgRenderer * getMainImgRenderer()
CssPropertyList * styleAttrPropertiesImportant
void postprocessAttrs(dw::core::style::StyleAttrs *attrs)
lout::misc::SimpleVector< char * > * klass
void inheritNonCssHints()
Instruct StyleEngine to use the nonCssHints from parent element This is only used for tables where no...
int size() const
Return the number of elements put into this vector.
ListStyleType listStyleType
void deleted(lout::signal::ObservedObject *object)
struct dw::core::style::StyleAttrs::@14 borderStyle
int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData)
void set(int i, T t)
Store an object in the vector.
DoctreeNode * doctreeNode
int dStrAsciiCasecmp(const char *s1, const char *s2)
dw::core::style::Style * backgroundStyle
void setClass(const char *klass)
void endElement(int tag)
tell the styleEngine that a html element has ended.
DilloUrl * a_Url_new(const char *url_str, const char *base_url)
void restyle(BrowserWindow *bw)
Recompute all style information from scratch This is used to take into account CSS styles for the HTM...
struct dw::core::style::StyleAttrs::@13 borderColor
BackgroundAttachment backgroundAttachment
void a_Capi_stop_client(int Key, int force)
The central class for managing and drawing a widget tree.
void apply(int i, dw::core::style::StyleAttrs *attrs, CssPropertyList *props, BrowserWindow *bw)
Make changes to StyleAttrs attrs according to CssPropertyList props.
dw::core::style::StyleImage * backgroundImage(dw::core::style::BackgroundRepeat *bgRepeat, dw::core::style::BackgroundAttachment *bgAttachment, dw::core::style::Length *bgPositionX, dw::core::style::Length *bgPositionY)
void setStyle(const char *style)
bool computeLength(dw::core::style::Length *dest, CssLength value, dw::core::style::Font *font)
CssLengthType CSS_LENGTH_TYPE(CssLength l)
dw::core::style::Style * wordStyle
Length createPerLength(double v)
Returns a percentage, v is relative to 1, not to 100.
static void init()
Create the user agent style.
~StyleImageDeletionReceiver()
void a_Bw_add_client(BrowserWindow *bw, int Key, int Root)
void setId(const char *id)
DilloUrl * a_Url_dup(const DilloUrl *ori)
dw::core::style::Style * wordStyle0(BrowserWindow *bw)
Dstr * a_Misc_file2dstr(const char *filename)
void a_Bw_add_url(BrowserWindow *bw, const DilloUrl *Url)
An observed object has a signal emitter, which tells the receivers, when the object is deleted.
StyleEngine(dw::core::Layout *layout, const DilloUrl *pageUrl, const DilloUrl *baseUrl)
int Length
Type for representing all lengths within dw::core::style.
CssPropertyList * nonCssProperties
StyleImage * backgroundImage
void startElement(int tag, BrowserWindow *bw)
tell the styleEngine that a new html element has started.
A list of CssProperty objects.
char * dStrdup(const char *s)
dw::core::style::Color * backgroundColor()
dw::core::style::Style * style
void parse(DilloHtml *html, DilloUrl *url, const char *buf, int buflen, CssOrigin origin)
Anything related to Dillo Widget styles is defined here.
bool computeValue(int *dest, CssLength value, dw::core::style::Font *font)
Resolve relative lengths to absolute values.
Length backgroundPositionX
CssBackgroundPosition * posVal
dw::core::style::Style * style0(int i, BrowserWindow *bw)
Create a new style object based on the previously opened / closed HTML elements and the nonCssPropert...
int a_Html_tag_index(const char *tag)
Simple (simpler than container::untyped::Vector and container::typed::Vector) template based vector.
DilloImage * a_Image_new(void *layout, void *img_rndr, int32_t bg_color)
void setPseudoLink()
set the CSS pseudo class :link.
Length createAbsLength(int n)
Returns a length of n pixels.
float CSS_LENGTH_VALUE(CssLength l)
int32_t white_bg_replacement
char * dStrstrip(char *s)