Changeset 52632 in webkit


Ignore:
Timestamp:
Dec 29, 2009 1:05:56 PM (14 years ago)
Author:
mitz@apple.com
Message:

Move the focus ring rect array, width and offset out of GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=33028

Reviewed by Sam Weinig.

  • platform/graphics/GraphicsContext.cpp: Removed initFocusRing(),

clearFocusRing(), focusRingBoundingRect(), addFocusRingRect(),
focusRingWidth(), focusRingOffset(), and focusRingRects().

  • platform/graphics/GraphicsContext.h: Ditto. Added the focus ring rect

vector, width and offset as parameters to drawFocusRing().

  • platform/graphics/GraphicsContextPrivate.h:

(WebCore::GraphicsContextState::GraphicsContextState): Cleaned up style.
(WebCore::GraphicsContextPrivate::GraphicsContextPrivate): Removed
m_focusRingRects, m_focusRingWidth and m_focusRingOffset.

  • platform/graphics/IntRect.cpp:

(WebCore::unionRect): Added this helper function.

  • platform/graphics/IntRect.h:
  • platform/graphics/cairo/GraphicsContextCairo.cpp:

(WebCore::GraphicsContext::drawFocusRing):

  • platform/graphics/haiku/GraphicsContextHaiku.cpp:

(WebCore::GraphicsContext::drawFocusRing): Ditto.

  • platform/graphics/mac/GraphicsContextMac.mm:

(WebCore::GraphicsContext::drawFocusRing): Ditto.

  • platform/graphics/qt/GraphicsContextQt.cpp:

(WebCore::GraphicsContext::drawFocusRing): Ditto.

  • platform/graphics/skia/GraphicsContextSkia.cpp:

(WebCore::GraphicsContext::drawFocusRing): Ditto.

  • platform/graphics/win/GraphicsContextCGWin.cpp:

(WebCore::GraphicsContext::drawFocusRing): Ditto.

  • platform/graphics/wince/GraphicsContextWince.cpp:

(WebCore::GraphicsContext::drawFocusRing): Ditto.

  • platform/graphics/wx/GraphicsContextWx.cpp:

(WebCore::GraphicsContext::drawFocusRing): Ditto.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::addFocusRingRects): Updated for new prototype.
Added empty rect checks that were previously done in
GraphicsContext::addFocusRingRect().

  • rendering/RenderBlock.h:
  • rendering/RenderBox.cpp:

(WebCore::RenderBox::addFocusRingRects): Ditto.

  • rendering/RenderBox.h:
  • rendering/RenderInline.cpp:

(WebCore::RenderInline::addFocusRingRects): Ditto.
(WebCore::RenderInline::paintOutline): Collect focus ring rects into a
vector and pass it to drawFocusRing(). Use unionRect() instead of
focusRingBoundingRect().

  • rendering/RenderInline.h:
  • rendering/RenderObject.cpp:

(WebCore::RenderObject::paintOutline): Ditto.

  • rendering/RenderObject.h:

(WebCore::RenderObject::addFocusRingRects): Changed to take a
Vector<IntRect> to which the rects are added.

  • rendering/RenderPath.cpp:

(WebCore::RenderPath::addFocusRingRects): Updated for new prototype.
Added empty rect check that was previously done in
GraphicsContext::addFocusRingRect().

  • rendering/RenderPath.h:
  • rendering/RenderSVGContainer.cpp:

(WebCore::RenderSVGContainer::addFocusRingRects): Updated for new prototype.
Added empty rect check that was previously done in
GraphicsContext::addFocusRingRect().

  • rendering/RenderSVGContainer.h:
  • rendering/RenderSVGImage.cpp:

(WebCore::RenderSVGImage::addFocusRingRects): Updated for new prototype.
Added empty rect check that was previously done in
GraphicsContext::addFocusRingRect().

  • rendering/RenderSVGImage.h:
  • rendering/RenderTextControl.cpp:

(WebCore::RenderTextControl::addFocusRingRects): Updated for new prototype.
Added empty rect check that was previously done in
GraphicsContext::addFocusRingRect().

  • rendering/RenderTextControl.h:
