layout/base/nsStyleChangeList.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /*
     7  * a list of the recomputation that needs to be done in response to a
     8  * style change
     9  */
    11 #ifndef nsStyleChangeList_h___
    12 #define nsStyleChangeList_h___
    14 #include "mozilla/Attributes.h"
    16 #include "nsError.h"
    17 #include "nsChangeHint.h"
    19 class nsIFrame;
    20 class nsIContent;
    22 // XXX would all platforms support putting this inside the list?
    23 struct nsStyleChangeData {
    24   nsIFrame*   mFrame;
    25   nsIContent* mContent;
    26   nsChangeHint mHint;
    27 };
    29 static const uint32_t kStyleChangeBufferSize = 10;
    31 // Note:  nsStyleChangeList owns a reference to
    32 //  nsIContent pointers in its list.
    33 class nsStyleChangeList {
    34 public:
    35   nsStyleChangeList();
    36   ~nsStyleChangeList();
    38   int32_t Count(void) const {
    39     return mCount;
    40   }
    42   /**
    43    * Fills in pointers without reference counting.  
    44    */
    45   nsresult ChangeAt(int32_t aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
    46                     nsChangeHint& aHint) const;
    48   /**
    49    * Fills in a pointer to the list entry storage (no reference counting
    50    * involved).
    51    */
    52   nsresult ChangeAt(int32_t aIndex, const nsStyleChangeData** aChangeData) const;
    54   nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint);
    56   void Clear(void);
    58 protected:
    59   nsStyleChangeList&  operator=(const nsStyleChangeList& aCopy);
    60   bool                operator==(const nsStyleChangeList& aOther) const;
    62   nsStyleChangeData*  mArray;
    63   int32_t             mArraySize;
    64   int32_t             mCount;
    65   nsStyleChangeData   mBuffer[kStyleChangeBufferSize];
    67 private:
    68   nsStyleChangeList(const nsStyleChangeList&) MOZ_DELETE;
    69 };
    72 #endif /* nsStyleChangeList_h___ */

mercurial