summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp
index 2b85bfa30..b1825481e 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/GraphicsLayer.cpp
@@ -449,6 +449,31 @@ void GraphicsLayer::setZPosition(float position)
}
#endif
+float GraphicsLayer::accumulatedOpacity() const
+{
+ if (!preserves3D())
+ return 1;
+
+ return m_opacity * (parent() ? parent()->accumulatedOpacity() : 1);
+}
+
+void GraphicsLayer::distributeOpacity(float accumulatedOpacity)
+{
+ // If this is a transform layer we need to distribute our opacity to all our children
+
+ // Incoming accumulatedOpacity is the contribution from our parent(s). We mutiply this by our own
+ // opacity to get the total contribution
+ accumulatedOpacity *= m_opacity;
+
+ setOpacityInternal(accumulatedOpacity);
+
+ if (preserves3D()) {
+ size_t numChildren = children().size();
+ for (size_t i = 0; i < numChildren; ++i)
+ children()[i]->distributeOpacity(accumulatedOpacity);
+ }
+}
+
static void writeIndent(TextStream& ts, int indent)
{
for (int i = 0; i != indent; ++i)