summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering')
-rw-r--r--WebCore/rendering/CounterNode.h2
-rw-r--r--WebCore/rendering/HitTestResult.h6
-rw-r--r--WebCore/rendering/RenderBlockLineLayout.cpp12
-rw-r--r--WebCore/rendering/RenderBoxModelObject.cpp2
-rw-r--r--WebCore/rendering/RenderLayer.cpp2
-rw-r--r--WebCore/rendering/RenderLayerBacking.cpp39
-rw-r--r--WebCore/rendering/RenderLayerCompositor.cpp2
-rw-r--r--WebCore/rendering/RenderObject.h2
-rw-r--r--WebCore/rendering/RenderObjectChildList.h2
-rw-r--r--WebCore/rendering/RenderPath.cpp3
-rw-r--r--WebCore/rendering/RenderSVGImage.cpp3
-rw-r--r--WebCore/rendering/RenderSVGResourceClipper.h2
-rw-r--r--WebCore/rendering/RenderSVGText.cpp7
-rw-r--r--WebCore/rendering/RenderScrollbar.cpp24
-rw-r--r--WebCore/rendering/RenderScrollbar.h8
-rw-r--r--WebCore/rendering/RenderScrollbarPart.cpp4
-rw-r--r--WebCore/rendering/RenderText.h2
-rw-r--r--WebCore/rendering/RenderTextControlSingleLine.cpp99
-rw-r--r--WebCore/rendering/RenderTextControlSingleLine.h2
-rw-r--r--WebCore/rendering/RenderTheme.cpp2
-rw-r--r--WebCore/rendering/RenderTreeAsText.h3
-rw-r--r--WebCore/rendering/RenderVideo.cpp99
-rw-r--r--WebCore/rendering/RenderVideo.h8
-rw-r--r--WebCore/rendering/SVGCharacterLayoutInfo.cpp15
-rw-r--r--WebCore/rendering/SVGInlineTextBox.cpp8
-rw-r--r--WebCore/rendering/SVGRenderSupport.cpp54
-rw-r--r--WebCore/rendering/SVGRenderSupport.h2
-rw-r--r--WebCore/rendering/SVGRenderTreeAsText.cpp14
-rw-r--r--WebCore/rendering/SVGTextLayoutUtilities.cpp14
-rw-r--r--WebCore/rendering/SVGTextLayoutUtilities.h3
-rw-r--r--WebCore/rendering/TextControlInnerElements.cpp19
-rw-r--r--WebCore/rendering/TextControlInnerElements.h8
-rw-r--r--WebCore/rendering/style/ContentData.h2
-rw-r--r--WebCore/rendering/style/FillLayer.cpp35
-rw-r--r--WebCore/rendering/style/RenderStyle.cpp12
-rw-r--r--WebCore/rendering/style/RenderStyle.h15
-rw-r--r--WebCore/rendering/style/SVGRenderStyle.cpp20
-rw-r--r--WebCore/rendering/style/SVGRenderStyle.h77
-rw-r--r--WebCore/rendering/style/SVGRenderStyleDefs.cpp4
-rw-r--r--WebCore/rendering/style/SVGRenderStyleDefs.h12
-rw-r--r--WebCore/rendering/style/StyleRareInheritedData.cpp6
-rw-r--r--WebCore/rendering/style/StyleRareInheritedData.h3
42 files changed, 370 insertions, 288 deletions
diff --git a/WebCore/rendering/CounterNode.h b/WebCore/rendering/CounterNode.h
index 15f2eb8..e35fb61 100644
--- a/WebCore/rendering/CounterNode.h
+++ b/WebCore/rendering/CounterNode.h
@@ -22,6 +22,7 @@
#ifndef CounterNode_h
#define CounterNode_h
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
// This implements a counter tree that is used for finding parents in counters() lookup,
@@ -35,7 +36,6 @@
namespace WebCore {
-class AtomicString;
class RenderObject;
class CounterNode : public Noncopyable {
diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h
index f47e2a5..3a42719 100644
--- a/WebCore/rendering/HitTestResult.h
+++ b/WebCore/rendering/HitTestResult.h
@@ -24,6 +24,7 @@
#include "IntRect.h"
#include "IntSize.h"
#include "TextDirection.h"
+#include <wtf/Forward.h>
#include <wtf/ListHashSet.h>
#include <wtf/RefPtr.h>
@@ -36,7 +37,6 @@ class IntRect;
class KURL;
class Node;
class Scrollbar;
-class String;
class HitTestResult {
public:
@@ -86,8 +86,8 @@ public:
IntRect rectFromPoint(int x, int y) const;
IntRect rectFromPoint(const IntPoint&) const;
IntSize padding() const { return m_padding; }
- int paddingWidth() const { return m_padding.width() >= 0 ? m_padding.width() : 0; }
- int paddingHeight() const { return m_padding.height() >= 0 ? m_padding.height() : 0; }
+ int paddingWidth() const { return m_padding.width(); }
+ int paddingHeight() const { return m_padding.height(); }
// Returns true if it is rect-based hit test and needs to continue until the rect is fully
// enclosed by the boundaries of a node.
bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& rect = IntRect());
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index 46dfd29..7cb1597 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -1445,7 +1445,7 @@ static inline unsigned textWidth(RenderText* text, unsigned from, unsigned len,
return font.width(TextRun(text->characters() + from, len, !collapseWhiteSpace, xPos));
}
-static void tryHyphenating(RenderText* text, const Font& font, int lastSpace, int pos, int xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
+static void tryHyphenating(RenderText* text, const Font& font, const AtomicString& localeIdentifier, int lastSpace, int pos, int xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
{
const AtomicString& hyphenString = text->style()->hyphenString();
int hyphenWidth = font.width(TextRun(hyphenString.characters(), hyphenString.length()));
@@ -1454,8 +1454,8 @@ static void tryHyphenating(RenderText* text, const Font& font, int lastSpace, in
if (!prefixLength)
return;
- prefixLength = 1 + lastHyphenLocation(text->characters() + lastSpace + 1, pos - lastSpace - 1, prefixLength - 1);
- if (prefixLength <= 1)
+ prefixLength = lastHyphenLocation(text->characters() + lastSpace, pos - lastSpace, prefixLength + 1, localeIdentifier);
+ if (!prefixLength)
return;
#if !ASSERT_DISABLED
@@ -1688,7 +1688,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
RenderStyle* style = t->style(firstLine);
const Font& f = style->font();
bool isFixedPitch = f.isFixedPitch();
- bool canHyphenate = style->hyphens() == HyphensAuto;
+ bool canHyphenate = style->hyphens() == HyphensAuto && WebCore::canHyphenate(style->hyphenationLocale());
int lastSpace = pos;
int wordSpacing = o->style()->wordSpacing();
@@ -1834,7 +1834,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
}
if (lineWasTooWide || w + tmpW > width) {
if (canHyphenate && w + tmpW > width) {
- tryHyphenating(t, f, lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);
+ tryHyphenating(t, f, style->hyphenationLocale(), lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);
if (hyphenated)
goto end;
}
@@ -1948,7 +1948,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
tmpW += inlineWidth(o, !appliedStartWidth, true);
if (canHyphenate && w + tmpW > width) {
- tryHyphenating(t, f, lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);
+ tryHyphenating(t, f, style->hyphenationLocale(), lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);
if (hyphenated)
goto end;
}
diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp
index 4ddd66b..9117ed8 100644
--- a/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/WebCore/rendering/RenderBoxModelObject.cpp
@@ -1526,7 +1526,7 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex
firstQuad[0] = quad[0];
firstQuad[1] = quad[1];
firstQuad[2] = side == BSTop || side == BSBottom ? FloatPoint(quad[3].x(), quad[2].y())
- : firstQuad[2] = FloatPoint(quad[2].x(), quad[3].y());
+ : FloatPoint(quad[2].x(), quad[3].y());
firstQuad[3] = quad[3];
graphicsContext->clipConvexPolygon(4, firstQuad, !firstEdgeMatches);
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 51b9326..cc7eed0 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -3902,7 +3902,7 @@ void showLayerTree(const WebCore::RenderLayer* layer)
return;
if (WebCore::Frame* frame = layer->renderer()->frame()) {
- WebCore::String output = externalRepresentation(frame, WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers | WebCore::RenderAsTextShowAddresses | WebCore::RenderAsTextShowIDAndClass);
+ WTF::String output = externalRepresentation(frame, WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers | WebCore::RenderAsTextShowAddresses | WebCore::RenderAsTextShowIDAndClass);
fprintf(stderr, "%s\n", output.utf8().data());
}
}
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index e1cf2a2..421196b 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -28,13 +28,12 @@
#if USE(ACCELERATED_COMPOSITING)
#include "AnimationController.h"
-#if ENABLE(3D_CANVAS)
-#include "WebGLRenderingContext.h"
-#endif
+#include "CanvasRenderingContext.h"
#include "CSSPropertyNames.h"
#include "CSSStyleSelector.h"
#include "FrameView.h"
#include "GraphicsContext.h"
+#include "GraphicsContext3D.h"
#include "GraphicsLayer.h"
#include "HTMLCanvasElement.h"
#include "HTMLElement.h"
@@ -70,11 +69,14 @@ static bool hasBoxDecorationsOrBackground(const RenderObject*);
static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*);
static IntRect clipBox(RenderBox* renderer);
-static inline bool is3DCanvas(RenderObject* renderer)
+static inline bool isAcceleratedCanvas(RenderObject* renderer)
{
-#if ENABLE(3D_CANVAS)
- if (renderer->isCanvas())
- return static_cast<HTMLCanvasElement*>(renderer->node())->is3D();
+#if ENABLE(3D_CANVAS) || ENABLE(ACCELERATED_2D_CANVAS)
+ if (renderer->isCanvas()) {
+ HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node());
+ if (CanvasRenderingContext* context = canvas->renderingContext())
+ return context->isAccelerated();
+ }
#else
UNUSED_PARAM(renderer);
#endif
@@ -256,12 +258,13 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration()
m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer());
}
#endif
-#if ENABLE(3D_CANVAS)
- else if (is3DCanvas(renderer())) {
+#if ENABLE(3D_CANVAS) || ENABLE(ACCELERATED_2D_CANVAS)
+ else if (isAcceleratedCanvas(renderer())) {
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer()->node());
- WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(canvas->renderingContext());
- if (context->graphicsContext3D()->platformLayer())
- m_graphicsLayer->setContentsToWebGL(context->graphicsContext3D()->platformLayer());
+ if (CanvasRenderingContext* context = canvas->renderingContext())
+ if (context->graphicsContext3D())
+ if (PlatformLayer* pl = context->graphicsContext3D()->platformLayer())
+ m_graphicsLayer->setContentsToCanvas(pl);
}
#endif
@@ -772,8 +775,14 @@ bool RenderLayerBacking::containsPaintedContent() const
// FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
// and set background color on the layer in that case, instead of allocating backing store and painting.
- if (renderer()->isVideo() || is3DCanvas(renderer()))
+#if ENABLE(VIDEO)
+ if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo())
return hasBoxDecorationsOrBackground(renderer());
+#endif
+#if ENABLE(3D_CANVAS) || ENABLE(ACCELERATED_2D_CANVAS)
+ if (isAcceleratedCanvas(renderer()))
+ return hasBoxDecorationsOrBackground(renderer());
+#endif
return true;
}
@@ -793,8 +802,8 @@ void RenderLayerBacking::rendererContentChanged()
return;
}
-#if ENABLE(3D_CANVAS)
- if (is3DCanvas(renderer())) {
+#if ENABLE(3D_CANVAS) || ENABLE(ACCELERATED_2D_CANVAS)
+ if (isAcceleratedCanvas(renderer())) {
m_graphicsLayer->setContentsNeedsDisplay();
return;
}
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index b60dec9..12c8a56 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1249,7 +1249,7 @@ bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer)
#if ENABLE(VIDEO)
if (renderer->isVideo()) {
RenderVideo* video = toRenderVideo(renderer);
- return canAccelerateVideoRendering(video);
+ return video->shouldDisplayVideo() && canAccelerateVideoRendering(video);
}
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
else if (renderer->isRenderPart()) {
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index 46169d0..d2046cf 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -38,7 +38,7 @@
#include "TransformationMatrix.h"
#include <wtf/UnusedParam.h>
-#if PLATFORM(CG) || PLATFORM(CAIRO)
+#if PLATFORM(CG) || PLATFORM(CAIRO) || PLATFORM(QT)
#define HAVE_PATH_BASED_BORDER_RADIUS_DRAWING 1
#endif
diff --git a/WebCore/rendering/RenderObjectChildList.h b/WebCore/rendering/RenderObjectChildList.h
index ba73c50..8b80f37 100644
--- a/WebCore/rendering/RenderObjectChildList.h
+++ b/WebCore/rendering/RenderObjectChildList.h
@@ -27,10 +27,10 @@
#define RenderObjectChildList_h
#include "RenderStyleConstants.h"
+#include <wtf/Forward.h>
namespace WebCore {
-class AtomicString;
class RenderObject;
class RenderObjectChildList {
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index 915be5d..ddc2c45 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -257,8 +257,7 @@ FloatRect RenderPath::calculateMarkerBoundsIfNeeded()
if (!markerStart && !markerMid && !markerEnd)
return FloatRect();
- float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f);
- return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, strokeWidth, m_path);
+ return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, svgStyle->strokeWidth().value(svgElement), m_path);
}
void RenderPath::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp
index 5a92e33..993278c 100644
--- a/WebCore/rendering/RenderSVGImage.cpp
+++ b/WebCore/rendering/RenderSVGImage.cpp
@@ -179,6 +179,9 @@ void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect)
if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this))
resources->invalidateClient(this);
+ // Eventually notify parent resources, that we've changed.
+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(this, false);
+
repaint();
}
diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h
index 3c76bc8..d334c7d 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.h
+++ b/WebCore/rendering/RenderSVGResourceClipper.h
@@ -36,7 +36,7 @@
namespace WebCore {
-struct ClipperData {
+struct ClipperData : FastAllocBase {
OwnPtr<ImageBuffer> clipMaskImage;
};
diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp
index c4fc353..20c8a7c 100644
--- a/WebCore/rendering/RenderSVGText.cpp
+++ b/WebCore/rendering/RenderSVGText.cpp
@@ -163,10 +163,13 @@ void RenderSVGText::paint(PaintInfo& paintInfo, int, int)
FloatRect RenderSVGText::strokeBoundingBox() const
{
FloatRect strokeBoundaries = objectBoundingBox();
- if (!style()->svgStyle()->hasStroke())
+ const SVGRenderStyle* svgStyle = style()->svgStyle();
+ if (!svgStyle->hasStroke())
return strokeBoundaries;
- strokeBoundaries.inflate(SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 1.0f));
+ ASSERT(node());
+ ASSERT(node()->isSVGElement());
+ strokeBoundaries.inflate(svgStyle->strokeWidth().value(static_cast<SVGElement*>(node())));
return strokeBoundaries;
}
diff --git a/WebCore/rendering/RenderScrollbar.cpp b/WebCore/rendering/RenderScrollbar.cpp
index 817dd02..7378056 100644
--- a/WebCore/rendering/RenderScrollbar.cpp
+++ b/WebCore/rendering/RenderScrollbar.cpp
@@ -26,19 +26,22 @@
#include "config.h"
#include "RenderScrollbar.h"
+#include "Frame.h"
+#include "RenderPart.h"
#include "RenderScrollbarPart.h"
#include "RenderScrollbarTheme.h"
namespace WebCore {
-PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer)
+PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame)
{
- return adoptRef(new RenderScrollbar(client, orientation, renderer));
+ return adoptRef(new RenderScrollbar(client, orientation, renderer, owningFrame));
}
-RenderScrollbar::RenderScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer)
+RenderScrollbar::RenderScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame)
: Scrollbar(client, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme())
, m_owner(renderer)
+ , m_owningFrame(owningFrame)
{
// FIXME: We need to do this because RenderScrollbar::styleChanged is called as soon as the scrollbar is created.
@@ -57,6 +60,15 @@ RenderScrollbar::~RenderScrollbar()
ASSERT(m_parts.isEmpty());
}
+RenderBox* RenderScrollbar::owningRenderer() const
+{
+ if (m_owningFrame) {
+ RenderBox* currentRenderer = m_owningFrame->ownerRenderer();
+ return currentRenderer;
+ }
+ return m_owner;
+}
+
void RenderScrollbar::setParent(ScrollView* parent)
{
Scrollbar::setParent(parent);
@@ -135,7 +147,7 @@ PassRefPtr<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart p
s_styleResolvePart = partType;
s_styleResolveScrollbar = this;
- RefPtr<RenderStyle> result = m_owner->getUncachedPseudoStyle(pseudoId, m_owner->style());
+ RefPtr<RenderStyle> result = owningRenderer()->getUncachedPseudoStyle(pseudoId, owningRenderer()->style());
s_styleResolvePart = NoPart;
s_styleResolveScrollbar = 0;
return result;
@@ -168,7 +180,7 @@ void RenderScrollbar::updateScrollbarParts(bool destroy)
if (newThickness != oldThickness) {
setFrameRect(IntRect(x(), y(), isHorizontal ? width() : newThickness, isHorizontal ? newThickness : height()));
- m_owner->setChildNeedsLayout(true);
+ owningRenderer()->setChildNeedsLayout(true);
}
}
@@ -231,7 +243,7 @@ void RenderScrollbar::updateScrollbarPart(ScrollbarPart partType, bool destroy)
RenderScrollbarPart* partRenderer = m_parts.get(partType);
if (!partRenderer && needRenderer) {
- partRenderer = new (m_owner->renderArena()) RenderScrollbarPart(m_owner->document(), this, partType);
+ partRenderer = new (owningRenderer()->renderArena()) RenderScrollbarPart(owningRenderer()->document(), this, partType);
m_parts.set(partType, partRenderer);
} else if (partRenderer && !needRenderer) {
m_parts.remove(partType);
diff --git a/WebCore/rendering/RenderScrollbar.h b/WebCore/rendering/RenderScrollbar.h
index 8cc263a..de70624 100644
--- a/WebCore/rendering/RenderScrollbar.h
+++ b/WebCore/rendering/RenderScrollbar.h
@@ -32,23 +32,24 @@
namespace WebCore {
+class Frame;
class RenderBox;
class RenderScrollbarPart;
class RenderStyle;
class RenderScrollbar : public Scrollbar {
protected:
- RenderScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*);
+ RenderScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*, Frame*);
public:
friend class Scrollbar;
- static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*);
+ static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*, Frame* owningFrame = 0);
virtual ~RenderScrollbar();
static ScrollbarPart partForStyleResolve();
static RenderScrollbar* scrollbarForStyleResolve();
- RenderBox* owningRenderer() const { return m_owner; }
+ RenderBox* owningRenderer() const;
void clearOwningRenderer() { m_owner = 0; }
void paintPart(GraphicsContext*, ScrollbarPart, const IntRect&);
@@ -78,6 +79,7 @@ private:
void updateScrollbarPart(ScrollbarPart, bool destroy = false);
RenderBox* m_owner;
+ Frame* m_owningFrame;
HashMap<unsigned, RenderScrollbarPart*> m_parts;
};
diff --git a/WebCore/rendering/RenderScrollbarPart.cpp b/WebCore/rendering/RenderScrollbarPart.cpp
index d2f1612..ea61e24 100644
--- a/WebCore/rendering/RenderScrollbarPart.cpp
+++ b/WebCore/rendering/RenderScrollbarPart.cpp
@@ -86,6 +86,8 @@ static int calcScrollbarThicknessUsing(const Length& l, int containingLength)
void RenderScrollbarPart::computeScrollbarWidth()
{
+ if (!m_scrollbar->owningRenderer())
+ return;
int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->borderLeft() - m_scrollbar->owningRenderer()->borderRight();
int w = calcScrollbarThicknessUsing(style()->width(), visibleSize);
int minWidth = calcScrollbarThicknessUsing(style()->minWidth(), visibleSize);
@@ -99,6 +101,8 @@ void RenderScrollbarPart::computeScrollbarWidth()
void RenderScrollbarPart::computeScrollbarHeight()
{
+ if (!m_scrollbar->owningRenderer())
+ return;
int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->owningRenderer()->borderTop() - m_scrollbar->owningRenderer()->borderBottom();
int h = calcScrollbarThicknessUsing(style()->height(), visibleSize);
int minHeight = calcScrollbarThicknessUsing(style()->minHeight(), visibleSize);
diff --git a/WebCore/rendering/RenderText.h b/WebCore/rendering/RenderText.h
index 92c82e1..f46f053 100644
--- a/WebCore/rendering/RenderText.h
+++ b/WebCore/rendering/RenderText.h
@@ -24,11 +24,11 @@
#define RenderText_h
#include "RenderObject.h"
+#include <wtf/Forward.h>
namespace WebCore {
class InlineTextBox;
-class StringImpl;
class RenderText : public RenderObject {
public:
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index 4ba2dc7..ed5c2f4 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -74,6 +74,10 @@ RenderTextControlSingleLine::~RenderTextControlSingleLine()
m_innerSpinButton->detach();
if (m_outerSpinButton)
m_outerSpinButton->detach();
+#if ENABLE(INPUT_SPEECH)
+ if (m_speechButton)
+ m_speechButton->detach();
+#endif
}
RenderStyle* RenderTextControlSingleLine::textBaseStyle() const
@@ -270,6 +274,22 @@ void RenderTextControlSingleLine::layout()
spinBox->setHeight(height() - borderTop() - borderBottom());
}
+#if ENABLE(INPUT_SPEECH)
+ if (RenderBox* button = m_speechButton ? m_speechButton->renderBox() : 0) {
+ if (m_innerBlock) {
+ // This is mostly the case where this is a search field. The speech button is a sibling
+ // of the inner block and laid out at the far right.
+ int x = width() - borderAndPaddingWidth() - button->width() - button->borderAndPaddingWidth();
+ int y = (height() - button->height()) / 2;
+ button->setLocation(x, y);
+ } else {
+ // For non-search fields which are simpler and we let the defaut layout handle things
+ // except for small tweaking below.
+ button->setLocation(button->x() + paddingRight(), (height() - button->height()) / 2);
+ }
+ }
+#endif
+
// Center the spin button vertically, and move it to the right by
// padding + border of the text fields.
if (RenderBox* spinBox = m_outerSpinButton ? m_outerSpinButton->renderBox() : 0) {
@@ -305,13 +325,13 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
return true;
if (m_outerSpinButton && result.innerNode() == m_outerSpinButton)
return true;
- // If we're not a search field, or we already found the speech, results or cancel buttons, we're done.
- if (!m_innerBlock || result.innerNode() == m_resultsButton || result.innerNode() == m_cancelButton)
- return true;
#if ENABLE(INPUT_SPEECH)
- if (m_innerBlock && m_speechButton && result.innerNode() == m_speechButton)
+ if (m_speechButton && result.innerNode() == m_speechButton)
return true;
#endif
+ // If we're not a search field, or we already found the speech, results or cancel buttons, we're done.
+ if (!m_innerBlock || result.innerNode() == m_resultsButton || result.innerNode() == m_cancelButton)
+ return true;
Node* innerNode = 0;
RenderBox* innerBlockRenderer = m_innerBlock->renderBox();
@@ -324,19 +344,6 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
if (m_resultsButton && m_resultsButton->renderer() && xPos < textLeft)
innerNode = m_resultsButton.get();
-#if ENABLE(INPUT_SPEECH)
- if (!innerNode && m_speechButton && m_speechButton->renderer()) {
- int buttonLeft = textLeft + innerTextRenderer->width();
- if (m_cancelButton) {
- RenderBox* cancelRenderer = m_cancelButton->renderBox();
- cancelRenderer->calcWidth();
- buttonLeft += cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight();
- }
- if (xPos > buttonLeft)
- innerNode = m_speechButton.get();
- }
-#endif
-
if (!innerNode) {
int textRight = textLeft + innerTextRenderer->width();
if (m_cancelButton && m_cancelButton->renderer() && xPos > textRight)
@@ -418,7 +425,7 @@ void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren
#if ENABLE(INPUT_SPEECH)
if (RenderObject* speechRenderer = m_speechButton ? m_speechButton->renderer() : 0)
- speechRenderer->setStyle(createSpeechButtonStyle(style()));
+ speechRenderer->setStyle(createSpeechButtonStyle());
#endif
setHasOverflowClip(false);
@@ -451,10 +458,6 @@ void RenderTextControlSingleLine::capsLockStateMayHaveChanged()
bool RenderTextControlSingleLine::hasControlClip() const
{
bool clip = m_cancelButton;
-#if ENABLE(INPUT_SPEECH)
- if (m_speechButton)
- clip = true;
-#endif
return clip;
}
@@ -596,29 +599,21 @@ void RenderTextControlSingleLine::adjustControlHeightBasedOnLineHeight(int lineH
lineHeight = max(lineHeight, cancelRenderer->height());
}
-#if ENABLE(INPUT_SPEECH)
- if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0) {
- toRenderBlock(speechRenderer)->calcHeight();
- setHeight(max(height(),
- speechRenderer->borderTop() + speechRenderer->borderBottom() +
- speechRenderer->paddingTop() + speechRenderer->paddingBottom() +
- speechRenderer->marginTop() + speechRenderer->marginBottom()));
- lineHeight = max(lineHeight, speechRenderer->height());
- }
-#endif
-
setHeight(height() + lineHeight);
}
void RenderTextControlSingleLine::createSubtreeIfNeeded()
{
bool createSubtree = inputElement()->isSearchField();
-#if ENABLE(INPUT_SPEECH)
- if (inputElement()->isSpeechEnabled())
- createSubtree = true;
-#endif
if (!createSubtree) {
RenderTextControl::createSubtreeIfNeeded(m_innerBlock.get());
+#if ENABLE(INPUT_SPEECH)
+ if (inputElement()->isSpeechEnabled() && !m_speechButton) {
+ // Create the speech button element.
+ m_speechButton = InputFieldSpeechButtonElement::create(node());
+ m_speechButton->attachInnerElement(node(), createSpeechButtonStyle(), renderArena());
+ }
+#endif
bool hasSpinButton = inputElement()->hasSpinButton();
if (hasSpinButton && !m_innerSpinButton) {
m_innerSpinButton = SpinButtonElement::create(node());
@@ -636,6 +631,13 @@ void RenderTextControlSingleLine::createSubtreeIfNeeded()
m_innerBlock = TextControlInnerElement::create(node());
m_innerBlock->attachInnerElement(node(), createInnerBlockStyle(style()), renderArena());
}
+#if ENABLE(INPUT_SPEECH)
+ if (inputElement()->isSpeechEnabled() && !m_speechButton) {
+ // Create the speech button element.
+ m_speechButton = InputFieldSpeechButtonElement::create(node());
+ m_speechButton->attachInnerElement(node(), createSpeechButtonStyle(), renderArena());
+ }
+#endif
if (inputElement()->hasSpinButton() && !m_outerSpinButton) {
m_outerSpinButton = SpinButtonElement::create(node());
m_outerSpinButton->attachInnerElement(node(), createOuterSpinButtonStyle(), renderArena());
@@ -659,13 +661,6 @@ void RenderTextControlSingleLine::createSubtreeIfNeeded()
m_cancelButton->attachInnerElement(m_innerBlock.get(), createCancelButtonStyle(m_innerBlock->renderer()->style()), renderArena());
}
}
-#if ENABLE(INPUT_SPEECH)
- if (inputElement()->isSpeechEnabled() && !m_speechButton) {
- // Create the speech button element.
- m_speechButton = InputFieldSpeechButtonElement::create(document());
- m_speechButton->attachInnerElement(m_innerBlock.get(), createSpeechButtonStyle(m_innerBlock->renderer()->style()), renderArena());
- }
-#endif
}
void RenderTextControlSingleLine::updateFromElement()
@@ -721,7 +716,12 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const
if (textBlockStyle->font().lineSpacing() > lineHeight(true, true))
textBlockStyle->setLineHeight(Length(-100.0f, Percent));
- textBlockStyle->setDisplay(m_innerBlock || inputElement()->hasSpinButton() ? INLINE_BLOCK : BLOCK);
+ WebCore::EDisplay display = (m_innerBlock || inputElement()->hasSpinButton() ? INLINE_BLOCK : BLOCK);
+#if ENABLE(INPUT_SPEECH)
+ if (inputElement()->isSpeechEnabled())
+ display = INLINE_BLOCK;
+#endif
+ textBlockStyle->setDisplay(display);
// We're adding one extra pixel of padding to match WinIE.
textBlockStyle->setPaddingLeft(Length(1, Fixed));
@@ -814,14 +814,13 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createOuterSpinButtonStyle(
}
#if ENABLE(INPUT_SPEECH)
-PassRefPtr<RenderStyle> RenderTextControlSingleLine::createSpeechButtonStyle(const RenderStyle* startStyle) const
+PassRefPtr<RenderStyle> RenderTextControlSingleLine::createSpeechButtonStyle() const
{
ASSERT(node()->isHTMLElement());
RefPtr<RenderStyle> buttonStyle = getCachedPseudoStyle(INPUT_SPEECH_BUTTON);
if (!buttonStyle)
buttonStyle = RenderStyle::create();
- if (startStyle)
- buttonStyle->inheritFrom(startStyle);
+ buttonStyle->inheritFrom(style());
return buttonStyle.release();
}
#endif
@@ -974,10 +973,6 @@ int RenderTextControlSingleLine::clientPaddingRight() const
if (RenderBox* cancelRenderer = m_cancelButton ? m_cancelButton->renderBox() : 0)
padding += cancelRenderer->width();
-#if ENABLE(INPUT_SPEECH)
- if (RenderBox* speechRenderer = m_speechButton ? m_speechButton->renderBox() : 0)
- padding += speechRenderer->width();
-#endif
return padding;
}
diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h
index 4bc80cf..e57e37e 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.h
+++ b/WebCore/rendering/RenderTextControlSingleLine.h
@@ -102,7 +102,7 @@ private:
PassRefPtr<RenderStyle> createInnerSpinButtonStyle() const;
PassRefPtr<RenderStyle> createOuterSpinButtonStyle() const;
#if ENABLE(INPUT_SPEECH)
- PassRefPtr<RenderStyle> createSpeechButtonStyle(const RenderStyle* startStyle) const;
+ PassRefPtr<RenderStyle> createSpeechButtonStyle() const;
#endif
void updateCancelButtonVisibility() const;
diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp
index 3fcb2c9..5d00f5a 100644
--- a/WebCore/rendering/RenderTheme.cpp
+++ b/WebCore/rendering/RenderTheme.cpp
@@ -1042,6 +1042,8 @@ void RenderTheme::platformColorsDidChange()
m_inactiveListBoxSelectionForegroundColor = Color();
m_activeListBoxSelectionBackgroundColor = Color();
m_inactiveListBoxSelectionForegroundColor = Color();
+
+ Page::setNeedsReapplyStyles();
}
Color RenderTheme::systemColor(int cssValueId) const
diff --git a/WebCore/rendering/RenderTreeAsText.h b/WebCore/rendering/RenderTreeAsText.h
index 645ccc0..722736b 100644
--- a/WebCore/rendering/RenderTreeAsText.h
+++ b/WebCore/rendering/RenderTreeAsText.h
@@ -26,12 +26,13 @@
#ifndef RenderTreeAsText_h
#define RenderTreeAsText_h
+#include <wtf/Forward.h>
+
namespace WebCore {
class Element;
class Frame;
class RenderObject;
-class String;
class TextStream;
enum RenderAsTextBehaviorFlags {
diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp
index 610fb5f..ab969cc 100644
--- a/WebCore/rendering/RenderVideo.cpp
+++ b/WebCore/rendering/RenderVideo.cpp
@@ -50,25 +50,7 @@ using namespace HTMLNames;
RenderVideo::RenderVideo(HTMLVideoElement* video)
: RenderMedia(video)
{
- if (video->player() && video->readyState() >= HTMLVideoElement::HAVE_METADATA)
- setIntrinsicSize(video->player()->naturalSize());
- else {
- // When the natural size of the video is unavailable, we use the provided
- // width and height attributes of the video element as the intrinsic size until
- // better values become available. If these attributes are not set, we fall back
- // to a default video size (300x150).
- if (video->hasAttribute(widthAttr) && video->hasAttribute(heightAttr))
- setIntrinsicSize(IntSize(video->width(), video->height()));
- else if (video->ownerDocument() && video->ownerDocument()->isMediaDocument()) {
- // Video in standalone media documents should not use the default 300x150
- // size since they also have audio thrown at them. By setting the intrinsic
- // size to 300x1 the video will resize itself in these cases, and audio will
- // have the correct height (it needs to be > 0 for controls to render properly).
- setIntrinsicSize(IntSize(defaultSize().width(), 1));
- }
- else
- setIntrinsicSize(defaultSize());
- }
+ setIntrinsicSize(calculateIntrinsicSize());
}
RenderVideo::~RenderVideo()
@@ -92,24 +74,59 @@ void RenderVideo::intrinsicSizeChanged()
{
if (videoElement()->shouldDisplayPosterImage())
RenderMedia::intrinsicSizeChanged();
- videoSizeChanged();
+ updateIntrinsicSize();
}
-
-void RenderVideo::videoSizeChanged()
+void RenderVideo::updateIntrinsicSize()
{
- if (!player())
+ IntSize size = calculateIntrinsicSize();
+
+ // Never set the element size to zero when in a media document.
+ if (size.isEmpty() && node()->ownerDocument() && node()->ownerDocument()->isMediaDocument())
return;
- IntSize size = player()->naturalSize();
- if (size.isEmpty()) {
- if (node()->ownerDocument() && node()->ownerDocument()->isMediaDocument())
- return;
- }
- if (size != intrinsicSize()) {
- setIntrinsicSize(size);
- setPrefWidthsDirty(true);
- setNeedsLayout(true);
- }
+
+ if (size == intrinsicSize())
+ return;
+
+ setIntrinsicSize(size);
+ setPrefWidthsDirty(true);
+ setNeedsLayout(true);
+}
+
+IntSize RenderVideo::calculateIntrinsicSize()
+{
+ HTMLVideoElement* video = videoElement();
+
+ // Spec text from 4.8.6
+ //
+ // The intrinsic width of a video element's playback area is the intrinsic width
+ // of the video resource, if that is available; otherwise it is the intrinsic
+ // width of the poster frame, if that is available; otherwise it is 300 CSS pixels.
+ //
+ // The intrinsic height of a video element's playback area is the intrinsic height
+ // of the video resource, if that is available; otherwise it is the intrinsic
+ // height of the poster frame, if that is available; otherwise it is 150 CSS pixels.
+
+ if (player() && video->readyState() >= HTMLVideoElement::HAVE_METADATA)
+ return player()->naturalSize();
+
+ if (video->shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !errorOccurred())
+ return m_cachedImageSize;
+
+ // When the natural size of the video is unavailable, we use the provided
+ // width and height attributes of the video element as the intrinsic size until
+ // better values become available.
+ if (video->hasAttribute(widthAttr) && video->hasAttribute(heightAttr))
+ return IntSize(video->width(), video->height());
+
+ // <video> in standalone media documents should not use the default 300x150
+ // size since they also have audio-only files. By setting the intrinsic
+ // size to 300x1 the video will resize itself in these cases, and audio will
+ // have the correct height (it needs to be > 0 for controls to render properly).
+ if (video->ownerDocument() && video->ownerDocument()->isMediaDocument())
+ return IntSize(defaultSize().width(), 1);
+
+ return defaultSize();
}
void RenderVideo::imageChanged(WrappedImagePtr newImage, const IntRect* rect)
@@ -119,8 +136,11 @@ void RenderVideo::imageChanged(WrappedImagePtr newImage, const IntRect* rect)
// Cache the image intrinsic size so we can continue to use it to draw the image correctly
// even after we know the video intrisic size but aren't able to draw video frames yet
// (we don't want to scale the poster to the video size).
- if (videoElement()->shouldDisplayPosterImage())
+ if (videoElement()->shouldDisplayPosterImage()) {
+ if (errorOccurred())
+ updateIntrinsicSize();
m_cachedImageSize = intrinsicSize();
+ }
}
IntRect RenderVideo::videoBox() const
@@ -155,7 +175,12 @@ IntRect RenderVideo::videoBox() const
return renderBox;
}
-
+
+bool RenderVideo::shouldDisplayVideo() const
+{
+ return !videoElement()->shouldDisplayPosterImage();
+}
+
void RenderVideo::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
{
MediaPlayer* mediaPlayer = player();
@@ -174,6 +199,7 @@ void RenderVideo::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
if (rect.isEmpty())
return;
rect.move(tx, ty);
+
if (displayingPoster)
paintIntoRect(paintInfo.context, rect);
else
@@ -200,9 +226,12 @@ void RenderVideo::updateFromElement()
void RenderVideo::updatePlayer()
{
+ updateIntrinsicSize();
+
MediaPlayer* mediaPlayer = player();
if (!mediaPlayer)
return;
+
if (!videoElement()->inActiveDocument()) {
mediaPlayer->setVisible(false);
return;
diff --git a/WebCore/rendering/RenderVideo.h b/WebCore/rendering/RenderVideo.h
index bb2b05c..dd7a531 100644
--- a/WebCore/rendering/RenderVideo.h
+++ b/WebCore/rendering/RenderVideo.h
@@ -40,7 +40,6 @@ public:
RenderVideo(HTMLVideoElement*);
virtual ~RenderVideo();
- void videoSizeChanged();
IntRect videoBox() const;
static IntSize defaultSize();
@@ -50,11 +49,16 @@ public:
void acceleratedRenderingStateChanged();
#endif
+ virtual bool shouldDisplayVideo() const;
+
private:
virtual void updateFromElement();
inline HTMLVideoElement* videoElement() const;
virtual void intrinsicSizeChanged();
+ IntSize calculateIntrinsicSize();
+ void updateIntrinsicSize();
+
virtual void imageChanged(WrappedImagePtr, const IntRect*);
virtual const char* renderName() const { return "RenderVideo"; }
@@ -69,7 +73,7 @@ private:
virtual int calcReplacedWidth(bool includeMaxWidth = true) const;
virtual int calcReplacedHeight() const;
virtual int minimumReplacedHeight() const;
-
+
int calcAspectRatioWidth() const;
int calcAspectRatioHeight() const;
diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.cpp b/WebCore/rendering/SVGCharacterLayoutInfo.cpp
index 18315df..71ff1aa 100644
--- a/WebCore/rendering/SVGCharacterLayoutInfo.cpp
+++ b/WebCore/rendering/SVGCharacterLayoutInfo.cpp
@@ -37,16 +37,21 @@ namespace WebCore {
// Helper function
static float calculateBaselineShift(RenderObject* item)
{
+ ASSERT(item);
+ ASSERT(item->style());
+ ASSERT(item->node());
+ ASSERT(item->node()->isSVGElement());
+
const Font& font = item->style()->font();
const SVGRenderStyle* svgStyle = item->style()->svgStyle();
float baselineShift = 0.0f;
if (svgStyle->baselineShift() == BS_LENGTH) {
- CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(svgStyle->baselineShiftValue());
- baselineShift = primitive->getFloatValue();
-
- if (primitive->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- baselineShift = baselineShift / 100.0f * font.pixelSize();
+ SVGLength baselineShiftValueLength = svgStyle->baselineShiftValue();
+ if (baselineShiftValueLength.unitType() == LengthTypePercentage)
+ baselineShift = baselineShiftValueLength.valueAsPercentage() * font.pixelSize();
+ else
+ baselineShift = baselineShiftValueLength.value(static_cast<SVGElement*>(item->node()));
} else {
float baselineAscent = font.ascent() + font.descent();
diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp
index a293124..f5bbe5b 100644
--- a/WebCore/rendering/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/SVGInlineTextBox.cpp
@@ -638,6 +638,12 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL
RenderStyle* style = textRenderer->style();
ASSERT(style);
+ RenderObject* parentRenderer = parent()->renderer();
+ ASSERT(parentRenderer);
+ ASSERT(parentRenderer->node());
+ ASSERT(parentRenderer->node()->isSVGElement());
+ SVGElement* lengthContext = static_cast<SVGElement*>(parentRenderer->node());
+
const Font& font = style->font();
const UChar* characters = textRenderer->characters();
@@ -709,7 +715,7 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL
}
// Take letter & word spacing and kerning into account
- float spacing = font.letterSpacing() + calculateCSSKerning(style);
+ float spacing = font.letterSpacing() + calculateCSSKerning(lengthContext, style);
const UChar* currentCharacter = characters + (textDirection == RTL ? endPosition - i : startPosition + i);
const UChar* lastCharacter = 0;
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 34f6659..67e19f2 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -320,41 +320,35 @@ bool SVGRenderSupport::pointInClippingArea(RenderObject* object, const FloatPoin
return true;
}
-DashArray SVGRenderSupport::dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle)
+void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
{
- DashArray array;
-
- CSSValueList* dashes = style->svgStyle()->strokeDashArray();
- if (!dashes)
- return array;
-
- CSSPrimitiveValue* dash = 0;
- unsigned long len = dashes->length();
- for (unsigned long i = 0; i < len; ++i) {
- dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
- if (!dash)
- continue;
-
- array.append(dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle));
- }
+ ASSERT(context);
+ ASSERT(style);
+ ASSERT(object);
+ ASSERT(object->node());
+ ASSERT(object->node()->isSVGElement());
- return array;
-}
+ const SVGRenderStyle* svgStyle = style->svgStyle();
+ ASSERT(svgStyle);
-void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
-{
- context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f));
- context->setLineCap(style->svgStyle()->capStyle());
- context->setLineJoin(style->svgStyle()->joinStyle());
- if (style->svgStyle()->joinStyle() == MiterJoin)
- context->setMiterLimit(style->svgStyle()->strokeMiterLimit());
-
- const DashArray& dashes = dashArrayFromRenderingStyle(object->style(), object->document()->documentElement()->renderStyle());
- float dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0f);
+ SVGElement* lengthContext = static_cast<SVGElement*>(object->node());
+ context->setStrokeThickness(svgStyle->strokeWidth().value(lengthContext));
+ context->setLineCap(svgStyle->capStyle());
+ context->setLineJoin(svgStyle->joinStyle());
+ if (svgStyle->joinStyle() == MiterJoin)
+ context->setMiterLimit(svgStyle->strokeMiterLimit());
+
+ const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();
if (dashes.isEmpty())
context->setStrokeStyle(SolidStroke);
- else
- context->setLineDash(dashes, dashOffset);
+ else {
+ DashArray dashArray;
+ const Vector<SVGLength>::const_iterator end = dashes.end();
+ for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
+ dashArray.append((*it).value(lengthContext));
+
+ context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengthContext));
+ }
}
const RenderObject* SVGRenderSupport::findTextRootObject(const RenderObject* start)
diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h
index 371ac75..576475b 100644
--- a/WebCore/rendering/SVGRenderSupport.h
+++ b/WebCore/rendering/SVGRenderSupport.h
@@ -26,7 +26,6 @@
#define SVGRenderSupport_h
#if ENABLE(SVG)
-#include "DashArray.h"
#include "PaintInfo.h"
namespace WebCore {
@@ -81,7 +80,6 @@ public:
// FIXME: These methods do not belong here.
static const RenderObject* findTextRootObject(const RenderObject* start);
- static DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
private:
// This class is not constructable.
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index d298544..db4c07a 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -365,15 +365,23 @@ static void writeStyle(TextStream& ts, const RenderObject& object)
writeIfNotDefault(ts, "opacity", style->opacity(), RenderStyle::initialOpacity());
if (object.isRenderPath()) {
const RenderPath& path = static_cast<const RenderPath&>(object);
+ ASSERT(path.node());
+ ASSERT(path.node()->isSVGElement());
if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderPath*>(&path), path.style())) {
TextStreamSeparator s(" ");
ts << " [stroke={" << s;
writeSVGPaintingResource(ts, strokePaintingResource);
- double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0f);
- const DashArray& dashArray = SVGRenderSupport::dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle());
- double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0f);
+ SVGElement* element = static_cast<SVGElement*>(path.node());
+ double dashOffset = svgStyle->strokeDashOffset().value(element);
+ double strokeWidth = svgStyle->strokeWidth().value(element);
+ const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();
+
+ DashArray dashArray;
+ const Vector<SVGLength>::const_iterator end = dashes.end();
+ for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
+ dashArray.append((*it).value(element));
writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f);
writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
diff --git a/WebCore/rendering/SVGTextLayoutUtilities.cpp b/WebCore/rendering/SVGTextLayoutUtilities.cpp
index 4366498..2debf28 100644
--- a/WebCore/rendering/SVGTextLayoutUtilities.cpp
+++ b/WebCore/rendering/SVGTextLayoutUtilities.cpp
@@ -315,20 +315,16 @@ TextRun svgTextRunForInlineTextBox(const UChar* characters, int length, const Re
return run;
}
-float calculateCSSKerning(const RenderStyle* style)
+float calculateCSSKerning(SVGElement* context, const RenderStyle* style)
{
const Font& font = style->font();
const SVGRenderStyle* svgStyle = style->svgStyle();
- float kerning = 0.0f;
- if (CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(svgStyle->kerning())) {
- kerning = primitive->getFloatValue();
-
- if (primitive->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE && font.pixelSize())
- kerning = kerning / 100.0f * font.pixelSize();
- }
+ SVGLength kerningLength = svgStyle->kerning();
+ if (kerningLength.unitType() == LengthTypePercentage)
+ return kerningLength.valueAsPercentage() * font.pixelSize();
- return kerning;
+ return kerningLength.value(context);
}
bool applySVGKerning(SVGCharacterLayoutInfo& info, const RenderStyle* style, SVGLastGlyphInfo& lastGlyph, const String& unicodeString, const String& glyphName, bool isVerticalText)
diff --git a/WebCore/rendering/SVGTextLayoutUtilities.h b/WebCore/rendering/SVGTextLayoutUtilities.h
index 8c07f62..459d682 100644
--- a/WebCore/rendering/SVGTextLayoutUtilities.h
+++ b/WebCore/rendering/SVGTextLayoutUtilities.h
@@ -32,6 +32,7 @@ class Font;
class InlineTextBox;
class RenderObject;
class RenderStyle;
+class SVGElement;
class SVGRenderStyle;
class TextRun;
@@ -60,7 +61,7 @@ float cummulatedWidthOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange&);
float cummulatedHeightOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange&);
TextRun svgTextRunForInlineTextBox(const UChar*, int length, const RenderStyle*, const InlineTextBox*);
-float calculateCSSKerning(const RenderStyle*);
+float calculateCSSKerning(SVGElement* context, const RenderStyle*);
bool applySVGKerning(SVGCharacterLayoutInfo&, const RenderStyle*, SVGLastGlyphInfo&, const String& unicodeString, const String& glyphName, bool isVerticalText);
}
diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp
index b29876a..cf0e864 100644
--- a/WebCore/rendering/TextControlInnerElements.cpp
+++ b/WebCore/rendering/TextControlInnerElements.cpp
@@ -342,15 +342,15 @@ void SpinButtonElement::setHovered(bool flag)
#if ENABLE(INPUT_SPEECH)
-inline InputFieldSpeechButtonElement::InputFieldSpeechButtonElement(Document* document)
- : TextControlInnerElement(document)
+inline InputFieldSpeechButtonElement::InputFieldSpeechButtonElement(Node* shadowParent)
+ : TextControlInnerElement(shadowParent->document(), shadowParent)
, m_capturing(false)
{
}
-PassRefPtr<InputFieldSpeechButtonElement> InputFieldSpeechButtonElement::create(Document* document)
+PassRefPtr<InputFieldSpeechButtonElement> InputFieldSpeechButtonElement::create(Node* shadowParent)
{
- return adoptRef(new InputFieldSpeechButtonElement(document));
+ return adoptRef(new InputFieldSpeechButtonElement(shadowParent));
}
void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
@@ -372,20 +372,21 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
input->select();
event->setDefaultHandled();
}
- // On mouse up, start speech recognition.
+ // On mouse up, release capture cleanly.
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_capturing && renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(0);
m_capturing = false;
}
- if (hovered()) {
- speechInput()->startRecognition(this);
- event->setDefaultHandled();
- }
}
}
+ if (event->type() == eventNames().clickEvent) {
+ speechInput()->startRecognition(this);
+ event->setDefaultHandled();
+ }
+
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
}
diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h
index ed38221..2859bd5 100644
--- a/WebCore/rendering/TextControlInnerElements.h
+++ b/WebCore/rendering/TextControlInnerElements.h
@@ -29,11 +29,11 @@
#include "HTMLDivElement.h"
#include "SpeechInputListener.h"
+#include <wtf/Forward.h>
namespace WebCore {
class SpeechInput;
-class String;
class TextControlInnerElement : public HTMLDivElement {
public:
@@ -119,8 +119,9 @@ class InputFieldSpeechButtonElement
: public TextControlInnerElement,
public SpeechInputListener {
public:
- static PassRefPtr<InputFieldSpeechButtonElement> create(Document*);
+ static PassRefPtr<InputFieldSpeechButtonElement> create(Node*);
+ virtual void detach();
virtual void defaultEventHandler(Event*);
// SpeechInputListener methods.
@@ -129,8 +130,7 @@ public:
void setRecognitionResult(const String& result);
private:
- InputFieldSpeechButtonElement(Document*);
- virtual void detach();
+ InputFieldSpeechButtonElement(Node*);
SpeechInput* speechInput();
bool m_capturing;
diff --git a/WebCore/rendering/style/ContentData.h b/WebCore/rendering/style/ContentData.h
index 2c261f8..5c3565e 100644
--- a/WebCore/rendering/style/ContentData.h
+++ b/WebCore/rendering/style/ContentData.h
@@ -26,13 +26,13 @@
#define ContentData_h
#include "RenderStyleConstants.h"
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
class CounterContent;
-class StringImpl;
class StyleImage;
struct ContentData : Noncopyable {
diff --git a/WebCore/rendering/style/FillLayer.cpp b/WebCore/rendering/style/FillLayer.cpp
index 3469e97..59f3bb2 100644
--- a/WebCore/rendering/style/FillLayer.cpp
+++ b/WebCore/rendering/style/FillLayer.cpp
@@ -129,6 +129,17 @@ bool FillLayer::operator==(const FillLayer& o) const
void FillLayer::fillUnsetProperties()
{
FillLayer* curr;
+ for (curr = this; curr && curr->isImageSet(); curr = curr->next()) { }
+ if (curr && curr != this) {
+ // We need to fill in the remaining values with the pattern specified.
+ for (FillLayer* pattern = this; curr; curr = curr->next()) {
+ curr->m_image = pattern->m_image;
+ pattern = pattern->next();
+ if (pattern == curr || !pattern)
+ pattern = this;
+ }
+ }
+
for (curr = this; curr && curr->isXPositionSet(); curr = curr->next()) { }
if (curr && curr != this) {
// We need to fill in the remaining values with the pattern specified.
@@ -232,27 +243,15 @@ void FillLayer::fillUnsetProperties()
void FillLayer::cullEmptyLayers()
{
- // CSS3 background layering: the number of background layers is determined
- // by the number of values in the 'background-image' property.
- // http://www.w3.org/TR/css3-background/#layering
-
FillLayer* next;
for (FillLayer* p = this; p; p = next) {
next = p->m_next;
- if (!next)
- break;
-
- bool anyAttributeSet = next->isXPositionSet()
- || next->isYPositionSet()
- || next->isAttachmentSet()
- || next->isClipSet()
- || next->isCompositeSet()
- || next->isOriginSet()
- || next->isRepeatXSet()
- || next->isRepeatYSet()
- || next->isSizeSet();
-
- if (!next->isImageSet() || !anyAttributeSet) {
+ if (next && !next->isImageSet() &&
+ !next->isXPositionSet() && !next->isYPositionSet() &&
+ !next->isAttachmentSet() && !next->isClipSet() &&
+ !next->isCompositeSet() && !next->isOriginSet() &&
+ !next->isRepeatXSet() && !next->isRepeatYSet()
+ && !next->isSizeSet()) {
delete next;
p->m_next = 0;
break;
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index ce6c98e..5a66c67 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -385,7 +385,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
rareInheritedData->khtmlLineBreak != other->rareInheritedData->khtmlLineBreak ||
rareInheritedData->textSecurity != other->rareInheritedData->textSecurity ||
rareInheritedData->hyphens != other->rareInheritedData->hyphens ||
- rareInheritedData->hyphenateCharacter != other->rareInheritedData->hyphenateCharacter)
+ rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString ||
+ rareInheritedData->hyphenationLocale != other->rareInheritedData->hyphenationLocale)
return StyleDifferenceLayout;
if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get()))
@@ -471,6 +472,9 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
return StyleDifferenceLayout;
}
+ if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE))
+ return StyleDifferenceLayout;
+
// Make sure these left/top/right/bottom checks stay below all layout checks and above
// all visible checks.
if (position() != StaticPosition) {
@@ -832,9 +836,9 @@ const AtomicString& RenderStyle::hyphenString() const
{
ASSERT(hyphens() == HyphensAuto);
- const AtomicString& hyphenateCharacter = rareInheritedData.get()->hyphenateCharacter;
- if (!hyphenateCharacter.isNull())
- return hyphenateCharacter;
+ const AtomicString& hyphenationString = rareInheritedData.get()->hyphenationString;
+ if (!hyphenationString.isNull())
+ return hyphenationString;
// FIXME: This should depend on locale.
DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphen, 1));
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 58af7cf..234122e 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -73,6 +73,7 @@
#include "ThemeTypes.h"
#include "TimingFunction.h"
#include "TransformOperations.h"
+#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/StdLibExtras.h>
@@ -108,7 +109,6 @@ class CSSStyleSelector;
class CSSValueList;
class CachedImage;
class Pair;
-class StringImpl;
class StyleImage;
typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
@@ -648,7 +648,8 @@ public:
EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); }
const AtomicString& highlight() const { return rareInheritedData->highlight; }
Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
- const AtomicString& hyphenateCharacter() const { return rareInheritedData->hyphenateCharacter; }
+ const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
+ const AtomicString& hyphenationLocale() const { return rareInheritedData->hyphenationLocale; }
EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
@@ -876,8 +877,8 @@ public:
void adjustBackgroundLayers()
{
if (backgroundLayers()->next()) {
- accessBackgroundLayers()->fillUnsetProperties();
accessBackgroundLayers()->cullEmptyLayers();
+ accessBackgroundLayers()->fillUnsetProperties();
}
}
@@ -887,8 +888,8 @@ public:
void adjustMaskLayers()
{
if (maskLayers()->next()) {
- accessMaskLayers()->fillUnsetProperties();
accessMaskLayers()->cullEmptyLayers();
+ accessMaskLayers()->fillUnsetProperties();
}
}
@@ -992,7 +993,8 @@ public:
void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); }
void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
- void setHyphenateCharacter(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenateCharacter, h); }
+ void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
+ void setHyphenationLocale(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationLocale, h); }
void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
@@ -1205,7 +1207,8 @@ public:
static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
static const AtomicString& initialHighlight() { return nullAtom; }
static Hyphens initialHyphens() { return HyphensManual; }
- static const AtomicString& initialHyphenateCharacter() { return nullAtom; }
+ static const AtomicString& initialHyphenationString() { return nullAtom; }
+ static const AtomicString& initialHyphenationLocale() { return nullAtom; }
static EBorderFit initialBorderFit() { return BorderFitBorder; }
static EResize initialResize() { return RESIZE_NONE; }
static ControlPart initialAppearance() { return NoControlPart; }
diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp
index 2a9003c..0df26f4 100644
--- a/WebCore/rendering/style/SVGRenderStyle.cpp
+++ b/WebCore/rendering/style/SVGRenderStyle.cpp
@@ -211,26 +211,6 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
return StyleDifferenceEqual;
}
-float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* value, float defaultValue)
-{
- CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(value);
-
- unsigned short cssType = (primitive ? primitive->primitiveType() : (unsigned short) CSSPrimitiveValue::CSS_UNKNOWN);
- if (!(cssType > CSSPrimitiveValue::CSS_UNKNOWN && cssType <= CSSPrimitiveValue::CSS_PC))
- return defaultValue;
-
- if (cssType == CSSPrimitiveValue::CSS_PERCENTAGE) {
- SVGStyledElement* element = static_cast<SVGStyledElement*>(item->node());
- SVGElement* viewportElement = (element ? element->viewportElement() : 0);
- if (viewportElement) {
- float result = primitive->getFloatValue() / 100.0f;
- return SVGLength::PercentageOfViewport(result, element, LengthModeOther);
- }
- }
-
- return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle());
-}
-
static void getSVGShadowExtent(ShadowData* shadow, float& top, float& right, float& bottom, float& left)
{
top = 0.0f;
diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h
index c1d72e9..f071755 100644
--- a/WebCore/rendering/style/SVGRenderStyle.h
+++ b/WebCore/rendering/style/SVGRenderStyle.h
@@ -78,17 +78,13 @@ public:
static SVGPaint* initialFillPaint() { return SVGPaint::defaultFill(); }
static float initialStrokeOpacity() { return 1.0f; }
static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); }
- static CSSValueList* initialStrokeDashArray() { return 0; }
+ static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>(); }
static float initialStrokeMiterLimit() { return 4.0f; }
- static CSSValue* initialStrokeWidth() { return 0; }
- static CSSValue* initialStrokeDashOffset() { return 0; };
- static CSSValue* initialKerning() { return 0; }
static float initialStopOpacity() { return 1.0f; }
static Color initialStopColor() { return Color(0, 0, 0); }
static float initialFloodOpacity() { return 1.0f; }
static Color initialFloodColor() { return Color(0, 0, 0); }
static Color initialLightingColor() { return Color(255, 255, 255); }
- static CSSValue* initialBaselineShiftValue() { return 0; }
static ShadowData* initialShadow() { return 0; }
static String initialClipperResource() { return String(); }
static String initialFilterResource() { return String(); }
@@ -97,6 +93,34 @@ public:
static String initialMarkerMidResource() { return String(); }
static String initialMarkerEndResource() { return String(); }
+ static SVGLength initialBaselineShiftValue()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length;
+ }
+
+ static SVGLength initialKerning()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length;
+ }
+
+ static SVGLength initialStrokeDashOffset()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length;
+ }
+
+ static SVGLength initialStrokeWidth()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 1);
+ return length;
+ }
+
// SVG CSS Property setters
void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; }
void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._dominantBaseline = val; }
@@ -140,7 +164,7 @@ public:
stroke.access()->paint = obj;
}
- void setStrokeDashArray(PassRefPtr<CSSValueList> obj)
+ void setStrokeDashArray(const Vector<SVGLength>& obj)
{
if (!(stroke->dashArray == obj))
stroke.access()->dashArray = obj;
@@ -152,19 +176,19 @@ public:
stroke.access()->miterLimit = obj;
}
- void setStrokeWidth(PassRefPtr<CSSValue> obj)
+ void setStrokeWidth(const SVGLength& obj)
{
if (!(stroke->width == obj))
stroke.access()->width = obj;
}
- void setStrokeDashOffset(PassRefPtr<CSSValue> obj)
+ void setStrokeDashOffset(const SVGLength& obj)
{
if (!(stroke->dashOffset == obj))
stroke.access()->dashOffset = obj;
}
- void setKerning(PassRefPtr<CSSValue> obj)
+ void setKerning(const SVGLength& obj)
{
if (!(text->kerning == obj))
text.access()->kerning = obj;
@@ -176,7 +200,7 @@ public:
stops.access()->opacity = obj;
}
- void setStopColor(Color obj)
+ void setStopColor(const Color& obj)
{
if (!(stops->color == obj))
stops.access()->color = obj;
@@ -188,60 +212,59 @@ public:
misc.access()->floodOpacity = obj;
}
- void setFloodColor(Color obj)
+ void setFloodColor(const Color& obj)
{
if (!(misc->floodColor == obj))
misc.access()->floodColor = obj;
}
- void setLightingColor(Color obj)
+ void setLightingColor(const Color& obj)
{
if (!(misc->lightingColor == obj))
misc.access()->lightingColor = obj;
}
- void setBaselineShiftValue(PassRefPtr<CSSValue> obj)
+ void setBaselineShiftValue(const SVGLength& obj)
{
if (!(misc->baselineShiftValue == obj))
misc.access()->baselineShiftValue = obj;
}
- void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj;
- }
+ void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; }
// Setters for non-inherited resources
- void setClipperResource(String obj)
+ void setClipperResource(const String& obj)
{
if (!(resources->clipper == obj))
resources.access()->clipper = obj;
}
- void setFilterResource(String obj)
+ void setFilterResource(const String& obj)
{
if (!(resources->filter == obj))
resources.access()->filter = obj;
}
- void setMaskerResource(String obj)
+ void setMaskerResource(const String& obj)
{
if (!(resources->masker == obj))
resources.access()->masker = obj;
}
// Setters for inherited resources
- void setMarkerStartResource(String obj)
+ void setMarkerStartResource(const String& obj)
{
if (!(inheritedResources->markerStart == obj))
inheritedResources.access()->markerStart = obj;
}
- void setMarkerMidResource(String obj)
+ void setMarkerMidResource(const String& obj)
{
if (!(inheritedResources->markerMid == obj))
inheritedResources.access()->markerMid = obj;
}
- void setMarkerEndResource(String obj)
+ void setMarkerEndResource(const String& obj)
{
if (!(inheritedResources->markerEnd == obj))
inheritedResources.access()->markerEnd = obj;
@@ -269,17 +292,17 @@ public:
SVGPaint* fillPaint() const { return fill->paint.get(); }
float strokeOpacity() const { return stroke->opacity; }
SVGPaint* strokePaint() const { return stroke->paint.get(); }
- CSSValueList* strokeDashArray() const { return stroke->dashArray.get(); }
+ Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; }
float strokeMiterLimit() const { return stroke->miterLimit; }
- CSSValue* strokeWidth() const { return stroke->width.get(); }
- CSSValue* strokeDashOffset() const { return stroke->dashOffset.get(); }
- CSSValue* kerning() const { return text->kerning.get(); }
+ SVGLength strokeWidth() const { return stroke->width; }
+ SVGLength strokeDashOffset() const { return stroke->dashOffset; }
+ SVGLength kerning() const { return text->kerning; }
float stopOpacity() const { return stops->opacity; }
Color stopColor() const { return stops->color; }
float floodOpacity() const { return misc->floodOpacity; }
Color floodColor() const { return misc->floodColor; }
Color lightingColor() const { return misc->lightingColor; }
- CSSValue* baselineShiftValue() const { return misc->baselineShiftValue.get(); }
+ SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
ShadowData* shadow() const { return shadowSVG->shadow.get(); }
String clipperResource() const { return resources->clipper; }
String filterResource() const { return resources->filter; }
@@ -296,8 +319,6 @@ public:
bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
- static float cssPrimitiveToLength(const RenderObject*, CSSValue*, float defaultValue = 0.0f);
-
protected:
// inherit
struct InheritedFlags {
diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/WebCore/rendering/style/SVGRenderStyleDefs.cpp
index bf7624f..c30ae6d 100644
--- a/WebCore/rendering/style/SVGRenderStyleDefs.cpp
+++ b/WebCore/rendering/style/SVGRenderStyleDefs.cpp
@@ -73,8 +73,8 @@ StyleStrokeData::StyleStrokeData()
, miterLimit(SVGRenderStyle::initialStrokeMiterLimit())
, width(SVGRenderStyle::initialStrokeWidth())
, dashOffset(SVGRenderStyle::initialStrokeDashOffset())
- , paint(SVGRenderStyle::initialStrokePaint())
, dashArray(SVGRenderStyle::initialStrokeDashArray())
+ , paint(SVGRenderStyle::initialStrokePaint())
{
}
@@ -84,8 +84,8 @@ StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
, miterLimit(other.miterLimit)
, width(other.width)
, dashOffset(other.dashOffset)
- , paint(other.paint)
, dashArray(other.dashArray)
+ , paint(other.paint)
{
}
diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h
index adb890c..339bb77 100644
--- a/WebCore/rendering/style/SVGRenderStyleDefs.h
+++ b/WebCore/rendering/style/SVGRenderStyleDefs.h
@@ -29,9 +29,9 @@
#define SVGRenderStyleDefs_h
#if ENABLE(SVG)
-
#include "Color.h"
#include "PlatformString.h"
+#include "SVGLength.h"
#include "ShadowData.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -127,11 +127,11 @@ namespace WebCore {
float opacity;
float miterLimit;
- RefPtr<CSSValue> width;
- RefPtr<CSSValue> dashOffset;
+ SVGLength width;
+ SVGLength dashOffset;
+ Vector<SVGLength> dashArray;
RefPtr<SVGPaint> paint;
- RefPtr<CSSValueList> dashArray;
private:
StyleStrokeData();
@@ -168,7 +168,7 @@ namespace WebCore {
return !(*this == other);
}
- RefPtr<CSSValue> kerning;
+ SVGLength kerning;
private:
StyleTextData();
@@ -192,7 +192,7 @@ namespace WebCore {
Color lightingColor;
// non-inherited text stuff lives here not in StyleTextData.
- RefPtr<CSSValue> baselineShiftValue;
+ SVGLength baselineShiftValue;
private:
StyleMiscData();
diff --git a/WebCore/rendering/style/StyleRareInheritedData.cpp b/WebCore/rendering/style/StyleRareInheritedData.cpp
index cb6edf3..6942809 100644
--- a/WebCore/rendering/style/StyleRareInheritedData.cpp
+++ b/WebCore/rendering/style/StyleRareInheritedData.cpp
@@ -77,7 +77,8 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
, userSelect(o.userSelect)
, colorSpace(o.colorSpace)
, hyphens(o.hyphens)
- , hyphenateCharacter(o.hyphenateCharacter)
+ , hyphenationString(o.hyphenationString)
+ , hyphenationLocale(o.hyphenationLocale)
{
}
@@ -121,7 +122,8 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
&& userSelect == o.userSelect
&& colorSpace == o.colorSpace
&& hyphens == o.hyphens
- && hyphenateCharacter == o.hyphenateCharacter;
+ && hyphenationString == o.hyphenationString
+ && hyphenationLocale == o.hyphenationLocale;
}
bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
diff --git a/WebCore/rendering/style/StyleRareInheritedData.h b/WebCore/rendering/style/StyleRareInheritedData.h
index f6e3bf4..74d5fc9 100644
--- a/WebCore/rendering/style/StyleRareInheritedData.h
+++ b/WebCore/rendering/style/StyleRareInheritedData.h
@@ -82,7 +82,8 @@ public:
unsigned colorSpace : 1; // ColorSpace
unsigned hyphens : 2; // Hyphens
- AtomicString hyphenateCharacter;
+ AtomicString hyphenationString;
+ AtomicString hyphenationLocale;
private:
StyleRareInheritedData();