diff options
| author | Steve Block <steveblock@google.com> | 2009-11-05 09:23:40 +0000 |
|---|---|---|
| committer | Steve Block <steveblock@google.com> | 2009-11-10 22:41:12 +0000 |
| commit | cac0f67c402d107cdb10971b95719e2ff9c7c76b (patch) | |
| tree | d182c7f87211c6f201a5f038e332336493ebdbe7 /WebCore/rendering | |
| parent | 4b2ef0f288e7c6c4602f621b7a0e9feed304b70e (diff) | |
| download | external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.zip external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.gz external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.bz2 | |
Merge webkit.org at r50258 : Initial merge by git.
Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0
Diffstat (limited to 'WebCore/rendering')
30 files changed, 308 insertions, 88 deletions
diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index 0aaddc9..50933c6 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -123,17 +123,6 @@ Frame* HitTestResult::targetFrame() const return frame->tree()->find(m_innerURLElement->target()); } -IntRect HitTestResult::boundingBox() const -{ - if (m_innerNonSharedNode) { - RenderObject* renderer = m_innerNonSharedNode->renderer(); - if (renderer) - return renderer->absoluteBoundingBoxRect(); - } - - return IntRect(); -} - bool HitTestResult::isSelected() const { if (!m_innerNonSharedNode) @@ -246,7 +235,7 @@ IntRect HitTestResult::imageRect() const { if (!image()) return IntRect(); - return m_innerNonSharedNode->renderBox()->absoluteContentBox(); + return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBoundingBox(); } KURL HitTestResult::absoluteImageURL() const diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h index f29ca41..25e1058 100644 --- a/WebCore/rendering/HitTestResult.h +++ b/WebCore/rendering/HitTestResult.h @@ -63,7 +63,6 @@ public: void setIsOverWidget(bool b) { m_isOverWidget = b; } Frame* targetFrame() const; - IntRect boundingBox() const; bool isSelected() const; String spellingToolTip(TextDirection&) const; String replacedString() const; diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index 143d3d8..baea956 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -429,7 +429,7 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi } lineHeight = baseline + baselineToBottom; } else if (parentLineHeight.isPercent()) { - lineHeight = parentLineHeight.calcMinValue(curr->renderer()->style()->fontSize()); + lineHeight = parentLineHeight.calcMinValue(curr->renderer()->style()->fontSize(), true); baseline = 0; for (size_t i = 0; i < usedFonts.size(); ++i) { int halfLeading = (lineHeight - usedFonts[i]->ascent() - usedFonts[i]->descent()) / 2; diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 73b9a3a..9611660 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -646,6 +646,15 @@ void MediaControlVolumeSliderElement::defaultEventHandler(Event* event) } } +void MediaControlVolumeSliderElement::update() +{ + float volume = m_mediaElement->volume(); + if (value().toFloat() != volume) { + setValue(String::number(volume)); + MediaControlInputElement::update(); + } +} + // ---------------------------- MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* document, HTMLMediaElement* element) diff --git a/WebCore/rendering/MediaControlElements.h b/WebCore/rendering/MediaControlElements.h index e562bb5..8b29773 100644 --- a/WebCore/rendering/MediaControlElements.h +++ b/WebCore/rendering/MediaControlElements.h @@ -234,6 +234,7 @@ class MediaControlVolumeSliderElement : public MediaControlInputElement { public: MediaControlVolumeSliderElement(Document*, HTMLMediaElement*); virtual void defaultEventHandler(Event*); + virtual void update(); }; // ---------------------------- diff --git a/WebCore/rendering/RenderBR.cpp b/WebCore/rendering/RenderBR.cpp index f407099..e05c8b4 100644 --- a/WebCore/rendering/RenderBR.cpp +++ b/WebCore/rendering/RenderBR.cpp @@ -64,7 +64,7 @@ int RenderBR::lineHeight(bool firstLine, bool /*isRootLineBox*/) const return s->font().lineSpacing(); } if (lh.isPercent()) - return lh.calcMinValue(s->fontSize()); + return lh.calcMinValue(s->fontSize(), true); return lh.value(); } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 83f9624..8e0f3b7 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -145,6 +145,8 @@ void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyl markContainingBlocksForLayout(); if (style()->position() == StaticPosition) repaint(); + else if (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition) + parent()->setChildNeedsLayout(true); if (isFloating() && !isPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition)) removeFloatingOrPositionedChildFromBlockLists(); } diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h index 897d9b3..c579123 100644 --- a/WebCore/rendering/RenderBox.h +++ b/WebCore/rendering/RenderBox.h @@ -318,7 +318,7 @@ protected: virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } - virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; + virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&) const; virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; private: diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 1f79e50..ff7c9c9 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -231,7 +231,7 @@ bool RenderImage::setImageSizeForAltText(CachedImage* newImage /* = 0 */) imageHeight = paddingHeight; } - if (newImage) { + if (newImage && newImage->image()) { // imageSize() returns 0 for the error image. We need the true size of the // error image, so we have to get it by grabbing image() directly. imageWidth += newImage->image()->width() * style()->effectiveZoom(); diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp index 05d29d0..0302113 100644 --- a/WebCore/rendering/RenderInline.cpp +++ b/WebCore/rendering/RenderInline.cpp @@ -30,6 +30,7 @@ #include "RenderArena.h" #include "RenderBlock.h" #include "RenderView.h" +#include "TransformState.h" #include "VisiblePosition.h" #if ENABLE(DASHBOARD_SUPPORT) @@ -705,6 +706,92 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, o->computeRectForRepaint(repaintContainer, rect, fixed); } +IntSize RenderInline::offsetFromContainer(RenderObject* container) const +{ + ASSERT(container == this->container()); + + IntSize offset; + if (isRelPositioned()) + offset += relativePositionOffset(); + + if (!isInline() || isReplaced()) { + RenderBlock* cb; + if (container->isBlockFlow() && (cb = toRenderBlock(container))->hasColumns()) { + IntRect rect(0, 0, 1, 1); + cb->adjustRectForColumns(rect); + } + } + + if (container->hasOverflowClip()) + offset -= toRenderBox(container)->layer()->scrolledContentOffset(); + + return offset; +} + +void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const +{ + if (repaintContainer == this) + return; + + if (RenderView *v = view()) { + if (v->layoutStateEnabled() && !repaintContainer) { + LayoutState* layoutState = v->layoutState(); + IntSize offset = layoutState->m_offset; + if (style()->position() == RelativePosition && layer()) + offset += layer()->relativePositionOffset(); + transformState.move(offset); + return; + } + } + + bool containerSkipped; + RenderObject* o = container(repaintContainer, &containerSkipped); + if (!o) + return; + + IntSize containerOffset = offsetFromContainer(o); + + bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); + if (useTransforms && shouldUseTransformFromContainer(o)) { + TransformationMatrix t; + getTransformFromContainer(o, containerOffset, t); + transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + } else + transformState.move(containerOffset.width(), containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + + if (containerSkipped) { + // There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe + // to just subtract the delta between the repaintContainer and o. + IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o); + transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + return; + } + + o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState); +} + +void RenderInline::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const +{ + // We don't expect this function to be called during layout. + ASSERT(!view() || !view()->layoutStateEnabled()); + + RenderObject* o = container(); + if (!o) + return; + + o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState); + + IntSize containerOffset = offsetFromContainer(o); + + bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D()); + if (useTransforms && shouldUseTransformFromContainer(o)) { + TransformationMatrix t; + getTransformFromContainer(o, containerOffset, t); + transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); + } else + transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform); +} + void RenderInline::updateDragState(bool dragOn) { RenderBoxModelObject::updateDragState(dragOn); diff --git a/WebCore/rendering/RenderInline.h b/WebCore/rendering/RenderInline.h index 8e0064e..8e9715c 100644 --- a/WebCore/rendering/RenderInline.h +++ b/WebCore/rendering/RenderInline.h @@ -44,6 +44,8 @@ public: virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); virtual void absoluteQuads(Vector<FloatQuad>&); + virtual IntSize offsetFromContainer(RenderObject*) const; + IntRect linesBoundingBox() const; IntRect linesVisibleOverflowBoundingBox() const; @@ -107,6 +109,9 @@ private: virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth); virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed); + virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&) const; + virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; + virtual VisiblePosition positionForPoint(const IntPoint&); virtual IntRect borderBoundingBox() const diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 7a8b428..8f2805a 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -311,12 +311,19 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags) if (m_reflection) m_reflection->layout(); +#if USE(ACCELERATED_COMPOSITING) + // Clear the IsCompositingUpdateRoot flag once we've found the first compositing layer in this update. + bool isUpdateRoot = (flags & IsCompositingUpdateRoot); + if (isComposited()) + flags &= ~IsCompositingUpdateRoot; +#endif + for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) child->updateLayerPositions(flags); #if USE(ACCELERATED_COMPOSITING) if ((flags & UpdateCompositingLayers) && isComposited()) - backing()->updateAfterLayout(RenderLayerBacking::CompositingChildren); + backing()->updateAfterLayout(RenderLayerBacking::CompositingChildren, isUpdateRoot); #endif // With all our children positioned, now update our marquee if we need to. @@ -1139,8 +1146,10 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai #if USE(ACCELERATED_COMPOSITING) if (compositor()->inCompositingMode()) { - if (RenderLayer* compositingAncestor = ancestorCompositingLayer()) - compositingAncestor->backing()->updateAfterLayout(RenderLayerBacking::AllDescendants); + if (RenderLayer* compositingAncestor = ancestorCompositingLayer()) { + bool isUpdateRoot = true; + compositingAncestor->backing()->updateAfterLayout(RenderLayerBacking::AllDescendants, isUpdateRoot); + } } #endif diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h index 9d2212b..a274638 100644 --- a/WebCore/rendering/RenderLayer.h +++ b/WebCore/rendering/RenderLayer.h @@ -298,10 +298,11 @@ public: enum UpdateLayerPositionsFlag { DoFullRepaint = 1, CheckForRepaint = 1 << 1, - UpdateCompositingLayers = 1 << 2, + IsCompositingUpdateRoot = 1 << 2, + UpdateCompositingLayers = 1 << 3, }; typedef unsigned UpdateLayerPositionsFlags; - void updateLayerPositions(UpdateLayerPositionsFlags = DoFullRepaint | UpdateCompositingLayers); + void updateLayerPositions(UpdateLayerPositionsFlags = DoFullRepaint | IsCompositingUpdateRoot | UpdateCompositingLayers); void updateTransform(); @@ -327,6 +328,7 @@ public: Vector<RenderLayer*>* normalFlowList() const { return m_normalFlowList; } bool hasVisibleContent() const { return m_hasVisibleContent; } + bool hasVisibleDescendant() const { return m_hasVisibleDescendant; } void setHasVisibleContent(bool); void dirtyVisibleContentStatus(); diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index 941817c..d7248d4 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -89,8 +89,8 @@ void RenderLayerBacking::createGraphicsLayer() m_graphicsLayer->setName("Anonymous Node"); #endif // NDEBUG - updateLayerOpacity(); - updateLayerTransform(); + updateLayerOpacity(renderer()->style()); + updateLayerTransform(renderer()->style()); } void RenderLayerBacking::destroyGraphicsLayer() @@ -104,15 +104,13 @@ void RenderLayerBacking::destroyGraphicsLayer() m_maskLayer = 0; } -void RenderLayerBacking::updateLayerOpacity() +void RenderLayerBacking::updateLayerOpacity(const RenderStyle* style) { - m_graphicsLayer->setOpacity(compositingOpacity(renderer()->opacity())); + m_graphicsLayer->setOpacity(compositingOpacity(style->opacity())); } -void RenderLayerBacking::updateLayerTransform() +void RenderLayerBacking::updateLayerTransform(const RenderStyle* style) { - RenderStyle* style = renderer()->style(); - // FIXME: This could use m_owningLayer->transform(), but that currently has transform-origin // baked into it, and we don't want that. TransformationMatrix t; @@ -148,7 +146,7 @@ void RenderLayerBacking::updateCompositedBounds() setCompositedBounds(layerBounds); } -void RenderLayerBacking::updateAfterLayout(UpdateDepth updateDepth) +void RenderLayerBacking::updateAfterLayout(UpdateDepth updateDepth, bool isUpdateRoot) { RenderLayerCompositor* layerCompositor = compositor(); if (!layerCompositor->compositingLayersNeedRebuild()) { @@ -162,7 +160,7 @@ void RenderLayerBacking::updateAfterLayout(UpdateDepth updateDepth) updateCompositedBounds(); layerCompositor->updateCompositingDescendantGeometry(m_owningLayer, m_owningLayer, updateDepth); - if (!m_owningLayer->parent()) { + if (isUpdateRoot) { updateGraphicsLayerGeometry(); layerCompositor->updateRootLayerPosition(); } @@ -219,11 +217,11 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() // Set transform property, if it is not animating. We have to do this here because the transform // is affected by the layer dimensions. if (!renderer()->animation()->isAnimatingPropertyOnRenderer(renderer(), CSSPropertyWebkitTransform)) - updateLayerTransform(); + updateLayerTransform(renderer()->style()); // Set opacity, if it is not animating. if (!renderer()->animation()->isAnimatingPropertyOnRenderer(renderer(), CSSPropertyOpacity)) - updateLayerOpacity(); + updateLayerOpacity(renderer()->style()); RenderStyle* style = renderer()->style(); m_graphicsLayer->setPreserves3D(style->transformStyle3D() == TransformStyle3DPreserve3D); @@ -886,7 +884,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* if (paintingRoot && !renderer()->isDescendantOf(paintingRoot)) paintingRootForRenderer = paintingRoot; - bool shouldPaint = m_owningLayer->hasVisibleContent() && m_owningLayer->isSelfPaintingLayer(); + bool shouldPaint = (m_owningLayer->hasVisibleContent() || m_owningLayer->hasVisibleDescendant()) && m_owningLayer->isSelfPaintingLayer(); if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackground)) { // If this is the root then we need to send in a bigger bounding box @@ -1082,8 +1080,11 @@ bool RenderLayerBacking::startTransition(double beginTime, int property, const R opacityVector.insert(new FloatAnimationValue(0, compositingOpacity(fromStyle->opacity()))); opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity()))); // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here. - if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, String(), beginTime)) + if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, String(), beginTime)) { + // To ensure that the correct opacity is visible when the animation ends, also set the final opacity. + updateLayerOpacity(toStyle); didAnimate = true; + } } } @@ -1093,8 +1094,11 @@ bool RenderLayerBacking::startTransition(double beginTime, int property, const R KeyframeValueList transformVector(AnimatedPropertyWebkitTransform); transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform())); transformVector.insert(new TransformAnimationValue(1, &toStyle->transform())); - if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, String(), beginTime)) + if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, String(), beginTime)) { + // To ensure that the correct transform is visible when the animation ends, also set the final opacity. + updateLayerTransform(toStyle); didAnimate = true; + } } } diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h index e12aa58..17bcaf7 100644 --- a/WebCore/rendering/RenderLayerBacking.h +++ b/WebCore/rendering/RenderLayerBacking.h @@ -54,7 +54,7 @@ public: RenderLayer* owningLayer() const { return m_owningLayer; } enum UpdateDepth { CompositingChildren, AllDescendants }; - void updateAfterLayout(UpdateDepth); + void updateAfterLayout(UpdateDepth, bool isUpdateRoot); // Returns true if layer configuration changed. bool updateGraphicsLayerConfiguration(); @@ -140,8 +140,8 @@ private: // Result is perspective origin in pixels. FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const; - void updateLayerOpacity(); - void updateLayerTransform(); + void updateLayerOpacity(const RenderStyle*); + void updateLayerTransform(const RenderStyle*); // Return the opacity value that this layer should use for compositing. float compositingOpacity(float rendererOpacity) const; diff --git a/WebCore/rendering/RenderMedia.cpp b/WebCore/rendering/RenderMedia.cpp index 1da2628..1d4da23 100644 --- a/WebCore/rendering/RenderMedia.cpp +++ b/WebCore/rendering/RenderMedia.cpp @@ -258,6 +258,7 @@ void RenderMedia::createVolumeSlider() m_volumeSlider = new MediaControlVolumeSliderElement(document(), mediaElement()); m_volumeSlider->setAttribute(precisionAttr, "float"); m_volumeSlider->setAttribute(maxAttr, "1"); + m_volumeSlider->setAttribute(valueAttr, String::number(mediaElement()->volume())); m_volumeSlider->attachToParent(m_volumeSliderContainer.get()); } diff --git a/WebCore/rendering/RenderMediaControls.cpp b/WebCore/rendering/RenderMediaControls.cpp index 4303aaa..9cc1493 100644 --- a/WebCore/rendering/RenderMediaControls.cpp +++ b/WebCore/rendering/RenderMediaControls.cpp @@ -37,7 +37,7 @@ using namespace std; namespace WebCore { -#if !defined(NDEBUG) && defined(USE_DEBUG_SAFARI_THEME) +#ifdef DEBUG_ALL SOFT_LINK_DEBUG_LIBRARY(SafariTheme) #else SOFT_LINK_LIBRARY(SafariTheme) diff --git a/WebCore/rendering/RenderMediaControlsChromium.cpp b/WebCore/rendering/RenderMediaControlsChromium.cpp index bba2fa2..56fbec4 100644 --- a/WebCore/rendering/RenderMediaControlsChromium.cpp +++ b/WebCore/rendering/RenderMediaControlsChromium.cpp @@ -54,14 +54,16 @@ static Image* platformResource(const char* name) return 0; } +static bool hasSource(const HTMLMediaElement* mediaElement) +{ + return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY + && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE; +} + static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Image* image) { - // Create a destination rectangle for the image that is centered in the drawing rectangle, rounded left, and down. IntRect imageRect = image->rect(); - imageRect.setY(rect.y() + (rect.height() - image->height() + 1) / 2); - imageRect.setX(rect.x() + (rect.width() - image->width() + 1) / 2); - - context->drawImage(image, imageRect); + context->drawImage(image, rect); return true; } @@ -75,7 +77,7 @@ static bool paintMediaMuteButton(RenderObject* object, const RenderObject::Paint static Image* soundNone = platformResource("mediaSoundNone"); static Image* soundDisabled = platformResource("mediaSoundDisabled"); - if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE || !mediaElement->hasAudio()) + if (!hasSource(mediaElement) || !mediaElement->hasAudio()) return paintMediaButton(paintInfo.context, rect, soundDisabled); return paintMediaButton(paintInfo.context, rect, mediaElement->muted() ? soundNone: soundFull); @@ -91,7 +93,7 @@ static bool paintMediaPlayButton(RenderObject* object, const RenderObject::Paint static Image* mediaPause = platformResource("mediaPause"); static Image* mediaPlayDisabled = platformResource("mediaPlayDisabled"); - if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE) + if (!hasSource(mediaElement)) return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled); return paintMediaButton(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause); @@ -110,6 +112,7 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo // FIXME: this should be a rounded rect but need to fix GraphicsContextSkia first. // https://bugs.webkit.org/show_bug.cgi?id=30143 context->save(); + context->setShouldAntialias(true); context->setStrokeStyle(SolidStroke); context->setStrokeColor(style->borderLeftColor()); context->setStrokeThickness(style->borderLeftWidth()); @@ -119,10 +122,9 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo // Draw the buffered ranges. // FIXME: Draw multiple ranges if there are multiple buffered ranges. - // FIXME: percentLoaded() doesn't always hit 1.0 so we're using round(). IntRect bufferedRect = rect; bufferedRect.inflate(-style->borderLeftWidth()); - bufferedRect.setWidth(round((bufferedRect.width() * mediaElement->percentLoaded()))); + bufferedRect.setWidth((bufferedRect.width() * mediaElement->percentLoaded())); // Don't bother drawing an empty area. if (!bufferedRect.isEmpty()) { @@ -138,7 +140,7 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo context->save(); context->setStrokeStyle(NoStroke); context->setFillGradient(gradient); - context->drawRect(bufferedRect); + context->fillRect(bufferedRect); context->restore(); } @@ -150,6 +152,13 @@ static bool paintMediaSliderThumb(RenderObject* object, const RenderObject::Pain if (!object->parent()->isSlider()) return false; + HTMLMediaElement* mediaElement = toParentMediaElement(object->parent()); + if (!mediaElement) + return false; + + if (!hasSource(mediaElement)) + return true; + static Image* mediaSliderThumb = platformResource("mediaSliderThumb"); return paintMediaButton(paintInfo.context, rect, mediaSliderThumb); } @@ -231,6 +240,8 @@ bool RenderMediaControlsChromium::shouldRenderMediaControlPart(ControlPart part, case MediaCurrentTimePart: case MediaTimeRemainingPart: return true; + default: + ; } return false; } @@ -261,6 +272,9 @@ bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType case MediaCurrentTimeDisplay: case MediaTimeRemainingDisplay: case MediaControlsPanel: + case MediaRewindButton: + case MediaReturnToRealtimeButton: + case MediaStatusDisplay: ASSERT_NOT_REACHED(); break; } @@ -278,9 +292,10 @@ void RenderMediaControlsChromium::adjustMediaSliderThumbSize(RenderObject* objec else if (object->style()->appearance() == MediaVolumeSliderThumbPart) thumbImage = mediaVolumeSliderThumb; + float zoomLevel = object->style()->effectiveZoom(); if (thumbImage) { - object->style()->setWidth(Length(thumbImage->width(), Fixed)); - object->style()->setHeight(Length(thumbImage->height(), Fixed)); + object->style()->setWidth(Length(static_cast<int>(thumbImage->width() * zoomLevel), Fixed)); + object->style()->setHeight(Length(static_cast<int>(thumbImage->height() * zoomLevel), Fixed)); } } diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index d83e4d0..21ced26 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -1571,7 +1571,7 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS // For changes in float styles, we need to conceivably remove ourselves // from the floating objects list. toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); - else if (isPositioned() && (newStyle->position() != AbsolutePosition && newStyle->position() != FixedPosition)) + else if (isPositioned() && (m_style->position() != newStyle->position())) // For changes in positioning styles, we need to conceivably remove ourselves // from the positioned objects list. toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); diff --git a/WebCore/rendering/RenderThemeChromiumSkia.cpp b/WebCore/rendering/RenderThemeChromiumSkia.cpp index 3a39423..fb42bb7 100644 --- a/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -585,8 +585,9 @@ bool RenderThemeChromiumSkia::paintMenuList(RenderObject* o, const RenderObject: paint.setAntiAlias(true); paint.setStyle(SkPaint::kFill_Style); + int arrowXPosition = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13; SkPath path; - path.moveTo(right - 13, middle - 3); + path.moveTo(arrowXPosition, middle - 3); path.rLineTo(6, 0); path.rLineTo(-3, 6); path.close(); diff --git a/WebCore/rendering/RenderThemeChromiumWin.cpp b/WebCore/rendering/RenderThemeChromiumWin.cpp index 20503f3..4b38d53 100644 --- a/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -611,21 +611,11 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, const IntRect& r, bool drawEdges) { - // Nasty hack to make us not paint the border on text fields with a - // border-radius. Webkit paints elements with border-radius for us. - // FIXME: Get rid of this if-check once we can properly clip rounded - // borders: http://b/1112604 and http://b/1108635 - // FIXME: make sure we do the right thing if css background-clip is set. - if (o->style()->hasBorderRadius()) - return false; - - const ThemeData& themeData = getThemeData(o); - // Fallback to white if the specified color object is invalid. + // (Note ChromiumBridge::paintTextField duplicates this check). Color backgroundColor(Color::white); - if (o->style()->backgroundColor().isValid()) { + if (o->style()->backgroundColor().isValid()) backgroundColor = o->style()->backgroundColor(); - } // If we have background-image, don't fill the content area to expose the // parent's background. Also, we shouldn't fill the content area if the @@ -634,17 +624,32 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, // Note that we should paint the content area white if we have neither the // background color nor background image explicitly specified to keep the // appearance of select element consistent with other browsers. - bool fillContentArea = !o->style()->hasBackgroundImage() && backgroundColor.alpha() != 0; - - WebCore::ThemePainter painter(i.context, r); - ChromiumBridge::paintTextField(painter.context(), - themeData.m_part, - themeData.m_state, - themeData.m_classicState, - painter.drawRect(), - backgroundColor, - fillContentArea, - drawEdges); + bool fillContentArea = !o->style()->hasBackgroundImage() && backgroundColor.alpha(); + + if (o->style()->hasBorderRadius()) { + // If the style has rounded borders, setup the context to clip the + // background (themed or filled) appropriately. + // FIXME: make sure we do the right thing if css background-clip is set. + i.context->save(); + IntSize topLeft, topRight, bottomLeft, bottomRight; + o->style()->getBorderRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); + i.context->addRoundedRectClip(r, topLeft, topRight, bottomLeft, bottomRight); + } + { + const ThemeData& themeData = getThemeData(o); + WebCore::ThemePainter painter(i.context, r); + ChromiumBridge::paintTextField(painter.context(), + themeData.m_part, + themeData.m_state, + themeData.m_classicState, + painter.drawRect(), + backgroundColor, + fillContentArea, + drawEdges); + // End of block commits the painter before restoring context. + } + if (o->style()->hasBorderRadius()) + i.context->restore(); return false; } diff --git a/WebCore/rendering/RenderThemeSafari.cpp b/WebCore/rendering/RenderThemeSafari.cpp index 8e53088..2ea3b8b 100644 --- a/WebCore/rendering/RenderThemeSafari.cpp +++ b/WebCore/rendering/RenderThemeSafari.cpp @@ -86,7 +86,7 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) return safariTheme; // keep the reference of one. } -#if !defined(NDEBUG) && defined(USE_DEBUG_SAFARI_THEME) +#ifdef DEBUG_ALL SOFT_LINK_DEBUG_LIBRARY(SafariTheme) #else SOFT_LINK_LIBRARY(SafariTheme) diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp index 5c6e738..b7ab191 100644 --- a/WebCore/rendering/RenderTreeAsText.cpp +++ b/WebCore/rendering/RenderTreeAsText.cpp @@ -28,6 +28,7 @@ #include "CSSMutableStyleDeclaration.h" #include "CharacterNames.h" +#include "CString.h" #include "Document.h" #include "Frame.h" #include "FrameView.h" @@ -553,4 +554,31 @@ String externalRepresentation(RenderObject* o) return ts.release(); } +static void writeCounterValuesFromChildren(TextStream& stream, RenderObject* parent) +{ + for (RenderObject* child = parent->firstChild(); child; child = child->nextSibling()) { + if (child->isCounter()) { + String str(toRenderText(child)->text()); + stream << str; + } + } +} + +String counterValueForElement(Element* element) +{ + // Make sure the element is not freed during the layout. + RefPtr<Element> elementRef(element); + element->document()->updateLayout(); + TextStream stream; + // The counter renderers should be children of anonymous children + // (i.e., :before or :after pseudo-elements). + if (RenderObject* renderer = element->renderer()) { + for (RenderObject* child = renderer->firstChild(); child; child = child->nextSibling()) { + if (child->isAnonymous()) + writeCounterValuesFromChildren(stream, child); + } + } + return stream.release(); +} + } // namespace WebCore diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h index daca253..325f109 100644 --- a/WebCore/rendering/RenderTreeAsText.h +++ b/WebCore/rendering/RenderTreeAsText.h @@ -28,15 +28,18 @@ namespace WebCore { - class RenderObject; - class String; - class TextStream; +class Element; +class RenderObject; +class String; +class TextStream; - String externalRepresentation(RenderObject*); - void write(TextStream&, const RenderObject&, int indent = 0); +String externalRepresentation(RenderObject*); +void write(TextStream&, const RenderObject&, int indent = 0); - // Helper function shared with SVGRenderTreeAsText - String quoteAndEscapeNonPrintables(const String&); +// Helper function shared with SVGRenderTreeAsText +String quoteAndEscapeNonPrintables(const String&); + +String counterValueForElement(Element*); } // namespace WebCore diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index fb6866f..ea087f9 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -94,6 +94,9 @@ void SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject paintInfo.context->beginTransparencyLayer(opacity); } + if (ShadowData* shadow = svgStyle->shadow()) + paintInfo.context->setShadow(IntSize(shadow->x, shadow->y), shadow->blur, shadow->color); + #if ENABLE(FILTERS) AtomicString filterId(svgStyle->filter()); #endif @@ -220,7 +223,7 @@ FloatRect SVGRenderBase::filterBoundingBoxForRenderer(const RenderObject* object #if ENABLE(FILTERS) SVGResourceFilter* filter = getFilterById(object->document(), object->style()->svgStyle()->filter()); if (filter) - return filter->filterBBoxForItemBBox(object->objectBoundingBox()); + return filter->filterBoundingBox(); #else UNUSED_PARAM(object); #endif diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index f1591de..2ea2304 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -458,7 +458,7 @@ public: return font().lineSpacing(); if (lh.isPercent()) - return lh.calcMinValue(fontSize()); + return lh.calcMinValue(fontSize(), true); return lh.value(); } @@ -1196,11 +1196,14 @@ public: static const Vector<StyleDashboardRegion>& noneDashboardRegions(); #endif +<<<<<<< HEAD:WebCore/rendering/style/RenderStyle.h #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR static Color initialTapHighlightColor() { return Color::tap; } #endif }; +======= +>>>>>>> webkit.org at r50258.:WebCore/rendering/style/RenderStyle.h } // namespace WebCore #endif // RenderStyle_h diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp index 1289b06..e8827c4 100644 --- a/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/WebCore/rendering/style/SVGRenderStyle.cpp @@ -51,6 +51,7 @@ SVGRenderStyle::SVGRenderStyle() mask = defaultStyle->mask; misc = defaultStyle->misc; markers = defaultStyle->markers; + shadowSVG = defaultStyle->shadowSVG; setBitDefaults(); } @@ -67,6 +68,7 @@ SVGRenderStyle::SVGRenderStyle(CreateDefaultType) mask.init(); misc.init(); markers.init(); + shadowSVG.init(); } SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) @@ -80,6 +82,7 @@ SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) mask = other.mask; misc = other.misc; markers = other.markers; + shadowSVG = other.shadowSVG; svg_inherited_flags = other.svg_inherited_flags; svg_noninherited_flags = other.svg_noninherited_flags; @@ -93,7 +96,7 @@ bool SVGRenderStyle::operator==(const SVGRenderStyle& o) const { return (fill == o.fill && stroke == o.stroke && text == o.text && stops == o.stops && clip == o.clip && mask == o.mask && - misc == o.misc && markers == o.markers && + misc == o.misc && markers == o.markers && shadowSVG == o.shadowSVG && svg_inherited_flags == o.svg_inherited_flags && svg_noninherited_flags == o.svg_noninherited_flags); } diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index e50d349..12477d7 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -30,6 +30,7 @@ #include "GraphicsTypes.h" #include "SVGPaint.h" #include "SVGRenderStyleDefs.h" +#include "ShadowData.h" #include <wtf/Platform.h> @@ -98,6 +99,8 @@ namespace WebCore { SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255)) SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, misc, baselineShiftValue, BaselineShiftValue, baselineShiftValue, 0) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(ShadowData, shadowSVG, shadow, Shadow, shadow, 0) + // convenience bool hasStroke() const { return (strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } bool hasFill() const { return (fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } @@ -172,6 +175,7 @@ namespace WebCore { DataRef<StyleClipData> clip; DataRef<StyleMaskData> mask; DataRef<StyleMiscData> misc; + DataRef<StyleShadowSVGData> shadowSVG; private: enum CreateDefaultType { CreateDefault }; diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/WebCore/rendering/style/SVGRenderStyleDefs.cpp index f5faad3..2ed1d8f 100644 --- a/WebCore/rendering/style/SVGRenderStyleDefs.cpp +++ b/WebCore/rendering/style/SVGRenderStyleDefs.cpp @@ -213,6 +213,25 @@ bool StyleMiscData::operator==(const StyleMiscData &other) const && baselineShiftValue == other.baselineShiftValue; } +StyleShadowSVGData::StyleShadowSVGData() +{ +} + +StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other) + : RefCounted<StyleShadowSVGData>() + , shadow(other.shadow ? new ShadowData(*other.shadow) : 0) +{ +} + +bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const +{ + if ((!shadow && other.shadow) || (shadow && !other.shadow)) + return false; + if (shadow && other.shadow && (*shadow != *other.shadow)) + return false; + return true; +} + #endif // ENABLE(SVG) // vim:ts=4:noet diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h index c0f5d4e..f4cf932 100644 --- a/WebCore/rendering/style/SVGRenderStyleDefs.h +++ b/WebCore/rendering/style/SVGRenderStyleDefs.h @@ -33,6 +33,9 @@ #include "Color.h" #include "Path.h" #include "PlatformString.h" +#include "ShadowData.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -65,6 +68,13 @@ } \ static Data* initial##Type() { return Initial; } +#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(Data, Group, Variable, Type, Name, Initial) \ + Data* Name() const { return Group->Variable.get(); } \ + void set##Type(Data* obj) { \ + Group.access()->Variable.set(obj); \ + } \ + static Data* initial##Type() { return Initial; } + #define SVG_RS_SET_VARIABLE(Group, Variable, Value) \ if (!(Group->Variable == Value)) \ Group.access()->Variable = Value; @@ -279,6 +289,24 @@ namespace WebCore { StyleMiscData(); StyleMiscData(const StyleMiscData&); }; + + class StyleShadowSVGData : public RefCounted<StyleShadowSVGData> { + public: + static PassRefPtr<StyleShadowSVGData> create() { return adoptRef(new StyleShadowSVGData); } + PassRefPtr<StyleShadowSVGData> copy() const { return adoptRef(new StyleShadowSVGData(*this)); } + + bool operator==(const StyleShadowSVGData& other) const; + bool operator!=(const StyleShadowSVGData& other) const + { + return !(*this == other); + } + + OwnPtr<ShadowData> shadow; + + private: + StyleShadowSVGData(); + StyleShadowSVGData(const StyleShadowSVGData& other); + }; } // namespace WebCore |
