Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2016-04-04 12:03:02 +02:00
Родитель a1dceae02f 1901d6fb07
Коммит 00b040116b
13 изменённых файлов: 234 добавлений и 57 удалений

Просмотреть файл

@ -31,7 +31,13 @@ PostSpecifiedTimingUpdated(KeyframeEffect* aEffect)
void
AnimationEffectTiming::SetDelay(double aDelay)
{
// TODO: Bug 1244633 - implement AnimationEffectTiming delay
TimeDuration delay = TimeDuration::FromMilliseconds(aDelay);
if (mTiming.mDelay == delay) {
return;
}
mTiming.mDelay = delay;
PostSpecifiedTimingUpdated(mEffect);
}
void

Просмотреть файл

@ -1636,6 +1636,47 @@ addAsyncAnimTest("change_iterations",
"records after animation end");
});
addAsyncAnimTest("change_delay",
{ observe: div, subtree: true }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] }, 100000);
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation is added");
anim.effect.timing.delay = 100;
yield await_frame();
assert_records([{ added: [], changed: [anim], removed: [] }],
"records after delay is changed");
anim.effect.timing.delay = 100;
yield await_frame();
assert_records([], "records after assigning same value");
anim.effect.timing.delay = -100000;
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after animation end");
anim.effect.timing.delay = 0;
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation restarted");
anim.cancel();
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after animation end");
});
addAsyncAnimTest("negative_delay_in_constructor",
{ observe: div, subtree: true }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] },
{ duration: 100, delay: -100 });
yield await_frame();
assert_records([], "records after assigning negative value");
});
addAsyncAnimTest("exclude_animations_targeting_pseudo_elements",
{ observe: div, subtree: false }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] },

Просмотреть файл

@ -1,29 +1,5 @@
"use strict";
function frameScript() {
let Ci = Components.interfaces;
let windowUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let menuitem = content.document.getElementById("menuitem");
menuitem.addEventListener("click", function() {
sendAsyncMessage("Test:ContextMenuClick", windowUtils.isHandlingUserInput);
});
}
var gMessageManager;
function listenOneMessage(aMsg, aListener) {
function listener({ data }) {
gMessageManager.removeMessageListener(aMsg, listener);
aListener(data);
}
gMessageManager.addMessageListener(aMsg, listener);
}
function promiseOneMessage(aMsg) {
return new Promise(resolve => listenOneMessage(aMsg, resolve));
}
const kPage = "http://example.org/browser/" +
"dom/html/test/file_content_contextmenu.html";
@ -32,9 +8,6 @@ add_task(function* () {
gBrowser,
url: kPage
}, function*(aBrowser) {
gMessageManager = aBrowser.messageManager;
ContentTask.spawn(aBrowser, null, frameScript);
let contextMenu = document.getElementById("contentAreaContextMenu");
ok(contextMenu, "Got context menu");
@ -53,9 +26,20 @@ add_task(function* () {
let testMenuItem = pageMenuSep.previousSibling;
is(testMenuItem.label, "Test Context Menu Click", "Got context menu item");
let promiseContextMenuClick = promiseOneMessage("Test:ContextMenuClick");
let promiseCtxMenuClick = ContentTask.spawn(aBrowser, null, function*() {
yield new Promise(resolve => {
let Ci = Components.interfaces;
let windowUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let menuitem = content.document.getElementById("menuitem");
menuitem.addEventListener("click", function() {
Assert.ok(windowUtils.isHandlingUserInput,
"Content menu click should be a user input");
resolve();
});
});
});
EventUtils.synthesizeMouseAtCenter(testMenuItem, {}, window);
let isUserInput = yield promiseContextMenuClick;
ok(isUserInput, "Content menu click should be a user input");
yield promiseCtxMenuClick;
});
});

Просмотреть файл

@ -6,3 +6,4 @@
== at-rule-error-handling-media-1.html at-rule-error-handling-ref.html
== invalid-font-face-descriptor-1.html invalid-font-face-descriptor-1-ref.html
== two-dash-identifiers.html two-dash-identifiers-ref.html
== supports-moz-bool-pref.html supports-moz-bool-pref-ref.html

Просмотреть файл

@ -0,0 +1,10 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<body>
<p>This text should not have background color.</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,20 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<style>
/* This is not a user agent style sheet, so the style will be ignored.
"testing.supports.moz-bool-pref" is set to true in
layout/tools/reftest/reftest-preferences.js. */
@supports -moz-bool-pref("testing.supports.moz-bool-pref") {
p {
background-color: red;
}
}
</style>
<body>
<p>This text should not have background color.</p>
</body>
</html>

Просмотреть файл

