Changeset 69625 in webkit
- Timestamp:
- Oct 12, 2010 6:05:41 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69624 r69625 1 2010-10-12 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Paint the find overlay background 6 https://bugs.webkit.org/show_bug.cgi?id=47565 7 8 Export symbols required by WebKit2. 9 10 * WebCore.exp.in: 11 1 12 2010-10-12 James Robinson <jamesr@chromium.org> 2 13 -
trunk/WebCore/WebCore.exp.in
r69598 r69625 347 347 __ZN7WebCore15FocusController9setActiveEb 348 348 __ZN7WebCore15GraphicsContext12setFillColorERKNS_5ColorENS_10ColorSpaceE 349 __ZN7WebCore15GraphicsContext20endTransparencyLayerEv 350 __ZN7WebCore15GraphicsContext21setCompositeOperationENS_17CompositeOperatorE 351 __ZN7WebCore15GraphicsContext22beginTransparencyLayerEf 349 352 __ZN7WebCore15GraphicsContext4clipERKNS_9FloatRectE 350 353 __ZN7WebCore15GraphicsContext4saveEv 354 __ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE 351 355 __ZN7WebCore15GraphicsContext7restoreEv 352 356 __ZN7WebCore15GraphicsContext9translateEff … … 1059 1063 __ZNK7WebCore6Widget25convertFromContainingViewERKNS_8IntPointE 1060 1064 __ZNK7WebCore6Widget25convertToContainingWindowERKNS_7IntRectE 1065 __ZNK7WebCore6Widget25convertToContainingWindowERKNS_8IntPointE 1061 1066 __ZNK7WebCore6Widget9frameRectEv 1062 1067 __ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE -
trunk/WebKit2/ChangeLog
r69621 r69625 1 2010-10-12 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Paint the find overlay background 6 https://bugs.webkit.org/show_bug.cgi?id=47565 7 8 * WebProcess/WebPage/FindController.cpp: 9 (WebKit::FindController::findString): 10 Don't show the overlay if we have too many matches. 11 12 * WebProcess/WebPage/FindPageOverlay.cpp: 13 (WebKit::FindPageOverlay::rectsForTextMatches): 14 Get the rects for all text matches. 15 16 (WebKit::FindPageOverlay::drawRect): 17 Assert that we're only being called if there are any text matches. 18 Paint the background. 19 1 20 2010-10-12 Sam Weinig <sam@webkit.org> 2 21 -
trunk/WebKit2/WebProcess/WebPage/FindController.cpp
r69616 r69625 53 53 void FindController::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxNumMatches) 54 54 { 55 bool found = m_webPage->corePage()->findString(string, (findOptions & FindOptionsCaseInsensitive) ? TextCaseInsensitive : TextCaseSensitive, 55 TextCaseSensitivity caseSensitivity = findOptions & FindOptionsCaseInsensitive ? TextCaseInsensitive : TextCaseSensitive; 56 bool found = m_webPage->corePage()->findString(string, caseSensitivity, 56 57 findDirection == FindDirectionForward ? WebCore::FindDirectionForward : WebCore::FindDirectionBackward, 57 58 findOptions & FindOptionsWrapAround); … … 69 70 selectedFrame->selection()->clear(); 70 71 } else { 71 // FIXME: We need to show the find indicator here.72 shouldShowOverlay = findOptions & FindOptionsShowOverlay; 72 73 73 shouldShowOverlay = findOptions & FindOptionsShowOverlay; 74 if (shouldShowOverlay) { 75 unsigned numMatches = m_webPage->corePage()->markAllMatchesForText(string, caseSensitivity, false, maxNumMatches); 76 77 // Check if we have more matches than allowed. 78 if (numMatches > maxNumMatches) 79 shouldShowOverlay = false; 80 } 74 81 } 75 82 -
trunk/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
r69616 r69625 27 27 28 28 #include "FindController.h" 29 #include "WebPage.h" 30 #include <WebCore/Frame.h> 31 #include <WebCore/FrameView.h> 29 32 #include <WebCore/GraphicsContext.h> 33 #include <WebCore/Page.h> 30 34 31 35 using namespace WebCore; … … 48 52 } 49 53 54 Vector<IntRect> FindPageOverlay::rectsForTextMatches() 55 { 56 Vector<IntRect> rects; 57 58 for (Frame* frame = webPage()->corePage()->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 59 Document* document = frame->document(); 60 if (!document) 61 continue; 62 63 IntRect visibleRect = frame->view()->visibleContentRect(); 64 Vector<IntRect> frameRects = document->markers()->renderedRectsForMarkers(DocumentMarker::TextMatch); 65 IntPoint frameOffset(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height()); 66 frameOffset = frame->view()->convertToContainingWindow(frameOffset); 67 68 for (Vector<IntRect>::iterator it = frameRects.begin(), end = frameRects.end(); it != end; ++it) { 69 it->intersect(visibleRect); 70 it->move(frameOffset.x(), frameOffset.y()); 71 rects.append(*it); 72 } 73 } 74 75 return rects; 76 } 77 78 static const int overlayBackgroundRed = 25; 79 static const int overlayBackgroundGreen = 25; 80 static const int overlayBackgroundBlue = 25; 81 static const int overlayBackgroundAlpha = 63; 82 83 static Color overlayBackgroundColor() 84 { 85 return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha); 86 } 87 50 88 void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect) 51 89 { 52 // FIXME: Draw something. 90 Vector<IntRect> rects = rectsForTextMatches(); 91 ASSERT(!rects.isEmpty()); 92 93 FrameView* frameView = webPage()->corePage()->mainFrame()->view(); 94 95 int width = frameView->width(); 96 if (frameView->verticalScrollbar()) 97 width -= frameView->verticalScrollbar()->width(); 98 int height = frameView->height(); 99 if (frameView->horizontalScrollbar()) 100 height -= frameView->horizontalScrollbar()->height(); 101 102 IntRect paintRect = intersection(dirtyRect, IntRect(0, 0, width, height)); 103 if (paintRect.isEmpty()) 104 return; 105 106 graphicsContext.beginTransparencyLayer(1); 107 graphicsContext.setCompositeOperation(CompositeCopy); 108 109 // Draw the background. 110 graphicsContext.fillRect(paintRect, overlayBackgroundColor(), sRGBColorSpace); 111 112 // FIXME: Draw the holes. 113 114 graphicsContext.endTransparencyLayer(); 53 115 } 54 116 55 56 117 } // namespace WebKit -
trunk/WebKit2/WebProcess/WebPage/FindPageOverlay.h
r69616 r69625 29 29 #include "PageOverlay.h" 30 30 #include <wtf/PassOwnPtr.h> 31 #include <wtf/Vector.h> 31 32 32 33 namespace WebKit { … … 42 43 explicit FindPageOverlay(FindController*); 43 44 45 Vector<WebCore::IntRect> rectsForTextMatches(); 46 44 47 // PageOverlay. 45 48 virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect); -
trunk/WebKit2/WebProcess/WebPage/PageOverlay.h
r69616 r69625 51 51 PageOverlay(); 52 52 53 WebPage* webPage() const { return m_webPage; } 54 53 55 private: 54 56 WebPage* m_webPage;
Note: See TracChangeset
for help on using the changeset viewer.