Title: [106158] trunk/Source/WebCore
Revision
106158
Author
[email protected]
Date
2012-01-27 15:13:59 -0800 (Fri, 27 Jan 2012)

Log Message

[chromium] CCLayerTreeHostImpl minor code cleanup
https://bugs.webkit.org/show_bug.cgi?id=77181

Fix a typo in comments and group functions properly.
Replace duplicated content size code with function.

Patch by Tien-Ren Chen <[email protected]> on 2012-01-27
Reviewed by James Robinson.

No new tests. No change in behavior.

* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::startPageScaleAnimation):
(WebCore::CCLayerTreeHostImpl::contentSize):
(WebCore):
(WebCore::CCLayerTreeHostImpl::updateMaxScrollPosition):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(CCLayerTreeHostImpl):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106157 => 106158)


--- trunk/Source/WebCore/ChangeLog	2012-01-27 23:06:33 UTC (rev 106157)
+++ trunk/Source/WebCore/ChangeLog	2012-01-27 23:13:59 UTC (rev 106158)
@@ -1,3 +1,23 @@
+2012-01-27  Tien-Ren Chen  <[email protected]>
+
+        [chromium] CCLayerTreeHostImpl minor code cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=77181
+
+        Fix a typo in comments and group functions properly.
+        Replace duplicated content size code with function.
+
+        Reviewed by James Robinson.
+
+        No new tests. No change in behavior.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+        (WebCore::CCLayerTreeHostImpl::startPageScaleAnimation):
+        (WebCore::CCLayerTreeHostImpl::contentSize):
+        (WebCore):
+        (WebCore::CCLayerTreeHostImpl::updateMaxScrollPosition):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
+        (CCLayerTreeHostImpl):
+
 2012-01-27  Kevin Ollivier  <[email protected]>
 
         [wx] Unreviewed. Build fix, add missing header.

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (106157 => 106158)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2012-01-27 23:06:33 UTC (rev 106157)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2012-01-27 23:13:59 UTC (rev 106158)
@@ -122,7 +122,7 @@
     IntSize scrollTotal = toSize(m_scrollLayerImpl->scrollPosition() + m_scrollLayerImpl->scrollDelta());
     scrollTotal.scale(m_pageScaleDelta);
     float scaleTotal = m_pageScale * m_pageScaleDelta;
-    IntSize scaledContentSize = m_scrollLayerImpl->children()[0]->contentBounds();
+    IntSize scaledContentSize = contentSize();
     scaledContentSize.scale(m_pageScaleDelta);
 
     m_pageScaleAnimation = CCPageScaleAnimation::create(scrollTotal, scaleTotal, m_viewportSize, scaledContentSize, startTimeMs);
@@ -244,6 +244,15 @@
         passes[i]->optimizeQuads();
 }
 
+IntSize CCLayerTreeHostImpl::contentSize() const
+{
+    // TODO(aelias): Hardcoding the first child here is weird. Think of
+    // a cleaner way to get the contentBounds on the Impl side.
+    if (!m_scrollLayerImpl || m_scrollLayerImpl->children().isEmpty())
+        return IntSize();
+    return m_scrollLayerImpl->children()[0]->contentBounds();
+}
+
 void CCLayerTreeHostImpl::drawLayers()
 {
     TRACE_EVENT("CCLayerTreeHostImpl::drawLayers", this, 0);
@@ -440,9 +449,7 @@
     FloatSize viewBounds = m_viewportSize;
     viewBounds.scale(1 / m_pageScaleDelta);
 
-    // TODO(aelias): Hardcoding the first child here is weird. Think of
-    // a cleaner way to get the contentBounds on the Impl side.
-    IntSize maxScroll = m_scrollLayerImpl->children()[0]->contentBounds() - expandedIntSize(viewBounds);
+    IntSize maxScroll = contentSize() - expandedIntSize(viewBounds);
     // The viewport may be larger than the contents in some cases, such as
     // having a vertical scrollbar but no horizontal overflow.
     maxScroll.clampNegativeToZero();

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h (106157 => 106158)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h	2012-01-27 23:06:33 UTC (rev 106157)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h	2012-01-27 23:13:59 UTC (rev 106158)
@@ -61,7 +61,7 @@
     static PassOwnPtr<CCLayerTreeHostImpl> create(const CCSettings&, CCLayerTreeHostImplClient*);
     virtual ~CCLayerTreeHostImpl();
 
-    // CCInputHandlerTarget implementation
+    // CCInputHandlerClient implementation
     virtual void setNeedsRedraw();
     virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&);
     virtual void scrollBy(const IntSize&);
@@ -70,6 +70,7 @@
     virtual void pinchGestureBegin();
     virtual void pinchGestureUpdate(float, const IntPoint&);
     virtual void pinchGestureEnd();
+    virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anchorPoint, float pageScale, double startTimeMs, double durationMs);
 
     // Virtual for testing
     virtual void beginCommit();
@@ -112,8 +113,6 @@
     void setPageScaleFactorAndLimits(float pageScale, float minPageScale, float maxPageScale);
     float pageScale() const { return m_pageScale; }
 
-    void startPageScaleAnimation(const IntSize& targetPosition, bool anchorPoint, float pageScale, double startTimeMs, double durationMs);
-
     const CCSettings& settings() const { return m_settings; }
 
     PassOwnPtr<CCScrollAndScaleSet> processScrollDeltas();
@@ -134,6 +133,7 @@
     void trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList);
     void calculateRenderPasses(CCRenderPassList&);
     void optimizeRenderPasses(CCRenderPassList&);
+    IntSize contentSize() const;
 
     OwnPtr<LayerRendererChromium> m_layerRenderer;
     RefPtr<CCLayerImpl> m_rootLayerImpl;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to