Log Message
[chromium] Remove unneeded code+fixmes from CCOcclusionTracker https://bugs.webkit.org/show_bug.cgi?id=82380
Patch by Dana Jansens <[email protected]> on 2012-03-29 Reviewed by Adrienne Walker. Source/WebCore: The current occlusion was exposed on the occlusion tracker for the transition over to culling 2.0 which has landed, so we can remove it now. It still had one use in unit tests which is moved to a test subclass. Above test subclass already existed in the occlusion tracker tests, so pulled it out to a common file CCOcclusionTrackerTestCommon.h so that other unit tests can use it to get at occlusion internals. * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: (WebCore): * platform/graphics/chromium/cc/CCOcclusionTracker.h: Source/WebKit/chromium: * WebKit.gypi: * tests/CCLayerTreeHostTest.cpp: (WTF::TestLayerChromium::paintContentsIfDirty): * tests/CCOcclusionTrackerTest.cpp: (WebKitTests::TestCCOcclusionTrackerWithScissor::TestCCOcclusionTrackerWithScissor): (WebKitTests::CCOcclusionTrackerTestIdentityTransforms::runMyTest): (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest): (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest): (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest): (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest): (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest): (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverNothing::runMyTest): (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverNothing::runMyTest): (WebKitTests::CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin::runMyTest): (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionEmpty::runMyTest): (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest): (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest): (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest): (WebKitTests::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest): (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest): (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest): (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest): (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest): * tests/CCOcclusionTrackerTestCommon.h: Added. (WebKitTests): (TestCCOcclusionTrackerBase): (WebKitTests::TestCCOcclusionTrackerBase::TestCCOcclusionTrackerBase): (WebKitTests::TestCCOcclusionTrackerBase::occlusionInScreenSpace): (WebKitTests::TestCCOcclusionTrackerBase::occlusionInTargetSurface): (WebKitTests::TestCCOcclusionTrackerBase::setOcclusionInScreenSpace): (WebKitTests::TestCCOcclusionTrackerBase::setOcclusionInTargetSurface):
Modified Paths
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
- trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h
- trunk/Source/WebKit/chromium/ChangeLog
- trunk/Source/WebKit/chromium/WebKit.gypi
- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
- trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (112547 => 112548)
--- trunk/Source/WebCore/ChangeLog 2012-03-29 18:11:40 UTC (rev 112547)
+++ trunk/Source/WebCore/ChangeLog 2012-03-29 18:14:01 UTC (rev 112548)
@@ -1,3 +1,23 @@
+2012-03-29 Dana Jansens <[email protected]>
+
+ [chromium] Remove unneeded code+fixmes from CCOcclusionTracker
+ https://bugs.webkit.org/show_bug.cgi?id=82380
+
+ Reviewed by Adrienne Walker.
+
+ The current occlusion was exposed on the occlusion tracker for the
+ transition over to culling 2.0 which has landed, so we can remove
+ it now. It still had one use in unit tests which is moved to a
+ test subclass.
+
+ Above test subclass already existed in the occlusion tracker tests,
+ so pulled it out to a common file CCOcclusionTrackerTestCommon.h
+ so that other unit tests can use it to get at occlusion internals.
+
+ * platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
+ (WebCore):
+ * platform/graphics/chromium/cc/CCOcclusionTracker.h:
+
2012-03-29 Joseph Pecoraro <[email protected]>
<http://webkit.org/b/82558> Toggling <input type="range"> readonly or disabled state while active breaks all click events
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp (112547 => 112548)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp 2012-03-29 18:11:40 UTC (rev 112547)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp 2012-03-29 18:14:01 UTC (rev 112548)
@@ -345,21 +345,6 @@
return enclosingIntRect(totalScissor);
}
-template<typename LayerType, typename RenderSurfaceType>
-const Region& CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::currentOcclusionInScreenSpace() const
-{
- ASSERT(!m_stack.isEmpty());
- return m_stack.last().occlusionInScreen;
-}
-
-template<typename LayerType, typename RenderSurfaceType>
-const Region& CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::currentOcclusionInTargetSurface() const
-{
- ASSERT(!m_stack.isEmpty());
- return m_stack.last().occlusionInTarget;
-}
-
-
// Declare the possible functions here for the linker.
template CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::CCOcclusionTrackerBase(IntRect scissorRectInScreenSpace, bool recordMetricsForFrame);
template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::enterTargetRenderSurface(const RenderSurfaceChromium* newTarget);
@@ -368,8 +353,6 @@
template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::markOccludedBehindLayer(const LayerChromium*);
template bool CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::occluded(const LayerChromium*, const IntRect& contentRect) const;
template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContentRect(const LayerChromium*, const IntRect& contentRect) const;
-template const Region& CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::currentOcclusionInScreenSpace() const;
-template const Region& CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::currentOcclusionInTargetSurface() const;
template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::layerScissorRectInTargetSurface(const LayerChromium*) const;
template CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::CCOcclusionTrackerBase(IntRect scissorRectInScreenSpace, bool recordMetricsForFrame);
@@ -379,8 +362,6 @@
template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::markOccludedBehindLayer(const CCLayerImpl*);
template bool CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::occluded(const CCLayerImpl*, const IntRect& contentRect) const;
template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContentRect(const CCLayerImpl*, const IntRect& contentRect) const;
-template const Region& CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::currentOcclusionInScreenSpace() const;
-template const Region& CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::currentOcclusionInTargetSurface() const;
template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::layerScissorRectInTargetSurface(const CCLayerImpl*) const;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h (112547 => 112548)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h 2012-03-29 18:11:40 UTC (rev 112547)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h 2012-03-29 18:14:01 UTC (rev 112548)
@@ -73,10 +73,6 @@
// FIXME: Remove this when paint tracking is on for paint culling.
void setUsePaintTracking(bool use) { m_usePaintTracking = use; }
- // FIXME: Remove these in future, they are to make CLs for transitioning to this easier.
- const Region& currentOcclusionInScreenSpace() const;
- const Region& currentOcclusionInTargetSurface() const;
-
protected:
struct StackObject {
StackObject() : surface(0) { }
Modified: trunk/Source/WebKit/chromium/ChangeLog (112547 => 112548)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-29 18:11:40 UTC (rev 112547)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-29 18:14:01 UTC (rev 112548)
@@ -1,3 +1,52 @@
+2012-03-29 Dana Jansens <[email protected]>
+
+ [chromium] Remove unneeded code+fixmes from CCOcclusionTracker
+ https://bugs.webkit.org/show_bug.cgi?id=82380
+
+ Reviewed by Adrienne Walker.
+
+ * WebKit.gypi:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestLayerChromium::paintContentsIfDirty):
+ * tests/CCOcclusionTrackerTest.cpp:
+ (WebKitTests::TestCCOcclusionTrackerWithScissor::TestCCOcclusionTrackerWithScissor):
+ (WebKitTests::CCOcclusionTrackerTestIdentityTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestRotatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestTranslatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOutsideChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOutsideChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectPartlyOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectPartlyOverChild::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectOverNothing::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestScreenScissorRectOverNothing::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestLayerScissorRectForLayerOffOrigin::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionEmpty::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTest3dTransform::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestPerspectiveTransform::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestPerspectiveTransformBehindCamera::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity1OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationOpacity0OnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestAnimationTranslateOnMainThread::runMyTest):
+ (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest):
+ * tests/CCOcclusionTrackerTestCommon.h: Added.
+ (WebKitTests):
+ (TestCCOcclusionTrackerBase):
+ (WebKitTests::TestCCOcclusionTrackerBase::TestCCOcclusionTrackerBase):
+ (WebKitTests::TestCCOcclusionTrackerBase::occlusionInScreenSpace):
+ (WebKitTests::TestCCOcclusionTrackerBase::occlusionInTargetSurface):
+ (WebKitTests::TestCCOcclusionTrackerBase::setOcclusionInScreenSpace):
+ (WebKitTests::TestCCOcclusionTrackerBase::setOcclusionInTargetSurface):
+
2012-03-29 Dirk Schulze <[email protected]>
Introduce CSSParserMode in all classes
Modified: trunk/Source/WebKit/chromium/WebKit.gypi (112547 => 112548)
--- trunk/Source/WebKit/chromium/WebKit.gypi 2012-03-29 18:11:40 UTC (rev 112547)
+++ trunk/Source/WebKit/chromium/WebKit.gypi 2012-03-29 18:14:01 UTC (rev 112548)
@@ -79,6 +79,7 @@
'tests/CCLayerTreeHostTest.cpp',
'tests/CCLayerTreeTestCommon.h',
'tests/CCOcclusionTrackerTest.cpp',
+ 'tests/CCOcclusionTrackerTestCommon.h',
'tests/CCQuadCullerTest.cpp',
'tests/CCRenderSurfaceTest.cpp',
'tests/CCSchedulerStateMachineTest.cpp',
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (112547 => 112548)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-03-29 18:11:40 UTC (rev 112547)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-03-29 18:14:01 UTC (rev 112548)
@@ -27,6 +27,7 @@
#include "cc/CCLayerTreeHost.h"
#include "CCAnimationTestCommon.h"
+#include "CCOcclusionTrackerTestCommon.h"
#include "CompositorFakeWebGraphicsContext3D.h"
#include "ContentLayerChromium.h"
#include "FilterOperations.h"
@@ -1756,7 +1757,9 @@
virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion)
{
- m_occludedScreenSpace = occlusion ? occlusion->currentOcclusionInScreenSpace() : Region();
+ // Gain access to internals of the CCOcclusionTracker.
+ const TestCCOcclusionTracker* testOcclusion = static_cast<const TestCCOcclusionTracker*>(occlusion);
+ m_occludedScreenSpace = testOcclusion ? testOcclusion->occlusionInScreenSpace() : Region();
}
virtual bool drawsContent() const { return true; }
Modified: trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp (112547 => 112548)
--- trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp 2012-03-29 18:11:40 UTC (rev 112547)
+++ trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp 2012-03-29 18:14:01 UTC (rev 112548)
@@ -27,6 +27,7 @@
#include "cc/CCOcclusionTracker.h"
#include "CCAnimationTestCommon.h"
+#include "CCOcclusionTrackerTestCommon.h"
#include "FilterOperations.h"
#include "LayerChromium.h"
#include "Region.h"
@@ -73,22 +74,15 @@
IntRect m_opaqueContentsRect;
};
-// A subclass to expose the total current occlusion.
template<typename LayerType, typename RenderSurfaceType>
-class TestCCOcclusionTrackerBase : public CCOcclusionTrackerBase<LayerType, RenderSurfaceType> {
+class TestCCOcclusionTrackerWithScissor : public TestCCOcclusionTrackerBase<LayerType, RenderSurfaceType> {
public:
- TestCCOcclusionTrackerBase(IntRect screenScissorRect, bool recordMetricsForFrame = false)
- : CCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame)
+ TestCCOcclusionTrackerWithScissor(IntRect screenScissorRect, bool recordMetricsForFrame = false)
+ : TestCCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame)
, m_overrideLayerScissorRect(false)
{
}
- Region occlusionInScreenSpace() const { return CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen; }
- Region occlusionInTargetSurface() const { return CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget; }
-
- void setOcclusionInScreenSpace(const Region& region) { CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen = region; }
- void setOcclusionInTargetSurface(const Region& region) { CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget = region; }
-
void setLayerScissorRect(const IntRect& rect) { m_overrideLayerScissorRect = true; m_layerScissorRect = rect;}
void useDefaultLayerScissorRect() { m_overrideLayerScissorRect = false; }
@@ -315,7 +309,7 @@
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(parent->renderSurface());
@@ -367,7 +361,7 @@
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(parent->renderSurface());
@@ -417,7 +411,7 @@
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(parent->renderSurface());
@@ -483,7 +477,7 @@
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(child->renderSurface());
@@ -580,7 +574,7 @@
typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(-10, -10, 1000, 1000));
occlusion.enterTargetRenderSurface(parent->renderSurface());
@@ -727,7 +721,7 @@
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
IntRect clippedLayerInChild = layerTransform.mapRect(layer->visibleLayerRect());
@@ -792,7 +786,7 @@
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(child->renderSurface());
@@ -881,7 +875,7 @@
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(-20, -20, 1000, 1000));
occlusion.enterTargetRenderSurface(child2->renderSurface());
@@ -992,7 +986,7 @@
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(-30, -30, 1000, 1000));
occlusion.enterTargetRenderSurface(child2->renderSurface());
@@ -1098,7 +1092,7 @@
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
// Opacity layer won't contribute to occlusion.
@@ -1162,7 +1156,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(200, 100, 100, 100));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1205,7 +1199,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1248,7 +1242,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(100, 100, 100, 100));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1286,7 +1280,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1324,7 +1318,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(50, 50, 200, 200));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1366,7 +1360,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1408,7 +1402,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.setLayerScissorRect(IntRect(500, 500, 100, 100));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1450,7 +1444,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100));
occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(layer->renderSurface());
@@ -1492,7 +1486,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(layer->renderSurface());
// This layer is translated when drawn into its target. So if the scissor rect given from the target surface
@@ -1516,7 +1510,7 @@
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(layer->renderSurface());
EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100)));
@@ -1552,7 +1546,7 @@
this->calcDrawEtc(parent);
{
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100));
occlusion.enterTargetRenderSurface(parent->renderSurface());
@@ -1567,7 +1561,7 @@
}
{
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180));
occlusion.enterTargetRenderSurface(parent->renderSurface());
@@ -1582,7 +1576,7 @@
}
{
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100));
occlusion.enterTargetRenderSurface(parent->renderSurface());
@@ -1613,7 +1607,7 @@
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(parent->renderSurface());
EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200)));
@@ -1639,7 +1633,7 @@
container->setPreserves3D(true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(parent->renderSurface());
EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200)));
@@ -1668,7 +1662,7 @@
container->setPreserves3D(true);
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(parent->renderSurface());
// The bottom 11 pixel rows of this layer remain visible inside the container, after translation to the target surface. When translated back,
@@ -1698,7 +1692,7 @@
EXPECT_FALSE(surface->drawOpacityIsAnimating());
EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(surface->renderSurface());
occlusion.markOccludedBehindLayer(surfaceChild2);
@@ -1739,7 +1733,7 @@
EXPECT_FALSE(surface->drawOpacityIsAnimating());
EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(surface->renderSurface());
occlusion.markOccludedBehindLayer(surfaceChild2);
@@ -1788,7 +1782,7 @@
EXPECT_TRUE(surfaceChild->drawTransformIsAnimating());
EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating());
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(surface2->renderSurface());
occlusion.markOccludedBehindLayer(surface2);
@@ -1864,7 +1858,7 @@
surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
this->calcDrawEtc(parent);
- TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
occlusion.enterTargetRenderSurface(surface2->renderSurface());
occlusion.markOccludedBehindLayer(surface2);
Added: trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h (0 => 112548)
--- trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h (rev 0)
+++ trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTestCommon.h 2012-03-29 18:14:01 UTC (rev 112548)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CCOcclusionTrackerTestCommon_h
+#define CCOcclusionTrackerTestCommon_h
+
+#include "IntRect.h"
+#include "Region.h"
+#include "RenderSurfaceChromium.h"
+#include "cc/CCOcclusionTracker.h"
+#include "cc/CCRenderSurface.h"
+
+namespace WebKitTests {
+
+// A subclass to expose the total current occlusion.
+template<typename LayerType, typename RenderSurfaceType>
+class TestCCOcclusionTrackerBase : public WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType> {
+public:
+ TestCCOcclusionTrackerBase(WebCore::IntRect screenScissorRect, bool recordMetricsForFrame = false)
+ : WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame)
+ {
+ }
+
+ WebCore::Region occlusionInScreenSpace() const { return WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen; }
+ WebCore::Region occlusionInTargetSurface() const { return WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget; }
+
+ void setOcclusionInScreenSpace(const WebCore::Region& region) { WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInScreen = region; }
+ void setOcclusionInTargetSurface(const WebCore::Region& region) { WebCore::CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::m_stack.last().occlusionInTarget = region; }
+};
+
+typedef TestCCOcclusionTrackerBase<WebCore::LayerChromium, WebCore::RenderSurfaceChromium> TestCCOcclusionTracker;
+typedef TestCCOcclusionTrackerBase<WebCore::CCLayerImpl, WebCore::CCRenderSurface> TestCCOcclusionTrackerImpl;
+
+}
+
+#endif // CCOcclusionTrackerTestCommon_h
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes
