Bug 10122 - Background composite property should apply to background color, not just images
Summary: Background composite property should apply to background color, not just images
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-26 13:37 PDT by Timothy Hatcher
Modified: 2021-12-24 13:47 PST (History)
3 users (show)

See Also:


Attachments
Test Case (105 bytes, text/html)
2006-07-26 13:41 PDT, Timothy Hatcher
no flags Details
Proposed patch (7.10 KB, patch)
2006-11-16 21:25 PST, Timothy Hatcher
no flags Details | Formatted Diff | Diff
Updated patch to fix bit rottenness (7.28 KB, patch)
2006-12-31 07:39 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2006-07-26 13:37:46 PDT
Right now -webkit-background-composite only applies to images. This should also apply to background color fills.
Comment 1 Timothy Hatcher 2006-07-26 13:41:17 PDT
Created attachment 9703 [details]
Test Case

This test case renders a red background. If the composite mode applies the rendering will be black (or transparent if you enable Safari transparent window mode.)
Comment 2 Timothy Hatcher 2006-11-16 21:25:04 PST
Created attachment 11545 [details]
Proposed patch

Makes -webkit-background-composite apply to background-color.
Adds compositeOperation() function to GraphicsContext.
Fixes functions in GraphicsContext that never drew when alpha() was 0,
this optimization only works when the compositeOperation is SourceOver.

* manual-tests/background-composite-color.html: Added.
* platform/graphics/GraphicsContext.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawRect): check the compositeOperation
(WebCore::GraphicsContext::drawEllipse): ditto
(WebCore::GraphicsContext::drawConvexPolygon): ditto
(WebCore::GraphicsContext::fillRect): ditto
* platform/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::compositeOperation): Added.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBackgroundExtended):
Comment 3 Beth Dakin 2006-11-17 11:44:44 PST
Comment on attachment 11545 [details]
Proposed patch

r=me!
Comment 4 David Kilzer (:ddkilzer) 2006-12-31 07:29:37 PST
Comment on attachment 11545 [details]
Proposed patch

Clearing bdakin's r+ since this patch has bit-rotten.
Comment 5 David Kilzer (:ddkilzer) 2006-12-31 07:39:06 PST
Created attachment 12134 [details]
Updated patch to fix bit rottenness

This patch applies cleanly now, but it causes an assertion failure while running layout tests on a locally-built debug build of WebKit r18491 with Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8N1037).  The assertion failure occurs on editing/pasteboard/subframe-dragndrop-1.html (as well as when simply clicking on a link after Safari opened with the test results!):

ASSERTION FAILED: !paintingDisabled()
(/.../WebKit/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:89 CGContext* WebCore::GraphicsContext::platformContext() const)
Segmentation fault

0   com.apple.WebCore           0x013d169c WebCore::GraphicsContext::platformContext() const + 74 (GraphicsContextCG.cpp
:89)
1   com.apple.WebCore           0x013d53b7 WebCore::GraphicsContext::compositeOperation() + 89 (GraphicsContextMac.mm:10
5)
2   com.apple.WebCore           0x0115cdba WebCore::RenderBox::paintBackgroundExtended(WebCore::GraphicsContext*, WebCor
e::Color const&, WebCore::BackgroundLayer const*, int, int, int, int, int, int, int, int, int, int) + 1680 (RenderBox.cp
p:514)
3   com.apple.WebCore           0x0115b933 WebCore::RenderBox::paintBackground(WebCore::GraphicsContext*, WebCore::Color
 const&, WebCore::BackgroundLayer const*, int, int, int, int, int, int) + 201 (RenderBox.cpp:392)
