Merge mozilla-central to inbound. a=merge CLOSED TREE

This commit is contained in:
Gurzau Raul 2018-02-21 19:32:45 +02:00
Родитель 924797ef59 9a8d3f8191
Коммит 67898ab5c2
53 изменённых файлов: 294 добавлений и 255 удалений

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

@ -722,10 +722,34 @@ TabTarget.prototype = {
* The category of the message. @see nsIScriptError.
*/
logErrorInPage: function (text, category) {
if (this.activeTab && this.activeTab.traits.logErrorInPage) {
if (this.activeTab && this.activeTab.traits.logInPage) {
const errorFlag = 0;
let packet = {
to: this.form.actor,
type: "logErrorInPage",
type: "logInPage",
flags: errorFlag,
text,
category,
};
this.client.request(packet);
}
},
/**
* Log a warning of some kind to the tab's console.
*
* @param {String} text
* The text to log.
* @param {String} category
* The category of the message. @see nsIScriptError.
*/
logWarningInPage: function (text, category) {
if (this.activeTab && this.activeTab.traits.logInPage) {
const warningFlag = 1;
let packet = {
to: this.form.actor,
type: "logInPage",
flags: warningFlag,
text,
category,
};
@ -887,4 +911,8 @@ WorkerTarget.prototype = {
logErrorInPage: function () {
// No-op. See bug 1368680.
},
logWarningInPage: function () {
// No-op. See bug 1368680.
},
};

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

@ -609,7 +609,7 @@ Toolbox.prototype = {
let message = L10N.getFormatStr("toolbox.sourceMapFailure",
text, urlInfo.url,
urlInfo.sourceMapURL);
this.target.logErrorInPage(message, "source map");
this.target.logWarningInPage(message, "source map");
// It's ok to swallow errors here, because a null
// result just means that no source map was found.
return null;
@ -622,7 +622,7 @@ Toolbox.prototype = {
.catch(text => {
let message = L10N.getFormatStr("toolbox.sourceMapSourceFailure",
text, originalSource.url);
this.target.logErrorInPage(message, "source map");
this.target.logWarningInPage(message, "source map");
// Also replace the result with the error text.
// Note that this result has to have the same form
// as whatever the upstream getOriginalSourceText
@ -3082,7 +3082,7 @@ Toolbox.prototype = {
// once in order to receive `onRequestFinished` events.
let message = "The Network panel needs to be selected at least" +
" once in order to receive 'onRequestFinished' events.";
this.target.logErrorInPage(message, "har");
this.target.logWarningInPage(message, "har");
// Add the listener into internal list.
this._requestFinishedListeners.add(listener);

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

@ -309,6 +309,7 @@ skip-if = true # Bug 1405343
[browser_webconsole_location_styleeditor_link.js]
[browser_webconsole_logErrorInPage.js]
[browser_webconsole_loglimit.js]
[browser_webconsole_logWarningInPage.js]
[browser_webconsole_longstring_expand.js]
skip-if = true # Bug 1403448
[browser_webconsole_longstring_hang.js]

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

@ -17,4 +17,5 @@ add_task(async function () {
const node = await waitFor(() => findMessage(hud, "octopus"));
ok(node, "text is displayed in web console");
ok(node.classList.contains("error"), "the log represents an error");
});

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

@ -0,0 +1,21 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that we can log warning message to the web console from the toolbox.
const TEST_URI = "data:text/html;charset=utf-8,<p>test logErrorInPage";
add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
const toolbox = hud.ui.newConsoleOutput.toolbox;
toolbox.target.logWarningInPage("beware the octopus", "content javascript");
const node = await waitFor(() => findMessage(hud, "octopus"));
ok(node, "text is displayed in web console");
ok(node.classList.contains("warn"), "the log represents a warning");
});

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

@ -132,7 +132,7 @@ NewWebConsoleFrame.prototype = {
},
logWarningAboutReplacedAPI() {
this.owner.target.logErrorInPage(l10n.getStr("ConsoleAPIDisabled"),
this.owner.target.logWarningInPage(l10n.getStr("ConsoleAPIDisabled"),
"ConsoleAPIDisabled");
},

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

@ -228,8 +228,8 @@ function TabActor(connection) {
// Do not require to send reconfigure request to reset the document state
// to what it was before using the TabActor
noTabReconfigureOnClose: true,
// Supports the logErrorInPage request.
logErrorInPage: true,
// Supports the logInPage request.
logInPage: true,
};
this._workerActorList = null;
@ -656,11 +656,11 @@ TabActor.prototype = {
});
},
onLogErrorInPage(request) {
let {text, category} = request;
onLogInPage(request) {
let {text, category, flags} = request;
let scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
scriptError.initWithWindowID(text, null, null, 0, 0, 1,
scriptError.initWithWindowID(text, null, null, 0, 0, flags,
category, getInnerId(this.window));
Services.console.logMessage(scriptError);
return {};
@ -1433,7 +1433,7 @@ TabActor.prototype.requestTypes = {
"switchToFrame": TabActor.prototype.onSwitchToFrame,
"listFrames": TabActor.prototype.onListFrames,
"listWorkers": TabActor.prototype.onListWorkers,
"logErrorInPage": TabActor.prototype.onLogErrorInPage,
"logInPage": TabActor.prototype.onLogInPage,
};
exports.TabActor = TabActor;

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

@ -107,7 +107,7 @@ protected:
nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
nsCOMPtr<Element> mHost;
RefPtr<Element> mHost;
};
} // namespace dom

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

@ -450,16 +450,6 @@ ShadowRoot::SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError)
SetInnerHTMLInternal(aInnerHTML, aError);
}
Element*
ShadowRoot::Host()
{
nsIContent* host = GetHost();
MOZ_ASSERT(host && host->IsElement(),
"ShadowRoot host should always be an element, "
"how else did we create this ShadowRoot?");
return host->AsElement();
}
void
ShadowRoot::AttributeChanged(nsIDocument* aDocument,
Element* aElement,

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

@ -65,7 +65,13 @@ public:
nsXBLPrototypeBinding* aProtoBinding);
// Shadow DOM v1
Element* Host();
Element* Host() const
{
MOZ_ASSERT(GetHost(), "ShadowRoot always has a host, how did we create "
"this ShadowRoot?");
return GetHost();
}
ShadowRootMode Mode() const
{
return mMode;

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

@ -1265,9 +1265,8 @@ nsContentSink::StartLayout(bool aIgnorePendingSheets)
// docshell in the iframe, and the content sink's call to OpenBody().
// (Bug 153815)
if (shell && !shell->DidInitialize()) {
nsRect r = shell->GetPresContext()->GetVisibleArea();
nsCOMPtr<nsIPresShell> shellGrip = shell;
nsresult rv = shell->Initialize(r.Width(), r.Height());
nsresult rv = shell->Initialize();
if (NS_FAILED(rv)) {
return;
}

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

@ -1373,8 +1373,7 @@ nsGlobalWindowOuter::SetInitialPrincipalToSubject()
if (shell && !shell->DidInitialize()) {
// Ensure that if someone plays with this document they will get
// layout happening.
nsRect r = shell->GetPresContext()->GetVisibleArea();
shell->Initialize(r.Width(), r.Height());
shell->Initialize();
}
}

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

@ -262,8 +262,7 @@ MediaDocument::StartLayout()
// Don't mess with the presshell if someone has already handled
// its initial reflow.
if (shell && !shell->DidInitialize()) {
nsRect visibleArea = shell->GetPresContext()->GetVisibleArea();
nsresult rv = shell->Initialize(visibleArea.width, visibleArea.height);
nsresult rv = shell->Initialize();
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -1574,9 +1574,7 @@ XULDocument::StartLayout(void)
if (! docShell)
return NS_ERROR_UNEXPECTED;
nsresult rv = NS_OK;
nsRect r = cx->GetVisibleArea();
rv = shell->Initialize(r.width, r.height);
nsresult rv = shell->Initialize();
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -802,7 +802,7 @@ TextEditor::InsertLineBreak()
return rv;
}
NS_IMETHODIMP
nsresult
TextEditor::SetText(const nsAString& aString)
{
if (NS_WARN_IF(!mRules)) {
@ -1018,25 +1018,6 @@ TextEditor::GetTextLength(int32_t* aCount)
return NS_OK;
}
NS_IMETHODIMP
TextEditor::SetMaxTextLength(int32_t aMaxTextLength)
{
mMaxTextLength = aMaxTextLength;
return NS_OK;
}
NS_IMETHODIMP
TextEditor::GetMaxTextLength(int32_t* aMaxTextLength)
{
// NOTE: If you need to override this method, you need to make
// MaxTextLength() virtual.
if (NS_WARN_IF(!aMaxTextLength)) {
return NS_ERROR_INVALID_POINTER;
}
*aMaxTextLength = MaxTextLength();
return NS_OK;
}
NS_IMETHODIMP
TextEditor::GetWrapWidth(int32_t* aWrapColumn)
{

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

@ -173,7 +173,20 @@ public:
static void GetDefaultEditorPrefs(int32_t& aNewLineHandling,
int32_t& aCaretStyle);
/**
* The maximum number of characters allowed.
* default: -1 (unlimited).
*/
int32_t MaxTextLength() const { return mMaxTextLength; }
void SetMaxTextLength(int32_t aLength) { mMaxTextLength = aLength; }
/**
* Replace existed string with a string.
* This is fast path to replace all string when using single line control.
*
* @ param aString the string to be set
*/
nsresult SetText(const nsAString& aString);
protected:
virtual ~TextEditor();

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

@ -64,12 +64,6 @@ interface nsIPlaintextEditor : nsISupports
*/
readonly attribute long textLength;
/**
* The maximum number of characters allowed.
* default: -1 (unlimited).
*/
attribute long maxTextLength;
/** Get and set the body wrap width.
*
* Special values:
@ -102,14 +96,6 @@ interface nsIPlaintextEditor : nsISupports
*/
void insertText(in DOMString aStringToInsert);
/**
* Replace existed string with a string.
* This is fast path to replace all string when using single line control.
*
* @ param aString the string to be set
*/
[noscript] void setText(in DOMString aString);
/**
* Insert a line break into the content model.
* The interpretation of a break is up to the implementation:

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

@ -158,8 +158,7 @@ gfxSVGGlyphsDocument::SetupPresentation()
rv = viewer->GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_SUCCESS(rv, rv);
if (!presShell->DidInitialize()) {
nsRect rect = presShell->GetPresContext()->GetVisibleArea();
rv = presShell->Initialize(rect.Width(), rect.Height());
rv = presShell->Initialize();
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -220,6 +220,9 @@ async function* generateContextsForLocale(locale, sourcesOrder, resourceIds, res
}
const MSG_CONTEXT_OPTIONS = {
// Temporarily disable bidi isolation due to Microsoft not supporting FSI/PDI.
// See bug 1439018 for details.
useIsolating: Services.prefs.getBoolPref("intl.l10n.enable-bidi-marks", false),
functions: {
/**
* PLATFORM is a built-in allowing localizers to differentiate message

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

@ -1730,7 +1730,7 @@ private:
};
nsresult
PresShell::Initialize(nscoord aWidth, nscoord aHeight)
PresShell::Initialize()
{
if (mIsDestroying) {
return NS_OK;
@ -1764,11 +1764,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
}
#endif
// XXX Do a full invalidate at the beginning so that invalidates along
// the way don't have region accumulation issues?
mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
// Get the root frame from the frame manager
// XXXbz it would be nice to move this somewhere else... like frame manager
// Init(), say. But we need to make sure our views are all set up by the
@ -9772,8 +9767,7 @@ PresShell::VerifyIncrementalReflow()
// Make the new presentation context the same size as our
// presentation context.
nsRect r = mPresContext->GetVisibleArea();
cx->SetVisibleArea(r);
cx->SetVisibleArea(mPresContext->GetVisibleArea());
// Create a new presentation shell to view the document. Use the
// exact same style information that this document has.
@ -9804,7 +9798,7 @@ PresShell::VerifyIncrementalReflow()
vm->SetPresShell(sh);
{
nsAutoCauseReflowNotifier crNotifier(this);
sh->Initialize(r.width, r.height);
sh->Initialize();
}
mDocument->BindingManager()->ProcessAttachedQueue();
sh->FlushPendingNotifications(FlushType::Layout);

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

@ -108,7 +108,7 @@ public:
int16_t aFlags) override;
NS_IMETHOD RepaintSelection(RawSelectionType aRawSelectionType) override;
virtual nsresult Initialize(nscoord aWidth, nscoord aHeight) override;
virtual nsresult Initialize() override;
virtual nsresult ResizeReflow(nscoord aWidth, nscoord aHeight,
nscoord aOldWidth = 0, nscoord aOldHeight = 0,
ResizeReflowOptions aOptions =

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

@ -656,6 +656,11 @@ UpdateOneAdditionalStyleContext(nsIFrame* aFrame,
}
if (childHint) {
if (childHint & nsChangeHint_ReconstructFrame) {
// If we generate a reconstruct here, remove any non-reconstruct hints we
// may have already generated for this content.
aRestyleState.ChangeList().PopChangesForContent(aFrame->GetContent());
}
aRestyleState.ChangeList().AppendChange(
aFrame, aFrame->GetContent(), childHint);
}

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

@ -720,6 +720,7 @@ nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow)
nscoord height = p2a * mBounds.height;
mViewManager->SetWindowDimensions(width, height);
mPresContext->SetVisibleArea(nsRect(0, 0, width, height));
mPresContext->SetTextZoom(mTextZoom);
mPresContext->SetFullZoom(mPageZoom);
mPresContext->SetOverrideDPPX(mOverrideDPPX);
@ -731,11 +732,7 @@ nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow)
if (aDoInitialReflow) {
nsCOMPtr<nsIPresShell> shell = mPresShell;
// Initial reflow
shell->Initialize(width, height);
} else {
// Store the visible area so it's available for other callers of
// Initialize, like nsContentSink::StartLayout.
mPresContext->SetVisibleArea(nsRect(0, 0, width, height));
shell->Initialize();
}
// now register ourselves as a selection listener, so that we get

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

@ -354,16 +354,13 @@ public:
/**
* Perform initialization. Constructs the frame for the root content
* object and then enqueues a reflow of the frame model into the
* specified width and height.
*
* The coordinates for aWidth and aHeight must be in standard nscoords.
* object and then enqueues a reflow of the frame model.
*
* Callers of this method must hold a reference to this shell that
* is guaranteed to survive through arbitrary script execution.
* Calling Initialize can execute arbitrary script.
*/
virtual nsresult Initialize(nscoord aWidth, nscoord aHeight) = 0;
virtual nsresult Initialize() = 0;
enum class ResizeReflowOptions : uint32_t {
// the resulting BSize should be exactly as given

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

@ -42,7 +42,7 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChange
(aHint & nsChangeHint_NeedReflow),
"Reflow hint bits set without actually asking for a reflow");
if (aContent && (aHint & nsChangeHint_ReconstructFrame)) {
if (aHint & nsChangeHint_ReconstructFrame) {
// If Servo fires reconstruct at a node, it is the only change hint fired at
// that node.
if (IsServo()) {
@ -51,6 +51,7 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChange
// will not find bugs where we add a non-reconstruct hint for an element after
// adding a reconstruct. This is ok though, since ProcessRestyledFrames will
// handle that case via mDestroyedFrames.
#ifdef DEBUG
for (size_t i = 0; i < Length(); ++i) {
MOZ_ASSERT(aContent != (*this)[i].mContent ||
!((*this)[i].mHint & nsChangeHint_ReconstructFrame),
@ -58,6 +59,7 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChange
appending a ReconstructFrame hint for the same \
content.");
}
#endif
} else {
// Filter out all other changes for same content for Gecko (Servo asserts against this
// case above).

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

@ -50,12 +50,8 @@ public:
// empty or an element with |mContent != aContent| is found.
void PopChangesForContent(nsIContent* aContent)
{
while (Length() > 0) {
if (LastElement().mContent == aContent) {
RemoveElementAt(Length() - 1);
} else {
break;
}
while (!IsEmpty() && LastElement().mContent == aContent) {
RemoveElementAt(Length() - 1);
}
}

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

@ -2388,6 +2388,7 @@ nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO)
aPO->mPresShell->BeginObservingDocument();
aPO->mPresContext->SetPageSize(adjSize);
aPO->mPresContext->SetVisibleArea(nsRect(0, 0, adjSize.width, adjSize.height));
aPO->mPresContext->SetIsRootPaginatedDocument(documentIsTopLevel);
aPO->mPresContext->SetPageScale(aPO->mZoomRatio);
// Calculate scale factor from printer to screen
@ -2401,7 +2402,7 @@ nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO)
aPO->mPresShell);
}
rv = aPO->mPresShell->Initialize(adjSize.width, adjSize.height);
rv = aPO->mPresShell->Initialize();
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(aPO->mPresShell, "Presshell should still be here");

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

@ -689,8 +689,7 @@ SERVO_BINDING_FUNC(Servo_ResolveStyleLazily, ServoStyleContextStrong,
mozilla::CSSPseudoElementType pseudo_type,
mozilla::StyleRuleInclusion rule_inclusion,
const mozilla::ServoElementSnapshotTable* snapshots,
RawServoStyleSetBorrowed set,
bool ignore_existing_styles)
RawServoStyleSetBorrowed set)
// Reparents style to the new parents.
SERVO_BINDING_FUNC(Servo_ReparentStyle, ServoStyleContextStrong,

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

@ -1399,8 +1399,7 @@ ServoStyleSet::ResolveStyleLazilyInternal(Element* aElement,
pseudoTypeForStyleResolution,
aRuleInclusion,
&Snapshots(),
mRawSet.get(),
/* aIgnoreExistingStyles = */ false).Consume();
mRawSet.get()).Consume();
if (GetPresContext()->EffectCompositor()->PreTraverse(aElement, aPseudoType)) {
computedValues =
@ -1408,8 +1407,7 @@ ServoStyleSet::ResolveStyleLazilyInternal(Element* aElement,
pseudoTypeForStyleResolution,
aRuleInclusion,
&Snapshots(),
mRawSet.get(),
/* aIgnoreExistingStyles = */ false).Consume();
mRawSet.get()).Consume();
}
MOZ_DIAGNOSTIC_ASSERT(computedValues->PresContext() == GetPresContext() ||

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

@ -0,0 +1,10 @@
<script>
o1 = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mfenced")
document.documentElement.appendChild(o1);
o3 = document.createElementNS("http://www.w3.org/1999/xhtml", "style");
o3.appendChild(document.createTextNode("[s=\"\"]{"));
(document.head || document.children[0]).appendChild(o3);
o4 = o3.sheet;
window.scrollBy(0.41979783887602806, 16);
o4.insertRule("::-moz-math-anonymous,g{scroll-behavior:smooth", 1);
</script>

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

@ -267,3 +267,4 @@ load 1418059.html
skip-if(!stylo) test-pref(dom.animations-api.core.enabled,true) load 1418867.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1419554.html
load 1426312.html
load 1439793.html

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

@ -111,7 +111,7 @@ pub struct Line {
/// For example, for the HTML below...
///
/// ~~~html
/// <div><span>I <span>like truffles, <img></span></div>
/// <div><span>I like truffles, <img></span></div>
/// ~~~
///
/// ...the bounds would be:
@ -1449,7 +1449,7 @@ impl Flow for InlineFlow {
}
/// Calculate and set the block-size of this flow. See CSS 2.1 § 10.6.1.
/// Note that we do not need to do in-order traversal becase the children
/// Note that we do not need to do in-order traversal because the children
/// are always block formatting context.
fn assign_block_size(&mut self, layout_context: &LayoutContext) {
let _scope = layout_debug_scope!("inline::assign_block_size {:x}",

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

@ -693,7 +693,7 @@ pub fn process_resolved_style_request<'a, N>(context: &LayoutContext,
thread_local: &mut tlc,
};
let styles = resolve_style(&mut context, element, RuleInclusion::All, false, pseudo.as_ref());
let styles = resolve_style(&mut context, element, RuleInclusion::All, pseudo.as_ref());
let style = styles.primary();
let longhand_id = match *property {
PropertyId::LonghandAlias(id, _) |

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

@ -3200,7 +3200,6 @@ extern "C" {
rule_inclusion: StyleRuleInclusion,
snapshots: *const ServoElementSnapshotTable,
set: RawServoStyleSetBorrowed,
ignore_existing_styles: bool,
) -> ServoStyleContextStrong;
}
extern "C" {

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

@ -761,20 +761,46 @@ impl PropertyDeclarationBlock {
///
/// https://drafts.csswg.org/cssom/#serialize-a-css-declaration-block
pub fn to_css(&self, dest: &mut CssStringWriter) -> fmt::Result {
use std::iter::Cloned;
use std::slice;
let mut is_first_serialization = true; // trailing serializations should have a prepended space
// Step 1 -> dest = result list
// Step 2
let mut already_serialized = PropertyDeclarationIdSet::new();
//
// NOTE(emilio): We reuse this set for both longhands and shorthands
// with subtly different meaning. For longhands, only longhands that
// have actually been serialized (either by themselves, or as part of a
// shorthand) appear here. For shorthands, all the shorthands that we've
// attempted to serialize appear here.
let mut already_serialized = NonCustomPropertyIdSet::new();
// Step 3
for (declaration, importance) in self.declaration_importance_iter() {
// Step 3.1
let property = declaration.id();
let longhand_id = match property {
PropertyDeclarationId::Longhand(id) => id,
PropertyDeclarationId::Custom(..) => {
// Given the invariants that there are no duplicate
// properties in a declaration block, and that custom
// properties can't be part of a shorthand, we can just care
// about them here.
append_serialization::<Cloned<slice::Iter<_>>, _>(
dest,
&property,
AppendableValue::Declaration(declaration),
importance,
&mut is_first_serialization,
)?;
continue;
}
};
// Step 3.2
if already_serialized.contains(property) {
if already_serialized.contains(longhand_id.into()) {
continue;
}
@ -783,7 +809,13 @@ impl PropertyDeclarationBlock {
// iterating below.
// Step 3.3.2
for &shorthand in declaration.shorthands() {
for &shorthand in longhand_id.shorthands() {
// We already attempted to serialize this shorthand before.
if already_serialized.contains(shorthand.into()) {
continue;
}
already_serialized.insert(shorthand.into());
// Substep 2 & 3
let mut current_longhands = SmallVec::<[_; 10]>::new();
let mut important_count = 0;
@ -792,8 +824,19 @@ impl PropertyDeclarationBlock {
let is_system_font =
shorthand == ShorthandId::Font &&
self.declarations.iter().any(|l| {
!already_serialized.contains(l.id()) &&
l.get_system().is_some()
match l.id() {
PropertyDeclarationId::Longhand(id) => {
if already_serialized.contains(id.into()) {
return false;
}
l.get_system().is_some()
}
PropertyDeclarationId::Custom(..) => {
debug_assert!(l.get_system().is_none());
false
}
}
});
if is_system_font {
@ -885,7 +928,7 @@ impl PropertyDeclarationBlock {
};
// Substeps 7 and 8
append_serialization::<Cloned<slice::Iter< _>>, _>(
append_serialization::<Cloned<slice::Iter<_>>, _>(
dest,
&shorthand,
value,
@ -894,8 +937,13 @@ impl PropertyDeclarationBlock {
)?;
for current_longhand in &current_longhands {
let longhand_id = match current_longhand.id() {
PropertyDeclarationId::Longhand(id) => id,
PropertyDeclarationId::Custom(..) => unreachable!(),
};
// Substep 9
already_serialized.insert(current_longhand.id());
already_serialized.insert(longhand_id.into());
}
// FIXME(https://github.com/w3c/csswg-drafts/issues/1774)
@ -907,13 +955,10 @@ impl PropertyDeclarationBlock {
}
// Step 3.3.4
if already_serialized.contains(property) {
if already_serialized.contains(longhand_id.into()) {
continue;
}
use std::iter::Cloned;
use std::slice;
// Steps 3.3.5, 3.3.6 & 3.3.7
// Need to specify an iterator type here even though its unused to work around
// "error: unable to infer enough type information about `_`;
@ -924,10 +969,11 @@ impl PropertyDeclarationBlock {
&property,
AppendableValue::Declaration(declaration),
importance,
&mut is_first_serialization)?;
&mut is_first_serialization,
)?;
// Step 3.3.8
already_serialized.insert(property);
already_serialized.insert(longhand_id.into());
}
// Step 4

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

@ -547,6 +547,20 @@ pub struct NonCustomPropertyIdSet {
}
impl NonCustomPropertyIdSet {
/// Creates an empty `NonCustomPropertyIdSet`.
pub fn new() -> Self {
Self {
storage: Default::default(),
}
}
/// Insert a non-custom-property in the set.
#[inline]
pub fn insert(&mut self, id: NonCustomPropertyId) {
let bit = id.0;
self.storage[bit / 32] |= 1 << (bit % 32);
}
/// Return whether the given property is in the set
#[inline]
pub fn contains(&self, id: NonCustomPropertyId) -> bool {
@ -688,62 +702,6 @@ impl LonghandIdSet {
}
}
/// A specialized set of PropertyDeclarationId
pub struct PropertyDeclarationIdSet {
longhands: LonghandIdSet,
// FIXME: Use a HashSet instead? This Vec is usually small, so linear scan might be ok.
custom: Vec<::custom_properties::Name>,
}
impl PropertyDeclarationIdSet {
/// Empty set
pub fn new() -> Self {
PropertyDeclarationIdSet {
longhands: LonghandIdSet::new(),
custom: Vec::new(),
}
}
/// Returns all the longhands that this set contains.
pub fn longhands(&self) -> &LonghandIdSet {
&self.longhands
}
/// Returns whether the set is empty.
#[inline]
pub fn is_empty(&self) -> bool {
self.longhands.is_empty() && self.custom.is_empty()
}
/// Clears the set.
#[inline]
pub fn clear(&mut self) {
self.longhands.clear();
self.custom.clear();
}
/// Returns whether the given ID is in the set
pub fn contains(&mut self, id: PropertyDeclarationId) -> bool {
match id {
PropertyDeclarationId::Longhand(id) => self.longhands.contains(id),
PropertyDeclarationId::Custom(name) => self.custom.contains(name),
}
}
/// Insert the given ID in the set
pub fn insert(&mut self, id: PropertyDeclarationId) {
match id {
PropertyDeclarationId::Longhand(id) => self.longhands.insert(id),
PropertyDeclarationId::Custom(name) => {
if !self.custom.contains(name) {
self.custom.push(name.clone())
}
}
}
}
}
/// An enum to represent a CSS Wide keyword.
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
pub enum CSSWideKeyword {

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

@ -300,7 +300,6 @@ pub fn resolve_style<E>(
context: &mut StyleContext<E>,
element: E,
rule_inclusion: RuleInclusion,
ignore_existing_style: bool,
pseudo: Option<&PseudoElement>,
) -> ElementStyles
where
@ -309,7 +308,6 @@ where
use style_resolver::StyleResolverForElement;
debug_assert!(rule_inclusion == RuleInclusion::DefaultOnly ||
ignore_existing_style ||
pseudo.map_or(false, |p| p.is_before_or_after()) ||
element.borrow_data().map_or(true, |d| !d.has_styles()),
"Why are we here?");
@ -321,7 +319,7 @@ where
let mut style = None;
let mut ancestor = element.traversal_parent();
while let Some(current) = ancestor {
if rule_inclusion == RuleInclusion::All && !ignore_existing_style {
if rule_inclusion == RuleInclusion::All {
if let Some(data) = current.borrow_data() {
if let Some(ancestor_style) = data.styles.get_primary() {
style = Some(ancestor_style.clone());

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

@ -3646,7 +3646,6 @@ pub extern "C" fn Servo_ResolveStyleLazily(
rule_inclusion: StyleRuleInclusion,
snapshots: *const ServoElementSnapshotTable,
raw_data: RawServoStyleSetBorrowed,
ignore_existing_styles: bool,
) -> ServoStyleContextStrong {
debug_assert!(!snapshots.is_null());
let global_style_data = &*GLOBAL_STYLE_DATA;
@ -3678,14 +3677,12 @@ pub extern "C" fn Servo_ResolveStyleLazily(
let is_before_or_after = pseudo.as_ref().map_or(false, |p| p.is_before_or_after());
// In the common case we already have the style. Check that before setting
// up all the computation machinery. (Don't use it when we're getting
// default styles or in a bfcached document (as indicated by
// ignore_existing_styles), though.)
// up all the computation machinery.
//
// Also, only probe in the ::before or ::after case, since their styles may
// not be in the `ElementData`, given they may exist but not be applicable
// to generate an actual pseudo-element (like, having a `content: none`).
if rule_inclusion == RuleInclusion::All && !ignore_existing_styles {
if rule_inclusion == RuleInclusion::All {
let styles = element.mutate_data().and_then(|d| {
if d.has_styles() {
finish(&d.styles, is_before_or_after)
@ -3714,7 +3711,6 @@ pub extern "C" fn Servo_ResolveStyleLazily(
&mut context,
element,
rule_inclusion,
ignore_existing_styles,
pseudo.as_ref()
);
@ -3797,24 +3793,23 @@ struct PropertyAndIndex {
}
struct PrioritizedPropertyIter<'a> {
properties: &'a nsTArray<PropertyValuePair>,
properties: &'a [PropertyValuePair],
sorted_property_indices: Vec<PropertyAndIndex>,
curr: usize,
}
impl<'a> PrioritizedPropertyIter<'a> {
pub fn new(properties: &'a nsTArray<PropertyValuePair>) -> PrioritizedPropertyIter {
// If we fail to convert a nsCSSPropertyID into a PropertyId we shouldn't fail outright
// but instead by treating that property as the 'all' property we make it sort last.
let all = PropertyId::Shorthand(ShorthandId::All);
fn new(properties: &'a [PropertyValuePair]) -> PrioritizedPropertyIter {
// If we fail to convert a nsCSSPropertyID into a PropertyId we
// shouldn't fail outright but instead by treating that property as the
// 'all' property we make it sort last.
let mut sorted_property_indices: Vec<PropertyAndIndex> =
properties.iter().enumerate().map(|(index, pair)| {
PropertyAndIndex {
property: PropertyId::from_nscsspropertyid(pair.mProperty)
.unwrap_or(all.clone()),
index,
}
let property =
PropertyId::from_nscsspropertyid(pair.mProperty)
.unwrap_or(PropertyId::Shorthand(ShorthandId::All));
PropertyAndIndex { property, index }
}).collect();
sorted_property_indices.sort_by(|a, b| compare_property_priority(&a.property, &b.property));

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

@ -559,22 +559,6 @@ mod shorthand_serialization {
}
}
#[test]
fn columns_should_serialize_correctly() {
use style::values::{Auto, Either};
let mut properties = Vec::new();
let width = Either::Second(Auto);
let count = Either::Second(Auto);
properties.push(PropertyDeclaration::ColumnWidth(width));
properties.push(PropertyDeclaration::ColumnCount(count));
let serialization = shorthand_properties_to_string(properties);
assert_eq!(serialization, "columns: auto auto;");
}
#[test]
fn flex_should_serialize_all_available_properties() {
use style::values::specified::{NonNegativeNumber, Percentage};

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

@ -13,7 +13,7 @@ linux64-clang-3.9:
platform: toolchains/opt
symbol: TL(clang3.9)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker-type: aws-provisioner-v1/gecko-{level}-b-linux-large
worker:
max-run-time: 7200
run:
@ -34,7 +34,7 @@ linux64-clang-4:
platform: toolchains/opt
symbol: TL(clang4)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker-type: aws-provisioner-v1/gecko-{level}-b-linux-large
worker:
max-run-time: 7200
run:
@ -55,7 +55,7 @@ linux64-clang-5:
platform: toolchains/opt
symbol: TL(clang5)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker-type: aws-provisioner-v1/gecko-{level}-b-linux-xlarge
worker:
max-run-time: 7200
run:
@ -77,7 +77,7 @@ linux64-clang-6-pre:
platform: toolchains/opt
symbol: TL(clang6p)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker-type: aws-provisioner-v1/gecko-{level}-b-linux-xlarge
worker:
max-run-time: 7200
run:
@ -127,7 +127,7 @@ linux64-clang-tidy:
platform: toolchains/opt
symbol: TL(clang-tidy)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker-type: aws-provisioner-v1/gecko-{level}-b-linux-large
worker:
max-run-time: 36000
run:

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

@ -16,7 +16,7 @@ macosx64-clang:
platform: toolchains/opt
symbol: TM(clang)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-macosx64
worker-type: aws-provisioner-v1/gecko-{level}-b-linux-large
worker:
max-run-time: 36000
env:
@ -45,7 +45,7 @@ macosx64-clang-tidy:
platform: toolchains/opt
symbol: TM(clang-tidy)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-macosx64
worker-type: aws-provisioner-v1/gecko-{level}-b-linux-large
worker:
max-run-time: 36000
env:
@ -72,7 +72,7 @@ macosx64-cctools-port:
platform: toolchains/opt
symbol: TM(cctools)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-macosx64
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
max-run-time: 36000
env:
@ -95,7 +95,7 @@ macosx64-gn:
platform: toolchains/opt
symbol: TM(gn)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-macosx64
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
max-run-time: 36000
env:

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

@ -25,6 +25,7 @@ RUN apt-get update && \
g++-multilib \
gnupg \
libucl-dev \
patch \
p7zip-full \
scons \
tar \

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

@ -7,16 +7,22 @@ from __future__ import absolute_import, print_function, unicode_literals
WORKER_TYPES = {
'aws-provisioner-v1/gecko-1-b-android': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-1-b-linux': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-1-b-linux-large': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-1-b-linux-xlarge': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-1-b-macosx64': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-1-b-win2012': ('generic-worker', 'windows'),
'aws-provisioner-v1/gecko-1-images': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-2-b-android': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-2-b-linux': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-2-b-linux-large': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-2-b-linux-xlarge': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-2-b-macosx64': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-2-b-win2012': ('generic-worker', 'windows'),
'aws-provisioner-v1/gecko-2-images': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-3-b-android': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-3-b-linux': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-3-b-linux-large': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-3-b-linux-xlarge': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-3-b-macosx64': ('docker-worker', 'linux'),
'aws-provisioner-v1/gecko-3-b-win2012': ('generic-worker', 'windows'),
'aws-provisioner-v1/gecko-3-images': ('docker-worker', 'linux'),

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

@ -12,7 +12,6 @@ config = {
"MOZ_UPDATE_CHANNEL": "%(update_channel)s",
"DIST": "%(abs_objdir)s",
"L10NBASEDIR": "../../l10n",
"MOZ_MAKE_COMPLETE_MAR": "1",
'TOOLTOOL_CACHE': os.environ.get('TOOLTOOL_CACHE'),
},
"upload_env": {

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

@ -12,7 +12,6 @@ config = {
"MOZ_UPDATE_CHANNEL": "%(update_channel)s",
"DIST": "%(abs_objdir)s",
"L10NBASEDIR": "../../l10n",
"MOZ_MAKE_COMPLETE_MAR": "1",
'TOOLTOOL_CACHE': os.environ.get('TOOLTOOL_CACHE'),
},
"upload_env": {

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

@ -12,7 +12,6 @@ config = {
"MOZ_UPDATE_CHANNEL": "%(update_channel)s",
"DIST": "%(abs_objdir)s",
"L10NBASEDIR": "../../l10n",
"MOZ_MAKE_COMPLETE_MAR": "1",
'TOOLTOOL_CACHE': os.environ.get('TOOLTOOL_CACHE'),
},
"upload_env": {

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

@ -17,7 +17,6 @@ config = {
"MOZ_UPDATE_CHANNEL": "%(update_channel)s",
"DIST": "%(abs_objdir)s",
"L10NBASEDIR": "../../l10n",
"MOZ_MAKE_COMPLETE_MAR": "1",
'TOOLTOOL_CACHE': os.environ.get('TOOLTOOL_CACHE', 'c:/builds/tooltool_cache'),
'EN_US_PACKAGE_NAME': 'target.zip',
'EN_US_PKG_INST_BASENAME': 'target.installer',

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

@ -17,7 +17,6 @@ config = {
"MOZ_UPDATE_CHANNEL": "%(update_channel)s",
"DIST": "%(abs_objdir)s",
"L10NBASEDIR": "../../l10n",
"MOZ_MAKE_COMPLETE_MAR": "1",
'TOOLTOOL_CACHE': os.environ.get('TOOLTOOL_CACHE', 'c:/builds/tooltool_cache'),
'EN_US_PACKAGE_NAME': 'target.zip',
'EN_US_PKG_INST_BASENAME': 'target.installer',

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

@ -568,6 +568,8 @@ CreateHeaderBar(WidgetNodeType aWidgetType)
return headerbar;
}
#define ICON_SCALE_VARIANTS 2
static void
LoadWidgetIconPixbuf(GtkWidget* aWidgetIcon)
{
@ -580,38 +582,55 @@ LoadWidgetIconPixbuf(GtkWidget* aWidgetIcon)
gint iconWidth, iconHeight;
gtk_icon_size_lookup(gtkIconSize, &iconWidth, &iconHeight);
/* This is available since Gtk+ 3.10 as well as GtkHeaderBar */
/* Those are available since Gtk+ 3.10 as well as GtkHeaderBar */
static auto sGtkIconThemeLookupIconForScalePtr =
(GtkIconInfo* (*)(GtkIconTheme *, const gchar *, gint, gint, GtkIconLookupFlags))
dlsym(RTLD_DEFAULT, "gtk_icon_theme_lookup_icon_for_scale");
static auto sGdkCairoSurfaceCreateFromPixbufPtr =
(cairo_surface_t * (*)(const GdkPixbuf *, int, GdkWindow *))
dlsym(RTLD_DEFAULT, "gdk_cairo_surface_create_from_pixbuf");
GtkIconInfo *gtkIconInfo =
sGtkIconThemeLookupIconForScalePtr(gtk_icon_theme_get_default(),
iconName,
iconWidth,
1, /* TODO: scale for HiDPI */
(GtkIconLookupFlags)0);
for (int scale = 1; scale < ICON_SCALE_VARIANTS+1; scale++) {
GtkIconInfo *gtkIconInfo =
sGtkIconThemeLookupIconForScalePtr(gtk_icon_theme_get_default(),
iconName,
iconWidth,
scale,
(GtkIconLookupFlags)0);
if (!gtkIconInfo) {
// We miss the icon, nothing to do here.
return;
if (!gtkIconInfo) {
// We miss the icon, nothing to do here.
return;
}
gboolean unused;
GdkPixbuf *iconPixbuf =
gtk_icon_info_load_symbolic_for_context(gtkIconInfo, style,
&unused, nullptr);
g_object_unref(G_OBJECT(gtkIconInfo));
cairo_surface_t* iconSurface =
sGdkCairoSurfaceCreateFromPixbufPtr(iconPixbuf, scale, nullptr);
g_object_unref(iconPixbuf);
nsAutoCString surfaceName;
surfaceName = nsPrintfCString("MozillaIconSurface%d", scale);
g_object_set_data_full(G_OBJECT(aWidgetIcon), surfaceName.get(),
iconSurface,
(GDestroyNotify)cairo_surface_destroy);
}
gboolean unused;
GdkPixbuf *iconPixbuf =
gtk_icon_info_load_symbolic_for_context(gtkIconInfo, style,
&unused, nullptr);
g_object_unref(G_OBJECT(gtkIconInfo));
g_object_set_data_full(G_OBJECT(aWidgetIcon), "MozillaIconPixbuf", iconPixbuf,
(GDestroyNotify)g_object_unref);
}
GdkPixbuf*
GetWidgetIconPixbuf(GtkWidget* aWidgetIcon)
cairo_surface_t*
GetWidgetIconSurface(GtkWidget* aWidgetIcon, int aScale)
{
return (GdkPixbuf*)g_object_get_data(G_OBJECT(aWidgetIcon),
"MozillaIconPixbuf");
if (aScale > ICON_SCALE_VARIANTS)
aScale = ICON_SCALE_VARIANTS;
nsAutoCString surfaceName;
surfaceName = nsPrintfCString("MozillaIconSurface%d", aScale);
return (cairo_surface_t*)
g_object_get_data(G_OBJECT(aWidgetIcon), surfaceName.get());
}
// TODO - Also return style for buttons located at Maximized toolbar.

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

@ -21,8 +21,8 @@ enum : StyleFlags {
GtkWidget*
GetWidget(WidgetNodeType aNodeType);
GdkPixbuf*
GetWidgetIconPixbuf(GtkWidget* aWidgetIcon);
cairo_surface_t*
GetWidgetIconSurface(GtkWidget* aWidgetIcon, int aScale);
/*
* Return a new style context based on aWidget, as a child of aParentStyle.

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

@ -18,6 +18,7 @@
#include "nsDebug.h"
#include <math.h>
#include <dlfcn.h>
static gboolean checkbox_check_state;
static gboolean notebook_has_tab_gap;
@ -181,6 +182,9 @@ moz_gtk_refresh()
sCheckboxMetrics.initialized = false;
sRadioMetrics.initialized = false;
sToolbarMetrics.initialized = false;
/* This will destroy all of our widgets */
ResetWidgetCache();
}
gint
@ -445,9 +449,9 @@ moz_gtk_header_bar_button_paint(cairo_t *cr, GdkRectangle* rect,
moz_gtk_button_paint(cr, rect, state, relief, widget, direction);
GtkWidget* iconWidget = gtk_bin_get_child(GTK_BIN(widget));
GdkPixbuf* pixbuf = GetWidgetIconPixbuf(iconWidget);
cairo_surface_t *surface = GetWidgetIconSurface(iconWidget, state->scale);
if (pixbuf) {
if (surface) {
GtkStyleContext* style = gtk_widget_get_style_context(iconWidget);
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
@ -457,8 +461,13 @@ moz_gtk_header_bar_button_paint(cairo_t *cr, GdkRectangle* rect,
const ToolbarButtonGTKMetrics *metrics =
GetToolbarButtonMetrics(aWidgetType);
gtk_render_icon(style, cr, pixbuf,
metrics->iconXPosition, metrics->iconYPosition);
/* This is available since Gtk+ 3.10 as well as GtkHeaderBar */
static auto sGtkRenderIconSurfacePtr =
(void (*)(GtkStyleContext *, cairo_t *, cairo_surface_t *, gdouble, gdouble))
dlsym(RTLD_DEFAULT, "gtk_render_icon_surface");
sGtkRenderIconSurfacePtr(style, cr, surface,
metrics->iconXPosition, metrics->iconYPosition);
gtk_style_context_restore(style);
}

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

@ -32,6 +32,7 @@ typedef struct {
guint8 depressed;
gint32 curpos; /* curpos and maxpos are used for scrollbars */
gint32 maxpos;
gint32 scale; /* actual widget scale */
} GtkWidgetState;
/**

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

@ -1150,6 +1150,10 @@ nsNativeThemeGTK::DrawWidgetBackground(gfxContext* aContext,
widgetRect.width/scaleFactor,
widgetRect.height/scaleFactor};
// Save actual widget scale to GtkWidgetState as we don't provide
// nsFrame to gtk3drawing routines.
state.scale = scaleFactor;
// translate everything so (0,0) is the top left of the drawingRect
gfxPoint origin = rect.TopLeft() + drawingRect.TopLeft();