Bug 655877 - Part 20: Make nsTextFrame QueryFrame-able. r=roc
authorCameron McCormack <cam@mcc.id.au>
Sun, 05 Aug 2012 11:01:19 +1000
changeset 101487 d8c6025c0881195cf71d6dda0ed3b91c4cef7ae2
parent 101486 270c17de5f452cd313fc82ca8b53586d9c325556
child 101488 6899651a0f096311cb8c1573b3854f81bb9a1ab7
push id23235
push userkhuey@mozilla.com
push dateSun, 05 Aug 2012 15:30:53 +0000
treeherdermozilla-central@6347710412a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs655877
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 655877 - Part 20: Make nsTextFrame QueryFrame-able. r=roc
layout/generic/nsTextFrame.h
layout/generic/nsTextFrameThebes.cpp
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -18,28 +18,34 @@ class nsTextPaintStyle;
 class PropertyProvider;
 
 // This state bit is set on frames that have some non-collapsed characters after
 // reflow
 #define TEXT_HAS_NONCOLLAPSED_CHARACTERS NS_FRAME_STATE_BIT(31)
 
 #define TEXT_HAS_FONT_INFLATION          NS_FRAME_STATE_BIT(61)
 
-class nsTextFrame : public nsFrame {
+typedef nsFrame nsTextFrameBase;
+
+class nsTextFrame : public nsTextFrameBase {
 public:
+  NS_DECL_QUERYFRAME_TARGET(nsTextFrame)
   NS_DECL_FRAMEARENA_HELPERS
 
   friend class nsContinuingTextFrame;
 
   nsTextFrame(nsStyleContext* aContext)
-    : nsFrame(aContext)
+    : nsTextFrameBase(aContext)
   {
     NS_ASSERTION(mContentOffset == 0, "Bogus content offset");
   }
   
+  // nsQueryFrame
+  NS_DECL_QUERYFRAME
+
   // nsIFrame
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -2399,16 +2399,20 @@ BuildTextRunsScanner::AssignTextRun(gfxT
     nsFrameState whichTextRunState =
       startFrame->GetTextRun(nsTextFrame::eInflated) == aTextRun
         ? TEXT_IN_TEXTRUN_USER_DATA
         : TEXT_IN_UNINFLATED_TEXTRUN_USER_DATA;
     startFrame->AddStateBits(whichTextRunState);
   }
 }
 
+NS_QUERYFRAME_HEAD(nsTextFrame)
+  NS_QUERYFRAME_ENTRY(nsTextFrame)
+NS_QUERYFRAME_TAIL_INHERITING(nsTextFrameBase)
+
 gfxSkipCharsIterator
 nsTextFrame::EnsureTextRun(TextRunType aWhichTextRun,
                            gfxContext* aReferenceContext,
                            nsIFrame* aLineContainer,
                            const nsLineList::iterator* aLine,
                            PRUint32* aFlowEndInTextRun)
 {
   gfxTextRun *textRun = GetTextRun(aWhichTextRun);