Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /*-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef NSDISPLAYLISTINVALIDATION_H_ |
michael@0 | 7 | #define NSDISPLAYLISTINVALIDATION_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | #include "nsRect.h" |
michael@0 | 11 | #include "nsColor.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsDisplayItem; |
michael@0 | 14 | class nsDisplayListBuilder; |
michael@0 | 15 | class nsDisplayBackgroundImage; |
michael@0 | 16 | class nsDisplayThemedBackground; |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * This stores the geometry of an nsDisplayItem, and the area |
michael@0 | 20 | * that will be affected when painting the item. |
michael@0 | 21 | * |
michael@0 | 22 | * It is used to retain information about display items so they |
michael@0 | 23 | * can be compared against new display items in the next paint. |
michael@0 | 24 | */ |
michael@0 | 25 | class nsDisplayItemGeometry |
michael@0 | 26 | { |
michael@0 | 27 | public: |
michael@0 | 28 | nsDisplayItemGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder); |
michael@0 | 29 | virtual ~nsDisplayItemGeometry(); |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * Compute the area required to be invalidated if this |
michael@0 | 33 | * display item is removed. |
michael@0 | 34 | */ |
michael@0 | 35 | const nsRect& ComputeInvalidationRegion() { return mBounds; } |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * Shifts all retained areas of the nsDisplayItemGeometry by the given offset. |
michael@0 | 39 | * |
michael@0 | 40 | * This is used to compensate for scrolling, since the destination buffer |
michael@0 | 41 | * can scroll without requiring a full repaint. |
michael@0 | 42 | * |
michael@0 | 43 | * @param aOffset Offset to shift by. |
michael@0 | 44 | */ |
michael@0 | 45 | virtual void MoveBy(const nsPoint& aOffset) = 0; |
michael@0 | 46 | |
michael@0 | 47 | /** |
michael@0 | 48 | * Bounds of the display item |
michael@0 | 49 | */ |
michael@0 | 50 | nsRect mBounds; |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * A default geometry implementation, used by nsDisplayItem. Retains |
michael@0 | 55 | * and compares the bounds, and border rect. |
michael@0 | 56 | * |
michael@0 | 57 | * This should be sufficient for the majority of display items. |
michael@0 | 58 | */ |
michael@0 | 59 | class nsDisplayItemGenericGeometry : public nsDisplayItemGeometry |
michael@0 | 60 | { |
michael@0 | 61 | public: |
michael@0 | 62 | nsDisplayItemGenericGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder); |
michael@0 | 63 | |
michael@0 | 64 | virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE; |
michael@0 | 65 | |
michael@0 | 66 | nsRect mBorderRect; |
michael@0 | 67 | }; |
michael@0 | 68 | |
michael@0 | 69 | class nsDisplayItemBoundsGeometry : public nsDisplayItemGeometry |
michael@0 | 70 | { |
michael@0 | 71 | public: |
michael@0 | 72 | nsDisplayItemBoundsGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder); |
michael@0 | 73 | |
michael@0 | 74 | virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE; |
michael@0 | 75 | |
michael@0 | 76 | bool mHasRoundedCorners; |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | class nsDisplayBorderGeometry : public nsDisplayItemGeometry |
michael@0 | 80 | { |
michael@0 | 81 | public: |
michael@0 | 82 | nsDisplayBorderGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder); |
michael@0 | 83 | |
michael@0 | 84 | virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE; |
michael@0 | 85 | |
michael@0 | 86 | nsRect mContentRect; |
michael@0 | 87 | }; |
michael@0 | 88 | |
michael@0 | 89 | class nsDisplayBackgroundGeometry : public nsDisplayItemGeometry |
michael@0 | 90 | { |
michael@0 | 91 | public: |
michael@0 | 92 | nsDisplayBackgroundGeometry(nsDisplayBackgroundImage* aItem, nsDisplayListBuilder* aBuilder); |
michael@0 | 93 | |
michael@0 | 94 | virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE; |
michael@0 | 95 | |
michael@0 | 96 | nsRect mPositioningArea; |
michael@0 | 97 | }; |
michael@0 | 98 | |
michael@0 | 99 | class nsDisplayThemedBackgroundGeometry : public nsDisplayItemGeometry |
michael@0 | 100 | { |
michael@0 | 101 | public: |
michael@0 | 102 | nsDisplayThemedBackgroundGeometry(nsDisplayThemedBackground* aItem, nsDisplayListBuilder* aBuilder); |
michael@0 | 103 | |
michael@0 | 104 | virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE; |
michael@0 | 105 | |
michael@0 | 106 | nsRect mPositioningArea; |
michael@0 | 107 | bool mWindowIsActive; |
michael@0 | 108 | }; |
michael@0 | 109 | |
michael@0 | 110 | class nsDisplayBoxShadowInnerGeometry : public nsDisplayItemGeometry |
michael@0 | 111 | { |
michael@0 | 112 | public: |
michael@0 | 113 | nsDisplayBoxShadowInnerGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder); |
michael@0 | 114 | |
michael@0 | 115 | virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE; |
michael@0 | 116 | |
michael@0 | 117 | nsRect mPaddingRect; |
michael@0 | 118 | }; |
michael@0 | 119 | |
michael@0 | 120 | class nsDisplaySolidColorGeometry : public nsDisplayItemBoundsGeometry |
michael@0 | 121 | { |
michael@0 | 122 | public: |
michael@0 | 123 | nsDisplaySolidColorGeometry(nsDisplayItem* aItem, |
michael@0 | 124 | nsDisplayListBuilder* aBuilder, |
michael@0 | 125 | nscolor aColor) |
michael@0 | 126 | : nsDisplayItemBoundsGeometry(aItem, aBuilder) |
michael@0 | 127 | , mColor(aColor) |
michael@0 | 128 | { } |
michael@0 | 129 | |
michael@0 | 130 | nscolor mColor; |
michael@0 | 131 | }; |
michael@0 | 132 | |
michael@0 | 133 | #endif /*NSDISPLAYLISTINVALIDATION_H_*/ |