<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183716] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183716">183716</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-05-02 08:32:10 -0700 (Sat, 02 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Small cleanup in BitmapImage
https://bugs.webkit.org/show_bug.cgi?id=144515
Reviewed by Darin Adler.
Use an enum for the internalAdvanceAnimation() argument, with a default.
Wrap the clearing of the timer in a clearTimer() function, called from
stopAnimation(). This fixes the jarring reading of BitmapImage::internalAdvanceAnimation(),
which used to start by calling stopAnimation().
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::clearTimer):
(WebCore::BitmapImage::startAnimation):
(WebCore::BitmapImage::stopAnimation):
(WebCore::BitmapImage::advanceAnimation):
(WebCore::BitmapImage::internalAdvanceAnimation):
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsBitmapImagecpp">trunk/Source/WebCore/platform/graphics/BitmapImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsBitmapImageh">trunk/Source/WebCore/platform/graphics/BitmapImage.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsImageh">trunk/Source/WebCore/platform/graphics/Image.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183715 => 183716)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-02 15:28:24 UTC (rev 183715)
+++ trunk/Source/WebCore/ChangeLog        2015-05-02 15:32:10 UTC (rev 183716)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-05-02 Simon Fraser <simon.fraser@apple.com>
+
+ Small cleanup in BitmapImage
+ https://bugs.webkit.org/show_bug.cgi?id=144515
+
+ Reviewed by Darin Adler.
+
+ Use an enum for the internalAdvanceAnimation() argument, with a default.
+
+ Wrap the clearing of the timer in a clearTimer() function, called from
+ stopAnimation(). This fixes the jarring reading of BitmapImage::internalAdvanceAnimation(),
+ which used to start by calling stopAnimation().
+
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::clearTimer):
+ (WebCore::BitmapImage::startAnimation):
+ (WebCore::BitmapImage::stopAnimation):
+ (WebCore::BitmapImage::advanceAnimation):
+ (WebCore::BitmapImage::internalAdvanceAnimation):
+ * platform/graphics/BitmapImage.h:
+ * platform/graphics/Image.h:
+
</ins><span class="cx"> 2015-05-01 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Avoid compositing updates after style recalcs which have no compositing implications
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsBitmapImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (183715 => 183716)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp        2015-05-02 15:28:24 UTC (rev 183715)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp        2015-05-02 15:32:10 UTC (rev 183716)
</span><span class="lines">@@ -83,6 +83,11 @@
</span><span class="cx"> stopAnimation();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void BitmapImage::clearTimer()
+{
+ m_frameTimer = nullptr;
+}
+
</ins><span class="cx"> #if !USE(CG)
</span><span class="cx"> bool BitmapImage::decodedDataIsPurgeable() const
</span><span class="cx"> {
</span><span class="lines">@@ -554,7 +559,7 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> // Yes; skip over it without notifying our observers.
</span><del>- if (!internalAdvanceAnimation(true))
</del><ins>+ if (!internalAdvanceAnimation(SkippingFramesToCatchUp))
</ins><span class="cx"> return;
</span><span class="cx"> m_desiredFrameStartTime = frameAfterNextStartTime;
</span><span class="cx"> nextFrame = frameAfterNext;
</span><span class="lines">@@ -564,7 +569,7 @@
</span><span class="cx"> // may be in the past, meaning the next time through this function we'll
</span><span class="cx"> // kick off the next advancement sooner than this frame's duration would
</span><span class="cx"> // suggest.
</span><del>- if (internalAdvanceAnimation(false)) {
</del><ins>+ if (internalAdvanceAnimation()) {
</ins><span class="cx"> // The image region has been marked dirty, but once we return to our
</span><span class="cx"> // caller, draw() will clear it, and nothing will cause the
</span><span class="cx"> // animation to advance again. We need to start the timer for the
</span><span class="lines">@@ -590,7 +595,7 @@
</span><span class="cx"> {
</span><span class="cx"> // This timer is used to animate all occurrences of this image. Don't invalidate
</span><span class="cx"> // the timer unless all renderers have stopped drawing.
</span><del>- m_frameTimer = nullptr;
</del><ins>+ clearTimer();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void BitmapImage::resetAnimation()
</span><span class="lines">@@ -643,16 +648,15 @@
</span><span class="cx">
</span><span class="cx"> void BitmapImage::advanceAnimation()
</span><span class="cx"> {
</span><del>- internalAdvanceAnimation(false);
</del><ins>+ internalAdvanceAnimation();
</ins><span class="cx"> // At this point the image region has been marked dirty, and if it's
</span><span class="cx"> // onscreen, we'll soon make a call to draw(), which will call
</span><span class="cx"> // startAnimation() again to keep the animation moving.
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool BitmapImage::internalAdvanceAnimation(bool skippingFrames)
</del><ins>+bool BitmapImage::internalAdvanceAnimation(AnimationAdvancement advancement)
</ins><span class="cx"> {
</span><del>- // Stop the animation.
- stopAnimation();
</del><ins>+ clearTimer();
</ins><span class="cx">
</span><span class="cx"> ++m_currentFrame;
</span><span class="cx"> bool advancedAnimation = true;
</span><span class="lines">@@ -679,8 +683,9 @@
</span><span class="cx">
</span><span class="cx"> // We need to draw this frame if we advanced to it while not skipping, or if
</span><span class="cx"> // while trying to skip frames we hit the last frame and thus had to stop.
</span><del>- if (skippingFrames != advancedAnimation)
</del><ins>+ if ((advancement == Normal && advancedAnimation) || (advancement == SkippingFramesToCatchUp && !advancedAnimation))
</ins><span class="cx"> imageObserver()->animationAdvanced(this);
</span><ins>+
</ins><span class="cx"> return advancedAnimation;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsBitmapImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (183715 => 183716)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/BitmapImage.h        2015-05-02 15:28:24 UTC (rev 183715)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h        2015-05-02 15:32:10 UTC (rev 183716)
</span><span class="lines">@@ -265,7 +265,8 @@
</span><span class="cx"> // a bunch of animation frames, so we should not do things like decode each
</span><span class="cx"> // one or notify our observers.
</span><span class="cx"> // Returns whether the animation was advanced.
</span><del>- bool internalAdvanceAnimation(bool skippingFrames);
</del><ins>+ enum AnimationAdvancement { Normal, SkippingFramesToCatchUp };
+ bool internalAdvanceAnimation(AnimationAdvancement = Normal);
</ins><span class="cx">
</span><span class="cx"> // Handle platform-specific data
</span><span class="cx"> void invalidatePlatformData();
</span><span class="lines">@@ -284,6 +285,7 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> virtual bool decodedDataIsPurgeable() const override;
</span><ins>+ void clearTimer();
</ins><span class="cx">
</span><span class="cx"> ImageSource m_source;
</span><span class="cx"> mutable IntSize m_size; // The size to use for the overall image (will just be the size of the first image).
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Image.h (183715 => 183716)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Image.h        2015-05-02 15:28:24 UTC (rev 183715)
+++ trunk/Source/WebCore/platform/graphics/Image.h        2015-05-02 15:32:10 UTC (rev 183716)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> public:
</span><span class="cx"> virtual ~Image();
</span><span class="cx">
</span><del>- static PassRefPtr<Image> create(ImageObserver* = 0);
</del><ins>+ static PassRefPtr<Image> create(ImageObserver* = nullptr);
</ins><span class="cx"> WEBCORE_EXPORT static PassRefPtr<Image> loadPlatformResource(const char* name);
</span><span class="cx"> WEBCORE_EXPORT static bool supportsType(const String&);
</span><span class="cx">
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx"> m_space = space;
</span><span class="cx"> }
</span><span class="cx"> protected:
</span><del>- Image(ImageObserver* = 0);
</del><ins>+ Image(ImageObserver* = nullptr);
</ins><span class="cx">
</span><span class="cx"> static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, const Color&, ColorSpace styleColorSpace, CompositeOperator);
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>