Changeset 84042 in webkit


Ignore:
Timestamp:
Apr 15, 2011 3:31:29 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-04-15 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Fade the find page overlay
https://bugs.webkit.org/show_bug.cgi?id=58697

Add a symbol that WebKit2 needs.

  • WebCore.exp.in:

2011-04-15 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Fade the find page overlay
https://bugs.webkit.org/show_bug.cgi?id=58697

  • WebProcess/WebPage/FindController.cpp: Make the color components floats.

(WebKit::overlayBackgroundColor):
(WebKit::holeShadowColor):
(WebKit::holeFillColor):
Add helper functions for returning the colors given the fraction faded in.

(WebKit::FindController::drawRect):
Use the new helper functions.

  • WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::installPageOverlay): Start the fade animation unless we're replacing an already existing page overlay with another.
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84039 r84042  
     12011-04-15  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Fade the find page overlay
     6        https://bugs.webkit.org/show_bug.cgi?id=58697
     7
     8        Add a symbol that WebKit2 needs.
     9
     10        * WebCore.exp.in:
     11
    1122011-04-15  MORITA Hajime  <morrita@google.com>
    213
  • trunk/Source/WebCore/WebCore.exp.in

    r84029 r84042  
    540540__ZN7WebCore20UserGestureIndicatorD1Ev
    541541__ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
     542__ZN7WebCore20makeRGBA32FromFloatsEffff
    542543__ZN7WebCore21BackForwardController11itemAtIndexEi
    543544__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
  • trunk/Source/WebKit2/ChangeLog

    r84036 r84042  
     12011-04-15  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Fade the find page overlay
     6        https://bugs.webkit.org/show_bug.cgi?id=58697
     7
     8        * WebProcess/WebPage/FindController.cpp:
     9        Make the color components floats.
     10
     11        (WebKit::overlayBackgroundColor):
     12        (WebKit::holeShadowColor):
     13        (WebKit::holeFillColor):
     14        Add helper functions for returning the colors given the fraction faded in.
     15
     16        (WebKit::FindController::drawRect):
     17        Use the new helper functions.
     18
     19        * WebProcess/WebPage/WebPage.cpp:
     20        (WebKit::WebPage::installPageOverlay):
     21        Start the fade animation unless we're replacing an already existing page overlay
     22        with another.
     23
    1242011-04-15  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp

    r84034 r84042  
    271271static const float whiteFrameThickness = 1.0;
    272272
    273 static const int overlayBackgroundRed = 25;
    274 static const int overlayBackgroundGreen = 25;
    275 static const int overlayBackgroundBlue = 25;
    276 static const int overlayBackgroundAlpha = 63;
    277 
    278 static Color overlayBackgroundColor()
    279 {
    280     return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha);
    281 }
    282 
    283 void FindController::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
    284 {
     273static const float overlayBackgroundRed = 0.1;
     274static const float overlayBackgroundGreen = 0.1;
     275static const float overlayBackgroundBlue = 0.1;
     276static const float overlayBackgroundAlpha = 0.25;
     277
     278static Color overlayBackgroundColor(float fractionFadedIn)
     279{
     280    return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha * fractionFadedIn);
     281}
     282
     283static Color holeShadowColor(float fractionFadedIn)
     284{
     285    return Color(0.0f, 0.0f, 0.0f, fractionFadedIn);
     286}
     287
     288static Color holeFillColor(float fractionFadedIn)
     289{
     290    return Color(1.0f, 1.0f, 1.0f, fractionFadedIn);
     291}
     292
     293void FindController::drawRect(PageOverlay* pageOverlay, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
     294{
     295    float fractionFadedIn = pageOverlay->fractionFadedIn();
     296
    285297    Vector<IntRect> rects = rectsForTextMatches();
    286298
    287299    // Draw the background.
    288     graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(), ColorSpaceSRGB);
     300    graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(fractionFadedIn), ColorSpaceSRGB);
    289301
    290302    graphicsContext.save();
    291     graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, Color::black, ColorSpaceSRGB);
    292 
    293     graphicsContext.setFillColor(Color::white, ColorSpaceSRGB);
     303    graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, holeShadowColor(fractionFadedIn), ColorSpaceSRGB);
     304
     305    graphicsContext.setFillColor(holeFillColor(fractionFadedIn), ColorSpaceSRGB);
    294306
    295307    // Draw white frames around the holes.
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r84034 r84042  
    725725void WebPage::installPageOverlay(PassRefPtr<PageOverlay> pageOverlay)
    726726{
    727     if (m_pageOverlay)
    728         pageOverlay->setPage(0);
     727    bool shouldFadeIn = true;
     728   
     729    if (m_pageOverlay) {
     730        m_pageOverlay->setPage(0);
     731
     732        if (pageOverlay) {
     733            // We're installing a page overlay when a page overlay is already active.
     734            // In this case we don't want to fade in the new overlay.
     735            shouldFadeIn = false;
     736        }
     737    }
    729738
    730739    m_pageOverlay = pageOverlay;
    731740    m_pageOverlay->setPage(this);
     741
     742    if (shouldFadeIn)
     743        m_pageOverlay->startFadeInAnimation();
     744
    732745    m_drawingArea->didInstallPageOverlay();
    733746}
Note: See TracChangeset for help on using the changeset viewer.