Bug 1018324 - Remove inIFlasher. r=roc
authorJonathan Watt <jwatt@jwatt.org>
Tue, 10 Jun 2014 07:02:21 +0100
changeset 209765 4140ef233349acc9fdbcc8e9dd97f68c50fa8067
parent 209764 8c40e85103216663aab0f1fa0ad51d77870a3f20
child 209766 2e1413c075c0c4eedb9d06bc536156c9c3204613
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1018324
milestone33.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 1018324 - Remove inIFlasher. r=roc
layout/build/nsLayoutModule.cpp
layout/inspector/inFlasher.cpp
layout/inspector/inFlasher.h
layout/inspector/inIFlasher.idl
layout/inspector/inLayoutUtils.cpp
layout/inspector/inLayoutUtils.h
layout/inspector/moz.build
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -188,17 +188,16 @@ class nsIDocumentLoaderFactory;
 
 #include "nsIBoxObject.h"
 
 #ifdef MOZ_XUL
 #include "inDOMView.h"
 #endif /* MOZ_XUL */
 
 #include "inDeepTreeWalker.h"
-#include "inFlasher.h"
 #include "inCSSValueSearch.h"
 #include "inDOMUtils.h"
 
 #ifdef MOZ_XUL
 #include "nsIXULDocument.h"
 #include "nsIXULSortService.h"
 
 nsresult
@@ -502,17 +501,16 @@ MAKE_CTOR(CreateNewScrollBoxObject,     
 MAKE_CTOR(CreateNewTreeBoxObject,       nsIBoxObject,           NS_NewTreeBoxObject)
 MAKE_CTOR(CreateNewContainerBoxObject,  nsIBoxObject,           NS_NewContainerBoxObject)
 #endif // MOZ_XUL
 
 #ifdef MOZ_XUL
 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMView)
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
-NS_GENERIC_FACTORY_CONSTRUCTOR(inFlasher)
 NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
 
 MAKE_CTOR2(CreateContentViewer,           nsIContentViewer,            NS_NewContentViewer)
 MAKE_CTOR(CreateHTMLDocument,             nsIDocument,                 NS_NewHTMLDocument)
 MAKE_CTOR(CreateXMLDocument,              nsIDocument,                 NS_NewXMLDocument)
 MAKE_CTOR(CreateSVGDocument,              nsIDocument,                 NS_NewSVGDocument)
 MAKE_CTOR(CreateImageDocument,            nsIDocument,                 NS_NewImageDocument)
@@ -658,17 +656,16 @@ NS_DEFINE_NAMED_CID(NS_POPUPBOXOBJECT_CI
 NS_DEFINE_NAMED_CID(NS_CONTAINERBOXOBJECT_CID);
 NS_DEFINE_NAMED_CID(NS_SCROLLBOXOBJECT_CID);
 NS_DEFINE_NAMED_CID(NS_TREEBOXOBJECT_CID);
 #endif // MOZ_XUL
 #ifdef MOZ_XUL
 NS_DEFINE_NAMED_CID(IN_DOMVIEW_CID);
 #endif
 NS_DEFINE_NAMED_CID(IN_DEEPTREEWALKER_CID);
-NS_DEFINE_NAMED_CID(IN_FLASHER_CID);
 NS_DEFINE_NAMED_CID(IN_CSSVALUESEARCH_CID);
 NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_DOMMULTIPARTBLOB_CID);
@@ -948,17 +945,16 @@ static const mozilla::Module::CIDEntry k
   { &kNS_CONTAINERBOXOBJECT_CID, false, nullptr, CreateNewContainerBoxObject },
   { &kNS_SCROLLBOXOBJECT_CID, false, nullptr, CreateNewScrollBoxObject },
   { &kNS_TREEBOXOBJECT_CID, false, nullptr, CreateNewTreeBoxObject },
 #endif // MOZ_XUL
 #ifdef MOZ_XUL
   { &kIN_DOMVIEW_CID, false, nullptr, inDOMViewConstructor },
 #endif
   { &kIN_DEEPTREEWALKER_CID, false, nullptr, inDeepTreeWalkerConstructor },