Location:
trunk/WebCore
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52631 r52632  
     12009-12-29  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Move the focus ring rect array, width and offset out of GraphicsContext
     6        https://bugs.webkit.org/show_bug.cgi?id=33028
     7
     8        * platform/graphics/GraphicsContext.cpp: Removed initFocusRing(),
     9        clearFocusRing(), focusRingBoundingRect(), addFocusRingRect(),
     10        focusRingWidth(), focusRingOffset(), and focusRingRects().
     11        * platform/graphics/GraphicsContext.h: Ditto. Added the focus ring rect
     12        vector, width and offset as parameters to drawFocusRing().
     13        * platform/graphics/GraphicsContextPrivate.h:
     14        (WebCore::GraphicsContextState::GraphicsContextState): Cleaned up style.
     15        (WebCore::GraphicsContextPrivate::GraphicsContextPrivate): Removed
     16        m_focusRingRects, m_focusRingWidth and m_focusRingOffset.
     17        * platform/graphics/IntRect.cpp:
     18        (WebCore::unionRect): Added this helper function.
     19        * platform/graphics/IntRect.h:
     20        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     21        (WebCore::GraphicsContext::drawFocusRing):
     22        * platform/graphics/haiku/GraphicsContextHaiku.cpp:
     23        (WebCore::GraphicsContext::drawFocusRing): Ditto.
     24        * platform/graphics/mac/GraphicsContextMac.mm:
     25        (WebCore::GraphicsContext::drawFocusRing): Ditto.
     26        * platform/graphics/qt/GraphicsContextQt.cpp:
     27        (WebCore::GraphicsContext::drawFocusRing): Ditto.
     28        * platform/graphics/skia/GraphicsContextSkia.cpp:
     29        (WebCore::GraphicsContext::drawFocusRing): Ditto.
     30        * platform/graphics/win/GraphicsContextCGWin.cpp:
     31        (WebCore::GraphicsContext::drawFocusRing): Ditto.
     32        * platform/graphics/wince/GraphicsContextWince.cpp:
     33        (WebCore::GraphicsContext::drawFocusRing): Ditto.
     34        * platform/graphics/wx/GraphicsContextWx.cpp:
     35        (WebCore::GraphicsContext::drawFocusRing): Ditto.
     36        * rendering/RenderBlock.cpp:
     37        (WebCore::RenderBlock::addFocusRingRects): Updated for new prototype.
     38        Added empty rect checks that were previously done in
     39        GraphicsContext::addFocusRingRect().
     40        * rendering/RenderBlock.h:
     41        * rendering/RenderBox.cpp:
     42        (WebCore::RenderBox::addFocusRingRects): Ditto.
     43        * rendering/RenderBox.h:
     44        * rendering/RenderInline.cpp:
     45        (WebCore::RenderInline::addFocusRingRects): Ditto.
     46        (WebCore::RenderInline::paintOutline): Collect focus ring rects into a
     47        vector and pass it to drawFocusRing(). Use unionRect() instead of
     48        focusRingBoundingRect().
     49        * rendering/RenderInline.h:
     50        * rendering/RenderObject.cpp:
     51        (WebCore::RenderObject::paintOutline): Ditto.
     52        * rendering/RenderObject.h:
     53        (WebCore::RenderObject::addFocusRingRects): Changed to take a
     54        Vector<IntRect> to which the rects are added.
     55        * rendering/RenderPath.cpp:
     56        (WebCore::RenderPath::addFocusRingRects): Updated for new prototype.
     57        Added empty rect check that was previously done in
     58        GraphicsContext::addFocusRingRect().
     59        * rendering/RenderPath.h:
     60        * rendering/RenderSVGContainer.cpp:
     61        (WebCore::RenderSVGContainer::addFocusRingRects): Updated for new prototype.
     62        Added empty rect check that was previously done in
     63        GraphicsContext::addFocusRingRect().
     64        * rendering/RenderSVGContainer.h:
     65        * rendering/RenderSVGImage.cpp:
     66        (WebCore::RenderSVGImage::addFocusRingRects): Updated for new prototype.
     67        Added empty rect check that was previously done in
     68        GraphicsContext::addFocusRingRect().
     69        * rendering/RenderSVGImage.h:
     70        * rendering/RenderTextControl.cpp:
     71        (WebCore::RenderTextControl::addFocusRingRects): Updated for new prototype.
     72        Added empty rect check that was previously done in
     73        GraphicsContext::addFocusRingRect().
     74        * rendering/RenderTextControl.h:
     75
    1762009-12-28  Dumitru Daniliuc  <dumi@chromium.org>
    277
  • trunk/WebCore/platform/graphics/GraphicsContext.cpp

    r51212 r52632  
    11/*
    2  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23 * THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
     
    381381
    382382    fillRect(font.selectionRectForText(run, point, h, from, to), backgroundColor, colorSpace);
    383 }
    384 
    385 void GraphicsContext::initFocusRing(int width, int offset)
    386 {
    387     if (paintingDisabled())
    388         return;
    389     clearFocusRing();
    390 
    391     m_common->m_focusRingWidth = width;
    392     m_common->m_focusRingOffset = offset;
    393 }
    394 
    395 void GraphicsContext::clearFocusRing()
    396 {
    397     m_common->m_focusRingRects.clear();
    398 }
    399 
    400 IntRect GraphicsContext::focusRingBoundingRect()
    401 {
    402     IntRect result = IntRect(0, 0, 0, 0);
    403 
    404     const Vector<IntRect>& rects = focusRingRects();
    405     unsigned rectCount = rects.size();
    406     for (unsigned i = 0; i < rectCount; i++)
    407         result.unite(rects[i]);
    408 
    409     return result;
    410 }
    411 
    412 void GraphicsContext::addFocusRingRect(const IntRect& rect)
    413 {
    414     if (paintingDisabled() || rect.isEmpty())
    415         return;
    416     m_common->m_focusRingRects.append(rect);
    417 }
    418 
    419 int GraphicsContext::focusRingWidth() const
    420 {
    421     return m_common->m_focusRingWidth;
    422 }
    423 
    424 int GraphicsContext::focusRingOffset() const
    425 {
    426     return m_common->m_focusRingOffset;
    427 }
    428 
    429 const Vector<IntRect>& GraphicsContext::focusRingRects() const
    430 {
    431     return m_common->m_focusRingRects;
    432383}
    433384
  • trunk/WebCore/platform/graphics/GraphicsContext.h

    r51212 r52632  
    263263        void clearShadow();
    264264
    265         void initFocusRing(int width, int offset);
    266         void addFocusRingRect(const IntRect&);
    267         void drawFocusRing(const Color&);
    268         void clearFocusRing();
    269         IntRect focusRingBoundingRect();
     265        void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&);
    270266
    271267        void setLineCap(LineCap);
     
    412408        static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&);
    413409
    414         int focusRingWidth() const;
    415         int focusRingOffset() const;
    416         const Vector<IntRect>& focusRingRects() const;
    417 
    418410        static GraphicsContextPrivate* createGraphicsContextPrivate();
    419411        static void destroyGraphicsContextPrivate(GraphicsContextPrivate*);
  • trunk/WebCore/platform/graphics/GraphicsContextPrivate.h

    r51161 r52632  
    4949            , shadowsIgnoreTransforms(false)
    5050#if PLATFORM(CAIRO)
    51             , globalAlpha(1.0f)
     51            , globalAlpha(1)
    5252#endif
    5353        {
     
    8888    public:
    8989        GraphicsContextPrivate()
    90             : m_focusRingWidth(0)
    91             , m_focusRingOffset(0)
    92             , m_updatingControlTints(false)
     90            : m_updatingControlTints(false)
    9391        {
    9492        }
     
    9694        GraphicsContextState state;
    9795        Vector<GraphicsContextState> stack;
    98         Vector<IntRect> m_focusRingRects;
    99         int m_focusRingWidth;
    100         int m_focusRingOffset;
    10196        bool m_updatingControlTints;
    10297    };
  • trunk/WebCore/platform/graphics/IntRect.cpp

    r17904 r52632  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23 * THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
     
    105105}
    106106
     107IntRect unionRect(const Vector<IntRect>& rects)
     108{
     109    IntRect result;
     110
     111    size_t count = rects.size();
     112    for (size_t i = 0; i < count; ++i)
     113        result.unite(rects[i]);
     114
     115    return result;
    107116}
     117
     118} // namespace WebCore
  • trunk/WebCore/platform/graphics/IntRect.h

    r48469 r52632  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23 * THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
     
    2929#include "IntPoint.h"
    3030#include <wtf/Platform.h>
     31#include <wtf/Vector.h>
    3132
    3233#if PLATFORM(CG)
     
    186187}
    187188
     189IntRect unionRect(const Vector<IntRect>&);
     190
    188191inline bool operator==(const IntRect& a, const IntRect& b)
    189192{
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r51310 r52632  
    607607}
    608608
    609 void GraphicsContext::drawFocusRing(const Color& color)
    610 {
    611     if (paintingDisabled())
    612         return;
    613 
    614     const Vector<IntRect>& rects = focusRingRects();
     609void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int /* offset */, const Color& color)
     610{
     611    if (paintingDisabled())
     612        return;
     613
    615614    unsigned rectCount = rects.size();
    616615
     
    633632    setPlatformStrokeStyle(DottedStroke);
    634633#else
    635     int radius = (focusRingWidth() - 1) / 2;
     634    int radius = (width - 1) / 2;
    636635    for (unsigned i = 0; i < rectCount; i++)
    637636        addPath(Path::createRoundedRectangle(rects[i], FloatSize(radius, radius)));
     
    640639    Color ringColor(color.red(), color.green(), color.blue(), 127);
    641640    setColor(cr, ringColor);
    642     cairo_set_line_width(cr, focusRingWidth());
     641    cairo_set_line_width(cr, width);
    643642    setPlatformStrokeStyle(SolidStroke);
    644643#endif
  • trunk/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp

    r51002 r52632  
    205205}
    206206
    207 void GraphicsContext::drawFocusRing(const Color& color)
    208 {
    209     if (paintingDisabled())
    210         return;
    211 
    212     const Vector<IntRect>& rects = focusRingRects();
     207void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color)
     208{
     209    if (paintingDisabled())
     210        return;
     211
    213212    unsigned rectCount = rects.size();
    214213
  • trunk/WebCore/platform/graphics/mac/GraphicsContextMac.mm

    r47585 r52632  
    2727#import "GraphicsContext.h"
    2828
    29 #import "../cg/GraphicsContextPlatformPrivateCG.h"
     29#import "GraphicsContextPlatformPrivateCG.h"
    3030#import <AppKit/AppKit.h>
    3131#import <wtf/StdLibExtras.h>
     
    4444// exceptions for those.
    4545
    46 void GraphicsContext::drawFocusRing(const Color& color)
     46void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
    4747{
    4848    if (paintingDisabled())
    4949        return;
    5050
    51     int radius = (focusRingWidth() - 1) / 2;
    52     int offset = radius + focusRingOffset();
     51    int radius = (width - 1) / 2;
     52    offset += radius;
    5353    RetainPtr<CGColorRef> colorRef;
    5454    if (color.isValid())
     
    5656
    5757    RetainPtr<CGMutablePathRef> focusRingPath(AdoptCF, CGPathCreateMutable());
    58     const Vector<IntRect>& rects = focusRingRects();
    5958    unsigned rectCount = rects.size();
    6059    for (unsigned i = 0; i < rectCount; i++)
  • trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r52601 r52632  
    801801 * need it.
    802802 */
    803 void GraphicsContext::drawFocusRing(const Color& color)
    804 {
    805     if (paintingDisabled())
    806         return;
    807 
    808     const Vector<IntRect>& rects = focusRingRects();
     803void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color)
     804{
     805    if (paintingDisabled())
     806        return;
     807
    809808    unsigned rectCount = rects.size();
    810809
  • trunk/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r51722 r52632  
    499499}
    500500
    501 void GraphicsContext::drawFocusRing(const Color& color)
    502 {
    503     if (paintingDisabled())
    504         return;
    505 
    506     const Vector<IntRect>& rects = focusRingRects();
     501void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color)
     502{
     503    if (paintingDisabled())
     504        return;
     505
    507506    unsigned rectCount = rects.size();
    508507    if (!rectCount)
  • trunk/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp

    r50764 r52632  
    125125}
    126126
    127 void GraphicsContext::drawFocusRing(const Color& color)
     127void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
    128128{
    129129    if (paintingDisabled())
    130130        return;
    131131
    132     float radius = (focusRingWidth() - 1) / 2.0f;
    133     int offset = radius + focusRingOffset();
     132    float radius = (width - 1) / 2.0f;
     133    offset += radius;
    134134    CGColorRef colorRef = color.isValid() ? createCGColor(color) : 0;
    135135
    136136    CGMutablePathRef focusRingPath = CGPathCreateMutable();
    137     const Vector<IntRect>& rects = focusRingRects();
    138137    unsigned rectCount = rects.size();
    139138    for (unsigned i = 0; i < rectCount; i++)
  • trunk/WebCore/platform/graphics/wince/GraphicsContextWince.cpp

    r52229 r52632  
    10031003}
    10041004
    1005 void GraphicsContext::drawFocusRing(const Color& color)
     1005void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
    10061006{
    10071007    if (!m_data->m_opacity || paintingDisabled())
     
    10121012        return;
    10131013
    1014     int radius = (focusRingWidth() - 1) / 2;
    1015     int offset = radius + focusRingOffset();
    1016 
    1017     const Vector<IntRect>& rects = focusRingRects();
     1014    int radius = (width - 1) / 2;
     1015    offset += radius;
     1016
    10181017    unsigned rectCount = rects.size();
    10191018    IntRect finalFocusRect;
  • trunk/WebCore/platform/graphics/wx/GraphicsContextWx.cpp

    r51143 r52632  
    271271}
    272272
    273 void GraphicsContext::drawFocusRing(const Color& color)
     273void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)
    274274{
    275275    if (paintingDisabled())
  • trunk/WebCore/rendering/RenderBlock.cpp

    r52566 r52632  
    50095009}
    50105010
    5011 void RenderBlock::addFocusRingRects(GraphicsContext* graphicsContext, int tx, int ty)
     5011void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
    50125012{
    50135013    // For blocks inside inlines, we go ahead and include margins so that we run right up to the
     
    50215021        int topMargin = prevInlineHasLineBox ? collapsedMarginTop() : 0;
    50225022        int bottomMargin = nextInlineHasLineBox ? collapsedMarginBottom() : 0;
    5023         graphicsContext->addFocusRingRect(IntRect(tx, ty - topMargin,
    5024                                                   width(), height() + topMargin + bottomMargin));
    5025     } else
    5026         graphicsContext->addFocusRingRect(IntRect(tx, ty, width(), height()));
     5023        IntRect rect(tx, ty - topMargin, width(), height() + topMargin + bottomMargin);
     5024        if (!rect.isEmpty())
     5025            rects.append(rect);
     5026    } else if (width() && height())
     5027        rects.append(IntRect(tx, ty, width(), height()));
    50275028
    50285029    if (!hasOverflowClip() && !hasControlClip()) {
     
    50305031            int top = max(curr->lineTop(), curr->y());
    50315032            int bottom = min(curr->lineBottom(), curr->y() + curr->height());
    5032             graphicsContext->addFocusRingRect(IntRect(tx + curr->x(), ty + top, curr->width(), bottom - top));
     5033            IntRect rect(tx + curr->x(), ty + top, curr->width(), bottom - top);
     5034            if (!rect.isEmpty())
     5035                rects.append(rect);
    50335036        }
    50345037
     
    50425045                else
    50435046                    pos = FloatPoint(tx + box->x(), ty + box->y());
    5044                 box->addFocusRingRects(graphicsContext, pos.x(), pos.y());
     5047                box->addFocusRingRects(rects, pos.x(), pos.y());
    50455048            }
    50465049        }
     
    50485051
    50495052    if (inlineContinuation())
    5050         inlineContinuation()->addFocusRingRects(graphicsContext,
     5053        inlineContinuation()->addFocusRingRects(rects,
    50515054                                                tx - x() + inlineContinuation()->containingBlock()->x(),
    50525055                                                ty - y() + inlineContinuation()->containingBlock()->y());
  • trunk/WebCore/rendering/RenderBlock.h

    r51378 r52632  
    352352    virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
    353353
    354     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
     354    virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
    355355
    356356    void adjustPointToColumnContents(IntPoint&) const;
  • trunk/WebCore/rendering/RenderBox.cpp

    r52314 r52632  
    331331}
    332332
    333 void RenderBox::addFocusRingRects(GraphicsContext* graphicsContext, int tx, int ty)
    334 {
    335     graphicsContext->addFocusRingRect(IntRect(tx, ty, width(), height()));
    336 }
    337 
     333void RenderBox::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
     334{
     335    if (width() && height())
     336        rects.append(IntRect(tx, ty, width(), height()));
     337}
    338338
    339339IntRect RenderBox::reflectionBox() const
  • trunk/WebCore/rendering/RenderBox.h

    r50184 r52632  
    7575    // Bounds of the outline box in absolute coords. Respects transforms
    7676    virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/) const;
    77     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
     77    virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
    7878
    7979    // Use this with caution! No type checking is done!
  • trunk/WebCore/rendering/RenderInline.cpp

    r52314 r52632  
    933933}
    934934
    935 void RenderInline::addFocusRingRects(GraphicsContext* graphicsContext, int tx, int ty)
     935void RenderInline::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
    936936{
    937937    for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
     
    939939        int top = max(root->lineTop(), curr->y());
    940940        int bottom = min(root->lineBottom(), curr->y() + curr->height());
    941         graphicsContext->addFocusRingRect(IntRect(tx + curr->x(), ty + top, curr->width(), bottom - top));
     941        IntRect rect(tx + curr->x(), ty + top, curr->width(), bottom - top);
     942        if (!rect.isEmpty())
     943            rects.append(rect);
    942944    }
    943945
     
    950952            else if (curr->isBox())
    951953                pos.move(toRenderBox(curr)->x(), toRenderBox(curr)->y());
    952            curr->addFocusRingRects(graphicsContext, pos.x(), pos.y());
     954           curr->addFocusRingRects(rects, pos.x(), pos.y());
    953955        }
    954956    }
     
    956958    if (continuation()) {
    957959        if (continuation()->isInline())
    958             continuation()->addFocusRingRects(graphicsContext,
     960            continuation()->addFocusRingRects(rects,
    959961                                              tx - containingBlock()->x() + continuation()->containingBlock()->x(),
    960962                                              ty - containingBlock()->y() + continuation()->containingBlock()->y());
    961963        else
    962             continuation()->addFocusRingRects(graphicsContext,
     964            continuation()->addFocusRingRects(rects,
    963965                                              tx - containingBlock()->x() + toRenderBox(continuation())->x(),
    964966                                              ty - containingBlock()->y() + toRenderBox(continuation())->y());
     
    977979            oc = style()->color();
    978980
    979         graphicsContext->initFocusRing(ow, style()->outlineOffset());
    980         addFocusRingRects(graphicsContext, tx, ty);
     981        Vector<IntRect> focusRingRects;
     982        addFocusRingRects(focusRingRects, tx, ty);
    981983        if (style()->outlineStyleIsAuto())
    982             graphicsContext->drawFocusRing(oc);
     984            graphicsContext->drawFocusRing(focusRingRects, ow, style()->outlineOffset(), oc);
    983985        else
    984             addPDFURLRect(graphicsContext, graphicsContext->focusRingBoundingRect());
    985         graphicsContext->clearFocusRing();
     986            addPDFURLRect(graphicsContext, unionRect(focusRingRects));
    986987    }
    987988
  • trunk/WebCore/rendering/RenderInline.h

    r50184 r52632  
    6666    IntSize relativePositionedInlineOffset(const RenderBox* child) const;
    6767
    68     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
     68    virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
    6969    void paintOutline(GraphicsContext*, int tx, int ty);
    7070
  • trunk/WebCore/rendering/RenderObject.cpp

    r52314 r52632  
    10101010        if (!theme()->supportsFocusRing(style)) {
    10111011            // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
    1012             graphicsContext->initFocusRing(ow, offset);
    1013             addFocusRingRects(graphicsContext, tx, ty);
     1012            Vector<IntRect> focusRingRects;
     1013            addFocusRingRects(focusRingRects, tx, ty);
    10141014            if (style->outlineStyleIsAuto())
    1015                 graphicsContext->drawFocusRing(oc);
     1015                graphicsContext->drawFocusRing(focusRingRects, ow, offset, oc);
    10161016            else
    1017                 addPDFURLRect(graphicsContext, graphicsContext->focusRingBoundingRect());
    1018             graphicsContext->clearFocusRing();
     1017                addPDFURLRect(graphicsContext, unionRect(focusRingRects));
    10191018        }
    10201019    }
  • trunk/WebCore/rendering/RenderObject.h

    r51833 r52632  
    751751    void getTransformFromContainer(const RenderObject* container, const IntSize& offsetInContainer, TransformationMatrix&) const;
    752752   
    753     virtual void addFocusRingRects(GraphicsContext*, int /*tx*/, int /*ty*/) { };
     753    virtual void addFocusRingRects(Vector<IntRect>&, int /*tx*/, int /*ty*/) { };
    754754
    755755    IntRect absoluteOutlineBounds() const
  • trunk/WebCore/rendering/RenderPath.cpp

    r52630 r52632  
    210210// This method is called from inside paintOutline() since we call paintOutline()
    211211// while transformed to our coord system, return local coords
    212 void RenderPath::addFocusRingRects(GraphicsContext* graphicsContext, int, int)
    213 {
    214     graphicsContext->addFocusRingRect(enclosingIntRect(repaintRectInLocalCoordinates()));
     212void RenderPath::addFocusRingRects(Vector<IntRect>& rects, int, int)
     213{
     214    IntRect rect = enclosingIntRect(repaintRectInLocalCoordinates());
     215    if (!rect.isEmpty())
     216        rects.append(rect);
    215217}
    216218
  • trunk/WebCore/rendering/RenderPath.h

    r52630 r52632  
    6060    virtual void layout();
    6161    virtual void paint(PaintInfo&, int parentX, int parentY);
    62     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
     62    virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
    6363
    6464    virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
  • trunk/WebCore/rendering/RenderSVGContainer.cpp

    r52584 r52632  
    137137
    138138// addFocusRingRects is called from paintOutline and needs to be in the same coordinates as the paintOuline call
    139 void RenderSVGContainer::addFocusRingRects(GraphicsContext* graphicsContext, int, int)
     139void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, int, int)
    140140{
    141141    IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
    142     graphicsContext->addFocusRingRect(paintRectInParent);
     142    if (!paintRectInParent.isEmpty())
     143        rects.append(paintRectInParent);
    143144}
    144145
  • trunk/WebCore/rendering/RenderSVGContainer.h

    r52630 r52632  
    5555    virtual void layout();
    5656
    57     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
     57    virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
    5858
    5959    virtual FloatRect objectBoundingBox() const;
  • trunk/WebCore/rendering/RenderSVGImage.cpp

    r52584 r52632  
    242242}
    243243
    244 void RenderSVGImage::addFocusRingRects(GraphicsContext* graphicsContext, int, int)
     244void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, int, int)
    245245{
    246246    // this is called from paint() after the localTransform has already been applied
    247247    IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates());
    248     graphicsContext->addFocusRingRect(contentRect);
     248    if (!contentRect.isEmpty())
     249        rects.append(contentRect);
    249250}
    250251
  • trunk/WebCore/rendering/RenderSVGImage.h

    r52373 r52632  
    5555        virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
    5656        virtual void absoluteQuads(Vector<FloatQuad>&);
    57         virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
     57        virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
    5858
    5959        virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
  • trunk/WebCore/rendering/RenderTextControl.cpp

    r51148 r52632  
    506506}
    507507
    508 void RenderTextControl::addFocusRingRects(GraphicsContext* graphicsContext, int tx, int ty)
    509 {
    510     graphicsContext->addFocusRingRect(IntRect(tx, ty, width(), height()));
     508void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
     509{
     510    if (width() && height())
     511        rects.append(IntRect(tx, ty, width(), height()));
    511512}
    512513
  • trunk/WebCore/rendering/RenderTextControl.h

    r51148 r52632  
    100100    void setInnerTextStyle(PassRefPtr<RenderStyle>);
    101101   
    102     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
     102    virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
    103103
    104104    virtual bool canBeProgramaticallyScrolled(bool) const { return true; }
Note: See TracChangeset for help on using the changeset viewer.