OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // then those rects should be repainted. If |scrollRect| and |paintRects| | 47 // then those rects should be repainted. If |scrollRect| and |paintRects| |
48 // are non-empty, then scrolling should be performed before repainting. | 48 // are non-empty, then scrolling should be performed before repainting. |
49 // |scrollDelta| can only specify scrolling in one direction (i.e., the x | 49 // |scrollDelta| can only specify scrolling in one direction (i.e., the x |
50 // and y members cannot both be non-zero). | 50 // and y members cannot both be non-zero). |
51 struct PendingUpdate { | 51 struct PendingUpdate { |
52 PendingUpdate(); | 52 PendingUpdate(); |
53 ~PendingUpdate(); | 53 ~PendingUpdate(); |
54 | 54 |
55 // Returns the rect damaged by scrolling within |scrollRect| by | 55 // Returns the rect damaged by scrolling within |scrollRect| by |
56 // |scrollDelta|. This rect must be repainted. | 56 // |scrollDelta|. This rect must be repainted. |
57 blink::IntRect calculateScrollDamage() const; | 57 IntRect calculateScrollDamage() const; |
58 | 58 |
59 // Returns the smallest rect containing all paint rects. | 59 // Returns the smallest rect containing all paint rects. |
60 blink::IntRect calculatePaintBounds() const; | 60 IntRect calculatePaintBounds() const; |
61 | 61 |
62 blink::IntPoint scrollDelta; | 62 IntPoint scrollDelta; |
63 blink::IntRect scrollRect; | 63 IntRect scrollRect; |
64 WTF::Vector<blink::IntRect> paintRects; | 64 WTF::Vector<IntRect> paintRects; |
65 }; | 65 }; |
66 | 66 |
67 // There is a PendingUpdate if invalidateRect or scrollRect were called and | 67 // There is a PendingUpdate if invalidateRect or scrollRect were called and |
68 // ClearPendingUpdate was not called. | 68 // ClearPendingUpdate was not called. |
69 bool hasPendingUpdate() const; | 69 bool hasPendingUpdate() const; |
70 void clearPendingUpdate(); | 70 void clearPendingUpdate(); |
71 | 71 |
72 // Fills |update| and clears the pending update. | 72 // Fills |update| and clears the pending update. |
73 void popPendingUpdate(PendingUpdate*); | 73 void popPendingUpdate(PendingUpdate*); |
74 | 74 |
75 // The given rect should be repainted. | 75 // The given rect should be repainted. |
76 void invalidateRect(const blink::IntRect&); | 76 void invalidateRect(const IntRect&); |
77 | 77 |
78 // The given rect should be scrolled by the given amounts. | 78 // The given rect should be scrolled by the given amounts. |
79 void scrollRect(int dx, int dy, const blink::IntRect& clipRect); | 79 void scrollRect(int dx, int dy, const IntRect& clipRect); |
80 | 80 |
81 private: | 81 private: |
82 blink::IntRect scrollPaintRect(const blink::IntRect& paintRect, int dx, int
dy) const; | 82 IntRect scrollPaintRect(const IntRect& paintRect, int dx, int dy) const; |
83 bool shouldInvalidateScrollRect(const blink::IntRect&) const; | 83 bool shouldInvalidateScrollRect(const IntRect&) const; |
84 void invalidateScrollRect(); | 84 void invalidateScrollRect(); |
85 void combinePaintRects(); | 85 void combinePaintRects(); |
86 | 86 |
87 PendingUpdate m_update; | 87 PendingUpdate m_update; |
88 }; | 88 }; |
89 | 89 |
90 } // namespace blink | 90 } // namespace blink |
91 | 91 |
92 #endif | 92 #endif |
OLD | NEW |