Commit 07be7ece authored by bdakin's avatar bdakin

Reviewed by Hyatt.

        Fix for <rdar://problem/4450615> Add composite mode to background 
        styles

        -webkit-background-composite will set a composite mode on a 
        background image.

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::):
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * css/CSSPropertyNames.in: Add -webkit-background-composite
        * css/CSSValueKeywords.in: Add all possible values (clear, copy, 
        source-over, source-in, source-out, source-atop, destination-over, 
        destination-in, destination-out, destination-atop, xor, plus-
        darker, highlight, and plus-lighter)
        * css/cssparser.cpp:
        (WebCore::CSSParser::parseValue):
        (WebCore::CSSParser::parseBackgroundProperty):
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        (WebCore::CSSStyleSelector::mapBackgroundComposite):
        * css/cssstyleselector.h:
        * platform/GraphicsContext.cpp:
        (WebCore::GraphicsContext::drawTiledImage):
        * platform/GraphicsContext.h: drawTiledImage() now takes a 
        composite operator.
        * platform/Image.h: drawTiled() now takes a composite operator.
        * platform/cairo/ImageCairo.cpp:
        (WebCore::Image::drawTiled): Set the composite operator.
        * platform/mac/ImageMac.mm:
        (WebCore::Image::drawTiled): Set the composite operator.
        * platform/win/TemporaryLinkStubs.cpp:
        (Image::drawTiled):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::paintBackgroundExtended): Send the composite 
        operator in the render style over to the graphics context.
        * rendering/render_style.cpp:
        (WebCore::BackgroundLayer::BackgroundLayer):
        (WebCore::BackgroundLayer::operator=):
        (WebCore::BackgroundLayer::operator==):
        (WebCore::BackgroundLayer::fillUnsetProperties):
        (WebCore::BackgroundLayer::cullEmptyLayers):
        * rendering/render_style.h:
        (WebCore::BackgroundLayer::backgroundComposite):
        (WebCore::BackgroundLayer::isBackgroundCompositeSet):
        (WebCore::BackgroundLayer::setBackgroundComposite):
        (WebCore::BackgroundLayer::clearBackgroundComposite):
        (WebCore::RenderStyle::backgroundComposite):
        (WebCore::RenderStyle::initialBackgroundComposite):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 248b1cfb
