mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c.
This commit is contained in:
commit
fdd42a380a
@ -14,6 +14,7 @@
|
||||
#include "nsFontMetrics.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "HyperTextAccessible.h"
|
||||
#include "mozilla/AppUnits.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
@ -504,7 +505,7 @@ TextAttrsMgr::FontSizeTextAttr::
|
||||
//
|
||||
// XXX todo: consider sharing this code with layout module? (bug 474621)
|
||||
float px =
|
||||
NSAppUnitsToFloatPixels(aValue, nsDeviceContext::AppUnitsPerCSSPixel());
|
||||
NSAppUnitsToFloatPixels(aValue, mozilla::AppUnitsPerCSSPixel());
|
||||
// Each pt is 4/3 of a CSS pixel.
|
||||
int pts = NS_lround(px*3/4);
|
||||
|
||||
|
@ -549,6 +549,7 @@ let gHistorySwipeAnimation = {
|
||||
this.isLTR = document.documentElement.mozMatchesSelector(
|
||||
":-moz-locale-dir(ltr)");
|
||||
this._trackedSnapshots = [];
|
||||
this._startingIndex = -1;
|
||||
this._historyIndex = -1;
|
||||
this._boxWidth = -1;
|
||||
this._maxSnapshots = this._getMaxSnapshots();
|
||||
@ -561,6 +562,7 @@ let gHistorySwipeAnimation = {
|
||||
gBrowser.addEventListener("pagehide", this, false);
|
||||
gBrowser.addEventListener("pageshow", this, false);
|
||||
gBrowser.addEventListener("popstate", this, false);
|
||||
gBrowser.addEventListener("DOMModalDialogClosed", this, false);
|
||||
gBrowser.tabContainer.addEventListener("TabClose", this, false);
|
||||
}
|
||||
},
|
||||
@ -572,6 +574,7 @@ let gHistorySwipeAnimation = {
|
||||
gBrowser.removeEventListener("pagehide", this, false);
|
||||
gBrowser.removeEventListener("pageshow", this, false);
|
||||
gBrowser.removeEventListener("popstate", this, false);
|
||||
gBrowser.removeEventListener("DOMModalDialogClosed", this, false);
|
||||
gBrowser.tabContainer.removeEventListener("TabClose", this, false);
|
||||
|
||||
this.active = false;
|
||||
@ -591,7 +594,8 @@ let gHistorySwipeAnimation = {
|
||||
this._handleFastSwiping();
|
||||
}
|
||||
else {
|
||||
this._historyIndex = gBrowser.webNavigation.sessionHistory.index;
|
||||
this._startingIndex = gBrowser.webNavigation.sessionHistory.index;
|
||||
this._historyIndex = this._startingIndex;
|
||||
this._canGoBack = this.canGoBack();
|
||||
this._canGoForward = this.canGoForward();
|
||||
if (this.active) {
|
||||
@ -622,20 +626,24 @@ let gHistorySwipeAnimation = {
|
||||
if (!this.isAnimationRunning())
|
||||
return;
|
||||
|
||||
// We use the following value to decrease the bounce effect when swiping
|
||||
// back/forward past the browsing history. This value was determined
|
||||
// experimentally.
|
||||
let dampValue = 4;
|
||||
if ((aVal >= 0 && this.isLTR) ||
|
||||
(aVal <= 0 && !this.isLTR)) {
|
||||
if (aVal > 1)
|
||||
aVal = 1; // Cap value to avoid sliding the page further than allowed.
|
||||
|
||||
let tempDampValue = 1;
|
||||
if (this._canGoBack)
|
||||
this._prevBox.collapsed = false;
|
||||
else
|
||||
else {
|
||||
tempDampValue = dampValue;
|
||||
this._prevBox.collapsed = true;
|
||||
}
|
||||
|
||||
// The current page is pushed to the right (LTR) or left (RTL),
|
||||
// the intention is to go back.
|
||||
// If there is a page to go back to, it should show in the background.
|
||||
this._positionBox(this._curBox, aVal);
|
||||
this._positionBox(this._curBox, aVal / tempDampValue);
|
||||
|
||||
// The forward page should be pushed offscreen all the way to the right.
|
||||
this._positionBox(this._nextBox, 1);
|
||||
@ -651,13 +659,14 @@ let gHistorySwipeAnimation = {
|
||||
// For the backdrop to be visible in that case, the previous page needs
|
||||
// to be hidden (if it exists).
|
||||
if (this._canGoForward) {
|
||||
this._nextBox.collapsed = false;
|
||||
let offset = this.isLTR ? 1 : -1;
|
||||
this._positionBox(this._curBox, 0);
|
||||
this._positionBox(this._nextBox, offset + aVal); // aVal is negative
|
||||
this._positionBox(this._nextBox, offset + aVal);
|
||||
}
|
||||
else {
|
||||
this._prevBox.collapsed = true;
|
||||
this._positionBox(this._curBox, aVal);
|
||||
this._positionBox(this._curBox, aVal / dampValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -674,13 +683,14 @@ let gHistorySwipeAnimation = {
|
||||
let browser = gBrowser.getBrowserForTab(aEvent.target);
|
||||
this._removeTrackedSnapshot(-1, browser);
|
||||
break;
|
||||
case "DOMModalDialogClosed":
|
||||
this.stopAnimation();
|
||||
break;
|
||||
case "pageshow":
|
||||
case "popstate":
|
||||
if (this.isAnimationRunning()) {
|
||||
if (aEvent.target != gBrowser.selectedBrowser.contentDocument)
|
||||
break;
|
||||
this.stopAnimation();
|
||||
}
|
||||
if (aEvent.target != gBrowser.selectedBrowser.contentDocument)
|
||||
break;
|
||||
this.stopAnimation();
|
||||
this._historyIndex = gBrowser.webNavigation.sessionHistory.index;
|
||||
break;
|
||||
case "pagehide":
|
||||
@ -748,7 +758,7 @@ let gHistorySwipeAnimation = {
|
||||
* any. This will also result in the animation overlay to be torn down.
|
||||
*/
|
||||
swipeEndEventReceived: function HSA_swipeEndEventReceived() {
|
||||
if (this._lastSwipeDir != "")
|
||||
if (this._lastSwipeDir != "" && this._historyIndex != this._startingIndex)
|
||||
this._navigateToHistoryIndex();
|
||||
else
|
||||
this.stopAnimation();
|
||||
@ -776,9 +786,10 @@ let gHistorySwipeAnimation = {
|
||||
* |this|.
|
||||
*/
|
||||
_navigateToHistoryIndex: function HSA__navigateToHistoryIndex() {
|
||||
if (this._doesIndexExistInHistory(this._historyIndex)) {
|
||||
if (this._doesIndexExistInHistory(this._historyIndex))
|
||||
gBrowser.webNavigation.gotoIndex(this._historyIndex);
|
||||
}
|
||||
else
|
||||
this.stopAnimation();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1004,12 +1015,17 @@ let gHistorySwipeAnimation = {
|
||||
return aBlob;
|
||||
|
||||
let img = new Image();
|
||||
let url = URL.createObjectURL(aBlob);
|
||||
img.onload = function() {
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
img.src = url;
|
||||
return img;
|
||||
let url = "";
|
||||
try {
|
||||
url = URL.createObjectURL(aBlob);
|
||||
img.onload = function() {
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
}
|
||||
finally {
|
||||
img.src = url;
|
||||
return img;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,28 @@ import glob, logging, os, platform, shutil, subprocess, sys, tempfile, urllib2,
|
||||
import re
|
||||
from urlparse import urlparse
|
||||
|
||||
try:
|
||||
import mozinfo
|
||||
except ImportError:
|
||||
# Stub out fake mozinfo since this is not importable on Android 4.0 Opt.
|
||||
# This should be fixed; see
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=650881
|
||||
mozinfo = type('mozinfo', (), dict(info={}))()
|
||||
mozinfo.isWin = mozinfo.isLinux = mozinfo.isUnix = mozinfo.isMac = False
|
||||
|
||||
# TODO! FILE: localautomation :/
|
||||
# mapping from would-be mozinfo attr <-> sys.platform
|
||||
mapping = {'isMac': ['mac', 'darwin'],
|
||||
'isLinux': ['linux', 'linux2'],
|
||||
'isWin': ['win32', 'win64'],
|
||||
}
|
||||
mapping = dict(sum([[(value, key) for value in values] for key, values in mapping.items()], []))
|
||||
attr = mapping.get(sys.platform)
|
||||
if attr:
|
||||
setattr(mozinfo, attr, True)
|
||||
if mozinfo.isLinux:
|
||||
mozinfo.isUnix = True
|
||||
|
||||
__all__ = [
|
||||
"ZipFileReader",
|
||||
"addCommonOptions",
|
||||
@ -18,6 +40,10 @@ __all__ = [
|
||||
"DEBUGGER_INFO",
|
||||
"replaceBackSlashes",
|
||||
"wrapCommand",
|
||||
'KeyValueParseError',
|
||||
'parseKeyValue',
|
||||
'systemMemory',
|
||||
'environment'
|
||||
]
|
||||
|
||||
# Map of debugging programs to information about them, like default arguments
|
||||
@ -345,3 +371,105 @@ def wrapCommand(cmd):
|
||||
return ["arch", "-arch", "i386"] + cmd
|
||||
# otherwise just execute the command normally
|
||||
return cmd
|
||||
|
||||
class KeyValueParseError(Exception):
|
||||
"""error when parsing strings of serialized key-values"""
|
||||
def __init__(self, msg, errors=()):
|
||||
self.errors = errors
|
||||
Exception.__init__(self, msg)
|
||||
|
||||
def parseKeyValue(strings, separator='=', context='key, value: '):
|
||||
"""
|
||||
parse string-serialized key-value pairs in the form of
|
||||
`key = value`. Returns a list of 2-tuples.
|
||||
Note that whitespace is not stripped.
|
||||
"""
|
||||
|
||||
# syntax check
|
||||
missing = [string for string in strings if separator not in string]
|
||||
if missing:
|
||||
raise KeyValueParseError("Error: syntax error in %s" % (context,
|
||||
','.join(missing)),
|
||||
errors=missing)
|
||||
return [string.split(separator, 1) for string in strings]
|
||||
|
||||
def systemMemory():
|
||||
"""
|
||||
Returns total system memory in kilobytes.
|
||||
Works only on unix-like platforms where `free` is in the path.
|
||||
"""
|
||||
return int(os.popen("free").readlines()[1].split()[1])
|
||||
|
||||
def environment(xrePath, env=None, crashreporter=True):
|
||||
"""populate OS environment variables for mochitest"""
|
||||
|
||||
env = os.environ.copy() if env is None else env
|
||||
|
||||
assert os.path.isabs(xrePath)
|
||||
|
||||
ldLibraryPath = xrePath
|
||||
|
||||
envVar = None
|
||||
if mozinfo.isUnix:
|
||||
envVar = "LD_LIBRARY_PATH"
|
||||
env['MOZILLA_FIVE_HOME'] = xrePath
|
||||
elif mozinfo.isMac:
|
||||
envVar = "DYLD_LIBRARY_PATH"
|
||||
elif mozinfo.isWin:
|
||||
envVar = "PATH"
|
||||
if envVar:
|
||||
envValue = ((env.get(envVar), str(ldLibraryPath))
|
||||
if mozinfo.isWin
|
||||
else (ldLibraryPath, env.get(envVar)))
|
||||
env[envVar] = os.path.pathsep.join([path for path in envValue if path])
|
||||
|
||||
# crashreporter
|
||||
env['GNOME_DISABLE_CRASH_DIALOG'] = '1'
|
||||
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
|
||||
env['NS_TRACE_MALLOC_DISABLE_STACKS'] = '1'
|
||||
|
||||
if crashreporter:
|
||||
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
|
||||
env['MOZ_CRASHREPORTER'] = '1'
|
||||
else:
|
||||
env['MOZ_CRASHREPORTER_DISABLE'] = '1'
|
||||
|
||||
# Additional temporary logging while we try to debug some intermittent
|
||||
# WebRTC conditions. This is necessary to troubleshoot bugs 841496,
|
||||
# 841150, and 839677 (at least)
|
||||
# Also (temporary) bug 870002 (mediastreamgraph)
|
||||
env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:3')
|
||||
env['R_LOG_LEVEL'] = '5'
|
||||
env['R_LOG_DESTINATION'] = 'stderr'
|
||||
env['R_LOG_VERBOSE'] = '1'
|
||||
|
||||
# ASan specific environment stuff
|
||||
asan = bool(mozinfo.info.get("asan"))
|
||||
if asan and (mozinfo.isLinux or mozinfo.isMac):
|
||||
try:
|
||||
totalMemory = systemMemory()
|
||||
|
||||
# Only 2 GB RAM or less available? Use custom ASan options to reduce
|
||||
# the amount of resources required to do the tests. Standard options
|
||||
# will otherwise lead to OOM conditions on the current test slaves.
|
||||
#
|
||||
# If we have more than 2 GB or RAM but still less than 4 GB, we need
|
||||
# another set of options to prevent OOM in some memory-intensive
|
||||
# tests.
|
||||
message = "INFO | runtests.py | ASan running in %s configuration"
|
||||
if totalMemory <= 1024 * 1024 * 2:
|
||||
message = message % 'low-memory'
|
||||
env["ASAN_OPTIONS"] = "quarantine_size=50331648:redzone=64"
|
||||
elif totalMemory <= 1024 * 1024 * 4:
|
||||
message = message % 'mid-memory'
|
||||
env["ASAN_OPTIONS"] = "quarantine_size=100663296:redzone=64"
|
||||
else:
|
||||
message = message % 'default memory'
|
||||
except OSError,err:
|
||||
log.info("Failed determine available memory, disabling ASan low-memory configuration: %s", err.strerror)
|
||||
except:
|
||||
log.info("Failed determine available memory, disabling ASan low-memory configuration")
|
||||
else:
|
||||
log.info(message)
|
||||
|
||||
return env
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsDeviceContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -12,7 +12,8 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsEvent.h"
|
||||
#include "mozilla/dom/UIEventBinding.h"
|
||||
#include "Units.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsDeviceContext.h"
|
||||
|
||||
class nsDOMUIEvent : public nsDOMEvent,
|
||||
public nsIDOMUIEvent
|
||||
|
@ -530,6 +530,12 @@ public:
|
||||
mTextTracks->AddTextTrack(aTextTrack);
|
||||
}
|
||||
|
||||
void RemoveTextTrack(TextTrack* aTextTrack) {
|
||||
if (mTextTracks) {
|
||||
mTextTracks->RemoveTextTrack(*aTextTrack);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
class MediaLoadListener;
|
||||
class StreamListener;
|
||||
|
@ -290,8 +290,15 @@ HTMLTrackElement::BindToTree(nsIDocument* aDocument,
|
||||
void
|
||||
HTMLTrackElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
if (mMediaParent && aNullParent) {
|
||||
mMediaParent = nullptr;
|
||||
if (mMediaParent) {
|
||||
// mTrack can be null if HTMLTrackElement::LoadResource has never been
|
||||
// called.
|
||||
if (mTrack) {
|
||||
mMediaParent->RemoveTextTrack(mTrack);
|
||||
}
|
||||
if (aNullParent) {
|
||||
mMediaParent = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
|
@ -73,15 +73,13 @@ TextTrack::SetMode(TextTrackMode aValue)
|
||||
void
|
||||
TextTrack::AddCue(TextTrackCue& aCue)
|
||||
{
|
||||
//XXX: If cue exists, remove. Bug 867823.
|
||||
mCueList->AddCue(aCue);
|
||||
}
|
||||
|
||||
void
|
||||
TextTrack::RemoveCue(TextTrackCue& aCue)
|
||||
TextTrack::RemoveCue(TextTrackCue& aCue, ErrorResult& aRv)
|
||||
{
|
||||
//XXX: If cue does not exists throw NotFoundError. Bug 867823.
|
||||
mCueList->RemoveCue(aCue);
|
||||
mCueList->RemoveCue(aCue, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
void Update(double aTime);
|
||||
|
||||
void AddCue(TextTrackCue& aCue);
|
||||
void RemoveCue(TextTrackCue& aCue);
|
||||
void RemoveCue(TextTrackCue& aCue, ErrorResult& aRv);
|
||||
void CueChanged(TextTrackCue& aCue);
|
||||
|
||||
IMPL_EVENT_HANDLER(cuechange)
|
||||
|
@ -116,6 +116,21 @@ public:
|
||||
CueChanged();
|
||||
}
|
||||
|
||||
void GetRegionId(nsAString& aRegionId) const
|
||||
{
|
||||
aRegionId = mRegionId;
|
||||
}
|
||||
|
||||
void SetRegionId(const nsAString& aRegionId)
|
||||
{
|
||||
if (mRegionId == aRegionId) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRegionId = aRegionId;
|
||||
CueChanged();
|
||||
}
|
||||
|
||||
DirectionSetting Vertical() const
|
||||
{
|
||||
return mVertical;
|
||||
@ -304,6 +319,7 @@ private:
|
||||
int32_t mSize;
|
||||
bool mPauseOnExit;
|
||||
bool mSnapToLines;
|
||||
nsString mRegionId;
|
||||
DirectionSetting mVertical;
|
||||
int mLine;
|
||||
TextTrackCueAlign mAlign;
|
||||
|
@ -66,12 +66,19 @@ TextTrackCueList::GetCueById(const nsAString& aId)
|
||||
void
|
||||
TextTrackCueList::AddCue(TextTrackCue& cue)
|
||||
{
|
||||
if (mList.Contains(&cue)) {
|
||||
return;
|
||||
}
|
||||
mList.AppendElement(&cue);
|
||||
}
|
||||
|
||||
void
|
||||
TextTrackCueList::RemoveCue(TextTrackCue& cue)
|
||||
TextTrackCueList::RemoveCue(TextTrackCue& cue, ErrorResult& aRv)
|
||||
{
|
||||
if (!mList.Contains(&cue)) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
|
||||
return;
|
||||
}
|
||||
mList.RemoveElement(&cue);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -47,7 +48,7 @@ public:
|
||||
TextTrackCue* GetCueById(const nsAString& aId);
|
||||
|
||||
void AddCue(TextTrackCue& cue);
|
||||
void RemoveCue(TextTrackCue& cue);
|
||||
void RemoveCue(TextTrackCue& cue, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/TextTrack.h"
|
||||
#include "mozilla/dom/TextTrackRegion.h"
|
||||
#include "mozilla/dom/TextTrackRegionBinding.h"
|
||||
#include "mozilla/dom/VTTRegionBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -22,7 +22,7 @@ NS_INTERFACE_MAP_END
|
||||
JSObject*
|
||||
TextTrackRegion::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return TextTrackRegionBinding::Wrap(aCx, aScope, this);
|
||||
return VTTRegionBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
already_AddRefed<TextTrackRegion>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "mozilla/dom/TextTrackRegion.h"
|
||||
#include "mozilla/dom/TextTrackRegionList.h"
|
||||
#include "mozilla/dom/TextTrackRegionListBinding.h"
|
||||
#include "mozilla/dom/VTTRegionListBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -23,7 +23,7 @@ NS_INTERFACE_MAP_END
|
||||
JSObject*
|
||||
TextTrackRegionList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return TextTrackRegionListBinding::Wrap(aCx, aScope, this);
|
||||
return VTTRegionListBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
TextTrackRegionList::TextTrackRegionList(nsISupports* aGlobal)
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "WebVTTListener.h"
|
||||
#include "mozilla/dom/TextTrackCue.h"
|
||||
#include "mozilla/dom/TextTrackRegion.h"
|
||||
#include "mozilla/dom/VTTRegionBinding.h"
|
||||
#include "mozilla/dom/HTMLTrackElement.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIWebVTTParserWrapper.h"
|
||||
@ -172,7 +174,17 @@ WebVTTListener::OnCue(const JS::Value &aCue, JSContext* aCx)
|
||||
NS_IMETHODIMP
|
||||
WebVTTListener::OnRegion(const JS::Value &aRegion, JSContext* aCx)
|
||||
{
|
||||
// TODO: Implement VTTRegions see bug 897504
|
||||
if (!aRegion.isObject()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
TextTrackRegion* region;
|
||||
nsresult rv = UNWRAP_OBJECT(VTTRegion, aCx, &aRegion.toObject(),
|
||||
region);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mElement->mTrack->AddRegion(*region);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,7 @@ MOCHITEST_FILES = \
|
||||
$(filter disabled-for-intermittent-failures--bug-608634, test_error_in_video_document.html) \
|
||||
test_texttrack.html \
|
||||
test_texttrackcue.html \
|
||||
test_texttrackregion.html \
|
||||
test_timeupdate_small_files.html \
|
||||
test_unseekable.html \
|
||||
test_VideoPlaybackQuality.html \
|
||||
@ -272,6 +273,7 @@ MOCHITEST_FILES += \
|
||||
notags.mp3 \
|
||||
id3tags.mp3 \
|
||||
basic.vtt \
|
||||
region.vtt \
|
||||
long.vtt \
|
||||
$(NULL)
|
||||
|
||||
|
5
content/media/test/region.vtt
Normal file
5
content/media/test/region.vtt
Normal file
@ -0,0 +1,5 @@
|
||||
WEBVTT
|
||||
Region: id=fred width=62% lines=5 regionanchor=4%,78% viewportanchor=10%,90% scroll=up
|
||||
|
||||
00:01.000 --> 00:02.000 region:fred
|
||||
Test here.
|
@ -84,40 +84,29 @@ SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
|
||||
is(cue.text, "foo", "Cue's text should be foo.");
|
||||
|
||||
// Adding the same cue again should not increase the cue count.
|
||||
// TODO: https://bugzilla.mozilla.org/show_bug.cgi?id=867823
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrack-addcue
|
||||
trackElement.track.addCue(vttCue);
|
||||
todo_is(cueList.length, 5, "Cue list length should be 5.");
|
||||
is(cueList.length, 5, "Cue list length should be 5.");
|
||||
|
||||
// Check that we are able to remove cues.
|
||||
trackElement.track.removeCue(cue);
|
||||
// TODO: Marked as todo as incorrect addition up top increases cue count
|
||||
// to 4 -- https://bugzilla.mozilla.org/show_bug.cgi?id=867823
|
||||
todo_is(cueList.length, 4, "Cue list length should be 4.");
|
||||
is(cueList.length, 4, "Cue list length should be 4.");
|
||||
|
||||
var exceptionHappened = false;
|
||||
try {
|
||||
// We should not be able to remove a cue that is not in the list.
|
||||
cue = new VTTCue(1, 2, "foo");
|
||||
trackElement.removeCue(cue);
|
||||
trackElement.track.removeCue(cue);
|
||||
} catch (e) {
|
||||
// "NotFoundError" should be thrown when trying to remove a cue that is
|
||||
// not in the list.
|
||||
// TODO: https://bugzilla.mozilla.org/show_bug.cgi?id=867823
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrack-removecue
|
||||
todo_is(e.name, "NotFoundError", "We should have caught an error.");
|
||||
is(e.name, "NotFoundError", "Should have thrown NotFoundError.");
|
||||
exceptionHappened = true;
|
||||
}
|
||||
// If this is false then we did not throw an error and probably removed a cue
|
||||
// when we shouln't have.
|
||||
ok(exceptionHappened, "Exception should have happened.");
|
||||
|
||||
// We should not have removed a cue so the cue list length should not
|
||||
// have changed.
|
||||
// TODO: Marked as todo as incorrect addition of cue up top increases
|
||||
// count erroneously.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=867823
|
||||
todo_is(cueList.length, 4, "Cue list length should be 4.");
|
||||
is(cueList.length, 4, "Cue list length should be 4.");
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
66
content/media/test/test_texttrackregion.html
Normal file
66
content/media/test/test_texttrackregion.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=917945
|
||||
-->
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>Test for Bug 917945 - VTTRegion</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
|
||||
function() {
|
||||
var video = document.createElement("video");
|
||||
video.src = "seek.webm";
|
||||
video.preload = "auto";
|
||||
var trackElement = document.createElement("track");
|
||||
trackElement.src = "region.vtt";
|
||||
trackElement.kind = "subtitles";
|
||||
document.getElementById("content").appendChild(video);
|
||||
video.appendChild(trackElement);
|
||||
video.addEventListener("loadedmetadata", function run_tests() {
|
||||
// Re-que run_tests() at the end of the event loop until the track
|
||||
// element has loaded its data.
|
||||
if (trackElement.readyState == 1) {
|
||||
setTimeout(run_tests, 0);
|
||||
return;
|
||||
}
|
||||
is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED.");
|
||||
|
||||
var cues = trackElement.track.cues,
|
||||
regions = trackElement.track.regions;
|
||||
|
||||
is(regions.length, 1, "Region list length should be 1.");
|
||||
is(cues.length, 1, "Cue list length should be 1.");
|
||||
|
||||
is(cues[0].regionId, "fred", "Cue regionId should be 'fred'.");
|
||||
|
||||
var region = regions[0];
|
||||
|
||||
is(region.id, "fred", "Region ID should be 'fred'.");
|
||||
is(region.width, 62, "Region width should be 50.");
|
||||
is(region.lines, 5, "Region lines should be 5.");
|
||||
is(region.regionAnchorX, 4, "Region regionAnchorX should be 4.");
|
||||
is(region.regionAnchorY, 78, "Region regionAnchorY should be 78.");
|
||||
is(region.viewportAnchorX, 10, "Region viewportAnchorX should be 10.");
|
||||
is(region.viewportAnchorY, 90, "Region viewportAnchorY should be 90.");
|
||||
is(region.scroll, "up", "Region scroll should be 'up'");
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -13,6 +13,7 @@
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "mozilla/dom/ScreenBinding.h"
|
||||
#include "nsDeviceContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -1254,6 +1254,14 @@ DOMInterfaces = {
|
||||
'nativeType': 'mozilla::dom::TextTrackCue'
|
||||
},
|
||||
|
||||
'VTTRegion': {
|
||||
'nativeType': 'mozilla::dom::TextTrackRegion',
|
||||
},
|
||||
|
||||
'VTTRegionList': {
|
||||
'nativeType': 'mozilla::dom::TextTrackRegionList',
|
||||
},
|
||||
|
||||
'WebGLActiveInfo': {
|
||||
'nativeType': 'mozilla::WebGLActiveInfo',
|
||||
'headerFile': 'WebGLActiveInfo.h',
|
||||
|
@ -34,13 +34,14 @@ interface TextTrack : EventTarget {
|
||||
|
||||
readonly attribute TextTrackCueList? cues;
|
||||
readonly attribute TextTrackCueList? activeCues;
|
||||
readonly attribute TextTrackRegionList? regions;
|
||||
readonly attribute VTTRegionList? regions;
|
||||
|
||||
void addCue(VTTCue cue);
|
||||
[Throws]
|
||||
void removeCue(VTTCue cue);
|
||||
|
||||
attribute EventHandler oncuechange;
|
||||
[Throws]
|
||||
void removeRegion(TextTrackRegion region);
|
||||
void addRegion(TextTrackRegion region);
|
||||
void removeRegion(VTTRegion region);
|
||||
void addRegion(VTTRegion region);
|
||||
};
|
||||
|
@ -34,6 +34,7 @@ interface VTTCue : EventTarget {
|
||||
attribute double startTime;
|
||||
attribute double endTime;
|
||||
attribute boolean pauseOnExit;
|
||||
attribute DOMString regionId;
|
||||
attribute DirectionSetting vertical;
|
||||
attribute boolean snapToLines;
|
||||
// XXXhumph: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20651
|
||||
|
@ -7,25 +7,24 @@
|
||||
* http://dev.w3.org/html5/webvtt/#extension-of-the-texttrack-interface-for-region-support
|
||||
*/
|
||||
|
||||
|
||||
[Constructor, Pref="media.webvtt.enabled"]
|
||||
interface TextTrackRegion {
|
||||
readonly attribute TextTrack? track;
|
||||
attribute DOMString id;
|
||||
|
||||
[SetterThrows]
|
||||
attribute double width;
|
||||
|
||||
attribute long lines;
|
||||
|
||||
[SetterThrows]
|
||||
attribute double regionAnchorX;
|
||||
[SetterThrows]
|
||||
attribute double regionAnchorY;
|
||||
[SetterThrows]
|
||||
attribute double viewportAnchorX;
|
||||
[SetterThrows]
|
||||
interface VTTRegion {
|
||||
readonly attribute TextTrack? track;
|
||||
attribute DOMString id;
|
||||
|
||||
[SetterThrows]
|
||||
attribute double width;
|
||||
|
||||
attribute long lines;
|
||||
|
||||
[SetterThrows]
|
||||
attribute double regionAnchorX;
|
||||
[SetterThrows]
|
||||
attribute double regionAnchorY;
|
||||
[SetterThrows]
|
||||
attribute double viewportAnchorX;
|
||||
[SetterThrows]
|
||||
attribute double viewportAnchorY;
|
||||
[SetterThrows]
|
||||
[SetterThrows]
|
||||
attribute DOMString scroll;
|
||||
};
|
@ -7,11 +7,9 @@
|
||||
* http://dev.w3.org/html5/webvtt/#extension-of-the-texttrack-interface-for-region-support
|
||||
*/
|
||||
|
||||
|
||||
[Pref="media.webvtt.enabled"]
|
||||
interface TextTrackRegionList {
|
||||
interface VTTRegionList {
|
||||
readonly attribute unsigned long length;
|
||||
getter TextTrackRegion (unsigned long index);
|
||||
TextTrackRegion? getRegionById(DOMString id);
|
||||
getter VTTRegion (unsigned long index);
|
||||
VTTRegion? getRegionById(DOMString id);
|
||||
};
|
||||
|
@ -381,8 +381,6 @@ WEBIDL_FILES = [
|
||||
'TextTrack.webidl',
|
||||
'TextTrackCueList.webidl',
|
||||
'TextTrackList.webidl',
|
||||
'TextTrackRegion.webidl',
|
||||
'TextTrackRegionList.webidl',
|
||||
'TimeEvent.webidl',
|
||||
'TimeRanges.webidl',
|
||||
'Touch.webidl',
|
||||
@ -397,6 +395,8 @@ WEBIDL_FILES = [
|
||||
'URLUtils.webidl',
|
||||
'URLUtilsReadOnly.webidl',
|
||||
'VTTCue.webidl',
|
||||
'VTTRegion.webidl',
|
||||
'VTTRegionList.webidl',
|
||||
'ValidityState.webidl',
|
||||
'VideoPlaybackQuality.webidl',
|
||||
'VideoStreamTrack.webidl',
|
||||
|
@ -39,14 +39,6 @@ EffectMask::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
if (mIs3D) {
|
||||
aTo += " [is-3d]";
|
||||
}
|
||||
|
||||
if (mMaskTexture) {
|
||||
nsAutoCString prefix(aPrefix);
|
||||
prefix += " ";
|
||||
|
||||
aTo += "\n";
|
||||
mMaskTexture->PrintInfo(aTo, prefix.get());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -161,6 +161,20 @@ TextureHost::~TextureHost()
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
|
||||
void
|
||||
TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
{
|
||||
aTo += aPrefix;
|
||||
aTo += nsPrintfCString("%s (0x%p)", Name(), this);
|
||||
AppendToString(aTo, GetSize(), " [size=", "]");
|
||||
AppendToString(aTo, GetFormat(), " [format=", "]");
|
||||
AppendToString(aTo, mFlags, " [flags=", "]");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void TextureSource::SetCompositableQuirks(CompositableQuirks* aQuirks)
|
||||
{
|
||||
mQuirks = aQuirks;
|
||||
@ -231,12 +245,6 @@ DeprecatedTextureHost::SwapTextures(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
void
|
||||
TextureSource::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
{
|
||||
aTo += aPrefix;
|
||||
aTo += nsPrintfCString("UnknownTextureSource (0x%p)", this);
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedTextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
|
@ -120,10 +120,6 @@ public:
|
||||
|
||||
virtual void SetCompositableQuirks(CompositableQuirks* aQuirks);
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
RefPtr<CompositableQuirks> mQuirks;
|
||||
};
|
||||
@ -389,13 +385,8 @@ public:
|
||||
virtual void SetCompositableQuirks(CompositableQuirks* aQuirks);
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
{
|
||||
RefPtr<TextureSource> source = GetTextureSources();
|
||||
if (source) {
|
||||
source->PrintInfo(aTo, aPrefix);
|
||||
}
|
||||
}
|
||||
virtual const char *Name() { return "TextureHost"; }
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@ -489,6 +480,10 @@ public:
|
||||
|
||||
virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char *Name() MOZ_OVERRIDE { return "ShmemTextureHost"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
ipc::Shmem* mShmem;
|
||||
ISurfaceAllocator* mDeallocator;
|
||||
@ -514,6 +509,10 @@ public:
|
||||
|
||||
virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char *Name() MOZ_OVERRIDE { return "MemoryTextureHost"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
uint8_t* mBuffer;
|
||||
};
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
bool IsValid() const;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "GrallocTextureHostOGL"; }
|
||||
virtual const char* Name() MOZ_OVERRIDE { return "GrallocTextureHostOGL"; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -3,9 +3,13 @@
|
||||
* 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 _NS_APPUNITS_H_
|
||||
#define _NS_APPUNITS_H_
|
||||
#ifndef mozilla_AppUnits_h
|
||||
#define mozilla_AppUnits_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace mozilla {
|
||||
static int32_t AppUnitsPerCSSPixel() { return 60; }
|
||||
inline int32_t AppUnitsPerCSSPixel() { return 60; }
|
||||
inline int32_t AppUnitsPerCSSInch() { return 96 * AppUnitsPerCSSPixel(); }
|
||||
}
|
||||
#endif /* _NS_APPUNITS_H_ */
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
* Gets the number of app units in one CSS inch; this is
|
||||
* 96 times AppUnitsPerCSSPixel.
|
||||
*/
|
||||
static int32_t AppUnitsPerCSSInch() { return 96 * AppUnitsPerCSSPixel(); }
|
||||
static int32_t AppUnitsPerCSSInch() { return mozilla::AppUnitsPerCSSInch(); }
|
||||
|
||||
/**
|
||||
* Get the unscaled ratio of app units to dev pixels; useful if something
|
||||
|
@ -143,11 +143,12 @@ def run_job(name, config):
|
||||
else:
|
||||
temp_map = {}
|
||||
cmdspec = fill(cmdspec, config)
|
||||
temp = '%s.tmp' % name
|
||||
if isinstance(outfiles, basestring):
|
||||
temp_map[temp] = outfiles
|
||||
stdout_filename = '%s.tmp' % name
|
||||
temp_map[stdout_filename] = outfiles
|
||||
print_command(cmdspec, outfile=outfiles, env=env(config))
|
||||
else:
|
||||
stdout_filename = None
|
||||
pc = list(cmdspec)
|
||||
outfile = 0
|
||||
for (i, name) in out_indexes(cmdspec):
|
||||
@ -163,8 +164,11 @@ def run_job(name, config):
|
||||
outfile += 1
|
||||
|
||||
sys.stdout.flush()
|
||||
with open(temp, 'w') as output:
|
||||
subprocess.check_call(command, stdout=output, env=env(config))
|
||||
if stdout_filename is None:
|
||||
subprocess.check_call(command, env=env(config))
|
||||
else:
|
||||
with open(stdout_filename, 'w') as output:
|
||||
subprocess.check_call(command, stdout=output, env=env(config))
|
||||
for (temp, final) in temp_map.items():
|
||||
try:
|
||||
os.rename(temp, final)
|
||||
|
12
js/src/jit-test/tests/auto-regress/bug912379.js
Normal file
12
js/src/jit-test/tests/auto-regress/bug912379.js
Normal file
@ -0,0 +1,12 @@
|
||||
s = newGlobal();
|
||||
evalcx("\
|
||||
try { \
|
||||
throw StopIteration;\
|
||||
} catch(a) {\
|
||||
x = a;\
|
||||
} \
|
||||
wrap(x);\
|
||||
", s);
|
||||
evalcx("\
|
||||
n = x;\
|
||||
", s);
|
@ -158,8 +158,8 @@ class BaselineFrame
|
||||
|
||||
Value &unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const {
|
||||
JS_ASSERT(i < numFormalArgs());
|
||||
JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals());
|
||||
JS_ASSERT_IF(checkAliasing, !script()->formalIsAliased(i));
|
||||
JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals() &&
|
||||
!script()->formalIsAliased(i));
|
||||
return argv()[i];
|
||||
}
|
||||
|
||||
|
@ -847,9 +847,13 @@ PrepareOsrTempData(JSContext *cx, ICUseCount_Fallback *stub, BaselineFrame *fram
|
||||
// Copy formal args and thisv.
|
||||
memcpy(stackFrameStart, frame->argv() - 1, (numFormalArgs + 1) * sizeof(Value));
|
||||
|
||||
// Initialize ScopeChain, Exec, and Flags fields in StackFrame struct.
|
||||
// Initialize ScopeChain, Exec, ArgsObj, and Flags fields in StackFrame struct.
|
||||
uint8_t *stackFrame = info->stackFrame;
|
||||
*((JSObject **) (stackFrame + StackFrame::offsetOfScopeChain())) = frame->scopeChain();
|
||||
if (frame->script()->needsArgsObj()) {
|
||||
JS_ASSERT(frame->hasArgsObj());
|
||||
*((JSObject **) (stackFrame + StackFrame::offsetOfArgumentsObject())) = &frame->argsObj();
|
||||
}
|
||||
if (frame->isFunctionFrame()) {
|
||||
// Store the function in exec field, and StackFrame::FUNCTION for flags.
|
||||
*((JSFunction **) (stackFrame + StackFrame::offsetOfExec())) = frame->fun();
|
||||
|
@ -1024,6 +1024,18 @@ CodeGenerator::visitOsrScopeChain(LOsrScopeChain *lir)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGenerator::visitOsrArgumentsObject(LOsrArgumentsObject *lir)
|
||||
{
|
||||
const LAllocation *frame = lir->getOperand(0);
|
||||
const LDefinition *object = lir->getDef(0);
|
||||
|
||||
const ptrdiff_t frameOffset = StackFrame::offsetOfArgumentsObject();
|
||||
|
||||
masm.loadPtr(Address(ToRegister(frame), frameOffset), ToRegister(object));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGenerator::visitStackArgT(LStackArgT *lir)
|
||||
{
|
||||
@ -1904,7 +1916,7 @@ CodeGenerator::visitCallKnown(LCallKnown *call)
|
||||
Register calleereg = ToRegister(call->getFunction());
|
||||
Register objreg = ToRegister(call->getTempObject());
|
||||
uint32_t unusedStack = StackOffsetOfPassedArg(call->argslot());
|
||||
JSFunction *target = call->getSingleTarget();
|
||||
DebugOnly<JSFunction *> target = call->getSingleTarget();
|
||||
ExecutionMode executionMode = gen->info().executionMode();
|
||||
Label end, uncompiled;
|
||||
|
||||
|
@ -66,6 +66,7 @@ class CodeGenerator : public CodeGeneratorSpecific
|
||||
bool visitDefFun(LDefFun *lir);
|
||||
bool visitOsrEntry(LOsrEntry *lir);
|
||||
bool visitOsrScopeChain(LOsrScopeChain *lir);
|
||||
bool visitOsrArgumentsObject(LOsrArgumentsObject *lir);
|
||||
bool visitStackArgT(LStackArgT *lir);
|
||||
bool visitStackArgV(LStackArgV *lir);
|
||||
bool visitMoveGroup(LMoveGroup *group);
|
||||
|
@ -1703,12 +1703,6 @@ CheckScript(JSContext *cx, JSScript *script, bool osr)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (osr && script->needsArgsObj()) {
|
||||
// OSR-ing into functions with arguments objects is not supported.
|
||||
IonSpew(IonSpew_Abort, "OSR script has argsobj");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!script->compileAndGo) {
|
||||
IonSpew(IonSpew_Abort, "not compile-and-go");
|
||||
return false;
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "jit/Lowering.h"
|
||||
#include "jit/MIRGraph.h"
|
||||
|
||||
#include "vm/ArgumentsObject.h"
|
||||
|
||||
#include "jsinferinlines.h"
|
||||
#include "jsobjinlines.h"
|
||||
#include "jsscriptinlines.h"
|
||||
@ -1033,7 +1035,7 @@ IonBuilder::maybeAddOsrTypeBarriers()
|
||||
if (info().isSlotAliased(i))
|
||||
continue;
|
||||
|
||||
MInstruction *def = osrBlock->getSlot(i)->toOsrValue();
|
||||
MInstruction *def = osrBlock->getSlot(i)->toInstruction();
|
||||
|
||||
JS_ASSERT(headerPhi->slot() == i);
|
||||
MPhi *preheaderPhi = preheader->getSlot(i)->toPhi();
|
||||
@ -5754,11 +5756,14 @@ IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry)
|
||||
osrBlock->initSlot(slot, scopev);
|
||||
}
|
||||
|
||||
// Initialize arguments object. Ion will not allow OSR-ing into scripts
|
||||
// with |needsArgsObj| set, so this can be undefined.
|
||||
JS_ASSERT(!info().needsArgsObj());
|
||||
// Initialize arguments object.
|
||||
bool needsArgsObj = info().needsArgsObj();
|
||||
MInstruction *argsObj = NULL;
|
||||
if (info().hasArguments()) {
|
||||
MInstruction *argsObj = MConstant::New(UndefinedValue());
|
||||
if (needsArgsObj)
|
||||
argsObj = MOsrArgumentsObject::New(entry);
|
||||
else
|
||||
argsObj = MConstant::New(UndefinedValue());
|
||||
osrBlock->add(argsObj);
|
||||
osrBlock->initSlot(info().argsObjSlot(), argsObj);
|
||||
}
|
||||
@ -5774,14 +5779,30 @@ IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry)
|
||||
|
||||
// Initialize arguments.
|
||||
for (uint32_t i = 0; i < info().nargs(); i++) {
|
||||
// NB: Ion does not OSR into any function which |needsArgsObj|, so
|
||||
// using argSlot() here instead of argSlotUnchecked() is ok.
|
||||
uint32_t slot = info().argSlot(i);
|
||||
ptrdiff_t offset = StackFrame::offsetOfFormalArg(info().fun(), i);
|
||||
uint32_t slot = needsArgsObj ? info().argSlotUnchecked(i) : info().argSlot(i);
|
||||
|
||||
MOsrValue *osrv = MOsrValue::New(entry, offset);
|
||||
osrBlock->add(osrv);
|
||||
osrBlock->initSlot(slot, osrv);
|
||||
if (needsArgsObj) {
|
||||
JS_ASSERT(argsObj && argsObj->isOsrArgumentsObject());
|
||||
// If this is an aliased formal, then the arguments object
|
||||
// contains a hole at this index. Any references to this
|
||||
// variable in the jitcode will come from JSOP_*ALIASEDVAR
|
||||
// opcodes, so the slot itself can be set to undefined. If
|
||||
// it's not aliased, it must be retrieved from the arguments
|
||||
// object.
|
||||
MInstruction *osrv;
|
||||
if (script()->formalIsAliased(i))
|
||||
osrv = MConstant::New(UndefinedValue());
|
||||
else
|
||||
osrv = MGetArgumentsObjectArg::New(argsObj, i);
|
||||
|
||||
osrBlock->add(osrv);
|
||||
osrBlock->initSlot(slot, osrv);
|
||||
} else {
|
||||
ptrdiff_t offset = StackFrame::offsetOfFormalArg(info().fun(), i);
|
||||
MOsrValue *osrv = MOsrValue::New(entry, offset);
|
||||
osrBlock->add(osrv);
|
||||
osrBlock->initSlot(slot, osrv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5834,7 +5855,7 @@ IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry)
|
||||
for (uint32_t i = info().startArgSlot(); i < osrBlock->stackDepth(); i++) {
|
||||
MDefinition *existing = current->getSlot(i);
|
||||
MDefinition *def = osrBlock->getSlot(i);
|
||||
JS_ASSERT(def->type() == MIRType_Value);
|
||||
JS_ASSERT_IF(!needsArgsObj || !info().isSlotAliased(i), def->type() == MIRType_Value);
|
||||
|
||||
// Aliased slots are never accessed, since they need to go through
|
||||
// the callobject. No need to type them here.
|
||||
@ -5876,7 +5897,7 @@ IonBuilder::newPendingLoopHeader(MBasicBlock *predecessor, jsbytecode *pc, bool
|
||||
// Unbox the MOsrValue if it is known to be unboxable.
|
||||
for (uint32_t i = info().startArgSlot(); i < block->stackDepth(); i++) {
|
||||
|
||||
// The value of aliased slots are in the callobject. So we can't
|
||||
// The value of aliased args and slots are in the callobject. So we can't
|
||||
// the value from the baseline frame.
|
||||
if (info().isSlotAliased(i))
|
||||
continue;
|
||||
@ -5892,12 +5913,16 @@ IonBuilder::newPendingLoopHeader(MBasicBlock *predecessor, jsbytecode *pc, bool
|
||||
Value existingValue;
|
||||
uint32_t arg = i - info().firstArgSlot();
|
||||
uint32_t var = i - info().firstLocalSlot();
|
||||
if (info().fun() && i == info().thisSlot())
|
||||
if (info().fun() && i == info().thisSlot()) {
|
||||
existingValue = baselineFrame_->thisValue();
|
||||
else if (arg < info().nargs())
|
||||
existingValue = baselineFrame_->unaliasedFormal(arg);
|
||||
else
|
||||
} else if (arg < info().nargs()) {
|
||||
if (info().needsArgsObj())
|
||||
existingValue = baselineFrame_->argsObj().arg(arg);
|
||||
else
|
||||
existingValue = baselineFrame_->unaliasedFormal(arg);
|
||||
} else {
|
||||
existingValue = baselineFrame_->unaliasedVar(var);
|
||||
}
|
||||
|
||||
// Extract typeset from value.
|
||||
MIRType type = existingValue.isDouble()
|
||||
|
@ -2801,6 +2801,22 @@ class LOsrScopeChain : public LInstructionHelper<1, 1, 0>
|
||||
}
|
||||
};
|
||||
|
||||
// Materialize a JSObject ArgumentsObject stored in an interpreter frame for OSR.
|
||||
class LOsrArgumentsObject : public LInstructionHelper<1, 1, 0>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(OsrArgumentsObject)
|
||||
|
||||
LOsrArgumentsObject(const LAllocation &entry)
|
||||
{
|
||||
setOperand(0, entry);
|
||||
}
|
||||
|
||||
const MOsrArgumentsObject *mir() {
|
||||
return mir_->toOsrArgumentsObject();
|
||||
}
|
||||
};
|
||||
|
||||
class LRegExp : public LCallInstructionHelper<1, 0, 0>
|
||||
{
|
||||
public:
|
||||
|
@ -134,6 +134,7 @@
|
||||
_(OsrEntry) \
|
||||
_(OsrValue) \
|
||||
_(OsrScopeChain) \
|
||||
_(OsrArgumentsObject) \
|
||||
_(RegExp) \
|
||||
_(RegExpTest) \
|
||||
_(Lambda) \
|
||||
|
@ -512,7 +512,7 @@ bool
|
||||
LIRGenerator::visitAssertFloat32(MAssertFloat32 *assertion)
|
||||
{
|
||||
MIRType type = assertion->input()->type();
|
||||
bool checkIsFloat32 = assertion->mustBeFloat32();
|
||||
DebugOnly<bool> checkIsFloat32 = assertion->mustBeFloat32();
|
||||
|
||||
if (!allowFloat32Optimizations())
|
||||
return true;
|
||||
@ -1546,6 +1546,13 @@ LIRGenerator::visitOsrScopeChain(MOsrScopeChain *object)
|
||||
return define(lir, object);
|
||||
}
|
||||
|
||||
bool
|
||||
LIRGenerator::visitOsrArgumentsObject(MOsrArgumentsObject *object)
|
||||
{
|
||||
LOsrArgumentsObject *lir = new LOsrArgumentsObject(useRegister(object->entry()));
|
||||
return define(lir, object);
|
||||
}
|
||||
|
||||
bool
|
||||
LIRGenerator::visitToDouble(MToDouble *convert)
|
||||
{
|
||||
@ -1972,7 +1979,7 @@ LIRGenerator::visitTypeBarrier(MTypeBarrier *ins)
|
||||
bool needTemp = !types->unknownObject() && types->getObjectCount() > 0;
|
||||
|
||||
MIRType inputType = ins->getOperand(0)->type();
|
||||
MIRType outputType = ins->type();
|
||||
DebugOnly<MIRType> outputType = ins->type();
|
||||
|
||||
JS_ASSERT(inputType == outputType);
|
||||
|
||||
@ -2465,7 +2472,7 @@ LIRGenerator::visitStoreTypedArrayElement(MStoreTypedArrayElement *ins)
|
||||
JS_ASSERT(ins->index()->type() == MIRType_Int32);
|
||||
|
||||
if (ins->isFloatArray()) {
|
||||
bool optimizeFloat32 = allowFloat32Optimizations();
|
||||
DebugOnly<bool> optimizeFloat32 = allowFloat32Optimizations();
|
||||
JS_ASSERT_IF(optimizeFloat32 && ins->arrayType() == ScalarTypeRepresentation::TYPE_FLOAT32,
|
||||
ins->value()->type() == MIRType_Float32);
|
||||
JS_ASSERT_IF(!optimizeFloat32 || ins->arrayType() == ScalarTypeRepresentation::TYPE_FLOAT64,
|
||||
@ -2494,7 +2501,7 @@ LIRGenerator::visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins)
|
||||
JS_ASSERT(ins->length()->type() == MIRType_Int32);
|
||||
|
||||
if (ins->isFloatArray()) {
|
||||
bool optimizeFloat32 = allowFloat32Optimizations();
|
||||
DebugOnly<bool> optimizeFloat32 = allowFloat32Optimizations();
|
||||
JS_ASSERT_IF(optimizeFloat32 && ins->arrayType() == ScalarTypeRepresentation::TYPE_FLOAT32,
|
||||
ins->value()->type() == MIRType_Float32);
|
||||
JS_ASSERT_IF(!optimizeFloat32 || ins->arrayType() == ScalarTypeRepresentation::TYPE_FLOAT64,
|
||||
|
@ -155,6 +155,7 @@ class LIRGenerator : public LIRGeneratorSpecific
|
||||
bool visitNop(MNop *nop);
|
||||
bool visitOsrValue(MOsrValue *value);
|
||||
bool visitOsrScopeChain(MOsrScopeChain *object);
|
||||
bool visitOsrArgumentsObject(MOsrArgumentsObject *object);
|
||||
bool visitToDouble(MToDouble *convert);
|
||||
bool visitToFloat32(MToFloat32 *convert);
|
||||
bool visitToInt32(MToInt32 *convert);
|
||||
|
@ -4286,6 +4286,28 @@ class MOsrScopeChain : public MUnaryInstruction
|
||||
}
|
||||
};
|
||||
|
||||
// MIR representation of a JSObject ArgumentsObject pointer on the OSR StackFrame.
|
||||
// The pointer is indexed off of OsrFrameReg.
|
||||
class MOsrArgumentsObject : public MUnaryInstruction
|
||||
{
|
||||
private:
|
||||
MOsrArgumentsObject(MOsrEntry *entry)
|
||||
: MUnaryInstruction(entry)
|
||||
{
|
||||
setResultType(MIRType_Object);
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(OsrArgumentsObject)
|
||||
static MOsrArgumentsObject *New(MOsrEntry *entry) {
|
||||
return new MOsrArgumentsObject(entry);
|
||||
}
|
||||
|
||||
MOsrEntry *entry() {
|
||||
return getOperand(0)->toOsrEntry();
|
||||
}
|
||||
};
|
||||
|
||||
// Check the current frame for over-recursion past the global stack limit.
|
||||
class MCheckOverRecursed : public MNullaryInstruction
|
||||
{
|
||||
|
@ -456,9 +456,20 @@ MBasicBlock::linkOsrValues(MStart *start)
|
||||
if (def->isOsrScopeChain())
|
||||
def->toOsrScopeChain()->setResumePoint(res);
|
||||
} else if (info().hasArguments() && i == info().argsObjSlot()) {
|
||||
JS_ASSERT(def->isConstant() && def->toConstant()->value() == UndefinedValue());
|
||||
JS_ASSERT(def->isConstant() || def->isOsrArgumentsObject());
|
||||
JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue());
|
||||
if (def->isOsrArgumentsObject())
|
||||
def->toOsrArgumentsObject()->setResumePoint(res);
|
||||
} else {
|
||||
def->toOsrValue()->setResumePoint(res);
|
||||
JS_ASSERT(def->isOsrValue() || def->isGetArgumentsObjectArg() || def->isConstant());
|
||||
// A constant Undefined can show up here for an argument slot when the function uses
|
||||
// a heavyweight argsobj, but the argument in question is stored on the scope chain.
|
||||
JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue());
|
||||
|
||||
if (def->isOsrValue())
|
||||
def->toOsrValue()->setResumePoint(res);
|
||||
else if (def->isGetArgumentsObjectArg())
|
||||
def->toGetArgumentsObjectArg()->setResumePoint(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace jit {
|
||||
_(Beta) \
|
||||
_(OsrValue) \
|
||||
_(OsrScopeChain) \
|
||||
_(OsrArgumentsObject) \
|
||||
_(ReturnFromCtor) \
|
||||
_(CheckOverRecursed) \
|
||||
_(DefVar) \
|
||||
|
@ -116,6 +116,7 @@ class ParallelSafetyVisitor : public MInstructionVisitor
|
||||
SAFE_OP(Beta)
|
||||
UNSAFE_OP(OsrValue)
|
||||
UNSAFE_OP(OsrScopeChain)
|
||||
UNSAFE_OP(OsrArgumentsObject)
|
||||
UNSAFE_OP(ReturnFromCtor)
|
||||
CUSTOM_OP(CheckOverRecursed)
|
||||
UNSAFE_OP(DefVar)
|
||||
|
@ -1222,28 +1222,31 @@ BOffImm::getDest(Instruction *src)
|
||||
|
||||
//VFPRegister implementation
|
||||
VFPRegister
|
||||
VFPRegister::doubleOverlay()
|
||||
VFPRegister::doubleOverlay() const
|
||||
{
|
||||
JS_ASSERT(!_isInvalid);
|
||||
if (kind != Double)
|
||||
if (kind != Double) {
|
||||
JS_ASSERT(_code % 2 == 0);
|
||||
return VFPRegister(_code >> 1, Double);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
VFPRegister
|
||||
VFPRegister::singleOverlay()
|
||||
VFPRegister::singleOverlay() const
|
||||
{
|
||||
JS_ASSERT(!_isInvalid);
|
||||
if (kind == Double) {
|
||||
// There are no corresponding float registers for d16-d31
|
||||
ASSERT(_code < 16);
|
||||
JS_ASSERT(_code < 16);
|
||||
return VFPRegister(_code << 1, Single);
|
||||
}
|
||||
|
||||
JS_ASSERT(_code % 2 == 0);
|
||||
return VFPRegister(_code, Single);
|
||||
}
|
||||
|
||||
VFPRegister
|
||||
VFPRegister::sintOverlay()
|
||||
VFPRegister::sintOverlay() const
|
||||
{
|
||||
JS_ASSERT(!_isInvalid);
|
||||
if (kind == Double) {
|
||||
@ -1252,10 +1255,11 @@ VFPRegister::sintOverlay()
|
||||
return VFPRegister(_code << 1, Int);
|
||||
}
|
||||
|
||||
JS_ASSERT(_code % 2 == 0);
|
||||
return VFPRegister(_code, Int);
|
||||
}
|
||||
VFPRegister
|
||||
VFPRegister::uintOverlay()
|
||||
VFPRegister::uintOverlay() const
|
||||
{
|
||||
JS_ASSERT(!_isInvalid);
|
||||
if (kind == Double) {
|
||||
@ -1264,6 +1268,7 @@ VFPRegister::uintOverlay()
|
||||
return VFPRegister(_code << 1, UInt);
|
||||
}
|
||||
|
||||
JS_ASSERT(_code % 2 == 0);
|
||||
return VFPRegister(_code, UInt);
|
||||
}
|
||||
|
||||
@ -1614,7 +1619,7 @@ class PoolHintData {
|
||||
JS_ASSERT(cond == cond_ >> 28);
|
||||
loadType = lt;
|
||||
ONES = expectedOnes;
|
||||
destReg = destReg_.code();
|
||||
destReg = destReg_.isDouble() ? destReg_.code() : destReg_.doubleOverlay().code();
|
||||
destType = destReg_.isDouble();
|
||||
}
|
||||
Assembler::Condition getCond() {
|
||||
@ -1625,8 +1630,8 @@ class PoolHintData {
|
||||
return Register::FromCode(destReg);
|
||||
}
|
||||
VFPRegister getVFPReg() {
|
||||
return VFPRegister(FloatRegister::FromCode(destReg),
|
||||
destType ? VFPRegister::Double : VFPRegister::Single);
|
||||
VFPRegister r = VFPRegister(FloatRegister::FromCode(destReg));
|
||||
return destType ? r : r.singleOverlay();
|
||||
}
|
||||
|
||||
int32_t getIndex() {
|
||||
|
@ -218,10 +218,10 @@ class VFPRegister
|
||||
bool isInvalid();
|
||||
bool isMissing();
|
||||
|
||||
VFPRegister doubleOverlay();
|
||||
VFPRegister singleOverlay();
|
||||
VFPRegister sintOverlay();
|
||||
VFPRegister uintOverlay();
|
||||
VFPRegister doubleOverlay() const;
|
||||
VFPRegister singleOverlay() const;
|
||||
VFPRegister sintOverlay() const;
|
||||
VFPRegister uintOverlay() const;
|
||||
|
||||
struct VFPRegIndexSplit;
|
||||
VFPRegIndexSplit encode();
|
||||
|
@ -285,6 +285,13 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin
|
||||
HandleObject global = cx->global();
|
||||
JS_ASSERT(global);
|
||||
|
||||
if (obj->compartment() == this)
|
||||
return WrapForSameCompartment(cx, obj);
|
||||
|
||||
/* Unwrap the object, but don't unwrap outer windows. */
|
||||
unsigned flags = 0;
|
||||
obj.set(UncheckedUnwrap(obj, /* stopAtOuter = */ true, &flags));
|
||||
|
||||
if (obj->compartment() == this)
|
||||
return WrapForSameCompartment(cx, obj);
|
||||
|
||||
@ -297,13 +304,6 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Unwrap the object, but don't unwrap outer windows. */
|
||||
unsigned flags = 0;
|
||||
obj.set(UncheckedUnwrap(obj, /* stopAtOuter = */ true, &flags));
|
||||
|
||||
if (obj->compartment() == this)
|
||||
return WrapForSameCompartment(cx, obj);
|
||||
|
||||
/* Invoke the prewrap callback. We're a bit worried about infinite
|
||||
* recursion here, so we do a check - see bug 809295. */
|
||||
JS_CHECK_CHROME_RECURSION(cx, return false);
|
||||
|
@ -160,7 +160,7 @@ ToNumber(JSContext *cx, JS::MutableHandleValue vp)
|
||||
if (vp.isNumber())
|
||||
return true;
|
||||
double d;
|
||||
extern bool ToNumberSlow(JSContext *cx, Value v, double *dp);
|
||||
extern JS_PUBLIC_API(bool) ToNumberSlow(JSContext *cx, Value v, double *dp);
|
||||
if (!ToNumberSlow(cx, vp, &d))
|
||||
return false;
|
||||
|
||||
@ -249,7 +249,7 @@ ToInteger(JSContext *cx, HandleValue v, double *dp)
|
||||
if (v.isDouble()) {
|
||||
*dp = v.toDouble();
|
||||
} else {
|
||||
extern bool ToNumberSlow(JSContext *cx, Value v, double *dp);
|
||||
extern JS_PUBLIC_API(bool) ToNumberSlow(JSContext *cx, Value v, double *dp);
|
||||
if (!ToNumberSlow(cx, v, dp))
|
||||
return false;
|
||||
}
|
||||
|
@ -1526,33 +1526,27 @@ void
|
||||
Debugger::markAll(JSTracer *trc)
|
||||
{
|
||||
JSRuntime *rt = trc->runtime;
|
||||
for (CompartmentsIter c(rt); !c.done(); c.next()) {
|
||||
GlobalObjectSet &debuggees = c->getDebuggees();
|
||||
for (Debugger *dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
GlobalObjectSet &debuggees = dbg->debuggees;
|
||||
for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) {
|
||||
GlobalObject *global = e.front();
|
||||
|
||||
MarkObjectUnbarriered(trc, &global, "Global Object");
|
||||
if (global != e.front())
|
||||
e.rekeyFront(global);
|
||||
}
|
||||
|
||||
const GlobalObject::DebuggerVector *debuggers = global->getDebuggers();
|
||||
JS_ASSERT(debuggers);
|
||||
for (Debugger * const *p = debuggers->begin(); p != debuggers->end(); p++) {
|
||||
Debugger *dbg = *p;
|
||||
HeapPtrObject &dbgobj = dbg->toJSObjectRef();
|
||||
MarkObject(trc, &dbgobj, "Debugger Object");
|
||||
|
||||
HeapPtrObject &dbgobj = dbg->toJSObjectRef();
|
||||
MarkObject(trc, &dbgobj, "Debugger Object");
|
||||
dbg->scripts.trace(trc);
|
||||
dbg->sources.trace(trc);
|
||||
dbg->objects.trace(trc);
|
||||
dbg->environments.trace(trc);
|
||||
|
||||
dbg->scripts.trace(trc);
|
||||
dbg->sources.trace(trc);
|
||||
dbg->objects.trace(trc);
|
||||
dbg->environments.trace(trc);
|
||||
|
||||
for (Breakpoint *bp = dbg->firstBreakpoint(); bp; bp = bp->nextInDebugger()) {
|
||||
MarkScriptUnbarriered(trc, &bp->site->script, "breakpoint script");
|
||||
MarkObject(trc, &bp->getHandlerRef(), "breakpoint handler");
|
||||
}
|
||||
}
|
||||
for (Breakpoint *bp = dbg->firstBreakpoint(); bp; bp = bp->nextInDebugger()) {
|
||||
MarkScriptUnbarriered(trc, &bp->site->script, "breakpoint script");
|
||||
MarkObject(trc, &bp->getHandlerRef(), "breakpoint handler");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -944,6 +944,10 @@ class StackFrame
|
||||
return offsetof(StackFrame, scopeChain_);
|
||||
}
|
||||
|
||||
static size_t offsetOfArgumentsObject() {
|
||||
return offsetof(StackFrame, argsObj_);
|
||||
}
|
||||
|
||||
static ptrdiff_t offsetOfThis(JSFunction *fun) {
|
||||
return fun == NULL
|
||||
? -1 * ptrdiff_t(sizeof(Value))
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsDeviceContext.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
#include "mozilla/gfx/ScaleFactor.h"
|
||||
#include "nsDeviceContext.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsMargin.h"
|
||||
#include "mozilla/AppUnits.h"
|
||||
|
@ -2672,6 +2672,24 @@ bool nsPresContext::GetPaintFlashing() const
|
||||
return mPaintFlashing;
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsPresContext::AppUnitsPerDevPixel() const
|
||||
{
|
||||
return mDeviceContext->AppUnitsPerDevPixel();
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsPresContext::GfxUnitsToAppUnits(gfxFloat aGfxUnits) const
|
||||
{
|
||||
return mDeviceContext->GfxUnitsToAppUnits(aGfxUnits);
|
||||
}
|
||||
|
||||
gfxFloat
|
||||
nsPresContext::AppUnitsToGfxUnits(nscoord aAppUnits) const
|
||||
{
|
||||
return mDeviceContext->AppUnitsToGfxUnits(aAppUnits);
|
||||
}
|
||||
|
||||
nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
|
||||
nsPresContextType aType)
|
||||
: nsPresContext(aDocument, aType),
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsDeviceContext.h"
|
||||
#include "nsFont.h"
|
||||
#include "gfxFontConstants.h"
|
||||
#include "nsIAtom.h"
|
||||
@ -65,6 +64,7 @@ class nsAnimationManager;
|
||||
class nsIDOMMediaQueryList;
|
||||
class nsRefreshDriver;
|
||||
class nsIWidget;
|
||||
class nsDeviceContext;
|
||||
|
||||
namespace mozilla {
|
||||
class RestyleManager;
|
||||
@ -558,8 +558,8 @@ public:
|
||||
float ScreenWidthInchesForFontInflation(bool* aChanged = nullptr);
|
||||
|
||||
static int32_t AppUnitsPerCSSPixel() { return mozilla::AppUnitsPerCSSPixel(); }
|
||||
int32_t AppUnitsPerDevPixel() const { return mDeviceContext->AppUnitsPerDevPixel(); }
|
||||
static int32_t AppUnitsPerCSSInch() { return nsDeviceContext::AppUnitsPerCSSInch(); }
|
||||
int32_t AppUnitsPerDevPixel() const;
|
||||
static int32_t AppUnitsPerCSSInch() { return mozilla::AppUnitsPerCSSInch(); }
|
||||
|
||||
static nscoord CSSPixelsToAppUnits(int32_t aPixels)
|
||||
{ return NSToCoordRoundWithClamp(float(aPixels) *
|
||||
@ -578,8 +578,7 @@ public:
|
||||
float(AppUnitsPerCSSPixel())); }
|
||||
|
||||
nscoord DevPixelsToAppUnits(int32_t aPixels) const
|
||||
{ return NSIntPixelsToAppUnits(aPixels,
|
||||
mDeviceContext->AppUnitsPerDevPixel()); }
|
||||
{ return NSIntPixelsToAppUnits(aPixels, AppUnitsPerDevPixel()); }
|
||||
|
||||
int32_t AppUnitsToDevPixels(nscoord aAppUnits) const
|
||||
{ return NSAppUnitsToIntPixels(aAppUnits,
|
||||
@ -591,7 +590,7 @@ public:
|
||||
float CSSPixelsToDevPixels(float aPixels)
|
||||
{
|
||||
return NSAppUnitsToFloatPixels(CSSPixelsToAppUnits(aPixels),
|
||||
float(mDeviceContext->AppUnitsPerDevPixel()));
|
||||
float(AppUnitsPerDevPixel()));
|
||||
}
|
||||
|
||||
int32_t DevPixelsToIntCSSPixels(int32_t aPixels)
|
||||
@ -601,11 +600,9 @@ public:
|
||||
{ return AppUnitsToFloatCSSPixels(DevPixelsToAppUnits(aPixels)); }
|
||||
|
||||
// If there is a remainder, it is rounded to nearest app units.
|
||||
nscoord GfxUnitsToAppUnits(gfxFloat aGfxUnits) const
|
||||
{ return mDeviceContext->GfxUnitsToAppUnits(aGfxUnits); }
|
||||
nscoord GfxUnitsToAppUnits(gfxFloat aGfxUnits) const;
|
||||
|
||||
gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const
|
||||
{ return mDeviceContext->AppUnitsToGfxUnits(aAppUnits); }
|
||||
gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const;
|
||||
|
||||
gfxRect AppUnitsToGfxUnits(const nsRect& aAppRect) const
|
||||
{ return gfxRect(AppUnitsToGfxUnits(aAppRect.x),
|
||||
@ -615,7 +612,7 @@ public:
|
||||
|
||||
static nscoord CSSTwipsToAppUnits(float aTwips)
|
||||
{ return NSToCoordRoundWithClamp(
|
||||
nsDeviceContext::AppUnitsPerCSSInch() * NS_TWIPS_TO_INCHES(aTwips)); }
|
||||
mozilla::AppUnitsPerCSSInch() * NS_TWIPS_TO_INCHES(aTwips)); }
|
||||
|
||||
// Margin-specific version, since they often need TwipsToAppUnits
|
||||
static nsMargin CSSTwipsToAppUnits(const nsIntMargin &marginInTwips)
|
||||
@ -625,7 +622,7 @@ public:
|
||||
CSSTwipsToAppUnits(float(marginInTwips.left))); }
|
||||
|
||||
static nscoord CSSPointsToAppUnits(float aPoints)
|
||||
{ return NSToCoordRound(aPoints * nsDeviceContext::AppUnitsPerCSSInch() /
|
||||
{ return NSToCoordRound(aPoints * mozilla::AppUnitsPerCSSInch() /
|
||||
POINTS_PER_INCH_FLOAT); }
|
||||
|
||||
nscoord RoundAppUnitsToNearestDevPixels(nscoord aAppUnits) const
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "nsDeviceContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -24,6 +24,7 @@ class nsIScrollPositionListener;
|
||||
class nsIFrame;
|
||||
class nsPresContext;
|
||||
class nsIContent;
|
||||
class nsRenderingContext;
|
||||
|
||||
/**
|
||||
* Interface for frames that are scrollable. This interface exposes
|
||||
|
@ -286,7 +286,8 @@ CSS_PROP_OUTLINE(
|
||||
CSS_PROP_DOMPROP_PREFIXED(OutlineRadiusTopleft),
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -298,7 +299,8 @@ CSS_PROP_OUTLINE(
|
||||
CSS_PROP_DOMPROP_PREFIXED(OutlineRadiusTopright),
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -310,7 +312,8 @@ CSS_PROP_OUTLINE(
|
||||
CSS_PROP_DOMPROP_PREFIXED(OutlineRadiusBottomright),
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -322,7 +325,8 @@ CSS_PROP_OUTLINE(
|
||||
CSS_PROP_DOMPROP_PREFIXED(OutlineRadiusBottomleft),
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -645,7 +649,8 @@ CSS_PROP_BORDER(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HKL | VARIANT_CALC,
|
||||
kBorderWidthKTable,
|
||||
@ -909,7 +914,8 @@ CSS_PROP_SHORTHAND(
|
||||
border_left_width,
|
||||
BorderLeftWidth,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"")
|
||||
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
CSS_PROP_BORDER(
|
||||
@ -1065,7 +1071,8 @@ CSS_PROP_SHORTHAND(
|
||||
border_right_width,
|
||||
BorderRightWidth,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"")
|
||||
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
CSS_PROP_BORDER(
|
||||
@ -1236,7 +1243,8 @@ CSS_PROP_BORDER(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HKL | VARIANT_CALC,
|
||||
kBorderWidthKTable,
|
||||
@ -1262,7 +1270,8 @@ CSS_PROP_BORDER(
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -1275,7 +1284,8 @@ CSS_PROP_BORDER(
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -1288,7 +1298,8 @@ CSS_PROP_BORDER(
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -1301,7 +1312,8 @@ CSS_PROP_BORDER(
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -1313,7 +1325,8 @@ CSS_PROP_POSITION(
|
||||
Bottom,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -1929,7 +1942,8 @@ CSS_PROP_POSITION(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -1972,7 +1986,8 @@ CSS_PROP_POSITION(
|
||||
Left,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -1998,7 +2013,8 @@ CSS_PROP_TEXT(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
|
||||
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
|
||||
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HLPN | VARIANT_KEYWORD | VARIANT_NORMAL | VARIANT_SYSFONT,
|
||||
kLineHeightKTable,
|
||||
@ -2057,7 +2073,8 @@ CSS_PROP_MARGIN(
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE,
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2091,7 +2108,8 @@ CSS_PROP_SHORTHAND(
|
||||
MarginLeft,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE,
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"")
|
||||
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
CSS_PROP_MARGIN(
|
||||
@ -2141,7 +2159,8 @@ CSS_PROP_SHORTHAND(
|
||||
MarginRight,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE,
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"")
|
||||
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
CSS_PROP_MARGIN(
|
||||
@ -2215,7 +2234,8 @@ CSS_PROP_MARGIN(
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE,
|
||||
CSS_PROPERTY_APPLIES_TO_PAGE_RULE |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2246,7 +2266,8 @@ CSS_PROP_POSITION(
|
||||
MaxHeight,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HLPO | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2258,7 +2279,8 @@ CSS_PROP_POSITION(
|
||||
MaxWidth,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HKLPO | VARIANT_CALC,
|
||||
kWidthKTable,
|
||||
@ -2270,7 +2292,8 @@ CSS_PROP_POSITION(
|
||||
MinHeight,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2282,7 +2305,8 @@ CSS_PROP_POSITION(
|
||||
MinWidth,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HKLP | VARIANT_CALC,
|
||||
kWidthKTable,
|
||||
@ -2423,7 +2447,8 @@ CSS_PROP_PADDING(
|
||||
// This is required by the UA stylesheet and can't be overridden.
|
||||
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2457,7 +2482,8 @@ CSS_PROP_SHORTHAND(
|
||||
padding_left,
|
||||
PaddingLeft,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"")
|
||||
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
CSS_PROP_PADDING(
|
||||
@ -2510,7 +2536,8 @@ CSS_PROP_SHORTHAND(
|
||||
padding_right,
|
||||
PaddingRight,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"")
|
||||
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
CSS_PROP_PADDING(
|
||||
@ -2589,7 +2616,8 @@ CSS_PROP_PADDING(
|
||||
// This is required by the UA stylesheet and can't be overridden.
|
||||
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2694,7 +2722,8 @@ CSS_PROP_POSITION(
|
||||
Right,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2800,7 +2829,8 @@ CSS_PROP_TEXT(
|
||||
text_indent,
|
||||
TextIndent,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -2869,7 +2899,8 @@ CSS_PROP_DISPLAY(
|
||||
transform,
|
||||
transform,
|
||||
Transform,
|
||||
CSS_PROPERTY_PARSE_FUNCTION,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
nullptr,
|
||||
@ -2880,7 +2911,8 @@ CSS_PROP_DISPLAY(
|
||||
transform_origin,
|
||||
TransformOrigin,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
@ -2891,7 +2923,8 @@ CSS_PROP_DISPLAY(
|
||||
perspective_origin,
|
||||
PerspectiveOrigin,
|
||||
CSS_PROPERTY_PARSE_FUNCTION |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
@ -2933,7 +2966,8 @@ CSS_PROP_POSITION(
|
||||
Top,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHLP | VARIANT_CALC,
|
||||
nullptr,
|
||||
@ -3049,7 +3083,8 @@ CSS_PROP_TEXTRESET(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
|
||||
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_HKLP | VARIANT_CALC,
|
||||
kVerticalAlignKTable,
|
||||
@ -3093,7 +3128,8 @@ CSS_PROP_POSITION(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE |
|
||||
CSS_PROPERTY_STORES_CALC |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
VARIANT_AHKLP | VARIANT_CALC,
|
||||
kWidthKTable,
|
||||
|
@ -187,6 +187,10 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
|
||||
// This property is allowed in an @page rule.
|
||||
#define CSS_PROPERTY_APPLIES_TO_PAGE_RULE (1<<19)
|
||||
|
||||
// This property's getComputedStyle implementation requires layout to be
|
||||
// flushed.
|
||||
#define CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH (1<<20)
|
||||
|
||||
/**
|
||||
* Types of animatable values.
|
||||
*/
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "gfxFontConstants.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "imgRequestProxy.h"
|
||||
#include "nsDeviceContext.h"
|
||||
|
||||
namespace css = mozilla::css;
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsDOMCSSRect.h"
|
||||
#include "nsDOMCSSRGBColor.h"
|
||||
#include "nsDOMCSSValueList.h"
|
||||
@ -43,6 +42,7 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "prtime.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "mozilla/AppUnits.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
@ -494,9 +494,9 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorRes
|
||||
// we're computing style in, not on the document mContent is in -- the two
|
||||
// may be different.
|
||||
document->FlushPendingNotifications(
|
||||
propEntry->mNeedsLayoutFlush ? Flush_Layout : Flush_Style);
|
||||
propEntry->IsLayoutFlushNeeded() ? Flush_Layout : Flush_Style);
|
||||
#ifdef DEBUG
|
||||
mFlushedPendingReflows = propEntry->mNeedsLayoutFlush;
|
||||
mFlushedPendingReflows = propEntry->IsLayoutFlushNeeded();
|
||||
#endif
|
||||
|
||||
mPresShell = document->GetShell();
|
||||
@ -1094,7 +1094,7 @@ nsComputedDOMStyle::DoGetTransform()
|
||||
mStyleContextHolder->PresContext(),
|
||||
dummy,
|
||||
bounds,
|
||||
float(nsDeviceContext::AppUnitsPerCSSPixel()));
|
||||
float(mozilla::AppUnitsPerCSSPixel()));
|
||||
|
||||
return MatrixToCSSValue(matrix);
|
||||
}
|
||||
@ -5020,9 +5020,7 @@ nsComputedDOMStyle::DoGetAnimationPlayState()
|
||||
}
|
||||
|
||||
#define COMPUTED_STYLE_MAP_ENTRY(_prop, _method) \
|
||||
{ eCSSProperty_##_prop, &nsComputedDOMStyle::DoGet##_method, false }
|
||||
#define COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_prop, _method) \
|
||||
{ eCSSProperty_##_prop, &nsComputedDOMStyle::DoGet##_method, true }
|
||||
{ eCSSProperty_##_prop, &nsComputedDOMStyle::DoGet##_method }
|
||||
|
||||
const nsComputedDOMStyle::ComputedStyleMapEntry*
|
||||
nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
|
||||
@ -5063,10 +5061,10 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border, Border),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_bottom, BorderBottom),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_bottom_color, BorderBottomColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_bottom_left_radius, BorderBottomLeftRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_bottom_right_radius,BorderBottomRightRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_bottom_left_radius, BorderBottomLeftRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_bottom_right_radius, BorderBottomRightRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_bottom_style, BorderBottomStyle),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_bottom_width, BorderBottomWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_bottom_width, BorderBottomWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_collapse, BorderCollapse),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_color, BorderColor),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_image, BorderImage),
|
||||
@ -5078,21 +5076,21 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_left, BorderLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_left_color, BorderLeftColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_left_style, BorderLeftStyle),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_left_width, BorderLeftWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_left_width, BorderLeftWidth),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_right, BorderRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_right_color, BorderRightColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_right_style, BorderRightStyle),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_right_width, BorderRightWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_right_width, BorderRightWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_spacing, BorderSpacing),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_style, BorderStyle),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_top, BorderTop),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_top_color, BorderTopColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_top_left_radius, BorderTopLeftRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_top_right_radius, BorderTopRightRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_top_left_radius, BorderTopLeftRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_top_right_radius, BorderTopRightRadius),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_top_style, BorderTopStyle),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_top_width, BorderTopWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(border_top_width, BorderTopWidth),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(border_width, BorderWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(bottom, Bottom),
|
||||
COMPUTED_STYLE_MAP_ENTRY(bottom, Bottom),
|
||||
COMPUTED_STYLE_MAP_ENTRY(box_shadow, BoxShadow),
|
||||
COMPUTED_STYLE_MAP_ENTRY(caption_side, CaptionSide),
|
||||
COMPUTED_STYLE_MAP_ENTRY(clear, Clear),
|
||||
@ -5126,28 +5124,28 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
|
||||
COMPUTED_STYLE_MAP_ENTRY(font_variant_numeric, FontVariantNumeric),
|
||||
COMPUTED_STYLE_MAP_ENTRY(font_variant_position, FontVariantPosition),
|
||||
COMPUTED_STYLE_MAP_ENTRY(font_weight, FontWeight),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(height, Height),
|
||||
COMPUTED_STYLE_MAP_ENTRY(height, Height),
|
||||
COMPUTED_STYLE_MAP_ENTRY(image_orientation, ImageOrientation),
|
||||
COMPUTED_STYLE_MAP_ENTRY(ime_mode, IMEMode),
|
||||
COMPUTED_STYLE_MAP_ENTRY(justify_content, JustifyContent),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(left, Left),
|
||||
COMPUTED_STYLE_MAP_ENTRY(left, Left),
|
||||
COMPUTED_STYLE_MAP_ENTRY(letter_spacing, LetterSpacing),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(line_height, LineHeight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(line_height, LineHeight),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(list_style, ListStyle),
|
||||
COMPUTED_STYLE_MAP_ENTRY(list_style_image, ListStyleImage),
|
||||
COMPUTED_STYLE_MAP_ENTRY(list_style_position, ListStylePosition),
|
||||
COMPUTED_STYLE_MAP_ENTRY(list_style_type, ListStyleType),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(margin, Margin),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_bottom, MarginBottomWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_left, MarginLeftWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_right, MarginRightWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_top, MarginTopWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(margin_bottom, MarginBottomWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(margin_left, MarginLeftWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(margin_right, MarginRightWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(margin_top, MarginTopWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(marker_offset, MarkerOffset),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(marks, Marks),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(max_height, MaxHeight),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(max_width, MaxWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(min_height, MinHeight),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(min_width, MinWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(max_height, MaxHeight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(max_width, MaxWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(min_height, MinHeight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(min_width, MinWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(mix_blend_mode, MixBlendMode),
|
||||
COMPUTED_STYLE_MAP_ENTRY(opacity, Opacity),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(orphans, Orphans),
|
||||
@ -5161,34 +5159,34 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
|
||||
COMPUTED_STYLE_MAP_ENTRY(overflow_x, OverflowX),
|
||||
COMPUTED_STYLE_MAP_ENTRY(overflow_y, OverflowY),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(padding, Padding),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_bottom, PaddingBottom),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_left, PaddingLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_right, PaddingRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_top, PaddingTop),
|
||||
COMPUTED_STYLE_MAP_ENTRY(padding_bottom, PaddingBottom),
|
||||
COMPUTED_STYLE_MAP_ENTRY(padding_left, PaddingLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY(padding_right, PaddingRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(padding_top, PaddingTop),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(page, Page),
|
||||
COMPUTED_STYLE_MAP_ENTRY(page_break_after, PageBreakAfter),
|
||||
COMPUTED_STYLE_MAP_ENTRY(page_break_before, PageBreakBefore),
|
||||
COMPUTED_STYLE_MAP_ENTRY(page_break_inside, PageBreakInside),
|
||||
COMPUTED_STYLE_MAP_ENTRY(perspective, Perspective),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(perspective_origin, PerspectiveOrigin),
|
||||
COMPUTED_STYLE_MAP_ENTRY(perspective_origin, PerspectiveOrigin),
|
||||
COMPUTED_STYLE_MAP_ENTRY(pointer_events, PointerEvents),
|
||||
COMPUTED_STYLE_MAP_ENTRY(position, Position),
|
||||
COMPUTED_STYLE_MAP_ENTRY(quotes, Quotes),
|
||||
COMPUTED_STYLE_MAP_ENTRY(resize, Resize),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(right, Right),
|
||||
COMPUTED_STYLE_MAP_ENTRY(right, Right),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(size, Size),
|
||||
COMPUTED_STYLE_MAP_ENTRY(table_layout, TableLayout),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_align, TextAlign),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_combine_horizontal, TextCombineHorizontal),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_decoration, TextDecoration),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(text_indent, TextIndent),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_indent, TextIndent),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_orientation, TextOrientation),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_overflow, TextOverflow),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_shadow, TextShadow),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_transform, TextTransform),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(top, Top),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(transform, Transform),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(transform_origin, TransformOrigin),
|
||||
COMPUTED_STYLE_MAP_ENTRY(top, Top),
|
||||
COMPUTED_STYLE_MAP_ENTRY(transform, Transform),
|
||||
COMPUTED_STYLE_MAP_ENTRY(transform_origin, TransformOrigin),
|
||||
COMPUTED_STYLE_MAP_ENTRY(transform_style, TransformStyle),
|
||||
//// COMPUTED_STYLE_MAP_ENTRY(transition, Transition),
|
||||
COMPUTED_STYLE_MAP_ENTRY(transition_delay, TransitionDelay),
|
||||
@ -5196,11 +5194,11 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
|
||||
COMPUTED_STYLE_MAP_ENTRY(transition_property, TransitionProperty),
|
||||
COMPUTED_STYLE_MAP_ENTRY(transition_timing_function, TransitionTimingFunction),
|
||||
COMPUTED_STYLE_MAP_ENTRY(unicode_bidi, UnicodeBidi),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(vertical_align, VerticalAlign),
|
||||
COMPUTED_STYLE_MAP_ENTRY(vertical_align, VerticalAlign),
|
||||
COMPUTED_STYLE_MAP_ENTRY(visibility, Visibility),
|
||||
COMPUTED_STYLE_MAP_ENTRY(white_space, WhiteSpace),
|
||||
// COMPUTED_STYLE_MAP_ENTRY(widows, Widows),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(width, Width),
|
||||
COMPUTED_STYLE_MAP_ENTRY(width, Width),
|
||||
COMPUTED_STYLE_MAP_ENTRY(word_break, WordBreak),
|
||||
COMPUTED_STYLE_MAP_ENTRY(word_spacing, WordSpacing),
|
||||
COMPUTED_STYLE_MAP_ENTRY(word_wrap, WordWrap),
|
||||
@ -5241,10 +5239,10 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
|
||||
COMPUTED_STYLE_MAP_ENTRY(image_region, ImageRegion),
|
||||
COMPUTED_STYLE_MAP_ENTRY(orient, Orient),
|
||||
COMPUTED_STYLE_MAP_ENTRY(osx_font_smoothing, OSXFontSmoothing),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_bottomRight,OutlineRadiusBottomRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_topLeft, OutlineRadiusTopLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_topRight, OutlineRadiusTopRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomRight,OutlineRadiusBottomRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_topLeft, OutlineRadiusTopLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_topRight, OutlineRadiusTopRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(stack_sizing, StackSizing),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_tab_size, TabSize),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_align_last, TextAlignLast),
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nscore.h"
|
||||
#include "nsCSSProperty.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
@ -543,7 +544,12 @@ private:
|
||||
|
||||
nsCSSProperty mProperty;
|
||||
ComputeMethod mGetter;
|
||||
bool mNeedsLayoutFlush;
|
||||
|
||||
bool IsLayoutFlushNeeded() const
|
||||
{
|
||||
return nsCSSProps::PropHasFlags(mProperty,
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH);
|
||||
}
|
||||
};
|
||||
|
||||
static const ComputedStyleMapEntry* GetQueryablePropertyMap(uint32_t* aLength);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#endif
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsDeviceContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsMenuPopupFrame.h"
|
||||
#include "nsClientRect.h"
|
||||
#include "nsView.h"
|
||||
#include "mozilla/AppUnits.h"
|
||||
|
||||
class nsPopupBoxObject : public nsBoxObject,
|
||||
public nsIPopupBoxObject
|
||||
@ -363,7 +364,7 @@ nsPopupBoxObject::GetAlignmentOffset(int32_t *aAlignmentOffset)
|
||||
if (!menuPopupFrame)
|
||||
return NS_OK;
|
||||
|
||||
int32_t pp = nsDeviceContext::AppUnitsPerCSSPixel();
|
||||
int32_t pp = mozilla::AppUnitsPerCSSPixel();
|
||||
// Note that the offset might be along either the X or Y axis, but for the
|
||||
// sake of simplicity we use a point with only the X axis set so we can
|
||||
// use ToNearestPixels().
|
||||
|
@ -436,13 +436,8 @@ VideoCaptureAndroid::~VideoCaptureAndroid() {
|
||||
|
||||
// Delete global object ref to the camera.
|
||||
env->DeleteGlobalRef(_javaCaptureObj);
|
||||
// Clean up the global class references
|
||||
env->DeleteGlobalRef(g_javaCmClass);
|
||||
env->DeleteGlobalRef(g_javaCmDevInfoClass);
|
||||
|
||||
_javaCaptureObj = NULL;
|
||||
VideoCaptureAndroid::g_javaCmClass = NULL;
|
||||
VideoCaptureAndroid::g_javaCmDevInfoClass = NULL;
|
||||
}
|
||||
else {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, -1,
|
||||
|
@ -77,6 +77,15 @@ class MochitestRunner(MozbuildObject):
|
||||
to hook up result parsing, etc.
|
||||
"""
|
||||
|
||||
def get_webapp_runtime_path(self):
|
||||
appname = 'webapprt-stub' + mozinfo.info.get('bin_suffix', '')
|
||||
if sys.platform.startswith('darwin'):
|
||||
appname = os.path.join(self.distdir, self.substs['MOZ_MACBUNDLE_NAME'],
|
||||
'Contents', 'MacOS', appname)
|
||||
else:
|
||||
appname = os.path.join(self.distdir, 'bin', appname)
|
||||
return appname
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
MozbuildObject.__init__(self, *args, **kwargs)
|
||||
|
||||
@ -211,7 +220,6 @@ class MochitestRunner(MozbuildObject):
|
||||
return 1
|
||||
|
||||
from StringIO import StringIO
|
||||
from automation import Automation
|
||||
|
||||
# runtests.py is ambiguous, so we load the file/module manually.
|
||||
if 'mochitest' not in sys.modules:
|
||||
@ -221,13 +229,12 @@ class MochitestRunner(MozbuildObject):
|
||||
imp.load_module('mochitest', fh, path,
|
||||
('.py', 'r', imp.PY_SOURCE))
|
||||
|
||||
import mozinfo
|
||||
import mochitest
|
||||
|
||||
# This is required to make other components happy. Sad, isn't it?
|
||||
os.chdir(self.topobjdir)
|
||||
|
||||
automation = Automation()
|
||||
|
||||
# Automation installs its own stream handler to stdout. Since we want
|
||||
# all logging to go through us, we just remove their handler.
|
||||
remove_handlers = [l for l in logging.getLogger().handlers
|
||||
@ -235,18 +242,11 @@ class MochitestRunner(MozbuildObject):
|
||||
for handler in remove_handlers:
|
||||
logging.getLogger().removeHandler(handler)
|
||||
|
||||
runner = mochitest.Mochitest(automation)
|
||||
runner = mochitest.Mochitest()
|
||||
|
||||
opts = mochitest.MochitestOptions(automation)
|
||||
opts = mochitest.MochitestOptions()
|
||||
options, args = opts.parse_args([])
|
||||
|
||||
appname = ''
|
||||
if sys.platform.startswith('darwin'):
|
||||
appname = os.path.join(self.distdir, self.substs['MOZ_MACBUNDLE_NAME'],
|
||||
'Contents', 'MacOS', 'webapprt-stub' + automation.BIN_SUFFIX)
|
||||
else:
|
||||
appname = os.path.join(self.distdir, 'bin', 'webapprt-stub' +
|
||||
automation.BIN_SUFFIX)
|
||||
|
||||
# Need to set the suite options before verifyOptions below.
|
||||
if suite == 'plain':
|
||||
@ -263,10 +263,10 @@ class MochitestRunner(MozbuildObject):
|
||||
options.a11y = True
|
||||
elif suite == 'webapprt-content':
|
||||
options.webapprtContent = True
|
||||
options.app = appname
|
||||
options.app = self.get_webapp_runtime_path()
|
||||
elif suite == 'webapprt-chrome':
|
||||
options.webapprtChrome = True
|
||||
options.app = appname
|
||||
options.app = self.get_webapp_runtime_path()
|
||||
options.browserArgs.append("-test-mode")
|
||||
else:
|
||||
raise Exception('None or unrecognized mochitest suite type.')
|
||||
@ -314,10 +314,6 @@ class MochitestRunner(MozbuildObject):
|
||||
if options is None:
|
||||
raise Exception('mochitest option validator failed.')
|
||||
|
||||
automation.setServerInfo(options.webServer, options.httpPort,
|
||||
options.sslPort, options.webSocketPort)
|
||||
|
||||
|
||||
# We need this to enable colorization of output.
|
||||
self.log_manager.enable_unstructured()
|
||||
|
||||
|
@ -2,14 +2,14 @@
|
||||
# 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/.
|
||||
|
||||
import mozinfo
|
||||
import moznetwork
|
||||
import optparse
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from automation import Automation
|
||||
from automationutils import addCommonOptions, isURL
|
||||
from mozprofile import DEFAULT_PORTS
|
||||
import moznetwork
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
@ -322,19 +322,12 @@ class MochitestOptions(optparse.OptionParser):
|
||||
}],
|
||||
]
|
||||
|
||||
def __init__(self, automation=None, **kwargs):
|
||||
self._automation = automation or Automation()
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
optparse.OptionParser.__init__(self, **kwargs)
|
||||
defaults = {}
|
||||
|
||||
# we want to pass down everything from self._automation.__all__
|
||||
addCommonOptions(self, defaults=dict(zip(self._automation.__all__,
|
||||
[getattr(self._automation, x) for x in self._automation.__all__])))
|
||||
|
||||
for option in self.mochitest_options:
|
||||
self.add_option(*option[0], **option[1])
|
||||
|
||||
self.set_defaults(**defaults)
|
||||
for option, value in self.mochitest_options:
|
||||
self.add_option(*option, **value)
|
||||
addCommonOptions(self)
|
||||
self.set_usage(self.__doc__)
|
||||
|
||||
def verifyOptions(self, options, mochitest):
|
||||
@ -385,13 +378,18 @@ class MochitestOptions(optparse.OptionParser):
|
||||
if options.symbolsPath and not isURL(options.symbolsPath):
|
||||
options.symbolsPath = mochitest.getFullPath(options.symbolsPath)
|
||||
|
||||
options.webServer = self._automation.DEFAULT_WEB_SERVER
|
||||
options.httpPort = self._automation.DEFAULT_HTTP_PORT
|
||||
options.sslPort = self._automation.DEFAULT_SSL_PORT
|
||||
options.webSocketPort = self._automation.DEFAULT_WEBSOCKET_PORT
|
||||
# Set server information on the options object
|
||||
options.webServer = '127.0.0.1'
|
||||
options.httpPort = DEFAULT_PORTS['http']
|
||||
options.sslPort = DEFAULT_PORTS['https']
|
||||
# options.webSocketPort = DEFAULT_PORTS['ws']
|
||||
options.webSocketPort = str(9988) # <- http://hg.mozilla.org/mozilla-central/file/b871dfb2186f/build/automation.py.in#l30
|
||||
# The default websocket port is incorrect in mozprofile; it is
|
||||
# set to the SSL proxy setting. See:
|
||||
# see https://bugzilla.mozilla.org/show_bug.cgi?id=916517
|
||||
|
||||
if options.vmwareRecording:
|
||||
if not self._automation.IS_WIN32:
|
||||
if not mozinfo.isWin:
|
||||
self.error("use-vmware-recording is only supported on Windows.")
|
||||
mochitest.vmwareHelperPath = os.path.join(
|
||||
options.utilityPath, VMWARE_RECORDING_HELPER_BASENAME + ".dll")
|
||||
@ -444,7 +442,7 @@ class MochitestOptions(optparse.OptionParser):
|
||||
options.testingModulesDir += '/'
|
||||
|
||||
if options.immersiveMode:
|
||||
if not self._automation.IS_WIN32:
|
||||
if not mozinfo.isWin:
|
||||
self.error("immersive is only supported on Windows 8 and up.")
|
||||
mochitest.immersiveHelperPath = os.path.join(
|
||||
options.utilityPath, "metrotestharness.exe")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -197,7 +197,7 @@ class B2GDeviceMochitest(B2GMochitest):
|
||||
d['profilePath'] = tempfile.mkdtemp()
|
||||
if d.get('httpdPath') is None:
|
||||
d['httpdPath'] = os.path.abspath(os.path.join(self.local_binary_dir, 'components'))
|
||||
self.server = MochitestServer(None, d)
|
||||
self.server = MochitestServer(d)
|
||||
self.server.start()
|
||||
|
||||
if (options.pidFile != ""):
|
||||
|
@ -31,7 +31,8 @@ class RemoteOptions(MochitestOptions):
|
||||
|
||||
def __init__(self, automation, **kwargs):
|
||||
defaults = {}
|
||||
MochitestOptions.__init__(self, automation)
|
||||
self._automation = automation or Automation()
|
||||
MochitestOptions.__init__(self)
|
||||
|
||||
self.add_option("--remote-app-path", action="store",
|
||||
type = "string", dest = "remoteAppPath",
|
||||
@ -227,9 +228,10 @@ class MochiRemote(Mochitest):
|
||||
|
||||
def __init__(self, automation, devmgr, options):
|
||||
self._automation = automation
|
||||
Mochitest.__init__(self, self._automation)
|
||||
Mochitest.__init__(self)
|
||||
self._dm = devmgr
|
||||
self.runSSLTunnel = False
|
||||
self.environment = self._automation.environment
|
||||
self.remoteProfile = options.remoteTestRoot + "/profile"
|
||||
self._automation.setRemoteProfile(self.remoteProfile)
|
||||
self.remoteLog = options.remoteLogFile
|
||||
@ -313,7 +315,7 @@ class MochiRemote(Mochitest):
|
||||
sys.exit(1)
|
||||
|
||||
options.profilePath = tempfile.mkdtemp()
|
||||
self.server = MochitestServer(localAutomation, options)
|
||||
self.server = MochitestServer(options)
|
||||
self.server.start()
|
||||
|
||||
if (options.pidFile != ""):
|
||||
@ -499,7 +501,8 @@ class MochiRemote(Mochitest):
|
||||
for key, value in browserEnv.items():
|
||||
try:
|
||||
value.index(',')
|
||||
log.error("Found a ',' in our value, unable to process value.")
|
||||
log.error("buildRobotiumConfig: browserEnv - Found a ',' in our value, unable to process value. key=%s,value=%s", key, value)
|
||||
log.error("browserEnv=%s", browserEnv)
|
||||
except ValueError, e:
|
||||
envstr += "%s%s=%s" % (delim, key, value)
|
||||
delim = ","
|
||||
@ -516,7 +519,16 @@ class MochiRemote(Mochitest):
|
||||
self.buildRobotiumConfig(options, browserEnv)
|
||||
return browserEnv
|
||||
|
||||
|
||||
def runApp(self, *args, **kwargs):
|
||||
"""front-end automation.py's `runApp` functionality until FennecRunner is written"""
|
||||
|
||||
# automation.py/remoteautomation `runApp` takes the profile path,
|
||||
# whereas runtest.py's `runApp` takes a mozprofile object.
|
||||
if 'profileDir' not in kwargs and 'profile' in kwargs:
|
||||
kwargs['profileDir'] = kwargs.pop('profile').profile
|
||||
|
||||
return self._automation.runApp(*args, **kwargs)
|
||||
|
||||
def main():
|
||||
auto = RemoteAutomation(None, "fennec")
|
||||
parser = RemoteOptions(auto)
|
||||
|
@ -21,7 +21,8 @@ from runtests import Mochitest, MochitestOptions
|
||||
class VMwareOptions(MochitestOptions):
|
||||
def __init__(self, automation, mochitest, **kwargs):
|
||||
defaults = {}
|
||||
MochitestOptions.__init__(self, automation, mochitest.SCRIPT_DIRECTORY)
|
||||
self._automation = automation or Automation()
|
||||
MochitestOptions.__init__(self, mochitest.SCRIPT_DIRECTORY)
|
||||
|
||||
def checkPathCallback(option, opt_str, value, parser):
|
||||
path = mochitest.getFullPath(value)
|
||||
|
@ -509,6 +509,7 @@ stage-jittest:
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/jit-test/tests
|
||||
cp -RL $(topsrcdir)/js/src/jsapi.h $(PKG_STAGE)/jit-test
|
||||
cp -RL $(topsrcdir)/js/src/jit-test $(PKG_STAGE)/jit-test/jit-test
|
||||
cp -RL $(topsrcdir)/js/src/tests/ecma_6 $(PKG_STAGE)/jit-test/tests/ecma_6
|
||||
cp -RL $(topsrcdir)/js/src/tests/lib $(PKG_STAGE)/jit-test/tests/lib
|
||||
|
||||
MARIONETTE_DIR=$(PKG_STAGE)/marionette
|
||||
|
@ -22,10 +22,15 @@ MOCHITEST_BROWSER_FILES := \
|
||||
ifndef RELEASE_BUILD
|
||||
MOCHITEST_BROWSER_FILES += \
|
||||
browser_thumbnails_background.js \
|
||||
browser_thumbnails_background_crash.js \
|
||||
browser_thumbnails_update.js \
|
||||
thumbnails_background.sjs \
|
||||
thumbnails_crash_content_helper.js \
|
||||
thumbnails_update.sjs \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_CRASHREPORTER
|
||||
MOCHITEST_BROWSER_FILES += \
|
||||
browser_thumbnails_background_crash.js \
|
||||
thumbnails_crash_content_helper.js \
|
||||
$(NULL)
|
||||
endif
|
||||
endif
|
||||
|
@ -13,6 +13,7 @@ registerCleanupFunction(function () {
|
||||
});
|
||||
|
||||
function test() {
|
||||
requestLongerTimeout(2);
|
||||
waitForExplicitFinish();
|
||||
spawnNextTest();
|
||||
}
|
||||
|
@ -56,6 +56,7 @@
|
||||
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/WidgetTraceEvent.h"
|
||||
#include "nsDebug.h"
|
||||
#include <limits.h>
|
||||
#include <prenv.h>
|
||||
#include <prinrval.h>
|
||||
|
@ -52,6 +52,7 @@ using mozilla::unused;
|
||||
#include "imgIEncoder.h"
|
||||
|
||||
#include "nsStringGlue.h"
|
||||
#include "GeckoProfiler.h" // For PROFILER_LABEL
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -2392,6 +2393,7 @@ nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect)
|
||||
void
|
||||
nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
PROFILER_LABEL("nsWindow", "DrawWindowOverlay");
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowOverlay()!");
|
||||
if (!env)
|
||||
|
@ -288,7 +288,7 @@ typedef NSInteger NSEventGestureAxis;
|
||||
|
||||
#ifdef __LP64__
|
||||
// Support for fluid swipe tracking.
|
||||
void (^mCancelSwipeAnimation)();
|
||||
BOOL* mCancelSwipeAnimation;
|
||||
#endif
|
||||
|
||||
// Whether this uses off-main-thread compositing.
|
||||
|
@ -3839,8 +3839,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
|
||||
- (void)beginGestureWithEvent:(NSEvent *)anEvent
|
||||
{
|
||||
NS_ASSERTION(mGestureState == eGestureState_None, "mGestureState should be eGestureState_None");
|
||||
|
||||
if (!anEvent)
|
||||
return;
|
||||
|
||||
@ -4063,18 +4061,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
return eventCancelled; // event cancelled == swipe should start
|
||||
}
|
||||
|
||||
- (void)cancelSwipeIfRunning
|
||||
{
|
||||
// Clear gesture state.
|
||||
mGestureState = eGestureState_None;
|
||||
|
||||
if (mCancelSwipeAnimation) {
|
||||
mCancelSwipeAnimation();
|
||||
[mCancelSwipeAnimation release];
|
||||
mCancelSwipeAnimation = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sendSwipeEndEvent:(NSEvent *)anEvent
|
||||
allowedDirections:(uint32_t)aAllowedDirections
|
||||
{
|
||||
@ -4112,7 +4098,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
if ([anEvent type] != NSScrollWheel) {
|
||||
// Verify that this is a scroll wheel event with proper phase to be tracked
|
||||
// by the OS.
|
||||
if ([anEvent type] != NSScrollWheel || [anEvent phase] == NSEventPhaseNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4126,12 +4114,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
// Only initiate tracking for gestures that have just begun -- otherwise a
|
||||
// scroll to one side of the page can have a swipe tacked on to it.
|
||||
if ([anEvent phase] != NSEventPhaseBegan) {
|
||||
return;
|
||||
}
|
||||
|
||||
CGFloat deltaX, deltaY;
|
||||
if ([anEvent hasPreciseScrollingDeltas]) {
|
||||
deltaX = [anEvent scrollingDeltaX];
|
||||
@ -4140,29 +4122,48 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
deltaX = [anEvent deltaX];
|
||||
deltaY = [anEvent deltaY];
|
||||
}
|
||||
// Only initiate tracking for events whose horizontal element is at least
|
||||
// eight times larger than its vertical element. This minimizes performance
|
||||
// problems with vertical scrolls (by minimizing the possibility that they'll
|
||||
// be misinterpreted as horizontal swipes), while still tolerating a small
|
||||
// vertical element to a true horizontal swipe. The number '8' was arrived
|
||||
// at by trial and error.
|
||||
if ((deltaX == 0) || (fabs(deltaX) <= fabs(deltaY) * 8)) {
|
||||
|
||||
uint32_t direction = 0;
|
||||
// Only initiate horizontal tracking for events whose horizontal element is
|
||||
// at least eight times larger than its vertical element. This minimizes
|
||||
// performance problems with vertical scrolls (by minimizing the possibility
|
||||
// that they'll be misinterpreted as horizontal swipes), while still
|
||||
// tolerating a small vertical element to a true horizontal swipe. The number
|
||||
// '8' was arrived at by trial and error.
|
||||
if (overflow != 0.0 && deltaX != 0.0 &&
|
||||
fabsf(deltaX) > fabsf(deltaY) * 8) {
|
||||
// Only initiate horizontal tracking for gestures that have just begun --
|
||||
// otherwise a scroll to one side of the page can have a swipe tacked on
|
||||
// to it.
|
||||
if ([anEvent phase] != NSEventPhaseBegan) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (deltaX < 0.0) {
|
||||
direction = (uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_RIGHT;
|
||||
} else {
|
||||
direction = (uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_LEFT;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// If a swipe is currently being tracked kill it -- it's been interrupted by
|
||||
// another gesture or legacy scroll wheel event.
|
||||
[self cancelSwipeIfRunning];
|
||||
// If a swipe is currently being tracked kill it -- it's been interrupted
|
||||
// by another gesture event.
|
||||
if (mCancelSwipeAnimation && *mCancelSwipeAnimation == NO) {
|
||||
*mCancelSwipeAnimation = YES;
|
||||
mCancelSwipeAnimation = nil;
|
||||
}
|
||||
|
||||
uint32_t allowedDirections = 0;
|
||||
// We're ready to start the animation. Tell Gecko about it, and at the same
|
||||
// time ask it if it really wants to start an animation for this event.
|
||||
// This event also reports back the directions that we can swipe in.
|
||||
uint32_t allowedDirections = 0;
|
||||
bool shouldStartSwipe = [self sendSwipeEvent:anEvent
|
||||
withKind:NS_SIMPLE_GESTURE_SWIPE_START
|
||||
allowedDirections:&allowedDirections
|
||||
direction:0
|
||||
delta:0.0];
|
||||
withKind:NS_SIMPLE_GESTURE_SWIPE_START
|
||||
allowedDirections:&allowedDirections
|
||||
direction:direction
|
||||
delta:0.0];
|
||||
|
||||
if (!shouldStartSwipe) {
|
||||
return;
|
||||
@ -4171,7 +4172,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
double min = (allowedDirections & nsIDOMSimpleGestureEvent::DIRECTION_RIGHT) ? -1 : 0;
|
||||
double max = (allowedDirections & nsIDOMSimpleGestureEvent::DIRECTION_LEFT) ? 1 : 0;
|
||||
|
||||
__block BOOL animationCancelled = NO;
|
||||
__block BOOL animationCanceled = NO;
|
||||
__block BOOL geckoSwipeEventSent = NO;
|
||||
// At this point, anEvent is the first scroll wheel event in a two-finger
|
||||
// horizontal gesture that we've decided to treat as a swipe. When we call
|
||||
@ -4188,67 +4189,70 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
// the anEvent object because it's retained by the block, see bug 682445.
|
||||
// The block will release it when the block goes away at the end of the
|
||||
// animation, or when the animation is canceled.
|
||||
[anEvent trackSwipeEventWithOptions:NSEventSwipeTrackingLockDirection
|
||||
[anEvent trackSwipeEventWithOptions:NSEventSwipeTrackingLockDirection |
|
||||
NSEventSwipeTrackingClampGestureAmount
|
||||
dampenAmountThresholdMin:min
|
||||
max:max
|
||||
usingHandler:^(CGFloat gestureAmount, NSEventPhase phase, BOOL isComplete, BOOL *stop) {
|
||||
// Since this tracking handler can be called asynchronously, mGeckoChild
|
||||
// might have become NULL here (our child widget might have been
|
||||
// destroyed).
|
||||
if (animationCancelled || !mGeckoChild) {
|
||||
*stop = YES;
|
||||
return;
|
||||
usingHandler:^(CGFloat gestureAmount,
|
||||
NSEventPhase phase,
|
||||
BOOL isComplete,
|
||||
BOOL *stop) {
|
||||
uint32_t allowedDirectionsCopy = allowedDirections;
|
||||
// Since this tracking handler can be called asynchronously, mGeckoChild
|
||||
// might have become NULL here (our child widget might have been
|
||||
// destroyed).
|
||||
// Checking for gestureAmount == 0.0 also works around bug 770626, which
|
||||
// happens when DispatchWindowEvent() triggers a modal dialog, which spins
|
||||
// the event loop and confuses the OS. This results in several re-entrant
|
||||
// calls to this handler.
|
||||
if (animationCanceled || !mGeckoChild || gestureAmount == 0.0) {
|
||||
*stop = YES;
|
||||
animationCanceled = YES;
|
||||
if (gestureAmount == 0.0) {
|
||||
if (mCancelSwipeAnimation)
|
||||
*mCancelSwipeAnimation = YES;
|
||||
mCancelSwipeAnimation = nil;
|
||||
[self sendSwipeEndEvent:anEvent
|
||||
allowedDirections:allowedDirectionsCopy];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t allowedDirectionsCopy = allowedDirections;
|
||||
// Update animation overlay to match gestureAmount.
|
||||
[self sendSwipeEvent:anEvent
|
||||
withKind:NS_SIMPLE_GESTURE_SWIPE_UPDATE
|
||||
allowedDirections:&allowedDirectionsCopy
|
||||
direction:0.0
|
||||
delta:gestureAmount];
|
||||
|
||||
// Update animation overlay to match gestureAmount.
|
||||
if (phase == NSEventPhaseEnded && !geckoSwipeEventSent) {
|
||||
// The result of the swipe is now known, so the main event can be sent.
|
||||
// The animation might continue even after this event was sent, so
|
||||
// don't tear down the animation overlay yet.
|
||||
|
||||
uint32_t directionCopy = direction;
|
||||
|
||||
// gestureAmount is documented to be '-1', '0' or '1' when isComplete
|
||||
// is TRUE, but the docs don't say anything about its value at other
|
||||
// times. However, tests show that, when phase == NSEventPhaseEnded,
|
||||
// gestureAmount is negative when it will be '-1' at isComplete, and
|
||||
// positive when it will be '1'. And phase is never equal to
|
||||
// NSEventPhaseEnded when gestureAmount will be '0' at isComplete.
|
||||
geckoSwipeEventSent = YES;
|
||||
[self sendSwipeEvent:anEvent
|
||||
withKind:NS_SIMPLE_GESTURE_SWIPE_UPDATE
|
||||
withKind:NS_SIMPLE_GESTURE_SWIPE
|
||||
allowedDirections:&allowedDirectionsCopy
|
||||
direction:0
|
||||
delta:gestureAmount];
|
||||
direction:directionCopy
|
||||
delta:0.0];
|
||||
}
|
||||
|
||||
if (phase == NSEventPhaseEnded && !geckoSwipeEventSent) {
|
||||
// The result of the swipe is now known, so the main event can be sent.
|
||||
// The animation might continue even after this event was sent, so
|
||||
// don't tear down the animation overlay yet.
|
||||
// gestureAmount is documented to be '-1', '0' or '1' when isComplete
|
||||
// is TRUE, but the docs don't say anything about its value at other
|
||||
// times. However, tests show that, when phase == NSEventPhaseEnded,
|
||||
// gestureAmount is negative when it will be '-1' at isComplete, and
|
||||
// positive when it will be '1'. And phase is never equal to
|
||||
// NSEventPhaseEnded when gestureAmount will be '0' at isComplete.
|
||||
uint32_t direction = gestureAmount > 0 ?
|
||||
(uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_LEFT :
|
||||
(uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_RIGHT;
|
||||
// If DispatchWindowEvent() does something to trigger a modal dialog
|
||||
// (which spins the event loop), the OS gets confused and makes
|
||||
// several re-entrant calls to this handler, all of which have
|
||||
// 'phase' set to NSEventPhaseEnded. Unless we do something about
|
||||
// it, this results in an equal number of re-entrant calls to
|
||||
// DispatchWindowEvent(), and to our modal-event handling code.
|
||||
// Probably because of bug 478703, this really messes things up,
|
||||
// and requires a force quit to get out of. We avoid this by
|
||||
// avoiding re-entrant calls to DispatchWindowEvent(). See bug
|
||||
// 770626.
|
||||
geckoSwipeEventSent = YES;
|
||||
[self sendSwipeEvent:anEvent
|
||||
withKind:NS_SIMPLE_GESTURE_SWIPE
|
||||
allowedDirections:&allowedDirectionsCopy
|
||||
direction:direction
|
||||
delta:0.0];
|
||||
}
|
||||
if (isComplete) {
|
||||
[self sendSwipeEndEvent:anEvent allowedDirections:allowedDirectionsCopy];
|
||||
mCancelSwipeAnimation = nil;
|
||||
}
|
||||
}];
|
||||
|
||||
if (isComplete) {
|
||||
[self cancelSwipeIfRunning];
|
||||
[self sendSwipeEndEvent:anEvent allowedDirections:allowedDirections];
|
||||
}
|
||||
}];
|
||||
|
||||
mCancelSwipeAnimation = [^{
|
||||
animationCancelled = YES;
|
||||
} copy];
|
||||
mCancelSwipeAnimation = &animationCanceled;
|
||||
}
|
||||
#endif // #ifdef __LP64__
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user