1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/xul/tree/nsTreeImageListener.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsTreeImageListener_h__ 1.10 +#define nsTreeImageListener_h__ 1.11 + 1.12 +#include "nsString.h" 1.13 +#include "nsCOMPtr.h" 1.14 +#include "nsITreeColumns.h" 1.15 +#include "nsTreeBodyFrame.h" 1.16 +#include "mozilla/Attributes.h" 1.17 + 1.18 +// This class handles image load observation. 1.19 +class nsTreeImageListener MOZ_FINAL : public imgINotificationObserver 1.20 +{ 1.21 +public: 1.22 + nsTreeImageListener(nsTreeBodyFrame *aTreeFrame); 1.23 + ~nsTreeImageListener(); 1.24 + 1.25 + NS_DECL_ISUPPORTS 1.26 + NS_DECL_IMGINOTIFICATIONOBSERVER 1.27 + 1.28 + NS_IMETHOD ClearFrame(); 1.29 + 1.30 + friend class nsTreeBodyFrame; 1.31 + 1.32 +protected: 1.33 + void UnsuppressInvalidation() { mInvalidationSuppressed = false; } 1.34 + void Invalidate(); 1.35 + void AddCell(int32_t aIndex, nsITreeColumn* aCol); 1.36 + 1.37 +private: 1.38 + nsTreeBodyFrame* mTreeFrame; 1.39 + 1.40 + // A guard that prevents us from recursive painting. 1.41 + bool mInvalidationSuppressed; 1.42 + 1.43 + class InvalidationArea { 1.44 + public: 1.45 + InvalidationArea(nsITreeColumn* aCol); 1.46 + ~InvalidationArea() { delete mNext; } 1.47 + 1.48 + friend class nsTreeImageListener; 1.49 + 1.50 + protected: 1.51 + void AddRow(int32_t aIndex); 1.52 + nsITreeColumn* GetCol() { return mCol.get(); } 1.53 + int32_t GetMin() { return mMin; } 1.54 + int32_t GetMax() { return mMax; } 1.55 + InvalidationArea* GetNext() { return mNext; } 1.56 + void SetNext(InvalidationArea* aNext) { mNext = aNext; } 1.57 + 1.58 + private: 1.59 + nsCOMPtr<nsITreeColumn> mCol; 1.60 + int32_t mMin; 1.61 + int32_t mMax; 1.62 + InvalidationArea* mNext; 1.63 + }; 1.64 + 1.65 + InvalidationArea* mInvalidationArea; 1.66 +}; 1.67 + 1.68 +#endif // nsTreeImageListener_h__