Bug 1284888 part 1: Annotate TextOverflow as a heap-only final class, to reflect reality. r?jfkthame draft
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 18 Jul 2017 22:36:24 -0700
changeset 611021 1d3e83e5fb24bf8efedee8e593da347f6dbd3956
parent 610910 d29d22da431dafbec526decd547d9a8dd7bf6dd0
child 611022 6ddefe2ca9db02afd1615b14f4e0bf8a0a686558
push id69099
push userdholbert@mozilla.com
push dateWed, 19 Jul 2017 05:48:28 +0000
reviewersjfkthame
bugs1284888
milestone56.0a1
Bug 1284888 part 1: Annotate TextOverflow as a heap-only final class, to reflect reality. r?jfkthame MozReview-Commit-ID: 9e03pevzCOc
layout/generic/TextOverflow.h
--- a/layout/generic/TextOverflow.h
+++ b/layout/generic/TextOverflow.h
@@ -4,33 +4,34 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef TextOverflow_h_
 #define TextOverflow_h_
 
 #include "nsDisplayList.h"
 #include "nsTHashtable.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/Likely.h"
 #include "mozilla/WritingModes.h"
 #include <algorithm>
 
 class nsIScrollableFrame;
 class nsLineBox;
 
 namespace mozilla {
 namespace css {
 
 /**
  * A class for rendering CSS3 text-overflow.
  * Usage:
  *  1. allocate an object using WillProcessLines
  *  2. then call ProcessLine for each line you are building display lists for
  */
-class TextOverflow {
+class MOZ_HEAP_CLASS TextOverflow final {
  public:
   /**
    * Allocate an object for text-overflow processing.
    * @return nullptr if no processing is necessary.  The caller owns the object.
    */
   static TextOverflow* WillProcessLines(nsDisplayListBuilder*   aBuilder,
                                         nsIFrame*               aBlockFrame);
   /**
@@ -50,19 +51,19 @@ class TextOverflow {
    * @return true if aBlockFrmae has text-overflow:clip on both sides.
    */
   static bool HasClippedOverflow(nsIFrame* aBlockFrame);
   /**
    * @return true if aBlockFrame needs analysis for text overflow.
    */
   static bool CanHaveTextOverflow(nsIFrame* aBlockFrame);
 
-  typedef nsTHashtable<nsPtrHashKey<nsIFrame> > FrameHashtable;
+  typedef nsTHashtable<nsPtrHashKey<nsIFrame>> FrameHashtable;
 
- protected:
+ private:
   TextOverflow(nsDisplayListBuilder* aBuilder,
                nsIFrame* aBlockFrame);
 
   typedef mozilla::WritingMode WritingMode;
   typedef mozilla::LogicalRect LogicalRect;
 
   struct AlignmentEdges {
     AlignmentEdges() : mAssigned(false) {}