aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-10-07 21:30:34 +0200
committerSebastian Geerken <devnull@localhost>2013-10-07 21:30:34 +0200
commitc4a148796a7597db7bb3ca1b0d1a2623e1373ce8 (patch)
tree9715ccdbafc722540da2fcc5c2e6e2f38187510c /src
parentcfdf262f3ffe5f818ebf318d68d03b698ff3e363 (diff)
View(port) background now set by HTML parser.
Diffstat (limited to 'src')
-rw-r--r--src/html.cc11
-rw-r--r--src/styleengine.cc20
-rw-r--r--src/styleengine.hh5
3 files changed, 35 insertions, 1 deletions
diff --git a/src/html.cc b/src/html.cc
index 527d7c79..2ff6a2c7 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -1805,6 +1805,10 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize)
int32_t color;
int tag_index_a = a_Html_tag_index ("a");
style::Color *bgColor;
+ style::StyleImage *bgImage;
+ style::BackgroundRepeat bgRepeat;
+ style::BackgroundAttachment bgAttachment;
+ style::Length bgPositionX, bgPositionY;
_MSG("Html_tag_open_body Num_BODY=%d\n", html->Num_BODY);
if (!(html->InFlags & IN_BODY))
@@ -1848,10 +1852,15 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize)
html->dw->setStyle (html->style ());
bgColor = html->styleEngine->backgroundColor ();
-
if (bgColor)
HT2LT(html)->setBgColor(bgColor);
+ bgImage = html->styleEngine->backgroundImage (&bgRepeat, &bgAttachment,
+ &bgPositionX, &bgPositionY);
+ if (bgImage)
+ HT2LT(html)->setBgImage(bgImage, bgRepeat, bgAttachment, bgPositionX,
+ bgPositionY);
+
/* Determine a color for visited links.
* This color is computed once per page and used for immediate feedback
* when clicking a link.
diff --git a/src/styleengine.cc b/src/styleengine.cc
index efd4d629..90ef718e 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -248,6 +248,26 @@ dw::core::style::Color *StyleEngine::backgroundColor () {
return NULL;
}
+dw::core::style::StyleImage *StyleEngine::backgroundImage
+ (dw::core::style::BackgroundRepeat *bgRepeat,
+ dw::core::style::BackgroundAttachment *bgAttachment,
+ dw::core::style::Length *bgPositionX,
+ dw::core::style::Length *bgPositionY) {
+ for (int i = 1; i < stack->size (); i++) {
+ Node *n = stack->getRef (i);
+
+ if (n->style && n->style->backgroundImage) {
+ *bgRepeat = n->style->backgroundRepeat;
+ *bgAttachment = n->style->backgroundAttachment;
+ *bgPositionX = n->style->backgroundPositionX;
+ *bgPositionY = n->style->backgroundPositionY;
+ return n->style->backgroundImage;
+ }
+ }
+
+ return NULL;
+}
+
/**
* \brief set the CSS pseudo class :link.
*/
diff --git a/src/styleengine.hh b/src/styleengine.hh
index 14222f35..714553ff 100644
--- a/src/styleengine.hh
+++ b/src/styleengine.hh
@@ -97,6 +97,11 @@ class StyleEngine {
dw::core::style::Style *backgroundStyle (BrowserWindow *bw,
DilloUrl *url);
dw::core::style::Color *backgroundColor ();
+ 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);
inline dw::core::style::Style *style (BrowserWindow *bw, DilloUrl *url) {
dw::core::style::Style *s = stack->getRef (stack->size () - 1)->style;