Changeset 52632 in webkit
- Timestamp:
- Dec 29, 2009 1:05:56 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r52631 r52632 1 2009-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 1 76 2009-12-28 Dumitru Daniliuc <dumi@chromium.org> 2 77 -
trunk/WebCore/platform/graphics/GraphicsContext.cpp
r51212 r52632 1 1 /* 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. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR17 * 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, OR20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE23 * 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. 24 24 */ 25 25 … … 381 381 382 382 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() const420 {421 return m_common->m_focusRingWidth;422 }423 424 int GraphicsContext::focusRingOffset() const425 {426 return m_common->m_focusRingOffset;427 }428 429 const Vector<IntRect>& GraphicsContext::focusRingRects() const430 {431 return m_common->m_focusRingRects;432 383 } 433 384 -
trunk/WebCore/platform/graphics/GraphicsContext.h
r51212 r52632 263 263 void clearShadow(); 264 264 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&); 270 266 271 267 void setLineCap(LineCap); … … 412 408 static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&); 413 409 414 int focusRingWidth() const;415 int focusRingOffset() const;416 const Vector<IntRect>& focusRingRects() const;417 418 410 static GraphicsContextPrivate* createGraphicsContextPrivate(); 419 411 static void destroyGraphicsContextPrivate(GraphicsContextPrivate*); -
trunk/WebCore/platform/graphics/GraphicsContextPrivate.h
r51161 r52632 49 49 , shadowsIgnoreTransforms(false) 50 50 #if PLATFORM(CAIRO) 51 , globalAlpha(1 .0f)51 , globalAlpha(1) 52 52 #endif 53 53 { … … 88 88 public: 89 89 GraphicsContextPrivate() 90 : m_focusRingWidth(0) 91 , m_focusRingOffset(0) 92 , m_updatingControlTints(false) 90 : m_updatingControlTints(false) 93 91 { 94 92 } … … 96 94 GraphicsContextState state; 97 95 Vector<GraphicsContextState> stack; 98 Vector<IntRect> m_focusRingRects;99 int m_focusRingWidth;100 int m_focusRingOffset;101 96 bool m_updatingControlTints; 102 97 }; -
trunk/WebCore/platform/graphics/IntRect.cpp
r17904 r52632 1 1 /* 2 * Copyright (C) 2003, 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR17 * 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, OR20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE23 * 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. 24 24 */ 25 25 … … 105 105 } 106 106 107 IntRect 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; 107 116 } 117 118 } // namespace WebCore -
trunk/WebCore/platform/graphics/IntRect.h
r48469 r52632 1 1 /* 2 * Copyright (C) 2003, 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR17 * 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, OR20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE23 * 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. 24 24 */ 25 25 … … 29 29 #include "IntPoint.h" 30 30 #include <wtf/Platform.h> 31 #include <wtf/Vector.h> 31 32 32 33 #if PLATFORM(CG) … … 186 187 } 187 188 189 IntRect unionRect(const Vector<IntRect>&); 190 188 191 inline bool operator==(const IntRect& a, const IntRect& b) 189 192 { -
trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r51310 r52632 607 607 } 608 608 609 void GraphicsContext::drawFocusRing(const Color& color) 610 { 611 if (paintingDisabled()) 612 return; 613 614 const Vector<IntRect>& rects = focusRingRects(); 609 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int /* offset */, const Color& color) 610 { 611 if (paintingDisabled()) 612 return; 613 615 614 unsigned rectCount = rects.size(); 616 615 … … 633 632 setPlatformStrokeStyle(DottedStroke); 634 633 #else 635 int radius = ( focusRingWidth()- 1) / 2;634 int radius = (width - 1) / 2; 636 635 for (unsigned i = 0; i < rectCount; i++) 637 636 addPath(Path::createRoundedRectangle(rects[i], FloatSize(radius, radius))); … … 640 639 Color ringColor(color.red(), color.green(), color.blue(), 127); 641 640 setColor(cr, ringColor); 642 cairo_set_line_width(cr, focusRingWidth());641 cairo_set_line_width(cr, width); 643 642 setPlatformStrokeStyle(SolidStroke); 644 643 #endif -
trunk/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
r51002 r52632 205 205 } 206 206 207 void GraphicsContext::drawFocusRing(const Color& color) 208 { 209 if (paintingDisabled()) 210 return; 211 212 const Vector<IntRect>& rects = focusRingRects(); 207 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color) 208 { 209 if (paintingDisabled()) 210 return; 211 213 212 unsigned rectCount = rects.size(); 214 213 -
trunk/WebCore/platform/graphics/mac/GraphicsContextMac.mm
r47585 r52632 27 27 #import "GraphicsContext.h" 28 28 29 #import " ../cg/GraphicsContextPlatformPrivateCG.h"29 #import "GraphicsContextPlatformPrivateCG.h" 30 30 #import <AppKit/AppKit.h> 31 31 #import <wtf/StdLibExtras.h> … … 44 44 // exceptions for those. 45 45 46 void GraphicsContext::drawFocusRing(const Color& color)46 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color) 47 47 { 48 48 if (paintingDisabled()) 49 49 return; 50 50 51 int radius = ( focusRingWidth()- 1) / 2;52 int offset = radius + focusRingOffset();51 int radius = (width - 1) / 2; 52 offset += radius; 53 53 RetainPtr<CGColorRef> colorRef; 54 54 if (color.isValid()) … … 56 56 57 57 RetainPtr<CGMutablePathRef> focusRingPath(AdoptCF, CGPathCreateMutable()); 58 const Vector<IntRect>& rects = focusRingRects();59 58 unsigned rectCount = rects.size(); 60 59 for (unsigned i = 0; i < rectCount; i++) -
trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r52601 r52632 801 801 * need it. 802 802 */ 803 void GraphicsContext::drawFocusRing(const Color& color) 804 { 805 if (paintingDisabled()) 806 return; 807 808 const Vector<IntRect>& rects = focusRingRects(); 803 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color) 804 { 805 if (paintingDisabled()) 806 return; 807 809 808 unsigned rectCount = rects.size(); 810 809 -
trunk/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
r51722 r52632 499 499 } 500 500 501 void GraphicsContext::drawFocusRing(const Color& color) 502 { 503 if (paintingDisabled()) 504 return; 505 506 const Vector<IntRect>& rects = focusRingRects(); 501 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color) 502 { 503 if (paintingDisabled()) 504 return; 505 507 506 unsigned rectCount = rects.size(); 508 507 if (!rectCount) -
trunk/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
r50764 r52632 125 125 } 126 126 127 void GraphicsContext::drawFocusRing(const Color& color)127 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color) 128 128 { 129 129 if (paintingDisabled()) 130 130 return; 131 131 132 float radius = ( focusRingWidth()- 1) / 2.0f;133 int offset = radius + focusRingOffset();132 float radius = (width - 1) / 2.0f; 133 offset += radius; 134 134 CGColorRef colorRef = color.isValid() ? createCGColor(color) : 0; 135 135 136 136 CGMutablePathRef focusRingPath = CGPathCreateMutable(); 137 const Vector<IntRect>& rects = focusRingRects();138 137 unsigned rectCount = rects.size(); 139 138 for (unsigned i = 0; i < rectCount; i++) -
trunk/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
r52229 r52632 1003 1003 } 1004 1004 1005 void GraphicsContext::drawFocusRing(const Color& color)1005 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color) 1006 1006 { 1007 1007 if (!m_data->m_opacity || paintingDisabled()) … … 1012 1012 return; 1013 1013 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 1018 1017 unsigned rectCount = rects.size(); 1019 1018 IntRect finalFocusRect; -
trunk/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
r51143 r52632 271 271 } 272 272 273 void GraphicsContext::drawFocusRing(const Color& color)273 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color) 274 274 { 275 275 if (paintingDisabled()) -
trunk/WebCore/rendering/RenderBlock.cpp
r52566 r52632 5009 5009 } 5010 5010 5011 void RenderBlock::addFocusRingRects( GraphicsContext* graphicsContext, int tx, int ty)5011 void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) 5012 5012 { 5013 5013 // For blocks inside inlines, we go ahead and include margins so that we run right up to the … … 5021 5021 int topMargin = prevInlineHasLineBox ? collapsedMarginTop() : 0; 5022 5022 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())); 5027 5028 5028 5029 if (!hasOverflowClip() && !hasControlClip()) { … … 5030 5031 int top = max(curr->lineTop(), curr->y()); 5031 5032 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); 5033 5036 } 5034 5037 … … 5042 5045 else 5043 5046 pos = FloatPoint(tx + box->x(), ty + box->y()); 5044 box->addFocusRingRects( graphicsContext, pos.x(), pos.y());5047 box->addFocusRingRects(rects, pos.x(), pos.y()); 5045 5048 } 5046 5049 } … … 5048 5051 5049 5052 if (inlineContinuation()) 5050 inlineContinuation()->addFocusRingRects( graphicsContext,5053 inlineContinuation()->addFocusRingRects(rects, 5051 5054 tx - x() + inlineContinuation()->containingBlock()->x(), 5052 5055 ty - y() + inlineContinuation()->containingBlock()->y()); -
trunk/WebCore/rendering/RenderBlock.h
r51378 r52632 352 352 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); 353 353 354 virtual void addFocusRingRects( GraphicsContext*, int tx, int ty);354 virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty); 355 355 356 356 void adjustPointToColumnContents(IntPoint&) const; -
trunk/WebCore/rendering/RenderBox.cpp
r52314 r52632 331 331 } 332 332 333 void RenderBox::addFocusRingRects( GraphicsContext* graphicsContext, int tx, int ty)334 { 335 graphicsContext->addFocusRingRect(IntRect(tx, ty, width(), height()));336 } 337 333 void RenderBox::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) 334 { 335 if (width() && height()) 336 rects.append(IntRect(tx, ty, width(), height())); 337 } 338 338 339 339 IntRect RenderBox::reflectionBox() const -
trunk/WebCore/rendering/RenderBox.h
r50184 r52632 75 75 // Bounds of the outline box in absolute coords. Respects transforms 76 76 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); 78 78 79 79 // Use this with caution! No type checking is done! -
trunk/WebCore/rendering/RenderInline.cpp
r52314 r52632 933 933 } 934 934 935 void RenderInline::addFocusRingRects( GraphicsContext* graphicsContext, int tx, int ty)935 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) 936 936 { 937 937 for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { … … 939 939 int top = max(root->lineTop(), curr->y()); 940 940 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); 942 944 } 943 945 … … 950 952 else if (curr->isBox()) 951 953 pos.move(toRenderBox(curr)->x(), toRenderBox(curr)->y()); 952 curr->addFocusRingRects( graphicsContext, pos.x(), pos.y());954 curr->addFocusRingRects(rects, pos.x(), pos.y()); 953 955 } 954 956 } … … 956 958 if (continuation()) { 957 959 if (continuation()->isInline()) 958 continuation()->addFocusRingRects( graphicsContext,960 continuation()->addFocusRingRects(rects, 959 961 tx - containingBlock()->x() + continuation()->containingBlock()->x(), 960 962 ty - containingBlock()->y() + continuation()->containingBlock()->y()); 961 963 else 962 continuation()->addFocusRingRects( graphicsContext,964 continuation()->addFocusRingRects(rects, 963 965 tx - containingBlock()->x() + toRenderBox(continuation())->x(), 964 966 ty - containingBlock()->y() + toRenderBox(continuation())->y()); … … 977 979 oc = style()->color(); 978 980 979 graphicsContext->initFocusRing(ow, style()->outlineOffset());980 addFocusRingRects( graphicsContext, tx, ty);981 Vector<IntRect> focusRingRects; 982 addFocusRingRects(focusRingRects, tx, ty); 981 983 if (style()->outlineStyleIsAuto()) 982 graphicsContext->drawFocusRing( oc);984 graphicsContext->drawFocusRing(focusRingRects, ow, style()->outlineOffset(), oc); 983 985 else 984 addPDFURLRect(graphicsContext, graphicsContext->focusRingBoundingRect()); 985 graphicsContext->clearFocusRing(); 986 addPDFURLRect(graphicsContext, unionRect(focusRingRects)); 986 987 } 987 988 -
trunk/WebCore/rendering/RenderInline.h
r50184 r52632 66 66 IntSize relativePositionedInlineOffset(const RenderBox* child) const; 67 67 68 virtual void addFocusRingRects( GraphicsContext*, int tx, int ty);68 virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty); 69 69 void paintOutline(GraphicsContext*, int tx, int ty); 70 70 -
trunk/WebCore/rendering/RenderObject.cpp
r52314 r52632 1010 1010 if (!theme()->supportsFocusRing(style)) { 1011 1011 // 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); 1014 1014 if (style->outlineStyleIsAuto()) 1015 graphicsContext->drawFocusRing( oc);1015 graphicsContext->drawFocusRing(focusRingRects, ow, offset, oc); 1016 1016 else 1017 addPDFURLRect(graphicsContext, graphicsContext->focusRingBoundingRect()); 1018 graphicsContext->clearFocusRing(); 1017 addPDFURLRect(graphicsContext, unionRect(focusRingRects)); 1019 1018 } 1020 1019 } -
trunk/WebCore/rendering/RenderObject.h
r51833 r52632 751 751 void getTransformFromContainer(const RenderObject* container, const IntSize& offsetInContainer, TransformationMatrix&) const; 752 752 753 virtual void addFocusRingRects( GraphicsContext*, int /*tx*/, int /*ty*/) { };753 virtual void addFocusRingRects(Vector<IntRect>&, int /*tx*/, int /*ty*/) { }; 754 754 755 755 IntRect absoluteOutlineBounds() const -
trunk/WebCore/rendering/RenderPath.cpp
r52630 r52632 210 210 // This method is called from inside paintOutline() since we call paintOutline() 211 211 // while transformed to our coord system, return local coords 212 void RenderPath::addFocusRingRects(GraphicsContext* graphicsContext, int, int) 213 { 214 graphicsContext->addFocusRingRect(enclosingIntRect(repaintRectInLocalCoordinates())); 212 void RenderPath::addFocusRingRects(Vector<IntRect>& rects, int, int) 213 { 214 IntRect rect = enclosingIntRect(repaintRectInLocalCoordinates()); 215 if (!rect.isEmpty()) 216 rects.append(rect); 215 217 } 216 218 -
trunk/WebCore/rendering/RenderPath.h
r52630 r52632 60 60 virtual void layout(); 61 61 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); 63 63 64 64 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); -
trunk/WebCore/rendering/RenderSVGContainer.cpp
r52584 r52632 137 137 138 138 // 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)139 void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, int, int) 140 140 { 141 141 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates())); 142 graphicsContext->addFocusRingRect(paintRectInParent); 142 if (!paintRectInParent.isEmpty()) 143 rects.append(paintRectInParent); 143 144 } 144 145 -
trunk/WebCore/rendering/RenderSVGContainer.h
r52630 r52632 55 55 virtual void layout(); 56 56 57 virtual void addFocusRingRects( GraphicsContext*, int tx, int ty);57 virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty); 58 58 59 59 virtual FloatRect objectBoundingBox() const; -
trunk/WebCore/rendering/RenderSVGImage.cpp
r52584 r52632 242 242 } 243 243 244 void RenderSVGImage::addFocusRingRects( GraphicsContext* graphicsContext, int, int)244 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, int, int) 245 245 { 246 246 // this is called from paint() after the localTransform has already been applied 247 247 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); 248 graphicsContext->addFocusRingRect(contentRect); 248 if (!contentRect.isEmpty()) 249 rects.append(contentRect); 249 250 } 250 251 -
trunk/WebCore/rendering/RenderSVGImage.h
r52373 r52632 55 55 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); 56 56 virtual void absoluteQuads(Vector<FloatQuad>&); 57 virtual void addFocusRingRects( GraphicsContext*, int tx, int ty);57 virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty); 58 58 59 59 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); -
trunk/WebCore/rendering/RenderTextControl.cpp
r51148 r52632 506 506 } 507 507 508 void RenderTextControl::addFocusRingRects(GraphicsContext* graphicsContext, int tx, int ty) 509 { 510 graphicsContext->addFocusRingRect(IntRect(tx, ty, width(), height())); 508 void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty) 509 { 510 if (width() && height()) 511 rects.append(IntRect(tx, ty, width(), height())); 511 512 } 512 513 -
trunk/WebCore/rendering/RenderTextControl.h
r51148 r52632 100 100 void setInnerTextStyle(PassRefPtr<RenderStyle>); 101 101 102 virtual void addFocusRingRects( GraphicsContext*, int tx, int ty);102 virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty); 103 103 104 104 virtual bool canBeProgramaticallyScrolled(bool) const { return true; }
Note: See TracChangeset
for help on using the changeset viewer.