Bug 1099807 part 1 - Add common superclass for ruby base and ruby text. r=dholbert
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 08 Jan 2015 18:28:09 +1100
changeset 248425 b936ab379c755646f876d3120c3e105c4e8128eb
parent 248424 a17fa338bf0fabf225df39e70a6acae45f74bdb4
child 248426 9e82574ea4f2b6e6f6d16b6b768ec850c739d75e
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1099807
milestone37.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 1099807 part 1 - Add common superclass for ruby base and ruby text. r=dholbert
layout/generic/moz.build
layout/generic/nsFrameIdList.h
layout/generic/nsRubyBaseFrame.cpp
layout/generic/nsRubyBaseFrame.h
layout/generic/nsRubyContentFrame.cpp
layout/generic/nsRubyContentFrame.h
layout/generic/nsRubyTextFrame.cpp
layout/generic/nsRubyTextFrame.h
layout/generic/nsTextFrame.h
--- a/layout/generic/moz.build
+++ b/layout/generic/moz.build
@@ -77,16 +77,17 @@ UNIFIED_SOURCES += [
     'nsIntervalSet.cpp',
     'nsLeafFrame.cpp',
     'nsLineBox.cpp',
     'nsPageContentFrame.cpp',
     'nsPageFrame.cpp',
     'nsPlaceholderFrame.cpp',
     'nsRubyBaseContainerFrame.cpp',
     'nsRubyBaseFrame.cpp',
+    'nsRubyContentFrame.cpp',
     'nsRubyFrame.cpp',
     'nsRubyTextContainerFrame.cpp',
     'nsRubyTextFrame.cpp',
     'nsSelection.cpp',
     'nsSimplePageSequenceFrame.cpp',
     'nsSplittableFrame.cpp',
     'nsSubDocumentFrame.cpp',
     'nsTextFrame.cpp',
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -111,16 +111,17 @@ FRAME_ID(nsPlaceholderFrame)
 FRAME_ID(nsPopupSetFrame)
 FRAME_ID(nsProgressFrame)
 FRAME_ID(nsProgressMeterFrame)
 FRAME_ID(nsRangeFrame)
 FRAME_ID(nsResizerFrame)
 FRAME_ID(nsRootBoxFrame)
 FRAME_ID(nsRubyBaseContainerFrame)
 FRAME_ID(nsRubyBaseFrame)
+FRAME_ID(nsRubyContentFrame)
 FRAME_ID(nsRubyFrame)
 FRAME_ID(nsRubyTextContainerFrame)
 FRAME_ID(nsRubyTextFrame)
 FRAME_ID(nsScrollbarButtonFrame)
 FRAME_ID(nsScrollbarFrame)
 FRAME_ID(nsSelectsAreaFrame)
 FRAME_ID(nsSimplePageSequenceFrame)
 FRAME_ID(nsSliderFrame)
--- a/layout/generic/nsRubyBaseFrame.cpp
+++ b/layout/generic/nsRubyBaseFrame.cpp
@@ -16,17 +16,17 @@ using namespace mozilla;
 
 //----------------------------------------------------------------------
 
 // Frame class boilerplate
 // =======================
 
 NS_QUERYFRAME_HEAD(nsRubyBaseFrame)
   NS_QUERYFRAME_ENTRY(nsRubyBaseFrame)
-NS_QUERYFRAME_TAIL_INHERITING(nsInlineFrame)
+NS_QUERYFRAME_TAIL_INHERITING(nsRubyBaseFrameSuper)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRubyBaseFrame)
 
 nsContainerFrame*
 NS_NewRubyBaseFrame(nsIPresShell* aPresShell,
                     nsStyleContext* aContext)
 {
   return new (aPresShell) nsRubyBaseFrame(aContext);
@@ -46,17 +46,8 @@ nsRubyBaseFrame::GetType() const
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsRubyBaseFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("RubyBase"), aResult);
 }
 #endif
-
-/* virtual */ bool
-nsRubyBaseFrame::IsFrameOfType(uint32_t aFlags) const
-{
-  if (aFlags & eBidiInlineContainer) {
-    return false;
-  }
-  return nsRubyBaseFrameSuper::IsFrameOfType(aFlags);
-}
--- a/layout/generic/nsRubyBaseFrame.h
+++ b/layout/generic/nsRubyBaseFrame.h
@@ -4,19 +4,19 @@
  * version 2.0 (the "License"). You can obtain a copy of the License at
  * http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for CSS "display: ruby-base" */
 
 #ifndef nsRubyBaseFrame_h___
 #define nsRubyBaseFrame_h___
 
-#include "nsInlineFrame.h"
+#include "nsRubyContentFrame.h"
 
-typedef nsInlineFrame nsRubyBaseFrameSuper;
+typedef nsRubyContentFrame nsRubyBaseFrameSuper;
 
 /**
  * Factory function.
  * @return a newly allocated nsRubyBaseFrame (infallible)
  */
 nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell,
                                       nsStyleContext* aContext);
 
@@ -24,17 +24,16 @@ class nsRubyBaseFrame MOZ_FINAL : public
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
   NS_DECL_QUERYFRAME_TARGET(nsRubyBaseFrame)
   NS_DECL_QUERYFRAME
 
   // nsIFrame overrides
   virtual nsIAtom* GetType() const MOZ_OVERRIDE;
-  virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE;
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
 #endif
 
 protected:
   friend nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell,
                                                nsStyleContext* aContext);
