Merge autoland to mozilla-central. a=merge

This commit is contained in:
arthur.iakab 2019-10-14 00:35:53 +03:00
commit c6dfda4706
25 changed files with 232 additions and 98 deletions

View File

@ -200,14 +200,14 @@ class nsDocShellLoadState final {
void SetOriginalURIString(const nsCString& aOriginalURI) {
mOriginalURIString.emplace(aOriginalURI);
}
const Maybe<nsCString>& GetOriginalURIString() const {
const mozilla::Maybe<nsCString>& GetOriginalURIString() const {
return mOriginalURIString;
}
void SetCancelContentJSEpoch(int32_t aCancelEpoch) {
mCancelContentJSEpoch.emplace(aCancelEpoch);
}
const Maybe<int32_t>& GetCancelContentJSEpoch() const {
const mozilla::Maybe<int32_t>& GetCancelContentJSEpoch() const {
return mCancelContentJSEpoch;
}
@ -361,11 +361,11 @@ class nsDocShellLoadState final {
// An optional string representation of mURI, before any
// fixups were applied, so that we can send it to a search
// engine service if needed.
Maybe<nsCString> mOriginalURIString;
mozilla::Maybe<nsCString> mOriginalURIString;
// An optional value to pass to nsIDocShell::setCancelJSEpoch
// when initiating the load.
Maybe<int32_t> mCancelContentJSEpoch;
mozilla::Maybe<int32_t> mCancelContentJSEpoch;
};
#endif /* nsDocShellLoadState_h__ */

View File

@ -539,6 +539,16 @@ nsDOMTokenList* Element::ClassList() {
return slots->mClassList;
}
nsDOMTokenList* Element::Part() {
Element::nsDOMSlots* slots = DOMSlots();
if (!slots->mPart) {
slots->mPart = new nsDOMTokenList(this, nsGkAtoms::part);
}
return slots->mPart;
}
void Element::GetAttributeNames(nsTArray<nsString>& aResult) {
uint32_t count = mAttrs.AttrCount();
for (uint32_t i = 0; i < count; ++i) {
@ -890,7 +900,7 @@ nsRect Element::GetClientAreaRect() {
// The display check is OK even though we're not looking at the style
// frame, because the style frame only differs from "frame" for tables,
// and table wrappers have the same display as the table itself.
(frame->StyleDisplay()->mDisplay != StyleDisplay::Inline ||
(!frame->StyleDisplay()->IsInlineFlow() ||
frame->IsFrameOfType(nsIFrame::eReplaced))) {
// Special case code to make client area work even when there isn't
// a scroll view, see bug 180552, bug 227567.

View File

@ -1030,6 +1030,8 @@ class Element : public FragmentOrElement {
}
nsDOMTokenList* ClassList();
nsDOMTokenList* Part();
nsDOMAttributeMap* Attributes() {
nsDOMSlots* slots = DOMSlots();
if (!slots->mAttributeMap) {

View File

@ -597,6 +597,9 @@ void FragmentOrElement::nsDOMSlots::Traverse(
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mSlots->mClassList");
aCb.NoteXPCOMChild(mClassList.get());
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mSlots->mPart");
aCb.NoteXPCOMChild(mPart.get());
}
void FragmentOrElement::nsDOMSlots::Unlink() {
@ -608,6 +611,7 @@ void FragmentOrElement::nsDOMSlots::Unlink() {
}
mChildrenList = nullptr;
mClassList = nullptr;
mPart = nullptr;
}
size_t FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(

View File

@ -247,6 +247,11 @@ class FragmentOrElement : public nsIContent {
* An object implementing the .classList property for this element.
*/
RefPtr<nsDOMTokenList> mClassList;
/**
* An object implementing the .part property for this element.
*/
RefPtr<nsDOMTokenList> mPart;
};
/**

View File

@ -33,6 +33,10 @@ interface Element : Node {
[Constant, PutForwards=value]
readonly attribute DOMTokenList classList;
// https://drafts.csswg.org/css-shadow-parts/#idl
[SameObject, PutForwards=value, Pref="layout.css.shadow-parts.enabled"]
readonly attribute DOMTokenList part;
[SameObject]
readonly attribute NamedNodeMap attributes;
[Pure]

View File

@ -684,17 +684,26 @@ static bool IsBreakElement(nsINode* aNode) {
}
dom::Element* element = aNode->AsElement();
if (element->IsHTMLElement(nsGkAtoms::br)) return true;
if (element->IsHTMLElement(nsGkAtoms::br)) {
return true;
}
// If we don't have a frame, we don't consider ourselves a break
// element. In particular, words can span us.
if (!element->GetPrimaryFrame()) return false;
nsIFrame* frame = element->GetPrimaryFrame();
if (!frame) {
return false;
}
auto* disp = frame->StyleDisplay();
// Anything that's not an inline element is a break element.
// XXXbz should replaced inlines be break elements, though?
return element->GetPrimaryFrame()->StyleDisplay()->mDisplay !=
StyleDisplay::Inline;
// Also should inline-block and such be break elements?
//
// FIXME(emilio): We should teach the spell checker to deal with generated
// content (it doesn't at all), then remove the IsListItem() check, as there
// could be no marker, etc...
return !disp->IsInlineFlow() || disp->IsListItem();
}
struct CheckLeavingBreakElementClosure {

View File

@ -66,7 +66,7 @@ static already_AddRefed<dom::Element> ElementFromPoint(
static bool ShouldZoomToElement(const nsCOMPtr<dom::Element>& aElement) {
if (nsIFrame* frame = aElement->GetPrimaryFrame()) {
if (frame->GetDisplay() == StyleDisplay::Inline) {
if (frame->StyleDisplay()->IsInlineFlow()) {
return false;
}
}

View File

@ -5656,7 +5656,7 @@ void nsCSSFrameConstructor::AddFrameConstructionItemsInternal(
// pseudos.
((bits & FCDATA_IS_TABLE_PART) &&
(!aParentFrame || // No aParentFrame means inline
aParentFrame->StyleDisplay()->mDisplay == StyleDisplay::Inline)) ||
aParentFrame->StyleDisplay()->IsInlineFlow())) ||
// Things that are inline-outside but aren't inline frames are inline
display.IsInlineOutsideStyle() ||
// Popups that are certainly out of flow.

View File

@ -3176,6 +3176,12 @@ nsresult nsDocumentViewer::GetContentSizeInternal(int32_t* aWidth,
prefWidth = aMaxWidth;
}
// We should never intentionally get here with this sentinel value, but it's
// possible that a document with huge sizes might inadvertently have a
// prefWidth that exactly matches NS_UNCONSTRAINEDSIZE.
// Just bail if that happens.
NS_ENSURE_TRUE(prefWidth != NS_UNCONSTRAINEDSIZE, NS_ERROR_FAILURE);
nsresult rv = presShell->ResizeReflow(prefWidth, aMaxHeight,
ResizeReflowOptions::BSizeLimit);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -1328,7 +1328,7 @@ void ReflowInput::CalculateHypotheticalPosition(
// the element had been in the flow
nscoord boxISize;
bool knowBoxISize = false;
if ((StyleDisplay::Inline == mStyleDisplay->mOriginalDisplay) &&
if (mStyleDisplay->IsOriginalDisplayInlineOutside() &&
!NS_FRAME_IS_REPLACED(mFrameType)) {
// For non-replaced inline-level elements the 'inline size' property
// doesn't apply, so we don't know what the inline size would have

View File

@ -546,8 +546,7 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame,
nsIContent* content = aFrame->GetContent();
LayoutFrameType frameType = aFrame->Type();
bool isInline =
(nsStyleDisplay::DisplayInside(aFrame->GetDisplay()) ==
StyleDisplayInside::Inline ||
(nsStyleDisplay::IsInlineFlow(aFrame->GetDisplay()) ||
RubyUtils::IsRubyBox(frameType) ||
(aFrame->IsFloating() && frameType == LayoutFrameType::Letter) ||
// Given multiple frames for the same node, only the
@ -5317,8 +5316,7 @@ static nsIFrame::ContentOffsets OffsetsForSingleFrame(nsIFrame* aFrame,
// Figure out whether the offsets should be over, after, or before the frame
nsRect rect(nsPoint(0, 0), aFrame->GetSize());
bool isBlock = nsStyleDisplay::DisplayInside(aFrame->GetDisplay()) !=
StyleDisplayInside::Inline;
bool isBlock = !aFrame->StyleDisplay()->IsInlineFlow();
bool isRtl =
(aFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL);
if ((isBlock && rect.y < aPoint.y) ||

View File

@ -710,8 +710,9 @@ static bool IsPercentageAware(const nsIFrame* aFrame, WritingMode aWM) {
// We need to check for frames that shrink-wrap when they're auto
// width.
const nsStyleDisplay* disp = aFrame->StyleDisplay();
if (disp->mDisplay == StyleDisplay::InlineBlock ||
disp->mDisplay == StyleDisplay::InlineTable ||
if ((disp->DisplayOutside() == StyleDisplayOutside::Inline &&
(disp->DisplayInside() == StyleDisplayInside::FlowRoot ||
disp->DisplayInside() == StyleDisplayInside::Table)) ||
fType == LayoutFrameType::HTMLButtonControl ||
fType == LayoutFrameType::GfxButtonControl ||
fType == LayoutFrameType::FieldSet ||

View File

@ -0,0 +1,102 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: abs pos static position (ancestor of grid container as abs.pos. CB)</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151243">
<link rel="help" href="http://dev.w3.org/csswg/css-grid/#static-position">
<link rel="match" href="grid-abspos-items-015-ref.html">
<style type="text/css">
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
separator { clear:both; display:block; height:6px; }
.grid {
display: grid;
padding: 1px 3px 5px 7px;
grid-template: 25px 33px 7px / 30px 51px 5px;
margin-right: 4px;
height: 100px;
width: 100px;
}
.wrap {
position: relative;
float: left;
padding: 3px 5px 7px 9px;
border-style: solid;
border-width: 1px 3px 5px 7px;
border-block-start-color: blue;
border-inline-start-color: lime;
writing-mode: vertical-lr; direction:rtl;
}
abs1,abs2,abs3,abs4 {
grid-area: 2 / 2 / 3 / 3;
position: absolute;
/* This is the only difference with grid-abspos-items-015.html */
display: inline list-item;
list-style-type: none;
}
abs1 { top:17px; bottom:2px; background:lime; }
abs2 { right:13px; left:3px; background:pink; }
abs3 { right:5px; left:11px; top:9px; background:cyan; }
abs4 { top:23px; bottom:1px; background:silver; }
abs1::before { content:"1";}
abs2::before { content:"2";}
abs3::before { content:"3";}
abs4::before { content:"4";}
x {
grid-area: 2 / 2 / 3 / 3;
}
y {
grid-area: 3 / 3;
display: block;
}
z {
grid-area: 1 / 3;
display: block;
}
.hl { writing-mode: horizontal-tb; direction:ltr; }
.hr { writing-mode: horizontal-tb; direction:rtl; }
.vl { writing-mode: vertical-lr; }
.vr { writing-mode: vertical-rl; }
.vlr { writing-mode: vertical-lr; direction:rtl; }
.vrl { writing-mode: vertical-rl; direction:ltr; }
</style>
</head>
<body>
<script>
document.body.style.display="none";
var wm = [ "hl", "hr", "vl", "vr", "vlr", "vrl" ];
for (var i = 0; i < wm.length; ++i) {
for (var j = 0; j < wm.length; ++j) {
var div = document.createElement("div");
div.className = "grid " + wm[i];
div.appendChild(document.createTextNode("A"));
div.appendChild(document.createElement("abs1"));
div.appendChild(document.createTextNode("BC"));
div.appendChild(y = document.createElement("y"));
y.appendChild(document.createElement("abs3"));
div.appendChild(z = document.createElement("z"));
z.appendChild(document.createElement("abs4"));
var wrap = document.createElement("div");
wrap.className = "wrap ";
wrap.appendChild(div);
document.body.appendChild(wrap)
}
document.body.appendChild(document.createElement("separator"));
}
document.body.style.display="";
</script>
</body>
</html>

View File

@ -30,6 +30,7 @@ fuzzy(0-180,0-3) == grid-abspos-items-002.html grid-abspos-items-002-ref.html #
== grid-abspos-items-013.html grid-abspos-items-013-ref.html
== grid-abspos-items-014.html grid-abspos-items-014-ref.html
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == grid-abspos-items-015.html grid-abspos-items-015-ref.html # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == grid-abspos-items-016.html grid-abspos-items-015-ref.html # Bug 1392106
== grid-order-abspos-items-001.html grid-order-abspos-items-001-ref.html
== grid-order-placement-auto-001.html grid-order-placement-auto-001-ref.html
fuzzy-if(skiaContent,0-1,0-200) == grid-order-placement-definite-001.html grid-order-placement-definite-001-ref.html

View File

@ -854,8 +854,7 @@ static nsIFrame* StyleFrame(nsIFrame* aOuterFrame) {
static bool IsNonReplacedInline(nsIFrame* aFrame) {
// FIXME: this should be IsInlineInsideStyle() since width/height
// doesn't apply to ruby boxes.
return aFrame->StyleDisplay()->DisplayInside() ==
StyleDisplayInside::Inline &&
return aFrame->StyleDisplay()->IsInlineFlow() &&
!aFrame->IsFrameOfType(nsIFrame::eReplaced);
}

View File

@ -40,8 +40,6 @@ enum class StyleDisplay : uint16_t {
StyleDisplayFrom(StyleDisplayOutside::None, StyleDisplayInside::Contents),
Inline =
StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::Inline),
InlineBlock = StyleDisplayFrom(StyleDisplayOutside::Inline,
StyleDisplayInside::FlowRoot),
Block =
StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::Block),
FlowRoot = StyleDisplayFrom(StyleDisplayOutside::Block,

View File

@ -1630,6 +1630,15 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
}
bool IsListItem() const { return IsListItem(mDisplay); }
// Whether display is `inline` or `inline list-item`.
static bool IsInlineFlow(mozilla::StyleDisplay aDisplay) {
return DisplayInside(aDisplay) == mozilla::StyleDisplayInside::Inline;
}
bool IsInlineFlow() const {
return IsInlineFlow(mDisplay);
}
bool IsInlineInsideStyle() const {
auto inside = DisplayInside();
return inside == mozilla::StyleDisplayInside::Inline ||

View File

@ -33,29 +33,8 @@
* style system code, and property cascading no longer relies on hand
* written functions, so this particular failure mode isn't as likely to
* happen.
*
* The test works by maintaining one style rule that has every CSS
* property specified, and a second style rule that has different values
* for every property, an element that matches only the first rule (so
* that we'll have a cached struct), and *later* an element that matches
* both rules (for whose computation we'll find the struct cached from
* the first element). (It does this twice, once with the overriding in
* each direction, because one of the cases might match the incorrect
* overwriting.) Then, in the second style rule, it unsets each
* property, one at a time, and checks that the computation works
* correctly. (The reason to want every property set is to hit a case
* where we can store the data in the rule tree... though this isn't
* guaranteed.)
*/
function xfail_computecheck(prop, roundnum) {
return false;
}
function xfail_test(prop, roundnum) {
return false;
}
var gStyleSheet = document.getElementById("stylesheet").sheet;
var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule("#base, #test {}", gStyleSheet.cssRules.length)];
var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#test {}", gStyleSheet.cssRules.length)];
@ -63,46 +42,44 @@ var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#test {}", gStyleSheet
var gBase = getComputedStyle(document.getElementById("base"), "");
var gTest = getComputedStyle(document.getElementById("test"), "");
function round(lower_set, higher_set, roundnum) {
function test_property(prop, lower_set, higher_set) {
var info = gCSSProperties[prop];
if (info.subproperties || info.logical)
return;
for (var prop in gCSSProperties) {
var info = gCSSProperties[prop];
if (info.subproperties || info.logical)
continue;
gRule1.style.setProperty(prop, info[lower_set][0], "");
gRule2.style.setProperty(prop, info[higher_set][0], "");
gRule1.style.setProperty(prop, info[lower_set][0]);
gRule2.style.setProperty(prop, info[higher_set][0]);
if ("prerequisites" in info) {
for (var prereq in info.prerequisites) {
gRule2.style.setProperty(prereq, info.prerequisites[prereq], "");
}
}
for (var prop in gCSSProperties) {
var info = gCSSProperties[prop];
if (info.subproperties || info.logical)
continue;
gBase.getPropertyValue(prop);
var higher_set_val = gTest.getPropertyValue(prop);
gRule2.style.setProperty(prop, info[lower_set][0], "");
var lower_set_val = gTest.getPropertyValue(prop);
isnot(higher_set_val, lower_set_val, "initial and other values of " + prop + " are different");
if ("prerequisites" in info) {
for (var prereq in info.prerequisites) {
gRule2.style.setProperty(prereq, info.prerequisites[prereq], "");
}
}
gRule2.style.removeProperty(prop);
is(gTest.getPropertyValue(prop), lower_set_val, prop + " is not touched when its value comes from aStartStruct");
gBase.getPropertyValue(prop);
var higher_set_val = gTest.getPropertyValue(prop);
gRule2.style.setProperty(prop, info[lower_set][0], "");
var lower_set_val = gTest.getPropertyValue(prop);
(xfail_computecheck(prop, roundnum) ? todo_isnot : isnot)(higher_set_val, lower_set_val, "initial and other values of " + prop + " are different");
gRule2.style.removeProperty(prop);
(xfail_test(prop, roundnum) ? todo_is : is)(gTest.getPropertyValue(prop), lower_set_val, prop + " is not touched when its value comes from aStartStruct");
gRule2.style.setProperty(prop, info[higher_set][0], "");
if ("prerequisites" in info) {
for (var prereq in info.prerequisites) {
gRule2.style.setProperty(prereq, gCSSProperties[prereq][higher_set][0], "");
}
gRule1.style.removeProperty(prop);
if ("prerequisites" in info) {
for (var prereq in info.prerequisites) {
gRule2.style.removeProperty(prereq);
}
}
}
round("other_values", "initial_values", 1);
round("initial_values", "other_values", 2);
function round(lower_set, higher_set) {
for (var prop in gCSSProperties)
test_property(prop, lower_set, higher_set);
}
round("other_values", "initial_values");
round("initial_values", "other_values");
</script>
</pre>

View File

@ -7,6 +7,7 @@ package org.mozilla.geckoview.test
import android.support.test.filters.MediumTest
import android.support.test.runner.AndroidJUnit4
import org.hamcrest.Matchers
import org.hamcrest.Matchers.equalTo
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
@ -15,13 +16,16 @@ import org.mozilla.geckoview.ContentBlockingController
import org.mozilla.geckoview.GeckoSession
import org.mozilla.geckoview.test.rule.GeckoSessionTestRule
import org.mozilla.geckoview.test.util.Callbacks
import org.junit.Assume.assumeThat
@RunWith(AndroidJUnit4::class)
@MediumTest
class ContentBlockingControllerTest : BaseSessionTest() {
@GeckoSessionTestRule.Setting(key = GeckoSessionTestRule.Setting.Key.USE_TRACKING_PROTECTION, value = "true")
// disable test on debug for frequently failing #Bug 1580223
@Test
fun trackingProtectionException() {
assumeThat(sessionRule.env.isDebugBuild, equalTo(false))
val category = ContentBlocking.AntiTracking.TEST
sessionRule.runtime.settings.contentBlocking.setAntiTracking(category)
sessionRule.session.loadTestPath(TRACKERS_PATH)

View File

@ -194,8 +194,8 @@ ALL_PROCESSES += [
# Bug 1268470 - crashes with Kaspersky Lab on Windows 8
DllBlocklistEntry("klsihk64.dll", (14, 0, 456, 0xffff), BLOCK_WIN8_ONLY),
# Bug 1407337, crashes with OpenSC < 0.16.0
DllBlocklistEntry("onepin-opensc-pkcs11.dll", (0, 15, 0xffff, 0xffff)),
# Bug 1579758, crashes with OpenSC nightly version 0.19.0.448 and lower
DllBlocklistEntry("onepin-opensc-pkcs11.dll", (0, 19, 0, 448)),
# Avecto Privilege Guard causes crashes, bug 1385542
DllBlocklistEntry("pghook.dll", ALL_VERSIONS),

View File

@ -1,4 +0,0 @@
[invalidation-change-part-name-idl-domtokenlist.html]
[Part in selected host changed color via part IDL DOMTokenList attribute.]
expected: FAIL

View File

@ -1,4 +0,0 @@
[invalidation-change-part-name-idl-setter.html]
[Part in selected host changed color via part IDL attribute setter.]
expected: FAIL

View File

@ -1,13 +0,0 @@
[part-name-idl.html]
[Access to .part returns an empty DOMTokenList.]
expected: FAIL
[Changes in DOMTokenList are refected in attribute.]
expected: FAIL
[DOMTokenList created by access is persisted.]
expected: FAIL
[Multiple names give a DOMTokenList with multiple entries.]
expected: FAIL

View File

@ -0,0 +1,26 @@
<!doctype html>
<title>client* returns the same for non-replaced inlines regardless of list-item-ness</title>
<link rel="help" href="https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1581467">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
.li {
display: inline list-item;
}
</style>
<div style="position: absolute"><span>Foo</span></div>
<div style="position: absolute"><span class="li">Foo</span></div>
<script>
test(() => {
let first = document.querySelector("span");
let second = document.querySelector(".li");
assert_equals(first.clientWidth, second.clientWidth, "clientWidth should match");
assert_equals(first.clientHeight, second.clientHeight, "clientHeight should match");
assert_equals(first.clientTop, second.clientTop, "clientTop should match");
assert_equals(first.clientLeft, second.clientLeft, "clientLeft should match");
}, "client* returns the same for non-replaced inlines regardless of list-item-ness");
</script>