diff options
author | Steve Block <steveblock@google.com> | 2010-07-08 12:51:48 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-07-09 15:33:40 +0100 |
commit | ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 (patch) | |
tree | bb45155550ec013adc0ad10f4d7d354c6469b022 /WebCore/rendering | |
parent | d4b24d9a829ed7de70381c8b99fb75a07ab40466 (diff) | |
download | external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.zip external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.gz external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.bz2 |
Merge WebKit at r62496: Initial merge by git
Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2
Diffstat (limited to 'WebCore/rendering')
104 files changed, 1798 insertions, 885 deletions
diff --git a/WebCore/rendering/EllipsisBox.cpp b/WebCore/rendering/EllipsisBox.cpp index 9d36086..96efbe2 100644 --- a/WebCore/rendering/EllipsisBox.cpp +++ b/WebCore/rendering/EllipsisBox.cpp @@ -27,7 +27,7 @@ namespace WebCore { -void EllipsisBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) +void EllipsisBox::paint(PaintInfo& paintInfo, int tx, int ty) { GraphicsContext* context = paintInfo.context; RenderStyle* style = m_renderer->style(m_firstLine); diff --git a/WebCore/rendering/EllipsisBox.h b/WebCore/rendering/EllipsisBox.h index 087fc72..476331c 100644 --- a/WebCore/rendering/EllipsisBox.h +++ b/WebCore/rendering/EllipsisBox.h @@ -39,7 +39,7 @@ public: { } - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paint(PaintInfo&, int tx, int ty); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); void setSelectionState(RenderObject::SelectionState s) { m_selectionState = s; } IntRect selectionRect(int tx, int ty); diff --git a/WebCore/rendering/InlineBox.cpp b/WebCore/rendering/InlineBox.cpp index 213737c..5475187 100644 --- a/WebCore/rendering/InlineBox.cpp +++ b/WebCore/rendering/InlineBox.cpp @@ -159,16 +159,16 @@ void InlineBox::adjustPosition(int dx, int dy) } } -void InlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) +void InlineBox::paint(PaintInfo& paintInfo, int tx, int ty) { - if (!renderer()->shouldPaintWithinRoot(paintInfo) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) + if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) return; // Paint all phases of replaced elements atomically, as though the replaced element established its // own stacking context. (See Appendix E.2, section 6.4 on inline block/table elements in the CSS2.1 // specification.) bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip; - RenderObject::PaintInfo info(paintInfo); + PaintInfo info(paintInfo); info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; renderer()->paint(info, tx, ty); if (!preservePhase) { diff --git a/WebCore/rendering/InlineBox.h b/WebCore/rendering/InlineBox.h index eec9c1b..ab0167c 100644 --- a/WebCore/rendering/InlineBox.h +++ b/WebCore/rendering/InlineBox.h @@ -112,7 +112,7 @@ public: virtual void adjustPosition(int dx, int dy); - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paint(PaintInfo&, int tx, int ty); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); // Overloaded new operator. diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index c329b23..c2d8549 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -648,7 +648,7 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re return false; } -void InlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) +void InlineFlowBox::paint(PaintInfo& paintInfo, int tx, int ty) { IntRect overflowRect(visibleOverflowRect()); overflowRect.inflate(renderer()->maximalOutlineSize(paintInfo.phase)); @@ -687,9 +687,9 @@ void InlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) return; PaintPhase paintPhase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPhaseOutline : paintInfo.phase; - RenderObject::PaintInfo childInfo(paintInfo); + PaintInfo childInfo(paintInfo); childInfo.phase = paintPhase; - childInfo.paintingRoot = renderer()->paintingRootForChildren(paintInfo); + childInfo.updatePaintingRootForChildren(renderer()); // 3. Paint our children. if (paintPhase != PaintPhaseSelfOutline) { @@ -704,7 +704,7 @@ void InlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) paintTextDecorations(paintInfo, tx, ty, true); } -void InlineFlowBox::paintFillLayers(const RenderObject::PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, int _tx, int _ty, int w, int h, CompositeOperator op) +void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, int _tx, int _ty, int w, int h, CompositeOperator op) { if (!fillLayer) return; @@ -712,7 +712,7 @@ void InlineFlowBox::paintFillLayers(const RenderObject::PaintInfo& paintInfo, co paintFillLayer(paintInfo, c, fillLayer, _tx, _ty, w, h, op); } -void InlineFlowBox::paintFillLayer(const RenderObject::PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, int tx, int ty, int w, int h, CompositeOperator op) +void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, int tx, int ty, int w, int h, CompositeOperator op) { StyleImage* img = fillLayer->image(); bool hasFillImage = img && img->canRender(renderer()->style()->effectiveZoom()); @@ -752,9 +752,9 @@ void InlineFlowBox::paintBoxShadow(GraphicsContext* context, RenderStyle* s, Sha } } -void InlineFlowBox::paintBoxDecorations(RenderObject::PaintInfo& paintInfo, int tx, int ty) +void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { - if (!renderer()->shouldPaintWithinRoot(paintInfo) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground) + if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground) return; int x = m_x; @@ -828,9 +828,9 @@ void InlineFlowBox::paintBoxDecorations(RenderObject::PaintInfo& paintInfo, int } } -void InlineFlowBox::paintMask(RenderObject::PaintInfo& paintInfo, int tx, int ty) +void InlineFlowBox::paintMask(PaintInfo& paintInfo, int tx, int ty) { - if (!renderer()->shouldPaintWithinRoot(paintInfo) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) + if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) return; int x = m_x; @@ -920,11 +920,11 @@ static bool shouldDrawTextDecoration(RenderObject* obj) return false; } -void InlineFlowBox::paintTextDecorations(RenderObject::PaintInfo& paintInfo, int tx, int ty, bool paintedChildren) +void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, bool paintedChildren) { // Paint text decorations like underlines/overlines. We only do this if we aren't in quirks mode (i.e., in // almost-strict mode or strict mode). - if (renderer()->style()->htmlHacks() || !renderer()->shouldPaintWithinRoot(paintInfo) || + if (renderer()->style()->htmlHacks() || !paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE) return; diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h index b933c09..9589c0a 100644 --- a/WebCore/rendering/InlineFlowBox.h +++ b/WebCore/rendering/InlineFlowBox.h @@ -91,13 +91,13 @@ public: virtual void clearTruncation(); - virtual void paintBoxDecorations(RenderObject::PaintInfo&, int tx, int ty); - virtual void paintMask(RenderObject::PaintInfo&, int tx, int ty); - void paintFillLayers(const RenderObject::PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int w, int h, CompositeOperator = CompositeSourceOver); - void paintFillLayer(const RenderObject::PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int w, int h, CompositeOperator = CompositeSourceOver); + virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); + virtual void paintMask(PaintInfo&, int tx, int ty); + void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int w, int h, CompositeOperator = CompositeSourceOver); + void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int w, int h, CompositeOperator = CompositeSourceOver); void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, int tx, int ty, int w, int h); - virtual void paintTextDecorations(RenderObject::PaintInfo&, int tx, int ty, bool paintedChildren = false); - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paintTextDecorations(PaintInfo&, int tx, int ty, bool paintedChildren = false); + virtual void paint(PaintInfo&, int tx, int ty); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); virtual RenderLineBoxList* rendererLineBoxes() const; diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp index 09825b6..d6bd70c 100644 --- a/WebCore/rendering/InlineTextBox.cpp +++ b/WebCore/rendering/InlineTextBox.cpp @@ -306,6 +306,31 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in return false; } +FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context, const ShadowData* shadow, const FloatRect& textRect, bool stroked, bool opaque) +{ + if (!shadow) + return FloatSize(); + + FloatSize extraOffset; + FloatSize shadowOffset(shadow->x(), shadow->y()); + int shadowBlur = shadow->blur(); + const Color& shadowColor = shadow->color(); + + if (shadow->next() || stroked || !opaque) { + FloatRect shadowRect(textRect); + shadowRect.inflate(shadowBlur); + shadowRect.move(shadowOffset); + context->save(); + context->clip(shadowRect); + + extraOffset = FloatSize(0, 2 * textRect.height() + max(0.0f, shadowOffset.height()) + shadowBlur); + shadowOffset -= extraOffset; + } + + context->setShadow(shadowOffset, shadowBlur, shadowColor, context->fillColorSpace()); + return extraOffset; +} + static void paintTextWithShadows(GraphicsContext* context, const Font& font, const TextRun& textRun, int startOffset, int endOffset, int truncationPoint, const IntPoint& textOrigin, int x, int y, int w, int h, const ShadowData* shadow, bool stroked) { Color fillColor = context->fillColor(); @@ -316,24 +341,9 @@ static void paintTextWithShadows(GraphicsContext* context, const Font& font, con do { IntSize extraOffset; - - if (shadow) { - IntSize shadowOffset(shadow->x(), shadow->y()); - int shadowBlur = shadow->blur(); - const Color& shadowColor = shadow->color(); - - if (shadow->next() || stroked || !opaque) { - IntRect shadowRect(x, y, w, h); - shadowRect.inflate(shadowBlur); - shadowRect.move(shadowOffset); - context->save(); - context->clip(shadowRect); - - extraOffset = IntSize(0, 2 * h + max(0, shadowOffset.height()) + shadowBlur); - shadowOffset -= extraOffset; - } - context->setShadow(shadowOffset, shadowBlur, shadowColor, fillColorSpace); - } else if (!opaque) + if (shadow) + extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, FloatRect(x, y, w, h), stroked, opaque)); + else if (!opaque) context->setFillColor(fillColor, fillColorSpace); if (startOffset <= endOffset) @@ -357,9 +367,9 @@ static void paintTextWithShadows(GraphicsContext* context, const Font& font, con } while (shadow || stroked || !opaque); } -void InlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) +void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty) { - if (isLineBreak() || !renderer()->shouldPaintWithinRoot(paintInfo) || renderer()->style()->visibility() != VISIBLE || + if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutline) return; diff --git a/WebCore/rendering/InlineTextBox.h b/WebCore/rendering/InlineTextBox.h index 2ef5ec9..fcbf23a 100644 --- a/WebCore/rendering/InlineTextBox.h +++ b/WebCore/rendering/InlineTextBox.h @@ -80,7 +80,7 @@ public: virtual void selectionStartEnd(int& sPos, int& ePos); protected: - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paint(PaintInfo&, int tx, int ty); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); public: @@ -121,6 +121,9 @@ public: bool containsCaretOffset(int offset) const; // false for offset after line break + // Needs to be public, so the static paintTextWithShadows() function can use it. + static FloatSize applyShadowToGraphicsContext(GraphicsContext*, const ShadowData*, const FloatRect& textRect, bool stroked, bool opaque); + private: InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderObject InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObject diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 383a8cf..d5cb187 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -135,7 +135,7 @@ PassRefPtr<MediaControlElement> MediaControlElement::create(HTMLMediaElement* me void MediaControlElement::attachToParent(Element* parent) { - parent->addChild(this); + parent->legacyParserAddChild(this); } void MediaControlElement::update() @@ -389,7 +389,7 @@ MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElemen void MediaControlInputElement::attachToParent(Element* parent) { - parent->addChild(this); + parent->legacyParserAddChild(this); } void MediaControlInputElement::update() diff --git a/WebCore/rendering/PaintInfo.h b/WebCore/rendering/PaintInfo.h new file mode 100644 index 0000000..213eb30 --- /dev/null +++ b/WebCore/rendering/PaintInfo.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2000 Lars Knoll (knoll@kde.org) + * (C) 2000 Antti Koivisto (koivisto@kde.org) + * (C) 2000 Dirk Mueller (mueller@kde.org) + * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PaintInfo_h +#define PaintInfo_h + +#if ENABLE(SVG) +#include "AffineTransform.h" +#endif + +#include "GraphicsContext.h" +#include "IntRect.h" +#include "PaintPhase.h" +#include <wtf/HashMap.h> +#include <wtf/ListHashSet.h> + +namespace WebCore { + +class OverlapTestRequestClient; +class RenderInline; +class RenderObject; + +typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap; + +/* + * Paint the object and its children, clipped by (x|y|w|h). + * (tx|ty) is the calculated position of the parent + */ +struct PaintInfo { + PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceBlackText, + RenderObject* newPaintingRoot, ListHashSet<RenderInline*>* newOutlineObjects, + OverlapTestRequestMap* overlapTestRequests = 0) + : context(newContext) + , rect(newRect) + , phase(newPhase) + , forceBlackText(newForceBlackText) + , paintingRoot(newPaintingRoot) + , outlineObjects(newOutlineObjects) + , overlapTestRequests(overlapTestRequests) + { + } + + void updatePaintingRootForChildren(const RenderObject* renderer) + { + if (!paintingRoot) + return; + + // If we're the painting root, kids draw normally, and see root of 0. + if (paintingRoot == renderer) { + paintingRoot = 0; + return; + } + } + + bool shouldPaintWithinRoot(const RenderObject* renderer) const + { + return !paintingRoot || paintingRoot == renderer; + } + +#if ENABLE(SVG) + void applyTransform(const AffineTransform& localToAncestorTransform) + { + if (localToAncestorTransform.isIdentity()) + return; + + context->concatCTM(localToAncestorTransform); + rect = localToAncestorTransform.inverse().mapRect(rect); + } +#endif + + // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout rendering/. + GraphicsContext* context; + IntRect rect; + PaintPhase phase; + bool forceBlackText; + RenderObject* paintingRoot; // used to draw just one element and its visual kids + ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children + OverlapTestRequestMap* overlapTestRequests; +}; + +} // namespace WebCore + +#endif // PaintInfo_h diff --git a/WebCore/rendering/PaintPhase.h b/WebCore/rendering/PaintPhase.h new file mode 100644 index 0000000..396131f --- /dev/null +++ b/WebCore/rendering/PaintPhase.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2000 Lars Knoll (knoll@kde.org) + * (C) 2000 Antti Koivisto (koivisto@kde.org) + * (C) 2000 Dirk Mueller (mueller@kde.org) + * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PaintPhase_h +#define PaintPhase_h + +namespace WebCore { + +/* + * The painting of a layer occurs in three distinct phases. Each phase involves + * a recursive descent into the layer's render objects. The first phase is the background phase. + * The backgrounds and borders of all blocks are painted. Inlines are not painted at all. + * Floats must paint above block backgrounds but entirely below inline content that can overlap them. + * In the foreground phase, all inlines are fully painted. Inline replaced elements will get all + * three phases invoked on them during this phase. + */ + +enum PaintPhase { + PaintPhaseBlockBackground, + PaintPhaseChildBlockBackground, + PaintPhaseChildBlockBackgrounds, + PaintPhaseFloat, + PaintPhaseForeground, + PaintPhaseOutline, + PaintPhaseChildOutlines, + PaintPhaseSelfOutline, + PaintPhaseSelection, + PaintPhaseCollapsedTableBorders, + PaintPhaseTextClip, + PaintPhaseMask +}; + +enum PaintBehaviorFlags { + PaintBehaviorNormal = 0, + PaintBehaviorSelectionOnly = 1 << 0, + PaintBehaviorForceBlackText = 1 << 1, + PaintBehaviorFlattenCompositingLayers = 1 << 2 +}; + +typedef unsigned PaintBehavior; + +} // namespace WebCore + +#endif // PaintPhase_h diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index f60b13c..58c5842 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -2007,7 +2007,7 @@ void RenderBlock::paint(PaintInfo& paintInfo, int tx, int ty) // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with // z-index. We paint after we painted the background/border, so that the scrollbars will // sit above the background/border. - if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && shouldPaintWithinRoot(paintInfo)) + if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(this)) layer()->paintOverflowControls(paintInfo.context, tx, ty, paintInfo.rect); } @@ -2122,13 +2122,13 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) // We don't paint our own background, but we do let the kids paint their backgrounds. PaintInfo info(paintInfo); info.phase = newPhase; - info.paintingRoot = paintingRootForChildren(paintInfo); + info.updatePaintingRootForChildren(this); bool checkPageBreaks = document()->printing() && !document()->settings()->paginateDuringLayoutEnabled(); bool checkColumnBreaks = !checkPageBreaks && !view()->printRect().isEmpty() && !document()->settings()->paginateDuringLayoutEnabled(); for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { // Check for page-break-before: always, and if it's set, break and bail. - bool checkBeforeAlways = !childrenInline() && (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS || checkColumnBreaks && child->style()->columnBreakBefore() == PBALWAYS); + bool checkBeforeAlways = !childrenInline() && ((checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS) || (checkColumnBreaks && child->style()->columnBreakBefore() == PBALWAYS)); if (checkBeforeAlways && (ty + child->y()) > paintInfo.rect.y() && (ty + child->y()) < paintInfo.rect.bottom()) { @@ -2137,7 +2137,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) } // Check for page-break-inside: avoid, and it it's set, break and bail. - bool checkInsideAvoid = !childrenInline() && (checkPageBreaks && child->style()->pageBreakInside() == PBAVOID || checkColumnBreaks && child->style()->columnBreakInside() == PBAVOID); + bool checkInsideAvoid = !childrenInline() && ((checkPageBreaks && child->style()->pageBreakInside() == PBAVOID) || (checkColumnBreaks && child->style()->columnBreakInside() == PBAVOID)); if (checkInsideAvoid && ty + child->y() > paintInfo.rect.y() && ty + child->y() < paintInfo.rect.bottom() @@ -2150,7 +2150,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) child->paint(info, tx, ty); // Check for page-break-after: always, and if it's set, break and bail. - bool checkAfterAlways = !childrenInline() && (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS || checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS); + bool checkAfterAlways = !childrenInline() && ((checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS) || (checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS)); if (checkAfterAlways && (ty + child->y() + child->height()) > paintInfo.rect.y() && (ty + child->y() + child->height()) < paintInfo.rect.bottom()) { @@ -2289,7 +2289,7 @@ void RenderBlock::paintFloats(PaintInfo& paintInfo, int tx, int ty, bool preserv void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty) { - if (!shouldPaintWithinRoot(paintInfo) || !firstLineBox()) + if (!paintInfo.shouldPaintWithinRoot(this) || !firstLineBox()) return; if (style()->visibility() == VISIBLE && paintInfo.phase == PaintPhaseForeground) { @@ -2452,7 +2452,7 @@ void RenderBlock::paintSelection(PaintInfo& paintInfo, int tx, int ty) } #ifndef BUILDING_ON_TIGER -static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, RenderBlock::PositionedObjectsListHashSet* positionedObjects) +static void clipOutPositionedObjects(const PaintInfo* paintInfo, int tx, int ty, RenderBlock::PositionedObjectsListHashSet* positionedObjects) { if (!positionedObjects) return; @@ -4282,7 +4282,7 @@ int RenderBlock::layoutColumns(int endOfContent, int requestedColumnHeight) v->setPrintRect(pageRect); v->setTruncatedAt(truncationPoint); GraphicsContext context((PlatformGraphicsContext*)0); - RenderObject::PaintInfo paintInfo(&context, pageRect, PaintPhaseForeground, false, 0, 0); + PaintInfo paintInfo(&context, pageRect, PaintPhaseForeground, false, 0, 0); setHasColumns(false); paintObject(paintInfo, 0, 0); diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index e3a11c8..95d0c29 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -295,7 +295,6 @@ private: }; // The following functions' implementations are in RenderBlockLineLayout.cpp. - void bidiReorderLine(InlineBidiResolver&, const InlineIterator& end, bool previousLineBrokeCleanly); RootInlineBox* determineStartPosition(bool& firstLine, bool& fullLayout, bool& previousLineBrokeCleanly, InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats); RootInlineBox* determineEndPosition(RootInlineBox* startBox, InlineIterator& cleanLineStart, diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp index 097b661..1a7f983 100644 --- a/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/WebCore/rendering/RenderBlockLineLayout.cpp @@ -521,12 +521,6 @@ void RenderBlock::computeVerticalPositionsForLine(RootInlineBox* lineBox, BidiRu lineBox->markDirty(false); } -// collects one line of the paragraph and transforms it to visual order -void RenderBlock::bidiReorderLine(InlineBidiResolver& resolver, const InlineIterator& end, bool previousLineBrokeCleanly) -{ - resolver.createBidiRunsForLine(end, style()->visuallyOrdered(), previousLineBrokeCleanly); -} - static inline bool isCollapsibleSpace(UChar character, RenderText* renderer) { if (character == ' ' || character == '\t' || character == softHyphen) @@ -809,7 +803,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i ASSERT(end != resolver.position()); if (!isLineEmpty) { - bidiReorderLine(resolver, end, previousLineBrokeCleanly); + resolver.createBidiRunsForLine(end, style()->visuallyOrdered(), previousLineBrokeCleanly); ASSERT(resolver.position() == end); BidiRun* trailingSpaceRun = 0; diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index c845ba7..f337a9a 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -591,7 +591,7 @@ void RenderBox::paint(PaintInfo& paintInfo, int tx, int ty) // default implementation. Just pass paint through to the children PaintInfo childInfo(paintInfo); - childInfo.paintingRoot = paintingRootForChildren(paintInfo); + childInfo.updatePaintingRootForChildren(this); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) child->paint(childInfo, tx, ty); } @@ -643,7 +643,7 @@ void RenderBox::paintRootBoxDecorations(PaintInfo& paintInfo, int tx, int ty) void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return; if (isRoot()) { @@ -685,7 +685,7 @@ void RenderBox::paintBoxDecorationsWithSize(PaintInfo& paintInfo, int tx, int ty void RenderBox::paintMask(PaintInfo& paintInfo, int tx, int ty) { - if (!shouldPaintWithinRoot(paintInfo) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) + if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) return; int w = width(); @@ -2972,13 +2972,4 @@ void RenderBox::clearLayoutOverflow() m_overflow->resetLayoutOverflow(borderBoxRect()); } -#if ENABLE(SVG) - -AffineTransform RenderBox::localTransform() const -{ - return AffineTransform(1, 0, 0, 1, x(), y()); -} - -#endif - } // namespace WebCore diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h index c033275..3e95cea 100644 --- a/WebCore/rendering/RenderBox.h +++ b/WebCore/rendering/RenderBox.h @@ -297,10 +297,6 @@ public: bool shrinkToAvoidFloats() const; virtual bool avoidsFloats() const; -#if ENABLE(SVG) - virtual AffineTransform localTransform() const; -#endif - protected: virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp index 3f1b5ae..c81289b 100644 --- a/WebCore/rendering/RenderBoxModelObject.cpp +++ b/WebCore/rendering/RenderBoxModelObject.cpp @@ -30,6 +30,7 @@ #include "HTMLElement.h" #include "HTMLNames.h" #include "ImageBuffer.h" +#include "Path.h" #include "RenderBlock.h" #include "RenderInline.h" #include "RenderLayer.h" @@ -931,9 +932,182 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, return true; } +#if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING) +static bool borderWillArcInnerEdge(const IntSize& firstRadius, const IntSize& secondRadius, int firstBorderWidth, int secondBorderWidth, int middleBorderWidth) +{ + // FIXME: This test is insufficient. We need to take border style into account. + return (!firstRadius.width() || firstRadius.width() >= firstBorderWidth) + && (!firstRadius.height() || firstRadius.height() >= middleBorderWidth) + && (!secondRadius.width() || secondRadius.width() >= secondBorderWidth) + && (!secondRadius.height() || secondRadius.height() >= middleBorderWidth); +} + +void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, + const RenderStyle* style, bool begin, bool end) +{ + if (paintNinePieceImage(graphicsContext, tx, ty, w, h, style, style->borderImage())) + return; + + if (graphicsContext->paintingDisabled()) + return; + + const Color& topColor = style->visitedDependentColor(CSSPropertyBorderTopColor); + const Color& bottomColor = style->visitedDependentColor(CSSPropertyBorderBottomColor); + const Color& leftColor = style->visitedDependentColor(CSSPropertyBorderLeftColor); + const Color& rightColor = style->visitedDependentColor(CSSPropertyBorderRightColor); + + bool topTransparent = style->borderTopIsTransparent(); + bool bottomTransparent = style->borderBottomIsTransparent(); + bool rightTransparent = style->borderRightIsTransparent(); + bool leftTransparent = style->borderLeftIsTransparent(); + + EBorderStyle topStyle = style->borderTopStyle(); + EBorderStyle bottomStyle = style->borderBottomStyle(); + EBorderStyle leftStyle = style->borderLeftStyle(); + EBorderStyle rightStyle = style->borderRightStyle(); + + bool renderTop = topStyle > BHIDDEN && !topTransparent; + bool renderLeft = leftStyle > BHIDDEN && begin && !leftTransparent; + bool renderRight = rightStyle > BHIDDEN && end && !rightTransparent; + bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent; + + bool renderRadii = false; + Path roundedPath; + IntSize topLeft, topRight, bottomLeft, bottomRight; + IntRect borderRect(tx, ty, w, h); + + if (style->hasBorderRadius()) { + IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; + style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + + IntRect innerBorderRect = borderInnerRect(borderRect, style->borderTopWidth(), style->borderBottomWidth(), + style->borderLeftWidth(), style->borderRightWidth()); + + IntSize innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius; + style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderRect, style->borderTopWidth(), style->borderBottomWidth(), + style->borderLeftWidth(), style->borderRightWidth(), innerTopLeftRadius, innerTopRightRadius, + innerBottomLeftRadius, innerBottomRightRadius); + + if (begin) { + topLeft = topLeftRadius; + bottomLeft = bottomLeftRadius; + } + if (end) { + topRight = topRightRadius; + bottomRight = bottomRightRadius; + } + + renderRadii = true; + + // Clip to the inner and outer radii rects. + graphicsContext->save(); + graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius); + + roundedPath = Path::createRoundedRectangle(borderRect, topLeft, topRight, bottomLeft, bottomRight); + graphicsContext->addPath(roundedPath); + } + + if (renderTop) { + int x = tx; + int x2 = tx + w; + + if (renderRadii && borderWillArcInnerEdge(topLeft, topRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) { + graphicsContext->save(); + clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSTop, style); + float thickness = max(max(style->borderTopWidth(), style->borderLeftWidth()), style->borderRightWidth()); + drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle); + graphicsContext->restore(); + } else { + bool ignoreLeft = (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET + && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); + bool ignoreRight = (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET + && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); + + drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle, + ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth()); + } + } + + if (renderBottom) { + int x = tx; + int x2 = tx + w; + + if (renderRadii && borderWillArcInnerEdge(bottomLeft, bottomRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) { + graphicsContext->save(); + clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSBottom, style); + float thickness = max(max(style->borderBottomWidth(), style->borderLeftWidth()), style->borderRightWidth()); + drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle); + graphicsContext->restore(); + } else { + bool ignoreLeft = (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET + && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); + + bool ignoreRight = (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET + && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); + + drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, + bottomStyle, ignoreLeft ? 0 : style->borderLeftWidth(), + ignoreRight ? 0 : style->borderRightWidth()); + } + } + + if (renderLeft) { + int y = ty; + int y2 = ty + h; + + if (renderRadii && borderWillArcInnerEdge(bottomLeft, topLeft, style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) { + graphicsContext->save(); + clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSLeft, style); + float thickness = max(max(style->borderLeftWidth(), style->borderTopWidth()), style->borderBottomWidth()); + drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle); + graphicsContext->restore(); + } else { + bool ignoreTop = (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET + && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); + + bool ignoreBottom = (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET + && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); + + drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, + leftStyle, ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth()); + } + } + + if (renderRight) { + if (renderRadii && borderWillArcInnerEdge(bottomRight, topRight, style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) { + graphicsContext->save(); + clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSRight, style); + float thickness = max(max(style->borderRightWidth(), style->borderTopWidth()), style->borderBottomWidth()); + drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle); + graphicsContext->restore(); + } else { + bool ignoreTop = ((topColor == rightColor) && (topTransparent == rightTransparent) + && (rightStyle >= DOTTED || rightStyle == INSET) + && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); + + bool ignoreBottom = ((bottomColor == rightColor) && (bottomTransparent == rightTransparent) + && (rightStyle >= DOTTED || rightStyle == INSET) + && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); + + int y = ty; + int y2 = ty + h; + + drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, + rightStyle, ignoreTop ? 0 : style->borderTopWidth(), + ignoreBottom ? 0 : style->borderBottomWidth()); + } + } + + if (renderRadii) + graphicsContext->restore(); +} +#else void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, const RenderStyle* style, bool begin, bool end) { + // FIXME: This old version of paintBorder should be removed when all ports implement + // GraphicsContext::clipConvexPolygon()!! This should happen soon. if (paintNinePieceImage(graphicsContext, tx, ty, w, h, style, style->borderImage())) return; @@ -1279,6 +1453,65 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, if (renderRadii) graphicsContext->restore(); } +#endif + +void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const BoxSide side, const RenderStyle* style) +{ + FloatPoint quad[4]; + int tx = box.x(); + int ty = box.y(); + int w = box.width(); + int h = box.height(); + + // For each side, create an array of FloatPoints where each point is based on whichever value in each corner + // is larger -- the radius width/height or the border width/height -- as appropriate. + switch (side) { + case BSTop: + quad[0] = FloatPoint(tx, ty); + quad[1] = FloatPoint( + tx + max(topLeft.width(), (int) style->borderLeftWidth()), + ty + max(topLeft.height(), (int) style->borderTopWidth())); + quad[2] = FloatPoint( + tx + w - max(topRight.width(), (int) style->borderRightWidth()), + ty + max(topRight.height(), (int)style->borderTopWidth())); + quad[3] = FloatPoint(tx + w, ty); + break; + case BSLeft: + quad[0] = FloatPoint(tx, ty); + quad[1] = FloatPoint( + tx + max(topLeft.width(), (int) style->borderLeftWidth()), + ty + max(topLeft.height(), (int) style->borderTopWidth())); + quad[2] = FloatPoint( + tx + max(bottomLeft.width(), (int) style->borderLeftWidth()), + ty + h - max(bottomLeft.height(), (int)style->borderBottomWidth())); + quad[3] = FloatPoint(tx, ty + h); + break; + case BSBottom: + quad[0] = FloatPoint(tx, ty + h); + quad[1] = FloatPoint( + tx + max(bottomLeft.width(), (int) style->borderLeftWidth()), + ty + h - max(bottomLeft.height(), (int)style->borderBottomWidth())); + quad[2] = FloatPoint( + tx + w - max(bottomRight.width(), (int) style->borderRightWidth()), + ty + h - max(bottomRight.height(), (int)style->borderBottomWidth())); + quad[3] = FloatPoint(tx + w, ty + h); + break; + case BSRight: + quad[0] = FloatPoint(tx + w, ty); + quad[1] = FloatPoint( + tx + w - max(topRight.width(), (int) style->borderRightWidth()), + ty + max(topRight.height(), (int) style->borderTopWidth())); + quad[2] = FloatPoint( + tx + w - max(bottomRight.width(), (int) style->borderRightWidth()), + ty + h - max(bottomRight.height(), (int)style->borderBottomWidth())); + quad[3] = FloatPoint(tx + w, ty + h); + break; + default: + break; + } + + graphicsContext->clipConvexPolygon(4, quad); +} void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool begin, bool end) { diff --git a/WebCore/rendering/RenderBoxModelObject.h b/WebCore/rendering/RenderBoxModelObject.h index f022495..45602f0 100644 --- a/WebCore/rendering/RenderBoxModelObject.h +++ b/WebCore/rendering/RenderBoxModelObject.h @@ -115,6 +115,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, const RenderStyle* style); + friend class RenderView; RenderLayer* m_layer; diff --git a/WebCore/rendering/RenderEmbeddedObject.cpp b/WebCore/rendering/RenderEmbeddedObject.cpp index 7ab12a1..3d6575c 100644 --- a/WebCore/rendering/RenderEmbeddedObject.cpp +++ b/WebCore/rendering/RenderEmbeddedObject.cpp @@ -67,6 +67,7 @@ static const float replacementTextTextOpacity = 0.55f; RenderEmbeddedObject::RenderEmbeddedObject(Element* element) : RenderPart(element) , m_hasFallbackContent(false) + , m_showsMissingPluginIndicator(false) { view()->frameView()->setIsVisuallyNonEmpty(); } @@ -344,11 +345,14 @@ void RenderEmbeddedObject::updateWidget(bool onlyCreateNonNetscapePlugins) void RenderEmbeddedObject::setShowsMissingPluginIndicator() { + ASSERT(m_replacementText.isEmpty()); m_replacementText = missingPluginText(); + m_showsMissingPluginIndicator = true; } void RenderEmbeddedObject::setShowsCrashedPluginIndicator() { + ASSERT(m_replacementText.isEmpty()); m_replacementText = crashedPluginText(); } diff --git a/WebCore/rendering/RenderEmbeddedObject.h b/WebCore/rendering/RenderEmbeddedObject.h index b68108d..bfb7b96 100644 --- a/WebCore/rendering/RenderEmbeddedObject.h +++ b/WebCore/rendering/RenderEmbeddedObject.h @@ -37,6 +37,7 @@ public: void updateWidget(bool onlyCreateNonNetscapePlugins); void setShowsMissingPluginIndicator(); void setShowsCrashedPluginIndicator(); + bool showsMissingPluginIndicator() const { return m_showsMissingPluginIndicator; } bool hasFallbackContent() const { return m_hasFallbackContent; } @@ -60,6 +61,7 @@ private: String m_replacementText; bool m_hasFallbackContent; + bool m_showsMissingPluginIndicator; }; inline RenderEmbeddedObject* toRenderEmbeddedObject(RenderObject* object) diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp index 734c348..bd245c7 100644 --- a/WebCore/rendering/RenderFieldset.cpp +++ b/WebCore/rendering/RenderFieldset.cpp @@ -120,7 +120,7 @@ RenderBox* RenderFieldset::findLegend() const void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return; int w = width(); diff --git a/WebCore/rendering/RenderForeignObject.cpp b/WebCore/rendering/RenderForeignObject.cpp index 9f0889b..4b94bab 100644 --- a/WebCore/rendering/RenderForeignObject.cpp +++ b/WebCore/rendering/RenderForeignObject.cpp @@ -47,10 +47,9 @@ void RenderForeignObject::paint(PaintInfo& paintInfo, int, int) PaintInfo childPaintInfo(paintInfo); childPaintInfo.context->save(); + childPaintInfo.applyTransform(localTransform()); - applyTransformToPaintInfo(childPaintInfo, localTransform()); - - if (SVGRenderBase::isOverflowHidden(this)) + if (SVGRenderSupport::isOverflowHidden(this)) childPaintInfo.context->clip(m_viewport); float opacity = style()->opacity(); @@ -67,12 +66,12 @@ void RenderForeignObject::paint(PaintInfo& paintInfo, int, int) IntRect RenderForeignObject::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { - return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer); + return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } void RenderForeignObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { - SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); + SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); } const AffineTransform& RenderForeignObject::localToParentTransform() const @@ -128,7 +127,7 @@ bool RenderForeignObject::nodeAtFloatPoint(const HitTestRequest& request, HitTes FloatPoint localPoint = localTransform().inverse().mapPoint(pointInParent); // Early exit if local point is not contained in clipped viewport area - if (SVGRenderBase::isOverflowHidden(this) && !m_viewport.contains(localPoint)) + if (SVGRenderSupport::isOverflowHidden(this) && !m_viewport.contains(localPoint)) return false; IntPoint roundedLocalPoint = roundedIntPoint(localPoint); @@ -146,7 +145,7 @@ void RenderForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintConta // When crawling up the hierachy starting from foreignObject child content, useTransforms may not be set to true. if (!useTransforms) useTransforms = true; - SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); + SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); } } diff --git a/WebCore/rendering/RenderInputSpeech.cpp b/WebCore/rendering/RenderInputSpeech.cpp new file mode 100644 index 0000000..df17944 --- /dev/null +++ b/WebCore/rendering/RenderInputSpeech.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "RenderInputSpeech.h" + +#if ENABLE(INPUT_SPEECH) + +#include "GraphicsContext.h" +#include "HTMLNames.h" +#include "RenderBox.h" + +namespace WebCore { + +static const float defaultControlFontPixelSize = 13; +static const float defaultSpeechButtonSize = 16; +static const float minSpeechButtonSize = 8; +static const float maxSpeechButtonSize = 40; + +void RenderInputSpeech::adjustInputFieldSpeechButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) +{ + // Scale the button size based on the font size. + float fontScale = style->fontSize() / defaultControlFontPixelSize; + int speechButtonSize = lroundf(std::min(std::max(minSpeechButtonSize, defaultSpeechButtonSize * fontScale), maxSpeechButtonSize)); + style->setWidth(Length(speechButtonSize, Fixed)); + style->setHeight(Length(speechButtonSize, Fixed)); +} + +bool RenderInputSpeech::paintInputFieldSpeechButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) +{ + // Get the renderer of <input> element. + Node* input = object->node()->shadowAncestorNode(); + if (!input->renderer()->isBox()) + return false; + RenderBox* inputRenderBox = toRenderBox(input->renderer()); + IntRect inputContentBox = inputRenderBox->contentBoxRect(); + + // Make sure the scaled button stays square and will fit in its parent's box. + int buttonSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), rect.height())); + // Calculate button's coordinates relative to the input element. + // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will + // be one pixel closer to the bottom of the field. This tends to look better with the text. + IntRect buttonRect(object->offsetFromAncestorContainer(inputRenderBox).width(), + inputContentBox.y() + (inputContentBox.height() - buttonSize + 1) / 2, + buttonSize, buttonSize); + + // Compute an offset between the part renderer and the input renderer. + IntSize offsetFromInputRenderer = -(object->offsetFromAncestorContainer(inputRenderBox)); + // Move the rect into partRenderer's coords. + buttonRect.move(offsetFromInputRenderer); + // Account for the local drawing offset. + buttonRect.move(rect.x(), rect.y()); + + DEFINE_STATIC_LOCAL(RefPtr<Image>, imageStateNormal, (Image::loadPlatformResource("inputSpeech"))); + paintInfo.context->drawImage(imageStateNormal.get(), object->style()->colorSpace(), buttonRect); + + return false; +} + +} // namespace WebCore + +#endif // ENABLE(INPUT_SPEECH) diff --git a/WebCore/rendering/RenderInputSpeech.h b/WebCore/rendering/RenderInputSpeech.h new file mode 100644 index 0000000..63ef8ae --- /dev/null +++ b/WebCore/rendering/RenderInputSpeech.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RenderInputSpeech_h +#define RenderInputSpeech_h + +#include "RenderObject.h" + +#if ENABLE(INPUT_SPEECH) + +namespace WebCore { + +class RenderInputSpeech { +public: + static void adjustInputFieldSpeechButtonStyle(CSSStyleSelector*, RenderStyle*, Element*); + static bool paintInputFieldSpeechButton(RenderObject*, const PaintInfo&, const IntRect&); +}; + +} // namespace WebCore + +#endif +#endif // RenderInputSpeech_h diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index fcb9c07..a672f4b 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -2257,10 +2257,10 @@ bool RenderLayer::scroll(ScrollDirection direction, ScrollGranularity granularit void RenderLayer::paint(GraphicsContext* p, const IntRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot) { - RenderObject::OverlapTestRequestMap overlapTestRequests; + OverlapTestRequestMap overlapTestRequests; paintLayer(this, p, damageRect, paintBehavior, paintingRoot, &overlapTestRequests); - RenderObject::OverlapTestRequestMap::iterator end = overlapTestRequests.end(); - for (RenderObject::OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it) + OverlapTestRequestMap::iterator end = overlapTestRequests.end(); + for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it) it->first->setOverlapTestResult(false); } @@ -2279,11 +2279,11 @@ static void restoreClip(GraphicsContext* p, const IntRect& paintDirtyRect, const p->restore(); } -static void performOverlapTests(RenderObject::OverlapTestRequestMap& overlapTestRequests, const IntRect& layerBounds) +static void performOverlapTests(OverlapTestRequestMap& overlapTestRequests, const IntRect& layerBounds) { Vector<OverlapTestRequestClient*> overlappedRequestClients; - RenderObject::OverlapTestRequestMap::iterator end = overlapTestRequests.end(); - for (RenderObject::OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it) { + OverlapTestRequestMap::iterator end = overlapTestRequests.end(); + for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it) { if (!layerBounds.intersects(it->second)) continue; @@ -2303,7 +2303,7 @@ static bool shouldDoSoftwarePaint(const RenderLayer* layer, bool paintingReflect void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, const IntRect& paintDirtyRect, PaintBehavior paintBehavior, - RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests, + RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, PaintLayerFlags paintFlags) { #if USE(ACCELERATED_COMPOSITING) @@ -2425,7 +2425,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, setClip(p, paintDirtyRect, damageRect); // Paint the background. - RenderObject::PaintInfo paintInfo(p, damageRect, PaintPhaseBlockBackground, false, paintingRootForRenderer, 0); + PaintInfo paintInfo(p, damageRect, PaintPhaseBlockBackground, false, paintingRootForRenderer, 0); renderer()->paint(paintInfo, tx, ty); // Restore the clip. @@ -2443,7 +2443,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, // Set up the clip used when painting our children. setClip(p, paintDirtyRect, clipRectToApply); - RenderObject::PaintInfo paintInfo(p, clipRectToApply, + PaintInfo paintInfo(p, clipRectToApply, selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, forceBlackText, paintingRootForRenderer, 0); renderer()->paint(paintInfo, tx, ty); @@ -2463,7 +2463,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, if (!outlineRect.isEmpty() && isSelfPaintingLayer()) { // Paint our own outline - RenderObject::PaintInfo paintInfo(p, outlineRect, PaintPhaseSelfOutline, false, paintingRootForRenderer, 0); + PaintInfo paintInfo(p, outlineRect, PaintPhaseSelfOutline, false, paintingRootForRenderer, 0); setClip(p, paintDirtyRect, outlineRect); renderer()->paint(paintInfo, tx, ty); restoreClip(p, paintDirtyRect, outlineRect); @@ -2479,7 +2479,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, setClip(p, paintDirtyRect, damageRect); // Paint the mask. - RenderObject::PaintInfo paintInfo(p, damageRect, PaintPhaseMask, false, paintingRootForRenderer, 0); + PaintInfo paintInfo(p, damageRect, PaintPhaseMask, false, paintingRootForRenderer, 0); renderer()->paint(paintInfo, tx, ty); // Restore the clip. @@ -2496,7 +2496,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, void RenderLayer::paintList(Vector<RenderLayer*>* list, RenderLayer* rootLayer, GraphicsContext* p, const IntRect& paintDirtyRect, PaintBehavior paintBehavior, - RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests, + RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, PaintLayerFlags paintFlags) { if (!list) @@ -2513,7 +2513,7 @@ void RenderLayer::paintList(Vector<RenderLayer*>* list, RenderLayer* rootLayer, void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext* context, const IntRect& paintDirtyRect, PaintBehavior paintBehavior, - RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests, + RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, PaintLayerFlags paintFlags) { // We need to do multiple passes, breaking up our child layer into strips. @@ -2534,7 +2534,7 @@ void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* void RenderLayer::paintChildLayerIntoColumns(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext* context, const IntRect& paintDirtyRect, PaintBehavior paintBehavior, - RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests, + RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, PaintLayerFlags paintFlags, const Vector<RenderLayer*>& columnLayers, size_t colIndex) { RenderBlock* columnBlock = toRenderBlock(columnLayers[colIndex]->renderer()); diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h index 45b64e0..e8c290b 100644 --- a/WebCore/rendering/RenderLayer.h +++ b/WebCore/rendering/RenderLayer.h @@ -487,19 +487,19 @@ private: typedef unsigned PaintLayerFlags; void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, - PaintBehavior, RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* = 0, + PaintBehavior, RenderObject* paintingRoot, OverlapTestRequestMap* = 0, PaintLayerFlags = 0); void paintList(Vector<RenderLayer*>*, RenderLayer* rootLayer, GraphicsContext* p, const IntRect& paintDirtyRect, PaintBehavior, - RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap*, + RenderObject* paintingRoot, OverlapTestRequestMap*, PaintLayerFlags); void paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, - RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap*, + RenderObject* paintingRoot, OverlapTestRequestMap*, PaintLayerFlags); void paintChildLayerIntoColumns(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, - RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap*, + RenderObject* paintingRoot, OverlapTestRequestMap*, PaintLayerFlags, const Vector<RenderLayer*>& columnLayers, size_t columnIndex); RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index 794b55a..c5a7e19 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -955,7 +955,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* // Establish the clip used to paint our background. setClip(context, paintDirtyRect, damageRect); - RenderObject::PaintInfo info(context, paintBox, PaintPhaseBlockBackground, false, paintingRootForRenderer, 0); + PaintInfo info(context, paintBox, PaintPhaseBlockBackground, false, paintingRootForRenderer, 0); renderer()->paint(info, tx, ty); // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with @@ -981,7 +981,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* // Set up the clip used when painting our children. setClip(context, paintDirtyRect, clipRectToApply); - RenderObject::PaintInfo paintInfo(context, clipRectToApply, + PaintInfo paintInfo(context, clipRectToApply, selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, forceBlackText, paintingRootForRenderer, 0); renderer()->paint(paintInfo, tx, ty); @@ -1002,7 +1002,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* if (!outlineRect.isEmpty()) { // Paint our own outline - RenderObject::PaintInfo paintInfo(context, outlineRect, PaintPhaseSelfOutline, false, paintingRootForRenderer, 0); + PaintInfo paintInfo(context, outlineRect, PaintPhaseSelfOutline, false, paintingRootForRenderer, 0); setClip(context, paintDirtyRect, outlineRect); renderer()->paint(paintInfo, tx, ty); restoreClip(context, paintDirtyRect, outlineRect); @@ -1028,7 +1028,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* setClip(context, paintDirtyRect, damageRect); // Paint the mask. - RenderObject::PaintInfo paintInfo(context, damageRect, PaintPhaseMask, false, paintingRootForRenderer, 0); + PaintInfo paintInfo(context, damageRect, PaintPhaseMask, false, paintingRootForRenderer, 0); renderer()->paint(paintInfo, tx, ty); // Restore the clip. diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp index 2d3ee7e..3e4c882 100644 --- a/WebCore/rendering/RenderLineBoxList.cpp +++ b/WebCore/rendering/RenderLineBoxList.cpp @@ -148,7 +148,7 @@ void RenderLineBoxList::dirtyLineBoxes() curr->dirtyLineBoxes(); } -void RenderLineBoxList::paint(RenderBoxModelObject* renderer, RenderObject::PaintInfo& paintInfo, int tx, int ty) const +void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintInfo, int tx, int ty) const { // Only paint during the foreground/selection phases. if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseOutline @@ -181,7 +181,7 @@ void RenderLineBoxList::paint(RenderBoxModelObject* renderer, RenderObject::Pain if (yPos >= paintInfo.rect.bottom() || yPos + h <= paintInfo.rect.y()) return; - RenderObject::PaintInfo info(paintInfo); + PaintInfo info(paintInfo); ListHashSet<RenderInline*> outlineObjects; info.outlineObjects = &outlineObjects; diff --git a/WebCore/rendering/RenderLineBoxList.h b/WebCore/rendering/RenderLineBoxList.h index 52d7542..f7d9960 100644 --- a/WebCore/rendering/RenderLineBoxList.h +++ b/WebCore/rendering/RenderLineBoxList.h @@ -63,7 +63,7 @@ public: void dirtyLineBoxes(); void dirtyLinesFromChangedChild(RenderObject* parent, RenderObject* child); - void paint(RenderBoxModelObject*, RenderObject::PaintInfo&, int x, int y) const; + void paint(RenderBoxModelObject*, PaintInfo&, int x, int y) const; bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction) const; private: diff --git a/WebCore/rendering/RenderMediaControls.cpp b/WebCore/rendering/RenderMediaControls.cpp index 17576ae..f75da70 100644 --- a/WebCore/rendering/RenderMediaControls.cpp +++ b/WebCore/rendering/RenderMediaControls.cpp @@ -82,7 +82,7 @@ void RenderMediaControls::adjustMediaSliderThumbSize(RenderObject* o) o->style()->setHeight(Length(static_cast<int>(mediaSliderThumbHeight * zoomLevel), Fixed)); } -bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); diff --git a/WebCore/rendering/RenderMediaControls.h b/WebCore/rendering/RenderMediaControls.h index 529dbac..9683dd7 100644 --- a/WebCore/rendering/RenderMediaControls.h +++ b/WebCore/rendering/RenderMediaControls.h @@ -34,7 +34,7 @@ namespace WebCore { class HTMLMediaElement; class RenderMediaControls { public: - static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const PaintInfo&, const IntRect&); static void adjustMediaSliderThumbSize(RenderObject*); }; diff --git a/WebCore/rendering/RenderMediaControlsChromium.cpp b/WebCore/rendering/RenderMediaControlsChromium.cpp index ede3d11..ffd7a1e 100644 --- a/WebCore/rendering/RenderMediaControlsChromium.cpp +++ b/WebCore/rendering/RenderMediaControlsChromium.cpp @@ -67,7 +67,7 @@ static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Imag return true; } -static bool paintMediaMuteButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) @@ -83,7 +83,7 @@ static bool paintMediaMuteButton(RenderObject* object, const RenderObject::Paint return paintMediaButton(paintInfo.context, rect, mediaElement->muted() ? soundNone: soundFull); } -static bool paintMediaPlayButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) @@ -105,7 +105,7 @@ static Image* getMediaSliderThumb() return mediaSliderThumb; } -static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) @@ -164,7 +164,7 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo return true; } -static bool paintMediaSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { if (!object->parent()->isSlider()) return false; @@ -180,7 +180,7 @@ static bool paintMediaSliderThumb(RenderObject* object, const RenderObject::Pain return paintMediaButton(paintInfo.context, rect, mediaSliderThumb); } -static bool paintMediaVolumeSlider(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) @@ -199,7 +199,7 @@ static bool paintMediaVolumeSlider(RenderObject* object, const RenderObject::Pai return true; } -static bool paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { if (!object->parent()->isSlider()) return false; @@ -208,7 +208,7 @@ static bool paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb); } -static bool paintMediaTimelineContainer(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +static bool paintMediaTimelineContainer(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { HTMLMediaElement* mediaElement = toParentMediaElement(object); if (!mediaElement) @@ -263,7 +263,7 @@ bool RenderMediaControlsChromium::shouldRenderMediaControlPart(ControlPart part, return false; } -bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { switch (part) { case MediaMuteButton: diff --git a/WebCore/rendering/RenderMediaControlsChromium.h b/WebCore/rendering/RenderMediaControlsChromium.h index d6d986c..060a9d4 100644 --- a/WebCore/rendering/RenderMediaControlsChromium.h +++ b/WebCore/rendering/RenderMediaControlsChromium.h @@ -37,7 +37,7 @@ class HTMLMediaElement; class RenderMediaControlsChromium { public: static bool shouldRenderMediaControlPart(ControlPart, Element*); - static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const PaintInfo&, const IntRect&); static void adjustMediaSliderThumbSize(RenderObject*); }; diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index 143e2c0..156df15 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -30,6 +30,7 @@ #include "AXObjectCache.h" #include "Chrome.h" #include "CSSStyleSelector.h" +#include "DashArray.h" #include "FloatQuad.h" #include "Frame.h" #include "FrameView.h" @@ -880,10 +881,186 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, } } +IntRect RenderObject::borderInnerRect(const IntRect& borderRect, unsigned short topWidth, unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const +{ + return IntRect( + borderRect.x() + leftWidth, + borderRect.y() + topWidth, + borderRect.width() - leftWidth - rightWidth, + borderRect.height() - topWidth - bottomWidth); +} + +#if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING) +void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect borderRect, Path borderPath, + float thickness, float drawThickness, BoxSide s, const RenderStyle* style, + Color c, EBorderStyle borderStyle) +{ + if (thickness <= 0) + return; + + if (borderStyle == DOUBLE && thickness < 3) + borderStyle = SOLID; + + switch (borderStyle) { + case BNONE: + case BHIDDEN: + return; + case DOTTED: + case DASHED: { + graphicsContext->setStrokeColor(c, style->colorSpace()); + + // The stroke is doubled here because the provided path is the + // outside edge of the border so half the stroke is clipped off. + // The extra multiplier is so that the clipping mask can antialias + // the edges to prevent jaggies. + graphicsContext->setStrokeThickness(drawThickness * 2 * 1.1f); + graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : DottedStroke); + + // If the number of dashes that fit in the path is odd and non-integral then we + // will have an awkwardly-sized dash at the end of the path. To try to avoid that + // here, we simply make the whitespace dashes ever so slightly bigger. + // FIXME: This could be even better if we tried to manipulate the dash offset + // and possibly the whiteSpaceWidth to get the corners dash-symmetrical. + float patWidth = thickness * ((borderStyle == DASHED) ? 3.0f : 1.0f); + float whiteSpaceWidth = patWidth; + float numberOfDashes = borderPath.length() / patWidth; + bool evenNumberOfFullDashes = !((int)numberOfDashes % 2); + bool integralNumberOfDashes = !(numberOfDashes - (int)numberOfDashes); + if (!evenNumberOfFullDashes && !integralNumberOfDashes) { + float numberOfWhitespaceDashes = numberOfDashes / 2; + whiteSpaceWidth += (patWidth / numberOfWhitespaceDashes); + } + + DashArray* lineDash = new DashArray(); + lineDash->append(patWidth); + lineDash->append(whiteSpaceWidth); + graphicsContext->setLineDash(*lineDash, patWidth); + graphicsContext->addPath(borderPath); + graphicsContext->strokePath(); + return; + } + case DOUBLE: { + int outerBorderTopWidth = style->borderTopWidth() / 3; + int outerBorderRightWidth = style->borderRightWidth() / 3; + int outerBorderBottomWidth = style->borderBottomWidth() / 3; + int outerBorderLeftWidth = style->borderLeftWidth() / 3; + + int innerBorderTopWidth = style->borderTopWidth() * 2 / 3; + int innerBorderRightWidth = style->borderRightWidth() * 2 / 3; + int innerBorderBottomWidth = style->borderBottomWidth() * 2 / 3; + int innerBorderLeftWidth = style->borderLeftWidth() * 2 / 3; + + // We need certain integer rounding results + if (style->borderTopWidth() % 3 == 2) + outerBorderTopWidth += 1; + if (style->borderRightWidth() % 3 == 2) + outerBorderRightWidth += 1; + if (style->borderBottomWidth() % 3 == 2) + outerBorderBottomWidth += 1; + if (style->borderLeftWidth() % 3 == 2) + outerBorderLeftWidth += 1; + + if (style->borderTopWidth() % 3 == 1) + innerBorderTopWidth += 1; + if (style->borderRightWidth() % 3 == 1) + innerBorderRightWidth += 1; + if (style->borderBottomWidth() % 3 == 1) + innerBorderBottomWidth += 1; + if (style->borderLeftWidth() % 3 == 1) + 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); + 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); + drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID); + graphicsContext->restore(); + + return; + } + case RIDGE: + case GROOVE: + { + EBorderStyle s1; + EBorderStyle s2; + if (borderStyle == GROOVE) { + s1 = INSET; + s2 = OUTSET; + } else { + s1 = OUTSET; + s2 = INSET; + } + + 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); + drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s2); + graphicsContext->restore(); + + return; + } + case INSET: + if (s == BSTop || s == BSLeft) + c = c.dark(); + break; + case OUTSET: + if (s == BSBottom || s == BSRight) + c = c.dark(); + break; + default: + break; + } + + graphicsContext->setStrokeStyle(NoStroke); + graphicsContext->setFillColor(c, style->colorSpace()); + graphicsContext->drawRect(borderRect); +} +#else void RenderObject::drawArcForBoxSide(GraphicsContext* graphicsContext, int x, int y, float thickness, IntSize radius, int angleStart, int angleSpan, BoxSide s, Color c, EBorderStyle style, bool firstCorner) { + // FIXME: This function should be removed when all ports implement GraphicsContext::clipConvexPolygon()!! + // At that time, everyone can use RenderObject::drawBoxSideFromPath() instead. This should happen soon. if ((style == DOUBLE && thickness / 2 < 3) || ((style == RIDGE || style == GROOVE) && thickness / 2 < 2)) style = SOLID; @@ -960,6 +1137,7 @@ void RenderObject::drawArcForBoxSide(GraphicsContext* graphicsContext, int x, in break; } } +#endif void RenderObject::addPDFURLRect(GraphicsContext* context, const IntRect& rect) { diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index 3446a00..33271df 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -31,12 +31,17 @@ #include "Document.h" #include "Element.h" #include "FloatQuad.h" +#include "PaintInfo.h" #include "RenderObjectChildList.h" #include "RenderStyle.h" #include "TextAffinity.h" #include "TransformationMatrix.h" #include <wtf/UnusedParam.h> +#if PLATFORM(CG) +#define HAVE_PATH_BASED_BORDER_RADIUS_DRAWING 1 +#endif + namespace WebCore { class AnimationController; @@ -44,6 +49,7 @@ class HitTestResult; class InlineBox; class InlineFlowBox; class OverlapTestRequestClient; +class Path; class Position; class RenderBoxModelObject; class RenderInline; @@ -57,39 +63,6 @@ class VisiblePosition; class RenderSVGResourceContainer; #endif -/* - * The painting of a layer occurs in three distinct phases. Each phase involves - * a recursive descent into the layer's render objects. The first phase is the background phase. - * The backgrounds and borders of all blocks are painted. Inlines are not painted at all. - * Floats must paint above block backgrounds but entirely below inline content that can overlap them. - * In the foreground phase, all inlines are fully painted. Inline replaced elements will get all - * three phases invoked on them during this phase. - */ - -// FIXME: These enums should move to their own header since they're used by other headers. -enum PaintPhase { - PaintPhaseBlockBackground, - PaintPhaseChildBlockBackground, - PaintPhaseChildBlockBackgrounds, - PaintPhaseFloat, - PaintPhaseForeground, - PaintPhaseOutline, - PaintPhaseChildOutlines, - PaintPhaseSelfOutline, - PaintPhaseSelection, - PaintPhaseCollapsedTableBorders, - PaintPhaseTextClip, - PaintPhaseMask -}; - -enum PaintBehaviorFlags { - PaintBehaviorNormal = 0, - PaintBehaviorSelectionOnly = 1 << 0, - PaintBehaviorForceBlackText = 1 << 1, - PaintBehaviorFlattenCompositingLayers = 1 << 2 -}; -typedef unsigned PaintBehavior; - enum HitTestFilter { HitTestAll, HitTestSelf, @@ -436,8 +409,19 @@ public: void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide, Color, EBorderStyle, int adjbw1, int adjbw2); +#if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING) + void drawBoxSideFromPath(GraphicsContext*, IntRect, Path, + float thickness, float drawThickness, BoxSide, const RenderStyle*, + Color, EBorderStyle); +#else + // FIXME: This function should be removed when all ports implement GraphicsContext::clipConvexPolygon()!! + // At that time, everyone can use RenderObject::drawBoxSideFromPath() instead. This should happen soon. void drawArcForBoxSide(GraphicsContext*, int x, int y, float thickness, IntSize radius, int angleStart, int angleSpan, BoxSide, Color, EBorderStyle, bool firstCorner); +#endif + + IntRect borderInnerRect(const IntRect&, unsigned short topWidth, unsigned short bottomWidth, + unsigned short leftWidth, unsigned short rightWidth) const; // The pseudo element style can be cached or uncached. Use the cached method if the pseudo element doesn't respect // any pseudo classes (and therefore has no concept of changing state). @@ -506,36 +490,6 @@ public: // for the vertical-align property of inline elements // the offset of baseline from the top of the object. virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const; - - typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap; - - /* - * Paint the object and its children, clipped by (x|y|w|h). - * (tx|ty) is the calculated position of the parent - */ - struct PaintInfo { - PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceBlackText, - RenderObject* newPaintingRoot, ListHashSet<RenderInline*>* newOutlineObjects, - OverlapTestRequestMap* overlapTestRequests = 0) - : context(newContext) - , rect(newRect) - , phase(newPhase) - , forceBlackText(newForceBlackText) - , paintingRoot(newPaintingRoot) - , outlineObjects(newOutlineObjects) - , overlapTestRequests(overlapTestRequests) - { - } - - GraphicsContext* context; - IntRect rect; - PaintPhase phase; - bool forceBlackText; - RenderObject* paintingRoot; // used to draw just one element and its visual kids - ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children - OverlapTestRequestMap* overlapTestRequests; - }; - virtual void paint(PaintInfo&, int tx, int ty); // Recursive function that computes the size and position of this object and all its descendants. @@ -768,17 +722,6 @@ public: void selectionStartEnd(int& spos, int& epos) const; - RenderObject* paintingRootForChildren(PaintInfo& paintInfo) const - { - // if we're the painting root, kids draw normally, and see root of 0 - return (!paintInfo.paintingRoot || paintInfo.paintingRoot == this) ? 0 : paintInfo.paintingRoot; - } - - bool shouldPaintWithinRoot(PaintInfo& paintInfo) const - { - return !paintInfo.paintingRoot || paintInfo.paintingRoot == this; - } - bool hasOverrideSize() const { return m_hasOverrideSize; } void setHasOverrideSize(bool b) { m_hasOverrideSize = b; } diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp index 238a4e6..0010e3f 100644 --- a/WebCore/rendering/RenderPath.cpp +++ b/WebCore/rendering/RenderPath.cpp @@ -34,7 +34,6 @@ #include "HitTestRequest.h" #include "PointerEventsHitRules.h" #include "RenderSVGContainer.h" -#include "RenderSVGResourceFilter.h" #include "RenderSVGResourceMarker.h" #include "StrokeStyleApplier.h" #include "SVGRenderSupport.h" @@ -57,7 +56,7 @@ public: void strokeStyle(GraphicsContext* gc) { - applyStrokeStyleToContext(gc, m_style, m_object); + SVGRenderSupport::applyStrokeStyleToContext(gc, m_style, m_object); } private: @@ -105,7 +104,7 @@ void RenderPath::layout() // as the viewport size may have changed. It would be nice to optimize this to detect these changes, and only // update when needed, even when using relative values. bool needsPathUpdate = m_needsPathUpdate; - if (!needsPathUpdate && element->hasRelativeValues()) + if (!needsPathUpdate && element->hasRelativeLengths()) needsPathUpdate = true; if (needsPathUpdate) { @@ -172,13 +171,12 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int) bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == PaintPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline); if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) { childPaintInfo.context->save(); - applyTransformToPaintInfo(childPaintInfo, m_localTransform); - RenderSVGResourceFilter* filter = 0; + childPaintInfo.applyTransform(m_localTransform); if (childPaintInfo.phase == PaintPhaseForeground) { PaintInfo savedInfo(childPaintInfo); - if (prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter)) { + if (SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo)) { const SVGRenderStyle* svgStyle = style()->svgStyle(); if (svgStyle->shapeRendering() == SR_CRISPEDGES) childPaintInfo.context->setShouldAntialias(false); @@ -189,7 +187,7 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int) m_markerLayoutInfo.drawMarkers(childPaintInfo); } - finishRenderSVGContent(this, childPaintInfo, filter, savedInfo.context); + SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, savedInfo.context); } if (drawsOutline) @@ -217,7 +215,7 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& FloatPoint localPoint = m_localTransform.inverse().mapPoint(pointInParent); - if (!pointInClippingArea(this, localPoint)) + if (!SVGRenderSupport::pointInClippingArea(this, localPoint)) return false; PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_PATH_HITTESTING, request, style()->pointerEvents()); @@ -317,7 +315,7 @@ void RenderPath::updateCachedBoundaries() // Cache smallest possible repaint rectangle m_repaintBoundingBox = m_strokeAndMarkerBoundingBox; - intersectRepaintRectWithResources(this, m_repaintBoundingBox); + SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox); } } diff --git a/WebCore/rendering/RenderProgress.cpp b/WebCore/rendering/RenderProgress.cpp index 2587e4b..6072e1e 100644 --- a/WebCore/rendering/RenderProgress.cpp +++ b/WebCore/rendering/RenderProgress.cpp @@ -98,12 +98,17 @@ void RenderProgress::layoutParts() bool RenderProgress::shouldHaveParts() const { - return !style()->hasAppearance(); + if (!style()->hasAppearance()) + return true; + if (ShadowBlockElement::partShouldHaveStyle(this, PROGRESS_BAR_VALUE)) + return true; + return false; } void RenderProgress::updatePartsState() { if (shouldHaveParts() && !m_valuePart) { + style()->setAppearance(NoControlPart); m_valuePart = ShadowBlockElement::createForPart(this->node(), PROGRESS_BAR_VALUE); addChild(m_valuePart->renderer()); } else if (!shouldHaveParts() && m_valuePart) { diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp index d579b99..0da321e 100644 --- a/WebCore/rendering/RenderReplaced.cpp +++ b/WebCore/rendering/RenderReplaced.cpp @@ -114,7 +114,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty) if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection) return; - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return; bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing(); @@ -163,7 +163,7 @@ bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, int& tx, int& ty) && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseMask) return false; - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return false; // if we're invisible or haven't received a layout yet, then just bail. diff --git a/WebCore/rendering/RenderSVGAllInOne.cpp b/WebCore/rendering/RenderSVGAllInOne.cpp new file mode 100644 index 0000000..da86f84 --- /dev/null +++ b/WebCore/rendering/RenderSVGAllInOne.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. + +#include "RenderSVGBlock.cpp" +#include "RenderSVGContainer.cpp" +#include "RenderSVGGradientStop.cpp" +#include "RenderSVGHiddenContainer.cpp" +#include "RenderSVGImage.cpp" +#include "RenderSVGInline.cpp" +#include "RenderSVGInlineText.cpp" +#include "RenderSVGModelObject.cpp" +#include "RenderSVGResource.cpp" +#include "RenderSVGResourceClipper.cpp" +#include "RenderSVGResourceFilter.cpp" +#include "RenderSVGResourceGradient.cpp" +#include "RenderSVGResourceLinearGradient.cpp" +#include "RenderSVGResourceMarker.cpp" +#include "RenderSVGResourceMasker.cpp" +#include "RenderSVGResourcePattern.cpp" +#include "RenderSVGResourceRadialGradient.cpp" +#include "RenderSVGResourceSolidColor.cpp" +#include "RenderSVGRoot.cpp" +#include "RenderSVGShadowTreeRootContainer.cpp" +#include "RenderSVGTSpan.cpp" +#include "RenderSVGText.cpp" +#include "RenderSVGTextPath.cpp" +#include "RenderSVGTransformableContainer.cpp" +#include "RenderSVGViewportContainer.cpp" +#include "SVGCharacterData.cpp" +#include "SVGCharacterLayoutInfo.cpp" +#include "SVGInlineFlowBox.cpp" +#include "SVGInlineTextBox.cpp" +#include "SVGMarkerLayoutInfo.cpp" +#include "SVGRenderSupport.cpp" +#include "SVGRenderTreeAsText.cpp" +#include "SVGRootInlineBox.cpp" +#include "SVGShadowTreeElements.cpp" +#include "SVGTextChunkLayoutInfo.cpp" +#include "SVGTextLayoutUtilities.cpp" +#include "SVGTextQuery.cpp" diff --git a/WebCore/rendering/RenderSVGBlock.h b/WebCore/rendering/RenderSVGBlock.h index af819fd..8dd140b 100644 --- a/WebCore/rendering/RenderSVGBlock.h +++ b/WebCore/rendering/RenderSVGBlock.h @@ -29,8 +29,7 @@ namespace WebCore { class SVGElement; -class RenderSVGBlock : public RenderBlock - , protected SVGRenderBase { +class RenderSVGBlock : public RenderBlock { public: RenderSVGBlock(SVGElement*); diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp index 66889ac..27584d9 100644 --- a/WebCore/rendering/RenderSVGContainer.cpp +++ b/WebCore/rendering/RenderSVGContainer.cpp @@ -60,7 +60,7 @@ void RenderSVGContainer::layout() LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint()); calculateLocalTransform(); // Allow RenderSVGTransformableContainer to update its transform - layoutChildren(this, selfNeedsLayout()); + SVGRenderSupport::layoutChildren(this, selfNeedsLayout()); repainter.repaintAfterLayout(); setNeedsLayout(false); @@ -87,29 +87,25 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int) return; PaintInfo childPaintInfo(paintInfo); - childPaintInfo.context->save(); // Let the RenderSVGViewportContainer subclass clip if necessary applyViewportClip(childPaintInfo); - applyTransformToPaintInfo(childPaintInfo, localToParentTransform()); - - RenderSVGResourceFilter* filter = 0; - FloatRect boundingBox = repaintRectInLocalCoordinates(); + childPaintInfo.applyTransform(localToParentTransform()); bool continueRendering = true; if (childPaintInfo.phase == PaintPhaseForeground) - continueRendering = prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter); + continueRendering = SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo); if (continueRendering) { - childPaintInfo.paintingRoot = paintingRootForChildren(childPaintInfo); + childPaintInfo.updatePaintingRootForChildren(this); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) child->paint(childPaintInfo, 0, 0); } if (paintInfo.phase == PaintPhaseForeground) - finishRenderSVGContent(this, childPaintInfo, filter, paintInfo.context); + SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, paintInfo.context); childPaintInfo.context->restore(); @@ -118,9 +114,10 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int) // outline rect into parent coords before drawing. // FIXME: This means our focus ring won't share our rotation like it should. // We should instead disable our clip during PaintPhaseOutline - IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates())); - if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE) + if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE) { + IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates())); paintOutline(paintInfo.context, paintRectInParent.x(), paintRectInParent.y(), paintRectInParent.width(), paintRectInParent.height()); + } } // addFocusRingRects is called from paintOutline and needs to be in the same coordinates as the paintOuline call @@ -133,21 +130,18 @@ void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, int, int) FloatRect RenderSVGContainer::objectBoundingBox() const { - return computeContainerBoundingBox(this, false); + return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::ObjectBoundingBox); } FloatRect RenderSVGContainer::strokeBoundingBox() const { - return computeContainerBoundingBox(this, true); + return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::StrokeBoundingBox); } -// RenderSVGContainer is used for <g> elements which do not themselves have a -// width or height, so we union all of our child rects as our repaint rect. FloatRect RenderSVGContainer::repaintRectInLocalCoordinates() const { - FloatRect repaintRect = computeContainerBoundingBox(this, true); - intersectRepaintRectWithResources(this, repaintRect); - + FloatRect repaintRect = SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::RepaintBoundingBox); + SVGRenderSupport::intersectRepaintRectWithResources(this, repaintRect); return repaintRect; } @@ -159,7 +153,7 @@ bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTest FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent); - if (!pointInClippingArea(this, localPoint)) + if (!SVGRenderSupport::pointInClippingArea(this, localPoint)) return false; for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { diff --git a/WebCore/rendering/RenderSVGHiddenContainer.cpp b/WebCore/rendering/RenderSVGHiddenContainer.cpp index 5d6bd25..0af4236 100644 --- a/WebCore/rendering/RenderSVGHiddenContainer.cpp +++ b/WebCore/rendering/RenderSVGHiddenContainer.cpp @@ -38,7 +38,7 @@ RenderSVGHiddenContainer::RenderSVGHiddenContainer(SVGStyledElement* element) void RenderSVGHiddenContainer::layout() { ASSERT(needsLayout()); - layoutChildren(this, selfNeedsLayout()); + SVGRenderSupport::layoutChildren(this, selfNeedsLayout()); setNeedsLayout(false); } diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp index 45898c7..a4572e6 100644 --- a/WebCore/rendering/RenderSVGImage.cpp +++ b/WebCore/rendering/RenderSVGImage.cpp @@ -83,11 +83,9 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int) paintInfo.context->concatCTM(localToParentTransform()); if (paintInfo.phase == PaintPhaseForeground) { - RenderSVGResourceFilter* filter = 0; - PaintInfo savedInfo(paintInfo); - if (prepareToRenderSVGContent(this, paintInfo, m_localBounds, filter)) { + if (SVGRenderSupport::prepareToRenderSVGContent(this, paintInfo)) { FloatRect destRect = m_localBounds; FloatRect srcRect(0, 0, image()->width(), image()->height()); @@ -97,7 +95,7 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int) paintInfo.context->drawImage(image(), DeviceColorSpace, destRect, srcRect); } - finishRenderSVGContent(this, paintInfo, filter, savedInfo.context); + SVGRenderSupport::finishRenderSVGContent(this, paintInfo, savedInfo.context); } if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth()) @@ -108,7 +106,7 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int) void RenderSVGImage::destroy() { - deregisterFromResources(this); + RenderSVGResource::invalidateAllResourcesOfRenderer(this); RenderImage::destroy(); } @@ -123,7 +121,7 @@ bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu if (isVisible || !hitRules.requireVisible) { FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent); - if (!pointInClippingArea(this, localPoint)) + if (!SVGRenderSupport::pointInClippingArea(this, localPoint)) return false; if (hitRules.canHitFill) { @@ -150,7 +148,7 @@ FloatRect RenderSVGImage::repaintRectInLocalCoordinates() const return m_cachedLocalRepaintRect; m_cachedLocalRepaintRect = m_localBounds; - intersectRepaintRectWithResources(this, m_cachedLocalRepaintRect); + SVGRenderSupport::intersectRepaintRectWithResources(this, m_cachedLocalRepaintRect); return m_cachedLocalRepaintRect; } @@ -169,17 +167,17 @@ void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect) IntRect RenderSVGImage::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { - return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer); + return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } void RenderSVGImage::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { - SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); + SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); } void RenderSVGImage::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) const { - SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); + SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); } void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, int, int) diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h index 37d2aee..3baac23 100644 --- a/WebCore/rendering/RenderSVGImage.h +++ b/WebCore/rendering/RenderSVGImage.h @@ -34,8 +34,7 @@ namespace WebCore { class SVGImageElement; -class RenderSVGImage : public RenderImage - , protected SVGRenderBase { +class RenderSVGImage : public RenderImage { public: RenderSVGImage(SVGImageElement*); diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp index ca0fdb5..ffc6b62 100644 --- a/WebCore/rendering/RenderSVGInline.cpp +++ b/WebCore/rendering/RenderSVGInline.cpp @@ -44,7 +44,7 @@ InlineFlowBox* RenderSVGInline::createInlineFlowBox() FloatRect RenderSVGInline::objectBoundingBox() const { - if (const RenderObject* object = findTextRootObject(this)) + if (const RenderObject* object = SVGRenderSupport::findTextRootObject(this)) return object->objectBoundingBox(); return FloatRect(); @@ -52,7 +52,7 @@ FloatRect RenderSVGInline::objectBoundingBox() const FloatRect RenderSVGInline::strokeBoundingBox() const { - if (const RenderObject* object = findTextRootObject(this)) + if (const RenderObject* object = SVGRenderSupport::findTextRootObject(this)) return object->strokeBoundingBox(); return FloatRect(); @@ -60,7 +60,7 @@ FloatRect RenderSVGInline::strokeBoundingBox() const FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const { - if (const RenderObject* object = findTextRootObject(this)) + if (const RenderObject* object = SVGRenderSupport::findTextRootObject(this)) return object->repaintRectInLocalCoordinates(); return FloatRect(); @@ -68,22 +68,22 @@ FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const IntRect RenderSVGInline::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { - return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer); + return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } void RenderSVGInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { - SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); + SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); } void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState& transformState) const { - SVGRenderBase::mapLocalToContainer(this, repaintContainer, useTransforms, fixed, transformState); + SVGRenderSupport::mapLocalToContainer(this, repaintContainer, useTransforms, fixed, transformState); } void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads) { - const RenderObject* object = findTextRootObject(this); + const RenderObject* object = SVGRenderSupport::findTextRootObject(this); if (!object) return; diff --git a/WebCore/rendering/RenderSVGInline.h b/WebCore/rendering/RenderSVGInline.h index 2efb1aa..6f44162 100644 --- a/WebCore/rendering/RenderSVGInline.h +++ b/WebCore/rendering/RenderSVGInline.h @@ -31,8 +31,7 @@ namespace WebCore { -class RenderSVGInline : public RenderInline - , protected SVGRenderBase { +class RenderSVGInline : public RenderInline { public: RenderSVGInline(Node*); diff --git a/WebCore/rendering/RenderSVGModelObject.cpp b/WebCore/rendering/RenderSVGModelObject.cpp index a80a963..3d22e7a 100644 --- a/WebCore/rendering/RenderSVGModelObject.cpp +++ b/WebCore/rendering/RenderSVGModelObject.cpp @@ -33,9 +33,7 @@ #if ENABLE(SVG) #include "RenderSVGModelObject.h" -#include "GraphicsContext.h" -#include "RenderLayer.h" -#include "RenderView.h" +#include "RenderSVGResource.h" #include "SVGStyledElement.h" namespace WebCore { @@ -47,21 +45,21 @@ RenderSVGModelObject::RenderSVGModelObject(SVGStyledElement* node) IntRect RenderSVGModelObject::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { - return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer); + return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } void RenderSVGModelObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { - SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); + SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); } void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) const { - SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); + SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); } // Copied from RenderBox, this method likely requires further refactoring to work easily for both SVG and CSS Box Model content. -// FIXME: This may also need to move into SVGRenderBase as the RenderBox version depends +// FIXME: This may also need to move into SVGRenderSupport as the RenderBox version depends // on borderBoundingBox() which SVG RenderBox subclases (like SVGRenderBlock) do not implement. IntRect RenderSVGModelObject::outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, IntPoint*) const { @@ -85,7 +83,7 @@ void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads) void RenderSVGModelObject::destroy() { - deregisterFromResources(this); + RenderSVGResource::invalidateAllResourcesOfRenderer(this); RenderObject::destroy(); } diff --git a/WebCore/rendering/RenderSVGModelObject.h b/WebCore/rendering/RenderSVGModelObject.h index 42ca27f..82c08c0 100644 --- a/WebCore/rendering/RenderSVGModelObject.h +++ b/WebCore/rendering/RenderSVGModelObject.h @@ -41,11 +41,11 @@ namespace WebCore { // Most renderers in the SVG rendering tree will inherit from this class // but not all. (e.g. RenderSVGForeignObject, RenderSVGBlock, RenderSVGImage) thus methods // required by SVG renders need to be declared on RenderObject, but shared -// logic can go in this class or in SVGRenderBase. +// logic can go in this class or in SVGRenderSupport. class SVGStyledElement; -class RenderSVGModelObject : public RenderObject, protected SVGRenderBase { +class RenderSVGModelObject : public RenderObject { public: RenderSVGModelObject(SVGStyledElement*); diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp index 129d800..0aa7182 100644 --- a/WebCore/rendering/RenderSVGResource.cpp +++ b/WebCore/rendering/RenderSVGResource.cpp @@ -26,7 +26,11 @@ #if ENABLE(SVG) #include "RenderSVGResource.h" +#include "RenderSVGResourceClipper.h" #include "RenderSVGResourceContainer.h" +#include "RenderSVGResourceFilter.h" +#include "RenderSVGResourceMarker.h" +#include "RenderSVGResourceMasker.h" #include "RenderSVGResourceSolidColor.h" #include "SVGURIReference.h" @@ -197,6 +201,59 @@ void RenderSVGResource::markForLayoutAndResourceInvalidation(RenderObject* objec static_cast<SVGStyledElement*>(element)->invalidateResourcesInAncestorChain(); } +static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object) +{ + ASSERT(paint); + + SVGPaint::SVGPaintType paintType = paint->paintType(); + if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) + return; + + AtomicString id(SVGURIReference::getTarget(paint->uri())); + if (RenderSVGResourceContainer* paintingResource = getRenderSVGResourceContainerById(object->document(), id)) + paintingResource->invalidateClient(object); +} + +void RenderSVGResource::invalidateAllResourcesOfRenderer(RenderObject* object) +{ + ASSERT(object); + ASSERT(object->style()); + + Document* document = object->document(); + ASSERT(document); + + const SVGRenderStyle* svgStyle = object->style()->svgStyle(); + ASSERT(svgStyle); + + // Masker + if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskerResource())) + masker->invalidateClient(object); + + // Clipper + if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) + clipper->invalidateClient(object); + + // Filter +#if ENABLE(FILTERS) + if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, svgStyle->filterResource())) + filter->invalidateClient(object); +#endif + + // Markers + if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerStartResource())) + startMarker->invalidateClient(object); + if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerMidResource())) + midMarker->invalidateClient(object); + if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerEndResource())) + endMarker->invalidateClient(object); + + // Gradients/Patterns + if (svgStyle->hasFill()) + invalidatePaintingResource(svgStyle->fillPaint(), object); + if (svgStyle->hasStroke()) + invalidatePaintingResource(svgStyle->strokePaint(), object); +} + } #endif diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h index a14a972..34ff14e 100644 --- a/WebCore/rendering/RenderSVGResource.h +++ b/WebCore/rendering/RenderSVGResource.h @@ -79,6 +79,8 @@ public: static RenderSVGResource* strokePaintingResource(const RenderObject*, const RenderStyle*); static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); + static void invalidateAllResourcesOfRenderer(RenderObject*); + private: static void adjustColorForPseudoRules(const RenderStyle*, bool useFillPaint, Color&); diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp index 450c5d6..cc499bf 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.cpp +++ b/WebCore/rendering/RenderSVGResourceClipper.cpp @@ -242,7 +242,7 @@ bool RenderSVGResourceClipper::createClipData(ClipperData* clipperData, const Fl // In the case of a <use> element, we obtained its renderere above, to retrieve its clipRule. // We hsve to pass the <use> renderer itself to renderSubtreeToImage() to apply it's x/y/transform/etc. values when rendering. // So if isUseElement is true, refetch the childNode->renderer(), as renderer got overriden above. - renderSubtreeToImage(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer); + SVGRenderSupport::renderSubtreeToImage(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer); renderer->setStyle(oldRenderStyle.release()); } @@ -271,7 +271,7 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect() bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint) { FloatPoint point = nodeAtPoint; - if (!pointInClippingArea(this, point)) + if (!SVGRenderSupport::pointInClippingArea(this, point)) return false; if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp index e715f6f..7ea70d2 100644 --- a/WebCore/rendering/RenderSVGResourceGradient.cpp +++ b/WebCore/rendering/RenderSVGResourceGradient.cpp @@ -91,7 +91,7 @@ static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& con OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object) { - const RenderObject* textRootBlock = findTextRootObject(object); + const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object); AffineTransform transform = absoluteTransformForRenderer(textRootBlock); FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates()); @@ -123,7 +123,7 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context, const RenderObject* object, GradientData* gradientData) { - const RenderObject* textRootBlock = findTextRootObject(object); + const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object); context->clipToImageBuffer(textRootBlock->repaintRectInLocalCoordinates(), imageBuffer.get()); AffineTransform matrix; @@ -211,7 +211,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(object, gradientData->userspaceTransform)); context->setAlpha(svgStyle->strokeOpacity()); context->setStrokeGradient(gradientData->gradient); - applyStrokeStyleToContext(context, style, object); + SVGRenderSupport::applyStrokeStyleToContext(context, style, object); } return true; @@ -235,7 +235,7 @@ void RenderSVGResourceGradient::postApplyResource(RenderObject* object, Graphics gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, object, gradientData)); context->setFillGradient(gradientData->gradient); - const RenderObject* textRootBlock = findTextRootObject(object); + const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object); context->fillRect(textRootBlock->repaintRectInLocalCoordinates()); m_imageBuffer.clear(); diff --git a/WebCore/rendering/RenderSVGResourceMarker.cpp b/WebCore/rendering/RenderSVGResourceMarker.cpp index 4a300c2..ce331a7 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.cpp +++ b/WebCore/rendering/RenderSVGResourceMarker.cpp @@ -88,7 +88,7 @@ void RenderSVGResourceMarker::invalidateClient(RenderObject* object) void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo) { - if (SVGRenderBase::isOverflowHidden(this)) + if (SVGRenderSupport::isOverflowHidden(this)) paintInfo.context->clip(m_viewport); } @@ -146,7 +146,7 @@ AffineTransform RenderSVGResourceMarker::markerTransformation(const FloatPoint& return transform; } -void RenderSVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, const AffineTransform& transform) +void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform) { DEFINE_STATIC_LOCAL(HashSet<RenderSVGResourceMarker*>, currentlyDrawingMarkers, ()); @@ -155,9 +155,9 @@ void RenderSVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, const Aff return; currentlyDrawingMarkers.add(this); - RenderObject::PaintInfo info(paintInfo); + PaintInfo info(paintInfo); info.context->save(); - applyTransformToPaintInfo(info, transform); + info.applyTransform(transform); RenderSVGContainer::paint(info, 0, 0); info.context->restore(); diff --git a/WebCore/rendering/RenderSVGResourceMarker.h b/WebCore/rendering/RenderSVGResourceMarker.h index 533a03b..75c442e 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.h +++ b/WebCore/rendering/RenderSVGResourceMarker.h @@ -45,7 +45,7 @@ public: virtual void invalidateClients(); virtual void invalidateClient(RenderObject*); - void draw(RenderObject::PaintInfo&, const AffineTransform&); + void draw(PaintInfo&, const AffineTransform&); // Calculates marker boundaries, mapped to the target element's coordinate space FloatRect markerBoundaries(const AffineTransform& markerTransformation) const; diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp index ea79439..74d3fe6 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.cpp +++ b/WebCore/rendering/RenderSVGResourceMasker.cpp @@ -173,7 +173,7 @@ void RenderSVGResourceMasker::createMaskImage(MaskerData* maskerData, const SVGM RenderStyle* style = renderer->style(); if (!style || style->display() == NONE || style->visibility() != VISIBLE) continue; - renderSubtreeToImage(maskerData->maskImage.get(), renderer); + SVGRenderSupport::renderSubtreeToImage(maskerData->maskImage.get(), renderer); } maskImageContext->restore(); diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp index 040b2e2..ba24fcf 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.cpp +++ b/WebCore/rendering/RenderSVGResourcePattern.cpp @@ -24,6 +24,7 @@ #if ENABLE(SVG) #include "RenderSVGResourcePattern.h" +#include "FrameView.h" #include "GraphicsContext.h" #include "PatternAttributes.h" #include "SVGRenderSupport.h" @@ -120,7 +121,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* patternData->pattern->setPatternSpaceTransform(transformOnNonScalingStroke(object, patternData->transform)); context->setAlpha(svgStyle->strokeOpacity()); context->setStrokePattern(patternData->pattern); - applyStrokeStyleToContext(context, style, object); + SVGRenderSupport::applyStrokeStyleToContext(context, style, object); } if (resourceMode & ApplyToTextMode) { @@ -208,6 +209,22 @@ FloatRect RenderSVGResourcePattern::calculatePatternBoundariesIncludingOverflow( return patternBoundariesIncludingOverflow; } +// FIXME: This method should be removed. RenderSVGResourcePatterns usage of it is just wrong. +static inline void clampImageBufferSizeToViewport(FrameView* frameView, IntSize& size) +{ + if (!frameView) + return; + + int viewWidth = frameView->visibleWidth(); + int viewHeight = frameView->visibleHeight(); + + if (size.width() > viewWidth) + size.setWidth(viewWidth); + + if (size.height() > viewHeight) + size.setHeight(viewHeight); +} + PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* patternData, const SVGPatternElement* patternElement, RenderObject* object) const @@ -268,7 +285,7 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* p for (Node* node = attributes.patternContentElement()->firstChild(); node; node = node->nextSibling()) { if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !node->renderer()) continue; - renderSubtreeToImage(tileImage.get(), node->renderer()); + SVGRenderSupport::renderSubtreeToImage(tileImage.get(), node->renderer()); } patternData->boundaries = patternBoundaries; diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.cpp b/WebCore/rendering/RenderSVGResourceSolidColor.cpp index 792908f..51ad658 100644 --- a/WebCore/rendering/RenderSVGResourceSolidColor.cpp +++ b/WebCore/rendering/RenderSVGResourceSolidColor.cpp @@ -24,6 +24,7 @@ #include "RenderSVGResourceSolidColor.h" #include "GraphicsContext.h" +#include "RenderStyle.h" #include "SVGRenderSupport.h" #if PLATFORM(SKIA) && !PLATFORM(ANDROID) @@ -65,7 +66,7 @@ bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyl context->setStrokeColor(m_color, colorSpace); if (style) - applyStrokeStyleToContext(context, style, object); + SVGRenderSupport::applyStrokeStyleToContext(context, style, object); if (resourceMode & ApplyToTextMode) context->setTextDrawingMode(cTextStroke); diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 70ff938..ad3303f 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -30,6 +30,7 @@ #include "HitTestResult.h" #endif #include "RenderSVGContainer.h" +#include "RenderSVGResource.h" #include "RenderView.h" #include "SVGLength.h" #include "SVGRenderSupport.h" @@ -121,7 +122,7 @@ void RenderSVGRoot::layout() // RenderSVGRoot needs to take special care to propagate window size changes to the children, // if the outermost <svg> is using relative x/y/width/height values. Hence the additonal parameters. SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); - layoutChildren(this, needsLayout || (svg->hasRelativeValues() && oldSize != size())); + SVGRenderSupport::layoutChildren(this, needsLayout || (svg->hasRelativeLengths() && oldSize != size())); repainter.repaintAfterLayout(); view()->enableLayoutState(); @@ -162,8 +163,8 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) if (!firstChild() && !selfWillPaint()) return; - // Make a copy of the PaintInfo because applyTransformToPaintInfo will modify the damage rect. - RenderObject::PaintInfo childPaintInfo(paintInfo); + // Make a copy of the PaintInfo because applyTransform will modify the damage rect. + PaintInfo childPaintInfo(paintInfo); childPaintInfo.context->save(); // Apply initial viewport clip - not affected by overflow handling @@ -171,20 +172,17 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) // Convert from container offsets (html renderers) to a relative transform (svg renderers). // Transform from our paint container's coordinate system to our local coords. - applyTransformToPaintInfo(childPaintInfo, localToRepaintContainerTransform(parentOriginInContainer)); - - RenderSVGResourceFilter* filter = 0; - FloatRect boundingBox = repaintRectInLocalCoordinates(); + childPaintInfo.applyTransform(localToRepaintContainerTransform(parentOriginInContainer)); bool continueRendering = true; if (childPaintInfo.phase == PaintPhaseForeground) - continueRendering = prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter); + continueRendering = SVGRenderSupport::prepareToRenderSVGContent(this, childPaintInfo); if (continueRendering) RenderBox::paint(childPaintInfo, 0, 0); if (childPaintInfo.phase == PaintPhaseForeground) - finishRenderSVGContent(this, childPaintInfo, filter, paintInfo.context); + SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, paintInfo.context); childPaintInfo.context->restore(); @@ -194,7 +192,7 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) void RenderSVGRoot::destroy() { - deregisterFromResources(this); + RenderSVGResource::invalidateAllResourcesOfRenderer(this); RenderBox::destroy(); } @@ -202,7 +200,7 @@ void RenderSVGRoot::calcViewport() { SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); - if (!selfNeedsLayout() && !svg->hasRelativeValues()) + if (!selfNeedsLayout() && !svg->hasRelativeLengths()) return; if (!svg->hasSetContainerSize()) { @@ -262,22 +260,22 @@ const AffineTransform& RenderSVGRoot::localToParentTransform() const FloatRect RenderSVGRoot::objectBoundingBox() const { - return computeContainerBoundingBox(this, false); + return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::ObjectBoundingBox); +} + +FloatRect RenderSVGRoot::strokeBoundingBox() const +{ + return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::StrokeBoundingBox); } FloatRect RenderSVGRoot::repaintRectInLocalCoordinates() const { // FIXME: This does not include the border but it should! - FloatRect repaintRect = computeContainerBoundingBox(this, true); + FloatRect repaintRect = SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::RepaintBoundingBox); style()->svgStyle()->inflateForShadow(repaintRect); return repaintRect; } -AffineTransform RenderSVGRoot::localTransform() const -{ - return AffineTransform(); -} - void RenderSVGRoot::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { // Apply our local transforms (except for x/y translation), then our shadow, diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h index 53c1298..48263aa 100644 --- a/WebCore/rendering/RenderSVGRoot.h +++ b/WebCore/rendering/RenderSVGRoot.h @@ -33,7 +33,7 @@ namespace WebCore { class SVGStyledElement; class AffineTransform; -class RenderSVGRoot : public RenderBox, protected SVGRenderBase { +class RenderSVGRoot : public RenderBox { public: RenderSVGRoot(SVGStyledElement*); @@ -63,12 +63,9 @@ private: bool strokeContains(const FloatPoint&) const; virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const { return computeContainerBoundingBox(this, true); } + virtual FloatRect strokeBoundingBox() const; virtual FloatRect repaintRectInLocalCoordinates() const; - // FIXME: This override should be removed. - virtual AffineTransform localTransform() const; - virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed); @@ -108,5 +105,3 @@ void toRenderSVGRoot(const RenderSVGRoot*); #endif // ENABLE(SVG) #endif // RenderSVGRoot_h - -// vim:ts=4:noet diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp index 84f5329..12f3cb5 100644 --- a/WebCore/rendering/RenderSVGText.cpp +++ b/WebCore/rendering/RenderSVGText.cpp @@ -36,6 +36,7 @@ #include "HitTestRequest.h" #include "PointerEventsHitRules.h" #include "RenderLayer.h" +#include "RenderSVGResource.h" #include "RenderSVGRoot.h" #include "SVGLengthList.h" #include "SVGRenderSupport.h" @@ -56,17 +57,17 @@ RenderSVGText::RenderSVGText(SVGTextElement* node) IntRect RenderSVGText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { - return SVGRenderBase::clippedOverflowRectForRepaint(this, repaintContainer); + return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } void RenderSVGText::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { - SVGRenderBase::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); + SVGRenderSupport::computeRectForRepaint(this, repaintContainer, repaintRect, fixed); } void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const { - SVGRenderBase::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); + SVGRenderSupport::mapLocalToContainer(this, repaintContainer, fixed, useTransforms, transformState); } void RenderSVGText::layout() @@ -117,7 +118,7 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul || (hitRules.canHitFill && (style()->svgStyle()->hasFill() || !hitRules.requireFill))) { FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent); - if (!pointInClippingArea(this, localPoint)) + if (!SVGRenderSupport::pointInClippingArea(this, localPoint)) return false; return RenderBlock::nodeAtPoint(request, result, (int)localPoint.x(), (int)localPoint.y(), 0, 0, hitTestAction); @@ -129,7 +130,7 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul void RenderSVGText::destroy() { - deregisterFromResources(this); + RenderSVGResource::invalidateAllResourcesOfRenderer(this); RenderSVGBlock::destroy(); } @@ -156,7 +157,7 @@ void RenderSVGText::paint(PaintInfo& paintInfo, int, int) PaintInfo blockInfo(paintInfo); blockInfo.context->save(); - applyTransformToPaintInfo(blockInfo, localToParentTransform()); + blockInfo.applyTransform(localToParentTransform()); RenderBlock::paint(blockInfo, 0, 0); blockInfo.context->restore(); } @@ -174,7 +175,7 @@ FloatRect RenderSVGText::strokeBoundingBox() const FloatRect RenderSVGText::repaintRectInLocalCoordinates() const { FloatRect repaintRect = strokeBoundingBox(); - intersectRepaintRectWithResources(this, repaintRect); + SVGRenderSupport::intersectRepaintRectWithResources(this, repaintRect); return repaintRect; } diff --git a/WebCore/rendering/RenderSVGViewportContainer.cpp b/WebCore/rendering/RenderSVGViewportContainer.cpp index 1587e7f..ca735d2 100644 --- a/WebCore/rendering/RenderSVGViewportContainer.cpp +++ b/WebCore/rendering/RenderSVGViewportContainer.cpp @@ -39,7 +39,7 @@ RenderSVGViewportContainer::RenderSVGViewportContainer(SVGStyledElement* node) void RenderSVGViewportContainer::applyViewportClip(PaintInfo& paintInfo) { - if (SVGRenderBase::isOverflowHidden(this)) + if (SVGRenderSupport::isOverflowHidden(this)) paintInfo.context->clip(m_viewport); } @@ -49,7 +49,7 @@ void RenderSVGViewportContainer::calcViewport() if (svgelem->hasTagName(SVGNames::svgTag)) { SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); - if (!selfNeedsLayout() && !svg->hasRelativeValues()) + if (!selfNeedsLayout() && !svg->hasRelativeLengths()) return; float x = svg->x().value(svg); @@ -82,7 +82,7 @@ const AffineTransform& RenderSVGViewportContainer::localToParentTransform() cons bool RenderSVGViewportContainer::pointIsInsideViewportClip(const FloatPoint& pointInParent) { // Respect the viewport clip (which is in parent coords) - if (!SVGRenderBase::isOverflowHidden(this)) + if (!SVGRenderSupport::isOverflowHidden(this)) return true; return m_viewport.contains(pointInParent); diff --git a/WebCore/rendering/RenderScrollbarPart.cpp b/WebCore/rendering/RenderScrollbarPart.cpp index c83248a..d2f1612 100644 --- a/WebCore/rendering/RenderScrollbarPart.cpp +++ b/WebCore/rendering/RenderScrollbarPart.cpp @@ -164,7 +164,7 @@ void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, int tx return; // Now do the paint. - RenderObject::PaintInfo paintInfo(graphicsContext, rect, PaintPhaseBlockBackground, false, 0, 0); + PaintInfo paintInfo(graphicsContext, rect, PaintPhaseBlockBackground, false, 0, 0); paint(paintInfo, tx, ty); paintInfo.phase = PaintPhaseChildBlockBackgrounds; paint(paintInfo, tx, ty); diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 00c6ac0..65a0cde 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -524,7 +524,7 @@ void RenderTable::paintObject(PaintInfo& paintInfo, int tx, int ty) PaintInfo info(paintInfo); info.phase = paintPhase; - info.paintingRoot = paintingRootForChildren(paintInfo); + info.updatePaintingRootForChildren(this); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) @@ -555,7 +555,7 @@ void RenderTable::paintObject(PaintInfo& paintInfo, int tx, int ty) void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return; int w = width(); diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp index de93107..11f3b52 100644 --- a/WebCore/rendering/RenderTableCell.cpp +++ b/WebCore/rendering/RenderTableCell.cpp @@ -681,7 +681,7 @@ int RenderTableCell::borderHalfBottom(bool outer) const void RenderTableCell::paint(PaintInfo& paintInfo, int tx, int ty) { if (paintInfo.phase == PaintPhaseCollapsedTableBorders && style()->visibility() == VISIBLE) { - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return; tx += x(); @@ -855,7 +855,7 @@ void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, int void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, int ty, RenderObject* backgroundObject) { - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return; if (!backgroundObject) @@ -897,7 +897,7 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, i void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { - if (!shouldPaintWithinRoot(paintInfo)) + if (!paintInfo.shouldPaintWithinRoot(this)) return; RenderTable* tableElt = table(); diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp index ab56036..84ed8aa 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -276,7 +276,8 @@ void RenderTextControlSingleLine::layout() // remaining one pixel. It's good for Mac NSStepper because it has // shadow at the bottom. int y = (diff / 2) + (diff % 2); - spinBox->setLocation(spinBox->x() + paddingRight() + borderRight(), y); + int x = width() - borderRight() - paddingRight() - spinBox->width(); + spinBox->setLocation(x, y); } } @@ -368,20 +369,18 @@ void RenderTextControlSingleLine::forwardEvent(Event* event) FloatPoint localPoint = innerTextRenderer->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true); int textRight = innerTextRenderer->borderBoxRect().right(); + #if ENABLE(INPUT_SPEECH) - int cancelRight = textRight; - if (m_cancelButton && m_cancelButton->renderBox()) { - RenderBox* cancelRenderer = m_cancelButton->renderBox(); - cancelRight += cancelRenderer->width() + cancelRenderer->marginLeft() + cancelRenderer->marginRight(); + if (RenderBox* speechBox = m_speechButton ? m_speechButton->renderBox() : 0) { + if (localPoint.x() >= speechBox->x() && localPoint.x() < speechBox->x() + speechBox->width()) { + m_speechButton->defaultEventHandler(event); + return; + } } #endif if (m_resultsButton && localPoint.x() < innerTextRenderer->borderBoxRect().x()) m_resultsButton->defaultEventHandler(event); -#if ENABLE(INPUT_SPEECH) - else if (m_speechButton && localPoint.x() > cancelRight) - m_speechButton->defaultEventHandler(event); -#endif else if (m_cancelButton && localPoint.x() > textRight) m_cancelButton->defaultEventHandler(event); else if (m_outerSpinButton && localPoint.x() > textRight) @@ -618,6 +617,10 @@ void RenderTextControlSingleLine::createSubtreeIfNeeded() m_innerBlock = TextControlInnerElement::create(node()); m_innerBlock->attachInnerElement(node(), createInnerBlockStyle(style()), renderArena()); } + if (inputElement()->hasSpinButton() && !m_outerSpinButton) { + m_outerSpinButton = SpinButtonElement::create(node()); + m_outerSpinButton->attachInnerElement(node(), createOuterSpinButtonStyle(), renderArena()); + } if (inputElement()->isSearchField()) { if (!m_resultsButton) { @@ -722,7 +725,7 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerBlockStyle(const RefPtr<RenderStyle> innerBlockStyle = RenderStyle::create(); innerBlockStyle->inheritFrom(startStyle); - innerBlockStyle->setDisplay(BLOCK); + innerBlockStyle->setDisplay(inputElement()->hasSpinButton() ? INLINE_BLOCK : BLOCK); innerBlockStyle->setDirection(LTR); // We don't want the shadow dom to be editable, so we set this block to read-only in case the input itself is editable. diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp index 407f273..2c6e9da 100644 --- a/WebCore/rendering/RenderTheme.cpp +++ b/WebCore/rendering/RenderTheme.cpp @@ -44,6 +44,10 @@ #include "RenderMeter.h" #endif +#if ENABLE(INPUT_SPEECH) +#include "RenderInputSpeech.h" +#endif + // The methods in this file are shared by all themes on every platform. namespace WebCore { @@ -234,14 +238,14 @@ void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, El #endif #if ENABLE(INPUT_SPEECH) case InputSpeechButtonPart: - // FIXME: Adjust the speech button's style and sizes. + return adjustInputFieldSpeechButtonStyle(selector, style, e); #endif default: break; } } -bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { // If painting is disabled, but we aren't updating control tints, then just bail. // If we are updating control tints, just schedule a repaint if the theme supports tinting @@ -368,7 +372,7 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf return paintSearchFieldResultsButton(o, paintInfo, r); #if ENABLE(INPUT_SPEECH) case InputSpeechButtonPart: - // FIXME: Add painting code to draw the speech button. + return paintInputFieldSpeechButton(o, paintInfo, r); #endif default: break; @@ -377,7 +381,7 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf return true; // We don't support the appearance, so let the normal background/border paint. } -bool RenderTheme::paintBorderOnly(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderTheme::paintBorderOnly(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { if (paintInfo.context->paintingDisabled()) return false; @@ -428,7 +432,7 @@ bool RenderTheme::paintBorderOnly(RenderObject* o, const RenderObject::PaintInfo return false; } -bool RenderTheme::paintDecorations(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderTheme::paintDecorations(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { if (paintInfo.context->paintingDisabled()) return false; @@ -926,6 +930,18 @@ void RenderTheme::adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) { } +#if ENABLE(INPUT_SPEECH) +void RenderTheme::adjustInputFieldSpeechButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* element) const +{ + RenderInputSpeech::adjustInputFieldSpeechButtonStyle(selector, style, element); +} + +bool RenderTheme::paintInputFieldSpeechButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) +{ + return RenderInputSpeech::paintInputFieldSpeechButton(object, paintInfo, rect); +} +#endif + #if ENABLE(METER_TAG) void RenderTheme::adjustMeterStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { @@ -942,7 +958,7 @@ bool RenderTheme::supportsMeter(ControlPart, bool) const return false; } -bool RenderTheme::paintMeter(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) +bool RenderTheme::paintMeter(RenderObject*, const PaintInfo&, const IntRect&) { return true; } diff --git a/WebCore/rendering/RenderTheme.h b/WebCore/rendering/RenderTheme.h index 72a33dc..47217ca 100644 --- a/WebCore/rendering/RenderTheme.h +++ b/WebCore/rendering/RenderTheme.h @@ -76,9 +76,9 @@ public: // This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the // text of a button, is always rendered by the engine itself. The boolean return value indicates // whether the CSS border/background should also be painted. - bool paint(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - bool paintBorderOnly(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - bool paintDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + bool paint(RenderObject*, const PaintInfo&, const IntRect&); + bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&); + bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&); // The remaining methods should be implemented by the platform-specific portion of the theme, e.g., // RenderThemeMac.cpp for Mac OS X. @@ -173,7 +173,7 @@ public: virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; } // Method for painting the caps lock indicator - virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return 0; }; + virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; }; #if ENABLE(PROGRESS_TAG) // Returns the repeat interval of the animation for the progress bar. @@ -216,85 +216,90 @@ protected: #if !USE(NEW_THEME) // Methods for each appearance value. virtual void adjustCheckboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void setCheckboxSize(RenderStyle*) const { } virtual void adjustRadioStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void setRadioSize(RenderStyle*) const { } virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void setButtonSize(RenderStyle*) const { } virtual void adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintInnerSpinButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustOuterSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintOuterSpinButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintOuterSpinButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } #endif virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&) { return true; } #ifdef ANDROID_LISTBOX_USES_MENU_LIST virtual void adjustListboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const {} #endif virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } #if ENABLE(METER_TAG) virtual void adjustMeterStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMeter(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); #endif #if ENABLE(PROGRESS_TAG) virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&) { return true; } +#endif + +#if ENABLE(INPUT_SPEECH) + virtual void adjustInputFieldSpeechButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintInputFieldSpeechButton(RenderObject*, const PaintInfo&, const IntRect&); #endif virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return true; } virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - - virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaVolumeSliderContainer(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaRewindButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } - virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; } + virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + + virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaRewindButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const IntRect&) { return true; } + virtual bool paintMediaTimeRemaining(RenderObject*, const PaintInfo&, const IntRect&) { return true; } public: // Methods for state querying diff --git a/WebCore/rendering/RenderThemeChromiumLinux.cpp b/WebCore/rendering/RenderThemeChromiumLinux.cpp index 13c9cd6..c29353d 100644 --- a/WebCore/rendering/RenderThemeChromiumLinux.cpp +++ b/WebCore/rendering/RenderThemeChromiumLinux.cpp @@ -32,9 +32,9 @@ namespace WebCore { -unsigned RenderThemeChromiumLinux::m_thumbInactiveColor = 0xf0ebe5; -unsigned RenderThemeChromiumLinux::m_thumbActiveColor = 0xfaf8f5; -unsigned RenderThemeChromiumLinux::m_trackColor = 0xe3ddd8; +unsigned RenderThemeChromiumLinux::m_thumbInactiveColor = 0xeaeaea; +unsigned RenderThemeChromiumLinux::m_thumbActiveColor = 0xf4f4f4; +unsigned RenderThemeChromiumLinux::m_trackColor = 0xd3d3d3; unsigned RenderThemeChromiumLinux::m_activeSelectionBackgroundColor = 0xff1e90ff; unsigned RenderThemeChromiumLinux::m_activeSelectionForegroundColor = diff --git a/WebCore/rendering/RenderThemeChromiumMac.h b/WebCore/rendering/RenderThemeChromiumMac.h index aaaade0..2309081 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.h +++ b/WebCore/rendering/RenderThemeChromiumMac.h @@ -34,15 +34,15 @@ public: protected: #if ENABLE(VIDEO) virtual void adjustMediaSliderThumbSize(RenderObject*) const; - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, const IntRect&); virtual bool shouldRenderMediaControlPart(ControlPart, Element*); virtual String extraMediaControlsStyleSheet(); - virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); #endif diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm index e572b69..a43da1e 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/WebCore/rendering/RenderThemeChromiumMac.mm @@ -109,22 +109,22 @@ bool RenderThemeChromiumMac::shouldRenderMediaControlPart(ControlPart part, Elem return RenderMediaControlsChromium::shouldRenderMediaControlPart(part, e); } -bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect); } -bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect); } -bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect); } -bool RenderThemeChromiumMac::paintMediaControlsBackground(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumMac::paintMediaControlsBackground(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaTimelineContainer, object, paintInfo, rect); } @@ -134,12 +134,12 @@ String RenderThemeChromiumMac::extraMediaControlsStyleSheet() return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet)); } -bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect); } -bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect); } diff --git a/WebCore/rendering/RenderThemeChromiumSkia.cpp b/WebCore/rendering/RenderThemeChromiumSkia.cpp index e3afd1f..d90bbc2 100644 --- a/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -235,19 +235,23 @@ IntRect center(const IntRect& original, int width, int height) return IntRect(x, y, width, height); } -bool RenderThemeChromiumSkia::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +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 (this->isEnabled(o)) - image = this->isChecked(o) ? checkedImage : uncheckedImage; + if (isIndeterminate(o)) + image = isEnabled(o) ? indeterminateImage : disabledIndeterminateImage; + else if (isChecked(o)) + image = isEnabled(o) ? checkedImage : disabledCheckedImage; else - image = this->isChecked(o) ? disabledCheckedImage : disabledUncheckedImage; + image = isEnabled(o) ? uncheckedImage : disabledUncheckedImage; i.context->drawImage(image, o->style()->colorSpace(), center(rect, widgetStandardHeight, widgetStandardWidth)); return false; @@ -268,7 +272,7 @@ void RenderThemeChromiumSkia::setCheckboxSize(RenderStyle* style) const setSizeIfAuto(style, size); } -bool RenderThemeChromiumSkia::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +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(); @@ -302,7 +306,7 @@ static SkColor brightenColor(double h, double s, double l, float brightenAmount) return makeRGBAFromHSLA(h, s, l, 1.0); } -static void paintButtonLike(RenderTheme* theme, RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +static void paintButtonLike(RenderTheme* theme, RenderObject* o, const PaintInfo& i, const IntRect& rect) { SkCanvas* const canvas = i.context->platformContext()->canvas(); SkPaint paint; @@ -360,7 +364,7 @@ static void paintButtonLike(RenderTheme* theme, RenderObject* o, const RenderObj canvas->drawPoint(right - 2, bottom - 2, paint); } -bool RenderThemeChromiumSkia::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +bool RenderThemeChromiumSkia::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) { paintButtonLike(this, o, i, rect); return false; @@ -375,12 +379,12 @@ void RenderThemeChromiumSkia::adjustButtonStyle(CSSStyleSelector*, RenderStyle* } -bool RenderThemeChromiumSkia::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +bool RenderThemeChromiumSkia::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect) { return true; } -bool RenderThemeChromiumSkia::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumSkia::paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); } @@ -391,7 +395,7 @@ void RenderThemeChromiumSkia::adjustSearchFieldStyle(CSSStyleSelector*, RenderSt style->setLineHeight(RenderStyle::initialLineHeight()); } -bool RenderThemeChromiumSkia::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumSkia::paintSearchField(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); } @@ -417,7 +421,7 @@ IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRender return partRect; } -bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* cancelButtonObject, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* cancelButtonObject, const PaintInfo& paintInfo, const IntRect& r) { // Get the renderer of <input> element. Node* input = cancelButtonObject->node()->shadowAncestorNode(); @@ -460,7 +464,7 @@ void RenderThemeChromiumSkia::adjustSearchFieldResultsDecorationStyle(CSSStyleSe style->setHeight(Length(magnifierSize, Fixed)); } -bool RenderThemeChromiumSkia::paintSearchFieldResultsDecoration(RenderObject* magnifierObject, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumSkia::paintSearchFieldResultsDecoration(RenderObject* magnifierObject, const PaintInfo& paintInfo, const IntRect& r) { // Get the renderer of <input> element. Node* input = magnifierObject->node()->shadowAncestorNode(); @@ -495,7 +499,7 @@ void RenderThemeChromiumSkia::adjustSearchFieldResultsButtonStyle(CSSStyleSelect style->setHeight(Length(magnifierHeight, Fixed)); } -bool RenderThemeChromiumSkia::paintSearchFieldResultsButton(RenderObject* magnifierObject, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeChromiumSkia::paintSearchFieldResultsButton(RenderObject* magnifierObject, const PaintInfo& paintInfo, const IntRect& r) { // Get the renderer of <input> element. Node* input = magnifierObject->node()->shadowAncestorNode(); @@ -517,7 +521,7 @@ bool RenderThemeChromiumSkia::paintSearchFieldResultsButton(RenderObject* magnif return false; } -bool RenderThemeChromiumSkia::paintMediaControlsBackground(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMediaControlsBackground(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { #if ENABLE(VIDEO) return RenderMediaControlsChromium::paintMediaControlsPart(MediaTimelineContainer, object, paintInfo, rect); @@ -529,7 +533,7 @@ bool RenderThemeChromiumSkia::paintMediaControlsBackground(RenderObject* object, #endif } -bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { #if ENABLE(VIDEO) return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect); @@ -541,7 +545,7 @@ bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const #endif } -bool RenderThemeChromiumSkia::paintMediaVolumeSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { #if ENABLE(VIDEO) return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect); @@ -562,7 +566,7 @@ void RenderThemeChromiumSkia::adjustSliderThumbSize(RenderObject* object) const #endif } -bool RenderThemeChromiumSkia::paintMediaSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { #if ENABLE(VIDEO) return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect); @@ -574,7 +578,7 @@ bool RenderThemeChromiumSkia::paintMediaSliderThumb(RenderObject* object, const #endif } -bool RenderThemeChromiumSkia::paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { #if ENABLE(VIDEO) return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect); @@ -586,7 +590,7 @@ bool RenderThemeChromiumSkia::paintMediaVolumeSliderThumb(RenderObject* object, #endif } -bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { #if ENABLE(VIDEO) return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect); @@ -598,7 +602,7 @@ bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const R #endif } -bool RenderThemeChromiumSkia::paintMediaMuteButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { #if ENABLE(VIDEO) return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect); @@ -616,7 +620,7 @@ void RenderThemeChromiumSkia::adjustMenuListStyle(CSSStyleSelector* selector, Re style->setLineHeight(RenderStyle::initialLineHeight()); } -bool RenderThemeChromiumSkia::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +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(); @@ -646,12 +650,12 @@ void RenderThemeChromiumSkia::adjustMenuListButtonStyle(CSSStyleSelector* select } // Used to paint styled menulists (i.e. with a non-default border) -bool RenderThemeChromiumSkia::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +bool RenderThemeChromiumSkia::paintMenuListButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) { return paintMenuList(o, i, rect); } -bool RenderThemeChromiumSkia::paintSliderTrack(RenderObject*, const RenderObject::PaintInfo& i, const IntRect& 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(); @@ -670,7 +674,7 @@ bool RenderThemeChromiumSkia::paintSliderTrack(RenderObject*, const RenderObject return false; } -bool RenderThemeChromiumSkia::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& rect) +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(); @@ -812,7 +816,7 @@ double RenderThemeChromiumSkia::animationDurationForProgressBar(RenderProgress* return progressAnimationInterval * progressAnimationFrmaes * 2; // "2" for back and forth } -bool RenderThemeChromiumSkia::paintProgressBar(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +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(); diff --git a/WebCore/rendering/RenderThemeChromiumSkia.h b/WebCore/rendering/RenderThemeChromiumSkia.h index 56c315e..a11046d 100644 --- a/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/WebCore/rendering/RenderThemeChromiumSkia.h @@ -66,41 +66,41 @@ class RenderProgress; virtual int minimumMenuListSize(RenderStyle*) const; - virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); virtual void setCheckboxSize(RenderStyle*) const; - virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); virtual void setRadioSize(RenderStyle*) const; - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSliderThumbSize(RenderObject*) const; - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&); // MenuList refers to an unstyled menulist (meaning a menulist without // background-color or border set) and MenuListButton refers to a styled @@ -112,17 +112,17 @@ 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 RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintSliderThumb(RenderObject*, const RenderObject::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 RenderObject::PaintInfo&, const IntRect&); + virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif // These methods define the padding for the MenuList's inner block. diff --git a/WebCore/rendering/RenderThemeChromiumWin.cpp b/WebCore/rendering/RenderThemeChromiumWin.cpp index d82fddc..1172f96 100644 --- a/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -374,16 +374,16 @@ void RenderThemeChromiumWin::adjustSliderThumbSize(RenderObject* o) const RenderThemeChromiumSkia::adjustSliderThumbSize(o); } -bool RenderThemeChromiumWin::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); } -bool RenderThemeChromiumWin::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); } -bool RenderThemeChromiumWin::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& r) { const ThemeData& themeData = getThemeData(o); @@ -396,12 +396,12 @@ bool RenderThemeChromiumWin::paintButton(RenderObject* o, const RenderObject::Pa return false; } -bool RenderThemeChromiumWin::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextFieldInternal(o, i, r, true); } -bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r) { const ThemeData& themeData = getThemeData(o); @@ -414,13 +414,13 @@ bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const RenderObjec return false; } -bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintSliderTrack(o, i, r); } // Used to paint unstyled menulists (i.e. with the default border) -bool RenderThemeChromiumWin::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& r) { if (!o->isBox()) return false; @@ -501,8 +501,14 @@ unsigned RenderThemeChromiumWin::determineState(RenderObject* o) result = ETS_FOCUSED; else if (isHovered(o)) result = TS_HOT; - if (isChecked(o)) - result += 4; // 4 unchecked states, 4 checked states. + + // CBS_UNCHECKED*: 1-4 + // CBS_CHECKED*: 5-8 + // CBS_MIXED*: 9-12 + if (isIndeterminate(o)) + result += 8; + else if (isChecked(o)) + result += 4; return result; } @@ -550,7 +556,8 @@ unsigned RenderThemeChromiumWin::determineClassicState(RenderObject* o) result = 0; else if (isHovered(o)) result = DFCS_HOT; - if (isChecked(o)) + // Classic theme can't represent indeterminate states. Use unchecked appearance. + if (isChecked(o) && !isIndeterminate(o)) result |= DFCS_CHECKED; } return result; @@ -609,7 +616,7 @@ ThemeData RenderThemeChromiumWin::getThemeData(RenderObject* o) } bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, - const RenderObject::PaintInfo& i, + const PaintInfo& i, const IntRect& r, bool drawEdges) { @@ -677,7 +684,7 @@ void RenderThemeChromiumWin::adjustProgressBarStyle(CSSStyleSelector*, RenderSty { } -bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& r) { if (!o->isProgress()) return true; @@ -689,7 +696,7 @@ bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const RenderObjec double animatedSeconds = renderProgress->animationStartTime() ? WTF::currentTime() - renderProgress->animationStartTime() : 0; ThemePainter painter(i.context, r); ChromiumBridge::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds); - return true; + return false; } #endif diff --git a/WebCore/rendering/RenderThemeChromiumWin.h b/WebCore/rendering/RenderThemeChromiumWin.h index 131314a..c6c95e6 100644 --- a/WebCore/rendering/RenderThemeChromiumWin.h +++ b/WebCore/rendering/RenderThemeChromiumWin.h @@ -64,12 +64,12 @@ namespace WebCore { virtual void adjustSliderThumbSize(RenderObject*) const; // Various paint functions. - virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); // MenuList refers to an unstyled menulist (meaning a menulist without // background-color or border set) and MenuListButton refers to a styled @@ -80,7 +80,7 @@ namespace WebCore { // In short, we either go down the MenuList code path or the MenuListButton // codepath. We never go down both. And in both cases, they render the // entire menulist. - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); // Override RenderThemeChromiumSkia's setDefaultFontSize method to also reset the local font property caches. // See comment in RenderThemeChromiumSkia::setDefaultFontSize() regarding ugliness of this hack. @@ -91,7 +91,7 @@ namespace WebCore { virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif protected: @@ -107,7 +107,7 @@ namespace WebCore { ThemeData getThemeData(RenderObject*); - bool paintTextFieldInternal(RenderObject*, const RenderObject::PaintInfo&, const IntRect&, bool); + bool paintTextFieldInternal(RenderObject*, const PaintInfo&, const IntRect&, bool); }; } // namespace WebCore diff --git a/WebCore/rendering/RenderThemeMac.h b/WebCore/rendering/RenderThemeMac.h index 34dbed3..44d9189 100644 --- a/WebCore/rendering/RenderThemeMac.h +++ b/WebCore/rendering/RenderThemeMac.h @@ -78,11 +78,11 @@ public: virtual int popupInternalPaddingTop(RenderStyle*) const; virtual int popupInternalPaddingBottom(RenderStyle*) const; - virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&); #if ENABLE(METER_TAG) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; - virtual bool paintMeter(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); virtual bool supportsMeter(ControlPart, bool isHorizontal) const; #endif @@ -104,58 +104,58 @@ protected: virtual bool supportsSelectionForegroundColors() const { return false; } - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; #if ENABLE(PROGRESS_TAG) virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif - virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&); #if ENABLE(VIDEO) - virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaRewindButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaRewindButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaTimeRemaining(RenderObject*, const PaintInfo&, const IntRect&); // Media controls virtual String extraMediaControlsStyleSheet(); @@ -192,7 +192,7 @@ private: const IntSize* popupButtonSizes() const; const int* popupButtonMargins() const; const int* popupButtonPadding(NSControlSize) const; - void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + void paintMenuListButtonGradients(RenderObject*, const PaintInfo&, const IntRect&); const IntSize* menuListSizes() const; const IntSize* searchFieldSizes() const; diff --git a/WebCore/rendering/RenderThemeMac.mm b/WebCore/rendering/RenderThemeMac.mm index 9c79386..993bc72 100644 --- a/WebCore/rendering/RenderThemeMac.mm +++ b/WebCore/rendering/RenderThemeMac.mm @@ -706,7 +706,7 @@ NSControlSize RenderThemeMac::controlSizeForSystemFont(RenderStyle* style) const return NSMiniControlSize; } -bool RenderThemeMac::paintTextField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintTextField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { LocalCurrentGraphicsContext localContext(paintInfo.context); wkDrawBezeledTextFieldCell(r, isEnabled(o) && !isReadOnlyControl(o)); @@ -717,7 +717,7 @@ void RenderThemeMac::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Eleme { } -bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const IntRect& r) { if (paintInfo.context->paintingDisabled()) return true; @@ -728,7 +728,7 @@ bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const RenderObject::P return false; } -bool RenderThemeMac::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintTextArea(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { LocalCurrentGraphicsContext localContext(paintInfo.context); wkDrawBezeledTextArea(r, isEnabled(o) && !isReadOnlyControl(o)); @@ -767,7 +767,7 @@ const int* RenderThemeMac::popupButtonPadding(NSControlSize size) const return padding[size]; } -bool RenderThemeMac::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMenuList(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { LocalCurrentGraphicsContext localContext(paintInfo.context); setPopupButtonCellState(o, r); @@ -821,7 +821,7 @@ IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const bounds.height() < cellSize.height ? cellSize.height : bounds.height()); } -bool RenderThemeMac::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeMac::paintMeter(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { if (!renderObject->isMeter()) return true; @@ -930,7 +930,7 @@ void RenderThemeMac::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Ele { } -bool RenderThemeMac::paintProgressBar(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) +bool RenderThemeMac::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { if (!renderObject->isProgress()) return true; @@ -1020,7 +1020,7 @@ static void TrackGradientInterpolate(void*, const CGFloat* inData, CGFloat* outD outData[i] = (1.0f - a) * dark[i] + a * light[i]; } -void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { if (r.isEmpty()) return; @@ -1087,7 +1087,7 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const RenderO paintInfo.context->restore(); } -bool RenderThemeMac::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMenuListButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), r.y() + o->style()->borderTopWidth(), @@ -1270,7 +1270,7 @@ void RenderThemeMac::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* styl style->setBoxShadow(0); } -bool RenderThemeMac::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { IntRect bounds = r; float zoomLevel = o->style()->effectiveZoom(); @@ -1316,7 +1316,7 @@ void RenderThemeMac::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* styl const float verticalSliderHeightPadding = 0.1f; -bool RenderThemeMac::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(o->parent()->isSlider()); @@ -1377,7 +1377,7 @@ bool RenderThemeMac::paintSliderThumb(RenderObject* o, const RenderObject::Paint return false; } -bool RenderThemeMac::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintSearchField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { NSSearchFieldCell* search = this->search(); LocalCurrentGraphicsContext localContext(paintInfo.context); @@ -1474,7 +1474,7 @@ void RenderThemeMac::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderSt style->setBoxShadow(0); } -bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* input = o->node()->shadowAncestorNode(); if (!input->renderer()->isBox()) @@ -1492,6 +1492,16 @@ bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const RenderO float zoomLevel = o->style()->effectiveZoom(); FloatRect localBounds = [search cancelButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; + +#if ENABLE(INPUT_SPEECH) + // Take care of cases where the cancel button was not aligned with the right border of the input element (for e.g. + // when speech input is enabled for the input element. + IntRect absBoundingBox = input->renderer()->absoluteBoundingBoxRect(); + int absRight = absBoundingBox.x() + absBoundingBox.width() - input->renderBox()->paddingRight() - input->renderBox()->borderRight(); + int spaceToRightOfCancelButton = absRight - (r.x() + r.width()); + localBounds.setX(localBounds.x() - spaceToRightOfCancelButton); +#endif + localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); FloatRect unzoomedRect(localBounds); @@ -1539,7 +1549,7 @@ void RenderThemeMac::adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderS style->setBoxShadow(0); } -bool RenderThemeMac::paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) +bool RenderThemeMac::paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return false; } @@ -1552,7 +1562,7 @@ void RenderThemeMac::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, style->setBoxShadow(0); } -bool RenderThemeMac::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo&, const IntRect& r) +bool RenderThemeMac::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo&, const IntRect& r) { Node* input = o->node()->shadowAncestorNode(); if (!input->renderer()->isBox()) @@ -1584,7 +1594,7 @@ void RenderThemeMac::adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, Rend style->setBoxShadow(0); } -bool RenderThemeMac::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* input = o->node()->shadowAncestorNode(); if (!input->renderer()->isBox()) @@ -1712,7 +1722,7 @@ static unsigned getMediaUIPartStateFlags(Node* node) } // Utility to scale when the UI part are not scaled by wkDrawMediaUIPart -static FloatRect getUnzoomedRectAndAdjustCurrentContext(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect &originalRect) +static FloatRect getUnzoomedRectAndAdjustCurrentContext(RenderObject* o, const PaintInfo& paintInfo, const IntRect &originalRect) { float zoomLevel = o->style()->effectiveZoom(); FloatRect unzoomedRect(originalRect); @@ -1727,7 +1737,7 @@ static FloatRect getUnzoomedRectAndAdjustCurrentContext(RenderObject* o, const R } -bool RenderThemeMac::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaFullscreenButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1738,7 +1748,7 @@ bool RenderThemeMac::paintMediaFullscreenButton(RenderObject* o, const RenderObj return false; } -bool RenderThemeMac::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaMuteButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); Node* mediaNode = node ? node->shadowAncestorNode() : 0; @@ -1753,7 +1763,7 @@ bool RenderThemeMac::paintMediaMuteButton(RenderObject* o, const RenderObject::P return false; } -bool RenderThemeMac::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); Node* mediaNode = node ? node->shadowAncestorNode() : 0; @@ -1767,7 +1777,7 @@ bool RenderThemeMac::paintMediaPlayButton(RenderObject* o, const RenderObject::P return false; } -bool RenderThemeMac::paintMediaSeekBackButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaSeekBackButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1778,7 +1788,7 @@ bool RenderThemeMac::paintMediaSeekBackButton(RenderObject* o, const RenderObjec return false; } -bool RenderThemeMac::paintMediaSeekForwardButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaSeekForwardButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1789,7 +1799,7 @@ bool RenderThemeMac::paintMediaSeekForwardButton(RenderObject* o, const RenderOb return false; } -bool RenderThemeMac::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); Node* mediaNode = node ? node->shadowAncestorNode() : 0; @@ -1817,7 +1827,7 @@ bool RenderThemeMac::paintMediaSliderTrack(RenderObject* o, const RenderObject:: return false; } -bool RenderThemeMac::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1828,7 +1838,7 @@ bool RenderThemeMac::paintMediaSliderThumb(RenderObject* o, const RenderObject:: return false; } -bool RenderThemeMac::paintMediaRewindButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaRewindButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1839,7 +1849,7 @@ bool RenderThemeMac::paintMediaRewindButton(RenderObject* o, const RenderObject: return false; } -bool RenderThemeMac::paintMediaReturnToRealtimeButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaReturnToRealtimeButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1850,7 +1860,7 @@ bool RenderThemeMac::paintMediaReturnToRealtimeButton(RenderObject* o, const Ren return false; } -bool RenderThemeMac::paintMediaToggleClosedCaptionsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaToggleClosedCaptionsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { HTMLInputElement* node = static_cast<HTMLInputElement*>(o->node()); if (!node) @@ -1866,7 +1876,7 @@ bool RenderThemeMac::paintMediaToggleClosedCaptionsButton(RenderObject* o, const return false; } -bool RenderThemeMac::paintMediaControlsBackground(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaControlsBackground(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1877,7 +1887,7 @@ bool RenderThemeMac::paintMediaControlsBackground(RenderObject* o, const RenderO return false; } -bool RenderThemeMac::paintMediaCurrentTime(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaCurrentTime(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) @@ -1890,7 +1900,7 @@ bool RenderThemeMac::paintMediaCurrentTime(RenderObject* o, const RenderObject:: return false; } -bool RenderThemeMac::paintMediaTimeRemaining(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintMediaTimeRemaining(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Node* node = o->node(); if (!node) diff --git a/WebCore/rendering/RenderThemeSafari.cpp b/WebCore/rendering/RenderThemeSafari.cpp index 6a62384..07b8eb8 100644 --- a/WebCore/rendering/RenderThemeSafari.cpp +++ b/WebCore/rendering/RenderThemeSafari.cpp @@ -409,7 +409,7 @@ NSControlSize RenderThemeSafari::controlSizeForSystemFont(RenderStyle* style) co return NSMiniControlSize; } -bool RenderThemeSafari::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintCheckbox(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -448,7 +448,7 @@ void RenderThemeSafari::setCheckboxSize(RenderStyle* style) const setSizeFromFont(style, checkboxSizes()); } -bool RenderThemeSafari::paintRadio(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintRadio(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -572,7 +572,7 @@ void RenderThemeSafari::setButtonSize(RenderStyle* style) const setSizeFromFont(style, buttonSizes()); } -bool RenderThemeSafari::paintButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -605,7 +605,7 @@ bool RenderThemeSafari::paintButton(RenderObject* o, const RenderObject::PaintIn return false; } -bool RenderThemeSafari::paintTextField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintTextField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -617,7 +617,7 @@ void RenderThemeSafari::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, El { } -bool RenderThemeSafari::paintCapsLockIndicator(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintCapsLockIndicator(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { #if defined(SAFARI_THEME_VERSION) && SAFARI_THEME_VERSION >= 1 ASSERT(SafariThemeLibrary()); @@ -633,7 +633,7 @@ bool RenderThemeSafari::paintCapsLockIndicator(RenderObject* o, const RenderObje #endif } -bool RenderThemeSafari::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintTextArea(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -673,7 +673,7 @@ const int* RenderThemeSafari::popupButtonPadding(NSControlSize size) const return padding[size]; } -bool RenderThemeSafari::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& info, const IntRect& r) +bool RenderThemeSafari::paintMenuList(RenderObject* o, const PaintInfo& info, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -742,7 +742,7 @@ static void TrackGradientInterpolate(void* info, const CGFloat* inData, CGFloat* outData[i] = (1.0f - a) * dark[i] + a * light[i]; } -void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { if (r.isEmpty()) return; @@ -809,7 +809,7 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Rend paintInfo.context->restore(); } -bool RenderThemeSafari::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMenuListButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), r.y() + o->style()->borderTopWidth(), @@ -955,7 +955,7 @@ int RenderThemeSafari::minimumMenuListSize(RenderStyle* style) const const int trackWidth = 5; const int trackRadius = 2; -bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { IntRect bounds = r; @@ -998,7 +998,7 @@ void RenderThemeSafari::adjustSliderThumbStyle(CSSStyleSelector* selector, Rende const float verticalSliderHeightPadding = 0.1f; -bool RenderThemeSafari::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -1029,7 +1029,7 @@ void RenderThemeSafari::adjustSliderThumbSize(RenderObject* o) const #endif } -bool RenderThemeSafari::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintSearchField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { ASSERT(SafariThemeLibrary()); @@ -1082,7 +1082,7 @@ void RenderThemeSafari::adjustSearchFieldStyle(CSSStyleSelector* selector, Rende setFontFromControlSize(selector, style, controlSize); } -bool RenderThemeSafari::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect&) +bool RenderThemeSafari::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect&) { ASSERT(SafariThemeLibrary()); @@ -1124,7 +1124,7 @@ void RenderThemeSafari::adjustSearchFieldDecorationStyle(CSSStyleSelector* selec style->setHeight(Length(size.height(), Fixed)); } -bool RenderThemeSafari::paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) +bool RenderThemeSafari::paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return false; } @@ -1136,7 +1136,7 @@ void RenderThemeSafari::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector style->setHeight(Length(size.height(), Fixed)); } -bool RenderThemeSafari::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect&) +bool RenderThemeSafari::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect&) { ASSERT(SafariThemeLibrary()); @@ -1159,7 +1159,7 @@ void RenderThemeSafari::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* se style->setHeight(Length(size.height(), Fixed)); } -bool RenderThemeSafari::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect&) +bool RenderThemeSafari::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect&) { ASSERT(SafariThemeLibrary()); @@ -1174,37 +1174,37 @@ bool RenderThemeSafari::paintSearchFieldResultsButton(RenderObject* o, const Ren return false; } #if ENABLE(VIDEO) -bool RenderThemeSafari::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMediaFullscreenButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaFullscreenButton, o, paintInfo, r); } -bool RenderThemeSafari::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMediaMuteButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaMuteButton, o, paintInfo, r); } -bool RenderThemeSafari::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaPlayButton, o, paintInfo, r); } -bool RenderThemeSafari::paintMediaSeekBackButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMediaSeekBackButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSeekBackButton, o, paintInfo, r); } -bool RenderThemeSafari::paintMediaSeekForwardButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMediaSeekForwardButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSeekForwardButton, o, paintInfo, r); } -bool RenderThemeSafari::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMediaSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSlider, o, paintInfo, r); } -bool RenderThemeSafari::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeSafari::paintMediaSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSliderThumb, o, paintInfo, r); } diff --git a/WebCore/rendering/RenderThemeSafari.h b/WebCore/rendering/RenderThemeSafari.h index fb8ffb0..b91e28e 100644 --- a/WebCore/rendering/RenderThemeSafari.h +++ b/WebCore/rendering/RenderThemeSafari.h @@ -86,56 +86,56 @@ public: protected: // Methods for each appearance value. - virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); virtual void setCheckboxSize(RenderStyle*) const; - virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); virtual void setRadioSize(RenderStyle*) const; virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, WebCore::Element*) const; - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void setButtonSize(RenderStyle*) const; - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&); #if ENABLE(VIDEO) - virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); #endif private: @@ -168,7 +168,7 @@ private: const IntSize* popupButtonSizes() const; const int* popupButtonMargins(NSControlSize) const; const int* popupButtonPadding(NSControlSize) const; - void paintMenuListButtonGradients(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + void paintMenuListButtonGradients(RenderObject*, const PaintInfo&, const IntRect&); const IntSize* menuListSizes() const; const IntSize* searchFieldSizes() const; diff --git a/WebCore/rendering/RenderThemeWin.cpp b/WebCore/rendering/RenderThemeWin.cpp index 52afbd6..38daf98 100644 --- a/WebCore/rendering/RenderThemeWin.cpp +++ b/WebCore/rendering/RenderThemeWin.cpp @@ -611,7 +611,7 @@ static void drawControl(GraphicsContext* context, RenderObject* o, HANDLE theme, context->releaseWindowsContext(hdc, r, alphaBlend); } -bool RenderThemeWin::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWin::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& r) { drawControl(i.context, o, buttonTheme(), getThemeData(o), r); return false; @@ -633,13 +633,13 @@ void RenderThemeWin::setCheckboxSize(RenderStyle* style) const style->setHeight(Length(13, Fixed)); } -bool RenderThemeWin::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWin::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& r) { drawControl(i.context, o, textFieldTheme(), getThemeData(o), r); return false; } -bool RenderThemeWin::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWin::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& r) { HANDLE theme; int part; @@ -694,7 +694,7 @@ void RenderThemeWin::adjustMenuListButtonStyle(CSSStyleSelector* selector, Rende style->setWhiteSpace(PRE); } -bool RenderThemeWin::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWin::paintMenuListButton(RenderObject* o, const PaintInfo& i, const IntRect& r) { // FIXME: Don't make hardcoded assumptions about the thickness of the textfield border. int borderThickness = haveTheme ? 1 : 2; @@ -721,7 +721,7 @@ bool RenderThemeWin::paintMenuListButton(RenderObject* o, const RenderObject::Pa const int trackWidth = 4; -bool RenderThemeWin::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWin::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r) { IntRect bounds = r; @@ -737,7 +737,7 @@ bool RenderThemeWin::paintSliderTrack(RenderObject* o, const RenderObject::Paint return false; } -bool RenderThemeWin::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWin::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r) { drawControl(i.context, o, sliderTheme(), getThemeData(o), r); return false; @@ -781,7 +781,7 @@ int RenderThemeWin::buttonInternalPaddingBottom() const return 1; } -bool RenderThemeWin::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWin::paintSearchField(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); } @@ -798,7 +798,7 @@ void RenderThemeWin::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderSt style->setOutlineOffset(-2); } -bool RenderThemeWin::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { IntRect bounds = r; ASSERT(o->parent()); @@ -849,7 +849,7 @@ void RenderThemeWin::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* s style->setHeight(Length(magnifierSize, Fixed)); } -bool RenderThemeWin::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { IntRect bounds = r; ASSERT(o->parent()); @@ -883,7 +883,7 @@ void RenderThemeWin::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* selec style->setHeight(Length(magnifierHeight, Fixed)); } -bool RenderThemeWin::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { IntRect bounds = r; ASSERT(o->parent()); @@ -972,42 +972,42 @@ bool RenderThemeWin::shouldRenderMediaControlPart(ControlPart part, Element* ele } -bool RenderThemeWin::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaFullscreenButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaFullscreenButton, o, paintInfo, r); } -bool RenderThemeWin::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaMuteButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaMuteButton, o, paintInfo, r); } -bool RenderThemeWin::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaPlayButton, o, paintInfo, r); } -bool RenderThemeWin::paintMediaSeekBackButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaSeekBackButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSeekBackButton, o, paintInfo, r); } -bool RenderThemeWin::paintMediaSeekForwardButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaSeekForwardButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSeekForwardButton, o, paintInfo, r); } -bool RenderThemeWin::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSlider, o, paintInfo, r); } -bool RenderThemeWin::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaSliderThumb, o, paintInfo, r); } -bool RenderThemeWin::paintMediaToggleClosedCaptionsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWin::paintMediaToggleClosedCaptionsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return RenderMediaControls::paintMediaControlsPart(MediaShowClosedCaptionsButton, o, paintInfo, r); } diff --git a/WebCore/rendering/RenderThemeWin.h b/WebCore/rendering/RenderThemeWin.h index a9fa5e6..2e80032 100644 --- a/WebCore/rendering/RenderThemeWin.h +++ b/WebCore/rendering/RenderThemeWin.h @@ -66,30 +66,30 @@ public: virtual void systemFont(int propId, FontDescription&) const; virtual Color systemColor(int cssValueId) const; - virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) + virtual bool paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); } virtual void setCheckboxSize(RenderStyle*) const; - virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) + virtual bool paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); } virtual void setRadioSize(RenderStyle* style) const { return setCheckboxSize(style); } - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) + virtual bool paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); } virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); - virtual bool paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); + virtual bool paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r); + virtual bool paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r); virtual void adjustSliderThumbSize(RenderObject*) const; virtual bool popupOptionSupportsTextIndent() const { return true; } @@ -100,19 +100,19 @@ public: virtual int buttonInternalPaddingBottom() const; virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return false; } + virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return false; } virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void themeChanged(); @@ -126,14 +126,14 @@ public: #if ENABLE(VIDEO) virtual bool shouldRenderMediaControlPart(ControlPart, Element*); - virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&); #endif private: diff --git a/WebCore/rendering/RenderThemeWince.cpp b/WebCore/rendering/RenderThemeWince.cpp index c4aaaad..4fd6de9 100644 --- a/WebCore/rendering/RenderThemeWince.cpp +++ b/WebCore/rendering/RenderThemeWince.cpp @@ -188,7 +188,7 @@ ThemeData RenderThemeWince::getThemeData(RenderObject* o) return result; } -bool RenderThemeWince::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWince::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& r) { // Get the correct theme data for a button ThemeData themeData = getThemeData(o); @@ -223,7 +223,7 @@ void RenderThemeWince::setCheckboxSize(RenderStyle* style) const style->setHeight(Length(13, Fixed)); } -bool RenderThemeWince::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWince::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& r) { // Get the correct theme data for a textfield ThemeData themeData = getThemeData(o); @@ -240,14 +240,14 @@ void RenderThemeWince::adjustMenuListStyle(CSSStyleSelector* selector, RenderSty adjustMenuListButtonStyle(selector, style, e); } -bool RenderThemeWince::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWince::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& r) { paintTextField(o, i, r); paintMenuListButton(o, i, r); return true; } -bool RenderThemeWince::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWince::paintMenuListButton(RenderObject* o, const PaintInfo& i, const IntRect& r) { IntRect buttonRect(r.right() - dropDownButtonWidth - 1, r.y(), dropDownButtonWidth, r.height()); buttonRect.inflateY(-1); @@ -362,12 +362,12 @@ void RenderThemeWince::adjustSearchFieldStyle(CSSStyleSelector* selector, Render } #endif -bool RenderThemeWince::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWince::paintSearchField(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); } -bool RenderThemeWince::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { Color buttonColor = (o->node() && o->node()->active()) ? Color(138, 138, 138) : Color(186, 186, 186); @@ -412,7 +412,7 @@ void RenderThemeWince::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* style->setHeight(Length(magnifierSize.height(), Fixed)); } -bool RenderThemeWince::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { notImplemented(); return false; @@ -425,7 +425,7 @@ void RenderThemeWince::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* sel style->setHeight(Length(magnifierSize.height(), Fixed)); } -bool RenderThemeWince::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { paintSearchFieldResultsDecoration(o, paintInfo, r); return false; @@ -485,7 +485,7 @@ static HTMLMediaElement* mediaElementParent(Node* node) } #endif -bool RenderThemeWince::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWince::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r) { bool rc = RenderTheme::paintSliderTrack(o, i, r); IntPoint left = IntPoint(r.x() + 2, (r.y() + r.bottom()) / 2); @@ -508,7 +508,7 @@ bool RenderThemeWince::paintSliderTrack(RenderObject* o, const RenderObject::Pai return rc; } -bool RenderThemeWince::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) +bool RenderThemeWince::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r) { bool rc = RenderTheme::paintSliderThumb(o, i, r); i.context->save(); @@ -559,7 +559,7 @@ void RenderThemeWince::adjustSearchFieldStyle(CSSStyleSelector* selector, Render #if ENABLE(VIDEO) -bool RenderThemeWince::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintMediaFullscreenButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { bool rc = paintButton(o, paintInfo, r); FloatRect imRect = r; @@ -572,7 +572,7 @@ bool RenderThemeWince::paintMediaFullscreenButton(RenderObject* o, const RenderO return rc; } -bool RenderThemeWince::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintMediaMuteButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { bool rc = paintButton(o, paintInfo, r); HTMLMediaElement* mediaElement = mediaElementParent(o->node()); @@ -597,7 +597,7 @@ bool RenderThemeWince::paintMediaMuteButton(RenderObject* o, const RenderObject: return rc; } -bool RenderThemeWince::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { bool rc = paintButton(o, paintInfo, r); FloatRect imRect = r; @@ -621,7 +621,7 @@ bool RenderThemeWince::paintMediaPlayButton(RenderObject* o, const RenderObject: return rc; } -bool RenderThemeWince::paintMediaSeekBackButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintMediaSeekBackButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { bool rc = paintButton(o, paintInfo, r); FloatRect imRect = r; @@ -637,7 +637,7 @@ bool RenderThemeWince::paintMediaSeekBackButton(RenderObject* o, const RenderObj return rc; } -bool RenderThemeWince::paintMediaSeekForwardButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintMediaSeekForwardButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { bool rc = paintButton(o, paintInfo, r); FloatRect imRect = r; @@ -653,12 +653,12 @@ bool RenderThemeWince::paintMediaSeekForwardButton(RenderObject* o, const Render return rc; } -bool RenderThemeWince::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintMediaSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return paintSliderTrack(o, paintInfo, r); } -bool RenderThemeWince::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeWince::paintMediaSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { return paintSliderThumb(o, paintInfo, r); } diff --git a/WebCore/rendering/RenderThemeWince.h b/WebCore/rendering/RenderThemeWince.h index a2d04e1..61a4ac5 100644 --- a/WebCore/rendering/RenderThemeWince.h +++ b/WebCore/rendering/RenderThemeWince.h @@ -65,30 +65,30 @@ namespace WebCore { virtual void systemFont(int propId, FontDescription&) const; virtual Color systemColor(int cssValueId) const; - virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) + virtual bool paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); } virtual void setCheckboxSize(RenderStyle*) const; - virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) + virtual bool paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintButton(o, i, r); } virtual void setRadioSize(RenderStyle* style) const { return setCheckboxSize(style); } - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) + virtual bool paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); } virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); - virtual bool paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); + virtual bool paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& r); + virtual bool paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& r); virtual void adjustSliderThumbSize(RenderObject*) const; virtual bool popupOptionSupportsTextIndent() const { return true; } @@ -99,19 +99,19 @@ namespace WebCore { virtual int buttonInternalPaddingBottom() const; virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return false; } + virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return false; } virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintSearchFieldResultsButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void themeChanged(); @@ -124,13 +124,13 @@ namespace WebCore { virtual bool supportsFocusRing(const RenderStyle*) const; #if ENABLE(VIDEO) - virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); #endif private: diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp index 2556bbb..bba14e2 100644 --- a/WebCore/rendering/RenderWidget.cpp +++ b/WebCore/rendering/RenderWidget.cpp @@ -27,6 +27,7 @@ #include "AnimationController.h" #include "GraphicsContext.h" #include "HitTestResult.h" +#include "RenderCounter.h" #include "RenderLayer.h" #include "RenderView.h" #include "RenderWidgetProtector.h" @@ -115,6 +116,9 @@ void RenderWidget::destroy() if (RenderView* v = view()) v->removeWidget(this); + if (m_hasCounterNodeMap) + RenderCounter::destroyCounterNodes(this); + if (AXObjectCache::accessibilityEnabled()) { document()->axObjectCache()->childrenChanged(this->parent()); document()->axObjectCache()->remove(this); diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp index 3a8a4f5..bec288c 100644 --- a/WebCore/rendering/RootInlineBox.cpp +++ b/WebCore/rendering/RootInlineBox.cpp @@ -115,9 +115,9 @@ int RootInlineBox::placeEllipsisBox(bool ltr, int blockLeftEdge, int blockRightE return result; } -void RootInlineBox::paintEllipsisBox(RenderObject::PaintInfo& paintInfo, int tx, int ty) const +void RootInlineBox::paintEllipsisBox(PaintInfo& paintInfo, int tx, int ty) const { - if (hasEllipsisBox() && renderer()->shouldPaintWithinRoot(paintInfo) && renderer()->style()->visibility() == VISIBLE + if (hasEllipsisBox() && paintInfo.shouldPaintWithinRoot(renderer()) && renderer()->style()->visibility() == VISIBLE && paintInfo.phase == PaintPhaseForeground) ellipsisBox()->paint(paintInfo, tx, ty); } @@ -140,9 +140,9 @@ void RootInlineBox::addHighlightOverflow() setVerticalOverflowPositions(topLayoutOverflow(), bottomLayoutOverflow(), min(topVisualOverflow(), inflatedRect.y()), max(bottomVisualOverflow(), inflatedRect.bottom()), height()); } -void RootInlineBox::paintCustomHighlight(RenderObject::PaintInfo& paintInfo, int tx, int ty, const AtomicString& highlightType) +void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, const AtomicString& highlightType) { - if (!renderer()->shouldPaintWithinRoot(paintInfo) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground) + if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground) return; Frame* frame = renderer()->frame(); @@ -161,7 +161,7 @@ void RootInlineBox::paintCustomHighlight(RenderObject::PaintInfo& paintInfo, int #endif -void RootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty) +void RootInlineBox::paint(PaintInfo& paintInfo, int tx, int ty) { InlineFlowBox::paint(paintInfo, tx, ty); paintEllipsisBox(paintInfo, tx, ty); @@ -240,7 +240,7 @@ int RootInlineBox::verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallb } GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty, - const RenderObject::PaintInfo* paintInfo) + const PaintInfo* paintInfo) { RenderObject::SelectionState lineState = selectionState(); diff --git a/WebCore/rendering/RootInlineBox.h b/WebCore/rendering/RootInlineBox.h index fa2510a..86f633d 100644 --- a/WebCore/rendering/RootInlineBox.h +++ b/WebCore/rendering/RootInlineBox.h @@ -87,17 +87,17 @@ public: EllipsisBox* ellipsisBox() const; - void paintEllipsisBox(RenderObject::PaintInfo&, int tx, int ty) const; + void paintEllipsisBox(PaintInfo&, int tx, int ty) const; bool hitTestEllipsisBox(HitTestResult&, int x, int y, int tx, int ty, HitTestAction, bool); virtual void clearTruncation(); #if PLATFORM(MAC) void addHighlightOverflow(); - void paintCustomHighlight(RenderObject::PaintInfo&, int tx, int ty, const AtomicString& highlightType); + void paintCustomHighlight(PaintInfo&, int tx, int ty, const AtomicString& highlightType); #endif - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paint(PaintInfo&, int tx, int ty); virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int); bool hasSelectedChildren() const { return m_hasSelectedChildren; } @@ -108,7 +108,7 @@ public: InlineBox* lastSelectedBox(); GapRects fillLineSelectionGap(int selTop, int selHeight, RenderBlock* rootBlock, int blockX, int blockY, - int tx, int ty, const RenderObject::PaintInfo*); + int tx, int ty, const PaintInfo*); RenderBlock* block() const; diff --git a/WebCore/rendering/SVGInlineFlowBox.cpp b/WebCore/rendering/SVGInlineFlowBox.cpp index 1cd938a..4008938 100644 --- a/WebCore/rendering/SVGInlineFlowBox.cpp +++ b/WebCore/rendering/SVGInlineFlowBox.cpp @@ -30,7 +30,7 @@ namespace WebCore { -void SVGInlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int, int) +void SVGInlineFlowBox::paint(PaintInfo& paintInfo, int, int) { ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); ASSERT(!paintInfo.context->paintingDisabled()); @@ -38,18 +38,15 @@ void SVGInlineFlowBox::paint(RenderObject::PaintInfo& paintInfo, int, int) RenderObject* boxRenderer = renderer(); ASSERT(boxRenderer); - RenderObject::PaintInfo childPaintInfo(paintInfo); + PaintInfo childPaintInfo(paintInfo); childPaintInfo.context->save(); - RenderSVGResourceFilter* filter = 0; - FloatRect repaintRect = boxRenderer->repaintRectInLocalCoordinates(); - - if (SVGRenderBase::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) { + if (SVGRenderSupport::prepareToRenderSVGContent(boxRenderer, childPaintInfo)) { for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) child->paint(childPaintInfo, 0, 0); } - SVGRenderBase::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context); + SVGRenderSupport::finishRenderSVGContent(boxRenderer, childPaintInfo, paintInfo.context); childPaintInfo.context->restore(); } diff --git a/WebCore/rendering/SVGInlineFlowBox.h b/WebCore/rendering/SVGInlineFlowBox.h index ba4c5b2..ab26297 100644 --- a/WebCore/rendering/SVGInlineFlowBox.h +++ b/WebCore/rendering/SVGInlineFlowBox.h @@ -40,7 +40,7 @@ public: virtual int virtualHeight() const { return m_height; } void setHeight(int h) { m_height = h; } - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paint(PaintInfo&, int tx, int ty); virtual IntRect calculateBoundaries() const; void layoutFlowBox(); diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp index 68b4fd0..8e498ad 100644 --- a/WebCore/rendering/SVGInlineTextBox.cpp +++ b/WebCore/rendering/SVGInlineTextBox.cpp @@ -124,8 +124,9 @@ int SVGInlineTextBox::offsetForPosition(int xCoordinate, bool includePartialGlyp m_currentChunkPart = SVGTextChunkPart(); // Eventually handle lengthAdjust="spacingAndGlyphs". + // FIXME: Need to revisit the whole offsetForPosition concept for vertical text selection. if (!m_chunkTransformation.isIdentity()) - textRun.setGlyphScale(narrowPrecisionToFloat(isVerticalWritingMode(style->svgStyle()) ? m_chunkTransformation.d() : m_chunkTransformation.a())); + textRun.setHorizontalGlyphStretch(narrowPrecisionToFloat(m_chunkTransformation.a())); return hitPart.offset + style->font().offsetForPosition(textRun, x, includePartialGlyphs); } @@ -189,9 +190,9 @@ IntRect SVGInlineTextBox::selectionRect(int, int, int startPos, int endPos) return enclosingIntRect(m_chunkTransformation.mapRect(selectionRect)); } -void SVGInlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int, int) +void SVGInlineTextBox::paint(PaintInfo& paintInfo, int, int) { - ASSERT(renderer()->shouldPaintWithinRoot(paintInfo)); + ASSERT(paintInfo.shouldPaintWithinRoot(renderer())); ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); ASSERT(truncation() == cNoTruncation); @@ -562,6 +563,35 @@ void SVGInlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint context->restore(); } +void SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* style, TextRun& textRun, int startPos, int endPos) +{ + const Font& font = style->font(); + const ShadowData* shadow = style->textShadow(); + + FloatRect shadowRect(FloatPoint(textOrigin.x(), textOrigin.y() - font.ascent()), FloatSize(m_currentChunkPart.width, m_currentChunkPart.height)); + do { + if (!prepareGraphicsContextForTextPainting(context, textRun, style)) + break; + + FloatSize extraOffset; + if (shadow) + extraOffset = applyShadowToGraphicsContext(context, shadow, shadowRect, false /* stroked */, true /* opaque */); + + font.drawText(context, textRun, textOrigin + extraOffset, startPos, endPos); + restoreGraphicsContextAfterTextPainting(context, textRun); + + if (!shadow) + break; + + if (shadow->next()) + context->restore(); + else + context->clearShadow(); + + shadow = shadow->next(); + } while (shadow); +} + void SVGInlineTextBox::paintText(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* style, RenderStyle* selectionStyle, bool hasSelection, bool paintSelectedTextOnly) { ASSERT(style); @@ -572,41 +602,24 @@ void SVGInlineTextBox::paintText(GraphicsContext* context, const FloatPoint& tex int endPos = 0; selectionStartEnd(startPos, endPos); - const Font& font = style->font(); - TextRun textRun(constructTextRun(style)); - // Fast path if there is no selection, just draw the whole chunk part using the regular style + TextRun textRun(constructTextRun(style)); if (!hasSelection || startPos >= endPos) { - if (prepareGraphicsContextForTextPainting(context, textRun, style)) { - font.drawText(context, textRun, textOrigin, 0, m_currentChunkPart.length); - restoreGraphicsContextAfterTextPainting(context, textRun); - } - + paintTextWithShadows(context, textOrigin, style, textRun, 0, m_currentChunkPart.length); return; } // Eventually draw text using regular style until the start position of the selection - if (startPos > 0 && !paintSelectedTextOnly) { - if (prepareGraphicsContextForTextPainting(context, textRun, style)) { - font.drawText(context, textRun, textOrigin, 0, startPos); - restoreGraphicsContextAfterTextPainting(context, textRun); - } - } + if (startPos > 0 && !paintSelectedTextOnly) + paintTextWithShadows(context, textOrigin, style, textRun, 0, startPos); // Draw text using selection style from the start to the end position of the selection TextRun selectionTextRun(constructTextRun(selectionStyle)); - if (prepareGraphicsContextForTextPainting(context, selectionTextRun, selectionStyle)) { - selectionStyle->font().drawText(context, selectionTextRun, textOrigin, startPos, endPos); - restoreGraphicsContextAfterTextPainting(context, selectionTextRun); - } + paintTextWithShadows(context, textOrigin, selectionStyle, textRun, startPos, endPos); // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part - if (endPos < m_currentChunkPart.length && !paintSelectedTextOnly) { - if (prepareGraphicsContextForTextPainting(context, textRun, style)) { - font.drawText(context, textRun, textOrigin, endPos, m_currentChunkPart.length); - restoreGraphicsContextAfterTextPainting(context, textRun); - } - } + if (endPos < m_currentChunkPart.length && !paintSelectedTextOnly) + paintTextWithShadows(context, textOrigin, style, textRun, endPos, m_currentChunkPart.length); } void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGLastGlyphInfo& lastGlyph) diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h index 704b1f5..602fff1 100644 --- a/WebCore/rendering/SVGInlineTextBox.h +++ b/WebCore/rendering/SVGInlineTextBox.h @@ -50,7 +50,7 @@ public: virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const; virtual int positionForOffset(int offset) const; - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paint(PaintInfo&, int tx, int ty); virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos); virtual void selectionStartEnd(int& startPos, int& endPos); @@ -86,6 +86,7 @@ private: void paintDecorationWithStyle(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, ETextDecoration); void paintSelection(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*); void paintText(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, RenderStyle* selectionStyle, bool hasSelection, bool paintSelectedTextOnly); + void paintTextWithShadows(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, TextRun&, int startPos, int endPos); FloatRect selectionRectForTextChunkPart(const SVGTextChunkPart&, int partStartPos, int partEndPos, RenderStyle*); diff --git a/WebCore/rendering/SVGMarkerLayoutInfo.cpp b/WebCore/rendering/SVGMarkerLayoutInfo.cpp index b771cf8..aed756a 100644 --- a/WebCore/rendering/SVGMarkerLayoutInfo.cpp +++ b/WebCore/rendering/SVGMarkerLayoutInfo.cpp @@ -98,7 +98,7 @@ FloatRect SVGMarkerLayoutInfo::calculateBoundaries(RenderSVGResourceMarker* star return bounds; } -void SVGMarkerLayoutInfo::drawMarkers(RenderObject::PaintInfo& paintInfo) +void SVGMarkerLayoutInfo::drawMarkers(PaintInfo& paintInfo) { if (m_layout.isEmpty()) return; diff --git a/WebCore/rendering/SVGMarkerLayoutInfo.h b/WebCore/rendering/SVGMarkerLayoutInfo.h index 6011a2d..8f59703 100644 --- a/WebCore/rendering/SVGMarkerLayoutInfo.h +++ b/WebCore/rendering/SVGMarkerLayoutInfo.h @@ -48,7 +48,7 @@ public: ~SVGMarkerLayoutInfo(); FloatRect calculateBoundaries(RenderSVGResourceMarker* startMarker, RenderSVGResourceMarker* midMarker, RenderSVGResourceMarker* endMarker, float strokeWidth, const Path&); - void drawMarkers(RenderObject::PaintInfo&); + void drawMarkers(PaintInfo&); // Used by static inline helper functions in SVGMarkerLayoutInfo.cpp SVGMarkerData& markerData() { return m_markerData; } diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index 7a426f2..a328031 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -28,31 +28,23 @@ #if ENABLE(SVG) #include "SVGRenderSupport.h" -#include "AffineTransform.h" -#include "Document.h" +#include "FrameView.h" #include "ImageBuffer.h" #include "NodeRenderStyle.h" #include "RenderLayer.h" -#include "RenderObject.h" #include "RenderSVGContainer.h" #include "RenderSVGResource.h" #include "RenderSVGResourceClipper.h" #include "RenderSVGResourceFilter.h" #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" -#include "RenderView.h" #include "SVGStyledElement.h" -#include "SVGURIReference.h" #include "TransformState.h" #include <wtf/UnusedParam.h> namespace WebCore { -SVGRenderBase::~SVGRenderBase() -{ -} - -IntRect SVGRenderBase::clippedOverflowRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer) +IntRect SVGRenderSupport::clippedOverflowRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer) { // Return early for any cases where we don't actually paint if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->hasVisibleContent()) @@ -65,7 +57,7 @@ IntRect SVGRenderBase::clippedOverflowRectForRepaint(RenderObject* object, Rende return repaintRect; } -void SVGRenderBase::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) +void SVGRenderSupport::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { object->style()->svgStyle()->inflateForShadow(repaintRect); @@ -74,7 +66,7 @@ void SVGRenderBase::computeRectForRepaint(RenderObject* object, RenderBoxModelOb object->parent()->computeRectForRepaint(repaintContainer, repaintRect, fixed); } -void SVGRenderBase::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) +void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, bool fixed , bool useTransforms, TransformState& transformState) { ASSERT(!fixed); // We should have no fixed content in the SVG rendering tree. ASSERT(useTransforms); // Mapping a point through SVG w/o respecting transforms is useless. @@ -82,12 +74,8 @@ void SVGRenderBase::mapLocalToContainer(const RenderObject* object, RenderBoxMod object->parent()->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState); } -bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, const FloatRect& repaintRect, RenderSVGResourceFilter*& filter) +bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo) { -#if !ENABLE(FILTERS) - UNUSED_PARAM(filter); -#endif - ASSERT(object); SVGElement* svgElement = static_cast<SVGElement*>(object->node()); ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); @@ -99,17 +87,24 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject const SVGRenderStyle* svgStyle = style->svgStyle(); ASSERT(svgStyle); + FloatRect repaintRect; + // Setup transparency layers before setting up SVG resources! - float opacity = style->opacity(); - if (opacity < 1.0f) { + float opacity = style->opacity(); + if (opacity < 1) { + repaintRect = object->repaintRectInLocalCoordinates(); paintInfo.context->clip(repaintRect); paintInfo.context->beginTransparencyLayer(opacity); } if (const ShadowData* shadow = svgStyle->shadow()) { + // Eventually compute repaint rect, if not done so far. + if (opacity >= 1) + repaintRect = object->repaintRectInLocalCoordinates(); + paintInfo.context->clip(repaintRect); paintInfo.context->setShadow(IntSize(shadow->x(), shadow->y()), shadow->blur(), shadow->color(), style->colorSpace()); - paintInfo.context->beginTransparencyLayer(1.0f); + paintInfo.context->beginTransparencyLayer(1); } Document* document = object->document(); @@ -120,7 +115,7 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) return false; } else - svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement); + document->accessSVGExtensions()->addPendingResource(maskerId, styledElement); } if (svgStyle->hasClipper()) { @@ -128,28 +123,26 @@ bool SVGRenderBase::prepareToRenderSVGContent(RenderObject* object, RenderObject if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, clipperId)) clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); else - svgElement->document()->accessSVGExtensions()->addPendingResource(clipperId, styledElement); + document->accessSVGExtensions()->addPendingResource(clipperId, styledElement); } #if ENABLE(FILTERS) if (svgStyle->hasFilter()) { AtomicString filterId(svgStyle->filterResource()); - filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, filterId); - if (filter) { + if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, filterId)) { if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) return false; } else - svgElement->document()->accessSVGExtensions()->addPendingResource(filterId, styledElement); + document->accessSVGExtensions()->addPendingResource(filterId, styledElement); } #endif return true; } -void SVGRenderBase::finishRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& paintInfo, RenderSVGResourceFilter*& filter, GraphicsContext* savedContext) +void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& paintInfo, GraphicsContext* savedContext) { #if !ENABLE(FILTERS) - UNUSED_PARAM(filter); UNUSED_PARAM(savedContext); #endif @@ -158,24 +151,30 @@ void SVGRenderBase::finishRenderSVGContent(RenderObject* object, RenderObject::P const RenderStyle* style = object->style(); ASSERT(style); + const SVGRenderStyle* svgStyle = style->svgStyle(); + ASSERT(svgStyle); + #if ENABLE(FILTERS) - if (filter) { - filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode); - paintInfo.context = savedContext; + if (svgStyle->hasFilter()) { + AtomicString filterId(svgStyle->filterResource()); + if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), filterId)) { + filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode); + paintInfo.context = savedContext; + } } #endif float opacity = style->opacity(); - if (opacity < 1.0f) + if (opacity < 1) paintInfo.context->endTransparencyLayer(); // This needs to be done separately from opacity, because if both properties are set, // then the transparency layers are nested. - if (style->svgStyle()->shadow()) + if (svgStyle->shadow()) paintInfo.context->endTransparencyLayer(); } -void renderSubtreeToImage(ImageBuffer* image, RenderObject* item) +void SVGRenderSupport::renderSubtreeToImage(ImageBuffer* image, RenderObject* item) { ASSERT(item); ASSERT(image); @@ -187,7 +186,7 @@ void renderSubtreeToImage(ImageBuffer* image, RenderObject* item) FrameView* frameView = item->document()->view(); if (frameView) rect = IntRect(0, 0, frameView->visibleWidth(), frameView->visibleHeight()); - RenderObject::PaintInfo info(image->context(), rect, PaintPhaseForeground, 0, 0, 0); + PaintInfo info(image->context(), rect, PaintPhaseForeground, 0, 0, 0); // FIXME: isSVGContainer returns true for RenderSVGViewportContainer, so if this is ever // called with one of those, we will read from the wrong offset in an object due to a bad cast. @@ -206,36 +205,32 @@ void renderSubtreeToImage(ImageBuffer* image, RenderObject* item) svgContainer->setDrawsContents(false); } -void clampImageBufferSizeToViewport(FrameView* frameView, IntSize& size) -{ - if (!frameView) - return; - - int viewWidth = frameView->visibleWidth(); - int viewHeight = frameView->visibleHeight(); - - if (size.width() > viewWidth) - size.setWidth(viewWidth); - - if (size.height() > viewHeight) - size.setHeight(viewHeight); -} - -FloatRect SVGRenderBase::computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent) +FloatRect SVGRenderSupport::computeContainerBoundingBox(const RenderObject* container, ContainerBoundingBoxMode mode) { FloatRect boundingBox; - RenderObject* current = container->firstChild(); - for (; current != 0; current = current->nextSibling()) { - FloatRect childBBox = includeAllPaintedContent ? current->repaintRectInLocalCoordinates() : current->objectBoundingBox(); - FloatRect childBBoxInLocalCoords = current->localToParentTransform().mapRect(childBBox); - boundingBox.unite(childBBoxInLocalCoords); + for (RenderObject* current = container->firstChild(); current; current = current->nextSibling()) { + FloatRect childBoundingBox; + + switch (mode) { + case ObjectBoundingBox: + childBoundingBox = current->objectBoundingBox(); + break; + case StrokeBoundingBox: + childBoundingBox = current->strokeBoundingBox(); + break; + case RepaintBoundingBox: + childBoundingBox = current->repaintRectInLocalCoordinates(); + break; + } + + boundingBox.unite(current->localToParentTransform().mapRect(childBoundingBox)); } return boundingBox; } -void SVGRenderBase::layoutChildren(RenderObject* start, bool selfNeedsLayout) +void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout) { for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { // Only force our kids to layout if we're being asked to relayout as a result of a parent changing @@ -246,7 +241,7 @@ void SVGRenderBase::layoutChildren(RenderObject* start, bool selfNeedsLayout) if (!needsLayout) { if (SVGElement* element = child->node()->isSVGElement() ? static_cast<SVGElement*>(child->node()) : 0) { if (element->isStyled()) - needsLayout = static_cast<SVGStyledElement*>(element)->hasRelativeValues(); + needsLayout = static_cast<SVGStyledElement*>(element)->hasRelativeLengths(); } } @@ -258,7 +253,7 @@ void SVGRenderBase::layoutChildren(RenderObject* start, bool selfNeedsLayout) } } -bool SVGRenderBase::isOverflowHidden(const RenderObject* object) +bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) { // SVG doesn't support independent x/y overflow ASSERT(object->style()->overflowX() == object->style()->overflowY()); @@ -272,7 +267,7 @@ bool SVGRenderBase::isOverflowHidden(const RenderObject* object) return object->style()->overflowX() == OHIDDEN; } -void SVGRenderBase::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect) const +void SVGRenderSupport::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect) { ASSERT(object); ASSERT(object->style()); @@ -301,20 +296,7 @@ void SVGRenderBase::intersectRepaintRectWithResources(const RenderObject* object svgStyle->inflateForShadow(repaintRect); } -static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object) -{ - ASSERT(paint); - - SVGPaint::SVGPaintType paintType = paint->paintType(); - if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) - return; - - AtomicString id(SVGURIReference::getTarget(paint->uri())); - if (RenderSVGResourceContainer* paintingResource = getRenderSVGResourceContainerById(object->document(), id)) - paintingResource->invalidateClient(object); -} - -bool pointInClippingArea(const RenderObject* object, const FloatPoint& point) +bool SVGRenderSupport::pointInClippingArea(const RenderObject* object, const FloatPoint& point) { ASSERT(object); ASSERT(object->style()); @@ -335,76 +317,28 @@ bool pointInClippingArea(const RenderObject* object, const FloatPoint& point) return true; } -void deregisterFromResources(RenderObject* object) -{ - ASSERT(object); - ASSERT(object->style()); - - Document* document = object->document(); - ASSERT(document); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - ASSERT(svgStyle); - - // Masker - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskerResource())) - masker->invalidateClient(object); - - // Clipper - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) - clipper->invalidateClient(object); - - // Filter -#if ENABLE(FILTERS) - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, svgStyle->filterResource())) - filter->invalidateClient(object); -#endif - - // Markers - if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerStartResource())) - startMarker->invalidateClient(object); - if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerMidResource())) - midMarker->invalidateClient(object); - if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerEndResource())) - endMarker->invalidateClient(object); - - // Gradients/Patterns - if (svgStyle->hasFill()) - invalidatePaintingResource(svgStyle->fillPaint(), object); - if (svgStyle->hasStroke()) - invalidatePaintingResource(svgStyle->strokePaint(), object); -} - -void applyTransformToPaintInfo(RenderObject::PaintInfo& paintInfo, const AffineTransform& localToAncestorTransform) -{ - if (localToAncestorTransform.isIdentity()) - return; - - paintInfo.context->concatCTM(localToAncestorTransform); - paintInfo.rect = localToAncestorTransform.inverse().mapRect(paintInfo.rect); -} - -DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle) +DashArray SVGRenderSupport::dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle) { DashArray array; CSSValueList* dashes = style->svgStyle()->strokeDashArray(); - if (dashes) { - CSSPrimitiveValue* dash = 0; - unsigned long len = dashes->length(); - for (unsigned long i = 0; i < len; i++) { - dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i)); - if (!dash) - continue; - - array.append((float) dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle)); - } + if (!dashes) + return array; + + CSSPrimitiveValue* dash = 0; + unsigned long len = dashes->length(); + for (unsigned long i = 0; i < len; ++i) { + dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i)); + if (!dash) + continue; + + array.append(dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle)); } return array; } -void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object) +void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object) { context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f)); context->setLineCap(style->svgStyle()->capStyle()); @@ -420,7 +354,7 @@ void applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* styl context->setLineDash(dashes, dashOffset); } -const RenderObject* findTextRootObject(const RenderObject* start) +const RenderObject* SVGRenderSupport::findTextRootObject(const RenderObject* start) { while (start && !start->isSVGText()) start = start->parent(); diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h index dce8b8f..8eb486e6 100644 --- a/WebCore/rendering/SVGRenderSupport.h +++ b/WebCore/rendering/SVGRenderSupport.h @@ -3,6 +3,7 @@ * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> * (C) 2007 Eric Seidel <eric@webkit.org> * Copyright (C) 2009 Google, Inc. All rights reserved. + * Copyright (C) Research In Motion Limited 2010. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,68 +27,69 @@ #if ENABLE(SVG) #include "DashArray.h" -#include "RenderObject.h" -#include "SVGElement.h" -#include "SVGStyledElement.h" +#include "PaintInfo.h" namespace WebCore { -class RenderSVGResourceFilter; +class FloatPoint; +class FloatRect; class ImageBuffer; +class RenderBoxModelObject; +class RenderObject; +class RenderStyle; +class TransformState; -// SVGRendererBase is an abstract base class which all SVG renderers inherit -// from in order to share SVG renderer code. -// FIXME: This code can all move into RenderSVGModelObject once -// all SVG renderers inherit from RenderSVGModelObject. -class SVGRenderBase { +// SVGRendererSupport is a helper class sharing code between all SVG renderers. +class SVGRenderSupport { public: - virtual ~SVGRenderBase(); + // Used by all SVG renderers who apply clip/filter/etc. resources to the renderer content + static bool prepareToRenderSVGContent(RenderObject*, PaintInfo&); + static void finishRenderSVGContent(RenderObject*, PaintInfo&, GraphicsContext* savedContext); - // FIXME: These are only public for SVGRootInlineBox. - // It's unclear if these should be exposed or not. SVGRootInlineBox may - // pass the wrong RenderObject* and boundingBox to these functions. - static bool prepareToRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, RenderSVGResourceFilter*&); - static void finishRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, RenderSVGResourceFilter*&, GraphicsContext* savedContext); - - // Layout all children of the passed render object + // Shares child layouting code between RenderSVGRoot/RenderSVG(Hidden)Container static void layoutChildren(RenderObject*, bool selfNeedsLayout); // Helper function determining wheter overflow is hidden static bool isOverflowHidden(const RenderObject*); // Calculates the repaintRect in combination with filter, clipper and masker in local coordinates. - void intersectRepaintRectWithResources(const RenderObject*, FloatRect&) const; + static void intersectRepaintRectWithResources(const RenderObject*, FloatRect&); -protected: - static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer); - static void computeRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer, IntRect&, bool fixed); + // Determines whether the passed point lies in a clipping area + static bool pointInClippingArea(const RenderObject*, const FloatPoint&); - static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&); + enum ContainerBoundingBoxMode { + ObjectBoundingBox, + StrokeBoundingBox, + RepaintBoundingBox + }; // Used to share the "walk all the children" logic between objectBoundingBox // and repaintRectInLocalCoordinates in RenderSVGRoot and RenderSVGContainer - static FloatRect computeContainerBoundingBox(const RenderObject* container, bool includeAllPaintedContent); -}; - -// FIXME: This should move to RenderObject or PaintInfo -// Used for transforming the GraphicsContext and damage rect before passing PaintInfo to child renderers. -void applyTransformToPaintInfo(RenderObject::PaintInfo&, const AffineTransform& localToChildTransform); + static FloatRect computeContainerBoundingBox(const RenderObject* container, ContainerBoundingBoxMode); -// This offers a way to render parts of a WebKit rendering tree into a ImageBuffer. -void renderSubtreeToImage(ImageBuffer*, RenderObject*); + // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations + static IntRect clippedOverflowRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer); + static void computeRectForRepaint(RenderObject*, RenderBoxModelObject* repaintContainer, IntRect&, bool fixed); + static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&); -bool pointInClippingArea(const RenderObject*, const FloatPoint&); + // This offers a way to render parts of a WebKit rendering tree into a ImageBuffer. + static void renderSubtreeToImage(ImageBuffer*, RenderObject*); -void deregisterFromResources(RenderObject*); -void clampImageBufferSizeToViewport(FrameView*, IntSize& imageBufferSize); + // Shared between SVG renderers and resources. + static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*); -void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*); -DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle); + // FIXME: These methods do not belong here. + static const RenderObject* findTextRootObject(const RenderObject* start); + static DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle); -const RenderObject* findTextRootObject(const RenderObject* start); +private: + // This class is not constructable. + SVGRenderSupport(); + ~SVGRenderSupport(); +}; } // namespace WebCore #endif // ENABLE(SVG) - #endif // SVGRenderSupport_h diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index e110ce6..bec78e7 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -372,7 +372,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object) writeSVGPaintingResource(ts, strokePaintingResource); double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0f); - const DashArray& dashArray = dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle()); + const DashArray& dashArray = SVGRenderSupport::dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle()); double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0f); writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f); diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp index 8fd71ea..6afdd99 100644 --- a/WebCore/rendering/SVGRootInlineBox.cpp +++ b/WebCore/rendering/SVGRootInlineBox.cpp @@ -27,7 +27,6 @@ #if ENABLE(SVG) #include "GraphicsContext.h" #include "RenderBlock.h" -#include "RenderSVGResourceFilter.h" #include "SVGInlineFlowBox.h" #include "SVGInlineTextBox.h" #include "SVGRenderSupport.h" @@ -39,7 +38,7 @@ namespace WebCore { -void SVGRootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int, int) +void SVGRootInlineBox::paint(PaintInfo& paintInfo, int, int) { ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection); ASSERT(!paintInfo.context->paintingDisabled()); @@ -47,18 +46,15 @@ void SVGRootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int, int) RenderObject* boxRenderer = renderer(); ASSERT(boxRenderer); - RenderObject::PaintInfo childPaintInfo(paintInfo); + PaintInfo childPaintInfo(paintInfo); childPaintInfo.context->save(); - FloatRect repaintRect = boxRenderer->repaintRectInLocalCoordinates(); - - RenderSVGResourceFilter* filter = 0; - if (SVGRenderBase::prepareToRenderSVGContent(boxRenderer, childPaintInfo, repaintRect, filter)) { + if (SVGRenderSupport::prepareToRenderSVGContent(boxRenderer, childPaintInfo)) { for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) child->paint(childPaintInfo, 0, 0); } - SVGRenderBase::finishRenderSVGContent(boxRenderer, childPaintInfo, filter, paintInfo.context); + SVGRenderSupport::finishRenderSVGContent(boxRenderer, childPaintInfo, paintInfo.context); childPaintInfo.context->restore(); } diff --git a/WebCore/rendering/SVGRootInlineBox.h b/WebCore/rendering/SVGRootInlineBox.h index 75e85fd..4e61190 100644 --- a/WebCore/rendering/SVGRootInlineBox.h +++ b/WebCore/rendering/SVGRootInlineBox.h @@ -35,8 +35,7 @@ namespace WebCore { class SVGInlineTextBox; -class SVGRootInlineBox : public RootInlineBox - , protected SVGRenderBase { +class SVGRootInlineBox : public RootInlineBox { public: SVGRootInlineBox(RenderObject* obj) : RootInlineBox(obj) @@ -49,7 +48,7 @@ public: virtual int virtualHeight() const { return m_height; } void setHeight(int height) { m_height = height; } - virtual void paint(RenderObject::PaintInfo&, int tx, int ty); + virtual void paint(PaintInfo&, int tx, int ty); void computePerCharacterLayoutInformation(); diff --git a/WebCore/rendering/ShadowElement.cpp b/WebCore/rendering/ShadowElement.cpp index 62b37e1..55a4b5c 100644 --- a/WebCore/rendering/ShadowElement.cpp +++ b/WebCore/rendering/ShadowElement.cpp @@ -31,7 +31,7 @@ using namespace HTMLNames; PassRefPtr<ShadowBlockElement> ShadowBlockElement::create(Node* shadowParent) { - return new ShadowBlockElement(shadowParent); + return adoptRef(new ShadowBlockElement(shadowParent)); } ShadowBlockElement::ShadowBlockElement(Node* shadowParent) @@ -105,7 +105,7 @@ bool ShadowBlockElement::partShouldHaveStyle(const RenderObject* parentRenderer, PassRefPtr<ShadowInputElement> ShadowInputElement::create(Node* shadowParent) { - return new ShadowInputElement(shadowParent); + return adoptRef(new ShadowInputElement(shadowParent)); } ShadowInputElement::ShadowInputElement(Node* shadowParent) diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp index 61c85e7..36e30af 100644 --- a/WebCore/rendering/TextControlInnerElements.cpp +++ b/WebCore/rendering/TextControlInnerElements.cpp @@ -111,7 +111,7 @@ void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<Render // For elements without a shadow parent, add the node to the DOM normally. if (!m_shadowParent) - parent->addChild(this); + parent->legacyParserAddChild(this); // Add the renderer to the render tree if (renderer) diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index 40f7a27..a386fc6 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -299,11 +299,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon changedContextSensitiveProperties = ContextSensitivePropertyNone; #if ENABLE(SVG) - // This is horribly inefficient. Eventually we'll have to integrate - // this more directly by calling: Diff svgDiff = svgStyle->diff(other) - // and then checking svgDiff and returning from the appropriate places below. if (m_svgStyle != other->m_svgStyle) - return StyleDifferenceLayout; + return m_svgStyle->diff(other->m_svgStyle.get()); #endif if (m_box->width() != other->m_box->width() || @@ -739,14 +736,8 @@ void RenderStyle::setBoxShadow(ShadowData* shadowData, bool add) rareData->m_boxShadow.set(shadowData); } -void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const +static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) { - topLeft = surround->border.topLeft(); - topRight = surround->border.topRight(); - - bottomLeft = surround->border.bottomLeft(); - bottomRight = surround->border.bottomRight(); - // Constrain corner radii using CSS3 rules: // http://www.w3.org/TR/css3-background/#the-border-radius @@ -791,6 +782,39 @@ void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntS } } +void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const +{ + topLeft = surround->border.topLeft(); + topRight = surround->border.topRight(); + + bottomLeft = surround->border.bottomLeft(); + bottomRight = surround->border.bottomRight(); + + constrainCornerRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); +} + +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 +{ + innerTopLeft = surround->border.topLeft(); + innerTopRight = surround->border.topRight(); + innerBottomLeft = surround->border.bottomLeft(); + innerBottomRight = surround->border.bottomRight(); + + 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); +} + const CounterDirectiveMap* RenderStyle::counterDirectives() const { return rareNonInheritedData->m_counterDirectives.get(); diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index 2914fcf..748842b 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -704,6 +704,7 @@ public: Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; } Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; } LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; } + PageSizeType pageSizeType() const { return rareNonInheritedData->m_pageSizeType; } #if USE(ACCELERATED_COMPOSITING) // When set, this ensures that styles compare as different. Used during accelerated animations. @@ -794,6 +795,10 @@ public: } 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; 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) } @@ -1035,6 +1040,8 @@ public: void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); } void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); } void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); } + void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); } + void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); } #if USE(ACCELERATED_COMPOSITING) void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); } diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp index f4e6cb5..93e50cc 100644 --- a/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/WebCore/rendering/style/SVGRenderStyle.cpp @@ -126,6 +126,90 @@ void SVGRenderStyle::inheritFrom(const SVGRenderStyle* svgInheritParent) svg_inherited_flags = svgInheritParent->svg_inherited_flags; } +StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const +{ + // NOTE: All comparisions that may return StyleDifferenceLayout have to go before those who return StyleDifferenceRepaint + + // If kerning changes, we need a relayout, to force SVGCharacterData to be recalculated in the SVGRootInlineBox. + if (text != other->text) + return StyleDifferenceLayout; + + // If resources change, we need a relayout, as the presence of resources influences the repaint rect. + if (resources != other->resources) + return StyleDifferenceLayout; + + // If markers change, we need a relayout, as marker boundaries are cached in RenderPath. + if (inheritedResources != other->inheritedResources) + return StyleDifferenceLayout; + + // All text related properties influence layout. + if (svg_inherited_flags._textAnchor != other->svg_inherited_flags._textAnchor + || svg_inherited_flags._writingMode != other->svg_inherited_flags._writingMode + || svg_inherited_flags._glyphOrientationHorizontal != other->svg_inherited_flags._glyphOrientationHorizontal + || svg_inherited_flags._glyphOrientationVertical != other->svg_inherited_flags._glyphOrientationVertical + || svg_noninherited_flags.f._alignmentBaseline != other->svg_noninherited_flags.f._alignmentBaseline + || svg_noninherited_flags.f._dominantBaseline != other->svg_noninherited_flags.f._dominantBaseline + || svg_noninherited_flags.f._baselineShift != other->svg_noninherited_flags.f._baselineShift) + return StyleDifferenceLayout; + + // Text related properties influence layout. + bool miscNotEqual = misc != other->misc; + if (miscNotEqual && misc->baselineShiftValue != other->misc->baselineShiftValue) + return StyleDifferenceLayout; + + // These properties affect the cached stroke bounding box rects. + if (svg_inherited_flags._capStyle != other->svg_inherited_flags._capStyle + || svg_inherited_flags._joinStyle != other->svg_inherited_flags._joinStyle) + return StyleDifferenceLayout; + + // Some stroke properties, requires relayouts, as the cached stroke boundaries need to be recalculated. + if (stroke != other->stroke) { + if (stroke->width != other->stroke->width + || stroke->miterLimit != other->stroke->miterLimit + || stroke->dashArray != other->stroke->dashArray + || stroke->dashOffset != other->stroke->dashOffset) + return StyleDifferenceLayout; + + // Only these two cases remain, where we only need a repaint. + ASSERT(stroke->paint != other->stroke->paint || stroke->opacity != other->stroke->opacity); + return StyleDifferenceRepaint; + } + + // NOTE: All comparisions below may only return StyleDifferenceRepaint + + // Painting related properties only need repaints. + if (miscNotEqual) { + if (misc->floodColor != other->misc->floodColor + || misc->floodOpacity != other->misc->floodOpacity + || misc->lightingColor != other->misc->lightingColor) + return StyleDifferenceRepaint; + } + + // If fill changes, we just need to repaint. Fill boundaries are not influenced by this, only by the Path, that RenderPath contains. + if (fill != other->fill) + return StyleDifferenceRepaint; + + // If gradient stops change, we just need to repaint. Style updates are already handled through RenderSVGGradientSTop. + if (stops != other->stops) + return StyleDifferenceRepaint; + + // Changes of these flags only cause repaints. + if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._colorRendering + || svg_inherited_flags._imageRendering != other->svg_inherited_flags._imageRendering + || svg_inherited_flags._shapeRendering != other->svg_inherited_flags._shapeRendering + || svg_inherited_flags._clipRule != other->svg_inherited_flags._clipRule + || svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule + || svg_inherited_flags._colorInterpolation != other->svg_inherited_flags._colorInterpolation + || svg_inherited_flags._colorInterpolationFilters != other->svg_inherited_flags._colorInterpolationFilters) + return StyleDifferenceRepaint; + + // FIXME: vector-effect is not taken into account in the layout-phase. Once this is fixed, we should relayout here. + if (svg_noninherited_flags.f._vectorEffect != other->svg_noninherited_flags.f._vectorEffect) + return StyleDifferenceRepaint; + + return StyleDifferenceEqual; +} + float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* value, float defaultValue) { CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(value); diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index b0bef61..c87dd2b 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -28,6 +28,7 @@ #include "DataRef.h" #include "GraphicsTypes.h" #include "Path.h" +#include "RenderStyleConstants.h" #include "SVGPaint.h" #include "SVGRenderStyleDefs.h" @@ -36,7 +37,6 @@ namespace WebCore { class FloatRect; class IntRect; class RenderObject; -class RenderStyle; class SVGRenderStyle : public RefCounted<SVGRenderStyle> { public: @@ -50,7 +50,9 @@ public: // FIXME: These functions should move to ShadowData. void inflateForShadow(IntRect&) const; void inflateForShadow(FloatRect&) const; - + + StyleDifference diff(const SVGRenderStyle*) const; + bool operator==(const SVGRenderStyle&) const; bool operator!=(const SVGRenderStyle& o) const { return !(*this == o); } diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/WebCore/rendering/style/StyleRareNonInheritedData.cpp index e3367d1..d5c9536 100644 --- a/WebCore/rendering/style/StyleRareNonInheritedData.cpp +++ b/WebCore/rendering/style/StyleRareNonInheritedData.cpp @@ -59,6 +59,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData() #if ENABLE(XBL) , bindingURI(0) #endif + , m_pageSize() + , m_pageSizeType(PAGE_SIZE_AUTO) { } @@ -98,6 +100,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited #if ENABLE(XBL) , bindingURI(o.bindingURI ? o.bindingURI->copy() : 0) #endif + , m_pageSize(o.m_pageSize) + , m_pageSizeType(o.m_pageSizeType) { } @@ -156,6 +160,8 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c && (m_perspective == o.m_perspective) && (m_perspectiveOriginX == o.m_perspectiveOriginX) && (m_perspectiveOriginY == o.m_perspectiveOriginY) + && (m_pageSize == o.m_pageSize) + && (m_pageSizeType == o.m_pageSizeType) ; } diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.h b/WebCore/rendering/style/StyleRareNonInheritedData.h index 74e736c..1025d81 100644 --- a/WebCore/rendering/style/StyleRareNonInheritedData.h +++ b/WebCore/rendering/style/StyleRareNonInheritedData.h @@ -40,7 +40,6 @@ namespace WebCore { class AnimationList; class CSSStyleSelector; -class LengthSize; class ShadowData; class StyleFlexibleBoxData; class StyleMarqueeData; @@ -49,6 +48,7 @@ class StyleReflection; class StyleTransformData; struct ContentData; +struct LengthSize; #if ENABLE(DASHBOARD_SUPPORT) struct StyleDashboardRegion; @@ -58,6 +58,16 @@ struct StyleDashboardRegion; class BindingURI; #endif +// Page size type. +// StyleRareNonInheritedData::m_pageSize is meaningful only when +// StyleRareNonInheritedData::m_pageSizeType is PAGE_SIZE_RESOLVED. +enum PageSizeType { + PAGE_SIZE_AUTO, // size: auto + PAGE_SIZE_AUTO_LANDSCAPE, // size: landscape + PAGE_SIZE_AUTO_PORTRAIT, // size: portrait + PAGE_SIZE_RESOLVED // Size is fully resolved. +}; + // This struct is for rarely used non-inherited CSS3, CSS2, and WebKit-specific properties. // By grouping them together, we save space, and only allocate this object when someone // actually uses one of these properties. @@ -125,6 +135,7 @@ public: Length m_perspectiveOriginY; LengthSize m_pageSize; + PageSizeType m_pageSizeType; #if ENABLE(XBL) OwnPtr<BindingURI> bindingURI; // The XBL binding URI list. |