diff options
author | Nicolas Roard <nicolasroard@google.com> | 2012-04-06 15:16:28 -0700 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2012-04-24 11:54:25 -0700 |
commit | a15d30f54c6edc68da7e82c198b5916dd023ac4d (patch) | |
tree | 6f7040096043ac04a72600144a51a274f1096b2f /Source/WebCore/rendering | |
parent | 492bcfac9fc25b61f44811050fb0cfe827eb6a08 (diff) | |
download | external_webkit-a15d30f54c6edc68da7e82c198b5916dd023ac4d.zip external_webkit-a15d30f54c6edc68da7e82c198b5916dd023ac4d.tar.gz external_webkit-a15d30f54c6edc68da7e82c198b5916dd023ac4d.tar.bz2 |
CSS Background image implementation
bug:1352305
Change-Id: Id9caaae9b9442729110b52c75004f634d8284db4
Diffstat (limited to 'Source/WebCore/rendering')
-rw-r--r-- | Source/WebCore/rendering/PaintPhase.h | 4 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderBlock.cpp | 6 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderBox.cpp | 5 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderBoxModelObject.h | 4 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderLayerBacking.cpp | 12 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderLayerCompositor.cpp | 3 |
6 files changed, 33 insertions, 1 deletions
diff --git a/Source/WebCore/rendering/PaintPhase.h b/Source/WebCore/rendering/PaintPhase.h index 396131f..7dc205d 100644 --- a/Source/WebCore/rendering/PaintPhase.h +++ b/Source/WebCore/rendering/PaintPhase.h @@ -39,6 +39,10 @@ namespace WebCore { enum PaintPhase { PaintPhaseBlockBackground, +#if PLATFORM(ANDROID) + // Used for fixed background support in layers + PaintPhaseBlockBackgroundDecorations, +#endif PaintPhaseChildBlockBackground, PaintPhaseChildBlockBackgrounds, PaintPhaseFloat, diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index a3bd41a..49dd169 100644 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2499,7 +2499,11 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, int tx, int ty) PaintPhase paintPhase = paintInfo.phase; // 1. paint background, borders etc - if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && style()->visibility() == VISIBLE) { + if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground +#if PLATFORM(ANDROID) + || paintPhase == PaintPhaseBlockBackgroundDecorations +#endif + ) && style()->visibility() == VISIBLE) { if (hasBoxDecorations()) paintBoxDecorations(paintInfo, tx, ty); if (hasColumns()) diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 9c40d5b..bc7d03a 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -843,6 +843,11 @@ void RenderBox::paintBoxDecorationsWithSize(PaintInfo& paintInfo, int tx, int ty else if (!isBody() || document()->documentElement()->renderer()->hasBackground()) { // The <body> only paints its background if the root element has defined a background // independent of the body. +#if PLATFORM(ANDROID) + // If we only want to draw the decorations, don't draw + // the background + if (paintInfo.phase != PaintPhaseBlockBackgroundDecorations) +#endif paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, width, height); } if (style()->hasAppearance()) diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index d2f5972..ac4152f 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -62,7 +62,11 @@ public: bool hasSelfPaintingLayer() const; RenderLayer* layer() const { return m_layer; } +#if PLATFORM(ANDROID) + virtual bool requiresLayer() const { return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection() || style()->specifiesColumns() || style()->hasFixedBackgroundImage(); } +#else virtual bool requiresLayer() const { return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection() || style()->specifiesColumns(); } +#endif // This will work on inlines to return the bounding box of all of the lines' border boxes. virtual IntRect borderBoundingBox() const = 0; diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index 6f56eca..c0c562a 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -1114,12 +1114,24 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* bool shouldPaint = (m_owningLayer->hasVisibleContent() || m_owningLayer->hasVisibleDescendant()) && m_owningLayer->isSelfPaintingLayer(); +#if PLATFORM(ANDROID) + if (shouldPaint && ((paintingPhase & GraphicsLayerPaintBackground) + || (paintingPhase & GraphicsLayerPaintBackgroundDecorations))) { +#else if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackground)) { +#endif // Paint our background first, before painting any child layers. // Establish the clip used to paint our background. setClip(context, paintDirtyRect, damageRect); +#if PLATFORM(ANDROID) + PaintPhase phase = PaintPhaseBlockBackground; + if (paintingPhase & GraphicsLayerPaintBackgroundDecorations) + phase = PaintPhaseBlockBackgroundDecorations; + PaintInfo info(context, damageRect, phase, false, paintingRootForRenderer, 0); +#else PaintInfo info(context, damageRect, PaintPhaseBlockBackground, false, paintingRootForRenderer, 0); +#endif renderer()->paint(info, tx, ty); // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 1871b57..6b669e8 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -1432,6 +1432,9 @@ bool RenderLayerCompositor::requiresCompositingForAndroidLayers(const RenderLaye if (layer->renderer()->isCanvas()) return true; + if (layer->renderer()->style()->hasFixedBackgroundImage()) + return true; + return false; } #endif |