-  { &kIN_FLASHER_CID, false, nullptr, inFlasherConstructor },
   { &kIN_CSSVALUESEARCH_CID, false, nullptr, inCSSValueSearchConstructor },
   { &kIN_DOMUTILS_CID, false, nullptr, inDOMUtilsConstructor },
   { &kNS_CONTENT_VIEWER_CID, false, nullptr, CreateContentViewer },
   { &kNS_HTMLDOCUMENT_CID, false, nullptr, CreateHTMLDocument },
   { &kNS_XMLDOCUMENT_CID, false, nullptr, CreateXMLDocument },
   { &kNS_SVGDOCUMENT_CID, false, nullptr, CreateSVGDocument },
   { &kNS_IMAGEDOCUMENT_CID, false, nullptr, CreateImageDocument },
   { &kNS_DOMMULTIPARTBLOB_CID, false, nullptr, CreateDOMBlob },
@@ -1102,17 +1098,16 @@ static const mozilla::Module::ContractID
   { "@mozilla.org/layout/xul-boxobject-container;1", &kNS_CONTAINERBOXOBJECT_CID },
   { "@mozilla.org/layout/xul-boxobject-scrollbox;1", &kNS_SCROLLBOXOBJECT_CID },
   { "@mozilla.org/layout/xul-boxobject-tree;1", &kNS_TREEBOXOBJECT_CID },
 #endif // MOZ_XUL
 #ifdef MOZ_XUL
   { "@mozilla.org/inspector/dom-view;1", &kIN_DOMVIEW_CID },
 #endif
   { "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID },
-  { "@mozilla.org/inspector/flasher;1", &kIN_FLASHER_CID },
   { "@mozilla.org/inspector/search;1?type=cssvalue", &kIN_CSSVALUESEARCH_CID },
   { IN_DOMUTILS_CONTRACTID, &kIN_DOMUTILS_CID },
   { "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
   { "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
   { NS_DOMMULTIPARTBLOB_CONTRACTID, &kNS_DOMMULTIPARTBLOB_CID },
   { NS_DOMMULTIPARTFILE_CONTRACTID, &kNS_DOMMULTIPARTFILE_CID },
   { "@mozilla.org/content/dom-selection;1", &kNS_DOMSELECTION_CID },
   { "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
deleted file mode 100644
--- a/layout/inspector/inFlasher.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-#include "inFlasher.h"
-#include "inLayoutUtils.h"
-
-#include "nsIDOMElement.h"
-#include "nsIServiceManager.h"
-#include "nsIPresShell.h"
-#include "nsIFrame.h"
-#include "nsIWidget.h"
-#include "nsReadableUtils.h"
-#include "nsRenderingContext.h"
-#include "nsIDOMWindow.h"
-#include "nsIContent.h"
-
-#include "prprf.h"
-
-///////////////////////////////////////////////////////////////////////////////
-
-inFlasher::inFlasher() :
-  mColor(NS_RGB(0,0,0)),
-  mThickness(0),
-  mInvert(false)
-{
-}
-
-inFlasher::~inFlasher()
-{
-}
-
-NS_IMPL_ISUPPORTS(inFlasher, inIFlasher)
-
-///////////////////////////////////////////////////////////////////////////////
-// inIFlasher
-
-NS_IMETHODIMP
-inFlasher::GetColor(nsAString& aColor)
-{
-  // Copied from nsGenericHTMLElement::ColorToString()
-  char buf[10];
-  PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x",
-              NS_GET_R(mColor), NS_GET_G(mColor), NS_GET_B(mColor));
-  CopyASCIItoUTF16(buf, aColor);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-inFlasher::SetColor(const nsAString& aColor)
-{
-  NS_ENSURE_FALSE(aColor.IsEmpty(), NS_ERROR_ILLEGAL_VALUE);
-
-  nsAutoString colorStr;
-  colorStr.Assign(aColor);
-
-  if (colorStr.CharAt(0) != '#') {
-    if (NS_ColorNameToRGB(colorStr, &mColor)) {
-      return NS_OK;
-    }
-  }
-  else {
-    colorStr.Cut(0, 1);
-    if (NS_HexToRGB(colorStr, &mColor)) {
-      return NS_OK;
-    }
-  }
-
-  return NS_ERROR_ILLEGAL_VALUE;
-}
-
-NS_IMETHODIMP
-inFlasher::GetThickness(uint16_t *aThickness)
-{
-  NS_PRECONDITION(aThickness, "Null pointer");
-  *aThickness = mThickness;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-inFlasher::SetThickness(uint16_t aThickness)
-{
-  mThickness = aThickness;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-inFlasher::GetInvert(bool *aInvert)
-{
-  NS_PRECONDITION(aInvert, "Null pointer");
-  *aInvert = mInvert;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-inFlasher::SetInvert(bool aInvert)
-{
-  mInvert = aInvert;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-inFlasher::RepaintElement(nsIDOMElement* aElement)
-{
-  NS_ENSURE_ARG_POINTER(aElement);
-  nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement);
-  if (!frame) return NS_OK;
-
-  frame->InvalidateFrame();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-inFlasher::DrawElementOutline(nsIDOMElement* aElement)
-{
-  NS_ENSURE_ARG_POINTER(aElement);
-  nsCOMPtr<nsIDOMWindow> window = inLayoutUtils::GetWindowFor(aElement);
-  if (!window) return NS_OK;
-  nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
-  if (!presShell) return NS_OK;
-
-  nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement);
-
-  bool isFirstFrame = true;
-
-  while (frame) {
-    nsPoint offset;
-    nsIWidget* widget = frame->GetNearestWidget(offset);
-    if (widget) {
-      nsRefPtr<nsRenderingContext> rcontext = new nsRenderingContext();
-      rcontext->Init(frame->PresContext()->DeviceContext(),
-                     widget->GetThebesSurface());
-
-      nsRect rect(offset, frame->GetSize());
-      if (mInvert) {
-        rcontext->InvertRect(rect);
-      }
-
-      bool isLastFrame = frame->GetNextContinuation() == nullptr;
-      DrawOutline(rect.x, rect.y, rect.width, rect.height, rcontext,
-                  isFirstFrame, isLastFrame);
-      isFirstFrame = false;
-    }
-    frame = frame->GetNextContinuation();
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-inFlasher::ScrollElementIntoView(nsIDOMElement *aElement)
-{
-  NS_ENSURE_ARG_POINTER(aElement);
-  nsCOMPtr<nsIDOMWindow> window = inLayoutUtils::GetWindowFor(aElement);
-  if (!window) {
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
-  if (!presShell) {
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
-  presShell->ScrollContentIntoView(content,
-                                   nsIPresShell::ScrollAxis(),
-                                   nsIPresShell::ScrollAxis(),
-                                   nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
-
-  return NS_OK;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// inFlasher
-
-void
-inFlasher::DrawOutline(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
-                       nsRenderingContext* aRenderContext,
-                       bool aDrawBegin, bool aDrawEnd)
-{
-  aRenderContext->SetColor(mColor);
-
-  DrawLine(aX, aY, aWidth, DIR_HORIZONTAL, BOUND_OUTER, aRenderContext);
-  if (aDrawBegin) {
-    DrawLine(aX, aY, aHeight, DIR_VERTICAL, BOUND_OUTER, aRenderContext);
-  }
-  DrawLine(aX, aY+aHeight, aWidth, DIR_HORIZONTAL, BOUND_INNER, aRenderContext);
-  if (aDrawEnd) {
-    DrawLine(aX+aWidth, aY, aHeight, DIR_VERTICAL, BOUND_INNER, aRenderContext);
-  }
-}
-
-void
-inFlasher::DrawLine(nscoord aX, nscoord aY, nscoord aLength,
-                    bool aDir, bool aBounds,
-                    nsRenderingContext* aRenderContext)
-{
-  nscoord thickTwips = nsPresContext::CSSPixelsToAppUnits(mThickness);
-  if (aDir) { // horizontal
-    aRenderContext->FillRect(aX, aY+(aBounds?0:-thickTwips), aLength, thickTwips);
-  } else { // vertical
-    aRenderContext->FillRect(aX+(aBounds?0:-thickTwips), aY, thickTwips, aLength);
-  }
-}
deleted file mode 100644
--- a/layout/inspector/inFlasher.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-#ifndef __inFlasher_h__
-#define __inFlasher_h__
-
-#include "inIFlasher.h"
-#include "nsCoord.h"
-#include "nsColor.h"
-
-class nsRenderingContext;
-
-#define BOUND_INNER 0
-#define BOUND_OUTER 1
-
-#define DIR_VERTICAL 0
-#define DIR_HORIZONTAL 1
-
-class inFlasher : public inIFlasher
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_INIFLASHER
-
-  inFlasher();
-  virtual ~inFlasher();
-
-protected:
-  void DrawOutline(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
-                   nsRenderingContext* aRenderContext,
-                   bool aDrawBegin, bool aDrawEnd);
-  void DrawLine(nscoord aX, nscoord aY, nscoord aLength,
-                bool aDir, bool aBounds,
-                nsRenderingContext* aRenderContext);
-
-  nscolor mColor;
-
-  uint16_t mThickness;
-  bool mInvert;
-};
-
-// {9286E71A-621A-4b91-851E-9984C1A2E81A}
-#define IN_FLASHER_CID \
-{ 0x9286e71a, 0x621a, 0x4b91, { 0x85, 0x1e, 0x99, 0x84, 0xc1, 0xa2, 0xe8, 0x1a } }
-
-#endif // __inFlasher_h__
deleted file mode 100644
--- a/layout/inspector/inIFlasher.idl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* 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 http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface nsIDOMElement;
-
-[scriptable, uuid(7B4A099F-6F6E-4565-977B-FB622ADBFF49)]
-interface inIFlasher : nsISupports 
-{
-  attribute DOMString       color;
-  attribute boolean         invert;
-  attribute unsigned short  thickness;
-
-  void drawElementOutline(in nsIDOMElement aElement);
-  void repaintElement(in nsIDOMElement aElement);
-  void scrollElementIntoView(in nsIDOMElement aElement);
-};
-
--- a/layout/inspector/inLayoutUtils.cpp
+++ b/layout/inspector/inLayoutUtils.cpp
@@ -15,48 +15,16 @@
 #include "nsPresContext.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla;
 
 ///////////////////////////////////////////////////////////////////////////////
 
-nsIDOMWindow*
-inLayoutUtils::GetWindowFor(nsIDOMNode* aNode)
-{
-  nsCOMPtr<nsIDOMDocument> doc1;
-  aNode->GetOwnerDocument(getter_AddRefs(doc1));
-  return GetWindowFor(doc1.get());
-}
-
-nsIDOMWindow*
-inLayoutUtils::GetWindowFor(nsIDOMDocument* aDoc)
-{
-  nsCOMPtr<nsIDOMWindow> window;
-  aDoc->GetDefaultView(getter_AddRefs(window));
-  return window;
-}
-
-nsIPresShell* 
-inLayoutUtils::GetPresShellFor(nsISupports* aThing)
-{
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aThing);
-
-  return window->GetDocShell()->GetPresShell();
-}
-
-/*static*/
-nsIFrame*
-inLayoutUtils::GetFrameFor(nsIDOMElement* aElement)
-{
-  nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
-  return content->GetPrimaryFrame();
-}
-
 EventStateManager*
 inLayoutUtils::GetEventStateManagerFor(nsIDOMElement *aElement)
 {
   NS_PRECONDITION(aElement, "Passing in a null element is bad");
 
   nsCOMPtr<nsIDOMDocument> domDoc;
   aElement->GetOwnerDocument(getter_AddRefs(domDoc));
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
--- a/layout/inspector/inLayoutUtils.h
+++ b/layout/inspector/inLayoutUtils.h
@@ -17,19 +17,15 @@ class nsISupports;
 
 namespace mozilla {
 class EventStateManager;
 }
 
 class inLayoutUtils
 {
 public:
-  static nsIDOMWindow* GetWindowFor(nsIDOMNode* aNode);
-  static nsIDOMWindow* GetWindowFor(nsIDOMDocument* aDoc);
-  static nsIPresShell* GetPresShellFor(nsISupports* aThing);
-  static nsIFrame* GetFrameFor(nsIDOMElement* aElement);
   static mozilla::EventStateManager*
            GetEventStateManagerFor(nsIDOMElement *aElement);
   static nsIDOMDocument* GetSubDocumentFor(nsIDOMNode* aNode);
   static nsIDOMNode* GetContainerFor(const nsIDocument& aDoc);
 };
 
 #endif // __inLayoutUtils_h__
--- a/layout/inspector/moz.build
+++ b/layout/inspector/moz.build
@@ -4,17 +4,16 @@
 # 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/.
 
 XPIDL_SOURCES += [
     'inICSSValueSearch.idl',
     'inIDeepTreeWalker.idl',
     'inIDOMUtils.idl',
     'inIDOMView.idl',
-    'inIFlasher.idl',
     'inISearchObserver.idl',
     'inISearchProcess.idl',
     'nsIDOMFontFace.idl',
     'nsIDOMFontFaceList.idl',
 ]
 
 XPIDL_MODULE = 'inspector'
 
@@ -22,17 +21,16 @@ EXPORTS += [
     'nsFontFace.h',
     'nsFontFaceList.h',
 ]
 
 UNIFIED_SOURCES += [
     'inCSSValueSearch.cpp',
     'inDeepTreeWalker.cpp',
     'inDOMUtils.cpp',
-    'inFlasher.cpp',
     'inLayoutUtils.cpp',
     'inSearchLoop.cpp',
     'nsFontFace.cpp',
     'nsFontFaceList.cpp',
 ]
 
 if CONFIG['MOZ_XUL']:
     UNIFIED_SOURCES += [