Merge backout

This commit is contained in:
Ehsan Akhgari 2011-07-20 15:49:38 -04:00
commit 5cd7d5f37e
43 changed files with 251 additions and 5 deletions

View File

@ -45,6 +45,7 @@
#include "nsEventShell.h"
#include "nsTextAccessible.h"
#include "TextUpdater.h"
#include "mozilla/dom/Element.h"
////////////////////////////////////////////////////////////////////////////////

View File

@ -105,6 +105,7 @@
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;

View File

@ -66,6 +66,7 @@
#include "nsContentCID.h"
#include "nsComponentManagerUtils.h"
#include "nsIInterfaceRequestorUtils.h"
#include "mozilla/dom/Element.h"
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);

View File

@ -43,6 +43,7 @@
#include "nsCoreUtils.h"
#include "nsEventStates.h"
#include "mozilla/dom/Element.h"
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLinkAccessible

View File

@ -58,6 +58,7 @@
#include "nsWidgetsCID.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;

View File

@ -79,13 +79,13 @@ static fp_except_t oldmask = fpsetmask(~allmask);
#include "mozilla/AutoRestore.h"
#include "nsINode.h"
#include "nsHashtable.h"
#include "nsIDOMNode.h"
struct nsNativeKeyEvent; // Don't include nsINativeKeyBindings.h here: it will force strange compilation error!
class nsIDOMScriptObjectFactory;
class nsIXPConnect;
class nsIContent;
class nsIDOMNode;
class nsIDOMKeyEvent;
class nsIDocument;
class nsIDocumentObserver;
@ -122,7 +122,6 @@ struct JSRuntime;
class nsIUGenCategory;
class nsIWidget;
class nsIDragSession;
class nsPIDOMWindow;
class nsIPresShell;
class nsIXPConnectJSObjectHolder;
#ifdef MOZ_XTF

View File

@ -56,7 +56,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "nsCRT.h"
#include "mozilla/dom/Element.h"
#include "nsHashKeys.h"
// Magic namespace id that means "match all namespaces". This is
// negative so it won't collide with actual namespace constants.
@ -74,6 +74,11 @@ typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent,
typedef void (*nsContentListDestroyFunc)(void* aData);
class nsIDocument;
namespace mozilla {
namespace dom {
class Element;
}
}
class nsBaseContentList : public nsINodeList

View File

@ -79,6 +79,8 @@
#include "nsContentUtils.h"
#include "nsContentCID.h"
#include "mozilla/dom/Element.h"
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);

View File

@ -82,6 +82,7 @@
#include "nsTArray.h"
#include "nsIFrame.h"
#include "nsStringBuffer.h"
#include "mozilla/dom/Element.h"
nsresult NS_NewDomSelection(nsISelection **aDomSelection);

View File

@ -53,8 +53,8 @@
#include "nsAutoPtr.h"
#include "nsFrameMessageManager.h"
#include "Layers.h"
#include "nsIContent.h"
class nsIContent;
class nsIURI;
class nsSubDocumentFrame;
class nsIView;

View File

