Merge m-c to s-c.

This commit is contained in:
Richard Newman 2012-06-11 16:49:27 -07:00
commit 70052c3560
16 changed files with 212 additions and 96 deletions

View File

@ -282,7 +282,8 @@ MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext)
if (shell) {
nsIFrame *rootFrame = shell->GetRootFrame();
if (rootFrame) {
shell->FrameNeedsReflow(rootFrame, nsIPresShell::eResize,
shell->FrameNeedsReflow(rootFrame,
nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
}
}

View File

@ -3461,7 +3461,7 @@ class CGBindingRoot(CGThing):
['mozilla/dom/BindingUtils.h',
'mozilla/dom/DOMJSClass.h'],
['mozilla/dom/Nullable.h',
'mozilla/dom/PrimitiveConversions.h',
'PrimitiveConversions.h',
'XPCQuickStubs.h',
'nsDOMQS.h',
'AccessCheck.h',

View File

@ -64,7 +64,6 @@ EXPORTS_$(binding_include_path) = \
PrototypeList.h \
RegisterBindings.h \
Nullable.h \
PrimitiveConversions.h \
TypedArray.h \
BindingUtils.h \
$(exported_binding_headers) \

View File

@ -11,6 +11,8 @@
#ifndef mozilla_dom_PrimitiveConversions_h
#define mozilla_dom_PrimitiveConversions_h
#include "xpcpublic.h"
namespace mozilla {
namespace dom {

View File

@ -31,6 +31,7 @@ CPPSRCS := $(subst .webidl,Binding.cpp,$(test_webidl_files))
LOCAL_INCLUDES += \
-I$(topsrcdir)/js/xpconnect/src \
-I$(topsrcdir)/js/xpconnect/wrappers \
-I$(topsrcdir)/dom/bindings \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1710,6 +1710,56 @@ void nsPluginInstanceOwner::ScrollPositionDidChange(nscoord aX, nscoord aY)
#ifdef MOZ_WIDGET_ANDROID
// Modified version of nsFrame::GetOffsetToCrossDoc that stops when it
// hits an element with a displayport (or runs out of frames). This is
// not really the right thing to do, but it's better than what was here before.
static nsPoint
GetOffsetRootContent(nsIFrame* aFrame)
{
// offset will hold the final offset
// docOffset holds the currently accumulated offset at the current APD, it
// will be converted and added to offset when the current APD changes.
nsPoint offset(0, 0), docOffset(0, 0);
const nsIFrame* f = aFrame;
PRInt32 currAPD = aFrame->PresContext()->AppUnitsPerDevPixel();
PRInt32 apd = currAPD;
nsRect displayPort;
while (f) {
if (f->GetContent() && nsLayoutUtils::GetDisplayPort(f->GetContent(), &displayPort))
break;
docOffset += f->GetPosition();
nsIFrame* parent = f->GetParent();
if (parent) {
f = parent;
} else {
nsPoint newOffset(0, 0);
f = nsLayoutUtils::GetCrossDocParentFrame(f, &newOffset);
PRInt32 newAPD = f ? f->PresContext()->AppUnitsPerDevPixel() : 0;
if (!f || newAPD != currAPD) {
// Convert docOffset to the right APD and add it to offset.
offset += docOffset.ConvertAppUnits(currAPD, apd);
docOffset.x = docOffset.y = 0;
}
currAPD = newAPD;
docOffset += newOffset;
}
}
offset += docOffset.ConvertAppUnits(currAPD, apd);
return offset;
}
gfxRect nsPluginInstanceOwner::GetPluginRect()
{
// Get the offset of the content relative to the page
nsRect bounds = mObjectFrame->GetContentRectRelativeToSelf() + GetOffsetRootContent(mObjectFrame);
nsIntRect intBounds = bounds.ToNearestPixels(mObjectFrame->PresContext()->AppUnitsPerDevPixel());
return gfxRect(intBounds);
}
void nsPluginInstanceOwner::SendSize(int width, int height)
{
if (!mInstance)
@ -1797,12 +1847,16 @@ void nsPluginInstanceOwner::ExitFullScreen() {
PRInt32 model = mInstance->GetANPDrawingModel();
if (model == kSurface_ANPDrawingModel) {
// We need to invalidate the plugin rect so Paint() gets called above.
// This will cause the view to be re-added. Gross.
Invalidate();
// We need to do this immediately, otherwise Flash
// sometimes causes a deadlock (bug 762407)
AddPluginView(GetPluginRect());
}
mInstance->NotifyFullScreen(mFullScreen);
// This will cause Paint() to be called, which is where
// we normally add/update views and layers
Invalidate();
}
void nsPluginInstanceOwner::ExitFullScreen(jobject view) {
@ -2848,47 +2902,6 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
#ifdef MOZ_WIDGET_ANDROID
// Modified version of nsFrame::GetOffsetToCrossDoc that stops when it
// hits an element with a displayport (or runs out of frames). This is
// not really the right thing to do, but it's better than what was here before.
static nsPoint
GetOffsetRootContent(nsIFrame* aFrame)
{
// offset will hold the final offset
// docOffset holds the currently accumulated offset at the current APD, it
// will be converted and added to offset when the current APD changes.
nsPoint offset(0, 0), docOffset(0, 0);
const nsIFrame* f = aFrame;
PRInt32 currAPD = aFrame->PresContext()->AppUnitsPerDevPixel();
PRInt32 apd = currAPD;
nsRect displayPort;
while (f) {
if (f->GetContent() && nsLayoutUtils::GetDisplayPort(f->GetContent(), &displayPort))
break;
docOffset += f->GetPosition();
nsIFrame* parent = f->GetParent();
if (parent) {
f = parent;
} else {
nsPoint newOffset(0, 0);
f = nsLayoutUtils::GetCrossDocParentFrame(f, &newOffset);
PRInt32 newAPD = f ? f->PresContext()->AppUnitsPerDevPixel() : 0;
if (!f || newAPD != currAPD) {
// Convert docOffset to the right APD and add it to offset.
offset += docOffset.ConvertAppUnits(currAPD, apd);
docOffset.x = docOffset.y = 0;
}
currAPD = newAPD;
docOffset += newOffset;
}
}
offset += docOffset.ConvertAppUnits(currAPD, apd);
return offset;
}
void nsPluginInstanceOwner::Paint(gfxContext* aContext,
const gfxRect& aFrameRect,
const gfxRect& aDirtyRect)
@ -2898,10 +2911,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
PRInt32 model = mInstance->GetANPDrawingModel();
// Get the offset of the content relative to the page
nsRect bounds = mObjectFrame->GetContentRectRelativeToSelf() + GetOffsetRootContent(mObjectFrame);
nsIntRect intBounds = bounds.ToNearestPixels(mObjectFrame->PresContext()->AppUnitsPerDevPixel());
gfxRect pluginRect(intBounds);
gfxRect pluginRect = GetPluginRect();
if (model == kSurface_ANPDrawingModel) {
if (!AddPluginView(pluginRect)) {

View File

@ -299,6 +299,7 @@ private:
#ifdef MOZ_WIDGET_ANDROID
void SendSize(int width, int height);
gfxRect GetPluginRect();
bool AddPluginView(const gfxRect& aRect = gfxRect(0, 0, 0, 0));
void RemovePluginView();

View File

@ -331,6 +331,10 @@ public class GeckoAppShell
File cacheFile = getCacheDir();
GeckoAppShell.putenv("MOZ_LINKER_CACHE=" + cacheFile.getPath());
// setup the app-specific cache path
f = geckoApp.getCacheDir();
GeckoAppShell.putenv("CACHE_DIRECTORY=" + f.getPath());
// gingerbread introduces File.getUsableSpace(). We should use that.
long freeSpace = getFreeSpace();
try {

View File

@ -2516,6 +2516,8 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
if (aIntrinsicDirty == eStyleChange) {
// Mark all descendants dirty (using an nsTArray stack rather than
// recursion).
// Note that nsHTMLReflowState::InitResizeFlags has some similar
// code; see comments there for how and why it differs.
nsAutoTArray<nsIFrame*, 32> stack;
stack.AppendElement(subtreeRoot);

View File

@ -38,7 +38,7 @@ nsFontInflationData::FindFontInflationDataFor(const nsIFrame *aFrame)
bfc->Properties().Get(FontInflationDataProperty()));
}
/* static */ void
/* static */ bool
nsFontInflationData::UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aReflowState)
{
nsIFrame *bfc = aReflowState.frame;
@ -47,12 +47,22 @@ nsFontInflationData::UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aR
FrameProperties bfcProps(bfc->Properties());
nsFontInflationData *data = static_cast<nsFontInflationData*>(
bfcProps.Get(FontInflationDataProperty()));
if (!data) {
bool oldInflationEnabled;
nscoord oldNCAWidth;
if (data) {
oldNCAWidth = data->mNCAWidth;
oldInflationEnabled = data->mInflationEnabled;
} else {
data = new nsFontInflationData(bfc);
bfcProps.Set(FontInflationDataProperty(), data);
oldNCAWidth = -1;
oldInflationEnabled = true; /* not relevant */
}
data->UpdateWidth(aReflowState);
return oldNCAWidth != data->mNCAWidth ||
oldInflationEnabled != data->mInflationEnabled;
}
/* static */ void

View File

@ -20,7 +20,9 @@ public:
static nsFontInflationData* FindFontInflationDataFor(const nsIFrame *aFrame);
static void
// Returns whether the effective width changed (which requires the
// caller to mark its descendants dirty
static bool
UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aReflowState);
static void MarkFontInflationDataTextDirty(nsIFrame *aFrame);

View File

@ -308,12 +308,6 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
if (frame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) {
// Create our font inflation data if we don't have it already, and
// give it our current width information.
nsFontInflationData::UpdateFontInflationDataWidthFor(*this);
}
}
void nsHTMLReflowState::InitCBReflowState()
@ -367,35 +361,92 @@ IsQuirkContainingBlockHeight(const nsHTMLReflowState* rs, nsIAtom* aFrameType)
void
nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
{
mFlags.mHResize = !(frame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
frame->GetSize().width !=
mComputedWidth + mComputedBorderPadding.LeftRight();
if (mFlags.mHResize &&
nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
// When font size inflation is enabled, the change in the width of a
// block (or anything that returns true in
// IsContainerForFontSizeInflation) needs to cause a dirty reflow
// since it changes the size of text, line-heights, etc. This is
// relatively similar to a classic case of style change reflow,
// except that because inflation doesn't affect the intrinsic sizing
// codepath, there's no need to invalidate intrinsic sizes.
//
// Note that this makes horizontal resizing a good bit more
// expensive. However, font size inflation is targeted at a set of
// devices (zoom-and-pan devices) where the main use case for
// horizontal resizing needing to be efficient (window resizing) is
// not present. It does still increase the cost of dynamic changes
// caused by script where a style or content change in one place
// causes a resize in another (e.g., rebalancing a table).
bool isHResize = frame->GetSize().width !=
mComputedWidth + mComputedBorderPadding.LeftRight();
// FIXME: This isn't so great for the cases where
// nsHTMLReflowState::SetComputedWith is called, if the first time
// we go through InitResizeFlags we set mHResize to true, and then
// the second time we'd set it to false even without the
// NS_FRAME_IS_DIRTY bit already set.
frame->AddStateBits(NS_FRAME_IS_DIRTY);
if ((frame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) &&
nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
// Create our font inflation data if we don't have it already, and
// give it our current width information.
bool dirty = nsFontInflationData::UpdateFontInflationDataWidthFor(*this);
if (dirty || (!frame->GetParent() && isHResize)) {
// When font size inflation is enabled, a change in either:
// * the effective width of a font inflation flow root
// * the width of the frame
// needs to cause a dirty reflow since they change the font size
// inflation calculations, which in turn change the size of text,
// line-heights, etc. This is relatively similar to a classic
// case of style change reflow, except that because inflation
// doesn't affect the intrinsic sizing codepath, there's no need
// to invalidate intrinsic sizes.
//
// Note that this makes horizontal resizing a good bit more
// expensive. However, font size inflation is targeted at a set of
// devices (zoom-and-pan devices) where the main use case for
// horizontal resizing needing to be efficient (window resizing) is
// not present. It does still increase the cost of dynamic changes
// caused by script where a style or content change in one place
// causes a resize in another (e.g., rebalancing a table).
// FIXME: This isn't so great for the cases where
// nsHTMLReflowState::SetComputedWidth is called, if the first time
// we go through InitResizeFlags we set mHResize to true, and then
// the second time we'd set it to false even without the
// NS_FRAME_IS_DIRTY bit already set.
if (frame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
// Foreign object frames use dirty bits in a special way.
frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
nsIFrame *kid = frame->GetFirstPrincipalChild();
if (kid) {
kid->AddStateBits(NS_FRAME_IS_DIRTY);
}
} else {
frame->AddStateBits(NS_FRAME_IS_DIRTY);
}
// Mark intrinsic widths on all descendants dirty. We need to do
// this (1) since we're changing the size of text and need to
// clear text runs on text frames and (2) since we actually are
// changing some intrinsic widths, but only those that live inside
// of containers.
// It makes sense to do this for descendants but not ancestors
// (which is unusual) because we're only changing the unusual
// inflation-dependent intrinsic widths (i.e., ones computed with
// nsPresContext::mInflationDisabledForShrinkWrap set to false),
// which should never affect anything outside of their inflation
// flow root (or, for that matter, even their inflation
// container).
// This is also different from what PresShell::FrameNeedsReflow
// does because it doesn't go through placeholders. It doesn't
// need to because we're actually doing something that cares about
// frame tree geometry (the width on an ancestor) rather than
// style.
nsAutoTArray<nsIFrame*, 32> stack;
stack.AppendElement(frame);
do {
nsIFrame *f = stack.ElementAt(stack.Length() - 1);
stack.RemoveElementAt(stack.Length() - 1);
nsIFrame::ChildListIterator lists(f);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
kid->MarkIntrinsicWidthsDirty();
stack.AppendElement(kid);
}
}
} while (stack.Length() != 0);
}
}
mFlags.mHResize = !(frame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
isHResize;
// XXX Should we really need to null check mCBReflowState? (We do for
// at least nsBoxFrame).
if (IS_TABLE_CELL(aFrameType) &&

View File

@ -1673,8 +1673,6 @@ abstract public class GeckoApp
return;
}
GeckoAppShell.onFullScreenPluginHidden(view);
mFullScreenPluginContainer.removeView(mFullScreenPluginView);
// We need do do this on the next iteration in order to avoid
@ -2920,7 +2918,8 @@ abstract public class GeckoApp
}
if (mFullScreenPluginView != null) {
removePluginView(mFullScreenPluginView, true);
GeckoAppShell.onFullScreenPluginHidden(mFullScreenPluginView);
removeFullScreenPluginView(mFullScreenPluginView);
return;
}

View File

@ -386,6 +386,10 @@ public class GeckoAppShell
// Enable fixed position layers
GeckoAppShell.putenv("MOZ_ENABLE_FIXED_POSITION_LAYERS=1");
// setup the app-specific cache path
f = context.getCacheDir();
GeckoAppShell.putenv("CACHE_DIRECTORY=" + f.getPath());
putLocaleEnv();
}

View File

@ -215,9 +215,6 @@ nsDeleteDir::DeleteDir(nsIFile *dirIn, bool moveToTrash, PRUint32 delay)
if (NS_FAILED(rv))
return rv;
// Important: must rename directory w/o changing parent directory: else on
// NTFS we'll wait (with cache lock) while nsIFile's ACL reset walks file
// tree: was hanging GUI for *minutes* on large cache dirs.
// Append random number to the trash directory and check if it exists.
srand(PR_Now());
nsCAutoString leaf;
@ -240,7 +237,18 @@ nsDeleteDir::DeleteDir(nsIFile *dirIn, bool moveToTrash, PRUint32 delay)
if (!leaf.Length())
return NS_ERROR_FAILURE;
#if defined(MOZ_WIDGET_ANDROID)
nsCOMPtr<nsIFile> parent;
rv = trash->GetParent(getter_AddRefs(parent));
if (NS_FAILED(rv))
return rv;
rv = dir->MoveToNative(parent, leaf);
#else
// Important: must rename directory w/o changing parent directory: else on
// NTFS we'll wait (with cache lock) while nsIFile's ACL reset walks file
// tree: was hanging GUI for *minutes* on large cache dirs.
rv = dir->MoveToNative(nsnull, leaf);
#endif
if (NS_FAILED(rv))
return rv;
} else {
@ -262,7 +270,25 @@ nsDeleteDir::DeleteDir(nsIFile *dirIn, bool moveToTrash, PRUint32 delay)
nsresult
nsDeleteDir::GetTrashDir(nsIFile *target, nsCOMPtr<nsIFile> *result)
{
nsresult rv = target->Clone(getter_AddRefs(*result));
nsresult rv;
#if defined(MOZ_WIDGET_ANDROID)
// Try to use the app cache folder for cache trash on Android
char* cachePath = getenv("CACHE_DIRECTORY");
if (cachePath) {
rv = NS_NewNativeLocalFile(nsDependentCString(cachePath),
true, getter_AddRefs(*result));
if (NS_FAILED(rv))
return rv;
// Add a sub folder with the cache folder name
nsCAutoString leaf;
rv = target->GetNativeLeafName(leaf);
(*result)->AppendNative(leaf);
} else
#endif
{
rv = target->Clone(getter_AddRefs(*result));
}
if (NS_FAILED(rv))
return rv;
@ -301,7 +327,11 @@ nsDeleteDir::RemoveOldTrashes(nsIFile *cacheDir)
return rv;
nsCOMPtr<nsIFile> parent;
#if defined(MOZ_WIDGET_ANDROID)
rv = trash->GetParent(getter_AddRefs(parent));
#else
rv = cacheDir->GetParent(getter_AddRefs(parent));
#endif
if (NS_FAILED(rv))
return rv;

View File

@ -71,7 +71,7 @@ class MarionetteTestResult(unittest._TextTestResult):
for testcase in test._tests:
if testcase.perfdata:
if not self.perfdata:
self.perfdata = datazilla.dzResult(testcase.perfdata)
self.perfdata = datazilla.DatazillaResult(testcase.perfdata)
else:
self.perfdata.join_results(testcase.perfdata)
@ -339,7 +339,7 @@ class MarionetteTestRunner(object):
self.logger.info("Using machine_name: %s" % machine_name)
os_name = platform.system()
os_version = platform.release()
self.perfrequest = datazilla.dzRequest(server=options.perfserv, machine_name=machine_name, os=os_name, os_version=os_version,
self.perfrequest = datazilla.DatazillaRequest(server=options.perfserv, machine_name=machine_name, os=os_name, os_version=os_version,
platform=manifest.get("platform")[0], build_name=manifest.get("build_name")[0],
version=manifest.get("version")[0], revision=self.revision,
branch=manifest.get("branch")[0], id=os.getenv('BUILD_ID'), test_date=int(time.time()))
@ -370,7 +370,7 @@ class MarionetteTestRunner(object):
results = MarionetteTextTestRunner(verbosity=3).run(suite)
self.failed += len(results.failures) + len(results.errors)
if results.perfdata:
self.perfrequest.add_dzresult(results.perfdata)
self.perfrequest.add_datazilla_result(results.perfdata)
if hasattr(results, 'skipped'):
self.todo += len(results.skipped) + len(results.expectedFailures)
self.passed += results.passed