diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-24 23:46:50 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-24 23:46:50 +0000 |
commit | 884db41554423ec017c57709f92cc2379e0cc02d (patch) | |
tree | 275e81e0c6ab0717912dd4864d91ad719bd2a55c /webkit/port/rendering | |
parent | 498c1a6b2dc98869e0703127565247830227d075 (diff) | |
download | chromium_src-884db41554423ec017c57709f92cc2379e0cc02d.zip chromium_src-884db41554423ec017c57709f92cc2379e0cc02d.tar.gz chromium_src-884db41554423ec017c57709f92cc2379e0cc02d.tar.bz2 |
Find now uses WebKit's TextMatch highlighting for Find-in-page.
This allows us to discard a bunch of code and plumbing related to
maintaining and passing around the tickmark vector.
WebKit now owns the drawing of the highlights for inactive matches and
we use the selection controller to draw the active highlight.
I also simplified the code by eliminating the separate FindNext
function, which has been merged into Find.
This change also requires minor changes to WebKit upstream (sold
seperately, void where prohibited).
It simply consists of adding one empty virtual paint function to
ScrollbarThemeComposite.h (paintTickmarks) and in
ScrollbarThemeComposite::paint call paintTickmarks().
This fixes/makes obsolete a slew of bugs:
BUG=1326399, 1241554,1143991, 1070190, 1023019, 984786, 893737, 868599
... and a couple of external ones as well. Full list:
1326399 Find highlighting disappears on ThinkPad x60s
1241554 Find doesn't highlight word inside blinky tag
1143991 Have find-in-page code use skia and have inspected node highlighting set the right xfermode
1070190 Find should begin searching from caret/selection
1023019 Find not highlighting correctly
984786 Find highlight drawing code causes ClearType text to look bad
893737 Find in page should search textareas
868599 Find in page tick marks incorrectly appear on nested scrollbars
298 Find-In-page should highlight elided entries
4389 Find-in-box is not highlighting all the instances of the search word
3908 Find in page highlighting and tickmarks are broken
Review URL: http://codereview.chromium.org/11364
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5946 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/rendering')
-rw-r--r-- | webkit/port/rendering/RenderThemeWin.cpp | 26 | ||||
-rw-r--r-- | webkit/port/rendering/RenderThemeWin.h | 7 |
2 files changed, 30 insertions, 3 deletions
diff --git a/webkit/port/rendering/RenderThemeWin.cpp b/webkit/port/rendering/RenderThemeWin.cpp index aa6322b..24f6b20 100644 --- a/webkit/port/rendering/RenderThemeWin.cpp +++ b/webkit/port/rendering/RenderThemeWin.cpp @@ -108,6 +108,8 @@ WebCore::FontDescription labelFont; namespace WebCore { +bool RenderThemeWin::m_findInPageMode = false; + // Internal static helper functions. We don't put them in an anonymous // namespace so they have easier access to the WebCore namespace. @@ -331,7 +333,9 @@ bool RenderThemeWin::supportsFocusRing(const RenderStyle* style) const Color RenderThemeWin::platformActiveSelectionBackgroundColor() const { if (ChromiumBridge::layoutTestMode()) - return Color("#0000FF"); // Royal blue + return Color("#0000FF"); // Royal blue. + if (m_findInPageMode) + return Color(255, 150, 50, 200); // Orange. COLORREF color = GetSysColor(COLOR_HIGHLIGHT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255); } @@ -339,7 +343,9 @@ Color RenderThemeWin::platformActiveSelectionBackgroundColor() const Color RenderThemeWin::platformInactiveSelectionBackgroundColor() const { if (ChromiumBridge::layoutTestMode()) - return Color("#999999"); // Medium grey + return Color("#999999"); // Medium gray. + if (m_findInPageMode) + return Color(255, 150, 50, 200); // Orange. COLORREF color = GetSysColor(COLOR_GRAYTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255); } @@ -347,7 +353,7 @@ Color RenderThemeWin::platformInactiveSelectionBackgroundColor() const Color RenderThemeWin::platformActiveSelectionForegroundColor() const { if (ChromiumBridge::layoutTestMode()) - return Color("#FFFFCC"); // Pale yellow + return Color("#FFFFCC"); // Pale yellow. COLORREF color = GetSysColor(COLOR_HIGHLIGHTTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255); } @@ -357,6 +363,11 @@ Color RenderThemeWin::platformInactiveSelectionForegroundColor() const return Color::white; } +Color RenderThemeWin::platformTextSearchHighlightColor() const +{ + return Color(255, 255, 150); +} + double RenderThemeWin::caretBlinkFrequency() const { // Disable the blinking caret in layout test mode, as it introduces @@ -872,4 +883,13 @@ int RenderThemeWin::menuListInternalPadding(RenderStyle* style, int paddingType) return padding; } +// static +void RenderThemeWin::setFindInPageMode(bool enable) { + if (m_findInPageMode == enable) + return; + + m_findInPageMode = enable; + theme()->platformColorsDidChange(); +} + } // namespace WebCore diff --git a/webkit/port/rendering/RenderThemeWin.h b/webkit/port/rendering/RenderThemeWin.h index 2ca8c70..9398cfe 100644 --- a/webkit/port/rendering/RenderThemeWin.h +++ b/webkit/port/rendering/RenderThemeWin.h @@ -57,6 +57,7 @@ public: virtual Color platformInactiveSelectionBackgroundColor() const; virtual Color platformActiveSelectionForegroundColor() const; virtual Color platformInactiveSelectionForegroundColor() const; + virtual Color platformTextSearchHighlightColor() const; virtual double caretBlinkFrequency() const; @@ -118,6 +119,9 @@ public: // the value to get it directly from the appropriate Settings object. static void setDefaultFontSize(int); + // Enables/Disables FindInPage mode, which (if enabled) overrides the + // selection rect color to be orange. + static void setFindInPageMode(bool); private: unsigned determineState(RenderObject*); unsigned determineClassicState(RenderObject*); @@ -130,6 +134,9 @@ private: void getMinimalButtonPadding(Length* minXPadding) const; int menuListInternalPadding(RenderStyle* style, int paddingType) const; + + // A flag specifying whether we are in Find-in-page mode or not. + static bool m_findInPageMode; }; } |