Changeset 103677 in webkit
- Timestamp:
- Dec 25, 2011 9:20:02 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r103676 r103677 1 2011-12-25 Dan Bernstein <mitz@apple.com> 2 3 WebCore changes for: Find indicators overlap when a match spans multiple text boxes 4 https://bugs.webkit.org/show_bug.cgi?id=75220 5 6 Reviewed by Darin Adler. 7 8 * WebCore.exp.in: Exported new unionRect(const Vector<FloatRect>&) and existing 9 FloatRect::intersects(). 10 * platform/graphics/FloatRect.cpp: 11 (WebCore::unionRect): Added. 12 * platform/graphics/FloatRect.h: 13 1 14 2011-12-25 Darin Adler <darin@apple.com> 2 15 -
trunk/Source/WebCore/WebCore.exp.in
r103643 r103677 1116 1116 __ZN7WebCore9plainTextEPKNS_5RangeENS_20TextIteratorBehaviorE 1117 1117 __ZN7WebCore9toElementEN3JSC7JSValueE 1118 __ZN7WebCore9unionRectERKN3WTF6VectorINS_9FloatRectELm0EEE 1118 1119 __ZNK3JSC8Bindings10RootObject12globalObjectEv 1119 1120 __ZNK3WTF6String14createCFStringEv … … 1424 1425 __ZNK7WebCore9DOMWindow27pendingUnloadEventListenersEv 1425 1426 __ZNK7WebCore9FloatQuad11boundingBoxEv 1427 __ZNK7WebCore9FloatRect10intersectsERKS0_ 1426 1428 __ZNK7WebCore9FloatRectcv7_NSRectEv 1427 1429 __ZNK7WebCore9FrameTree12traverseNextEPKNS_5FrameE -
trunk/Source/WebCore/platform/graphics/FloatRect.cpp
r101517 r103677 138 138 } 139 139 140 FloatRect unionRect(const Vector<FloatRect>& rects) 141 { 142 FloatRect result; 143 144 size_t count = rects.size(); 145 for (size_t i = 0; i < count; ++i) 146 result.unite(rects[i]); 147 148 return result; 149 } 150 140 151 void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1) 141 152 { -
trunk/Source/WebCore/platform/graphics/FloatRect.h
r101517 r103677 29 29 30 30 #include "FloatPoint.h" 31 #include <wtf/Vector.h> 31 32 32 33 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM) … … 240 241 } 241 242 243 FloatRect unionRect(const Vector<FloatRect>&); 244 242 245 inline FloatRect& operator+=(FloatRect& a, const FloatRect& b) 243 246 { -
trunk/Source/WebKit2/ChangeLog
r103643 r103677 1 2011-12-25 Dan Bernstein <mitz@apple.com> 2 3 Find indicators overlap when a match spans multiple text boxes 4 https://bugs.webkit.org/show_bug.cgi?id=75220 5 6 Reviewed by Darin Adler. 7 8 * UIProcess/FindIndicator.cpp: 9 (WebKit::findIndicatorsForTextRectsOverlap): Added this helper function that checks for 10 pairwise intersections between all indicator rects. 11 (WebKit::FindIndicator::FindIndicator): Changed to use a single rect (the union of all text 12 rects) if any two indicator rects would otherwise overlap. This is similar to what Safari 13 does, and it eliminates overlapping rects for adjacent text boxes. In rare cases (such as when 14 a match spans two lines and adjacent text boxes on one of those lines) it results in a find 15 indicator that is too large and obscures some non-match text. 16 * UIProcess/FindIndicator.h: 17 1 18 2011-12-21 Sam Weinig <sam@webkit.org> 2 19 -
trunk/Source/WebKit2/UIProcess/FindIndicator.cpp
r95901 r103677 88 88 } 89 89 90 static bool findIndicatorsForTextRectsOverlap(const Vector<FloatRect>& textRects) 91 { 92 size_t count = textRects.size(); 93 if (count <= 1) 94 return false; 95 96 Vector<FloatRect> indicatorRects; 97 indicatorRects.reserveInitialCapacity(count); 98 99 for (size_t i = 0; i < count; ++i) { 100 FloatRect indicatorRect = textRects[i]; 101 indicatorRect.move(-leftBorderThickness, -topBorderThickness); 102 indicatorRect.expand(leftBorderThickness + rightBorderThickness, topBorderThickness + bottomBorderThickness); 103 104 for (size_t j = indicatorRects.size(); j; ) { 105 --j; 106 if (indicatorRect.intersects(indicatorRects[j])) 107 return true; 108 } 109 110 indicatorRects.uncheckedAppend(indicatorRect); 111 } 112 113 return false; 114 } 115 90 116 FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, PassRefPtr<ShareableBitmap> contentImage) 91 117 : m_selectionRectInWindowCoordinates(selectionRectInWindowCoordinates) … … 94 120 , m_contentImage(contentImage) 95 121 { 122 if (findIndicatorsForTextRectsOverlap(m_textRectsInSelectionRectCoordinates)) { 123 m_textRectsInSelectionRectCoordinates[0] = unionRect(m_textRectsInSelectionRectCoordinates); 124 m_textRectsInSelectionRectCoordinates.shrink(1); 125 } 96 126 } 97 127 -
trunk/Source/WebKit2/UIProcess/FindIndicator.h
r95901 r103677 47 47 WebCore::FloatRect frameRect() const; 48 48 49 const Vector<WebCore::FloatRect>& textRects() const { return m_textRectsInSelectionRectCoordinates; }50 51 49 ShareableBitmap* contentImage() const { return m_contentImage.get(); } 52 50
Note: See TracChangeset
for help on using the changeset viewer.