summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-18 15:36:45 +0100
committerBen Murdoch <benm@google.com>2009-08-18 19:20:06 +0100
commitd227fc870c7a697500a3c900c31baf05fb9a8524 (patch)
treea3fa109aa5bf52fef562ac49d97a2f723889cc71 /WebCore/rendering
parentf2c627513266faa73f7669058d98c60769fb3524 (diff)
downloadexternal_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.zip
external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.gz
external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.bz2
Merge WebKit r47420
Diffstat (limited to 'WebCore/rendering')
-rw-r--r--WebCore/rendering/HitTestResult.cpp2
-rw-r--r--WebCore/rendering/InlineFlowBox.cpp26
-rw-r--r--WebCore/rendering/MediaControlElements.cpp60
-rw-r--r--WebCore/rendering/RenderBlock.cpp81
-rw-r--r--WebCore/rendering/RenderBlock.h6
-rw-r--r--WebCore/rendering/RenderBox.cpp61
-rw-r--r--WebCore/rendering/RenderBox.h4
-rw-r--r--WebCore/rendering/RenderButton.cpp4
-rw-r--r--WebCore/rendering/RenderFieldset.cpp3
-rw-r--r--WebCore/rendering/RenderFlexibleBox.cpp23
-rw-r--r--WebCore/rendering/RenderHTMLCanvas.cpp7
-rw-r--r--WebCore/rendering/RenderImage.cpp2
-rw-r--r--WebCore/rendering/RenderInline.cpp12
-rw-r--r--WebCore/rendering/RenderLayer.cpp52
-rw-r--r--WebCore/rendering/RenderLayer.h4
-rw-r--r--WebCore/rendering/RenderLayerBacking.cpp134
-rw-r--r--WebCore/rendering/RenderLayerBacking.h26
-rw-r--r--WebCore/rendering/RenderLayerCompositor.cpp24
-rw-r--r--WebCore/rendering/RenderLayerCompositor.h3
-rw-r--r--WebCore/rendering/RenderListItem.h4
-rw-r--r--WebCore/rendering/RenderMarquee.cpp7
-rw-r--r--WebCore/rendering/RenderObject.cpp24
-rw-r--r--WebCore/rendering/RenderObject.h13
-rw-r--r--WebCore/rendering/RenderReplaced.cpp2
-rw-r--r--WebCore/rendering/RenderTable.cpp21
-rw-r--r--WebCore/rendering/RenderText.cpp2
-rw-r--r--WebCore/rendering/RenderTextFragment.cpp4
-rw-r--r--WebCore/rendering/RenderThemeChromiumMac.h1
-rw-r--r--WebCore/rendering/RenderThemeChromiumMac.mm30
-rw-r--r--WebCore/rendering/RenderThemeChromiumSkia.cpp4
-rw-r--r--WebCore/rendering/style/FillLayer.h6
-rw-r--r--WebCore/rendering/style/RenderStyleConstants.h7
32 files changed, 407 insertions, 252 deletions
diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp
index b7de46b..0aaddc9 100644
--- a/WebCore/rendering/HitTestResult.cpp
+++ b/WebCore/rendering/HitTestResult.cpp
@@ -209,7 +209,7 @@ String HitTestResult::altDisplayString() const
if (m_innerNonSharedNode->hasTagName(imgTag)) {
HTMLImageElement* image = static_cast<HTMLImageElement*>(m_innerNonSharedNode.get());
- return displayString(image->alt(), m_innerNonSharedNode.get());
+ return displayString(image->getAttribute(altAttr), m_innerNonSharedNode.get());
}
if (m_innerNonSharedNode->hasTagName(inputTag)) {
diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp
index 543c190..98c5c43 100644
--- a/WebCore/rendering/InlineFlowBox.cpp
+++ b/WebCore/rendering/InlineFlowBox.cpp
@@ -29,6 +29,7 @@
#include "RootInlineBox.h"
#include "RenderBlock.h"
#include "RenderInline.h"
+#include "RenderLayer.h"
#include "RenderListMarker.h"
#include "RenderTableCell.h"
#include "RootInlineBox.h"
@@ -774,18 +775,23 @@ void InlineFlowBox::paintMask(RenderObject::PaintInfo& paintInfo, int tx, int ty
int w = width();
int h = height();
- // Figure out if we need to push a transparency layer to render our mask.
- bool pushTransparencyLayer = false;
const NinePieceImage& maskNinePieceImage = renderer()->style()->maskBoxImage();
StyleImage* maskBoxImage = renderer()->style()->maskBoxImage().image();
- if ((maskBoxImage && renderer()->style()->maskLayers()->hasImage()) || renderer()->style()->maskLayers()->next())
- pushTransparencyLayer = true;
-
- CompositeOperator compositeOp = CompositeDestinationIn;
- if (pushTransparencyLayer) {
- paintInfo.context->setCompositeOperation(CompositeDestinationIn);
- paintInfo.context->beginTransparencyLayer(1.0f);
- compositeOp = CompositeSourceOver;
+
+ // Figure out if we need to push a transparency layer to render our mask.
+ bool pushTransparencyLayer = false;
+ bool compositedMask = renderer()->hasLayer() && boxModelObject()->layer()->hasCompositedMask();
+ CompositeOperator compositeOp = CompositeSourceOver;
+ if (!compositedMask) {
+ if ((maskBoxImage && renderer()->style()->maskLayers()->hasImage()) || renderer()->style()->maskLayers()->next())
+ pushTransparencyLayer = true;
+
+ compositeOp = CompositeDestinationIn;
+ if (pushTransparencyLayer) {
+ paintInfo.context->setCompositeOperation(CompositeDestinationIn);
+ paintInfo.context->beginTransparencyLayer(1.0f);
+ compositeOp = CompositeSourceOver;
+ }
}
paintFillLayers(paintInfo, Color(), renderer()->style()->maskLayers(), tx, ty, w, h, compositeOp);
diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp
index 352f270..6715111 100644
--- a/WebCore/rendering/MediaControlElements.cpp
+++ b/WebCore/rendering/MediaControlElements.cpp
@@ -32,28 +32,27 @@
#include "MediaControlElements.h"
-#include "LocalizedStrings.h"
#include "EventNames.h"
#include "FloatConversion.h"
#include "Frame.h"
#include "HTMLNames.h"
+#include "LocalizedStrings.h"
#include "MouseEvent.h"
#include "RenderMedia.h"
#include "RenderSlider.h"
#include "RenderTheme.h"
-#include "CString.h"
namespace WebCore {
using namespace HTMLNames;
-// FIXME: These constants may need to be tweaked to better match the seeking in the QT plugin
+// FIXME: These constants may need to be tweaked to better match the seeking in the QuickTime plug-in.
static const float cSeekRepeatDelay = 0.1f;
static const float cStepTime = 0.07f;
static const float cSeekTime = 0.2f;
-MediaControlShadowRootElement::MediaControlShadowRootElement(Document* doc, HTMLMediaElement* mediaElement)
- : HTMLDivElement(divTag, doc)
+MediaControlShadowRootElement::MediaControlShadowRootElement(Document* document, HTMLMediaElement* mediaElement)
+ : HTMLDivElement(divTag, document)
, m_mediaElement(mediaElement)
{
RefPtr<RenderStyle> rootStyle = RenderStyle::create();
@@ -76,10 +75,9 @@ void MediaControlShadowRootElement::updateStyle()
}
// ----------------------------
-
-MediaControlElement::MediaControlElement(Document* doc, PseudoId pseudo, HTMLMediaElement* mediaElement)
- : HTMLDivElement(divTag, doc)
+MediaControlElement::MediaControlElement(Document* document, PseudoId pseudo, HTMLMediaElement* mediaElement)
+ : HTMLDivElement(divTag, document)
, m_mediaElement(mediaElement)
, m_pseudoStyleId(pseudo)
{
@@ -165,8 +163,8 @@ void MediaControlElement::updateStyle()
// ----------------------------
-MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* doc, HTMLMediaElement* element)
-: MediaControlElement(doc, MEDIA_CONTROLS_TIMELINE_CONTAINER, element)
+MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* document, HTMLMediaElement* element)
+ : MediaControlElement(document, MEDIA_CONTROLS_TIMELINE_CONTAINER, element)
{
}
@@ -188,9 +186,9 @@ bool MediaControlTimelineContainerElement::rendererIsNeeded(RenderStyle* style)
// ----------------------------
-MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* doc, HTMLMediaElement* element)
-: MediaControlElement(doc, MEDIA_CONTROLS_STATUS_DISPLAY, element)
-, m_stateBeingDisplayed(Nothing)
+MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* document, HTMLMediaElement* element)
+ : MediaControlElement(document, MEDIA_CONTROLS_STATUS_DISPLAY, element)
+ , m_stateBeingDisplayed(Nothing)
{
}
@@ -235,8 +233,8 @@ bool MediaControlStatusDisplayElement::rendererIsNeeded(RenderStyle* style)
// ----------------------------
-MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType)
- : HTMLInputElement(inputTag, doc)
+MediaControlInputElement::MediaControlInputElement(Document* document, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType)
+ : HTMLInputElement(inputTag, document)
, m_mediaElement(mediaElement)
, m_pseudoStyleId(pseudo)
, m_displayType(displayType)
@@ -330,8 +328,8 @@ void MediaControlInputElement::setDisplayType(MediaControlElementType displayTyp
// ----------------------------
-MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* doc, HTMLMediaElement* element)
- : MediaControlInputElement(doc, MEDIA_CONTROLS_MUTE_BUTTON, "button", element, element->muted() ? MediaUnMuteButton : MediaMuteButton)
+MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* document, HTMLMediaElement* element)
+ : MediaControlInputElement(document, MEDIA_CONTROLS_MUTE_BUTTON, "button", element, element->muted() ? MediaUnMuteButton : MediaMuteButton)
{
}
@@ -351,8 +349,8 @@ void MediaControlMuteButtonElement::updateDisplayType()
// ----------------------------
-MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* doc, HTMLMediaElement* element)
- : MediaControlInputElement(doc, MEDIA_CONTROLS_PLAY_BUTTON, "button", element, element->canPlay() ? MediaPlayButton : MediaPauseButton)
+MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* document, HTMLMediaElement* element)
+ : MediaControlInputElement(document, MEDIA_CONTROLS_PLAY_BUTTON, "button", element, element->canPlay() ? MediaPlayButton : MediaPauseButton)
{
}
@@ -372,8 +370,8 @@ void MediaControlPlayButtonElement::updateDisplayType()
// ----------------------------
-MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* doc, HTMLMediaElement* element, bool forward)
- : MediaControlInputElement(doc, forward ? MEDIA_CONTROLS_SEEK_FORWARD_BUTTON : MEDIA_CONTROLS_SEEK_BACK_BUTTON,
+MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* document, HTMLMediaElement* element, bool forward)
+ : MediaControlInputElement(document, forward ? MEDIA_CONTROLS_SEEK_FORWARD_BUTTON : MEDIA_CONTROLS_SEEK_BACK_BUTTON,
"button", element, forward ? MediaSeekForwardButton : MediaSeekBackButton)
, m_forward(forward)
, m_seeking(false)
@@ -432,8 +430,8 @@ void MediaControlSeekButtonElement::detach()
// ----------------------------
-MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* doc, HTMLMediaElement* element)
-: MediaControlInputElement(doc, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton)
+MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* document, HTMLMediaElement* element)
+ : MediaControlInputElement(document, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton)
{
}
@@ -454,8 +452,8 @@ bool MediaControlRewindButtonElement::rendererIsNeeded(RenderStyle* style)
// ----------------------------
-MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* doc, HTMLMediaElement* element)
-: MediaControlInputElement(doc, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton)
+MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* document, HTMLMediaElement* element)
+ : MediaControlInputElement(document, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton)
{
}
@@ -482,8 +480,8 @@ MediaControlTimelineElement::MediaControlTimelineElement(Document* document, HTM
void MediaControlTimelineElement::defaultEventHandler(Event* event)
{
- // Left button is 0. Accepts only if mouse event is from left button.
- if (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button())
+ // Left button is 0. Rejects mouse events not from left button.
+ if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
return;
if (event->type() == eventNames().mousedownEvent)
@@ -520,8 +518,8 @@ void MediaControlTimelineElement::update(bool updateDuration)
// ----------------------------
-MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* doc, HTMLMediaElement* element)
- : MediaControlInputElement(doc, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element, MediaFullscreenButton)
+MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* document, HTMLMediaElement* element)
+ : MediaControlInputElement(document, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element, MediaFullscreenButton)
{
}
@@ -541,8 +539,8 @@ bool MediaControlFullscreenButtonElement::rendererIsNeeded(RenderStyle* style)
// ----------------------------
-MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* doc, PseudoId pseudo, HTMLMediaElement* element)
- : MediaControlElement(doc, pseudo, element)
+MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* document, PseudoId pseudo, HTMLMediaElement* element)
+ : MediaControlElement(document, pseudo, element)
, m_isVisible(true)
{
}
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index e10c331..03f5781 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -33,6 +33,7 @@
#include "HTMLNames.h"
#include "HitTestResult.h"
#include "InlineTextBox.h"
+#include "RenderFlexibleBox.h"
#include "RenderImage.h"
#include "RenderInline.h"
#include "RenderMarquee.h"
@@ -734,6 +735,31 @@ void RenderBlock::updateScrollInfoAfterLayout()
}
}
+void RenderBlock::updateOverflowWithShadowAndReflection()
+{
+ if (hasOverflowClip())
+ return;
+
+ int shadowLeft;
+ int shadowRight;
+ int shadowTop;
+ int shadowBottom;
+ style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
+
+ m_overflowLeft = min(m_overflowLeft, shadowLeft);
+ m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
+ m_overflowTop = min(m_overflowTop, shadowTop);
+ m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
+
+ if (hasReflection()) {
+ IntRect reflection(reflectionBox());
+ m_overflowLeft = min(m_overflowLeft, reflection.x());
+ m_overflowWidth = max(m_overflowWidth, reflection.right());
+ m_overflowTop = min(m_overflowTop, reflection.y());
+ m_overflowHeight = max(m_overflowHeight, reflection.bottom());
+ }
+}
+
void RenderBlock::layout()
{
// Update our first letter info now.
@@ -884,26 +910,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
m_overflowWidth = max(m_overflowWidth, width());
m_overflowHeight = max(m_overflowHeight, height());
- if (!hasOverflowClip()) {
- int shadowLeft;
- int shadowRight;
- int shadowTop;
- int shadowBottom;
- style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
-
- m_overflowLeft = min(m_overflowLeft, shadowLeft);
- m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
- m_overflowTop = min(m_overflowTop, shadowTop);
- m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
-
- if (hasReflection()) {
- IntRect reflection(reflectionBox());
- m_overflowLeft = min(m_overflowLeft, reflection.x());
- m_overflowWidth = max(m_overflowWidth, reflection.right());
- m_overflowTop = min(m_overflowTop, reflection.y());
- m_overflowHeight = max(m_overflowHeight, reflection.bottom());
- }
- }
+ updateOverflowWithShadowAndReflection();
statePusher.pop();
@@ -1032,7 +1039,10 @@ bool RenderBlock::handleRunInChild(RenderBox* child)
// See if we have a run-in element with inline children. If the
// children aren't inline, then just treat the run-in as a normal
// block.
- if (!child->isRunIn() || !child->childrenInline() && !child->isReplaced())
+ if (!child->isRunIn() || !child->childrenInline())
+ return false;
+ // FIXME: We don't handle non-block elements with run-in for now.
+ if (!child->isRenderBlock())
return false;
// Get the next non-positioned/non-floating RenderBlock.
@@ -3298,13 +3308,17 @@ int RenderBlock::getClearDelta(RenderBox* child, int yPos)
// We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default).
// FIXME: Note that the remaining space checks aren't quite accurate, since you should be able to clear only some floats (the minimum # needed
// to fit) and not all (we should be using nextFloatBottomBelow and looping).
- // Do not allow tables to wrap in quirks or even in almost strict mode
- // (ebay on the PLT, finance.yahoo.com in the real world, versiontracker.com forces even almost strict mode not to work)
int result = clearSet ? max(0, bottom - yPos) : 0;
- if (!result && child->avoidsFloats() && child->style()->width().isFixed() &&
- child->minPrefWidth() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth() &&
- document()->inStrictMode())
- result = max(0, floatBottom() - yPos);
+ if (!result && child->avoidsFloats()) {
+ int oldYPos = child->y();
+ int oldWidth = child->width();
+ child->setY(yPos);
+ child->calcWidth();
+ if (child->width() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth())
+ result = max(0, floatBottom() - yPos);
+ child->setY(oldYPos);
+ child->setWidth(oldWidth);
+ }
return result;
}
@@ -5121,13 +5135,20 @@ void RenderBlock::addFocusRingRects(GraphicsContext* graphicsContext, int tx, in
ty - y() + inlineContinuation()->containingBlock()->y());
}
-RenderBlock* RenderBlock::createAnonymousBlock() const
+RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const
{
RefPtr<RenderStyle> newStyle = RenderStyle::create();
newStyle->inheritFrom(style());
- newStyle->setDisplay(BLOCK);
- RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
+ RenderBlock* newBox = 0;
+ if (isFlexibleBox) {
+ newStyle->setDisplay(BOX);
+ newBox = new (renderArena()) RenderFlexibleBox(document() /* anonymous box */);
+ } else {
+ newStyle->setDisplay(BLOCK);
+ newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
+ }
+
newBox->setStyle(newStyle.release());
return newBox;
}
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 839be16..88d2386 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -147,7 +147,7 @@ public:
// This function is a convenience helper for creating an anonymous block that inherits its
// style from this RenderBlock.
- RenderBlock* createAnonymousBlock() const;
+ RenderBlock* createAnonymousBlock(bool isFlexibleBox = false) const;
Vector<IntRect>* columnRects() const;
int columnGap() const;
@@ -207,7 +207,9 @@ protected:
virtual bool hasLineIfEmpty() const;
bool layoutOnlyPositionedObjects();
-
+
+ void updateOverflowWithShadowAndReflection();
+
private:
virtual RenderObjectChildList* virtualChildren() { return children(); }
virtual const RenderObjectChildList* virtualChildren() const { return children(); }
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 4c2bff0..a1a2d9a 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -416,6 +416,11 @@ bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity,
return b->scroll(direction, granularity, multiplier);
return false;
}
+
+bool RenderBox::canBeScrolledAndHasScrollableArea() const
+{
+ return canBeProgramaticallyScrolled(false) && (scrollHeight() != clientHeight() || scrollWidth() != clientWidth());
+}
bool RenderBox::canBeProgramaticallyScrolled(bool) const
{
@@ -653,31 +658,36 @@ void RenderBox::paintMaskImages(const PaintInfo& paintInfo, int tx, int ty, int
{
// Figure out if we need to push a transparency layer to render our mask.
bool pushTransparencyLayer = false;
- StyleImage* maskBoxImage = style()->maskBoxImage().image();
- if (maskBoxImage && style()->maskLayers()->hasImage()) {
- pushTransparencyLayer = true;
- } else {
- // We have to use an extra image buffer to hold the mask. Multiple mask images need
- // to composite together using source-over so that they can then combine into a single unified mask that
- // can be composited with the content using destination-in. SVG images need to be able to set compositing modes
- // as they draw images contained inside their sub-document, so we paint all our images into a separate buffer
- // and composite that buffer as the mask.
- // We have to check that the mask images to be rendered contain at least one image that can be actually used in rendering
- // before pushing the transparency layer.
- for (const FillLayer* fillLayer = style()->maskLayers()->next(); fillLayer; fillLayer = fillLayer->next()) {
- if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) {
- pushTransparencyLayer = true;
- // We found one image that can be used in rendering, exit the loop
- break;
+ bool compositedMask = hasLayer() && layer()->hasCompositedMask();
+ CompositeOperator compositeOp = CompositeSourceOver;
+
+ if (!compositedMask) {
+ StyleImage* maskBoxImage = style()->maskBoxImage().image();
+ if (maskBoxImage && style()->maskLayers()->hasImage()) {
+ pushTransparencyLayer = true;
+ } else {
+ // We have to use an extra image buffer to hold the mask. Multiple mask images need
+ // to composite together using source-over so that they can then combine into a single unified mask that
+ // can be composited with the content using destination-in. SVG images need to be able to set compositing modes
+ // as they draw images contained inside their sub-document, so we paint all our images into a separate buffer
+ // and composite that buffer as the mask.
+ // We have to check that the mask images to be rendered contain at least one image that can be actually used in rendering
+ // before pushing the transparency layer.
+ for (const FillLayer* fillLayer = style()->maskLayers()->next(); fillLayer; fillLayer = fillLayer->next()) {
+ if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) {
+ pushTransparencyLayer = true;
+ // We found one image that can be used in rendering, exit the loop
+ break;
+ }
}
}
- }
-
- CompositeOperator compositeOp = CompositeDestinationIn;
- if (pushTransparencyLayer) {
- paintInfo.context->setCompositeOperation(CompositeDestinationIn);
- paintInfo.context->beginTransparencyLayer(1.0f);
- compositeOp = CompositeSourceOver;
+
+ compositeOp = CompositeDestinationIn;
+ if (pushTransparencyLayer) {
+ paintInfo.context->setCompositeOperation(CompositeDestinationIn);
+ paintInfo.context->beginTransparencyLayer(1.0f);
+ compositeOp = CompositeSourceOver;
+ }
}
paintFillLayers(paintInfo, Color(), style()->maskLayers(), tx, ty, w, h, compositeOp);
@@ -2701,11 +2711,6 @@ int RenderBox::leftmostPosition(bool /*includeOverflowInterior*/, bool includeSe
return left;
}
-bool RenderBox::isAfterContent(RenderObject* child) const
-{
- return (child && child->style()->styleType() == AFTER && (!child->isText() || child->isBR()));
-}
-
VisiblePosition RenderBox::positionForPoint(const IntPoint& point)
{
// no children...return this render object's element, if there is one, and offset 0
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index cb2297b..e86d073 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -230,6 +230,7 @@ public:
virtual int verticalScrollbarWidth() const;
int horizontalScrollbarHeight() const;
virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f);
+ bool canBeScrolledAndHasScrollableArea() const;
virtual bool canBeProgramaticallyScrolled(bool) const;
virtual void autoscroll();
virtual void stopAutoscroll() { }
@@ -333,9 +334,6 @@ private:
// These include tables, positioned objects, floats and flexible boxes.
virtual void calcPrefWidths() { setPrefWidthsDirty(false); }
-protected:
- bool isAfterContent(RenderObject* child) const;
-
private:
// The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent).
IntRect m_frameRect;
diff --git a/WebCore/rendering/RenderButton.cpp b/WebCore/rendering/RenderButton.cpp
index 6d36a0f..f3ae558 100644
--- a/WebCore/rendering/RenderButton.cpp
+++ b/WebCore/rendering/RenderButton.cpp
@@ -52,7 +52,8 @@ void RenderButton::addChild(RenderObject* newChild, RenderObject* beforeChild)
if (!m_inner) {
// Create an anonymous block.
ASSERT(!firstChild());
- m_inner = createAnonymousBlock();
+ bool isFlexibleBox = style()->display() == BOX || style()->display() == INLINE_BOX;
+ m_inner = createAnonymousBlock(isFlexibleBox);
setupInnerStyle(m_inner->style());
RenderFlexibleBox::addChild(m_inner);
}
@@ -108,6 +109,7 @@ void RenderButton::setupInnerStyle(RenderStyle* innerStyle)
// RenderBlock::createAnonymousBlock creates a new RenderStyle, so this is
// safe to modify.
innerStyle->setBoxFlex(1.0f);
+ innerStyle->setBoxOrient(style()->boxOrient());
innerStyle->setPaddingTop(Length(theme()->buttonInternalPaddingTop(), Fixed));
innerStyle->setPaddingRight(Length(theme()->buttonInternalPaddingRight(), Fixed));
diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp
index 437991a..8618d11 100644
--- a/WebCore/rendering/RenderFieldset.cpp
+++ b/WebCore/rendering/RenderFieldset.cpp
@@ -108,10 +108,11 @@ RenderBox* RenderFieldset::findLegend() const
{
for (RenderObject* legend = firstChild(); legend; legend = legend->nextSibling()) {
if (!legend->isFloatingOrPositioned() && legend->node() &&
- legend->node()->hasTagName(legendTag)
+ (legend->node()->hasTagName(legendTag)
#if ENABLE(WML)
|| legend->node()->hasTagName(WMLNames::insertedLegendTag)
#endif
+ )
)
return toRenderBox(legend);
}
diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp
index 6bbcc43..fa6d7a0 100644
--- a/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/WebCore/rendering/RenderFlexibleBox.cpp
@@ -295,26 +295,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren)
if (m_overflowWidth < width())
m_overflowWidth = width();
- if (!hasOverflowClip()) {
- int shadowLeft;
- int shadowRight;
- int shadowTop;
- int shadowBottom;
- style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
-
- m_overflowLeft = min(m_overflowLeft, shadowLeft);
- m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
- m_overflowTop = min(m_overflowTop, shadowTop);
- m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
-
- if (hasReflection()) {
- IntRect reflection(reflectionBox());
- m_overflowTop = min(m_overflowTop, reflection.y());
- m_overflowHeight = max(m_overflowHeight, reflection.bottom());
- m_overflowLeft = min(m_overflowLeft, reflection.x());
- m_overflowHeight = max(m_overflowWidth, reflection.right());
- }
- }
+ updateOverflowWithShadowAndReflection();
statePusher.pop();
@@ -1161,6 +1142,8 @@ const char *RenderFlexibleBox::renderName() const
return "RenderFlexibleBox (floating)";
if (isPositioned())
return "RenderFlexibleBox (positioned)";
+ if (isAnonymous())
+ return "RenderFlexibleBox (generated)";
if (isRelPositioned())
return "RenderFlexibleBox (relative positioned)";
return "RenderFlexibleBox";
diff --git a/WebCore/rendering/RenderHTMLCanvas.cpp b/WebCore/rendering/RenderHTMLCanvas.cpp
index 1fc07f0..3a776ba 100644
--- a/WebCore/rendering/RenderHTMLCanvas.cpp
+++ b/WebCore/rendering/RenderHTMLCanvas.cpp
@@ -55,10 +55,13 @@ void RenderHTMLCanvas::canvasSizeChanged()
IntSize canvasSize = static_cast<HTMLCanvasElement*>(node())->size();
IntSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasSize.height() * style()->effectiveZoom());
- if (canvasSize == intrinsicSize())
+ if (zoomedSize == intrinsicSize())
return;
- setIntrinsicSize(canvasSize);
+ setIntrinsicSize(zoomedSize);
+
+ if (!parent())
+ return;
if (!prefWidthsDirty())
setPrefWidthsDirty(true);
diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp
index 5c11e41..9692a09 100644
--- a/WebCore/rendering/RenderImage.cpp
+++ b/WebCore/rendering/RenderImage.cpp
@@ -440,7 +440,7 @@ int RenderImage::minimumReplacedHeight() const
HTMLMapElement* RenderImage::imageMap()
{
HTMLImageElement* i = node() && node()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(node()) : 0;
- return i ? i->document()->getImageMap(i->useMap()) : 0;
+ return i ? i->document()->getImageMap(i->getAttribute(usemapAttr)) : 0;
}
bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction)
diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp
index 53962d2..664af93 100644
--- a/WebCore/rendering/RenderInline.cpp
+++ b/WebCore/rendering/RenderInline.cpp
@@ -131,18 +131,6 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
}
}
-static inline bool isAfterContent(RenderObject* child)
-{
- if (!child)
- return false;
- if (child->style()->styleType() != AFTER)
- return false;
- // Text nodes don't have their own styles, so ignore the style on a text node.
- if (child->isText() && !child->isBR())
- return false;
- return true;
-}
-
void RenderInline::addChild(RenderObject* newChild, RenderObject* beforeChild)
{
if (continuation())
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index ab78f40..ca6e5a6 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -207,12 +207,8 @@ RenderLayer::~RenderLayer()
// Make sure we have no lingering clip rects.
ASSERT(!m_clipRects);
- if (m_reflection) {
- if (!m_reflection->documentBeingDestroyed())
- m_reflection->removeLayers(this);
- m_reflection->setParent(0);
- m_reflection->destroy();
- }
+ if (m_reflection)
+ removeReflection();
if (m_scrollCorner)
m_scrollCorner->destroy();
@@ -997,6 +993,9 @@ void RenderLayer::panScrollFromPoint(const IntPoint& sourcePoint)
void RenderLayer::scrollByRecursively(int xDelta, int yDelta)
{
+ if (!xDelta && !yDelta)
+ return;
+
bool restrictedByLineClamp = false;
if (renderer()->parent())
restrictedByLineClamp = renderer()->parent()->style()->lineClamp() >= 0;
@@ -1006,17 +1005,30 @@ void RenderLayer::scrollByRecursively(int xDelta, int yDelta)
int newOffsetY = scrollYOffset() + yDelta;
scrollToOffset(newOffsetX, newOffsetY);
- // If this layer can't do the scroll we ask its parent
+ // If this layer can't do the scroll we ask the next layer up that can scroll to try
int leftToScrollX = newOffsetX - scrollXOffset();
int leftToScrollY = newOffsetY - scrollYOffset();
if ((leftToScrollX || leftToScrollY) && renderer()->parent()) {
- renderer()->parent()->enclosingLayer()->scrollByRecursively(leftToScrollX, leftToScrollY);
+ RenderObject* nextRenderer = renderer()->parent();
+ while (nextRenderer) {
+ if (nextRenderer->isBox() && toRenderBox(nextRenderer)->canBeScrolledAndHasScrollableArea()) {
+ nextRenderer->enclosingLayer()->scrollByRecursively(leftToScrollX, leftToScrollY);
+ break;
+ }
+ nextRenderer = nextRenderer->parent();
+ }
+
Frame* frame = renderer()->document()->frame();
if (frame)
frame->eventHandler()->updateAutoscrollRenderer();
}
- } else if (renderer()->view()->frameView())
+ } else if (renderer()->view()->frameView()) {
+ // If we are here, we were called on a renderer that can be programatically scrolled, but doesn't
+ // have an overflow clip. Which means that it is a document node that can be scrolled.
renderer()->view()->frameView()->scrollBy(IntSize(xDelta, yDelta));
+ // FIXME: If we didn't scroll the whole way, do we want to try looking at the frames ownerElement?
+ // https://bugs.webkit.org/show_bug.cgi?id=28237
+ }
}
@@ -2873,6 +2885,11 @@ void RenderLayer::clearBacking()
{
m_backing.clear();
}
+
+bool RenderLayer::hasCompositedMask() const
+{
+ return m_backing && m_backing->hasMaskLayer();
+}
#endif
void RenderLayer::setParent(RenderLayer* parent)
@@ -3183,10 +3200,9 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*)
m_marquee = 0;
}
- if (!hasReflection() && m_reflection) {
- m_reflection->destroy();
- m_reflection = 0;
- } else if (hasReflection()) {
+ if (!hasReflection() && m_reflection)
+ removeReflection();
+ else if (hasReflection()) {
if (!m_reflection)
createReflection();
updateReflectionStyle();
@@ -3260,6 +3276,16 @@ void RenderLayer::createReflection()
m_reflection->setParent(renderer()); // We create a 1-way connection.
}
+void RenderLayer::removeReflection()
+{
+ if (!m_reflection->documentBeingDestroyed())
+ m_reflection->removeLayers(this);
+
+ m_reflection->setParent(0);
+ m_reflection->destroy();
+ m_reflection = 0;
+}
+
void RenderLayer::updateReflectionStyle()
{
RefPtr<RenderStyle> newStyle = RenderStyle::create();
diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h
index 1772c66..16ad4d4 100644
--- a/WebCore/rendering/RenderLayer.h
+++ b/WebCore/rendering/RenderLayer.h
@@ -415,11 +415,13 @@ public:
#if USE(ACCELERATED_COMPOSITING)
bool isComposited() const { return m_backing != 0; }
+ bool hasCompositedMask() const;
RenderLayerBacking* backing() const { return m_backing.get(); }
RenderLayerBacking* ensureBacking();
void clearBacking();
#else
bool isComposited() const { return false; }
+ bool hasCompositedMask() const { return false; }
#endif
bool paintsWithTransparency() const
@@ -507,6 +509,8 @@ private:
Node* enclosingElement() const;
void createReflection();
+ void removeReflection();
+
void updateReflectionStyle();
bool paintingInsideReflection() const { return m_paintingInsideReflection; }
void setPaintingInsideReflection(bool b) { m_paintingInsideReflection = b; }
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index e98c458..b60e18f 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -47,16 +47,14 @@ using namespace std;
namespace WebCore {
+using namespace HTMLNames;
+
static bool hasBorderOutlineOrShadow(const RenderStyle*);
static bool hasBoxDecorations(const RenderStyle*);
static bool hasBoxDecorationsWithBackgroundImage(const RenderStyle*);
RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)
: m_owningLayer(layer)
- , m_ancestorClippingLayer(0)
- , m_graphicsLayer(0)
- , m_foregroundLayer(0)
- , m_clippingLayer(0)
, m_hasDirectlyCompositedContent(false)
{
createGraphicsLayer();
@@ -66,12 +64,13 @@ RenderLayerBacking::~RenderLayerBacking()
{
updateClippingLayers(false, false);
updateForegroundLayer(false);
+ updateMaskLayer(false);
destroyGraphicsLayer();
}
void RenderLayerBacking::createGraphicsLayer()
{
- m_graphicsLayer = GraphicsLayer::createGraphicsLayer(this);
+ m_graphicsLayer = GraphicsLayer::create(this);
#ifndef NDEBUG
if (renderer()->node()) {
@@ -79,7 +78,7 @@ void RenderLayerBacking::createGraphicsLayer()
m_graphicsLayer->setName("Document Node");
else {
if (renderer()->node()->isHTMLElement() && renderer()->node()->hasID())
- m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->id());
+ m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->getAttribute(idAttr));
else
m_graphicsLayer->setName(renderer()->renderName());
}
@@ -96,14 +95,10 @@ void RenderLayerBacking::destroyGraphicsLayer()
if (m_graphicsLayer)
m_graphicsLayer->removeFromParent();
- delete m_graphicsLayer;
m_graphicsLayer = 0;
-
- delete m_foregroundLayer;
m_foregroundLayer = 0;
-
- delete m_clippingLayer;
m_clippingLayer = 0;
+ m_maskLayer = 0;
}
void RenderLayerBacking::updateLayerOpacity()
@@ -158,6 +153,9 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration()
if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), compositor->clipsCompositingDescendants(m_owningLayer)))
layerConfigChanged = true;
+ if (updateMaskLayer(m_owningLayer->renderer()->hasMask()))
+ m_graphicsLayer->setMaskLayer(m_maskLayer.get());
+
m_hasDirectlyCompositedContent = false;
if (canUseDirectCompositing()) {
if (renderer()->isImage()) {
@@ -251,13 +249,19 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
}
// If we have a layer that clips children, position it.
+ IntRect clippingBox;
if (m_clippingLayer) {
- IntRect clippingBox = toRenderBox(renderer())->overflowClipRect(0, 0);
+ clippingBox = toRenderBox(renderer())->overflowClipRect(0, 0);
m_clippingLayer->setPosition(FloatPoint() + (clippingBox.location() - localCompositingBounds.location()));
m_clippingLayer->setSize(clippingBox.size());
m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint());
}
+ if (m_maskLayer) {
+ m_maskLayer->setSize(m_graphicsLayer->size());
+ m_maskLayer->setPosition(FloatPoint());
+ }
+
if (m_owningLayer->hasTransform()) {
const IntRect borderBox = toRenderBox(renderer())->borderBoxRect();
@@ -293,10 +297,20 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
}
if (m_foregroundLayer) {
- // The contents layer is always coincidental with the graphicsLayer for now.
- m_foregroundLayer->setPosition(IntPoint(0, 0));
- m_foregroundLayer->setSize(newSize);
- m_foregroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
+ FloatPoint foregroundPosition;
+ FloatSize foregroundSize = newSize;
+ IntSize foregroundOffset = m_graphicsLayer->offsetFromRenderer();
+ // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
+ // so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
+ if (m_clippingLayer) {
+ foregroundPosition = FloatPoint() + (localCompositingBounds.location() - clippingBox.location());
+ foregroundSize = FloatSize(clippingBox.size());
+ foregroundOffset = clippingBox.location() - IntPoint();
+ }
+
+ m_foregroundLayer->setPosition(foregroundPosition);
+ m_foregroundLayer->setSize(foregroundSize);
+ m_foregroundLayer->setOffsetFromRenderer(foregroundOffset);
}
m_graphicsLayer->setContentsRect(contentsBox());
@@ -311,12 +325,12 @@ void RenderLayerBacking::updateInternalHierarchy()
if (m_ancestorClippingLayer) {
m_ancestorClippingLayer->removeAllChildren();
m_graphicsLayer->removeFromParent();
- m_ancestorClippingLayer->addChild(m_graphicsLayer);
+ m_ancestorClippingLayer->addChild(m_graphicsLayer.get());
}
if (m_clippingLayer) {
m_clippingLayer->removeFromParent();
- m_graphicsLayer->addChild(m_clippingLayer);
+ m_graphicsLayer->addChild(m_clippingLayer.get());
}
}
@@ -327,7 +341,7 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
if (needsAncestorClip) {
if (!m_ancestorClippingLayer) {
- m_ancestorClippingLayer = GraphicsLayer::createGraphicsLayer(this);
+ m_ancestorClippingLayer = GraphicsLayer::create(this);
#ifndef NDEBUG
m_ancestorClippingLayer->setName("Ancestor clipping Layer");
#endif
@@ -336,14 +350,13 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
}
} else if (m_ancestorClippingLayer) {
m_ancestorClippingLayer->removeFromParent();
- delete m_ancestorClippingLayer;
m_ancestorClippingLayer = 0;
layersChanged = true;
}
if (needsDescendantClip) {
if (!m_clippingLayer) {
- m_clippingLayer = GraphicsLayer::createGraphicsLayer(0);
+ m_clippingLayer = GraphicsLayer::create(0);
#ifndef NDEBUG
m_clippingLayer->setName("Child clipping Layer");
#endif
@@ -352,7 +365,6 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
}
} else if (m_clippingLayer) {
m_clippingLayer->removeFromParent();
- delete m_clippingLayer;
m_clippingLayer = 0;
layersChanged = true;
}
@@ -368,25 +380,61 @@ bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
bool layerChanged = false;
if (needsForegroundLayer) {
if (!m_foregroundLayer) {
- m_foregroundLayer = GraphicsLayer::createGraphicsLayer(this);
+ m_foregroundLayer = GraphicsLayer::create(this);
#ifndef NDEBUG
- m_foregroundLayer->setName("Contents");
+ m_foregroundLayer->setName("Foreground");
#endif
m_foregroundLayer->setDrawsContent(true);
- m_foregroundLayer->setDrawingPhase(GraphicsLayerPaintForegroundMask);
- m_graphicsLayer->setDrawingPhase(GraphicsLayerPaintBackgroundMask);
+ m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
layerChanged = true;
}
} else if (m_foregroundLayer) {
m_foregroundLayer->removeFromParent();
- delete m_foregroundLayer;
m_foregroundLayer = 0;
- m_graphicsLayer->setDrawingPhase(GraphicsLayerPaintAllMask);
layerChanged = true;
}
+
+ if (layerChanged)
+ m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
+
+ return layerChanged;
+}
+
+bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer)
+{
+ bool layerChanged = false;
+ if (needsMaskLayer) {
+ if (!m_maskLayer) {
+ m_maskLayer = GraphicsLayer::create(this);
+#ifndef NDEBUG
+ m_maskLayer->setName("Mask");
+#endif
+ m_maskLayer->setDrawsContent(true);
+ m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
+ layerChanged = true;
+ }
+ } else if (m_maskLayer) {
+ m_maskLayer = 0;
+ layerChanged = true;
+ }
+
+ if (layerChanged)
+ m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
+
return layerChanged;
}
+GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const
+{
+ unsigned phase = GraphicsLayerPaintBackground;
+ if (!m_foregroundLayer)
+ phase |= GraphicsLayerPaintForeground;
+ if (!m_maskLayer)
+ phase |= GraphicsLayerPaintMask;
+
+ return static_cast<GraphicsLayerPaintingPhase>(phase);
+}
+
float RenderLayerBacking::compositingOpacity(float rendererOpacity) const
{
float finalOpacity = rendererOpacity;
@@ -500,7 +548,7 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
// Now look at the body's renderer.
HTMLElement* body = renderObject->document()->body();
- RenderObject* bodyObject = (body && body->hasLocalName(HTMLNames::bodyTag)) ? body->renderer() : 0;
+ RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0;
if (!bodyObject)
return false;
@@ -705,13 +753,16 @@ void RenderLayerBacking::setContentsNeedDisplay()
if (m_foregroundLayer && m_foregroundLayer->drawsContent())
m_foregroundLayer->setNeedsDisplay();
+
+ if (m_maskLayer && m_maskLayer->drawsContent())
+ m_maskLayer->setNeedsDisplay();
}
// r is in the coordinate space of the layer's render object
void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r)
{
if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
- FloatPoint dirtyOrigin = contentsToGraphicsLayerCoordinates(m_graphicsLayer, FloatPoint(r.x(), r.y()));
+ FloatPoint dirtyOrigin = contentsToGraphicsLayerCoordinates(m_graphicsLayer.get(), FloatPoint(r.x(), r.y()));
FloatRect dirtyRect(dirtyOrigin, r.size());
FloatRect bounds(FloatPoint(), m_graphicsLayer->size());
if (bounds.intersects(dirtyRect))
@@ -722,6 +773,11 @@ void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r)
// FIXME: do incremental repaint
m_foregroundLayer->setNeedsDisplay();
}
+
+ if (m_maskLayer && m_maskLayer->drawsContent()) {
+ // FIXME: do incremental repaint
+ m_maskLayer->setNeedsDisplay();
+ }
}
static void setClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)
@@ -779,7 +835,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
bool shouldPaint = m_owningLayer->hasVisibleContent() && m_owningLayer->isSelfPaintingLayer();
- if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackgroundMask)) {
+ if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackground)) {
// If this is the root then we need to send in a bigger bounding box
// because we'll be painting the background as well (see RenderBox::paintRootBoxDecorations()).
IntRect paintBox = clipRectToApply;
@@ -823,7 +879,10 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
restoreClip(context, paintDirtyRect, damageRect);
}
- if (shouldPaint && (paintingPhase & GraphicsLayerPaintForegroundMask)) {
+ bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText;
+ bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText;
+
+ if (shouldPaint && (paintingPhase & GraphicsLayerPaintForeground)) {
// Now walk the sorted list of children with negative z-indices. Only RenderLayers without compositing layers will paint.
// FIXME: should these be painted as background?
Vector<RenderLayer*>* negZOrderList = m_owningLayer->negZOrderList();
@@ -832,9 +891,6 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot);
}
- bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText;
- bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText;
-
// Set up the clip used when painting our children.
setClip(context, paintDirtyRect, clipRectToApply);
RenderObject::PaintInfo paintInfo(context, clipRectToApply,
@@ -877,7 +933,9 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
for (Vector<RenderLayer*>::iterator it = posZOrderList->begin(); it != posZOrderList->end(); ++it)
it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot);
}
-
+ }
+
+ if (shouldPaint && (paintingPhase & GraphicsLayerPaintMask)) {
if (renderer()->hasMask() && !selectionOnly && !damageRect.isEmpty()) {
setClip(context, paintDirtyRect, damageRect);
@@ -894,7 +952,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
}
// Up-call from compositing layer drawing callback.
-void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase drawingPhase, const IntRect& clip)
+void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip)
{
// We have to use the same root as for hit testing, because both methods
// can compute and cache clipRects.
@@ -912,7 +970,7 @@ void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& co
IntRect dirtyRect = enclosingBBox;
dirtyRect.intersect(clipRect);
- paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintRestrictionNone, drawingPhase, renderer());
+ paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintRestrictionNone, paintingPhase, renderer());
}
bool RenderLayerBacking::startAnimation(double beginTime, const Animation* anim, const KeyframeList& keyframes)
diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h
index b027685..731e741 100644
--- a/WebCore/rendering/RenderLayerBacking.h
+++ b/WebCore/rendering/RenderLayerBacking.h
@@ -63,21 +63,23 @@ public:
// Update contents and clipping structure.
void updateInternalHierarchy(); // make private
- GraphicsLayer* graphicsLayer() const { return m_graphicsLayer; }
+ GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
// Layer to clip children
bool hasClippingLayer() const { return m_clippingLayer != 0; }
- GraphicsLayer* clippingLayer() const { return m_clippingLayer; }
+ GraphicsLayer* clippingLayer() const { return m_clippingLayer.get(); }
// Layer to get clipped by ancestor
bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != 0; }
- GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer; }
+ GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); }
bool hasContentsLayer() const { return m_foregroundLayer != 0; }
- GraphicsLayer* foregroundLayer() const { return m_foregroundLayer; }
+ GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); }
- GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer : m_graphicsLayer; }
- GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer : m_graphicsLayer; }
+ bool hasMaskLayer() const { return m_maskLayer != 0; }
+
+ GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer.get() : m_graphicsLayer.get(); }
+ GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer.get() : m_graphicsLayer.get(); }
// RenderLayers with backing normally short-circuit paintLayer() because
// their content is rendered via callbacks from GraphicsLayer. However, the document
@@ -127,7 +129,10 @@ private:
bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
bool updateForegroundLayer(bool needsForegroundLayer);
+ bool updateMaskLayer(bool needsMaskLayer);
+ GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
+
IntSize contentOffsetInCompostingLayer() const;
// Result is transform origin in pixels.
FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
@@ -162,10 +167,11 @@ private:
private:
RenderLayer* m_owningLayer;
- GraphicsLayer* m_ancestorClippingLayer; // only used if we are clipped by an ancestor which is not a stacking context
- GraphicsLayer* m_graphicsLayer;
- GraphicsLayer* m_foregroundLayer; // only used in cases where we need to draw the foreground separately
- GraphicsLayer* m_clippingLayer; // only used if we have clipping on a stacking context, with compositing children
+ OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // only used if we are clipped by an ancestor which is not a stacking context
+ OwnPtr<GraphicsLayer> m_graphicsLayer;
+ OwnPtr<GraphicsLayer> m_foregroundLayer; // only used in cases where we need to draw the foreground separately
+ OwnPtr<GraphicsLayer> m_clippingLayer; // only used if we have clipping on a stacking context, with compositing children
+ OwnPtr<GraphicsLayer> m_maskLayer; // only used if we have a mask
IntRect m_compositedBounds;
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index fb15800..10da951 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -92,7 +92,6 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView)
RenderLayerCompositor::~RenderLayerCompositor()
{
ASSERT(!m_rootLayerAttached);
- delete m_rootPlatformLayer;
}
void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */)
@@ -503,8 +502,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
// If we have a software transform, and we have layers under us, we need to also
// be composited. Also, if we have opacity < 1, then we need to be a layer so that
// the child layers are opaque, then rendered with opacity on this layer.
- if (childState.m_subtreeIsCompositing &&
- (layer->renderer()->hasTransform() || layer->renderer()->style()->opacity() < 1)) {
+ if (childState.m_subtreeIsCompositing && requiresCompositingWhenDescendantsAreCompositing(layer->renderer())) {
layer->setMustOverlapCompositedLayers(true);
if (overlapMap)
addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
@@ -573,7 +571,7 @@ bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const
{
// FIXME: ideally we need to look at all ancestors for mask or video. But for now,
// just bail on the obvious cases.
- if (o->hasMask() || o->hasReflection() || !m_hasAcceleratedCompositing)
+ if (o->hasReflection() || !m_hasAcceleratedCompositing)
return false;
return o->supportsAcceleratedRendering();
@@ -632,10 +630,10 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru
}
if (updateHierarchy && layerBacking && layerBacking->foregroundLayer()) {
- // we only have a contents layer if we have an m_layer
layerBacking->foregroundLayer()->removeFromParent();
-
- GraphicsLayer* hostingLayer = layerBacking->clippingLayer() ? layerBacking->clippingLayer() : layerBacking->graphicsLayer();
+
+ // The foreground layer has to be correctly sorted with child layers, so needs to become a child of the clipping layer.
+ GraphicsLayer* hostingLayer = layerBacking->parentForSublayers();
hostingLayer->addChild(layerBacking->foregroundLayer());
}
}
@@ -759,7 +757,7 @@ RenderLayer* RenderLayerCompositor::rootRenderLayer() const
GraphicsLayer* RenderLayerCompositor::rootPlatformLayer() const
{
- return m_rootPlatformLayer;
+ return m_rootPlatformLayer.get();
}
void RenderLayerCompositor::didMoveOnscreen()
@@ -772,7 +770,7 @@ void RenderLayerCompositor::didMoveOnscreen()
if (!page)
return;
- page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer);
+ page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer.get());
m_rootLayerAttached = true;
}
@@ -906,6 +904,11 @@ bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* render
return false;
}
+bool RenderLayerCompositor::requiresCompositingWhenDescendantsAreCompositing(RenderObject* renderer) const
+{
+ return renderer->hasTransform() || renderer->isTransparent() || renderer->hasMask();
+}
+
// If an element has negative z-index children, those children render in front of the
// layer background, so we need an extra 'contents' layer for the foreground of the layer
// object.
@@ -919,7 +922,7 @@ void RenderLayerCompositor::ensureRootPlatformLayer()
if (m_rootPlatformLayer)
return;
- m_rootPlatformLayer = GraphicsLayer::createGraphicsLayer(0);
+ m_rootPlatformLayer = GraphicsLayer::create(0);
m_rootPlatformLayer->setSize(FloatSize(m_renderView->overflowWidth(), m_renderView->overflowHeight()));
m_rootPlatformLayer->setPosition(FloatPoint(0, 0));
// The root layer does flipping if we need it on this platform.
@@ -937,7 +940,6 @@ void RenderLayerCompositor::destroyRootPlatformLayer()
return;
willMoveOffscreen();
- delete m_rootPlatformLayer;
m_rootPlatformLayer = 0;
}
diff --git a/WebCore/rendering/RenderLayerCompositor.h b/WebCore/rendering/RenderLayerCompositor.h
index 02929dc..8dd689c 100644
--- a/WebCore/rendering/RenderLayerCompositor.h
+++ b/WebCore/rendering/RenderLayerCompositor.h
@@ -164,10 +164,11 @@ private:
bool requiresCompositingForAnimation(RenderObject*) const;
bool requiresCompositingForTransform(RenderObject*) const;
bool requiresCompositingForVideo(RenderObject*) const;
+ bool requiresCompositingWhenDescendantsAreCompositing(RenderObject*) const;
private:
RenderView* m_renderView;
- GraphicsLayer* m_rootPlatformLayer;
+ OwnPtr<GraphicsLayer> m_rootPlatformLayer;
bool m_hasAcceleratedCompositing;
bool m_compositingConsultsOverlap;
bool m_compositing;
diff --git a/WebCore/rendering/RenderListItem.h b/WebCore/rendering/RenderListItem.h
index 21544f9..c4c41dc 100644
--- a/WebCore/rendering/RenderListItem.h
+++ b/WebCore/rendering/RenderListItem.h
@@ -44,6 +44,8 @@ public:
void setNotInList(bool notInList) { m_notInList = notInList; }
bool notInList() const { return m_notInList; }
+ const String& markerText() const;
+
private:
virtual const char* renderName() const { return "RenderListItem"; }
@@ -59,8 +61,6 @@ private:
virtual void positionListMarker();
- const String& markerText() const;
-
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
void updateMarkerLocation();
diff --git a/WebCore/rendering/RenderMarquee.cpp b/WebCore/rendering/RenderMarquee.cpp
index 31a8305..bb917f8 100644
--- a/WebCore/rendering/RenderMarquee.cpp
+++ b/WebCore/rendering/RenderMarquee.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* Portions are Copyright (C) 1998 Netscape Communications Corporation.
*
@@ -152,7 +153,11 @@ int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge
void RenderMarquee::start()
{
- if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero())
+ if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero()
+#if ENABLE(WCSS) && ENABLE(XHTMLMP)
+ || (m_layer->renderer()->document()->isXHTMLMPDocument() && !m_layer->renderer()->style()->marqueeLoopCount())
+#endif
+ )
return;
// We may end up propagating a scroll event. It is important that we suspend events until
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index 5137338..728ff7a 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -4,6 +4,7 @@
* (C) 2000 Dirk Mueller (mueller@kde.org)
* (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
* Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -145,6 +146,12 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style)
o = new (arena) RenderTableCell(node);
break;
case TABLE_CAPTION:
+#if ENABLE(WCSS)
+ // As per the section 17.1 of the spec WAP-239-WCSS-20011026-a.pdf,
+ // the marquee box inherits and extends the characteristics of the
+ // principal block box ([CSS2] section 9.2.1).
+ case WAP_MARQUEE:
+#endif
o = new (arena) RenderBlock(node);
break;
case BOX:
@@ -1612,15 +1619,20 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*)
void RenderObject::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers)
{
- // FIXME: This will be slow when a large number of images is used. Fix by using a dict.
- for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) {
- if (currOld->image() && (!newLayers || !newLayers->containsImage(currOld->image())))
- currOld->image()->removeClient(this);
- }
+ // Optimize the common case
+ if (oldLayers && !oldLayers->next() && newLayers && !newLayers->next() && (oldLayers->image() == newLayers->image()))
+ return;
+
+ // Go through the new layers and addClients first, to avoid removing all clients of an image.
for (const FillLayer* currNew = newLayers; currNew; currNew = currNew->next()) {
- if (currNew->image() && (!oldLayers || !oldLayers->containsImage(currNew->image())))
+ if (currNew->image())
currNew->image()->addClient(this);
}
+
+ for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) {
+ if (currOld->image())
+ currOld->image()->removeClient(this);
+ }
}
void RenderObject::updateImage(StyleImage* oldImage, StyleImage* newImage)
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index 911169d..eb558f6 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -285,6 +285,9 @@ public:
bool isHTMLMarquee() const;
+ inline bool isAfterContent() const;
+ static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); }
+
bool childrenInline() const { return m_childrenInline; }
void setChildrenInline(bool b = true) { m_childrenInline = b; }
bool hasColumns() const { return m_hasColumns; }
@@ -858,6 +861,16 @@ inline bool RenderObject::documentBeingDestroyed() const
return !document()->renderer();
}
+inline bool RenderObject::isAfterContent() const
+{
+ if (style()->styleType() != AFTER)
+ return false;
+ // Text nodes don't have their own styles, so ignore the style on a text node.
+ if (isText() && !isBR())
+ return false;
+ return true;
+}
+
inline void RenderObject::setNeedsLayout(bool b, bool markParents)
{
bool alreadyNeededLayout = m_needsLayout;
diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp
index 692a66e..0ab11b6 100644
--- a/WebCore/rendering/RenderReplaced.cpp
+++ b/WebCore/rendering/RenderReplaced.cpp
@@ -66,7 +66,7 @@ void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* old
bool hadStyle = (oldStyle != 0);
float oldZoom = hadStyle ? oldStyle->effectiveZoom() : RenderStyle::initialZoom();
- if (hadStyle && style() && style()->effectiveZoom() != oldZoom)
+ if (style() && style()->effectiveZoom() != oldZoom)
intrinsicSizeChanged();
}
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index 7599999..ebd7fbe 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -456,26 +456,7 @@ void RenderTable::layout()
// FIXME: Only pass true if width or height changed.
layoutPositionedObjects(true);
- if (!hasOverflowClip()) {
- int shadowLeft;
- int shadowRight;
- int shadowTop;
- int shadowBottom;
- style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
-
- m_overflowLeft = min(m_overflowLeft, shadowLeft);
- m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
- m_overflowTop = min(m_overflowTop, shadowTop);
- m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
-
- if (hasReflection()) {
- IntRect reflection(reflectionBox());
- m_overflowTop = min(m_overflowTop, reflection.y());
- m_overflowHeight = max(m_overflowHeight, reflection.bottom());
- m_overflowLeft = min(m_overflowLeft, reflection.x());
- m_overflowHeight = max(m_overflowWidth, reflection.right());
- }
- }
+ updateOverflowWithShadowAndReflection();
statePusher.pop();
diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp
index ada3961..383a394 100644
--- a/WebCore/rendering/RenderText.cpp
+++ b/WebCore/rendering/RenderText.cpp
@@ -207,7 +207,7 @@ void RenderText::deleteTextBoxes()
PassRefPtr<StringImpl> RenderText::originalText() const
{
Node* e = node();
- return e ? static_cast<Text*>(e)->string() : 0;
+ return e ? static_cast<Text*>(e)->dataImpl() : 0;
}
void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
diff --git a/WebCore/rendering/RenderTextFragment.cpp b/WebCore/rendering/RenderTextFragment.cpp
index 7da9e5a..9ff1106 100644
--- a/WebCore/rendering/RenderTextFragment.cpp
+++ b/WebCore/rendering/RenderTextFragment.cpp
@@ -47,7 +47,7 @@ RenderTextFragment::RenderTextFragment(Node* node, StringImpl* str)
PassRefPtr<StringImpl> RenderTextFragment::originalText() const
{
Node* e = node();
- RefPtr<StringImpl> result = (e ? static_cast<Text*>(e)->string() : contentString());
+ RefPtr<StringImpl> result = (e ? static_cast<Text*>(e)->dataImpl() : contentString());
if (result && (start() > 0 || start() < result->length()))
result = result->substring(start(), end());
return result.release();
@@ -76,7 +76,7 @@ UChar RenderTextFragment::previousCharacter()
{
if (start()) {
Node* e = node();
- StringImpl* original = (e ? static_cast<Text*>(e)->string() : contentString());
+ StringImpl* original = (e ? static_cast<Text*>(e)->dataImpl() : contentString());
if (original)
return (*original)[start() - 1];
}
diff --git a/WebCore/rendering/RenderThemeChromiumMac.h b/WebCore/rendering/RenderThemeChromiumMac.h
index ffb2548..0c417a2 100644
--- a/WebCore/rendering/RenderThemeChromiumMac.h
+++ b/WebCore/rendering/RenderThemeChromiumMac.h
@@ -156,6 +156,7 @@ namespace WebCore {
IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const;
void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const;
+ void updateActiveState(NSCell*, const RenderObject*);
void updateCheckedState(NSCell*, const RenderObject*);
void updateEnabledState(NSCell*, const RenderObject*);
void updateFocusedState(NSCell*, const RenderObject*);
diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm
index 23201c9..42e2aca 100644
--- a/WebCore/rendering/RenderThemeChromiumMac.mm
+++ b/WebCore/rendering/RenderThemeChromiumMac.mm
@@ -549,6 +549,25 @@ IntRect RenderThemeChromiumMac::inflateRect(const IntRect& r, const IntSize& siz
return result;
}
+// Updates the control tint (a.k.a. active state) of |cell| (from |o|).
+// In the Chromium port, the renderer runs as a background process and controls'
+// NSCell(s) lack a parent NSView. Therefore controls don't have their tint
+// color updated correctly when the application is activated/deactivated.
+// FocusController's setActive() is called when the application is
+// activated/deactivated, which causes a repaint at which time this code is
+// called.
+// This function should be called before drawing any NSCell-derived controls,
+// unless you're sure it isn't needed.
+void RenderThemeChromiumMac::updateActiveState(NSCell* cell, const RenderObject* o)
+{
+ NSControlTint oldTint = [cell controlTint];
+ NSControlTint tint = isActive(o) ? [NSColor currentControlTint] :
+ NSClearControlTint;
+
+ if (tint != oldTint)
+ [cell setControlTint:tint];
+}
+
void RenderThemeChromiumMac::updateCheckedState(NSCell* cell, const RenderObject* o)
{
bool oldIndeterminate = [cell state] == NSMixedState;
@@ -765,6 +784,7 @@ void RenderThemeChromiumMac::setCheckboxCellState(const RenderObject* o, const I
setControlSize(checkbox, checkboxSizes(), r.size(), o->style()->effectiveZoom());
// Update the various states we respond to.
+ updateActiveState(checkbox, o);
updateCheckedState(checkbox, o);
updateEnabledState(checkbox, o);
updatePressedState(checkbox, o);
@@ -846,6 +866,7 @@ void RenderThemeChromiumMac::setRadioCellState(const RenderObject* o, const IntR
setControlSize(radio, radioSizes(), r.size(), o->style()->effectiveZoom());
// Update the various states we respond to.
+ updateActiveState(radio, o);
updateCheckedState(radio, o);
updateEnabledState(radio, o);
updatePressedState(radio, o);
@@ -976,6 +997,7 @@ void RenderThemeChromiumMac::setButtonCellState(const RenderObject* o, const Int
[button setKeyEquivalent:(isDefaultButton ? @"\r" : @"")];
// Update the various states we respond to.
+ updateActiveState(button, o);
updateCheckedState(button, o);
updateEnabledState(button, o);
updatePressedState(button, o);
@@ -1414,6 +1436,7 @@ void RenderThemeChromiumMac::setPopupButtonCellState(const RenderObject* o, cons
setControlSize(popupButton, popupButtonSizes(), r.size(), o->style()->effectiveZoom());
// Update the various states we respond to.
+ updateActiveState(popupButton, o);
updateCheckedState(popupButton, o);
updateEnabledState(popupButton, o);
updatePressedState(popupButton, o);
@@ -1496,6 +1519,7 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec
LocalCurrentGraphicsContext localContext(paintInfo.context);
// Update the various states we respond to.
+ updateActiveState(sliderThumbCell, o);
updateEnabledState(sliderThumbCell, o->parent());
updateFocusedState(sliderThumbCell, o->parent());
@@ -1607,6 +1631,7 @@ void RenderThemeChromiumMac::setSearchCellState(RenderObject* o, const IntRect&
[search setControlSize:controlSizeForFont(o->style())];
// Update the various states we respond to.
+ updateActiveState(search, o);
updateEnabledState(search, o);
updateFocusedState(search, o);
}
@@ -1667,6 +1692,7 @@ bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const
NSSearchFieldCell* search = this->search();
+ updateActiveState([search cancelButtonCell], o);
updatePressedState([search cancelButtonCell], o);
paintInfo.context->save();
@@ -1742,6 +1768,8 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o,
NSSearchFieldCell* search = this->search();
+ updateActiveState([search searchButtonCell], o);
+
if ([search searchMenuTemplate] != nil)
[search setSearchMenuTemplate:nil];
@@ -1769,6 +1797,8 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons
NSSearchFieldCell* search = this->search();
+ updateActiveState([search searchButtonCell], o);
+
if (![search searchMenuTemplate])
[search setSearchMenuTemplate:searchMenuTemplate()];
diff --git a/WebCore/rendering/RenderThemeChromiumSkia.cpp b/WebCore/rendering/RenderThemeChromiumSkia.cpp
index 79804ac..c8875dc 100644
--- a/WebCore/rendering/RenderThemeChromiumSkia.cpp
+++ b/WebCore/rendering/RenderThemeChromiumSkia.cpp
@@ -610,6 +610,10 @@ bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const R
static Image* mediaPlay = Image::loadPlatformResource("mediaPlay").releaseRef();
static Image* mediaPause = Image::loadPlatformResource("mediaPause").releaseRef();
+ static Image* mediaPlayDisabled = Image::loadPlatformResource("mediaPlayDisabled").releaseRef();
+
+ if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE)
+ return paintMediaButtonInternal(paintInfo.context, rect, mediaPlayDisabled);
return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause);
#else
diff --git a/WebCore/rendering/style/FillLayer.h b/WebCore/rendering/style/FillLayer.h
index c3944ad..aad7900 100644
--- a/WebCore/rendering/style/FillLayer.h
+++ b/WebCore/rendering/style/FillLayer.h
@@ -63,14 +63,14 @@ public:
bool isSizeSet() const { return m_sizeSet; }
void setImage(StyleImage* i) { m_image = i; m_imageSet = true; }
- void setXPosition(const Length& l) { m_xPosition = l; m_xPosSet = true; }
- void setYPosition(const Length& l) { m_yPosition = l; m_yPosSet = true; }
+ void setXPosition(Length l) { m_xPosition = l; m_xPosSet = true; }
+ void setYPosition(Length l) { m_yPosition = l; m_yPosSet = true; }
void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; }
void setClip(EFillBox b) { m_clip = b; m_clipSet = true; }
void setOrigin(EFillBox b) { m_origin = b; m_originSet = true; }
void setRepeat(EFillRepeat r) { m_repeat = r; m_repeatSet = true; }
void setComposite(CompositeOperator c) { m_composite = c; m_compositeSet = true; }
- void setSize(const LengthSize& b) { m_size = b; m_sizeSet = true; }
+ void setSize(LengthSize b) { m_size = b; m_sizeSet = true; }
void clearImage() { m_imageSet = false; }
void clearXPosition() { m_xPosSet = false; }
diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h
index c491816..013d335 100644
--- a/WebCore/rendering/style/RenderStyleConstants.h
+++ b/WebCore/rendering/style/RenderStyleConstants.h
@@ -4,6 +4,7 @@
* (C) 2000 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -298,7 +299,11 @@ enum EDisplay {
TABLE, INLINE_TABLE, TABLE_ROW_GROUP,
TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW,
TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL,
- TABLE_CAPTION, BOX, INLINE_BOX, NONE
+ TABLE_CAPTION, BOX, INLINE_BOX,
+#if ENABLE(WCSS)
+ WAP_MARQUEE,
+#endif
+ NONE
};
enum EPointerEvents {