author Xidorn Quan <>
Wed, 11 Jun 2014 21:13:00 -0400
changeset 188318 6576396848f105936ace359d046a4b7d985b7861
parent 188316 fffcb4bbc8b17a34f5fa5013418a8956d0fdcc7a
child 188824 9603399b9ee1a95a7e2359d3c878e41cc6012ed2
permissions -rw-r--r--
Bug 966166 - Part 5: Move computation code with minor changes. r=dbaron In addition to moving the code, this patch also: * changes the square character from U+25AA to U+25FE to match the spec * changes all the generating functions from using append to using assign * removes negative handling from CJKIdeographicToText since it is no longer used there * fixes indentation and naming conventions * changes buffer size in DecimalToText

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

/* rendering object for list-item bullets */

#ifndef nsBulletFrame_h___
#define nsBulletFrame_h___

#include "mozilla/Attributes.h"
#include "nsFrame.h"

#include "imgINotificationObserver.h"

class imgIContainer;
class imgRequestProxy;

class nsBulletFrame;

class nsBulletListener : public imgINotificationObserver
  virtual ~nsBulletListener();


  void SetFrame(nsBulletFrame *frame) { mFrame = frame; }

  nsBulletFrame *mFrame;

 * A simple class that manages the layout and rendering of html bullets.
 * This class also supports the CSS list-style properties.
class nsBulletFrame : public nsFrame {
#ifdef DEBUG

  nsBulletFrame(nsStyleContext* aContext)
    : nsFrame(aContext)
  virtual ~nsBulletFrame();

  NS_IMETHOD Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData);

  // nsIFrame
  virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                const nsRect&           aDirtyRect,
                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
  virtual nsIAtom* GetType() const MOZ_OVERRIDE;
  virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
  virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;

  // nsIHTMLReflow
  virtual void Reflow(nsPresContext* aPresContext,
                      nsHTMLReflowMetrics& aMetrics,
                      const nsHTMLReflowState& aReflowState,
                      nsReflowStatus& aStatus) MOZ_OVERRIDE;
  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;

  // nsBulletFrame
  int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged,
                             int32_t aIncrement);

  /* get list item text, with prefix & suffix */
  void GetListItemText(nsAString& aResult);

  void GetSpokenText(nsAString& aText);
  void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
                   const nsRect& aDirtyRect, uint32_t aFlags);
  virtual bool IsEmpty() MOZ_OVERRIDE;
  virtual bool IsSelfEmpty() MOZ_OVERRIDE;
  virtual nscoord GetBaseline() const MOZ_OVERRIDE;

  float GetFontSizeInflation() const;
  bool HasFontSizeInflation() const {
    return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION) != 0;
  void SetFontSizeInflation(float aInflation);

  int32_t GetOrdinal() { return mOrdinal; }

  already_AddRefed<imgIContainer> GetImage() const;

  nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);

  void GetDesiredSize(nsPresContext* aPresContext,
                      nsRenderingContext *aRenderingContext,
                      nsHTMLReflowMetrics& aMetrics,
                      float aFontSizeInflation);

  void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);

  nsMargin mPadding;
  nsRefPtr<imgRequestProxy> mImageRequest;
  nsRefPtr<nsBulletListener> mListener;

  nsSize mIntrinsicSize;
  int32_t mOrdinal;


  // This is a boolean flag indicating whether or not the current image request
  // has been registered with the refresh driver.
  bool mRequestRegistered;

#endif /* nsBulletFrame_h___ */