@ -79,6 +79,7 @@
#include "nsSVGEffects.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/dom/Element.h"
#ifdef DEBUG_chb
static void PrintReqURL(imgIRequest* req) {

View File

@ -52,6 +52,7 @@
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsString.h"
#include "nsEventStates.h"
class nsIURI;
class nsIDocument;

View File

@ -55,6 +55,8 @@
#include NEW_H
#include "nsFixedSizeAllocator.h"
#include "prprf.h"
#include "nsIDocument.h"
#include "nsGkAtoms.h"
static const size_t kNodeInfoPoolSizes[] = {
sizeof(nsNodeInfo)

View File

@ -96,6 +96,7 @@
#include "nsIContentSecurityPolicy.h"
#include "nsIChannelPolicy.h"
#include "nsChannelPolicy.h"
#include "mozilla/dom/Element.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gObjectLog = PR_NewLogModule("objlc");

View File

@ -47,6 +47,8 @@
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsDOMError.h"
#include "nsINode.h"
#include "nsIContent.h"
#include "nsContentUtils.h"

View File

@ -45,6 +45,7 @@
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsCSSProps.h"
#include "mozilla/dom/Element.h"
// Callback function, for freeing string buffers stored in property table
static void

View File

@ -104,6 +104,8 @@
#include "nsDOMClassInfo.h"
#include "nsJSUtils.h"
#include "mozilla/dom/Element.h"
// Helper classes
/***********************************************************************/

View File

@ -74,6 +74,7 @@
#include "nsIStyleRuleProcessor.h"
#include "nsXBLResourceLoader.h"
#include "mozilla/dom/Element.h"
// Helper Classes =====================================================================

View File

@ -89,6 +89,7 @@
#endif
#include "nsIDOMEventListener.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;

View File

@ -69,6 +69,7 @@
#include "nsISelectionController.h"
#include "nsGUIEvent.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;

View File

@ -54,6 +54,7 @@
#include "nsUnicharUtils.h"
#include "nsAttrName.h"
#include "nsTArray.h"
#include "mozilla/dom/Element.h"
const PRUint32 kUnknownIndex = PRUint32(-1);

View File

@ -71,6 +71,7 @@
#include "nsHTMLReflowState.h"
#include "nsIObjectLoadingContent.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
// for event firing in context menus
#include "nsPresContext.h"

View File

@ -46,9 +46,9 @@
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "TimeStamp.h"
#include "nsIURI.h"
class nsDOMNavigationTimingClock;
class nsIURI;
class nsIDocument;
class nsDOMNavigationTiming

View File

@ -57,6 +57,7 @@
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h"
#include "nsPIDOMWindow.h"
#include "nsDOMJSUtils.h" // for GetScriptContextFromJSContext

View File

@ -59,6 +59,7 @@
#include "nsPluginStreamListenerPeer.h"
#include "nsSize.h"
#include "nsNetCID.h"
#include "nsIContent.h"
using namespace mozilla;
using namespace mozilla::plugins::parent;

View File

@ -57,6 +57,7 @@
#include "nsDOMEventTargetHelper.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDocument.h"
class AlertServiceObserver;

View File

@ -112,6 +112,7 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
#define NS_ERROR_EDITOR_NO_SELECTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,1)
#define NS_ERROR_EDITOR_NO_TEXTNODE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,2)

View File

@ -99,6 +99,7 @@
#include "nsIFrame.h"
#include "nsIParserService.h"
#include "mozilla/dom/Element.h"
// Some utilities to handle annoying overloading of "A" tag for link and named anchor
static char hrefText[] = "href";

View File

@ -195,6 +195,8 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
//switch to page layout
#include "nsGfxCIID.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
#ifdef NS_DEBUG

View File

@ -45,6 +45,7 @@
#include "nsITheme.h"
#include "nsThemeConstants.h"
#include "nsEventStates.h"
#include "mozilla/dom/Element.h"
#define ACTIVE "active"
#define HOVER "hover"

View File

@ -51,6 +51,7 @@
#include "nsContentUtils.h"
#include "nsFormControlFrame.h"
#include "nsFontMetrics.h"
#include "mozilla/dom/Element.h"
nsIFrame*

View File

@ -113,6 +113,7 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
#endif // IBMBIDI
#include "nsDOMError.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;

View File

@ -59,6 +59,8 @@
#include "nsEventStateManager.h"
#include "nsIAtom.h"
#include "nsIRange.h"
#include "mozilla/dom/Element.h"
///////////////////////////////////////////////////////////////////////////////

View File

@ -52,6 +52,8 @@
#include "nsIDOMElement.h"
#include "nsDisplayList.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Element.h"
//
// NS_NewXULButtonFrame

View File

@ -60,6 +60,8 @@
#include "nsContentUtils.h"
#include "nsMenuPopupFrame.h"
#include "nsIScreenManager.h"
#include "mozilla/dom/Element.h"
//
// NS_NewResizerFrame

View File

@ -72,6 +72,7 @@
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Element.h"
class nsSplitterInfo {
public:

View File

@ -61,6 +61,8 @@
#include "nsIRootBox.h"
#include "nsEventDispatcher.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;

View File

@ -40,6 +40,7 @@
#include "nsTreeStyleCache.h"
#include "nsISupportsArray.h"
#include "nsStyleSet.h"
#include "mozilla/dom/Element.h"
// The style context cache impl
nsStyleContext*

View File

@ -88,6 +88,7 @@
#include "nsIWindowWatcher.h"
#include "nsIObserverService.h"
#include "nsFocusManager.h"
#include "mozilla/dom/Element.h"
#include "nsTypeAheadFind.h"

View File

@ -54,6 +54,7 @@
#include "nsPIDOMWindow.h"
#include "nsProgressFrame.h"
#include "nsMenuFrame.h"
#include "mozilla/dom/Element.h"
nsNativeTheme::nsNativeTheme()
: mAnimatedContentTimeout(PR_UINT32_MAX)

View File

@ -77,6 +77,8 @@ CPPSRCS = \
ifdef HAVE_CLOCK_MONOTONIC
CPPSRCS += TimeStamp_posix.cpp
else ifeq ($(OS_ARCH),Darwin)
CPPSRCS += TimeStamp_darwin.cpp
else
CPPSRCS += TimeStamp.cpp
endif

View File

@ -78,6 +78,9 @@ public:
double ToMilliseconds() const {
return ToSeconds() * 1000.0;
}
double ToMicroseconds() const {
return ToMilliseconds() * 1000.0;
}
// Using a double here is safe enough; with 53 bits we can represent
// durations up to over 280,000 years exactly. If the units of

View File

@ -0,0 +1,192 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeff Muizelaar <jmuizelaar@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//
// Implement TimeStamp::Now() with mach_absolute_time
//
// The "tick" unit for mach_absolute_time is defined using mach_timebase_info() which
// gives a conversion ratio to nanoseconds. For more information see Apple's QA1398.
//
// This code is inspired by Chromium's time_mac.cc. The biggest
// differences are that we explicitly initialize using
// TimeStamp::Initialize() instead of lazily in Now() and that
// we store the time value in ticks and convert when needed instead
// of storing the time value in nanoseconds.
#include <mach/mach_time.h>
#include <time.h>
#include "mozilla/TimeStamp.h"
// Estimate of the smallest duration of time we can measure.
static PRUint64 sResolution;
static PRUint64 sResolutionSigDigs;
static const PRUint16 kNsPerUs = 1000;
static const PRUint64 kNsPerMs = 1000000;
static const PRUint64 kNsPerSec = 1000000000;
static const double kNsPerMsd = 1000000.0;
static const double kNsPerSecd = 1000000000.0;
static double sNsPerTick;
static PRUint64
ClockTime()
{
// mach_absolute_time is it when it comes to ticks on the Mac. Other calls
// with less precision (such as TickCount) just call through to
// mach_absolute_time.
//
// At the time of writing mach_absolute_time returns the number of nanoseconds
// since boot. This won't overflow 64bits for 500+ years so we aren't going
// to worry about that possiblity
return mach_absolute_time();
}
static PRUint64
ClockResolutionNs()
{
PRUint64 start = ClockTime();
PRUint64 end = ClockTime();
PRUint64 minres = (end - start);
// 10 total trials is arbitrary: what we're trying to avoid by
// looping is getting unlucky and being interrupted by a context
// switch or signal, or being bitten by paging/cache effects
for (int i = 0; i < 9; ++i) {
start = ClockTime();
end = ClockTime();
PRUint64 candidate = (start - end);
if (candidate < minres)
minres = candidate;
}
if (0 == minres) {
// measurable resolution is either incredibly low, ~1ns, or very
// high. fall back on NSPR's resolution assumption
minres = 1 * kNsPerMs;
}
return minres;
}
namespace mozilla {
double
TimeDuration::ToSeconds() const
{
return (mValue * sNsPerTick) / kNsPerSecd;
}
double
TimeDuration::ToSecondsSigDigits() const
{
// don't report a value < mResolution ...
PRInt64 valueSigDigs = sResolution * (mValue / sResolution);
// and chop off insignificant digits
valueSigDigs = sResolutionSigDigs * (valueSigDigs / sResolutionSigDigs);
return (valueSigDigs * sNsPerTick) / kNsPerSecd;
}
TimeDuration
TimeDuration::FromMilliseconds(double aMilliseconds)
{
return TimeDuration::FromTicks(PRInt64((aMilliseconds * kNsPerMsd) / sNsPerTick));
}
TimeDuration
TimeDuration::Resolution()
{
return TimeDuration::FromTicks(PRInt64(sResolution));
}
struct TimeStampInitialization
{
TimeStampInitialization() {
TimeStamp::Startup();
}
~TimeStampInitialization() {
TimeStamp::Shutdown();
}
};
static TimeStampInitialization initOnce;
static PRBool gInitialized = PR_FALSE;
nsresult
TimeStamp::Startup()
{
if (gInitialized)
return NS_OK;
mach_timebase_info_data_t timebaseInfo;
// Apple's QA1398 suggests that the output from mach_timebase_info
// will not change while a program is running, so it should be safe
// to cache the result.
kern_return_t kr = mach_timebase_info(&timebaseInfo);
if (kr != KERN_SUCCESS)
NS_RUNTIMEABORT("mach_timebase_info failed");
sNsPerTick = double(timebaseInfo.numer) / timebaseInfo.denom;
sResolution = ClockResolutionNs();
// find the number of significant digits in sResolution, for the
// sake of ToSecondsSigDigits()
for (sResolutionSigDigs = 1;
!(sResolutionSigDigs == sResolution
|| 10*sResolutionSigDigs > sResolution);
sResolutionSigDigs *= 10);
gInitialized = PR_TRUE;
return NS_OK;
}
void
TimeStamp::Shutdown()
{
}
TimeStamp
TimeStamp::Now()
{
return TimeStamp(ClockTime());
}
}