new file mode 100644
--- /dev/null
+++ b/layout/generic/nsRubyContentFrame.cpp
@@ -0,0 +1,34 @@
+/* -*- 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
+ * http://mozilla.org/MPL/2.0/. */
+
+/* base class for ruby rendering objects that directly contain content */
+
+#include "nsRubyContentFrame.h"
+#include "nsPresContext.h"
+#include "nsStyleContext.h"
+
+using namespace mozilla;
+
+//----------------------------------------------------------------------
+
+// Frame class boilerplate
+// =======================
+
+NS_IMPL_FRAMEARENA_HELPERS(nsRubyContentFrame)
+
+//----------------------------------------------------------------------
+
+// nsRubyContentFrame Method Implementations
+// ======================================
+
+/* virtual */ bool
+nsRubyContentFrame::IsFrameOfType(uint32_t aFlags) const
+{
+  if (aFlags & eBidiInlineContainer) {
+    return false;
+  }
+  return nsRubyContentFrameSuper::IsFrameOfType(aFlags);
+}
new file mode 100644
--- /dev/null
+++ b/layout/generic/nsRubyContentFrame.h
@@ -0,0 +1,29 @@
+/* -*- 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
+ * http://mozilla.org/MPL/2.0/. */
+
+/* base class for ruby rendering objects that directly contain content */
+
+#ifndef nsRubyContentFrame_h___
+#define nsRubyContentFrame_h___
+
+#include "nsInlineFrame.h"
+
+typedef nsInlineFrame nsRubyContentFrameSuper;
+
+class nsRubyContentFrame : public nsRubyContentFrameSuper
+{
+public:
+  NS_DECL_FRAMEARENA_HELPERS
+
+  // nsIFrame overrides
+  virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE;
+
+protected:
+  explicit nsRubyContentFrame(nsStyleContext* aContext)
+    : nsRubyContentFrameSuper(aContext) {}
+};
+
+#endif /* nsRubyContentFrame_h___ */
--- a/layout/generic/nsRubyTextFrame.cpp
+++ b/layout/generic/nsRubyTextFrame.cpp
@@ -16,17 +16,17 @@ using namespace mozilla;
 
 //----------------------------------------------------------------------
 
 // Frame class boilerplate
 // =======================
 
 NS_QUERYFRAME_HEAD(nsRubyTextFrame)
   NS_QUERYFRAME_ENTRY(nsRubyTextFrame)
-NS_QUERYFRAME_TAIL_INHERITING(nsInlineFrame)
+NS_QUERYFRAME_TAIL_INHERITING(nsRubyTextFrameSuper)
 
 NS_IMPL_FRAMEARENA_HELPERS(nsRubyTextFrame)
 
 nsContainerFrame*
 NS_NewRubyTextFrame(nsIPresShell* aPresShell,
                     nsStyleContext* aContext)
 {
   return new (aPresShell) nsRubyTextFrame(aContext);
@@ -47,24 +47,16 @@ nsRubyTextFrame::GetType() const
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsRubyTextFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("RubyText"), aResult);
 }
 #endif
 
-/* virtual */ bool
-nsRubyTextFrame::IsFrameOfType(uint32_t aFlags) const
-{
-  if (aFlags & eBidiInlineContainer) {
-    return false;
-  }
-  return nsRubyTextFrameSuper::IsFrameOfType(aFlags);
-}
 
 
 /* virtual */ void
 nsRubyTextFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                   const nsRect&           aDirtyRect,
                                   const nsDisplayListSet& aLists)
 {
   if (GetStateBits() & NS_RUBY_TEXT_FRAME_AUTOHIDE) {
--- a/layout/generic/nsRubyTextFrame.h
+++ b/layout/generic/nsRubyTextFrame.h
@@ -4,19 +4,19 @@
  * version 2.0 (the "License"). You can obtain a copy of the License at
  * http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for CSS "display: ruby-text" */
 
 #ifndef nsRubyTextFrame_h___
 #define nsRubyTextFrame_h___
 
-#include "nsInlineFrame.h"
+#include "nsRubyContentFrame.h"
 
-typedef nsInlineFrame nsRubyTextFrameSuper;
+typedef nsRubyContentFrame nsRubyTextFrameSuper;
 
 /**
  * Factory function.
  * @return a newly allocated nsRubyTextFrame (infallible)
  */
 nsContainerFrame* NS_NewRubyTextFrame(nsIPresShell* aPresShell,
                                       nsStyleContext* aContext);
 
@@ -24,17 +24,16 @@ class nsRubyTextFrame MOZ_FINAL : public
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
   NS_DECL_QUERYFRAME_TARGET(nsRubyTextFrame)
   NS_DECL_QUERYFRAME
 
   // nsIFrame overrides
   virtual nsIAtom* GetType() const MOZ_OVERRIDE;
-  virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE;
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
 #endif
 
   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
                                 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -10,16 +10,21 @@
 #include "nsFrame.h"
 #include "nsSplittableFrame.h"
 #include "nsLineBox.h"
 #include "gfxSkipChars.h"
 #include "gfxTextRun.h"
 #include "nsDisplayList.h"
 #include "JustificationUtils.h"
 
+// Undo the windows.h damage
+#if defined(XP_WIN) && defined(DrawText)
+#undef DrawText
+#endif
+
 class nsTextPaintStyle;
 class PropertyProvider;
 struct SelectionDetails;
 class nsTextFragment;
 
 typedef nsFrame nsTextFrameBase;
 
 class nsDisplayTextGeometry;