author Jon Coppeard <>
Tue, 10 Jan 2017 10:12:14 +0000
changeset 328629 2e1a0c4886c5393498627d394c4f661e6f2ea6b2
parent 322369 10b8471d7d455260dc55469b1936661b9a8d13b0
child 355830 662df8ef329fd7a38fb2ceb24e305cd31e7bcaa7
permissions -rw-r--r--
Bug 1325406 - Refactor rooting base class templates r=sfink r=mccr8

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code is subject to the terms of the Mozilla Public License
 * version 2.0 (the "License"). You can obtain a copy of the License at
 * */

/* rendering object for CSS "display: ruby" */

#ifndef nsRubyFrame_h___
#define nsRubyFrame_h___

#include "nsInlineFrame.h"
#include "RubyUtils.h"

 * Factory function.
 * @return a newly allocated nsRubyFrame (infallible)
nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
                                  nsStyleContext* aContext);

class nsRubyFrame final : public nsInlineFrame

  // nsIFrame overrides
  virtual nsIAtom* GetType() const override;
  virtual bool IsFrameOfType(uint32_t aFlags) const override;
  virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
                                 InlineMinISizeData *aData) override;
  virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
                                  InlinePrefISizeData *aData) override;
  virtual void Reflow(nsPresContext* aPresContext,
                      ReflowOutput& aDesiredSize,
                      const ReflowInput& aReflowInput,
                      nsReflowStatus& aStatus) override;

  virtual nsresult GetFrameName(nsAString& aResult) const override;

  mozilla::RubyBlockLeadings GetBlockLeadings() const {
    return mLeadings;

  friend nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
                                           nsStyleContext* aContext);
  explicit nsRubyFrame(nsStyleContext* aContext)
    : nsInlineFrame(aContext) {}

  void ReflowSegment(nsPresContext* aPresContext,
                     const ReflowInput& aReflowInput,
                     nsRubyBaseContainerFrame* aBaseContainer,
                     nsReflowStatus& aStatus);

  nsRubyBaseContainerFrame* PullOneSegment(const nsLineLayout* aLineLayout,
                                           ContinuationTraversingState& aState);

  // The leadings required to put the annotations. They are dummy-
  // initialized to 0, and get meaningful values at first reflow.
  mozilla::RubyBlockLeadings mLeadings;

#endif /* nsRubyFrame_h___ */