Skip to content

Commit

Permalink
layout update for the further update
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedor committed Jan 7, 2024
1 parent af8ad28 commit b179cc2
Show file tree
Hide file tree
Showing 7,578 changed files with 71,793 additions and 41,425 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion accessible/base/SelectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ void SelectionManager::ProcessSelectionChanged(SelData* aSelData) {

const nsRange* range = selection->GetAnchorFocusRange();
nsINode* cntrNode = nullptr;
if (range) cntrNode = range->GetCommonAncestor();
if (range) {
cntrNode = range->GetClosestCommonInclusiveAncestor();
}

if (!cntrNode) {
cntrNode = selection->GetFrameSelection()->GetAncestorLimiter();
Expand Down
5 changes: 3 additions & 2 deletions accessible/base/StyleInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void StyleInfo::TextIndent(nsAString& aValue) {

const auto& textIndent = mComputedStyle->StyleText()->mTextIndent;
if (textIndent.ConvertsToLength()) {
aValue.AppendFloat(textIndent.LengthInCSSPixels());
aValue.AppendFloat(textIndent.ToLengthInCSSPixels());
aValue.AppendLiteral("px");
return;
}
Expand All @@ -44,7 +44,8 @@ void StyleInfo::TextIndent(nsAString& aValue) {
aValue.AppendLiteral("%");
return;
}
// FIXME: This doesn't handle calc in any meaningful way?
// FIXME: This doesn't handle calc in any meaningful way? Probably should just
// use the Servo serialization code...
aValue.AppendLiteral("0px");
}

Expand Down
2 changes: 1 addition & 1 deletion accessible/base/nsAccessiblePivot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ bool nsAccessiblePivot::IsDescendantOf(Accessible* aAccessible,
bool nsAccessiblePivot::MovePivotInternal(Accessible* aPosition,
PivotMoveReason aReason,
bool aIsFromUserInput) {
RefPtr<Accessible> oldPosition = mPosition.forget();
RefPtr<Accessible> oldPosition = std::move(mPosition);
mPosition = aPosition;
int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
mStartOffset = mEndOffset = -1;
Expand Down
35 changes: 29 additions & 6 deletions accessible/generic/HyperTextAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "nsCaret.h"
#include "nsContentUtils.h"
#include "nsDebug.h"
#include "nsFocusManager.h"
#include "nsIEditingSession.h"
#include "nsContainerFrame.h"
Expand All @@ -28,6 +29,7 @@
#include "nsIMathMLFrame.h"
#include "nsRange.h"
#include "nsTextFragment.h"
#include "mozilla/Assertions.h"
#include "mozilla/BinarySearch.h"
#include "mozilla/EventStates.h"
#include "mozilla/MathAlgorithms.h"
Expand Down Expand Up @@ -1510,9 +1512,15 @@ bool HyperTextAccessible::SelectionBoundsAt(int32_t aSelectionNum,

// Make sure start is before end, by swapping DOM points. This occurs when
// the user selects backwards in the text.
int32_t rangeCompare =
const Maybe<int32_t> order =
nsContentUtils::ComparePoints(endNode, endOffset, startNode, startOffset);
if (rangeCompare < 0) {

if (!order) {
MOZ_ASSERT_UNREACHABLE();
return false;
}

if (*order < 0) {
nsINode* tempNode = startNode;
startNode = endNode;
endNode = tempNode;
Expand Down Expand Up @@ -2002,18 +2010,33 @@ void HyperTextAccessible::GetSpellTextAttr(
// case there is another range after this one.
nsINode* endNode = range->GetEndContainer();
int32_t endNodeOffset = range->EndOffset();
if (nsContentUtils::ComparePoints(aNode, aNodeOffset, endNode,
endNodeOffset) >= 0)
Maybe<int32_t> order = nsContentUtils::ComparePoints(
aNode, aNodeOffset, endNode, endNodeOffset);
if (NS_WARN_IF(!order)) {
continue;
}

if (*order >= 0) {
continue;
}

// At this point our point is either in this range or before it but after
// the previous range. So we check to see if the range starts before the
// point in which case the point is in the missspelled range, otherwise it
// must be before the range and after the previous one if any.
nsINode* startNode = range->GetStartContainer();
int32_t startNodeOffset = range->StartOffset();
if (nsContentUtils::ComparePoints(startNode, startNodeOffset, aNode,
aNodeOffset) <= 0) {
order = nsContentUtils::ComparePoints(startNode, startNodeOffset, aNode,
aNodeOffset);
if (!order) {
// As (`aNode`, `aNodeOffset`) is comparable to the end of the range, it
// should also be comparable to the range's start. Returning here
// prevents crashes in release builds.
MOZ_ASSERT_UNREACHABLE();
return;
}

if (*order <= 0) {
startOffset = DOMPointToOffset(startNode, startNodeOffset);

endOffset = DOMPointToOffset(endNode, endNodeOffset);
Expand Down
4 changes: 1 addition & 3 deletions accessible/generic/TableAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ bool TableAccessible::IsProbablyLayoutTable() {
}

// Check for legitimate data table attributes.
nsAutoString summary;
if (el->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, summary) &&
!summary.IsEmpty()) {
if (el->Element::HasNonEmptyAttr(nsGkAtoms::summary)) {
RETURN_LAYOUT_ANSWER(false, "Has summary -- legitimate table structures");
}

Expand Down
2 changes: 0 additions & 2 deletions browser/actors/NetErrorChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,6 @@ class NetErrorChild extends ActorChild {
clockErrTitle.textContent;
let desc = doc.getElementById("errorShortDescText");
doc.getElementById("errorShortDesc").style.display = "block";
doc.getElementById("certificateErrorReporting").style.display =
"none";
if (desc) {
// eslint-disable-next-line no-unsanitized/property
desc.innerHTML = clockErrDesc.innerHTML;
Expand Down
6 changes: 6 additions & 0 deletions browser/app/profile/mypal.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ pref("permissions.postPrompt.animate", true);
pref("permissions.eventTelemetry.enabled", false);
#endif

#ifdef NIGHTLY_BUILD
pref("permissions.delegation.enable", true);
#else
pref("permissions.delegation.enable", false);
#endif

// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window
pref("browser.link.open_newwindow", 3);
Expand Down
40 changes: 0 additions & 40 deletions browser/base/content/aboutNetError.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ function toggleDisplay(node) {
return (node.style.display = toggle[node.style.display]);
}

function showCertificateErrorReporting() {
// Display error reporting UI
document.getElementById("certificateErrorReporting").style.display = "block";
}

function showPrefChangeContainer() {
const panel = document.getElementById("prefChangeContainer");
panel.style.display = "block";
Expand Down Expand Up @@ -270,23 +265,6 @@ function initPage() {
let shortDesc = document.getElementById("errorShortDescText")
.textContent;
document.getElementById("learnMoreContainer").style.display = "block";
var options = JSON.parse(evt.detail);
if (options && options.enabled) {
var checkbox = document.getElementById("automaticallyReportInFuture");
showCertificateErrorReporting();
if (options.automatic) {
// set the checkbox
checkbox.checked = true;
}

checkbox.addEventListener("change", function(changeEvt) {
var event = new CustomEvent("AboutNetErrorSetAutomatic", {
bubbles: true,
detail: changeEvt.target.checked,
});
document.dispatchEvent(event);
});
}
const hasPrefStyleError = [
"interrupted", // This happens with subresources that are above the max tls
"SSL_ERROR_PROTOCOL_VERSION_ALERT",
Expand Down Expand Up @@ -379,28 +357,10 @@ function initPageCertError() {

document.getElementById("learnMoreContainer").style.display = "block";

let checkbox = document.getElementById("automaticallyReportInFuture");
checkbox.addEventListener("change", function({ target: { checked } }) {
document.dispatchEvent(
new CustomEvent("AboutNetErrorSetAutomatic", {
detail: checked,
bubbles: true,
})
);
});

addEventListener(
"AboutNetErrorOptions",
function(event) {
var options = JSON.parse(event.detail);
if (options && options.enabled) {
// Display error reporting UI
document.getElementById("certificateErrorReporting").style.display =
"block";

// set the checkbox
checkbox.checked = !!options.automatic;
}
if (options && options.hideAddExceptionButton) {
document.querySelector(".exceptionDialogButtonContainer").hidden = true;
}
Expand Down
7 changes: 0 additions & 7 deletions browser/base/content/aboutNetError.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,6 @@
</div>
</div>

<div id="certificateErrorReporting">
<p class="toggle-container-with-text">
<input type="checkbox" id="automaticallyReportInFuture" role="checkbox" data-telemetry-id="auto_report_cb"/>
<label for="automaticallyReportInFuture">&errorReporting.automatic2;</label>
</p>
</div>

<div id="certificateErrorDebugInformation">
<button id="copyToClipboard" data-telemetry-id="clipboard_button_top">&certerror.copyToClipboard.label;</button>
<div id="certificateErrorText"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ add_task(async function checkTelemetryClickEvents() {
let recordedObjects = [
"advanced_button",
"learn_more_link",
"auto_report_cb",
"error_code_link",
"clipboard_button_top",
"clipboard_button_bot",
Expand Down
98 changes: 2 additions & 96 deletions browser/base/content/test/general/browser_bug839103.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ async function testBody(testRoot) {
// Now add a stylesheet on the fly and make sure we see it.
let doc = content.document;
doc.styleSheetChangeEventsEnabled = true;
doc.addEventListener("StyleSheetAdded", unexpectedContentEvent);
doc.addEventListener("StyleSheetRemoved", unexpectedContentEvent);
doc.addEventListener(
"StyleSheetApplicableStateChanged",
unexpectedContentEvent
);
doc.defaultView.addEventListener("StyleSheetAdded", unexpectedContentEvent);
doc.defaultView.addEventListener("StyleSheetRemoved", unexpectedContentEvent);
doc.defaultView.addEventListener(
"StyleSheetApplicableStateChanged",
unexpectedContentEvent
Expand All @@ -47,26 +43,15 @@ async function testBody(testRoot) {
link.setAttribute("type", "text/css");
link.setAttribute("href", testRoot + gStyleSheet);

let sheetAdded = ContentTaskUtils.waitForEvent(this, "StyleSheetAdded", true);
let stateChanged = ContentTaskUtils.waitForEvent(
this,
"StyleSheetApplicableStateChanged",
true
);
doc.body.appendChild(link);

let evt = await sheetAdded;
info("received dynamic style sheet event");
is(evt.type, "StyleSheetAdded", "evt.type has expected value");
is(evt.target, doc, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(
evt.stylesheet.toString().includes("CSSStyleSheet"),
"evt.stylesheet is a stylesheet"
);
ok(evt.documentSheet, "style sheet is a document sheet");

evt = await stateChanged;
info("waiting for applicable state change event");
let evt = await stateChanged;
info("received dynamic style sheet applicable state change event");
is(
evt.type,
Expand Down Expand Up @@ -97,84 +82,5 @@ async function testBody(testRoot) {
is(evt.stylesheet, link.sheet, "evt.stylesheet has the right value");
is(evt.applicable, false, "evt.applicable has the right value");

let sheetRemoved = ContentTaskUtils.waitForEvent(
this,
"StyleSheetRemoved",
true
);
doc.body.removeChild(link);

evt = await sheetRemoved;
info("received dynamic style sheet removal");
is(evt.type, "StyleSheetRemoved", "evt.type has expected value");
is(evt.target, doc, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(
evt.stylesheet.toString().includes("CSSStyleSheet"),
"evt.stylesheet is a stylesheet"
);
ok(
evt.stylesheet.href.includes(gStyleSheet),
"evt.stylesheet is the removed stylesheet"
);

let ruleAdded = ContentTaskUtils.waitForEvent(this, "StyleRuleAdded", true);
doc.querySelector("style").sheet.insertRule("*{color:black}", 0);

evt = await ruleAdded;
info("received style rule added event");
is(evt.type, "StyleRuleAdded", "evt.type has expected value");
is(evt.target, doc, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(
evt.stylesheet.toString().includes("CSSStyleSheet"),
"evt.stylesheet is a stylesheet"
);
ok(evt.rule, "evt.rule is defined");
is(
evt.rule.cssText,
"* { color: black; }",
"evt.rule.cssText has expected value"
);

let ruleChanged = ContentTaskUtils.waitForEvent(
this,
"StyleRuleChanged",
true
);
evt.rule.style.cssText = "color:green";

evt = await ruleChanged;
ok(true, "received style rule changed event");
is(evt.type, "StyleRuleChanged", "evt.type has expected value");
is(evt.target, doc, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(
evt.stylesheet.toString().includes("CSSStyleSheet"),
"evt.stylesheet is a stylesheet"
);
ok(evt.rule, "evt.rule is defined");
is(
evt.rule.cssText,
"* { color: green; }",
"evt.rule.cssText has expected value"
);

let ruleRemoved = ContentTaskUtils.waitForEvent(
this,
"StyleRuleRemoved",
true
);
evt.stylesheet.deleteRule(0);

evt = await ruleRemoved;
info("received style rule removed event");
is(evt.type, "StyleRuleRemoved", "evt.type has expected value");
is(evt.target, doc, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(
evt.stylesheet.toString().includes("CSSStyleSheet"),
"evt.stylesheet is a stylesheet"
);
ok(evt.rule, "evt.rule is defined");
}
16 changes: 0 additions & 16 deletions browser/base/content/test/static/browser_parsable_css.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,6 @@ if (
});
}

if (!Services.prefs.getBoolPref("full-screen-api.unprefix.enabled")) {
whitelist.push(
{
sourceName: /(?:res|gre-resources)\/(ua|html)\.css$/i,
errorMessage: /Unknown pseudo-class .*\bfullscreen\b/i,
isFromDevTools: false,
},
{
// PDFjs is futureproofing its pseudoselectors, and those rules are dropped.
sourceName: /web\/viewer\.css$/i,
errorMessage: /Unknown pseudo-class .*\bfullscreen\b/i,
isFromDevTools: false,
}
);
}

if (!Services.prefs.getBoolPref("layout.css.scrollbar-width.enabled")) {
whitelist.push({
sourceName: /(?:res|gre-resources)\/forms\.css$/i,
Expand Down
Loading

0 comments on commit b179cc2

Please sign in to comment.