From 04dcc1881f6fd5ffcd09e95297f2e2e0d9aa084e Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Mon, 27 Oct 2014 14:01:14 +0100 Subject: Some smaller changes in dw (backport from RTFL). --- dw/style.cc | 26 +++++++++++++++++--------- dw/style.hh | 2 +- dw/widget.cc | 25 +++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/dw/style.cc b/dw/style.cc index 53d2cbb7..54d9af4b 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -1204,18 +1204,26 @@ void drawBorder (View *view, Layout *layout, Rectangle *area, * * Otherwise, the caller should not try to increase the performance by * doing some tests before; this is all done in this method. + * + * "bgColor" is passes implicitly. For non-inversed drawing, + * style->backgroundColor may simply used. However, when drawing is + * inversed, and style->backgroundColor is undefined (NULL), a + * background color defined higher in the hierarchy (which is not + * accessable here) must be used. + * + * (Background *images* are never drawn inverse.) */ void drawBackground (View *view, Layout *layout, Rectangle *area, int x, int y, int width, int height, int xRef, int yRef, int widthRef, int heightRef, - Style *style, bool inverse, bool atTop) + Style *style, Color *bgColor, bool inverse, bool atTop) { - bool bgColor = style->backgroundColor != NULL && + bool hasBgColor = bgColor != NULL && // The test for background colors is rather simple, since only the color // has to be compared, ... - (!atTop || layout->getBgColor () != style->backgroundColor); - bool bgImage = (style->backgroundImage != NULL && - style->backgroundImage->getImgbufSrc() != NULL) && + (!atTop || layout->getBgColor () != bgColor); + bool hasBgImage = (style->backgroundImage != NULL && + style->backgroundImage->getImgbufSrc() != NULL) && // ... but for backgrounds, it would be rather complicated. To handle the // two cases (normal HTML in a viewport, where the layout background // image is set, and contents of