4   com.apple.WebCore           0x0115b9e8 WebCore::RenderBox::paintBackgrounds(WebCore::GraphicsContext*, WebCore::Colo
r const&, WebCore::BackgroundLayer const*, int, int, int, int, int, int) + 174 (RenderBox.cpp:386)
5   com.apple.WebCore           0x0115bd82 WebCore::RenderBox::paintRootBoxDecorations(WebCore::RenderObject::PaintInfo&
, int, int) + 920 (RenderBox.cpp:340)
6   com.apple.WebCore           0x0115be76 WebCore::RenderBox::paintBoxDecorations(WebCore::RenderObject::PaintInfo&, in
t, int) + 86 (RenderBox.cpp:350)
7   com.apple.WebCore           0x011560ab WebCore::RenderBlock::paintObject(WebCore::RenderObject::PaintInfo&, int, int
) + 163 (RenderBlock.cpp:1355)
8   com.apple.WebCore           0x0114ed55 WebCore::RenderBlock::paint(WebCore::RenderObject::PaintInfo&, int, int) + 46
7 (RenderBlock.cpp:1286)
9   com.apple.WebCore           0x0117d8ce WebCore::RenderLayer::paintLayer(WebCore::RenderLayer*, WebCore::GraphicsCont
ext*, WebCore::IntRect const&, bool, WebCore::PaintRestriction, WebCore::RenderObject*) + 864 (RenderLayer.cpp:1411)
10  com.apple.WebCore           0x0117dccc WebCore::RenderLayer::paintLayer(WebCore::RenderLayer*, WebCore::GraphicsCont
ext*, WebCore::IntRect const&, bool, WebCore::PaintRestriction, WebCore::RenderObject*) + 1886 (RenderLayer.cpp:1462)
11  com.apple.WebCore           0x0117dd94 WebCore::RenderLayer::paint(WebCore::GraphicsContext*, WebCore::IntRect const
&, WebCore::PaintRestriction, WebCore::RenderObject*) + 60 (RenderLayer.cpp:1331)
12  com.apple.WebCore           0x010dcb63 WebCore::Frame::paint(WebCore::GraphicsContext*, WebCore::IntRect const&) + 5
39 (Frame.cpp:1045)
13  com.apple.WebCore           0x010dd58d WebCore::Frame::setIsActive(bool) + 795 (Frame.cpp:1254)
14  com.apple.WebKit            0x0033eabb -[WebHTMLView(WebPrivate) _updateActiveState] + 311 (WebHTMLView.m:1805)
15  com.apple.WebKit            0x00342b9b -[WebHTMLView windowDidBecomeKey:] + 213 (WebHTMLView.m:2777)
16  com.apple.Foundation        0x925f0207 _nsnote_callback + 230
17  com.apple.CoreFoundation    0x908543f6 __CFXNotificationPost + 345
18  com.apple.CoreFoundation    0x9084bc11 _CFXNotificationPostNotification + 600
19  com.apple.Foundation        0x925e8860 -[NSNotificationCenter postNotificationName:object:userInfo:] + 121
20  com.apple.Foundation        0x925ef755 -[NSNotificationCenter postNotificationName:object:] + 55
21  com.apple.AppKit            0x9334ff09 -[NSWindow becomeKeyWindow] + 746
22  com.apple.Safari            0x000259e4 0x1000 + 149988
23  com.apple.AppKit            0x9334efa0 _NXShowKeyAndMain + 365
24  com.apple.AppKit            0x9335bdf1 -[NSWindow sendEvent:] + 3809
25  com.apple.Safari            0x000230c6 0x1000 + 139462
26  com.apple.AppKit            0x9334e350 -[NSApplication sendEvent:] + 5023
27  com.apple.Safari            0x00022c56 0x1000 + 138326
28  com.apple.AppKit            0x93278dfe -[NSApplication run] + 547
29  com.apple.AppKit            0x9326cd2f NSApplicationMain + 573
30  com.apple.Safari            0x0005f54a 0x1000 + 386378
31  com.apple.Safari            0x0005f471 0x1000 + 386161
Comment 6 Eric Seidel (no email) 2007-10-01 09:08:55 PDT
The patch did not apply cleanly to feature-branch, however I imagine this bug would be pretty easy to finish once feature-branch/trunk calm down.  (Assuming it's still desired.  -webkit-background-composite seems like a rather odd feature).
Comment 7 Tim Nguyen (:ntim) 2021-12-24 13:47:49 PST
Bug 234661 is removing -webkit-background-composite.