@ -694,6 +694,7 @@ protected:
bool ParseSupportsCondition(bool& aConditionMet);
bool ParseSupportsConditionNegation(bool& aConditionMet);
bool ParseSupportsConditionInParens(bool& aConditionMet);
bool ParseSupportsMozBoolPrefName(bool& aConditionMet);
bool ParseSupportsConditionInParensInsideParens(bool& aConditionMet);
bool ParseSupportsConditionTerms(bool& aConditionMet);
enum SupportsConditionTermOperator { eAnd, eOr };
@ -4526,6 +4527,7 @@ CSSParserImpl::ParseSupportsConditionNegation(bool& aConditionMet)
// supports_condition_in_parens
// : '(' S* supports_condition_in_parens_inside_parens ')' S*
// | supports_condition_pref
// | general_enclosed
// ;
bool
@ -4541,6 +4543,12 @@ CSSParserImpl::ParseSupportsConditionInParens(bool& aConditionMet)
return true;
}
if (AgentRulesEnabled() &&
mToken.mType == eCSSToken_Function &&
mToken.mIdent.LowerCaseEqualsLiteral("-moz-bool-pref")) {
return ParseSupportsMozBoolPrefName(aConditionMet);
}
if (mToken.mType == eCSSToken_Function ||
mToken.mType == eCSSToken_Bad_URL) {
if (!SkipUntil(')')) {
@ -4575,6 +4583,32 @@ CSSParserImpl::ParseSupportsConditionInParens(bool& aConditionMet)
return true;
}
// supports_condition_pref
// : '-moz-bool-pref(' bool_pref_name ')'
// ;
bool
CSSParserImpl::ParseSupportsMozBoolPrefName(bool& aConditionMet)
{
if (!GetToken(true)) {
return false;
}
if (mToken.mType != eCSSToken_String) {
SkipUntil(')');
return false;
}
aConditionMet = Preferences::GetBool(
NS_ConvertUTF16toUTF8(mToken.mIdent).get());
if (!ExpectSymbol(')', true)) {
SkipUntil(')');
return false;
}
return true;
}
// supports_condition_in_parens_inside_parens
// : core_declaration
// | supports_condition_negation

Просмотреть файл

@ -134,6 +134,11 @@ nsLayoutStylesheetCache::UASheet()
StyleSheetHandle
nsLayoutStylesheetCache::HTMLSheet()
{
if (!mHTMLSheet) {
LoadSheetURL("resource://gre-resources/html.css",
mHTMLSheet, eAgentSheetFeatures);
}
return mHTMLSheet;
}
@ -319,8 +324,6 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType)
// per-profile, since they're profile-invariant.
LoadSheetURL("resource://gre-resources/counterstyles.css",
mCounterStylesSheet, eAgentSheetFeatures);
LoadSheetURL("resource://gre-resources/html.css",
mHTMLSheet, eAgentSheetFeatures);
LoadSheetURL("chrome://global/content/minimal-xul.css",
mMinimalXULSheet, eAgentSheetFeatures);
LoadSheetURL("resource://gre-resources/quirk.css",
@ -375,6 +378,8 @@ nsLayoutStylesheetCache::For(StyleBackendType aType)
// "layout.css.example-pref.enabled");
Preferences::RegisterCallback(&DependentPrefChanged,
"layout.css.grid.enabled");
Preferences::RegisterCallback(&DependentPrefChanged,
"dom.details_element.enabled");
}
return cache;
@ -818,6 +823,7 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr);
INVALIDATE(mUASheet); // for layout.css.grid.enabled
INVALIDATE(mHTMLSheet); // for dom.details_element.enabled
#undef INVALIDATE
}

Просмотреть файл

