Skip to content

Commit 17204c2

Browse files
author
Anders Carlsson
committed
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. Canonical link: https://commits.webkit.org/73783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84042 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3a4c621 commit 17204c2

5 files changed

Lines changed: 72 additions & 12 deletions

File tree

Source/WebCore/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2011-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+
112
2011-04-15 MORITA Hajime <morrita@google.com>
213

314
Reviewed by Dimitri Glazkov.

Source/WebCore/WebCore.exp.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ __ZN7WebCore20SpaceSplitStringData12createVectorEv
539539
__ZN7WebCore20UserGestureIndicatorC1ENS_26ProcessingUserGestureStateE
540540
__ZN7WebCore20UserGestureIndicatorD1Ev
541541
__ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
542+
__ZN7WebCore20makeRGBA32FromFloatsEffff
542543
__ZN7WebCore21BackForwardController11itemAtIndexEi
543544
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
544545
__ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent

Source/WebKit2/ChangeLog

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2011-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+
124
2011-04-15 Anders Carlsson <andersca@apple.com>
225

326
Fix Windows build.

Source/WebKit2/WebProcess/WebPage/FindController.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,27 +270,39 @@ static const float shadowOffsetY = 1.0;
270270
static const float shadowBlurRadius = 2.0;
271271
static 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;
273+
static const float overlayBackgroundRed = 0.1;
274+
static const float overlayBackgroundGreen = 0.1;
275+
static const float overlayBackgroundBlue = 0.1;
276+
static const float overlayBackgroundAlpha = 0.25;
277277

278-
static Color overlayBackgroundColor()
278+
static Color overlayBackgroundColor(float fractionFadedIn)
279279
{
280-
return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha);
280+
return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha * fractionFadedIn);
281281
}
282282

283-
void FindController::drawRect(PageOverlay*, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
283+
static Color holeShadowColor(float fractionFadedIn)
284284
{
285+
return Color(0.0f, 0.0f, 0.0f, fractionFadedIn);
286+
}
287+
288+
static Color holeFillColor(float fractionFadedIn)
289+
{
290+
return Color(1.0f, 1.0f, 1.0f, fractionFadedIn);
291+
}
292+
293+
void 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);
303+
graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, holeShadowColor(fractionFadedIn), ColorSpaceSRGB);
292304

293-
graphicsContext.setFillColor(Color::white, ColorSpaceSRGB);
305+
graphicsContext.setFillColor(holeFillColor(fractionFadedIn), ColorSpaceSRGB);
294306

295307
// Draw white frames around the holes.
296308
for (size_t i = 0; i < rects.size(); ++i) {

Source/WebKit2/WebProcess/WebPage/WebPage.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,24 @@ void WebPage::setFixedLayoutSize(const IntSize& size)
724724

725725
void 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
}
734747

0 commit comments

Comments
 (0)