diff options
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/platform/chromium/ScrollbarThemeChromium.cpp | 45 | ||||
-rw-r--r-- | webkit/port/platform/chromium/ScrollbarThemeChromium.h | 1 | ||||
-rw-r--r-- | webkit/port/rendering/RenderThemeWin.cpp | 26 | ||||
-rw-r--r-- | webkit/port/rendering/RenderThemeWin.h | 7 |
4 files changed, 76 insertions, 3 deletions
diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp b/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp index 0cbf018..f9d961c 100644 --- a/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp +++ b/webkit/port/platform/chromium/ScrollbarThemeChromium.cpp @@ -28,6 +28,8 @@ #include "ChromiumBridge.h" #include "PlatformMouseEvent.h" +#include "Frame.h" +#include "FrameView.h" #include "Scrollbar.h" #include "ScrollbarThemeComposite.h" @@ -112,6 +114,49 @@ void ScrollbarThemeChromium::paintTrackBackground(GraphicsContext* context, Scro paintTrackPiece(context, scrollbar, rect, ForwardTrackPart); } +void ScrollbarThemeChromium::paintTickmarks(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect) +{ + if (scrollbar->orientation() != VerticalScrollbar) + return; + + if (rect.height() <= 0 || rect.width() <= 0) + return; // nothing to draw on. + + // Get the frameview. + // FIXME: Stop relying on high-level WebCore types such as Frame and FrameView. + if (!scrollbar->parent()->isFrameView()) + return; + FrameView* frameView = static_cast<FrameView*>(scrollbar->parent()); + Document* doc = frameView->frame()->document(); + + // Get the text markers for the frameview. + Vector<IntRect> markers = doc->renderedRectsForMarkers(DocumentMarker::TextMatch); + if (!markers.size()) + return; + + // Get the image for the tickmarks. + static RefPtr<Image> dash = Image::loadPlatformResource("tickmarkDash"); + if (dash->isNull()) { + ASSERT_NOT_REACHED(); + return; + } + + context->save(); + + for (Vector<IntRect>::const_iterator i = markers.begin(); i != markers.end(); ++i) { + // Calculate how far down (in %) the tick-mark should appear. + const float percent = static_cast<float>(i->y()) / scrollbar->totalSize(); + + // Calculate how far down (in pixels) the tick-mark should appear. + const int yPos = rect.topLeft().y() + (rect.height() * percent); + + IntPoint tick(scrollbar->x(), yPos); + context->drawImage(dash.get(), tick); + } + + context->restore(); +} + void ScrollbarThemeChromium::paintScrollCorner(ScrollView* view, GraphicsContext* context, const IntRect& cornerRect) { // ScrollbarThemeComposite::paintScrollCorner incorrectly assumes that the diff --git a/webkit/port/platform/chromium/ScrollbarThemeChromium.h b/webkit/port/platform/chromium/ScrollbarThemeChromium.h index f75b052..c198222 100644 --- a/webkit/port/platform/chromium/ScrollbarThemeChromium.h +++ b/webkit/port/platform/chromium/ScrollbarThemeChromium.h @@ -65,6 +65,7 @@ protected: virtual void paintTrackPiece(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart); virtual void paintButton(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart); virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&); + virtual void paintTickmarks(GraphicsContext*, Scrollbar*, const IntRect&); private: IntSize buttonSize(Scrollbar*); 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; }; } |