diff options
author | Ben Murdoch <benm@google.com> | 2011-05-16 16:25:10 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-23 18:54:14 +0100 |
commit | ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch) | |
tree | db769fadd053248f85db67434a5b275224defef7 /Source/WebCore/rendering | |
parent | 52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff) | |
download | external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2 |
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebCore/rendering')
92 files changed, 739 insertions, 1133 deletions
diff --git a/Source/WebCore/rendering/ColumnInfo.h b/Source/WebCore/rendering/ColumnInfo.h index 5e6f619..d77d6ca 100644 --- a/Source/WebCore/rendering/ColumnInfo.h +++ b/Source/WebCore/rendering/ColumnInfo.h @@ -31,7 +31,8 @@ namespace WebCore { -class ColumnInfo : public Noncopyable { +class ColumnInfo { + WTF_MAKE_NONCOPYABLE(ColumnInfo); WTF_MAKE_FAST_ALLOCATED; public: ColumnInfo() : m_desiredColumnWidth(0) diff --git a/Source/WebCore/rendering/EllipsisBox.cpp b/Source/WebCore/rendering/EllipsisBox.cpp index 39fa205..d367c07 100644 --- a/Source/WebCore/rendering/EllipsisBox.cpp +++ b/Source/WebCore/rendering/EllipsisBox.cpp @@ -25,6 +25,7 @@ #include "HitTestResult.h" #include "PaintInfo.h" #include "RootInlineBox.h" +#include "TextRun.h" namespace WebCore { diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp index ae5be0f..8992964 100644 --- a/Source/WebCore/rendering/InlineTextBox.cpp +++ b/Source/WebCore/rendering/InlineTextBox.cpp @@ -40,6 +40,7 @@ #include "RenderRubyText.h" #include "RenderTheme.h" #include "Text.h" +#include "TextRun.h" #include "break_lines.h" #include <wtf/AlwaysInline.h> diff --git a/Source/WebCore/rendering/LayoutState.h b/Source/WebCore/rendering/LayoutState.h index 0d06cb1..c499435 100644 --- a/Source/WebCore/rendering/LayoutState.h +++ b/Source/WebCore/rendering/LayoutState.h @@ -37,7 +37,8 @@ class RenderArena; class RenderBox; class RenderObject; -class LayoutState : public Noncopyable { +class LayoutState { + WTF_MAKE_NONCOPYABLE(LayoutState); public: LayoutState() : m_clipped(false) diff --git a/Source/WebCore/rendering/RenderArena.h b/Source/WebCore/rendering/RenderArena.h index edf052a..5d2559a 100644 --- a/Source/WebCore/rendering/RenderArena.h +++ b/Source/WebCore/rendering/RenderArena.h @@ -36,13 +36,15 @@ #define RenderArena_h #include "Arena.h" +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { static const size_t gMaxRecycledSize = 400; -class RenderArena : public Noncopyable { +class RenderArena { + WTF_MAKE_NONCOPYABLE(RenderArena); WTF_MAKE_FAST_ALLOCATED; public: RenderArena(unsigned arenaSize = 4096); ~RenderArena(); diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 794bafc..7275461 100644 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -48,6 +48,7 @@ #include "RenderView.h" #include "SelectionController.h" #include "Settings.h" +#include "TextRun.h" #include "TransformState.h" #include <wtf/StdLibExtras.h> @@ -5265,9 +5266,8 @@ void RenderBlock::updateFirstLetter() if (remainingText->node()) remainingText->node()->setRenderer(remainingText); - RenderObject* nextObj = textObj->nextSibling(); + firstLetterContainer->addChild(remainingText, textObj); firstLetterContainer->removeChild(textObj); - firstLetterContainer->addChild(remainingText, nextObj); remainingText->setFirstLetter(firstLetter); // construct text fragment for the first letter diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 9529bd6..f8829ee 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -360,7 +360,9 @@ private: bool everHadLayout; }; - struct FloatingObject : Noncopyable { + struct FloatingObject { + WTF_MAKE_NONCOPYABLE(FloatingObject); WTF_MAKE_FAST_ALLOCATED; + public: // Note that Type uses bits so you can use FloatBoth as a mask to query for both left and right. enum Type { FloatLeft = 1, FloatRight = 2, FloatBoth = 3 }; @@ -678,7 +680,9 @@ private: PositionedObjectsListHashSet* m_positionedObjects; // Allocated only when some of these fields have non-default values - struct RenderBlockRareData : Noncopyable { + struct RenderBlockRareData { + WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; + public: RenderBlockRareData(const RenderBlock* block) : m_margins(positiveMarginBeforeDefault(block), negativeMarginBeforeDefault(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(block)) , m_paginationStrut(0) diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index 1d909a3..5e16931 100644 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -34,6 +34,7 @@ #include "RenderListMarker.h" #include "RenderView.h" #include "Settings.h" +#include "TextRun.h" #include "TrailingFloatsRootInlineBox.h" #include "VerticalPositionCache.h" #include "break_lines.h" diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index e218d85..265c46a 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -50,6 +50,7 @@ #include "Settings.h" #endif #include "RenderView.h" +#include "ScrollbarTheme.h" #include "TransformState.h" #include <algorithm> #include <math.h> @@ -573,6 +574,18 @@ IntRect RenderBox::reflectedRect(const IntRect& r) const return result; } +bool RenderBox::includeVerticalScrollbarSize() const +{ + return !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() + && hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); +} + +bool RenderBox::includeHorizontalScrollbarSize() const +{ + return !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() + && hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); +} + int RenderBox::verticalScrollbarWidth() const { return includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0; @@ -1078,14 +1091,8 @@ bool RenderBox::pushContentsClip(PaintInfo& paintInfo, int tx, int ty) } IntRect clipRect(isControlClip ? controlClipRect(tx, ty) : overflowClipRect(tx, ty)); paintInfo.context->save(); - if (style()->hasBorderRadius()) { - IntSize topLeft, topRight, bottomLeft, bottomRight; - IntRect borderRect = IntRect(tx, ty, width(), height()); - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); - } - + if (style()->hasBorderRadius()) + paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(IntRect(tx, ty, width(), height()))); paintInfo.context->clip(clipRect); return true; } @@ -3164,14 +3171,12 @@ VisiblePosition RenderBox::positionForPoint(const IntPoint& point) bool RenderBox::shrinkToAvoidFloats() const { - // FIXME: Technically we should be able to shrink replaced elements on a line, but this is difficult to accomplish, since this - // involves doing a relayout during findNextLineBreak and somehow overriding the containingBlockWidth method to return the - // current remaining width on a line. - if ((isInline() && !isHTMLMarquee()) || !avoidsFloats()) + // Floating objects don't shrink. Objects that don't avoid floats don't shrink. Marquees don't shrink. + if ((isInline() && !isHTMLMarquee()) || !avoidsFloats() || isFloating()) return false; // All auto-width objects that avoid floats should always use lineWidth. - return style()->width().isAuto(); + return style()->width().isAuto(); } bool RenderBox::avoidsFloats() const diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 0a7b175..acbcc29 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -414,8 +414,8 @@ protected: virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; private: - bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); } - bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); } + bool includeVerticalScrollbarSize() const; + bool includeHorizontalScrollbarSize() const; void paintRootBoxDecorations(PaintInfo&, int tx, int ty); // Returns true if we did a full repaint diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index 5098306..f2412a1 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -63,7 +63,8 @@ typedef HashMap<LastPaintSizeMapKey, IntSize> LastPaintSizeMap; typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> ContinuationMap; static ContinuationMap* continuationMap = 0; -class ImageQualityController : public Noncopyable { +class ImageQualityController { + WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED; public: ImageQualityController(); bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const IntSize&); @@ -547,26 +548,9 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co context->save(); - IntSize topLeft, topRight, bottomLeft, bottomRight; - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - if (!includeLeftEdge) { - topLeft = IntSize(); - if (box->isHorizontal()) - bottomLeft = IntSize(); - else - topRight = IntSize(); - } - - if (!includeRightEdge) { - if (box->isHorizontal()) - topRight = IntSize(); - else - bottomLeft = IntSize(); - bottomRight = IntSize(); - } - - context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + RoundedIntRect border = style()->getRoundedBorderFor(borderRect); + border.excludeLogicalEdges(box && box->isHorizontal(), !includeLeftEdge, !includeRightEdge); + context->addRoundedRectClip(border); clippedToBorderRadius = true; } @@ -1024,62 +1008,32 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge); bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); - bool renderRadii = false; Path roundedPath; - IntSize topLeft, topRight, bottomLeft, bottomRight; - IntRect borderRect(tx, ty, w, h); + RoundedIntRect border(tx, ty, w, h); if (style->hasBorderRadius()) { - IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; - style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(), + horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0; int rightWidth = (!horizontal || includeLogicalRightEdge) ? style->borderRightWidth() : 0; int topWidth = (horizontal || includeLogicalLeftEdge) ? style->borderTopWidth() : 0; int bottomWidth = (horizontal || includeLogicalRightEdge) ? style->borderBottomWidth() : 0; - IntRect innerBorderRect = borderInnerRect(borderRect, topWidth, bottomWidth, leftWidth, rightWidth); - IntSize innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius; - - style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderRect, topWidth, bottomWidth, leftWidth, rightWidth, innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius); - - IntSize innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight; - - if (includeLogicalLeftEdge) { - topLeft = topLeftRadius; - innerTopLeft = innerTopLeftRadius; - if (horizontal) { - bottomLeft = bottomLeftRadius; - innerBottomLeft = innerBottomLeftRadius; - } else { - topRight = topRightRadius; - innerTopRight = innerTopRightRadius; - } - } - - if (includeLogicalRightEdge) { - if (horizontal) { - topRight = topRightRadius; - innerTopRight = innerTopRightRadius; - } else { - bottomLeft = bottomLeftRadius; - innerBottomLeft = innerBottomLeftRadius; - } - bottomRight = bottomRightRadius; - innerBottomRight = innerBottomRightRadius; - } + RoundedIntRect inner(borderInnerRect(border.rect(), topWidth, bottomWidth, leftWidth, rightWidth)); + inner.includeLogicalEdges(style->getRoundedInnerBorderWithBorderWidths(inner.rect(), topWidth, bottomWidth, leftWidth, rightWidth).radii(), + horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); - renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); - - if (renderRadii) { + if (border.isRounded()) { // Clip to the inner and outer radii rects. graphicsContext->save(); - graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); - graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); - roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); + graphicsContext->addRoundedRectClip(border); + graphicsContext->clipOutRoundedRect(inner); + roundedPath.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight()); } } + bool renderRadii = border.isRounded(); bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor); bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE); bool lowerLeftBorderStylesMatch = renderLeft && (bottomStyle == leftStyle) && (bottomColor == leftColor) && (bottomStyle != OUTSET) && (bottomStyle != RIDGE) && (bottomStyle != INSET) && (bottomStyle != GROOVE); @@ -1089,11 +1043,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int x = tx; int x2 = tx + w; - if (renderRadii && borderWillArcInnerEdge(topLeft, topRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().topLeft(), border.radii().topRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderTopWidth(), style->borderLeftWidth()), style->borderRightWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle); graphicsContext->restore(); } else { bool ignoreLeft = (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET @@ -1110,11 +1064,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int x = tx; int x2 = tx + w; - if (renderRadii && borderWillArcInnerEdge(bottomLeft, bottomRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().bottomRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderBottomWidth(), style->borderLeftWidth()), style->borderRightWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle); graphicsContext->restore(); } else { bool ignoreLeft = (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET @@ -1133,11 +1087,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int y = ty; int y2 = ty + h; - if (renderRadii && borderWillArcInnerEdge(bottomLeft, topLeft, style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().topLeft(), style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderLeftWidth(), style->borderTopWidth()), style->borderBottomWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle); graphicsContext->restore(); } else { bool ignoreTop = (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET @@ -1152,11 +1106,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderRight) { - if (renderRadii && borderWillArcInnerEdge(bottomRight, topRight, style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().bottomRight(), border.radii().topRight(), style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderRightWidth(), style->borderTopWidth()), style->borderBottomWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle); graphicsContext->restore(); } else { bool ignoreTop = ((topColor == rightColor) && (topTransparent == rightTransparent) @@ -1209,65 +1163,43 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge); bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); - bool renderRadii = false; - IntSize topLeft, topRight, bottomLeft, bottomRight; + RoundedIntRect border(tx, ty, w, h); if (style->hasBorderRadius()) { - IntRect borderRect = IntRect(tx, ty, w, h); - - IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; - style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - if (includeLogicalLeftEdge) { - topLeft = topLeftRadius; - if (horizontal) - bottomLeft = bottomLeftRadius; - else - topRight = topRightRadius; - } - - if (includeLogicalRightEdge) { - if (horizontal) - topRight = topRightRadius; - else - bottomLeft = bottomLeftRadius; - bottomRight = bottomRightRadius; - } - - renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); - - if (renderRadii) { - // Clip to the rounded rectangle. + border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(), + horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); + if (border.isRounded()) { graphicsContext->save(); - graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + graphicsContext->addRoundedRectClip(border); } } int firstAngleStart, secondAngleStart, firstAngleSpan, secondAngleSpan; float thickness; + bool renderRadii = border.isRounded(); bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor); bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE); bool lowerLeftBorderStylesMatch = renderLeft && (bottomStyle == leftStyle) && (bottomColor == leftColor) && (bottomStyle != OUTSET) && (bottomStyle != RIDGE) && (bottomStyle != INSET) && (bottomStyle != GROOVE); bool lowerRightBorderStylesMatch = renderRight && (bottomStyle == rightStyle) && (bottomColor == rightColor); if (renderTop) { - bool ignore_left = (renderRadii && topLeft.width() > 0) || - (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET && - (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); - - bool ignore_right = (renderRadii && topRight.width() > 0) || - (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET && - (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); + bool ignoreLeft = (renderRadii && border.radii().topLeft().width() > 0) + || (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET + && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); + + bool ignoreRight = (renderRadii && border.radii().topRight().width() > 0) + || (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET + && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); int x = tx; int x2 = tx + w; if (renderRadii) { - x += topLeft.width(); - x2 -= topRight.width(); + x += border.radii().topLeft().width(); + x2 -= border.radii().topRight().width(); } drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle, - ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth()); + ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth()); if (renderRadii) { int leftY = ty; @@ -1277,15 +1209,15 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, // with the arc-drawing function. thickness = style->borderTopWidth() * 2; - if (topLeft.width()) { + if (border.radii().topLeft().width()) { int leftX = tx; // The inner clip clips inside the arc. This is especially important for 1px borders. - bool applyLeftInnerClip = (style->borderLeftWidth() < topLeft.width()) - && (style->borderTopWidth() < topLeft.height()) + bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width()) + && (style->borderTopWidth() < border.radii().topLeft().height()) && (topStyle != DOUBLE || style->borderTopWidth() > 6); if (applyLeftInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, topLeft.width() * 2, topLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2), style->borderTopWidth()); } @@ -1293,20 +1225,20 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, firstAngleSpan = upperLeftBorderStylesMatch ? 90 : 45; // Draw upper left arc - drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, topLeft, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan, BSTop, topColor, topStyle, true); if (applyLeftInnerClip) graphicsContext->restore(); } - if (topRight.width()) { - int rightX = tx + w - topRight.width() * 2; - bool applyRightInnerClip = (style->borderRightWidth() < topRight.width()) - && (style->borderTopWidth() < topRight.height()) + if (border.radii().topRight().width()) { + int rightX = tx + w - border.radii().topRight().width() * 2; + bool applyRightInnerClip = (style->borderRightWidth() < border.radii().topRight().width()) + && (style->borderTopWidth() < border.radii().topRight().height()) && (topStyle != DOUBLE || style->borderTopWidth() > 6); if (applyRightInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, topRight.width() * 2, topRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2), style->borderTopWidth()); } @@ -1319,7 +1251,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } // Draw upper right arc - drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, topRight, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, border.radii().topRight(), secondAngleStart, secondAngleSpan, BSTop, topColor, topStyle, false); if (applyRightInnerClip) graphicsContext->restore(); @@ -1328,36 +1260,36 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderBottom) { - bool ignore_left = (renderRadii && bottomLeft.width() > 0) || - (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET && - (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); + bool ignoreLeft = (renderRadii && border.radii().bottomLeft().width() > 0) + || (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET + && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); - bool ignore_right = (renderRadii && bottomRight.width() > 0) || - (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET && - (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); + bool ignoreRight = (renderRadii && border.radii().bottomRight().width() > 0) + || (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET + && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); int x = tx; int x2 = tx + w; if (renderRadii) { - x += bottomLeft.width(); - x2 -= bottomRight.width(); + x += border.radii().bottomLeft().width(); + x2 -= border.radii().bottomRight().width(); } drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, bottomStyle, - ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth()); + ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth()); if (renderRadii) { thickness = style->borderBottomWidth() * 2; - if (bottomLeft.width()) { + if (border.radii().bottomLeft().width()) { int leftX = tx; - int leftY = ty + h - bottomLeft.height() * 2; - bool applyLeftInnerClip = (style->borderLeftWidth() < bottomLeft.width()) - && (style->borderBottomWidth() < bottomLeft.height()) + int leftY = ty + h - border.radii().bottomLeft().height() * 2; + bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width()) + && (style->borderBottomWidth() < border.radii().bottomLeft().height()) && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6); if (applyLeftInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, bottomLeft.width() * 2, bottomLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2), style->borderBottomWidth()); } @@ -1370,21 +1302,21 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } // Draw lower left arc - drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, bottomLeft, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().bottomLeft(), firstAngleStart, firstAngleSpan, BSBottom, bottomColor, bottomStyle, true); if (applyLeftInnerClip) graphicsContext->restore(); } - if (bottomRight.width()) { - int rightY = ty + h - bottomRight.height() * 2; - int rightX = tx + w - bottomRight.width() * 2; - bool applyRightInnerClip = (style->borderRightWidth() < bottomRight.width()) - && (style->borderBottomWidth() < bottomRight.height()) + if (border.radii().bottomRight().width()) { + int rightY = ty + h - border.radii().bottomRight().height() * 2; + int rightX = tx + w - border.radii().bottomRight().width() * 2; + bool applyRightInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width()) + && (style->borderBottomWidth() < border.radii().bottomRight().height()) && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6); if (applyRightInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, bottomRight.width() * 2, bottomRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2), style->borderBottomWidth()); } @@ -1392,7 +1324,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, secondAngleSpan = lowerRightBorderStylesMatch ? 90 : 45; // Draw lower right arc - drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, bottomRight, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan, BSBottom, bottomColor, bottomStyle, false); if (applyRightInnerClip) graphicsContext->restore(); @@ -1401,36 +1333,36 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderLeft) { - bool ignore_top = (renderRadii && topLeft.height() > 0) || - (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET && - (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); + bool ignoreTop = (renderRadii && border.radii().topLeft().height() > 0) + || (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET + && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); - bool ignore_bottom = (renderRadii && bottomLeft.height() > 0) || - (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET && - (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); + bool ignoreBottom = (renderRadii && border.radii().bottomLeft().height() > 0) + || (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET + && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); int y = ty; int y2 = ty + h; if (renderRadii) { - y += topLeft.height(); - y2 -= bottomLeft.height(); + y += border.radii().topLeft().height(); + y2 -= border.radii().bottomLeft().height(); } drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle, - ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth()); + ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth()); if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) { int topX = tx; thickness = style->borderLeftWidth() * 2; - if (!upperLeftBorderStylesMatch && topLeft.width()) { + if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) { int topY = ty; - bool applyTopInnerClip = (style->borderLeftWidth() < topLeft.width()) - && (style->borderTopWidth() < topLeft.height()) + bool applyTopInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width()) + && (style->borderTopWidth() < border.radii().topLeft().height()) && (leftStyle != DOUBLE || style->borderLeftWidth() > 6); if (applyTopInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topLeft.width() * 2, topLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2), style->borderLeftWidth()); } @@ -1438,20 +1370,20 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, firstAngleSpan = 45; // Draw top left arc - drawArcForBoxSide(graphicsContext, topX, topY, thickness, topLeft, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan, BSLeft, leftColor, leftStyle, true); if (applyTopInnerClip) graphicsContext->restore(); } - if (!lowerLeftBorderStylesMatch && bottomLeft.width()) { - int bottomY = ty + h - bottomLeft.height() * 2; - bool applyBottomInnerClip = (style->borderLeftWidth() < bottomLeft.width()) - && (style->borderBottomWidth() < bottomLeft.height()) + if (!lowerLeftBorderStylesMatch && border.radii().bottomLeft().width()) { + int bottomY = ty + h - border.radii().bottomLeft().height() * 2; + bool applyBottomInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width()) + && (style->borderBottomWidth() < border.radii().bottomLeft().height()) && (leftStyle != DOUBLE || style->borderLeftWidth() > 6); if (applyBottomInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomLeft.width() * 2, bottomLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2), style->borderLeftWidth()); } @@ -1459,7 +1391,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, secondAngleSpan = 45; // Draw bottom left arc - drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, bottomLeft, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, border.radii().bottomLeft(), secondAngleStart, secondAngleSpan, BSLeft, leftColor, leftStyle, false); if (applyBottomInnerClip) graphicsContext->restore(); @@ -1468,38 +1400,38 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderRight) { - bool ignore_top = (renderRadii && topRight.height() > 0) || - ((topColor == rightColor) && (topTransparent == rightTransparent) && - (rightStyle >= DOTTED || rightStyle == INSET) && - (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); + bool ignoreTop = (renderRadii && border.radii().topRight().height() > 0) + || ((topColor == rightColor) && (topTransparent == rightTransparent) + && (rightStyle >= DOTTED || rightStyle == INSET) + && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); - bool ignore_bottom = (renderRadii && bottomRight.height() > 0) || - ((bottomColor == rightColor) && (bottomTransparent == rightTransparent) && - (rightStyle >= DOTTED || rightStyle == INSET) && - (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); + bool ignoreBottom = (renderRadii && border.radii().bottomRight().height() > 0) + || ((bottomColor == rightColor) && (bottomTransparent == rightTransparent) + && (rightStyle >= DOTTED || rightStyle == INSET) + && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); int y = ty; int y2 = ty + h; if (renderRadii) { - y += topRight.height(); - y2 -= bottomRight.height(); + y += border.radii().topRight().height(); + y2 -= border.radii().bottomRight().height(); } drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, rightStyle, - ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth()); + ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth()); if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) { thickness = style->borderRightWidth() * 2; - if (!upperRightBorderStylesMatch && topRight.width()) { - int topX = tx + w - topRight.width() * 2; + if (!upperRightBorderStylesMatch && border.radii().topRight().width()) { + int topX = tx + w - border.radii().topRight().width() * 2; int topY = ty; - bool applyTopInnerClip = (style->borderRightWidth() < topRight.width()) - && (style->borderTopWidth() < topRight.height()) + bool applyTopInnerClip = (style->borderRightWidth() < border.radii().topRight().width()) + && (style->borderTopWidth() < border.radii().topRight().height()) && (rightStyle != DOUBLE || style->borderRightWidth() > 6); if (applyTopInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topRight.width() * 2, topRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2), style->borderRightWidth()); } @@ -1507,21 +1439,21 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, firstAngleSpan = 45; // Draw top right arc - drawArcForBoxSide(graphicsContext, topX, topY, thickness, topRight, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topRight(), firstAngleStart, firstAngleSpan, BSRight, rightColor, rightStyle, true); if (applyTopInnerClip) graphicsContext->restore(); } - if (!lowerRightBorderStylesMatch && bottomRight.width()) { - int bottomX = tx + w - bottomRight.width() * 2; - int bottomY = ty + h - bottomRight.height() * 2; - bool applyBottomInnerClip = (style->borderRightWidth() < bottomRight.width()) - && (style->borderBottomWidth() < bottomRight.height()) + if (!lowerRightBorderStylesMatch && border.radii().bottomRight().width()) { + int bottomX = tx + w - border.radii().bottomRight().width() * 2; + int bottomY = ty + h - border.radii().bottomRight().height() * 2; + bool applyBottomInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width()) + && (style->borderBottomWidth() < border.radii().bottomRight().height()) && (rightStyle != DOUBLE || style->borderRightWidth() > 6); if (applyBottomInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, bottomRight.width() * 2, bottomRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2), style->borderRightWidth()); } @@ -1529,7 +1461,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, secondAngleSpan = 45; // Draw bottom right arc - drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, bottomRight, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan, BSRight, rightColor, rightStyle, false); if (applyBottomInnerClip) graphicsContext->restore(); @@ -1542,15 +1474,15 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } #endif -void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, +void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const RoundedIntRect& border, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) { FloatPoint quad[4]; - int tx = box.x(); - int ty = box.y(); - int w = box.width(); - int h = box.height(); + int tx = border.rect().x(); + int ty = border.rect().y(); + int w = border.rect().width(); + int h = border.rect().height(); bool horizontal = style->isHorizontalWritingMode(); int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0; @@ -1563,26 +1495,26 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex switch (side) { case BSTop: quad[0] = FloatPoint(tx, ty); - quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); - quad[2] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); + quad[1] = FloatPoint(tx + max(border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth)); + quad[2] = FloatPoint(tx + w - max(border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth)); quad[3] = FloatPoint(tx + w, ty); break; case BSLeft: quad[0] = FloatPoint(tx, ty); - quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); - quad[2] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); + quad[1] = FloatPoint(tx + max(border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth)); + quad[2] = FloatPoint(tx + max(border.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth)); quad[3] = FloatPoint(tx, ty + h); break; case BSBottom: quad[0] = FloatPoint(tx, ty + h); - quad[1] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); - quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); + quad[1] = FloatPoint(tx + max(border.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth)); + quad[2] = FloatPoint(tx + w - max(border.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth)); quad[3] = FloatPoint(tx + w, ty + h); break; case BSRight: quad[0] = FloatPoint(tx + w, ty); - quad[1] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); - quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); + quad[1] = FloatPoint(tx + w - max(border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth)); + quad[2] = FloatPoint(tx + w - max(border.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth)); quad[3] = FloatPoint(tx + w, ty + h); break; default: @@ -1613,18 +1545,6 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches); } -static inline void uniformlyExpandBorderRadii(int delta, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) -{ - topLeft.expand(delta, delta); - topLeft.clampNegativeToZero(); - topRight.expand(delta, delta); - topRight.clampNegativeToZero(); - bottomLeft.expand(delta, delta); - bottomLeft.clampNegativeToZero(); - bottomRight.expand(delta, delta); - bottomRight.clampNegativeToZero(); -} - void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) { // FIXME: Deal with border-image. Would be great to use border-image as a mask. @@ -1632,61 +1552,19 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int if (context->paintingDisabled()) return; - IntRect rect(tx, ty, w, h); - IntSize topLeft; - IntSize topRight; - IntSize bottomLeft; - IntSize bottomRight; - + RoundedIntRect border(tx, ty, w, h); bool hasBorderRadius = s->hasBorderRadius(); bool isHorizontal = s->isHorizontalWritingMode(); if (hasBorderRadius && (includeLogicalLeftEdge || includeLogicalRightEdge)) { - IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; - s->getBorderRadiiForRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - if (includeLogicalLeftEdge) { - if (shadowStyle == Inset) { - topLeftRadius.expand(-borderLeft(), -borderTop()); - topLeftRadius.clampNegativeToZero(); - if (isHorizontal) { - bottomLeftRadius.expand(-borderLeft(), -borderBottom()); - bottomLeftRadius.clampNegativeToZero(); - } else { - topRightRadius.expand(-borderRight(), -borderTop()); - topRightRadius.clampNegativeToZero(); - } - } - topLeft = topLeftRadius; - if (isHorizontal) - bottomLeft = bottomLeftRadius; - else - topRight = topRightRadius; - } - if (includeLogicalRightEdge) { - if (shadowStyle == Inset) { - if (isHorizontal) { - topRightRadius.expand(-borderRight(), -borderTop()); - topRightRadius.clampNegativeToZero(); - } else { - bottomLeftRadius.expand(-borderLeft(), -borderBottom()); - bottomLeftRadius.clampNegativeToZero(); - } - bottomRightRadius.expand(-borderRight(), -borderBottom()); - bottomRightRadius.clampNegativeToZero(); - } - if (isHorizontal) - topRight = topRightRadius; - else - bottomLeft = bottomLeftRadius; - bottomRight = bottomRightRadius; - } - } - - if (shadowStyle == Inset) { - rect.move(includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0, includeLogicalLeftEdge || isHorizontal ? borderTop() : 0); - rect.setWidth(rect.width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0)); - rect.setHeight(rect.height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0)); + RoundedIntRect::Radii radii = ((shadowStyle == Inset) ? s->getRoundedInnerBorderWithBorderWidths(border.rect(), borderTop(), borderBottom(), borderLeft(), borderRight()) : s->getRoundedBorderFor(border.rect())).radii(); + border.includeLogicalEdges(radii, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge); } + + if (shadowStyle == Inset) + border.setRect(IntRect(border.rect().x() + (includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0), + border.rect().y() + (includeLogicalLeftEdge || isHorizontal ? borderTop() : 0), + border.rect().width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0), + border.rect().height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0))); bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255; for (const ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next()) { @@ -1699,12 +1577,12 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int const Color& shadowColor = shadow->color(); if (shadow->style() == Normal) { - IntRect fillRect(rect); + RoundedIntRect fillRect = border; fillRect.inflate(shadowSpread); if (fillRect.isEmpty()) continue; - IntRect shadowRect(rect); + IntRect shadowRect(border.rect()); shadowRect.inflate(shadowBlur + shadowSpread); shadowRect.move(shadowOffset); @@ -1719,32 +1597,23 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace()); if (hasBorderRadius) { - IntRect rectToClipOut = rect; - IntSize topLeftToClipOut = topLeft; - IntSize topRightToClipOut = topRight; - IntSize bottomLeftToClipOut = bottomLeft; - IntSize bottomRightToClipOut = bottomRight; - - IntSize topLeftToFill = topLeft; - IntSize topRightToFill = topRight; - IntSize bottomLeftToFill = bottomLeft; - IntSize bottomRightToFill = bottomRight; - if (shadowSpread < 0) - uniformlyExpandBorderRadii(shadowSpread, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill); + RoundedIntRect rectToClipOut = border; // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time // when painting the shadow. On the other hand, it introduces subpixel gaps along the // corners. Those are avoided by insetting the clipping path by one pixel. if (hasOpaqueBackground) { - rectToClipOut.inflate(-1); - uniformlyExpandBorderRadii(-1, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut); + rectToClipOut.inflateWithRadii(-1); } if (!rectToClipOut.isEmpty()) - context->clipOutRoundedRect(rectToClipOut, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut); - context->fillRoundedRect(fillRect, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill, Color::black, s->colorSpace()); + context->clipOutRoundedRect(rectToClipOut); + + if (shadowSpread < 0) + fillRect.expandRadii(shadowSpread); + context->fillRoundedRect(fillRect, Color::black, s->colorSpace()); } else { - IntRect rectToClipOut = rect; + IntRect rectToClipOut = border.rect(); // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time // when painting the shadow. On the other hand, it introduces subpixel gaps along the @@ -1759,20 +1628,20 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int if (!rectToClipOut.isEmpty()) context->clipOut(rectToClipOut); - context->fillRect(fillRect, Color::black, s->colorSpace()); + context->fillRect(fillRect.rect(), Color::black, s->colorSpace()); } context->restore(); } else { // Inset shadow. - IntRect holeRect(rect); + IntRect holeRect(border.rect()); holeRect.inflate(-shadowSpread); if (holeRect.isEmpty()) { if (hasBorderRadius) - context->fillRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight, shadowColor, s->colorSpace()); + context->fillRoundedRect(border, shadowColor, s->colorSpace()); else - context->fillRect(rect, shadowColor, s->colorSpace()); + context->fillRect(border.rect(), shadowColor, s->colorSpace()); continue; } @@ -1794,7 +1663,7 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255); - IntRect outerRect(rect); + IntRect outerRect(border.rect()); outerRect.inflateX(w - 2 * shadowSpread); outerRect.inflateY(h - 2 * shadowSpread); @@ -1802,11 +1671,11 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int Path path; if (hasBorderRadius) { - path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); + path.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight()); context->clip(path); path.clear(); } else - context->clip(rect); + context->clip(border.rect()); IntSize extraOffset(2 * w + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0); context->translate(extraOffset.width(), extraOffset.height()); @@ -1816,8 +1685,8 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int if (hasBorderRadius) { if (shadowSpread > 0) - uniformlyExpandBorderRadii(-shadowSpread, topLeft, topRight, bottomLeft, bottomRight); - path.addRoundedRect(holeRect, topLeft, topRight, bottomLeft, bottomRight); + border.shrinkRadii(shadowSpread); + path.addRoundedRect(holeRect, border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight()); } else path.addRect(holeRect); diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index 8f9f465..f6bcb94 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -134,8 +134,8 @@ private: IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const; - void clipBorderSidePolygon(GraphicsContext*, const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, - const IntSize& bottomRight, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, + void clipBorderSidePolygon(GraphicsContext*, const RoundedIntRect& border, + const BoxSide, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle*, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); friend class RenderView; diff --git a/Source/WebCore/rendering/RenderDataGrid.h b/Source/WebCore/rendering/RenderDataGrid.h index 1492d26..852010c 100644 --- a/Source/WebCore/rendering/RenderDataGrid.h +++ b/Source/WebCore/rendering/RenderDataGrid.h @@ -30,14 +30,14 @@ #include "HTMLDataGridElement.h" #include "RenderBlock.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include "StyleImage.h" #include <wtf/RefPtr.h> #include <wtf/Vector.h> namespace WebCore { -class RenderDataGrid : public RenderBlock, private ScrollbarClient { +class RenderDataGrid : public RenderBlock, private ScrollableArea { public: RenderDataGrid(Element*); ~RenderDataGrid(); @@ -66,7 +66,7 @@ private: HTMLDataGridElement* gridElement() const { return static_cast<HTMLDataGridElement*>(node()); } - // ScrollbarClient interface. + // ScrollableArea interface. virtual int scrollSize(ScrollbarOrientation orientation) const; virtual void setScrollOffsetFromAnimation(const IntPoint&); virtual void valueChanged(Scrollbar*); diff --git a/Source/WebCore/rendering/RenderEmbeddedObject.cpp b/Source/WebCore/rendering/RenderEmbeddedObject.cpp index ac72fe1..5486d51 100644 --- a/Source/WebCore/rendering/RenderEmbeddedObject.cpp +++ b/Source/WebCore/rendering/RenderEmbeddedObject.cpp @@ -49,6 +49,7 @@ #include "RenderWidgetProtector.h" #include "Settings.h" #include "Text.h" +#include "TextRun.h" #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) #include "HTMLVideoElement.h" diff --git a/Source/WebCore/rendering/RenderFileUploadControl.cpp b/Source/WebCore/rendering/RenderFileUploadControl.cpp index 3e4d216..aec55a8 100644 --- a/Source/WebCore/rendering/RenderFileUploadControl.cpp +++ b/Source/WebCore/rendering/RenderFileUploadControl.cpp @@ -37,6 +37,7 @@ #include "RenderText.h" #include "RenderTheme.h" #include "RenderView.h" +#include "TextRun.h" #include <math.h> using namespace std; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 5d96adb..5af5733 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -28,6 +28,7 @@ #include "CharacterNames.h" #include "RenderLayer.h" #include "RenderView.h" +#include "TextRun.h" #include <wtf/StdLibExtras.h> #ifdef ANDROID_LAYOUT diff --git a/Source/WebCore/rendering/RenderFrameSet.h b/Source/WebCore/rendering/RenderFrameSet.h index cdc7b5a..4d14410 100644 --- a/Source/WebCore/rendering/RenderFrameSet.h +++ b/Source/WebCore/rendering/RenderFrameSet.h @@ -77,7 +77,8 @@ public: private: static const int noSplit = -1; - class GridAxis : public Noncopyable { + class GridAxis { + WTF_MAKE_NONCOPYABLE(GridAxis); public: GridAxis(); void resize(int); diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp index 7f4c41e..839328e 100644 --- a/Source/WebCore/rendering/RenderImage.cpp +++ b/Source/WebCore/rendering/RenderImage.cpp @@ -41,6 +41,7 @@ #include "RenderTheme.h" #include "RenderView.h" #include "SelectionController.h" +#include "TextRun.h" #include <wtf/CurrentTime.h> #include <wtf/UnusedParam.h> diff --git a/Source/WebCore/rendering/RenderImageResource.h b/Source/WebCore/rendering/RenderImageResource.h index 2346712..a20c55a 100644 --- a/Source/WebCore/rendering/RenderImageResource.h +++ b/Source/WebCore/rendering/RenderImageResource.h @@ -29,13 +29,13 @@ #include "CachedImage.h" #include "CachedResourceHandle.h" #include "StyleImage.h" -#include <wtf/Noncopyable.h> namespace WebCore { class RenderObject; -class RenderImageResource : public Noncopyable { +class RenderImageResource { + WTF_MAKE_NONCOPYABLE(RenderImageResource); WTF_MAKE_FAST_ALLOCATED; public: virtual ~RenderImageResource(); diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 3613d95..29a6fc9 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -1322,23 +1322,36 @@ void RenderLayer::scrollByRecursively(int xDelta, int yDelta) } } -void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repaint) +void RenderLayer::scrollToOffset(int x, int y) +{ + ScrollableArea::scrollToOffsetWithoutAnimation(IntPoint(x, y)); +} + +void RenderLayer::scrollTo(int x, int y) { RenderBox* box = renderBox(); if (!box) return; if (box->style()->overflowX() != OMARQUEE) { - if (x < 0) x = 0; - if (y < 0) y = 0; + if (x < 0) + x = 0; + if (y < 0) + y = 0; // Call the scrollWidth/Height functions so that the dimensions will be computed if they need // to be (for overflow:hidden blocks). int maxX = scrollWidth() - box->clientWidth(); + if (maxX < 0) + maxX = 0; int maxY = scrollHeight() - box->clientHeight(); - - if (x > maxX) x = maxX; - if (y > maxY) y = maxY; + if (maxY < 0) + maxY = 0; + + if (x > maxX) + x = maxX; + if (y > maxY) + y = maxY; } // FIXME: Eventually, we will want to perform a blit. For now never @@ -1402,16 +1415,9 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai } // Just schedule a full repaint of our object. - if (view && repaint) + if (view) renderer()->repaintUsingContainer(repaintContainer, rectForRepaint); - if (updateScrollbars) { - if (m_hBar) - m_hBar->setValue(scrollXOffset(), Scrollbar::NotFromScrollAnimator); - if (m_vBar) - m_vBar->setValue(m_scrollY, Scrollbar::NotFromScrollAnimator); - } - // Schedule the scroll DOM event. renderer()->node()->document()->eventQueue()->enqueueScrollEvent(renderer()->node(), EventQueue::ScrollEventElementTarget); } @@ -1665,36 +1671,18 @@ int RenderLayer::scrollSize(ScrollbarOrientation orientation) const return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0; } -void RenderLayer::setScrollOffsetFromAnimation(const IntPoint& offset) +void RenderLayer::setScrollOffset(const IntPoint& offset) { - if (m_hBar) - m_hBar->setValue(offset.x(), Scrollbar::FromScrollAnimator); - if (m_vBar) - m_vBar->setValue(offset.y(), Scrollbar::FromScrollAnimator); + scrollTo(offset.x(), offset.y()); } -void RenderLayer::valueChanged(Scrollbar*) +int RenderLayer::scrollPosition(Scrollbar* scrollbar) const { - // Update scroll position from scrollbars. - - bool needUpdate = false; - int newX = scrollXOffset(); - int newY = m_scrollY; - - if (m_hBar) { - newX = m_hBar->value(); - if (newX != scrollXOffset()) - needUpdate = true; - } - - if (m_vBar) { - newY = m_vBar->value(); - if (newY != m_scrollY) - needUpdate = true; - } - - if (needUpdate) - scrollToOffset(newX, newY, false); + if (scrollbar->orientation() == HorizontalScrollbar) + return scrollXOffset(); + if (scrollbar->orientation() == VerticalScrollbar) + return m_scrollY; + return 0; } bool RenderLayer::isActive() const @@ -1703,7 +1691,6 @@ bool RenderLayer::isActive() const return page && page->focusController()->isActive(); } - static IntRect cornerRect(const RenderLayer* layer, const IntRect& bounds) { int horizontalThickness; @@ -1849,7 +1836,7 @@ void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation) static_cast<RenderScrollbar*>(scrollbar.get())->clearOwningRenderer(); scrollbar->removeFromParent(); - scrollbar->setClient(0); + scrollbar->disconnectFromScrollableArea(); scrollbar = 0; } } @@ -1902,14 +1889,14 @@ void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar) int RenderLayer::verticalScrollbarWidth() const { - if (!m_vBar) + if (!m_vBar || ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) return 0; return m_vBar->width(); } int RenderLayer::horizontalScrollbarHeight() const { - if (!m_hBar) + if (!m_hBar || ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) return 0; return m_hBar->height(); } @@ -2076,8 +2063,7 @@ void RenderLayer::updateOverflowStatus(bool horizontalOverflow, bool verticalOve } } -void -RenderLayer::updateScrollInfoAfterLayout() +void RenderLayer::updateScrollInfoAfterLayout() { RenderBox* box = renderBox(); if (!box) @@ -2169,28 +2155,16 @@ RenderLayer::updateScrollInfoAfterLayout() int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_hBar->setProportion(clientWidth, m_scrollWidth); - // Explicitly set the horizontal scroll value. This ensures that when a - // right-to-left scrollable area's width (or content width) changes, the - // top right corner of the content doesn't shift with respect to the top - // right corner of the area. Conceptually, right-to-left areas have - // their origin at the top-right, but RenderLayer is top-left oriented, - // so this is needed to keep everything working. - m_hBar->setValue(scrollXOffset(), Scrollbar::NotFromScrollAnimator); } if (m_vBar) { int clientHeight = box->clientHeight(); int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_vBar->setProportion(clientHeight, m_scrollHeight); - // Explicitly set the vertical scroll value. This ensures that when a - // right-to-left vertical writing-mode scrollable area's height (or content height) changes, the - // bottom right corner of the content doesn't shift with respect to the bottom - // right corner of the area. Conceptually, right-to-left vertical writing-mode areas have - // their origin at the bottom-right, but RenderLayer is top-left oriented, - // so this is needed to keep everything working. - m_vBar->setValue(scrollYOffset(), Scrollbar::NotFromScrollAnimator); } + scrollToOffset(scrollXOffset(), scrollYOffset()); + if (renderer()->node() && renderer()->document()->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) updateOverflowStatus(horizontalOverflow, verticalOverflow); @@ -2359,15 +2333,7 @@ bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const IntPoint& bool RenderLayer::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) { - bool didHorizontalScroll = false; - bool didVerticalScroll = false; - - if (m_hBar) - didHorizontalScroll = m_hBar->scroll(direction, granularity, multiplier); - if (m_vBar) - didVerticalScroll = m_vBar->scroll(direction, granularity, multiplier); - - return (didHorizontalScroll || didVerticalScroll); + return ScrollableArea::scroll(direction, granularity, multiplier); } void RenderLayer::paint(GraphicsContext* p, const IntRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot) diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 8245c2f..57cb4de 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -47,7 +47,7 @@ #include "PaintInfo.h" #include "RenderBox.h" #include "ScrollBehavior.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include <wtf/OwnPtr.h> namespace WebCore { @@ -176,7 +176,7 @@ private: bool m_fixed : 1; }; -class RenderLayer : public ScrollbarClient { +class RenderLayer : public ScrollableArea { public: friend class RenderReplica; @@ -266,7 +266,7 @@ public: int scrollXOffset() const { return m_scrollX + m_scrollOrigin.x(); } int scrollYOffset() const { return m_scrollY + m_scrollOrigin.y(); } - void scrollToOffset(int x, int y, bool updateScrollbars = true, bool repaint = true); + void scrollToOffset(int x, int y); void scrollToXOffset(int x) { scrollToOffset(x, m_scrollY + m_scrollOrigin.y()); } void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOrigin.x(), y); } void scrollRectToVisible(const IntRect&, bool scrollToAnchor = false, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded); @@ -560,10 +560,10 @@ private: bool shouldBeNormalFlowOnly() const; - // ScrollBarClient interface + // ScrollableArea interface virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual void setScrollOffsetFromAnimation(const IntPoint&); - virtual void valueChanged(Scrollbar*); + virtual void setScrollOffset(const IntPoint&); + virtual int scrollPosition(Scrollbar*) const; virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const; virtual bool scrollbarCornerPresent() const; @@ -571,7 +571,10 @@ private: virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; - + + // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. + void scrollTo(int x, int y); + IntSize scrollbarOffset(const Scrollbar*) const; void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow); diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h index 5c6ed12..726b777 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.h +++ b/Source/WebCore/rendering/RenderLayerBacking.h @@ -53,7 +53,8 @@ enum CompositingLayerType { // // There is one RenderLayerBacking for each RenderLayer that is composited. -class RenderLayerBacking : public GraphicsLayerClient, public Noncopyable { +class RenderLayerBacking : public GraphicsLayerClient { + WTF_MAKE_NONCOPYABLE(RenderLayerBacking); WTF_MAKE_FAST_ALLOCATED; public: RenderLayerBacking(RenderLayer*); ~RenderLayerBacking(); diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 15bb8ec..9a5dda7 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -108,6 +108,7 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) , m_compositingDependsOnGeometry(false) , m_compositing(false) , m_compositingLayersNeedRebuild(false) + , m_flushingLayers(false) , m_rootLayerAttachment(RootLayerUnattached) #if PROFILE_LAYER_REBUILD , m_rootLayerUpdateCount(0) @@ -188,12 +189,32 @@ void RenderLayerCompositor::scheduleLayerFlush() void RenderLayerCompositor::flushPendingLayerChanges() { + ASSERT(!m_flushingLayers); + m_flushingLayers = true; + // FIXME: FrameView::syncCompositingStateRecursive() calls this for each // frame, so when compositing layers are connected between frames, we'll // end up syncing subframe's layers multiple times. // https://bugs.webkit.org/show_bug.cgi?id=52489 if (GraphicsLayer* rootLayer = rootPlatformLayer()) rootLayer->syncCompositingState(); + + ASSERT(m_flushingLayers); + m_flushingLayers = false; +} + +RenderLayerCompositor* RenderLayerCompositor::enclosingCompositorFlushingLayers() const +{ + if (!m_renderView->frameView()) + return 0; + + for (Frame* frame = m_renderView->frameView()->frame(); frame; frame = frame->tree()->parent()) { + RenderLayerCompositor* compositor = frame->contentRenderer() ? frame->contentRenderer()->compositor() : 0; + if (compositor->isFlushingLayers()) + return compositor; + } + + return 0; } void RenderLayerCompositor::scheduleCompositingLayerUpdate() diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index 24e182c..1cf9ea9 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -88,6 +88,11 @@ public: // at specific times. void scheduleLayerFlush(); void flushPendingLayerChanges(); + bool isFlushingLayers() const { return m_flushingLayers; } + + // flushPendingLayerChanges() flushes the entire GraphicsLayer tree, which can cross frame boundaries. + // This call returns the rootmost compositor that is being flushed (including self). + RenderLayerCompositor* enclosingCompositorFlushingLayers() const; // Rebuild the tree of compositing layers void updateCompositingLayers(CompositingUpdateType = CompositingUpdateAfterLayoutOrStyleChange, RenderLayer* updateRoot = 0); @@ -271,6 +276,7 @@ private: bool m_compositing; bool m_compositingLayersNeedRebuild; + bool m_flushingLayers; RootLayerAttachment m_rootLayerAttachment; diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp index e6ce340..90f13da 100644 --- a/Source/WebCore/rendering/RenderListBox.cpp +++ b/Source/WebCore/rendering/RenderListBox.cpp @@ -43,6 +43,7 @@ #include "GraphicsContext.h" #include "HTMLNames.h" #include "HitTestResult.h" +#include "NodeRenderStyle.h" #include "OptionGroupElement.h" #include "OptionElement.h" #include "Page.h" @@ -51,9 +52,10 @@ #include "RenderTheme.h" #include "RenderView.h" #include "Scrollbar.h" +#include "ScrollbarTheme.h" #include "SelectElement.h" #include "SelectionController.h" -#include "NodeRenderStyle.h" +#include "TextRun.h" #include <math.h> using namespace std; @@ -493,9 +495,7 @@ bool RenderListBox::scrollToRevealElementAtListIndex(int index) else newOffset = index - numVisibleItems() + 1; - m_indexOffset = newOffset; - if (m_vBar) - m_vBar->setValue(m_indexOffset, Scrollbar::NotFromScrollAnimator); + ScrollableArea::scrollToYOffsetWithoutAnimation(newOffset); return true; } @@ -507,12 +507,12 @@ bool RenderListBox::listIndexIsVisible(int index) bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Node**) { - return m_vBar && m_vBar->scroll(direction, granularity, multiplier); + return ScrollableArea::scroll(direction, granularity, multiplier); } bool RenderListBox::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Node**) { - return m_vBar && m_vBar->scroll(logicalToPhysical(direction, style()->isHorizontalWritingMode(), style()->isFlippedBlocksWritingMode()), granularity, multiplier); + return ScrollableArea::scroll(logicalToPhysical(direction, style()->isHorizontalWritingMode(), style()->isFlippedBlocksWritingMode()), granularity, multiplier); } void RenderListBox::valueChanged(unsigned listIndex) @@ -528,20 +528,24 @@ int RenderListBox::scrollSize(ScrollbarOrientation orientation) const return ((orientation == VerticalScrollbar) && m_vBar) ? (m_vBar->totalSize() - m_vBar->visibleSize()) : 0; } -void RenderListBox::setScrollOffsetFromAnimation(const IntPoint& offset) +int RenderListBox::scrollPosition(Scrollbar*) const { - if (m_vBar) - m_vBar->setValue(offset.y(), Scrollbar::FromScrollAnimator); + return m_indexOffset; } -void RenderListBox::valueChanged(Scrollbar*) +void RenderListBox::setScrollOffset(const IntPoint& offset) { - int newOffset = m_vBar->value(); - if (newOffset != m_indexOffset) { - m_indexOffset = newOffset; - repaint(); - node()->document()->eventQueue()->enqueueScrollEvent(node(), EventQueue::ScrollEventElementTarget); - } + scrollTo(offset.y()); +} + +void RenderListBox::scrollTo(int newOffset) +{ + if (newOffset == m_indexOffset) + return; + + m_indexOffset = newOffset; + repaint(); + node()->document()->eventQueue()->enqueueScrollEvent(node(), EventQueue::ScrollEventElementTarget); } int RenderListBox::itemHeight() const @@ -551,7 +555,7 @@ int RenderListBox::itemHeight() const int RenderListBox::verticalScrollbarWidth() const { - return m_vBar ? m_vBar->width() : 0; + return m_vBar && !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() ? m_vBar->width() : 0; } // FIXME: We ignore padding in the vertical direction as far as these values are concerned, since that's @@ -587,9 +591,8 @@ void RenderListBox::setScrollTop(int newTop) int index = newTop / itemHeight(); if (index < 0 || index >= numItems() || index == m_indexOffset) return; - m_indexOffset = index; - if (m_vBar) - m_vBar->setValue(index, Scrollbar::NotFromScrollAnimator); + + ScrollableArea::scrollToYOffsetWithoutAnimation(index); } bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) @@ -711,7 +714,7 @@ void RenderListBox::destroyScrollbar() return; m_vBar->removeFromParent(); - m_vBar->setClient(0); + m_vBar->disconnectFromScrollableArea(); m_vBar = 0; } diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h index 243fcbe..1ba2b94 100644 --- a/Source/WebCore/rendering/RenderListBox.h +++ b/Source/WebCore/rendering/RenderListBox.h @@ -32,11 +32,11 @@ #define RenderListBox_h #include "RenderBlock.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" namespace WebCore { -class RenderListBox : public RenderBlock, private ScrollbarClient { +class RenderListBox : public RenderBlock, private ScrollableArea { public: RenderListBox(Element*); virtual ~RenderListBox(); @@ -94,10 +94,10 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); - // ScrollbarClient interface. + // ScrollableArea interface. virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual void setScrollOffsetFromAnimation(const IntPoint&); - virtual void valueChanged(Scrollbar*); + virtual int scrollPosition(Scrollbar*) const; + virtual void setScrollOffset(const IntPoint&); virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const; virtual bool scrollbarCornerPresent() const { return false; } // We don't support resize on list boxes yet. If we did this would have to change. @@ -105,6 +105,10 @@ private: virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; + virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } + + // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. + void scrollTo(int newOffset); void setHasVerticalScrollbar(bool hasScrollbar); PassRefPtr<Scrollbar> createScrollbar(); diff --git a/Source/WebCore/rendering/RenderListMarker.cpp b/Source/WebCore/rendering/RenderListMarker.cpp index 71b1eae..cd41c75 100644 --- a/Source/WebCore/rendering/RenderListMarker.cpp +++ b/Source/WebCore/rendering/RenderListMarker.cpp @@ -32,6 +32,7 @@ #include "RenderLayer.h" #include "RenderListItem.h" #include "RenderView.h" +#include "TextRun.h" using namespace std; using namespace WTF; diff --git a/Source/WebCore/rendering/RenderMarquee.cpp b/Source/WebCore/rendering/RenderMarquee.cpp index 1c08831..9b58118 100644 --- a/Source/WebCore/rendering/RenderMarquee.cpp +++ b/Source/WebCore/rendering/RenderMarquee.cpp @@ -171,9 +171,9 @@ void RenderMarquee::start() if (!m_suspended && !m_stopped) { if (isHorizontal()) - m_layer->scrollToOffset(m_start, 0, false, false); + m_layer->scrollToOffset(m_start, 0); else - m_layer->scrollToOffset(0, m_start, false, false); + m_layer->scrollToOffset(0, m_start); } else { m_suspended = false; diff --git a/Source/WebCore/rendering/RenderMarquee.h b/Source/WebCore/rendering/RenderMarquee.h index 79998ed..98fddb9 100644 --- a/Source/WebCore/rendering/RenderMarquee.h +++ b/Source/WebCore/rendering/RenderMarquee.h @@ -53,7 +53,8 @@ namespace WebCore { class RenderLayer; // This class handles the auto-scrolling of layers with overflow: marquee. -class RenderMarquee : public Noncopyable { +class RenderMarquee { + WTF_MAKE_NONCOPYABLE(RenderMarquee); WTF_MAKE_FAST_ALLOCATED; public: explicit RenderMarquee(RenderLayer*); virtual ~RenderMarquee(); diff --git a/Source/WebCore/rendering/RenderMenuList.cpp b/Source/WebCore/rendering/RenderMenuList.cpp index 61f1084..e55b5ca 100644 --- a/Source/WebCore/rendering/RenderMenuList.cpp +++ b/Source/WebCore/rendering/RenderMenuList.cpp @@ -39,6 +39,7 @@ #include "RenderScrollbar.h" #include "RenderTheme.h" #include "SelectElement.h" +#include "TextRun.h" #include <math.h> using namespace std; @@ -455,14 +456,14 @@ HostWindow* RenderMenuList::hostWindow() const return document()->view()->hostWindow(); } -PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) +PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) { RefPtr<Scrollbar> widget; bool hasCustomScrollbarStyle = style()->hasPseudoStyle(SCROLLBAR); if (hasCustomScrollbarStyle) - widget = RenderScrollbar::createCustomScrollbar(client, orientation, this); + widget = RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, this); else - widget = Scrollbar::createNativeScrollbar(client, orientation, controlSize); + widget = Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize); return widget.release(); } diff --git a/Source/WebCore/rendering/RenderMenuList.h b/Source/WebCore/rendering/RenderMenuList.h index 2c99b1e..b84b799 100644 --- a/Source/WebCore/rendering/RenderMenuList.h +++ b/Source/WebCore/rendering/RenderMenuList.h @@ -107,7 +107,7 @@ private: virtual void selectionCleared() {} virtual FontSelector* fontSelector() const; virtual HostWindow* hostWindow() const; - virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); + virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize); #if ENABLE(NO_LISTBOX_RENDERING) virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true); diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 670f818..9a1233e 100644 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -982,36 +982,24 @@ void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect innerBorderLeftWidth += 1; // Get the inner border rects for both the outer border line and the inner border line - IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth, - outerBorderLeftWidth, outerBorderRightWidth); - IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth, - innerBorderLeftWidth, innerBorderRightWidth); - - // Get the inner radii for the outer border line - IntSize outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius, - outerBorderBottomRightInnerRadius; - style->getInnerBorderRadiiForRectWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth, - outerBorderLeftWidth, outerBorderRightWidth, outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius, - outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius); - - // Get the inner radii for the inner border line - IntSize innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius, - innerBorderBottomRightInnerRadius; - style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth, - innerBorderLeftWidth, innerBorderRightWidth, innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius, - innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius); // Draw inner border line graphicsContext->save(); - graphicsContext->addRoundedRectClip(innerBorderInnerRect, innerBorderTopLeftInnerRadius, - innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius); + IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth, + innerBorderLeftWidth, innerBorderRightWidth); + RoundedIntRect innerClip = style->getRoundedInnerBorderWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth, + innerBorderLeftWidth, innerBorderRightWidth); + graphicsContext->addRoundedRectClip(innerClip); drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID); graphicsContext->restore(); // Draw outer border line graphicsContext->save(); - graphicsContext->clipOutRoundedRect(outerBorderInnerRect, outerBorderTopLeftInnerRadius, - outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius); + IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth, + outerBorderLeftWidth, outerBorderRightWidth); + RoundedIntRect outerClip = style->getRoundedInnerBorderWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth, + outerBorderLeftWidth, outerBorderRightWidth); + graphicsContext->clipOutRoundedRect(outerClip); drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID); graphicsContext->restore(); @@ -1033,18 +1021,14 @@ void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect IntRect halfBorderRect = borderInnerRect(borderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2, style->borderLeftWidth() / 2, style->borderRightWidth() / 2); - IntSize topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius; - style->getInnerBorderRadiiForRectWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, - style->borderBottomWidth() / 2, style->borderLeftWidth() / 2, style->borderRightWidth() / 2, - topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius); - // Paint full border drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s1); // Paint inner only graphicsContext->save(); - graphicsContext->addRoundedRectClip(halfBorderRect, topLeftHalfRadius, topRightHalfRadius, - bottomLeftHalfRadius, bottomRightHalfRadius); + RoundedIntRect clipRect = style->getRoundedInnerBorderWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2, + style->borderLeftWidth() / 2, style->borderRightWidth() / 2); + graphicsContext->addRoundedRectClip(clipRect); drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s2); graphicsContext->restore(); diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index cf08a0d..f2e7f13 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -26,7 +26,6 @@ #ifndef RenderObject_h #define RenderObject_h -#include "AffineTransform.h" #include "CachedResourceClient.h" #include "Document.h" #include "Element.h" @@ -44,6 +43,7 @@ namespace WebCore { +class AffineTransform; class AnimationController; class HitTestResult; class InlineBox; diff --git a/Source/WebCore/rendering/RenderOverflow.h b/Source/WebCore/rendering/RenderOverflow.h index 7dc2bcb..33e8cff 100644 --- a/Source/WebCore/rendering/RenderOverflow.h +++ b/Source/WebCore/rendering/RenderOverflow.h @@ -37,7 +37,8 @@ namespace WebCore // Examples of visual overflow are shadows, text stroke (and eventually outline and border-image). // This object is allocated only when some of these fields have non-default values in the owning box. -class RenderOverflow : public Noncopyable { +class RenderOverflow { + WTF_MAKE_NONCOPYABLE(RenderOverflow); WTF_MAKE_FAST_ALLOCATED; public: RenderOverflow(const IntRect& layoutRect, const IntRect& visualRect) : m_topLayoutOverflow(layoutRect.y()) diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp index 974a8d0..0d72f95 100644 --- a/Source/WebCore/rendering/RenderReplaced.cpp +++ b/Source/WebCore/rendering/RenderReplaced.cpp @@ -135,11 +135,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty) else { // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. paintInfo.context->save(); - - IntSize topLeft, topRight, bottomLeft, bottomRight; - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect)); } } diff --git a/Source/WebCore/rendering/RenderScrollbar.cpp b/Source/WebCore/rendering/RenderScrollbar.cpp index 44a0126..4091d51 100644 --- a/Source/WebCore/rendering/RenderScrollbar.cpp +++ b/Source/WebCore/rendering/RenderScrollbar.cpp @@ -34,13 +34,13 @@ namespace WebCore { -PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) +PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) { - return adoptRef(new RenderScrollbar(client, orientation, renderer, owningFrame)); + return adoptRef(new RenderScrollbar(scrollableArea, orientation, renderer, owningFrame)); } -RenderScrollbar::RenderScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) - : Scrollbar(client, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme()) +RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) + : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme()) , m_owner(renderer) , m_owningFrame(owningFrame) { diff --git a/Source/WebCore/rendering/RenderScrollbar.h b/Source/WebCore/rendering/RenderScrollbar.h index de70624..8f4de4f 100644 --- a/Source/WebCore/rendering/RenderScrollbar.h +++ b/Source/WebCore/rendering/RenderScrollbar.h @@ -39,11 +39,11 @@ class RenderStyle; class RenderScrollbar : public Scrollbar { protected: - RenderScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*, Frame*); + RenderScrollbar(ScrollableArea*, ScrollbarOrientation, RenderBox*, Frame*); public: friend class Scrollbar; - static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*, Frame* owningFrame = 0); + static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollableArea*, ScrollbarOrientation, RenderBox*, Frame* owningFrame = 0); virtual ~RenderScrollbar(); static ScrollbarPart partForStyleResolve(); diff --git a/Source/WebCore/rendering/RenderSelectionInfo.h b/Source/WebCore/rendering/RenderSelectionInfo.h index a09fc1a..45ca813 100644 --- a/Source/WebCore/rendering/RenderSelectionInfo.h +++ b/Source/WebCore/rendering/RenderSelectionInfo.h @@ -30,7 +30,8 @@ namespace WebCore { -class RenderSelectionInfoBase : public Noncopyable { +class RenderSelectionInfoBase { + WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED; public: RenderSelectionInfoBase() : m_object(0) diff --git a/Source/WebCore/rendering/RenderSlider.cpp b/Source/WebCore/rendering/RenderSlider.cpp index b0dc0d9..49da396 100644 --- a/Source/WebCore/rendering/RenderSlider.cpp +++ b/Source/WebCore/rendering/RenderSlider.cpp @@ -181,116 +181,6 @@ SliderThumbElement* RenderSlider::sliderThumbElement() const return toSliderThumbElement(static_cast<Element*>(node())->shadowRoot()); } -bool RenderSlider::mouseEventIsInThumb(MouseEvent* evt) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement || !thumbElement->renderer()) - return false; - -#if ENABLE(VIDEO) - if (style()->appearance() == MediaSliderPart || style()->appearance() == MediaVolumeSliderPart) { - MediaControlInputElement* sliderThumb = static_cast<MediaControlInputElement*>(thumbElement->renderer()->node()); - return sliderThumb->hitTest(evt->absoluteLocation()); - } -#endif - - FloatPoint localPoint = thumbElement->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true); - IntRect thumbBounds = thumbElement->renderBox()->borderBoxRect(); - return thumbBounds.contains(roundedIntPoint(localPoint)); -} - -FloatPoint RenderSlider::mouseEventOffsetToThumb(MouseEvent* evt) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - ASSERT(thumbElement && thumbElement->renderer()); - FloatPoint localPoint = thumbElement->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true); - IntRect thumbBounds = thumbElement->renderBox()->borderBoxRect(); - FloatPoint offset; - offset.setX(thumbBounds.x() + thumbBounds.width() / 2 - localPoint.x()); - offset.setY(thumbBounds.y() + thumbBounds.height() / 2 - localPoint.y()); - return offset; -} - -void RenderSlider::setValueForPosition(int position) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement || !thumbElement->renderer()) - return; - - HTMLInputElement* element = static_cast<HTMLInputElement*>(node()); - - // Calculate the new value based on the position, and send it to the element. - StepRange range(element); - double fraction = static_cast<double>(position) / trackSize(); - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - fraction = 1 - fraction; - double value = range.clampValue(range.valueFromProportion(fraction)); - element->setValueFromRenderer(serializeForNumberType(value)); - - // Also update the position if appropriate. - if (position != currentPosition()) { - setNeedsLayout(true); - - // FIXME: It seems like this could send extra change events if the same value is set - // multiple times with no layout in between. - element->dispatchFormControlChangeEvent(); - } -} - -int RenderSlider::positionForOffset(const IntPoint& p) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement || !thumbElement->renderer()) - return 0; - - int position; - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - position = p.y() - thumbElement->renderBox()->height() / 2; - else - position = p.x() - thumbElement->renderBox()->width() / 2; - - return max(0, min(position, trackSize())); -} - -int RenderSlider::currentPosition() -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - ASSERT(thumbElement && thumbElement->renderer()); - - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - return toRenderBox(thumbElement->renderer())->y() - contentBoxRect().y(); - return toRenderBox(thumbElement->renderer())->x() - contentBoxRect().x(); -} - -int RenderSlider::trackSize() -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - ASSERT(thumbElement && thumbElement->renderer()); - - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - return contentHeight() - thumbElement->renderBox()->height(); - return contentWidth() - thumbElement->renderBox()->width(); -} - -void RenderSlider::forwardEvent(Event* event) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement) - return; - - if (event->isMouseEvent()) { - MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); - if (event->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) { - if (!mouseEventIsInThumb(mouseEvent)) { - IntPoint eventOffset = roundedIntPoint(absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); - setValueForPosition(positionForOffset(eventOffset)); - } - } - } - - thumbElement->defaultEventHandler(event); -} - bool RenderSlider::inDragMode() const { SliderThumbElement* thumbElement = sliderThumbElement(); diff --git a/Source/WebCore/rendering/RenderSlider.h b/Source/WebCore/rendering/RenderSlider.h index 5fb5921..0162b71 100644 --- a/Source/WebCore/rendering/RenderSlider.h +++ b/Source/WebCore/rendering/RenderSlider.h @@ -34,7 +34,6 @@ namespace WebCore { RenderSlider(HTMLInputElement*); virtual ~RenderSlider(); - void forwardEvent(Event*); bool inDragMode() const; IntRect thumbRect(); @@ -49,20 +48,8 @@ namespace WebCore { // FIXME: Eventually, the logic of manipulating slider thumb should move to // SliderThumbElement and accessing sliderThumbElement should not be necessary in this class. SliderThumbElement* sliderThumbElement() const; - bool mouseEventIsInThumb(MouseEvent*); - FloatPoint mouseEventOffsetToThumb(MouseEvent*); - - void setValueForPosition(int position); - void setPositionFromValue(); - int positionForOffset(const IntPoint&); - - int currentPosition(); virtual bool requiresForcedStyleRecalcPropagation() const { return true; } - - int trackSize(); - - friend class SliderThumbElement; }; inline RenderSlider* toRenderSlider(RenderObject* object) diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 7aaad62..265d2ef 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -1192,6 +1192,13 @@ void RenderTableSection::recalcCells() setNeedsLayout(true); } +void RenderTableSection::setNeedsCellRecalc() +{ + m_needsCellRecalc = true; + if (RenderTable* t = table()) + t->setNeedsSectionRecalc(); +} + void RenderTableSection::clearGrid() { int rows = m_gridRows; diff --git a/Source/WebCore/rendering/RenderTableSection.h b/Source/WebCore/rendering/RenderTableSection.h index fac6a84..cc969e8 100644 --- a/Source/WebCore/rendering/RenderTableSection.h +++ b/Source/WebCore/rendering/RenderTableSection.h @@ -114,11 +114,7 @@ public: } bool needsCellRecalc() const { return m_needsCellRecalc; } - void setNeedsCellRecalc() - { - m_needsCellRecalc = true; - table()->setNeedsSectionRecalc(); - } + void setNeedsCellRecalc(); int getBaseline(int row) { return m_grid[row].baseline; } diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index 78c5684..86b32d5 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -40,6 +40,7 @@ #include "Text.h" #include "TextBreakIterator.h" #include "TextResourceDecoder.h" +#include "TextRun.h" #include "VisiblePosition.h" #include "break_lines.h" #include <wtf/AlwaysInline.h> diff --git a/Source/WebCore/rendering/RenderTextControl.cpp b/Source/WebCore/rendering/RenderTextControl.cpp index 40aa4c2..cac8113 100644 --- a/Source/WebCore/rendering/RenderTextControl.cpp +++ b/Source/WebCore/rendering/RenderTextControl.cpp @@ -41,6 +41,7 @@ #include "Text.h" #include "TextControlInnerElements.h" #include "TextIterator.h" +#include "TextRun.h" using namespace std; diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp index b54c45b..95f209a 100644 --- a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -1083,14 +1083,14 @@ bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction return RenderBlock::logicalScroll(direction, granularity, multiplier, stopNode); } -PassRefPtr<Scrollbar> RenderTextControlSingleLine::createScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) +PassRefPtr<Scrollbar> RenderTextControlSingleLine::createScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) { RefPtr<Scrollbar> widget; bool hasCustomScrollbarStyle = style()->hasPseudoStyle(SCROLLBAR); if (hasCustomScrollbarStyle) - widget = RenderScrollbar::createCustomScrollbar(client, orientation, this); + widget = RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, this); else - widget = Scrollbar::createNativeScrollbar(client, orientation, controlSize); + widget = Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize); return widget.release(); } diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.h b/Source/WebCore/rendering/RenderTextControlSingleLine.h index 16ce1e4..6b99f59 100644 --- a/Source/WebCore/rendering/RenderTextControlSingleLine.h +++ b/Source/WebCore/rendering/RenderTextControlSingleLine.h @@ -140,7 +140,7 @@ private: virtual void setTextFromItem(unsigned listIndex); virtual FontSelector* fontSelector() const; virtual HostWindow* hostWindow() const; - virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); + virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize); InputElement* inputElement() const; diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp index 90736c7..3a2874d 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp @@ -28,8 +28,10 @@ #include "CSSValueKeywords.h" #include "Color.h" #include "PaintInfo.h" -#include "PlatformThemeChromiumGtk.h" +#include "PlatformBridge.h" #include "RenderObject.h" +#include "RenderProgress.h" +#include "RenderSlider.h" #include "ScrollbarTheme.h" #include "UserAgentStyleSheets.h" @@ -46,6 +48,21 @@ unsigned RenderThemeChromiumLinux::m_inactiveSelectionForegroundColor = double RenderThemeChromiumLinux::m_caretBlinkInterval; +static const unsigned defaultButtonBackgroundColor = 0xffdddddd; + +static PlatformBridge::ThemePaintState getWebThemeState(const RenderTheme* theme, const RenderObject* o) +{ + if (!theme->isEnabled(o)) + return PlatformBridge::StateDisabled; + if (theme->isPressed(o)) + return PlatformBridge::StatePressed; + if (theme->isHovered(o)) + return PlatformBridge::StateHover; + + return PlatformBridge::StateNormal; +} + + PassRefPtr<RenderTheme> RenderThemeChromiumLinux::create() { return adoptRef(new RenderThemeChromiumLinux()); @@ -128,15 +145,14 @@ Color RenderThemeChromiumLinux::platformInactiveSelectionForegroundColor() const void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderObject* o) const { - // These sizes match the sizes in Chromium Win. - const int sliderThumbAlongAxis = 11; - const int sliderThumbAcrossAxis = 21; + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartSliderThumb); + if (o->style()->appearance() == SliderThumbHorizontalPart) { - o->style()->setWidth(Length(sliderThumbAlongAxis, Fixed)); - o->style()->setHeight(Length(sliderThumbAcrossAxis, Fixed)); + o->style()->setWidth(Length(size.width(), Fixed)); + o->style()->setHeight(Length(size.height(), Fixed)); } else if (o->style()->appearance() == SliderThumbVerticalPart) { - o->style()->setWidth(Length(sliderThumbAcrossAxis, Fixed)); - o->style()->setHeight(Length(sliderThumbAlongAxis, Fixed)); + o->style()->setWidth(Length(size.height(), Fixed)); + o->style()->setHeight(Length(size.width(), Fixed)); } else RenderThemeChromiumSkia::adjustSliderThumbSize(o); } @@ -168,29 +184,154 @@ void RenderThemeChromiumLinux::setSelectionColors( m_inactiveSelectionForegroundColor = inactiveForegroundColor; } +bool RenderThemeChromiumLinux::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.button.checked = isChecked(o); + extraParams.button.indeterminate = isIndeterminate(o); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartCheckbox, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +void RenderThemeChromiumLinux::setCheckboxSize(RenderStyle* style) const +{ + // If the width and height are both specified, then we have nothing to do. + if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) + return; + + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartCheckbox); + setSizeIfAuto(style, size); +} + +bool RenderThemeChromiumLinux::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.button.checked = isChecked(o); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartRadio, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +void RenderThemeChromiumLinux::setRadioSize(RenderStyle* style) const +{ + // If the width and height are both specified, then we have nothing to do. + if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) + return; + + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartRadio); + setSizeIfAuto(style, size); +} + +bool RenderThemeChromiumLinux::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.button.isDefault = isDefault(o); + extraParams.button.backgroundColor = defaultButtonBackgroundColor; + if (o->hasBackground()) + extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartButton, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + // WebThemeEngine does not handle border rounded corner and background image + // so return true to draw CSS border and background. + if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) + return true; + + ControlPart part = o->style()->appearance(); + + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.textField.isTextArea = part == TextAreaPart; + extraParams.textField.isListbox = part == ListboxPart; + + // Fallback to white if the specified color object is invalid. + Color backgroundColor(Color::white); + if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) + backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor); + extraParams.textField.backgroundColor = backgroundColor.rgb(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartTextField, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + const int right = rect.x() + rect.width(); + const int middle = rect.y() + rect.height() / 2; + + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13; + extraParams.menuList.arrowY = middle; + extraParams.menuList.backgroundColor = SkColorSetRGB(0xdd, 0xdd, 0xdd); + if (o->hasBackground()) + extraParams.menuList.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartMenuList, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart; + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartSliderTrack, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart; + extraParams.slider.inDrag = toRenderSlider(o->parent())->inDragMode(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartSliderThumb, getWebThemeState(this, o), rect, &extraParams); + return false; +} + void RenderThemeChromiumLinux::adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { - int width = ScrollbarTheme::nativeTheme()->scrollbarThickness(); - style->setWidth(Length(width, Fixed)); - style->setMinWidth(Length(width, Fixed)); + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartInnerSpinButton); + + style->setWidth(Length(size.width(), Fixed)); + style->setMinWidth(Length(size.width(), Fixed)); } -bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* object, const PaintInfo& info, const IntRect& rect) +bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) { - ControlStates northStates = controlStatesForRenderer(object); - ControlStates southStates = northStates; - if (northStates & SpinUpState) - southStates &= ~(HoverState | PressedState); - else - northStates &= ~(HoverState | PressedState); + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState); + extraParams.innerSpin.readOnly = isReadOnlyControl(o); - IntRect half = rect; - half.setHeight(rect.height() / 2); - PlatformThemeChromiumGtk::paintArrowButton(info.context, half, PlatformThemeChromiumGtk::North, northStates); + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartInnerSpinButton, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +#if ENABLE(PROGRESS_TAG) + +bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + if (!o->isProgress()) + return true; - half.setY(rect.y() + rect.height() / 2); - PlatformThemeChromiumGtk::paintArrowButton(info.context, half, PlatformThemeChromiumGtk::South, southStates); + RenderProgress* renderProgress = toRenderProgress(o); + IntRect valueRect = progressValueRectFor(renderProgress, rect); + + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.progressBar.determinate = renderProgress->isDeterminate(); + extraParams.progressBar.valueRectX = valueRect.x(); + extraParams.progressBar.valueRectY = valueRect.y(); + extraParams.progressBar.valueRectWidth = valueRect.width(); + extraParams.progressBar.valueRectHeight = valueRect.height(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartProgressBar, getWebThemeState(this, o), rect, &extraParams); return false; } +#endif + } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.h b/Source/WebCore/rendering/RenderThemeChromiumLinux.h index 9eeca97..8f3eb98 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.h +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.h @@ -59,9 +59,25 @@ namespace WebCore { static void setCaretBlinkInterval(double interval); virtual double caretBlinkIntervalInternal() const; + virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); + virtual void setCheckboxSize(RenderStyle*) const; + + virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); + virtual void setRadioSize(RenderStyle*) const; + + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual void adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&); +#if ENABLE(PROGRESS_TAG) + virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); +#endif + static void setSelectionColors(unsigned activeBackgroundColor, unsigned activeForegroundColor, unsigned inactiveBackgroundColor, diff --git a/Source/WebCore/rendering/RenderThemeChromiumMac.mm b/Source/WebCore/rendering/RenderThemeChromiumMac.mm index 02eb134..10285ac 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/Source/WebCore/rendering/RenderThemeChromiumMac.mm @@ -20,8 +20,8 @@ #import "config.h" #import "RenderThemeChromiumMac.h" -#import "ChromiumBridge.h" #import "PaintInfo.h" +#import "PlatformBridge.h" #import "RenderMediaControlsChromium.h" #import "UserAgentStyleSheets.h" #import <Carbon/Carbon.h> @@ -71,7 +71,7 @@ PassRefPtr<RenderTheme> RenderThemeChromiumMac::create() bool RenderThemeChromiumMac::usesTestModeFocusRingColor() const { - return ChromiumBridge::layoutTestMode(); + return PlatformBridge::layoutTestMode(); } NSView* RenderThemeChromiumMac::documentViewFor(RenderObject*) const diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp index bb60c1f..9691876 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -24,7 +24,6 @@ #include "config.h" #include "RenderThemeChromiumSkia.h" -#include "ChromiumBridge.h" #include "CSSValueKeywords.h" #include "CurrentTime.h" #include "GraphicsContext.h" @@ -33,6 +32,7 @@ #include "Image.h" #include "MediaControlElements.h" #include "PaintInfo.h" +#include "PlatformBridge.h" #include "PlatformContextSkia.h" #include "RenderBox.h" #include "RenderMediaControlsChromium.h" @@ -68,38 +68,6 @@ static const float minSearchFieldResultsDecorationSize = 9; static const float maxSearchFieldResultsDecorationSize = 30; static const float defaultSearchFieldResultsButtonWidth = 18; -static void setSizeIfAuto(RenderStyle* style, const IntSize& size) -{ - if (style->width().isIntrinsicOrAuto()) - style->setWidth(Length(size.width(), Fixed)); - if (style->height().isAuto()) - style->setHeight(Length(size.height(), Fixed)); -} - -static void drawVertLine(SkCanvas* canvas, int x, int y1, int y2, const SkPaint& paint) -{ - SkIRect skrect; - skrect.set(x, y1, x + 1, y2 + 1); - canvas->drawIRect(skrect, paint); -} - -static void drawHorizLine(SkCanvas* canvas, int x1, int x2, int y, const SkPaint& paint) -{ - SkIRect skrect; - skrect.set(x1, y, x2 + 1, y + 1); - canvas->drawIRect(skrect, paint); -} - -static void drawBox(SkCanvas* canvas, const IntRect& rect, const SkPaint& paint) -{ - const int right = rect.x() + rect.width() - 1; - const int bottom = rect.y() + rect.height() - 1; - drawHorizLine(canvas, rect.x(), right, rect.y(), paint); - drawVertLine(canvas, right, rect.y(), bottom, paint); - drawHorizLine(canvas, rect.x(), right, bottom, paint); - drawVertLine(canvas, rect.x(), rect.y(), bottom, paint); -} - // We aim to match IE here. // -IE uses a font based on the encoding as the default font for form controls. // -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT), @@ -185,7 +153,7 @@ double RenderThemeChromiumSkia::caretBlinkInterval() const { // Disable the blinking caret in layout test mode, as it introduces // a race condition for the pixel tests. http://b/1198440 - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return 0; return caretBlinkIntervalInternal(); @@ -237,28 +205,6 @@ IntRect center(const IntRect& original, int width, int height) return IntRect(x, y, width, height); } -bool RenderThemeChromiumSkia::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - static Image* const checkedImage = Image::loadPlatformResource("linuxCheckboxOn").releaseRef(); - static Image* const uncheckedImage = Image::loadPlatformResource("linuxCheckboxOff").releaseRef(); - static Image* const indeterminateImage = Image::loadPlatformResource("linuxCheckboxIndeterminate").releaseRef(); - static Image* const disabledCheckedImage = Image::loadPlatformResource("linuxCheckboxDisabledOn").releaseRef(); - static Image* const disabledUncheckedImage = Image::loadPlatformResource("linuxCheckboxDisabledOff").releaseRef(); - static Image* const disabledIndeterminateImage = Image::loadPlatformResource("linuxCheckboxDisabledIndeterminate").releaseRef(); - - Image* image; - - if (isIndeterminate(o)) - image = isEnabled(o) ? indeterminateImage : disabledIndeterminateImage; - else if (isChecked(o)) - image = isEnabled(o) ? checkedImage : disabledCheckedImage; - else - image = isEnabled(o) ? uncheckedImage : disabledUncheckedImage; - - i.context->drawImage(image, o->style()->colorSpace(), center(rect, widgetStandardHeight, widgetStandardWidth)); - return false; -} - void RenderThemeChromiumSkia::setCheckboxSize(RenderStyle* style) const { // If the width and height are both specified, then we have nothing to do. @@ -270,108 +216,16 @@ void RenderThemeChromiumSkia::setCheckboxSize(RenderStyle* style) const // querying the theme gives you a larger size that accounts for the higher // DPI. Until our entire engine honors a DPI setting other than 96, we // can't rely on the theme's metrics. - const IntSize size(widgetStandardHeight, widgetStandardWidth); + const IntSize size(widgetStandardWidth, widgetStandardHeight); setSizeIfAuto(style, size); } -bool RenderThemeChromiumSkia::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - static Image* const checkedImage = Image::loadPlatformResource("linuxRadioOn").releaseRef(); - static Image* const uncheckedImage = Image::loadPlatformResource("linuxRadioOff").releaseRef(); - static Image* const disabledCheckedImage = Image::loadPlatformResource("linuxRadioDisabledOn").releaseRef(); - static Image* const disabledUncheckedImage = Image::loadPlatformResource("linuxRadioDisabledOff").releaseRef(); - - Image* image; - if (this->isEnabled(o)) - image = this->isChecked(o) ? checkedImage : uncheckedImage; - else - image = this->isChecked(o) ? disabledCheckedImage : disabledUncheckedImage; - - i.context->drawImage(image, o->style()->colorSpace(), center(rect, widgetStandardHeight, widgetStandardWidth)); - return false; -} - void RenderThemeChromiumSkia::setRadioSize(RenderStyle* style) const { // Use same sizing for radio box as checkbox. setCheckboxSize(style); } -static SkColor brightenColor(double h, double s, double l, float brightenAmount) -{ - l += brightenAmount; - if (l > 1.0) - l = 1.0; - if (l < 0.0) - l = 0.0; - - return makeRGBAFromHSLA(h, s, l, 1.0); -} - -static void paintButtonLike(RenderTheme* theme, RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - SkCanvas* const canvas = i.context->platformContext()->canvas(); - SkPaint paint; - SkRect skrect; - const int right = rect.x() + rect.width(); - const int bottom = rect.y() + rect.height(); - SkColor baseColor = SkColorSetARGB(0xff, 0xdd, 0xdd, 0xdd); - if (o->hasBackground()) - baseColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); - double h, s, l; - Color(baseColor).getHSL(h, s, l); - // Our standard gradient is from 0xdd to 0xf8. This is the amount of - // increased luminance between those values. - SkColor lightColor(brightenColor(h, s, l, 0.105)); - - // If the button is too small, fallback to drawing a single, solid color - if (rect.width() < 5 || rect.height() < 5) { - paint.setColor(baseColor); - skrect.set(rect.x(), rect.y(), right, bottom); - canvas->drawRect(skrect, paint); - return; - } - - const int borderAlpha = theme->isHovered(o) ? 0x80 : 0x55; - paint.setARGB(borderAlpha, 0, 0, 0); - canvas->drawLine(rect.x() + 1, rect.y(), right - 1, rect.y(), paint); - canvas->drawLine(right - 1, rect.y() + 1, right - 1, bottom - 1, paint); - canvas->drawLine(rect.x() + 1, bottom - 1, right - 1, bottom - 1, paint); - canvas->drawLine(rect.x(), rect.y() + 1, rect.x(), bottom - 1, paint); - - paint.setColor(SK_ColorBLACK); - SkPoint p[2]; - const int lightEnd = theme->isPressed(o) ? 1 : 0; - const int darkEnd = !lightEnd; - p[lightEnd].set(SkIntToScalar(rect.x()), SkIntToScalar(rect.y())); - p[darkEnd].set(SkIntToScalar(rect.x()), SkIntToScalar(bottom - 1)); - SkColor colors[2]; - colors[0] = lightColor; - colors[1] = baseColor; - - SkShader* shader = SkGradientShader::CreateLinear( - p, colors, NULL, 2, SkShader::kClamp_TileMode, NULL); - paint.setStyle(SkPaint::kFill_Style); - paint.setShader(shader); - shader->unref(); - - skrect.set(rect.x() + 1, rect.y() + 1, right - 1, bottom - 1); - canvas->drawRect(skrect, paint); - - paint.setShader(NULL); - paint.setColor(brightenColor(h, s, l, -0.0588)); - canvas->drawPoint(rect.x() + 1, rect.y() + 1, paint); - canvas->drawPoint(right - 2, rect.y() + 1, paint); - canvas->drawPoint(rect.x() + 1, bottom - 2, paint); - canvas->drawPoint(right - 2, bottom - 2, paint); -} - -bool RenderThemeChromiumSkia::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - paintButtonLike(this, o, i, rect); - return false; -} - void RenderThemeChromiumSkia::adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { if (style->appearance() == PushButtonPart) { @@ -380,12 +234,6 @@ void RenderThemeChromiumSkia::adjustButtonStyle(CSSStyleSelector*, RenderStyle* } } - -bool RenderThemeChromiumSkia::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - return true; -} - bool RenderThemeChromiumSkia::paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); @@ -622,30 +470,6 @@ void RenderThemeChromiumSkia::adjustMenuListStyle(CSSStyleSelector* selector, Re style->setLineHeight(RenderStyle::initialLineHeight()); } -bool RenderThemeChromiumSkia::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - SkCanvas* const canvas = i.context->platformContext()->canvas(); - const int right = rect.x() + rect.width(); - const int middle = rect.y() + rect.height() / 2; - - paintButtonLike(this, o, i, rect); - - SkPaint paint; - paint.setColor(SK_ColorBLACK); - paint.setAntiAlias(true); - paint.setStyle(SkPaint::kFill_Style); - - int arrowXPosition = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13; - SkPath path; - path.moveTo(arrowXPosition, middle - 3); - path.rLineTo(6, 0); - path.rLineTo(-3, 6); - path.close(); - canvas->drawPath(path, paint); - - return false; -} - void RenderThemeChromiumSkia::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const { adjustMenuListStyle(selector, style, e); @@ -657,69 +481,6 @@ bool RenderThemeChromiumSkia::paintMenuListButton(RenderObject* o, const PaintIn return paintMenuList(o, i, rect); } -bool RenderThemeChromiumSkia::paintSliderTrack(RenderObject*, const PaintInfo& i, const IntRect& rect) -{ - // Just paint a grey box for now (matches the color of a scrollbar background. - SkCanvas* const canvas = i.context->platformContext()->canvas(); - int verticalCenter = rect.y() + rect.height() / 2; - int top = std::max(rect.y(), verticalCenter - 2); - int bottom = std::min(rect.y() + rect.height(), verticalCenter + 2); - - SkPaint paint; - const SkColor grey = SkColorSetARGB(0xff, 0xe3, 0xdd, 0xd8); - paint.setColor(grey); - - SkRect skrect; - skrect.set(rect.x(), top, rect.x() + rect.width(), bottom); - canvas->drawRect(skrect, paint); - - return false; -} - -bool RenderThemeChromiumSkia::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - // Make a thumb similar to the scrollbar thumb. - const bool hovered = isHovered(o) || toRenderSlider(o->parent())->inDragMode(); - const int midx = rect.x() + rect.width() / 2; - const int midy = rect.y() + rect.height() / 2; - const bool vertical = (o->style()->appearance() == SliderThumbVerticalPart); - SkCanvas* const canvas = i.context->platformContext()->canvas(); - - const SkColor thumbLightGrey = SkColorSetARGB(0xff, 0xf4, 0xf2, 0xef); - const SkColor thumbDarkGrey = SkColorSetARGB(0xff, 0xea, 0xe5, 0xe0); - SkPaint paint; - paint.setColor(hovered ? SK_ColorWHITE : thumbLightGrey); - - SkIRect skrect; - if (vertical) - skrect.set(rect.x(), rect.y(), midx + 1, rect.bottom()); - else - skrect.set(rect.x(), rect.y(), rect.right(), midy + 1); - - canvas->drawIRect(skrect, paint); - - paint.setColor(hovered ? thumbLightGrey : thumbDarkGrey); - - if (vertical) - skrect.set(midx + 1, rect.y(), rect.right(), rect.bottom()); - else - skrect.set(rect.x(), midy + 1, rect.right(), rect.bottom()); - - canvas->drawIRect(skrect, paint); - - const SkColor borderDarkGrey = SkColorSetARGB(0xff, 0x9d, 0x96, 0x8e); - paint.setColor(borderDarkGrey); - drawBox(canvas, rect, paint); - - if (rect.height() > 10 && rect.width() > 10) { - drawHorizLine(canvas, midx - 2, midx + 2, midy, paint); - drawHorizLine(canvas, midx - 2, midx + 2, midy - 3, paint); - drawHorizLine(canvas, midx - 2, midx + 2, midy + 3, paint); - } - - return false; -} - int RenderThemeChromiumSkia::popupInternalPaddingLeft(RenderStyle* style) const { return menuListInternalPadding(style, LeftPadding); @@ -758,6 +519,15 @@ double RenderThemeChromiumSkia::caretBlinkIntervalInternal() const return RenderTheme::caretBlinkInterval(); } +// static +void RenderThemeChromiumSkia::setSizeIfAuto(RenderStyle* style, const IntSize& size) +{ + if (style->width().isIntrinsicOrAuto()) + style->setWidth(Length(size.width(), Fixed)); + if (style->height().isAuto()) + style->setHeight(Length(size.height(), Fixed)); +} + int RenderThemeChromiumSkia::menuListInternalPadding(RenderStyle* style, int paddingType) const { // This internal padding is in addition to the user-supplied padding. @@ -801,7 +571,7 @@ IntRect RenderThemeChromiumSkia::indeterminateProgressValueRectFor(RenderProgres int movableWidth = rect.width() - valueWidth; if (movableWidth <= 0) return IntRect(); - + double progress = renderProgress->animationProgress(); if (progress < 0.5) return IntRect(rect.x() + progress * 2 * movableWidth, rect.y(), valueWidth, rect.height()); @@ -818,67 +588,6 @@ double RenderThemeChromiumSkia::animationDurationForProgressBar(RenderProgress* return progressAnimationInterval * progressAnimationFrmaes * 2; // "2" for back and forth } -bool RenderThemeChromiumSkia::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) -{ - static Image* barImage = Image::loadPlatformResource("linuxProgressBar").releaseRef(); - static Image* valueImage = Image::loadPlatformResource("linuxProgressValue").releaseRef(); - static Image* leftBorderImage = Image::loadPlatformResource("linuxProgressBorderLeft").releaseRef(); - static Image* rightBorderImage = Image::loadPlatformResource("linuxProgressBorderRight").releaseRef(); - ASSERT(barImage->height() == valueImage->height()); - - if (!renderObject->isProgress()) - return true; - - paintInfo.context->platformContext()->setImageResamplingHint(barImage->size(), rect.size()); - - RenderProgress* renderProgress = toRenderProgress(renderObject); - double tileScale = static_cast<double>(rect.height()) / barImage->height(); - IntSize barTileSize(static_cast<int>(barImage->width() * tileScale), rect.height()); - ColorSpace colorSpace = renderObject->style()->colorSpace(); - - paintInfo.context->drawTiledImage(barImage, colorSpace, rect, IntPoint(0, 0), barTileSize); - - IntRect valueRect = progressValueRectFor(renderProgress, rect); - if (valueRect.width()) { - - IntSize valueTileSize(std::max(1, static_cast<int>(valueImage->width() * tileScale)), valueRect.height()); - - int leftOffset = valueRect.x() - rect.x(); - int roundedLeftOffset= (leftOffset / valueTileSize.width()) * valueTileSize.width(); - int dstLeftValueWidth = roundedLeftOffset - leftOffset + (leftOffset % valueImage->width()) ? valueTileSize.width() : 0; - - IntRect dstLeftValueRect(valueRect.x(), valueRect.y(), dstLeftValueWidth, valueRect.height()); - int srcLeftValueWidth = dstLeftValueWidth / tileScale; - IntRect srcLeftValueRect(valueImage->width() - srcLeftValueWidth, 0, srcLeftValueWidth, valueImage->height()); - paintInfo.context->drawImage(valueImage, colorSpace, dstLeftValueRect, srcLeftValueRect); - - int rightOffset = valueRect.right() - rect.x(); - int roundedRightOffset = (rightOffset / valueTileSize.width()) * valueTileSize.width(); - int dstRightValueWidth = rightOffset - roundedRightOffset; - IntRect dstRightValueRect(rect.x() + roundedRightOffset, valueRect.y(), dstRightValueWidth, valueTileSize.height()); - int srcRightValueWidth = dstRightValueWidth / tileScale; - IntRect srcRightValueRect(0, 0, srcRightValueWidth, valueImage->height()); - paintInfo.context->drawImage(valueImage, colorSpace, dstRightValueRect, srcRightValueRect); - - IntRect alignedValueRect(dstLeftValueRect.right(), dstLeftValueRect.y(), - dstRightValueRect.x() - dstLeftValueRect.right(), dstLeftValueRect.height()); - paintInfo.context->drawTiledImage(valueImage, colorSpace, alignedValueRect, IntPoint(0, 0), valueTileSize); - } - - int dstLeftBorderWidth = leftBorderImage->width() * tileScale; - IntRect dstLeftBorderRect(rect.x(), rect.y(), dstLeftBorderWidth, rect.height()); - paintInfo.context->drawImage(leftBorderImage, colorSpace, dstLeftBorderRect, leftBorderImage->rect()); - - int dstRightBorderWidth = rightBorderImage->width() * tileScale; - IntRect dstRightBorderRect(rect.right() - dstRightBorderWidth, rect.y(), dstRightBorderWidth, rect.height()); - paintInfo.context->drawImage(rightBorderImage, colorSpace, dstRightBorderRect, rightBorderImage->rect()); - - paintInfo.context->platformContext()->clearImageResamplingHint(); - - return false; -} - - IntRect RenderThemeChromiumSkia::progressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const { return renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, rect) : indeterminateProgressValueRectFor(renderProgress, rect); diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.h b/Source/WebCore/rendering/RenderThemeChromiumSkia.h index a11046d..bf0af34 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.h @@ -34,7 +34,7 @@ namespace WebCore { class RenderProgress; - class RenderThemeChromiumSkia : public RenderTheme { +class RenderThemeChromiumSkia : public RenderTheme { public: RenderThemeChromiumSkia(); virtual ~RenderThemeChromiumSkia(); @@ -66,17 +66,12 @@ class RenderProgress; virtual int minimumMenuListSize(RenderStyle*) const; - virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); virtual void setCheckboxSize(RenderStyle*) const; - virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); virtual void setRadioSize(RenderStyle*) const; - virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; @@ -112,17 +107,12 @@ class RenderProgress; // codepath. We never go down both. And in both cases, they render the // entire menulist. virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); - #if ENABLE(PROGRESS_TAG) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; - virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif // These methods define the padding for the MenuList's inner block. @@ -153,6 +143,8 @@ class RenderProgress; virtual double caretBlinkIntervalInternal() const; + static void setSizeIfAuto(RenderStyle*, const IntSize&); + #if ENABLE(PROGRESS_TAG) IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const; diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp index 5b41ea2..bba0520 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -30,7 +30,6 @@ #include <vssym32.h> #include "CSSValueKeywords.h" -#include "ChromiumBridge.h" #include "CurrentTime.h" #include "FontSelector.h" #include "FontUtilsChromiumWin.h" @@ -39,6 +38,7 @@ #include "HTMLNames.h" #include "MediaControlElements.h" #include "PaintInfo.h" +#include "PlatformBridge.h" #include "RenderBox.h" #include "RenderProgress.h" #include "RenderSlider.h" @@ -238,7 +238,7 @@ bool RenderThemeChromiumWin::supportsFocusRing(const RenderStyle* style) const Color RenderThemeChromiumWin::platformActiveSelectionBackgroundColor() const { - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return Color(0x00, 0x00, 0xff); // Royal blue. COLORREF color = GetSysColor(COLOR_HIGHLIGHT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff); @@ -246,7 +246,7 @@ Color RenderThemeChromiumWin::platformActiveSelectionBackgroundColor() const Color RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor() const { - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return Color(0x99, 0x99, 0x99); // Medium gray. COLORREF color = GetSysColor(COLOR_GRAYTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff); @@ -254,7 +254,7 @@ Color RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor() const Color RenderThemeChromiumWin::platformActiveSelectionForegroundColor() const { - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return Color(0xff, 0xff, 0xcc); // Pale yellow. COLORREF color = GetSysColor(COLOR_HIGHLIGHTTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff); @@ -375,7 +375,7 @@ static int cssValueIdToSysColorIndex(int cssValueId) Color RenderThemeChromiumWin::systemColor(int cssValueId) const { int sysColorIndex = cssValueIdToSysColorIndex(cssValueId); - if (ChromiumBridge::layoutTestMode() || (sysColorIndex == -1)) + if (PlatformBridge::layoutTestMode() || (sysColorIndex == -1)) return RenderTheme::systemColor(cssValueId); COLORREF color = GetSysColor(sysColorIndex); @@ -411,7 +411,7 @@ bool RenderThemeChromiumWin::paintButton(RenderObject* o, const PaintInfo& i, co const ThemeData& themeData = getThemeData(o); ThemePainter painter(i.context, r); - ChromiumBridge::paintButton(painter.context(), + PlatformBridge::paintButton(painter.context(), themeData.m_part, themeData.m_state, themeData.m_classicState, @@ -429,7 +429,7 @@ bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const PaintInfo& const ThemeData& themeData = getThemeData(o); ThemePainter painter(i.context, r); - ChromiumBridge::paintTrackbar(painter.context(), + PlatformBridge::paintTrackbar(painter.context(), themeData.m_part, themeData.m_state, themeData.m_classicState, @@ -444,7 +444,7 @@ bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const PaintInfo& static int menuListButtonWidth() { - static int width = ChromiumBridge::layoutTestMode() ? kStandardMenuListButtonWidth : GetSystemMetrics(SM_CXVSCROLL); + static int width = PlatformBridge::layoutTestMode() ? kStandardMenuListButtonWidth : GetSystemMetrics(SM_CXVSCROLL); return width; } @@ -492,7 +492,7 @@ bool RenderThemeChromiumWin::paintMenuList(RenderObject* o, const PaintInfo& i, // Get the correct theme data for a textfield and paint the menu. ThemePainter painter(i.context, rect); - ChromiumBridge::paintMenuList(painter.context(), + PlatformBridge::paintMenuList(painter.context(), CP_DROPDOWNBUTTON, determineState(o), determineClassicState(o), @@ -657,7 +657,7 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, bool drawEdges) { // Fallback to white if the specified color object is invalid. - // (Note ChromiumBridge::paintTextField duplicates this check). + // (Note PlatformBridge::paintTextField duplicates this check). Color backgroundColor(Color::white); if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor); @@ -676,14 +676,12 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, // 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); + i.context->addRoundedRectClip(o->style()->getRoundedBorderFor(r)); } { const ThemeData& themeData = getThemeData(o); ThemePainter painter(i.context, r); - ChromiumBridge::paintTextField(painter.context(), + PlatformBridge::paintTextField(painter.context(), themeData.m_part, themeData.m_state, themeData.m_classicState, @@ -712,7 +710,7 @@ bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const Pa half.setHeight(rect.height() / 2); const ThemeData& upThemeData = getThemeData(object, SpinButtonUp); ThemePainter upPainter(info.context, half); - ChromiumBridge::paintSpinButton(upPainter.context(), + PlatformBridge::paintSpinButton(upPainter.context(), upThemeData.m_part, upThemeData.m_state, upThemeData.m_classicState, @@ -721,7 +719,7 @@ bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const Pa half.setY(rect.y() + rect.height() / 2); const ThemeData& downThemeData = getThemeData(object, SpinButtonDown); ThemePainter downPainter(info.context, half); - ChromiumBridge::paintSpinButton(downPainter.context(), + PlatformBridge::paintSpinButton(downPainter.context(), downThemeData.m_part, downThemeData.m_state, downThemeData.m_classicState, @@ -762,7 +760,7 @@ bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const PaintInfo& IntRect valueRect = renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, r) : IntRect(0, 0, 0, 0); double animatedSeconds = renderProgress->animationStartTime() ? WTF::currentTime() - renderProgress->animationStartTime() : 0; ThemePainter painter(i.context, r); - ChromiumBridge::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds); + PlatformBridge::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds); return false; } diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index 0764093..605e958 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -1033,14 +1033,8 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn paintInfo.context->save(); - IntSize topLeftRadius; - IntSize topRightRadius; - IntSize bottomLeftRadius; - IntSize bottomRightRadius; - - o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - int radius = topLeftRadius.width(); + RoundedIntRect border = o->style()->getRoundedBorderFor(r); + int radius = border.radii().topLeft().width(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); @@ -1063,27 +1057,27 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false)); paintInfo.context->save(); CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(border); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); paintInfo.context->save(); CGContextClipToRect(context, topGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(topGradient), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSize())); CGContextDrawShading(context, topShading.get()); paintInfo.context->restore(); if (!bottomGradient.isEmpty()) { paintInfo.context->save(); CGContextClipToRect(context, bottomGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().bottomRight())); CGContextDrawShading(context, bottomShading.get()); paintInfo.context->restore(); } paintInfo.context->save(); CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(border); CGContextDrawShading(context, leftShading.get()); CGContextDrawShading(context, rightShading.get()); paintInfo.context->restore(); @@ -1304,9 +1298,7 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false)); IntSize radius(trackRadius, trackRadius); - paintInfo.context->addRoundedRectClip(bounds, - radius, radius, - radius, radius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(bounds, radius, radius, radius, radius)); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); diff --git a/Source/WebCore/rendering/RenderThemeSafari.cpp b/Source/WebCore/rendering/RenderThemeSafari.cpp index 3c1dedc..47f627e 100644 --- a/Source/WebCore/rendering/RenderThemeSafari.cpp +++ b/Source/WebCore/rendering/RenderThemeSafari.cpp @@ -752,14 +752,8 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain paintInfo.context->save(); - IntSize topLeftRadius; - IntSize topRightRadius; - IntSize bottomLeftRadius; - IntSize bottomRightRadius; - - o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - int radius = topLeftRadius.width(); + RoundedIntRect bound = o->style()->getRoundedBorderFor(r); + int radius = bound.radii().topLeft().width(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); @@ -781,28 +775,28 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false)); paintInfo.context->save(); - CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + CGContextClipToRect(context, bound.rect()); + paintInfo.context->addRoundedRectClip(bound); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); paintInfo.context->save(); CGContextClipToRect(context, topGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(topGradient), bound.radii().topLeft(), bound.radii().topRight(), IntSize(), IntSize())); CGContextDrawShading(context, topShading.get()); paintInfo.context->restore(); if (!bottomGradient.isEmpty()) { paintInfo.context->save(); CGContextClipToRect(context, bottomGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bound.radii().bottomLeft(), bound.radii().bottomRight())); CGContextDrawShading(context, bottomShading.get()); paintInfo.context->restore(); } paintInfo.context->save(); - CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + CGContextClipToRect(context, bound.rect()); + paintInfo.context->addRoundedRectClip(bound); CGContextDrawShading(context, leftShading.get()); CGContextDrawShading(context, rightShading.get()); paintInfo.context->restore(); @@ -958,34 +952,35 @@ const int trackRadius = 2; bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { - IntRect bounds = r; - - if (o->style()->appearance() == SliderHorizontalPart) { - bounds.setHeight(trackWidth); - bounds.setY(r.y() + r.height() / 2 - trackWidth / 2); - } else if (o->style()->appearance() == SliderVerticalPart) { - bounds.setWidth(trackWidth); - bounds.setX(r.x() + r.width() / 2 - trackWidth / 2); - } + IntSize radius(trackRadius, trackRadius); + RoundedIntRect bounds(r, radius, radius, radius, radius); + + if (o->style()->appearance() == SliderHorizontalPart) + bounds.setRect(IntRect(r.x(), + r.y() + r.height() / 2 - trackWidth / 2, + r.width(), + trackWidth)); + else if (o->style()->appearance() == SliderVerticalPart) + bounds.setRect(IntRect(r.x() + r.width() / 2 - trackWidth / 2, + r.y(), + trackWidth, + r.height())); CGContextRef context = paintInfo.context->platformContext(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); paintInfo.context->save(); - CGContextClipToRect(context, bounds); + CGContextClipToRect(context, bounds.rect()); struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL }; RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks)); RetainPtr<CGShadingRef> mainShading; if (o->style()->appearance() == SliderVerticalPart) - mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false)); + mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(), bounds.rect().bottom()), CGPointMake(bounds.rect().right(), bounds.rect().bottom()), mainFunction.get(), false, false)); else - mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false)); + mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(), bounds.rect().y()), CGPointMake(bounds.rect().x(), bounds.rect().bottom()), mainFunction.get(), false, false)); - IntSize radius(trackRadius, trackRadius); - paintInfo.context->addRoundedRectClip(bounds, - radius, radius, - radius, radius); + paintInfo.context->addRoundedRectClip(bounds); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); diff --git a/Source/WebCore/rendering/RenderThemeWinCE.cpp b/Source/WebCore/rendering/RenderThemeWinCE.cpp index 2c55f31..d4bff96 100644 --- a/Source/WebCore/rendering/RenderThemeWinCE.cpp +++ b/Source/WebCore/rendering/RenderThemeWinCE.cpp @@ -378,7 +378,7 @@ bool RenderThemeWinCE::paintSearchFieldCancelButton(RenderObject* o, const Paint int y = r.y() + (r.height() - cancelSize.height()) / 2 + 1; IntRect cancelBounds(IntPoint(x, y), cancelSize); paintInfo.context->save(); - paintInfo.context->addRoundedRectClip(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius)); paintInfo.context->fillRect(cancelBounds, buttonColor, ColorSpaceDeviceRGB); // Draw the 'x' diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index 2915998..14b94ec 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -267,7 +267,8 @@ void toRenderView(const RenderView*); // Stack-based class to assist with LayoutState push/pop -class LayoutStateMaintainer : public Noncopyable { +class LayoutStateMaintainer { + WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer); public: // ctor to push now LayoutStateMaintainer(RenderView* view, RenderBox* root, IntSize offset, bool disableState = false, int pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) diff --git a/Source/WebCore/rendering/RenderWidget.cpp b/Source/WebCore/rendering/RenderWidget.cpp index 22283a0..d4b8ba6 100644 --- a/Source/WebCore/rendering/RenderWidget.cpp +++ b/Source/WebCore/rendering/RenderWidget.cpp @@ -275,11 +275,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty) // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. paintInfo.context->save(); - - IntSize topLeft, topRight, bottomLeft, bottomRight; - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect)); } if (m_widget) { diff --git a/Source/WebCore/rendering/RenderWidgetProtector.h b/Source/WebCore/rendering/RenderWidgetProtector.h index 788304c..8bf6ac9 100644 --- a/Source/WebCore/rendering/RenderWidgetProtector.h +++ b/Source/WebCore/rendering/RenderWidgetProtector.h @@ -30,7 +30,8 @@ namespace WebCore { -class RenderWidgetProtector : private Noncopyable { +class RenderWidgetProtector { + WTF_MAKE_NONCOPYABLE(RenderWidgetProtector); public: RenderWidgetProtector(RenderWidget* object) : m_object(object) diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp index 65130e7..e9e2029 100644 --- a/Source/WebCore/rendering/RootInlineBox.cpp +++ b/Source/WebCore/rendering/RootInlineBox.cpp @@ -266,6 +266,8 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn heightOfBlock += annotationsAdjustment; } + maxHeight = max(0, maxHeight); + // Detect integer overflow. if (heightOfBlock > numeric_limits<int>::max() - maxHeight) return numeric_limits<int>::max(); diff --git a/Source/WebCore/rendering/ShadowElement.h b/Source/WebCore/rendering/ShadowElement.h index 2c1a69e..8bcb34e 100644 --- a/Source/WebCore/rendering/ShadowElement.h +++ b/Source/WebCore/rendering/ShadowElement.h @@ -39,16 +39,12 @@ class ShadowElement : public BaseElement { protected: ShadowElement(const QualifiedName& name, HTMLElement* shadowParent) : BaseElement(name, shadowParent->document()) - , m_shadowParent(shadowParent) { BaseElement::setShadowHost(shadowParent); } public: virtual void detach(); - -private: - RefPtr<HTMLElement> m_shadowParent; }; template<class BaseElement> diff --git a/Source/WebCore/rendering/TableLayout.h b/Source/WebCore/rendering/TableLayout.h index e0fa8ee..c5f61f6 100644 --- a/Source/WebCore/rendering/TableLayout.h +++ b/Source/WebCore/rendering/TableLayout.h @@ -21,13 +21,15 @@ #ifndef TableLayout_h #define TableLayout_h +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { class RenderTable; -class TableLayout : public Noncopyable { +class TableLayout { + WTF_MAKE_NONCOPYABLE(TableLayout); WTF_MAKE_FAST_ALLOCATED; public: TableLayout(RenderTable* table) : m_table(table) diff --git a/Source/WebCore/rendering/TextControlInnerElements.cpp b/Source/WebCore/rendering/TextControlInnerElements.cpp index 5b8712d..7b1b36f 100644 --- a/Source/WebCore/rendering/TextControlInnerElements.cpp +++ b/Source/WebCore/rendering/TextControlInnerElements.cpp @@ -119,7 +119,8 @@ void TextControlInnerElement::detach() { HTMLDivElement::detach(); // FIXME: Remove once shadow DOM uses Element::setShadowRoot(). - setShadowHost(0); + if (shadowHost()) + setShadowHost(0); } // ---------------------------- @@ -243,7 +244,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event) input->setValue(""); if (!oldValue.isEmpty()) { toRenderTextControl(input->renderer())->setChangedSinceLastChangeEvent(true); - input->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); + input->dispatchFormControlInputEvent(); } input->onSearch(); event->setDefaultHandled(); @@ -433,9 +434,13 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event) if (event->type() == eventNames().clickEvent) { switch (m_state) { - case Idle: - if (speechInput()->startRecognition(m_listenerId, input->renderer()->absoluteBoundingBoxRect(), input->computeInheritedLanguage(), input->getAttribute(webkitgrammarAttr))) - setState(Recording); + case Idle: { + AtomicString language = input->computeInheritedLanguage(); + String grammar = input->getAttribute(webkitgrammarAttr); + IntRect rect = input->renderer()->absoluteBoundingBoxRect(); + if (speechInput()->startRecognition(m_listenerId, rect, language, grammar, document()->securityOrigin())) + setState(Recording); + } break; case Recording: speechInput()->stopRecording(m_listenerId); diff --git a/Source/WebCore/rendering/TransformState.h b/Source/WebCore/rendering/TransformState.h index 0b4ca46..36fc6ec 100644 --- a/Source/WebCore/rendering/TransformState.h +++ b/Source/WebCore/rendering/TransformState.h @@ -31,14 +31,14 @@ #include "FloatQuad.h" #include "IntSize.h" #include "TransformationMatrix.h" -#include <wtf/Noncopyable.h> #include <wtf/PassRefPtr.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> namespace WebCore { -class TransformState : public Noncopyable { +class TransformState { + WTF_MAKE_NONCOPYABLE(TransformState); public: enum TransformDirection { ApplyTransformDirection, UnapplyInverseTransformDirection }; enum TransformAccumulation { FlattenTransform, AccumulateTransform }; diff --git a/Source/WebCore/rendering/VerticalPositionCache.h b/Source/WebCore/rendering/VerticalPositionCache.h index 4deaef5..b25b2f6 100644 --- a/Source/WebCore/rendering/VerticalPositionCache.h +++ b/Source/WebCore/rendering/VerticalPositionCache.h @@ -38,7 +38,8 @@ const int PositionTop = -0x7fffffff; const int PositionBottom = 0x7fffffff; const int PositionUndefined = 0x80000000; -class VerticalPositionCache : public Noncopyable { +class VerticalPositionCache { + WTF_MAKE_NONCOPYABLE(VerticalPositionCache); public: VerticalPositionCache() { } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp index 7117618..9d80fbe 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp @@ -39,12 +39,12 @@ namespace WebCore { using namespace MathMLNames; -static const double gHorizontalPad = 0.2; -static const double gLineThin = 0.33; -static const double gLineMedium = 1.; -static const double gLineThick = 3.; -static const double gFractionBarWidth = 0.05; -static const double gDenominatorPad = 0.1; +static const float gHorizontalPad = 0.2f; +static const float gLineThin = 0.33f; +static const float gLineMedium = 1.f; +static const float gLineThick = 3.f; +static const float gFractionBarWidth = 0.05f; +static const float gDenominatorPad = 0.1f; RenderMathMLFraction::RenderMathMLFraction(Element* fraction) : RenderMathMLBlock(fraction) @@ -125,7 +125,7 @@ void RenderMathMLFraction::layout() // Adjust the fraction line thickness for the zoom if (lastChild() && lastChild()->isRenderBlock()) - m_lineThickness *= ceil(gFractionBarWidth * style()->fontSize()); + m_lineThickness *= ceilf(gFractionBarWidth * style()->fontSize()); RenderBlock::layout(); @@ -158,7 +158,7 @@ void RenderMathMLFraction::paint(PaintInfo& info, int tx, int ty) info.context->save(); - info.context->setStrokeThickness(static_cast<float>(m_lineThickness)); + info.context->setStrokeThickness(m_lineThickness); info.context->setStrokeStyle(SolidStroke); info.context->setStrokeColor(style()->visitedDependentColor(CSSPropertyColor), ColorSpaceSRGB); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h index 2a03f81..c96d56d 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h @@ -43,7 +43,7 @@ public: protected: virtual void layout(); private: - double m_lineThickness; + float m_lineThickness; }; } diff --git a/Source/WebCore/rendering/style/BorderData.h b/Source/WebCore/rendering/style/BorderData.h index 03635d9..0e50edb 100644 --- a/Source/WebCore/rendering/style/BorderData.h +++ b/Source/WebCore/rendering/style/BorderData.h @@ -26,6 +26,7 @@ #define BorderData_h #include "BorderValue.h" +#include "IntRect.h" #include "LengthSize.h" #include "NinePieceImage.h" @@ -109,7 +110,7 @@ public: const LengthSize& topRight() const { return m_topRight; } const LengthSize& bottomLeft() const { return m_bottomLeft; } const LengthSize& bottomRight() const { return m_bottomRight; } - + private: BorderValue m_left; BorderValue m_right; diff --git a/Source/WebCore/rendering/style/ContentData.h b/Source/WebCore/rendering/style/ContentData.h index 4f964a2..15f6912 100644 --- a/Source/WebCore/rendering/style/ContentData.h +++ b/Source/WebCore/rendering/style/ContentData.h @@ -33,7 +33,8 @@ namespace WebCore { class StyleImage; -struct ContentData : Noncopyable { +struct ContentData { + WTF_MAKE_NONCOPYABLE(ContentData); WTF_MAKE_FAST_ALLOCATED; public: ContentData() : m_type(CONTENT_NONE) diff --git a/Source/WebCore/rendering/style/CounterContent.h b/Source/WebCore/rendering/style/CounterContent.h index 52757ad..814039e 100644 --- a/Source/WebCore/rendering/style/CounterContent.h +++ b/Source/WebCore/rendering/style/CounterContent.h @@ -30,7 +30,8 @@ namespace WebCore { -class CounterContent : public FastAllocBase { +class CounterContent { + WTF_MAKE_FAST_ALLOCATED; public: CounterContent(const AtomicString& identifier, EListStyleType style, const AtomicString& separator) : m_identifier(identifier) diff --git a/Source/WebCore/rendering/style/FillLayer.h b/Source/WebCore/rendering/style/FillLayer.h index 49fb294..847e8df 100644 --- a/Source/WebCore/rendering/style/FillLayer.h +++ b/Source/WebCore/rendering/style/FillLayer.h @@ -59,7 +59,8 @@ struct FillSize { LengthSize size; }; -class FillLayer : public FastAllocBase { +class FillLayer { + WTF_MAKE_FAST_ALLOCATED; public: FillLayer(EFillLayerType); ~FillLayer(); diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 4665e52..2836fb9 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -744,7 +744,19 @@ void RenderStyle::setBoxShadow(ShadowData* shadowData, bool add) rareData->m_boxShadow.set(shadowData); } -static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) +static RoundedIntRect::Radii calcRadiiFor(const BorderData& border, int width, int height) +{ + return RoundedIntRect::Radii(IntSize(border.topLeft().width().calcValue(width), + border.topLeft().height().calcValue(height)), + IntSize(border.topRight().width().calcValue(width), + border.topRight().height().calcValue(height)), + IntSize(border.bottomLeft().width().calcValue(width), + border.bottomLeft().height().calcValue(height)), + IntSize(border.bottomRight().width().calcValue(width), + border.bottomRight().height().calcValue(height))); +} + +static float calcConstraintScaleFor(const IntRect& rect, const RoundedIntRect::Radii& radii) { // Constrain corner radii using CSS3 rules: // http://www.w3.org/TR/css3-background/#the-border-radius @@ -753,75 +765,43 @@ static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntS unsigned radiiSum; // top - radiiSum = static_cast<unsigned>(topLeft.width()) + static_cast<unsigned>(topRight.width()); // Casts to avoid integer overflow. - if (radiiSum > static_cast<unsigned>(r.width())) - factor = min(static_cast<float>(r.width()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.topLeft().width()) + static_cast<unsigned>(radii.topRight().width()); // Casts to avoid integer overflow. + if (radiiSum > static_cast<unsigned>(rect.width())) + factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor); // bottom - radiiSum = static_cast<unsigned>(bottomLeft.width()) + static_cast<unsigned>(bottomRight.width()); - if (radiiSum > static_cast<unsigned>(r.width())) - factor = min(static_cast<float>(r.width()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.bottomLeft().width()) + static_cast<unsigned>(radii.bottomRight().width()); + if (radiiSum > static_cast<unsigned>(rect.width())) + factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor); // left - radiiSum = static_cast<unsigned>(topLeft.height()) + static_cast<unsigned>(bottomLeft.height()); - if (radiiSum > static_cast<unsigned>(r.height())) - factor = min(static_cast<float>(r.height()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.topLeft().height()) + static_cast<unsigned>(radii.bottomLeft().height()); + if (radiiSum > static_cast<unsigned>(rect.height())) + factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor); // right - radiiSum = static_cast<unsigned>(topRight.height()) + static_cast<unsigned>(bottomRight.height()); - if (radiiSum > static_cast<unsigned>(r.height())) - factor = min(static_cast<float>(r.height()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.topRight().height()) + static_cast<unsigned>(radii.bottomRight().height()); + if (radiiSum > static_cast<unsigned>(rect.height())) + factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor); - // Scale all radii by f if necessary. - if (factor < 1) { - // If either radius on a corner becomes zero, reset both radii on that corner. - topLeft.scale(factor); - if (!topLeft.width() || !topLeft.height()) - topLeft = IntSize(); - topRight.scale(factor); - if (!topRight.width() || !topRight.height()) - topRight = IntSize(); - bottomLeft.scale(factor); - if (!bottomLeft.width() || !bottomLeft.height()) - bottomLeft = IntSize(); - bottomRight.scale(factor); - if (!bottomRight.width() || !bottomRight.height()) - bottomRight = IntSize(); - } + ASSERT(factor <= 1); + return factor; } -void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const +RoundedIntRect RenderStyle::getRoundedBorderFor(const IntRect& rect) const { - topLeft = IntSize(surround->border.topLeft().width().calcValue(r.width()), surround->border.topLeft().height().calcValue(r.height())); - topRight = IntSize(surround->border.topRight().width().calcValue(r.width()), surround->border.topRight().height().calcValue(r.height())); - - bottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(r.width()), surround->border.bottomLeft().height().calcValue(r.height())); - bottomRight = IntSize(surround->border.bottomRight().width().calcValue(r.width()), surround->border.bottomRight().height().calcValue(r.height())); - - constrainCornerRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); + RoundedIntRect::Radii radii = calcRadiiFor(surround->border, rect.width(), rect.height()); + radii.scale(calcConstraintScaleFor(rect, radii)); + return RoundedIntRect(rect, radii); } -void RenderStyle::getInnerBorderRadiiForRectWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, IntSize& innerBottomRight) const +RoundedIntRect RenderStyle::getRoundedInnerBorderWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, + unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const { - innerTopLeft = IntSize(surround->border.topLeft().width().calcValue(innerRect.width()), surround->border.topLeft().height().calcValue(innerRect.height())); - innerTopRight = IntSize(surround->border.topRight().width().calcValue(innerRect.width()), surround->border.topRight().height().calcValue(innerRect.height())); - innerBottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(innerRect.width()), surround->border.bottomLeft().height().calcValue(innerRect.height())); - innerBottomRight = IntSize(surround->border.bottomRight().width().calcValue(innerRect.width()), surround->border.bottomRight().height().calcValue(innerRect.height())); - - - innerTopLeft.setWidth(max(0, innerTopLeft.width() - leftWidth)); - innerTopLeft.setHeight(max(0, innerTopLeft.height() - topWidth)); - - innerTopRight.setWidth(max(0, innerTopRight.width() - rightWidth)); - innerTopRight.setHeight(max(0, innerTopRight.height() - topWidth)); - - innerBottomLeft.setWidth(max(0, innerBottomLeft.width() - leftWidth)); - innerBottomLeft.setHeight(max(0, innerBottomLeft.height() - bottomWidth)); - - innerBottomRight.setWidth(max(0, innerBottomRight.width() - rightWidth)); - innerBottomRight.setHeight(max(0, innerBottomRight.height() - bottomWidth)); - - constrainCornerRadiiForRect(innerRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); + RoundedIntRect::Radii radii = calcRadiiFor(surround->border, innerRect.width(), innerRect.height()); + radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth); + radii.scale(calcConstraintScaleFor(innerRect, radii)); + return RoundedIntRect(innerRect, radii); } const CounterDirectiveMap* RenderStyle::counterDirectives() const diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 14329bc..9d5239b 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -43,6 +43,8 @@ #include "NinePieceImage.h" #include "OutlineValue.h" #include "RenderStyleConstants.h" +#include "RoundedIntRect.h" +#include "ShadowData.h" #include "StyleBackgroundData.h" #include "StyleBoxData.h" #include "StyleFlexibleBoxData.h" @@ -862,13 +864,10 @@ public: { setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); } - - void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const; - void getInnerBorderRadiiForRectWithBorderWidths(const IntRect&, unsigned short topWidth, - unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, - IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, - IntSize& innerBottomRight) const; + RoundedIntRect getRoundedBorderFor(const IntRect&) const; + RoundedIntRect getRoundedInnerBorderWithBorderWidths(const IntRect&, unsigned short topWidth, + unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const; void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) } void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) } @@ -1212,11 +1211,11 @@ public: bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAffectedByBackwardPositionalRules; } void setChildrenAffectedByBackwardPositionalRules() { m_childrenAffectedByBackwardPositionalRules = true; } bool firstChildState() const { return m_firstChildState; } - void setFirstChildState() { m_firstChildState = true; } + void setFirstChildState() { m_unique = true; m_firstChildState = true; } bool lastChildState() const { return m_lastChildState; } - void setLastChildState() { m_lastChildState = true; } + void setLastChildState() { m_unique = true; m_lastChildState = true; } unsigned childIndex() const { return m_childIndex; } - void setChildIndex(unsigned index) { m_childIndex = index; } + void setChildIndex(unsigned index) { m_unique = true; m_childIndex = index; } const Color visitedDependentColor(int colorProperty) const; diff --git a/Source/WebCore/rendering/style/ShadowData.h b/Source/WebCore/rendering/style/ShadowData.h index fb5926d..0be3fc1 100644 --- a/Source/WebCore/rendering/style/ShadowData.h +++ b/Source/WebCore/rendering/style/ShadowData.h @@ -26,7 +26,6 @@ #define ShadowData_h #include "Color.h" -#include <wtf/FastAllocBase.h> namespace WebCore { @@ -37,7 +36,8 @@ enum ShadowStyle { Normal, Inset }; // This struct holds information about shadows for the text-shadow and box-shadow properties. -class ShadowData : public FastAllocBase { +class ShadowData { + WTF_MAKE_FAST_ALLOCATED; public: ShadowData() : m_x(0) diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h index 7f862a7..99861d8 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h @@ -35,7 +35,9 @@ namespace WebCore { -struct ClipperData : FastAllocBase { +struct ClipperData { + WTF_MAKE_FAST_ALLOCATED; +public: OwnPtr<ImageBuffer> clipMaskImage; }; diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp index 2a8a47f..0215e8e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp @@ -182,8 +182,8 @@ AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderOb return resourceTransform; SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); - AffineTransform transform = resourceTransform; - transform.multiply(element->getScreenCTM(SVGLocatable::DisallowStyleUpdate)); + AffineTransform transform = element->getScreenCTM(SVGLocatable::DisallowStyleUpdate); + transform *= resourceTransform; return transform; } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp index 5ad5d84..9f2bb8d 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp @@ -133,7 +133,7 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context, matrix.translate(maskBoundingBox.x(), maskBoundingBox.y()); matrix.scaleNonUniform(maskBoundingBox.width(), maskBoundingBox.height()); } - matrix.multLeft(gradientTransform); + matrix *= gradientTransform; return matrix; } #endif @@ -190,7 +190,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* AffineTransform gradientTransform; calculateGradientTransform(gradientTransform); - gradientData->userspaceTransform.multLeft(gradientTransform); + gradientData->userspaceTransform *= gradientTransform; gradientData->gradient->setGradientSpaceTransform(gradientData->userspaceTransform); } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp index 330a21a..1b14ce4 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp @@ -139,7 +139,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* AffineTransform patternTransform = m_attributes.patternTransform(); if (!patternTransform.isIdentity()) - patternData->transform.multiply(patternTransform); + patternData->transform = patternTransform * patternData->transform; patternData->pattern->setPatternSpaceTransform(patternData->transform); } @@ -228,7 +228,7 @@ bool RenderSVGResourcePattern::buildTileImageTransform(RenderObject* renderer, if (patternBoundaries.width() <= 0 || patternBoundaries.height() <= 0) return false; - AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(patternElement->viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); + AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(attributes.viewBox(), attributes.preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); // Apply viewBox/objectBoundingBox transformations. if (!viewBoxCTM.isIdentity()) diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp index aa87b09..3a8dce9 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp @@ -246,7 +246,7 @@ AffineTransform RenderSVGRoot::localToBorderBoxTransform() const float scale = svg->currentScale(); FloatPoint translate = svg->currentTranslate(); AffineTransform ctm(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()); - return svg->viewBoxToViewTransform(width() / scale, height() / scale) * ctm; + return ctm * svg->viewBoxToViewTransform(width() / scale, height() / scale); } IntSize RenderSVGRoot::parentOriginToBorderBox() const diff --git a/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp b/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp index f0657af..6726694 100644 --- a/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp +++ b/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp @@ -43,7 +43,7 @@ void SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem( absoluteTransform = currentContentTransformation(); while (current) { - absoluteTransform.multiply(current->localToParentTransform()); + absoluteTransform = current->localToParentTransform() * absoluteTransform; if (current->isSVGRoot()) break; current = current->parent(); @@ -83,7 +83,7 @@ void SVGImageBufferTools::renderSubtreeToImageBuffer(ImageBuffer* image, RenderO AffineTransform& contentTransformation = currentContentTransformation(); AffineTransform savedContentTransformation = contentTransformation; - contentTransformation.multiply(subtreeContentTransformation); + contentTransformation = subtreeContentTransformation * contentTransformation; item->layoutIfNeeded(); item->paint(info, 0, 0); diff --git a/Source/WebCore/rendering/svg/SVGImageBufferTools.h b/Source/WebCore/rendering/svg/SVGImageBufferTools.h index cfb15b2..11577c0 100644 --- a/Source/WebCore/rendering/svg/SVGImageBufferTools.h +++ b/Source/WebCore/rendering/svg/SVGImageBufferTools.h @@ -32,7 +32,8 @@ class FloatSize; class GraphicsContext; class RenderObject; -class SVGImageBufferTools : public Noncopyable { +class SVGImageBufferTools { + WTF_MAKE_NONCOPYABLE(SVGImageBufferTools); public: static bool createImageBuffer(const FloatRect& absoluteTargetRect, const FloatRect& clampedAbsoluteTargetRect, OwnPtr<ImageBuffer>&, ColorSpace); static void renderSubtreeToImageBuffer(ImageBuffer*, RenderObject*, const AffineTransform&); diff --git a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp index f370310..2879f20 100644 --- a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp +++ b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp @@ -31,6 +31,7 @@ #include "RenderSVGResource.h" #include "RenderSVGResourceSolidColor.h" #include "SVGRootInlineBox.h" +#include "TextRun.h" using namespace std; diff --git a/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h b/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h index 0eb3689..32317b9 100644 --- a/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h +++ b/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h @@ -21,6 +21,7 @@ #define SVGMarkerLayoutInfo_h #if ENABLE(SVG) +#include "AffineTransform.h" #include "RenderObject.h" #include "SVGMarkerData.h" #include <wtf/Noncopyable.h> @@ -42,7 +43,8 @@ struct MarkerLayout { AffineTransform matrix; }; -class SVGMarkerLayoutInfo : public Noncopyable { +class SVGMarkerLayoutInfo { + WTF_MAKE_NONCOPYABLE(SVGMarkerLayoutInfo); public: SVGMarkerLayoutInfo(); ~SVGMarkerLayoutInfo(); diff --git a/Source/WebCore/rendering/svg/SVGResources.h b/Source/WebCore/rendering/svg/SVGResources.h index dd328b8..48cca23 100644 --- a/Source/WebCore/rendering/svg/SVGResources.h +++ b/Source/WebCore/rendering/svg/SVGResources.h @@ -38,7 +38,8 @@ class RenderSVGResourceMasker; class SVGRenderStyle; // Holds a set of resources associated with a RenderObject -class SVGResources : public Noncopyable { +class SVGResources { + WTF_MAKE_NONCOPYABLE(SVGResources); WTF_MAKE_FAST_ALLOCATED; public: SVGResources(); diff --git a/Source/WebCore/rendering/svg/SVGResourcesCache.h b/Source/WebCore/rendering/svg/SVGResourcesCache.h index 30eaeca..bc73f4d 100644 --- a/Source/WebCore/rendering/svg/SVGResourcesCache.h +++ b/Source/WebCore/rendering/svg/SVGResourcesCache.h @@ -31,7 +31,8 @@ class RenderStyle; class RenderSVGResourceContainer; class SVGResources; -class SVGResourcesCache : public Noncopyable { +class SVGResourcesCache { + WTF_MAKE_NONCOPYABLE(SVGResourcesCache); WTF_MAKE_FAST_ALLOCATED; public: SVGResourcesCache(); ~SVGResourcesCache(); diff --git a/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h b/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h index 0653304..099f91c 100644 --- a/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h +++ b/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h @@ -29,7 +29,8 @@ class RenderObject; class RenderSVGResourceContainer; class SVGResources; -class SVGResourcesCycleSolver : public Noncopyable { +class SVGResourcesCycleSolver { + WTF_MAKE_NONCOPYABLE(SVGResourcesCycleSolver); public: SVGResourcesCycleSolver(RenderObject*, SVGResources*); ~SVGResourcesCycleSolver(); diff --git a/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h b/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h index 36342e7..321f391 100644 --- a/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h +++ b/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h @@ -35,7 +35,8 @@ struct SVGTextFragment; // Phase two performed the actual per-character layout, computing the final positions for each character, stored in the SVGInlineTextBox objects (SVGTextFragment). // Phase three performs all modifications that have to be applied to each individual text chunk (text-anchor & textLength). -class SVGTextChunkBuilder : public Noncopyable { +class SVGTextChunkBuilder { + WTF_MAKE_NONCOPYABLE(SVGTextChunkBuilder); public: SVGTextChunkBuilder(); diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h b/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h index f29ac64..c68185b 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h @@ -38,7 +38,8 @@ class RenderSVGText; // to create the InlineBox tree based on text chunk boundaries & BiDi information. // The second layout phase is carried out by SVGTextLayoutEngine. -class SVGTextLayoutAttributesBuilder : public Noncopyable { +class SVGTextLayoutAttributesBuilder { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutAttributesBuilder); public: SVGTextLayoutAttributesBuilder(); void buildLayoutAttributesForTextSubtree(RenderSVGText*); diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp index 7eefad6..3b28d2b 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp @@ -321,7 +321,7 @@ void SVGTextLayoutEngine::finalizeTransformMatrices(Vector<SVGInlineTextBox*>& b if (transform.isIdentity()) transform = textBoxTransformation; else - transform.multiply(textBoxTransformation); + transform = textBoxTransformation * transform; } } diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h index ad058d8..631e4cd 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h @@ -44,7 +44,8 @@ class SVGRenderStyle; // RenderSVGInlineText renderers to compute the final positions for each character // which are stored in the SVGInlineTextBox objects. -class SVGTextLayoutEngine : public Noncopyable { +class SVGTextLayoutEngine { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngine); public: SVGTextLayoutEngine(); SVGTextChunkBuilder& chunkLayoutBuilder() { return m_chunkLayoutBuilder; } diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h b/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h index d753b39..6794bf3 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h @@ -33,7 +33,8 @@ class SVGRenderStyle; class SVGTextMetrics; // Helper class used by SVGTextLayoutEngine to handle 'alignment-baseline' / 'dominant-baseline' and 'baseline-shift'. -class SVGTextLayoutEngineBaseline : public Noncopyable { +class SVGTextLayoutEngineBaseline { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngineBaseline); public: SVGTextLayoutEngineBaseline(const Font&); diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h b/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h index 0a6d736..71d4707 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h @@ -30,7 +30,8 @@ class SVGRenderStyle; class SVGElement; // Helper class used by SVGTextLayoutEngine to handle 'kerning' / 'letter-spacing' and 'word-spacing'. -class SVGTextLayoutEngineSpacing : public Noncopyable { +class SVGTextLayoutEngineSpacing { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngineSpacing); public: SVGTextLayoutEngineSpacing(const Font&); diff --git a/Source/WebCore/rendering/svg/SVGTextMetrics.cpp b/Source/WebCore/rendering/svg/SVGTextMetrics.cpp index 58d0ad9..ec8c2c6 100644 --- a/Source/WebCore/rendering/svg/SVGTextMetrics.cpp +++ b/Source/WebCore/rendering/svg/SVGTextMetrics.cpp @@ -23,6 +23,7 @@ #include "SVGTextMetrics.h" #include "RenderSVGInlineText.h" +#include "TextRun.h" namespace WebCore { |