@ -771,13 +771,15 @@ video > .caption-box {
}
/* details & summary */
/* Need to revert Bug 1259889 Part 2 when removing details preference. */
@supports -moz-bool-pref("dom.details_element.enabled") {
details > summary::-moz-list-bullet {
list-style-type: disclosure-closed;
}
details > summary::-moz-list-bullet {
list-style-type: disclosure-closed;
}
details[open] > summary::-moz-list-bullet {
list-style-type: disclosure-open;
details[open] > summary::-moz-list-bullet {
list-style-type: disclosure-open;
}
}
/* emulation of non-standard HTML <marquee> tag */

Просмотреть файл

@ -114,3 +114,6 @@ user_pref("startup.homepage_override_url", "");
user_pref("browser.usedOnWindows10.introURL", "");
user_pref("media.gmp-manager.url.override", "http://localhost/dummy-gmp-manager.xml");
// A fake bool pref for "@supports -moz-bool-pref" sanify test.
user_pref("testing.supports.moz-bool-pref", true);

Просмотреть файл

@ -28389,6 +28389,10 @@
"path": "web-animations/animatable/animate.html",
"url": "/web-animations/animatable/animate.html"
},
{
"path": "web-animations/animation-effect-timing/delay.html",
"url": "/web-animations/animation-effect-timing/delay.html"
},
{
"path": "web-animations/animation-effect-timing/duration.html",
"url": "/web-animations/animation-effect-timing/duration.html"

Просмотреть файл

@ -0,0 +1,62 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>delay tests</title>
<link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffecttiming-delay">
<link rel="author" title="Daisuke Akatsuka" href="mailto:daisuke@mozilla-japan.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
<link rel="stylesheet" href="/resources/testharness.css">
<body>
<div id="log"></div>
<script>
'use strict';
test(function(t) {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
anim.effect.timing.delay = 100;
assert_equals(anim.effect.timing.delay, 100, 'set delay 100');
assert_equals(anim.effect.getComputedTiming().delay, 100,
'getComputedTiming() after set delay 100');
}, 'set delay 100');
test(function(t) {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
anim.effect.timing.delay = -100;
assert_equals(anim.effect.timing.delay, -100, 'set delay -100');
assert_equals(anim.effect.getComputedTiming().delay, -100,
'getComputedTiming() after set delay -100');
}, 'set delay -100');
test(function(t) {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
anim.effect.timing.delay = 100;
assert_equals(anim.effect.getComputedTiming().progress, null);
assert_equals(anim.effect.getComputedTiming().currentIteration, null);
}, 'Test adding a positive delay to an animation without a backwards fill ' +
'makes it no longer active');
test(function(t) {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ fill: 'both',
duration: 100 });
anim.effect.timing.delay = -50;
assert_equals(anim.effect.getComputedTiming().progress, 0.5);
}, 'Test seeking an animation by setting a negative delay');
test(function(t) {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ fill: 'both',
duration: 100 });
anim.effect.timing.delay = -100;
assert_equals(anim.effect.getComputedTiming().progress, 1);
assert_equals(anim.effect.getComputedTiming().currentIteration, 0);
}, 'Test finishing an animation using a large negative delay');
</script>
</body>

Просмотреть файл

@ -41,9 +41,9 @@ static GtkWidget* gComboBoxEntryArrowWidget;
static GtkWidget* gHandleBoxWidget;
static GtkWidget* gToolbarWidget;
static GtkWidget* gFrameWidget;
static GtkWidget* gStatusbarWidget;
static GtkWidget* gProgressWidget;
static GtkWidget* gTabWidget;
static GtkWidget* gTextViewWidget;
static GtkWidget* gTooltipWidget;
static GtkWidget* gMenuBarWidget;
static GtkWidget* gMenuBarItemWidget;
@ -537,24 +537,12 @@ ensure_progress_widget()
return MOZ_GTK_SUCCESS;
}
static gint
ensure_statusbar_widget()
{
if (!gStatusbarWidget) {
gStatusbarWidget = gtk_statusbar_new();
setup_widget_prototype(gStatusbarWidget);
}
return MOZ_GTK_SUCCESS;
}
static gint
ensure_frame_widget()
{
if (!gFrameWidget) {
ensure_statusbar_widget();
gFrameWidget = gtk_frame_new(NULL);
gtk_container_add(GTK_CONTAINER(gStatusbarWidget), gFrameWidget);
gtk_widget_realize(gFrameWidget);
setup_widget_prototype(gFrameWidget);
}
return MOZ_GTK_SUCCESS;
}
@ -721,6 +709,17 @@ ensure_scrolled_window_widget()
return MOZ_GTK_SUCCESS;
}
static void
ensure_text_view_widget()
{
if (gTextViewWidget)
return;
gTextViewWidget = gtk_text_view_new();
ensure_scrolled_window_widget();
gtk_container_add(GTK_CONTAINER(gScrolledWindowWidget), gTextViewWidget);
}
gint
moz_gtk_init()
{
@ -1964,11 +1963,16 @@ moz_gtk_resizer_paint(cairo_t *cr, GdkRectangle* rect,
{
GtkStyleContext* style;
ensure_frame_widget();
gtk_widget_set_direction(gStatusbarWidget, GTK_TEXT_DIR_LTR);
// gtk_render_handle() draws a background, so use GtkTextView and its
// GTK_STYLE_CLASS_VIEW to match the background with textarea elements.
// The resizer is drawn with shaded variants of the background color, and
// so a transparent background would lead to a transparent resizer.
ensure_text_view_widget();
gtk_widget_set_direction(gTextViewWidget, GTK_TEXT_DIR_LTR);
style = gtk_widget_get_style_context(gStatusbarWidget);
style = gtk_widget_get_style_context(gTextViewWidget);
gtk_style_context_save(style);
gtk_style_context_add_class(style, GTK_STYLE_CLASS_VIEW);
gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
@ -3441,10 +3445,10 @@ moz_gtk_shutdown()
gComboBoxEntryTextareaWidget = NULL;
gHandleBoxWidget = NULL;
gToolbarWidget = NULL;
gStatusbarWidget = NULL;
gFrameWidget = NULL;
gProgressWidget = NULL;
gTabWidget = NULL;
gTextViewWidget = nullptr;
gTooltipWidget = NULL;
gMenuBarWidget = NULL;
gMenuBarItemWidget = NULL;