1/* 2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 * THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef TiledBacking_h 27#define TiledBacking_h 28 29namespace WebCore { 30 31static const int defaultTileWidth = 512; 32static const int defaultTileHeight = 512; 33 34class IntRect; 35class PlatformCALayer; 36 37enum ScrollingModeIndication { 38 SynchronousScrollingBecauseOfStyleIndication, 39 SynchronousScrollingBecauseOfEventHandlersIndication, 40 AsyncScrollingIndication 41}; 42 43class TiledBacking { 44public: 45 virtual ~TiledBacking() { } 46 47 virtual void setVisibleRect(const FloatRect&) = 0; 48 virtual FloatRect visibleRect() const = 0; 49 virtual bool tilesWouldChangeForVisibleRect(const FloatRect&) const = 0; 50 51 virtual void setTiledScrollingIndicatorPosition(const FloatPoint&) = 0; 52 virtual void setTopContentInset(float) = 0; 53 54 virtual void prepopulateRect(const FloatRect&) = 0; 55 56 virtual void setIsInWindow(bool) = 0; 57 58 enum { 59 CoverageForVisibleArea = 0, 60 CoverageForVerticalScrolling = 1 << 0, 61 CoverageForHorizontalScrolling = 1 << 1, 62 CoverageForScrolling = CoverageForVerticalScrolling | CoverageForHorizontalScrolling 63 }; 64 typedef unsigned TileCoverage; 65 66 virtual void setTileCoverage(TileCoverage) = 0; 67 virtual TileCoverage tileCoverage() const = 0; 68 69 virtual IntSize tileSize() const = 0; 70 71 virtual void revalidateTiles() = 0; 72 virtual void forceRepaint() = 0; 73 74 virtual void setScrollingPerformanceLoggingEnabled(bool) = 0; 75 virtual bool scrollingPerformanceLoggingEnabled() const = 0; 76 77 virtual void setUnparentsOffscreenTiles(bool) = 0; 78 virtual bool unparentsOffscreenTiles() const = 0; 79 80 virtual double retainedTileBackingStoreMemory() const = 0; 81 82 virtual void setTileMargins(int marginTop, int marginBottom, int marginLeft, int marginRight) = 0; 83 virtual bool hasMargins() const = 0; 84 virtual bool hasHorizontalMargins() const = 0; 85 virtual bool hasVerticalMargins() const = 0; 86 87 virtual int topMarginHeight() const = 0; 88 virtual int bottomMarginHeight() const = 0; 89 virtual int leftMarginWidth() const = 0; 90 virtual int rightMarginWidth() const = 0; 91 92 virtual void setZoomedOutContentsScale(float) = 0; 93 virtual float zoomedOutContentsScale() const = 0; 94 95 // Includes margins. 96 virtual IntRect bounds() const = 0; 97 virtual IntRect boundsWithoutMargin() const = 0; 98 99 // Exposed for testing 100 virtual IntRect tileCoverageRect() const = 0; 101 virtual IntRect tileGridExtent() const = 0; 102 virtual void setScrollingModeIndication(ScrollingModeIndication) = 0; 103 104#if USE(CA) 105 virtual PlatformCALayer* tiledScrollingIndicatorLayer() = 0; 106#endif 107}; 108 109} // namespace WebCore 110 111#endif // TiledBacking_h 112