2006-06-29 Beth Dakin <bdakin@apple.com>
Reviewed by Hyatt.
Test for <rdar://problem/4450615> Add composite mode to background
styles
* fast/backgrounds/bgCompositeCopy-expected.checksum: Added.
* fast/backgrounds/bgCompositeCopy-expected.png: Added.
* fast/backgrounds/bgCompositeCopy-expected.txt: Added.
* fast/backgrounds/bgCompositeCopy.html: Added.
* fast/backgrounds/resources/rgba16.png: Added.
2006-06-28 Levi Weintraub <lweintraub@apple.com>
Reviewed by justin
d1f92350f58a4f0d8730f32dd0772632
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {DIV} at (0,0) size 85x62
<head>
<style>
div {
background-image:url(resources/rgba16.png);
-webkit-background-composite:copy;
}
</style>
</head>
<body>
<div style="width:85px; height:62px"></div>
</body>
2006-06-29 Beth Dakin <bdakin@apple.com>
Reviewed by Hyatt.
Fix for <rdar://problem/4450615> Add composite mode to background
styles
-webkit-background-composite will set a composite mode on a
background image.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSPropertyNames.in: Add -webkit-background-composite
* css/CSSValueKeywords.in: Add all possible values (clear, copy,
source-over, source-in, source-out, source-atop, destination-over,
destination-in, destination-out, destination-atop, xor, plus-
darker, highlight, and plus-lighter)
* css/cssparser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseBackgroundProperty):
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
(WebCore::CSSStyleSelector::mapBackgroundComposite):
* css/cssstyleselector.h:
* platform/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawTiledImage):
* platform/GraphicsContext.h: drawTiledImage() now takes a
composite operator.
* platform/Image.h: drawTiled() now takes a composite operator.
* platform/cairo/ImageCairo.cpp:
(WebCore::Image::drawTiled): Set the composite operator.
* platform/mac/ImageMac.mm:
(WebCore::Image::drawTiled): Set the composite operator.
* platform/win/TemporaryLinkStubs.cpp:
(Image::drawTiled):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBackgroundExtended): Send the composite
operator in the render style over to the graphics context.
* rendering/render_style.cpp:
(WebCore::BackgroundLayer::BackgroundLayer):
(WebCore::BackgroundLayer::operator=):
(WebCore::BackgroundLayer::operator==):
(WebCore::BackgroundLayer::fillUnsetProperties):
(WebCore::BackgroundLayer::cullEmptyLayers):
* rendering/render_style.h:
(WebCore::BackgroundLayer::backgroundComposite):
(WebCore::BackgroundLayer::isBackgroundCompositeSet):
(WebCore::BackgroundLayer::setBackgroundComposite):
(WebCore::BackgroundLayer::clearBackgroundComposite):
(WebCore::RenderStyle::backgroundComposite):
(WebCore::RenderStyle::initialBackgroundComposite):
2006-06-29 David Kilzer <ddkilzer@kilzer.net>
Reviewed by Darin.
......
......@@ -46,6 +46,7 @@ static const int computedProperties[] = {
CSS_PROP_BACKGROUND_IMAGE,
CSS_PROP__WEBKIT_BACKGROUND_SIZE,
CSS_PROP_BACKGROUND_REPEAT,
CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE,
CSS_PROP_BACKGROUND_ATTACHMENT,
CSS_PROP__WEBKIT_BACKGROUND_CLIP,
CSS_PROP__WEBKIT_BACKGROUND_ORIGIN,
......@@ -373,6 +374,39 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE:
switch (style->backgroundComposite()) {
case CompositeClear:
return new CSSPrimitiveValue(CSS_VAL_CLEAR);
case CompositeCopy:
return new CSSPrimitiveValue(CSS_VAL_COPY);
case CompositeSourceOver:
return new CSSPrimitiveValue(CSS_VAL_SOURCE_OVER);
case CompositeSourceIn:
return new CSSPrimitiveValue(CSS_VAL_SOURCE_IN);
case CompositeSourceOut:
return new CSSPrimitiveValue(CSS_VAL_SOURCE_OUT);
case CompositeSourceAtop:
return new CSSPrimitiveValue(CSS_VAL_SOURCE_ATOP);
case CompositeDestinationOver:
return new CSSPrimitiveValue(CSS_VAL_DESTINATION_OVER);
case CompositeDestinationIn:
return new CSSPrimitiveValue(CSS_VAL_DESTINATION_IN);
case CompositeDestinationOut:
return new CSSPrimitiveValue(CSS_VAL_DESTINATION_OUT);
case CompositeDestinationAtop:
return new CSSPrimitiveValue(CSS_VAL_DESTINATION_ATOP);
case CompositeXOR:
return new CSSPrimitiveValue(CSS_VAL_XOR);
case CompositePlusDarker:
return new CSSPrimitiveValue(CSS_VAL_PLUS_DARKER);
case CompositeHighlight:
return new CSSPrimitiveValue(CSS_VAL_HIGHLIGHT);
case CompositePlusLighter:
return new CSSPrimitiveValue(CSS_VAL_PLUS_LIGHTER);
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP_BACKGROUND_ATTACHMENT:
if (style->backgroundAttachment())
return new CSSPrimitiveValue(CSS_VAL_SCROLL);
......
......@@ -11,6 +11,7 @@
background-attachment
-webkit-background-clip
background-color
-webkit-background-composite
background-image
-webkit-background-origin
background-position
......
......@@ -163,6 +163,23 @@ repeat-x
repeat-y
no-repeat
#
# CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE:
#
clear
copy
source-over
source-in
source-out
source-atop
destination-over
destination-in
destination-out
destination-atop
xor
plus-darker
# highlight
plus-lighter
#
# CSS_PROP_VERTICAL_ALIGN:
#
baseline
......
......@@ -713,6 +713,7 @@ bool CSSParser::parseValue(int propId, bool important)
case CSS_PROP_BACKGROUND_ATTACHMENT:
case CSS_PROP__WEBKIT_BACKGROUND_CLIP:
case CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE:
case CSS_PROP_BACKGROUND_IMAGE:
case CSS_PROP__WEBKIT_BACKGROUND_ORIGIN:
case CSS_PROP_BACKGROUND_POSITION:
......@@ -1758,6 +1759,12 @@ bool CSSParser::parseBackgroundProperty(int propId, int& propId1, int& propId2,
valueList->next();
break;
}
case CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE:
if ((val->id >= CSS_VAL_CLEAR && val->id <= CSS_VAL_PLUS_LIGHTER) || val->id == CSS_VAL_HIGHLIGHT) {
currValue = new CSSPrimitiveValue(val->id);
valueList->next();
}
break;
case CSS_PROP_BACKGROUND_REPEAT:
if (val->id >= CSS_VAL_REPEAT && val->id <= CSS_VAL_NO_REPEAT) {
currValue = new CSSPrimitiveValue(val->id);
......
......@@ -1795,6 +1795,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSS_PROP__WEBKIT_BACKGROUND_CLIP:
HANDLE_BACKGROUND_VALUE(backgroundClip, BackgroundClip, value)
break;
case CSS_PROP__WEBKIT_BACKGROUND_COMPOSITE:
HANDLE_BACKGROUND_VALUE(backgroundComposite, BackgroundComposite, value)
break;
case CSS_PROP__WEBKIT_BACKGROUND_ORIGIN:
HANDLE_BACKGROUND_VALUE(backgroundOrigin, BackgroundOrigin, value)
break;
......@@ -4081,6 +4084,64 @@ void CSSStyleSelector::mapBackgroundClip(BackgroundLayer* layer, CSSValue* value
}
}
void CSSStyleSelector::mapBackgroundComposite(BackgroundLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setBackgroundComposite(RenderStyle::initialBackgroundComposite());
return;
}
if (!value->isPrimitiveValue())
return;
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
switch(primitiveValue->getIdent()) {
case CSS_VAL_CLEAR:
layer->setBackgroundComposite(CompositeClear);
break;
case CSS_VAL_COPY:
layer->setBackgroundComposite(CompositeCopy);
break;
case CSS_VAL_SOURCE_OVER:
layer->setBackgroundComposite(CompositeSourceOver);
break;
case CSS_VAL_SOURCE_IN:
layer->setBackgroundComposite(CompositeSourceIn);
break;
case CSS_VAL_SOURCE_OUT:
layer->setBackgroundComposite(CompositeSourceOut);
break;
case CSS_VAL_SOURCE_ATOP:
layer->setBackgroundComposite(CompositeSourceAtop);
break;
case CSS_VAL_DESTINATION_OVER:
layer->setBackgroundComposite(CompositeDestinationOver);
break;
case CSS_VAL_DESTINATION_IN:
layer->setBackgroundComposite(CompositeDestinationIn);
break;
case CSS_VAL_DESTINATION_OUT:
layer->setBackgroundComposite(CompositeDestinationOut);
break;
case CSS_VAL_DESTINATION_ATOP:
layer->setBackgroundComposite(CompositeDestinationAtop);
break;
case CSS_VAL_XOR:
layer->setBackgroundComposite(CompositeXOR);
break;
case CSS_VAL_PLUS_DARKER:
layer->setBackgroundComposite(CompositePlusDarker);
break;
case CSS_VAL_HIGHLIGHT:
layer->setBackgroundComposite(CompositeHighlight);
break;
case CSS_VAL_PLUS_LIGHTER:
layer->setBackgroundComposite(CompositePlusLighter);
break;
default:
return;
}
}
void CSSStyleSelector::mapBackgroundOrigin(BackgroundLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
......
......@@ -191,6 +191,7 @@ class StyledElement;
void mapBackgroundAttachment(BackgroundLayer* layer, CSSValue* value);
void mapBackgroundClip(BackgroundLayer* layer, CSSValue* value);
void mapBackgroundComposite(BackgroundLayer* layer, CSSValue* value);
void mapBackgroundOrigin(BackgroundLayer* layer, CSSValue* value);
void mapBackgroundImage(BackgroundLayer* layer, CSSValue* value);
void mapBackgroundRepeat(BackgroundLayer* layer, CSSValue* value);
......
......@@ -256,15 +256,15 @@ void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const Float
image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), op);
}
void GraphicsContext::drawTiledImage(Image* image, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize)
void GraphicsContext::drawTiledImage(Image* image, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op)
{
if (paintingDisabled())
return;
image->drawTiled(this, rect, srcPoint, tileSize);
image->drawTiled(this, rect, srcPoint, tileSize, op);
}
void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule)
void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op)
{
if (paintingDisabled())
return;
......@@ -273,7 +273,7 @@ void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const In
// Just do a scale.
return drawImage(image, dest, srcRect);
image->drawTiled(this, dest, srcRect, hRule, vRule);
image->drawTiled(this, dest, srcRect, hRule, vRule, op);
}
}
......@@ -101,9 +101,11 @@ namespace WebCore {
void drawImage(Image*, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver);
void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1),
CompositeOperator = CompositeSourceOver);
void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize);
void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
CompositeOperator = CompositeSourceOver);
void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect,
Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile);
Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile,
CompositeOperator = CompositeSourceOver);
void addClip(const IntRect&);
void addRoundedRectClip(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
......
......@@ -146,8 +146,10 @@ private:
private:
void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize);
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule);
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize,
CompositeOperator);
void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule,
CompositeOperator);
// Decodes and caches a frame. Never accessed except internally.
void cacheFrame(size_t index);
......
......@@ -133,7 +133,8 @@ void Image::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& s
}
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize)
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatPoint& srcPoint,
const FloatSize& tileSize, CompositeOperator op)
{
if (!m_source.initialized())
return;
......@@ -178,8 +179,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
// If the single image draw covers the whole area, then just draw once.
if (dstTileRect.contains(dstRect)) {
draw(ctxt, dstRect,
FloatRect(srcX * scaleX, srcY * scaleY, dstRect.width() * scaleX, dstRect.height() * scaleY),
CompositeSourceOver);
FloatRect(srcX * scaleX, srcY * scaleY, dstRect.width() * scaleX, dstRect.height() * scaleY), op);
return;
}
......@@ -189,8 +189,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
cairo_save(context);
// Set the compositing operation.
// FIXME: This should be part of the drawTiled API.
setCompositingOperation(context, CompositeSourceOver, frameHasAlphaAtIndex(m_currentFrame));
setCompositingOperation(context, op, frameHasAlphaAtIndex(m_currentFrame));
cairo_translate(context, dstTileRect.x(), dstTileRect.y());
cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);
......
......@@ -290,14 +290,15 @@ static void drawPattern(void* info, CGContextRef context)
static const CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& tileSize)
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint,
const FloatSize& tileSize, CompositeOperator op)
{
CGImageRef image = frameAtIndex(m_currentFrame);
if (!image)
return;
if (m_currentFrame == 0 && m_isSolidColor) {
fillSolidColorInRect(ctxt, m_solidColor, destRect, CompositeSourceOver);
fillSolidColorInRect(ctxt, m_solidColor, destRect, op);
return;
}
......@@ -335,7 +336,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
fromRect.size.width = destRect.width() / scaleX;
fromRect.size.height = destRect.height() / scaleY;
draw(ctxt, destRect, fromRect, CompositeSourceOver);
draw(ctxt, destRect, fromRect, op);
return;
}
......@@ -357,7 +358,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
CGFloat patternAlpha = 1;
CGContextSetFillPattern(context, pattern, &patternAlpha);
ctxt->setCompositeOperation(CompositeSourceOver);
ctxt->setCompositeOperation(op);
CGContextFillRect(context, destRect);
......@@ -370,14 +371,15 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
}
// FIXME: Merge with the other drawTiled eventually, since we need a combination of both for some things.
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule)
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule,
TileRule vRule, CompositeOperator op)
{
CGImageRef image = frameAtIndex(m_currentFrame);
if (!image)
return;
if (m_currentFrame == 0 && m_isSolidColor)
return fillSolidColorInRect(ctxt, m_solidColor, dstRect, CompositeSourceOver);
return fillSolidColorInRect(ctxt, m_solidColor, dstRect, op);
ctxt->save();
......@@ -440,7 +442,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
CGFloat patternAlpha = 1;
CGContextSetFillPattern(context, pattern, &patternAlpha);
ctxt->setCompositeOperation(CompositeSourceOver);
ctxt->setCompositeOperation(op);
CGContextFillRect(context, ir);
......
......@@ -357,4 +357,4 @@ void WebCore::setFocusRingColorChangeFunction(void (*)()) { }
void Frame::setNeedsReapplyStyles() { }
void Image::drawTiled(GraphicsContext*, const FloatRect&, const FloatRect&, TileRule, TileRule) { }
void Image::drawTiled(GraphicsContext*, const FloatRect&, const FloatRect&, TileRule, TileRule, CompositeOperator) { }
......@@ -641,8 +641,10 @@ void RenderBox::paintBackgroundExtended(GraphicsContext* p, const Color& c, cons
ch = b.height();
}
if (cw > 0 && ch > 0)
p->drawTiledImage(bg->image(), IntRect(cx, cy, cw, ch), IntPoint(sx, sy), IntSize(scaledImageWidth, scaledImageHeight));
if (cw > 0 && ch > 0) {
p->drawTiledImage(bg->image(), IntRect(cx, cy, cw, ch), IntPoint(sx, sy), IntSize(scaledImageWidth, scaledImageHeight),
bgLayer->backgroundComposite());
}
}
if (bgLayer->backgroundClip() != BGBORDER)
......
......@@ -116,6 +116,7 @@ BackgroundLayer::BackgroundLayer()
, m_bgClip(RenderStyle::initialBackgroundClip())
, m_bgOrigin(RenderStyle::initialBackgroundOrigin())
, m_bgRepeat(RenderStyle::initialBackgroundRepeat())
, m_bgComposite(RenderStyle::initialBackgroundComposite())
, m_backgroundSize(RenderStyle::initialBackgroundSize())
, m_imageSet(false)
, m_attachmentSet(false)
......@@ -124,6 +125,7 @@ BackgroundLayer::BackgroundLayer()
, m_repeatSet(false)
, m_xPosSet(false)
, m_yPosSet(false)
, m_compositeSet(false)
, m_backgroundSizeSet(false)
, m_next(0)
{
......@@ -137,6 +139,7 @@ BackgroundLayer::BackgroundLayer(const BackgroundLayer& o)
, m_bgClip(o.m_bgClip)
, m_bgOrigin(o.m_bgOrigin)
, m_bgRepeat(o.m_bgRepeat)
, m_bgComposite(o.m_bgComposite)
, m_backgroundSize(o.m_backgroundSize)
, m_imageSet(o.m_imageSet)
, m_attachmentSet(o.m_attachmentSet)
......@@ -145,6 +148,7 @@ BackgroundLayer::BackgroundLayer(const BackgroundLayer& o)
, m_repeatSet(o.m_repeatSet)
, m_xPosSet(o.m_xPosSet)
, m_yPosSet(o.m_yPosSet)
, m_compositeSet(o.m_compositeSet)
, m_backgroundSizeSet(o.m_backgroundSizeSet)
, m_next(o.m_next ? new BackgroundLayer(*o.m_next) : 0)
{
......@@ -167,6 +171,7 @@ BackgroundLayer& BackgroundLayer::operator=(const BackgroundLayer& o)
m_yPosition = o.m_yPosition;
m_bgAttachment = o.m_bgAttachment;
m_bgClip = o.m_bgClip;
m_bgComposite = o.m_bgComposite;
m_bgOrigin = o.m_bgOrigin;
m_bgRepeat = o.m_bgRepeat;
m_backgroundSize = o.m_backgroundSize;
......@@ -174,6 +179,7 @@ BackgroundLayer& BackgroundLayer::operator=(const BackgroundLayer& o)
m_imageSet = o.m_imageSet;
m_attachmentSet = o.m_attachmentSet;
m_clipSet = o.m_clipSet;
m_compositeSet = o.m_compositeSet;
m_originSet = o.m_originSet;
m_repeatSet = o.m_repeatSet;
m_xPosSet = o.m_xPosSet;
......@@ -186,10 +192,12 @@ BackgroundLayer& BackgroundLayer::operator=(const BackgroundLayer& o)
bool BackgroundLayer::operator==(const BackgroundLayer& o) const
{
return m_image == o.m_image && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition &&
m_bgAttachment == o.m_bgAttachment && m_bgClip == o.m_bgClip && m_bgOrigin == o.m_bgOrigin && m_bgRepeat == o.m_bgRepeat &&
m_bgAttachment == o.m_bgAttachment && m_bgClip == o.m_bgClip &&
m_bgComposite == o.m_bgComposite && m_bgOrigin == o.m_bgOrigin && m_bgRepeat == o.m_bgRepeat &&
m_backgroundSize.width == o.m_backgroundSize.width && m_backgroundSize.height == o.m_backgroundSize.height &&
m_imageSet == o.m_imageSet && m_attachmentSet == o.m_attachmentSet && m_repeatSet == o.m_repeatSet &&
m_xPosSet == o.m_xPosSet && m_yPosSet == o.m_yPosSet && m_backgroundSizeSet == o.m_backgroundSizeSet &&
m_imageSet == o.m_imageSet && m_attachmentSet == o.m_attachmentSet && m_compositeSet == o.m_compositeSet &&
m_repeatSet == o.m_repeatSet && m_xPosSet == o.m_xPosSet && m_yPosSet == o.m_yPosSet &&
m_backgroundSizeSet == o.m_backgroundSizeSet &&
((m_next && o.m_next) ? *m_next == *o.m_next : m_next == o.m_next);
}
......@@ -251,6 +259,17 @@ void BackgroundLayer::fillUnsetProperties()
}
}
for (curr = this; curr && curr->isBackgroundCompositeSet(); curr = curr->next());
if (curr && curr != this) {
// We need to fill in the remaining values with the pattern specified.
for (BackgroundLayer* pattern = this; curr; curr = curr->next()) {
curr->m_bgComposite = pattern->m_bgComposite;
pattern = pattern->next();
if (pattern == curr || !pattern)
pattern = this;
}
}
for (curr = this; curr && curr->isBackgroundOriginSet(); curr = curr->next());
if (curr && curr != this) {
// We need to fill in the remaining values with the pattern specified.
......@@ -293,8 +312,8 @@ void BackgroundLayer::cullEmptyLayers()
if (next && !next->isBackgroundImageSet() &&
!next->isBackgroundXPositionSet() && !next->isBackgroundYPositionSet() &&
!next->isBackgroundAttachmentSet() && !next->isBackgroundClipSet() &&
!next->isBackgroundOriginSet() && !next->isBackgroundRepeatSet() &&
!next->isBackgroundSizeSet()) {
!next->isBackgroundCompositeSet() && !next->isBackgroundOriginSet() &&
!next->isBackgroundRepeatSet() && !next->isBackgroundSizeSet()) {
delete next;
p->m_next = 0;
break;
......
......@@ -38,6 +38,7 @@
#include "Color.h"
#include "DataRef.h"
#include "Font.h"
#include "GraphicsTypes.h"
#include "IntRect.h"
#include "Length.h"
#include "Shared.h"
......@@ -451,6 +452,7 @@ public:
EBackgroundBox backgroundClip() const { return static_cast<EBackgroundBox>(m_bgClip); }
EBackgroundBox backgroundOrigin() const { return static_cast<EBackgroundBox>(m_bgOrigin); }
EBackgroundRepeat backgroundRepeat() const { return static_cast<EBackgroundRepeat>(m_bgRepeat); }
CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_bgComposite); }
LengthSize backgroundSize() const { return m_backgroundSize; }
BackgroundLayer* next() const { return m_next; }
......@@ -463,6 +465,7 @@ public:
bool isBackgroundClipSet() const { return m_clipSet; }
bool isBackgroundOriginSet() const { return m_originSet; }
bool isBackgroundRepeatSet() const { return m_repeatSet; }
bool isBackgroundCompositeSet() const { return m_compositeSet; }
bool isBackgroundSizeSet() const { return m_backgroundSizeSet; }
void setBackgroundImage(CachedImage* i) { m_image = i; m_imageSet = true; }
......@@ -472,6 +475,7 @@ public:
void setBackgroundClip(EBackgroundBox b) { m_bgClip = b; m_clipSet = true; }
void setBackgroundOrigin(EBackgroundBox b) { m_bgOrigin = b; m_originSet = true; }
void setBackgroundRepeat(EBackgroundRepeat r) { m_bgRepeat = r; m_repeatSet = true; }
void setBackgroundComposite(CompositeOperator c) { m_bgComposite = c; m_compositeSet = true; }
void setBackgroundSize(const LengthSize& b) { m_backgroundSize = b; m_backgroundSizeSet = true; }
void clearBackgroundImage() { m_imageSet = false; }
......@@ -481,6 +485,7 @@ public:
void clearBackgroundClip() { m_clipSet = false; }
void clearBackgroundOrigin() { m_originSet = false; }
void clearBackgroundRepeat() { m_repeatSet = false; }
void clearBackgroundComposite() { m_compositeSet = false; }
void clearBackgroundSize() { m_backgroundSizeSet = false; }
void setNext(BackgroundLayer* n) { if (m_next != n) { delete m_next; m_next = n; } }
......@@ -518,6 +523,7 @@ public:
unsigned m_bgClip : 2; // EBackgroundBox
unsigned m_bgOrigin : 2; // EBackgroundBox
unsigned m_bgRepeat : 2; // EBackgroundRepeat
unsigned m_bgComposite : 2; // CompositeOperator
LengthSize m_backgroundSize;
......@@ -528,6 +534,7 @@ public:
bool m_repeatSet : 1;
bool m_xPosSet : 1;
bool m_yPosSet : 1;
bool m_compositeSet : 1;
bool m_backgroundSizeSet : 1;
BackgroundLayer* m_next;
......@@ -1265,6 +1272,7 @@ public:
const Color & backgroundColor() const { return background->m_color; }
CachedImage *backgroundImage() const { return background->m_background.m_image; }
EBackgroundRepeat backgroundRepeat() const { return static_cast<EBackgroundRepeat>(background->m_background.m_bgRepeat); }
CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(background->m_background.m_bgComposite); }
bool backgroundAttachment() const { return background->m_background.m_bgAttachment; }
EBackgroundBox backgroundClip() const { return static_cast<EBackgroundBox>(background->m_background.m_bgClip); }
EBackgroundBox backgroundOrigin() const { return static_cast<EBackgroundBox>(background->m_background.m_bgOrigin); }
......@@ -1619,6 +1627,7 @@ public:
static EBackgroundBox initialBackgroundClip() { return BGBORDER; }
static EBackgroundBox initialBackgroundOrigin() { return BGPADDING; }
static EBackgroundRepeat initialBackgroundRepeat() { return REPEAT; }
static CompositeOperator initialBackgroundComposite() { return CompositeSourceOver; }
static LengthSize initialBackgroundSize() { return LengthSize(); }
static bool initialBorderCollapse() { return false; }
static EBorderStyle initialBorderStyle() { return BNONE; }
......