mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1236750 - Introduce a new unit type CSSTransformedLayerPixel. r=kats (4e9bba3d19) - Bug 1236750 - Add a ViewAs() overload for casting (with a justification) one typed matrix to another. r=kats (c48e143508) - Bug 1236750 - Add some specialized typedefs of Matrix4x4 to represent layer transform matrices. r=kats (cc50113c98) - Bug 1239300 - reject promise with null while creating imagebitmap from empty blob; r=smaug (bff7483bf1) - Bug 1233056 - Long tapping on a link will select a different link from the page r=tnikkel (3a727b33c1) - Bug 1245674. Null-check mGlobal before dereferencing it in one more place in Promise code. r=smaug (68cf5312dc) - Bug 1236750 - Use strongly-typed matrices to represent layer transforms in APZ code. r=kats (63931eb2a1) - Bug 1236750 - Add typed getters for layer transform matrices. r=kats (baef978fe1) - Bug 1147673 - Relax the ancestor transform assertion a little. r=kats (ec9ce47ba4) - Bug 1154161 Initialize WidgetQueryContentEvent::mReply r=smaug (6086291313) - Bug 1240921 - Use nsAutoTArray in nsStyleSet::RuleNodeWithReplacement. r=bz. (66f6823b46) - Bug 1229437 part 1 - Add a helper function to get the float containing block of a given frame. r=dbaron (72de452e5d) - Bug 1229437 part 2 - Reparent floats inside pulled ruby segment. r=dbaron (82cc44632d) - Bug 1229437 part 3 - Support iterating frames of RubyColumn. r=dholbert (5d43e7f6ff) - Bug 1229437 part 4 - Reparent floats inside pulled ruby column. r=dbaron (4c1a7ff20b) - Bug 1229437 part 5 - Add crashtests for this bug. r=dbaron (6afabe1604) - Bug 1229437 followup - Fix sign-compare error in RubyColumn::Iterator on CLOSED TREE. (e93453d00a) - Bug 1229437 followup 2 - Fix another sign-compare error in RubyColumn::Iterator on CLOSED TREE. (c0bf6a2a7b) - Bug 1229437 followup 3 - Fix a mistake in RubyColumn::Iterator::SkipUntilExistingFrame(). a=me (1ce408e194) - bits of Bug 1072150 - Use the opt-out for various sloppy consumers (29d97c59ca) - Make test_bug946632 compatible with asynchronous scrolling. (bug 1140293, r=mstange) (e975a8350c) - fix misspatch of 1072150 (a3e580fa4b) - Bug 686281 - Implement nsStyleImageLayers; r=dbaron (85bb33c8e6) - Bug 686281 - Rename *background* to *imagelayer*; r=dbaron. (36d90f112d) - Bug 1230034 part 4 - Make FramePropertyDescriptor to be a template. r=froydnj,dbaron (271cd19b6e) - Bug 1230034 part 5 - Convert all frame properties which use DeleteValue and ReleaseValue as destructor to be typesafe. r=dbaron (efc8d63c9d) - Bug 1230034 part 6 - Convert all frame properties which do not hold pointer to be typed. r=dbaron (b5541775f7) - Bug 1230034 part 7 - Convert nsIFrame::GenConProperty to be typed. r=dbaron (2b71527b2c) - Bug 1230034 part 8 - Convert frame properties which assert on destructor to be typed. r=dbaron (0f125a3414) - Bug 1230034 part 9 - Convert FrameLayerBuilder::LayerManagerDataProperty to be typed. r=dbaron (1147498c2f) - Bug 1230034 part 10 - Convert remaining frame properties to by typed and remove the unsafe declaring macro. r=dbaron (d59d94eac4) - Bug 1072501: Unmap file mapping on source surface destruction. r=jrmuizel (19fd63890a) - Bug 1235613 - Make gfxCriticalError/Note strings in gfx/ unique. r=jrmuizel (780c6ff862) - Bug 1247535 - Fix -Wunreachable-code warning in mfbt/Poison.cpp. r=froydnj (0e7cf60b6d) - Bug 1239479: Add comments to mfbt/XorShift128PlusRNG.h from the RNG's designer. DONTBUILD r=Waldo (bb674b07ce) - Add an assertion message to the assert-is-empty in LinkedList::~LinkedList, to indicate to users who hit it that it's the fault of the caller, not the fault of MFBT code. No bug, rs=froydnj (4cad80874c) - Bug 1221103 - Add a comment to nsIChannel::securityInfo noting that this info may appear on non-nsHttpChannels and how that may happen. r=bz IGNORE IDL (cd9cebc3f2) - Bug 1001765 - Make login credentials in Saved Passwords manager editable. r=MattN (09eec4f6f8) - Bug 1188478 - Add an Import button to the password manager to open the browser migrator. r=dolske (d1126a89fc) - Bug 1199382 - Rename some strings from "password" to "login" in preferences and the manager. r=markh (60638f5e2a) - Bug 1207733 - Update @disabled on the Remove Password button when selection changes. r=MattN (64ac9f22f6) - bits of 1124472 and 1166840 (26e2681183) - Bug 1219707 - fix argument passing to migration.js, r=jaws (55d332f5c6) - bug 1215657 - make AccessibleWrap::get_accSelection work with proxies=davidb (4e72111032) - fix missing telemetry entry (4fcfabb3e6) and follow-up API changes of TFF#493.
This commit is contained in:
@@ -838,7 +838,17 @@ AccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren)
|
||||
|
||||
if (IsSelect()) {
|
||||
nsAutoTArray<Accessible*, 10> selectedItems;
|
||||
SelectedItems(&selectedItems);
|
||||
if (IsProxy()) {
|
||||
nsTArray<ProxyAccessible*> proxies;
|
||||
Proxy()->SelectedItems(&proxies);
|
||||
|
||||
uint32_t selectedCount = proxies.Length();
|
||||
for (uint32_t i = 0; i < selectedCount; i++) {
|
||||
selectedItems.AppendElement(WrapperFor(proxies[i]));
|
||||
}
|
||||
} else {
|
||||
SelectedItems(&selectedItems);
|
||||
}
|
||||
|
||||
// 1) Create and initialize the enumeration
|
||||
RefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems);
|
||||
|
||||
@@ -93,11 +93,11 @@
|
||||
|
||||
<!-- Passwords -->
|
||||
<groupbox id="passwordsGroup" orient="vertical">
|
||||
<caption label="&passwords.label;"/>
|
||||
<caption label="&logins.label;"/>
|
||||
|
||||
<hbox id="savePasswordsBox">
|
||||
<checkbox id="savePasswords" flex="1"
|
||||
label="&rememberPasswords.label;" accesskey="&rememberPasswords.accesskey;"
|
||||
label="&rememberLogins.label;" accesskey="&rememberLogins.accesskey;"
|
||||
preference="signon.rememberSignons"
|
||||
onsyncfrompreference="return gSecurityPane.readSavePasswords();"/>
|
||||
<button id="passwordExceptions"
|
||||
@@ -123,7 +123,7 @@
|
||||
<hbox id="showPasswordsBox">
|
||||
<spacer flex="1"/>
|
||||
<button id="showPasswords"
|
||||
label="&savedPasswords.label;" accesskey="&savedPasswords.accesskey;"
|
||||
label="&savedLogins.label;" accesskey="&savedLogins.accesskey;"
|
||||
oncommand="gSecurityPane.showPasswords();"
|
||||
preference="pref.privacy.disable_button.view_passwords"/>
|
||||
</hbox>
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
<!ENTITY addonSecurityLevel_High "Medium: Block all harmful add-ons (default, recommended)">
|
||||
<!ENTITY addonSecurityLevel_Extreme "High: Block all add-ons with known issues">
|
||||
|
||||
<!ENTITY passwords.label "Passwords">
|
||||
<!ENTITY logins.label "Logins">
|
||||
|
||||
<!ENTITY rememberPasswords.label "Remember passwords for sites">
|
||||
<!ENTITY rememberPasswords.accesskey "R">
|
||||
<!ENTITY rememberLogins.label "Remember logins for sites">
|
||||
<!ENTITY rememberLogins.accesskey "R">
|
||||
<!ENTITY passwordExceptions.label "Exceptions…">
|
||||
<!ENTITY passwordExceptions.accesskey "x">
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
<!ENTITY changeMasterPassword.label "Change Master Password…">
|
||||
<!ENTITY changeMasterPassword.accesskey "M">
|
||||
|
||||
<!ENTITY savedPasswords.label "Saved Passwords…">
|
||||
<!ENTITY savedPasswords.accesskey "P">
|
||||
<!ENTITY savedLogins.label "Saved Logins…">
|
||||
<!ENTITY savedLogins.accesskey "L">
|
||||
|
||||
<!ENTITY SecProto.label "Security Protocols">
|
||||
<!ENTITY enableHSTS.label "Enable Strict Transport Security (HSTS)">
|
||||
|
||||
@@ -7710,7 +7710,7 @@ nsContentUtils::ToWidgetPoint(const CSSPoint& aPoint,
|
||||
{
|
||||
return LayoutDeviceIntPoint::FromAppUnitsRounded(
|
||||
(CSSPoint::ToAppUnits(aPoint) +
|
||||
aOffset).ApplyResolution(aPresContext->PresShell()->GetCumulativeNonRootScaleResolution()),
|
||||
aOffset).ApplyResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(aPresContext->PresShell())),
|
||||
aPresContext->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
|
||||
@@ -481,7 +481,7 @@ nsDOMWindowUtils::SetDisplayPortBaseForElement(int32_t aX,
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetResolution(float aResolution)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ nsDOMWindowUtils::GetIsResolutionSet(bool* aIsResolutionSet) {
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetIsFirstPaint(bool aIsFirstPaint)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
@@ -557,7 +557,7 @@ nsDOMWindowUtils::SetIsFirstPaint(bool aIsFirstPaint)
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetIsFirstPaint(bool *aIsFirstPaint)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
@@ -2443,8 +2443,10 @@ nsDOMWindowUtils::RestoreNormalRefresh()
|
||||
transaction->SendLeaveTestMode();
|
||||
}
|
||||
|
||||
nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
|
||||
driver->RestoreNormalRefresh();
|
||||
if (nsPresContext* pc = GetPresContext()) {
|
||||
nsRefreshDriver* driver = pc->RefreshDriver();
|
||||
driver->RestoreNormalRefresh();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -2944,7 +2946,7 @@ nsDOMWindowUtils::EnableDialogs()
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::DisableDialogs()
|
||||
{
|
||||
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
@@ -2958,7 +2960,7 @@ nsDOMWindowUtils::DisableDialogs()
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::AreDialogsEnabled(bool* aResult)
|
||||
{
|
||||
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
@@ -3691,7 +3693,7 @@ NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetHandlingUserInput(bool aHandlingUserInput,
|
||||
nsIJSRAIIHelper** aHelper)
|
||||
{
|
||||
if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
|
||||
@@ -1065,7 +1065,7 @@ private:
|
||||
RefPtr<layers::Image> data = DecodeAndCropBlob(*mBlob, mCropRect);
|
||||
|
||||
if (NS_WARN_IF(!data)) {
|
||||
mPromise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
mPromise->MaybeRejectWithNull();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1143,9 +1143,9 @@ private:
|
||||
mPromise->MaybeReject(rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
if (NS_WARN_IF(!data)) {
|
||||
mPromise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
||||
mPromise->MaybeRejectWithNull();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
function testBug1239300() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
createImageBitmap(new Blob()).then(
|
||||
function() {
|
||||
ok(false, "The promise should be rejected with null.");
|
||||
reject();
|
||||
},
|
||||
function(result) {
|
||||
if (result == null) {
|
||||
ok(true, "The promise should be rejected with null.");
|
||||
resolve();
|
||||
} else {
|
||||
ok(false, "The promise should be rejected with null.");
|
||||
reject();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
importScripts("imagebitmap_bug1239300.js");
|
||||
|
||||
function ok(expect, msg) {
|
||||
postMessage({type: "status", status: !!expect, msg: msg});
|
||||
}
|
||||
@@ -77,5 +79,8 @@ onmessage = function(event) {
|
||||
promiseThrows(createImageBitmap(source), event.data.msg);
|
||||
}
|
||||
doneTask();
|
||||
} else if (event.data.type == "testBug1239300") {
|
||||
var promise = testBug1239300();
|
||||
promise.then(doneTask, doneTask);
|
||||
}
|
||||
};
|
||||
@@ -24,6 +24,7 @@ support-files =
|
||||
image_transparent50.png
|
||||
image_yellow.png
|
||||
image_yellow75.png
|
||||
imagebitmap_bug1239300.js
|
||||
imagebitmap_on_worker.js
|
||||
imagebitmap_structuredclone.js
|
||||
imagebitmap_structuredclone_iframe.html
|
||||
@@ -247,13 +248,21 @@ support-files = captureStream_common.js
|
||||
support-files = file_drawWindow_source.html file_drawWindow_common.js
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk')
|
||||
[test_imagebitmap.html]
|
||||
tags = imagebitmap
|
||||
[test_imagebitmap_close.html]
|
||||
tags = imagebitmap
|
||||
[test_imagebitmap_cropping.html]
|
||||
tags = imagebitmap
|
||||
[test_imagebitmap_on_worker.html]
|
||||
tags = imagebitmap
|
||||
[test_imagebitmap_structuredclone.html]
|
||||
tags = imagebitmap
|
||||
[test_imagebitmap_structuredclone_iframe.html]
|
||||
tags = imagebitmap
|
||||
[test_imagebitmap_structuredclone_window.html]
|
||||
tags = imagebitmap
|
||||
[test_imagebitmap_transfer.html]
|
||||
tags = imagebitmap
|
||||
[test_ImageData_ctor.html]
|
||||
[test_isPointInStroke.html]
|
||||
[test_mozDashOffset.html]
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<canvas id="c1" class="output" width="128" height="128"></canvas>
|
||||
<canvas id="c2" width="128" height="128"></canvas>
|
||||
|
||||
<script src="imagebitmap_bug1239300.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
@@ -333,6 +334,7 @@ function runTests() {
|
||||
.then(testSources)
|
||||
.then(testExceptions)
|
||||
.then(testSecurityErrors)
|
||||
.then(testBug1239300)
|
||||
.then(SimpleTest.finish, function(ev) { failed(ev); SimpleTest.finish(); });
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,9 @@ function runTests() {
|
||||
xhr.send();
|
||||
}
|
||||
getNonImageFile("imagebitmap_on_worker.js");
|
||||
|
||||
// task: test bug : bug 1239300
|
||||
WORKER_TASKS.tasks.push(new Task("testBug1239300"));
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
@@ -933,7 +933,7 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
|
||||
LayoutDevicePixel::ToAppUnits(aPoint, aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
|
||||
|
||||
if (aPresContext->PresShell()) {
|
||||
pt = pt.RemoveResolution(aPresContext->PresShell()->GetCumulativeNonRootScaleResolution());
|
||||
pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(aPresContext->PresShell()));
|
||||
}
|
||||
|
||||
pt += LayoutDevicePixel::ToAppUnits(guiEvent->widget->WidgetToScreenOffset(),
|
||||
|
||||
@@ -37,12 +37,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=946632
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests, window);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set":[["general.smoothScroll", false],
|
||||
["mousewheel.system_scroll_override_on_root_content.enabled", false]]
|
||||
}, runTests)
|
||||
}, window);
|
||||
|
||||
var input = document.querySelector("input");
|
||||
var container = document.querySelector("#container");
|
||||
|
||||
function prepare(check)
|
||||
function reset()
|
||||
{
|
||||
container.scrollTop = 0;
|
||||
container.scrollLeft = 0;
|
||||
@@ -50,6 +55,10 @@ function prepare(check)
|
||||
input.scrollLeft = 0;
|
||||
container.style.display='none';
|
||||
container.getBoundingClientRect();
|
||||
}
|
||||
|
||||
function prepare(check)
|
||||
{
|
||||
container.style.display='';
|
||||
container.getBoundingClientRect();
|
||||
scrollHandler = function(event) {
|
||||
@@ -70,9 +79,10 @@ var tests = [
|
||||
is(input.scrollTop, 0, "<input> horizontal line scroll input.scrollTop");
|
||||
is(input.scrollLeft, 0, "<input> horizontal line scroll input.scrollLeft");
|
||||
},
|
||||
test: function() {
|
||||
synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaY: 1.0, lineOrPageDeltaY: 1 });
|
||||
event: {
|
||||
deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaY: 1.0,
|
||||
lineOrPageDeltaY: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -83,9 +93,10 @@ var tests = [
|
||||
is(container.scrollTop, 0, "<input> horizontal line scroll container.scrollTop");
|
||||
is(container.scrollLeft, 0, "<input> horizontal line scroll container.scrollLeft");
|
||||
},
|
||||
test: function() {
|
||||
synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 1.0, lineOrPageDeltaX: 1 });
|
||||
event: {
|
||||
deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 1.0,
|
||||
lineOrPageDeltaX: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -96,9 +107,10 @@ var tests = [
|
||||
is(input.scrollTop, 0, "<input> vertical page scroll input.scrollTop");
|
||||
is(input.scrollLeft, 0, "<input> vertical page scroll input.scrollLeft");
|
||||
},
|
||||
test: function() {
|
||||
synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaY: 1.0, lineOrPageDeltaY: 1 });
|
||||
event: {
|
||||
deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaY: 1.0,
|
||||
lineOrPageDeltaY: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -109,9 +121,10 @@ var tests = [
|
||||
is(container.scrollTop, 0, "<input> horizontal page scroll container.scrollTop");
|
||||
is(container.scrollLeft, 0, "<input> horizontal page scroll container.scrollLeft");
|
||||
},
|
||||
test: function() {
|
||||
synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 1.0, lineOrPageDeltaX: 1 });
|
||||
event: {
|
||||
deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 1.0,
|
||||
lineOrPageDeltaX: 1
|
||||
}
|
||||
},
|
||||
];
|
||||
@@ -120,15 +133,20 @@ var i = 0;
|
||||
function nextTest()
|
||||
{
|
||||
if (i == tests.length) {
|
||||
SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
var test = tests[i];
|
||||
++i;
|
||||
prepare(test.check);
|
||||
reset();
|
||||
|
||||
window.waitForAllPaintsFlushed(function() {
|
||||
test.test();
|
||||
prepare(test.check);
|
||||
|
||||
sendWheelAndPaint(input, 5, 5, test.event, function() {
|
||||
// Do nothing - we wait for the scroll event.
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -906,6 +906,12 @@ Promise::MaybeReject(const RefPtr<MediaStreamError>& aArg) {
|
||||
MaybeSomething(aArg, &Promise::MaybeReject);
|
||||
}
|
||||
|
||||
void
|
||||
Promise::MaybeRejectWithNull()
|
||||
{
|
||||
MaybeSomething(JS::NullHandleValue, &Promise::MaybeReject);
|
||||
}
|
||||
|
||||
bool
|
||||
Promise::PerformMicroTaskCheckpoint()
|
||||
{
|
||||
@@ -2364,7 +2370,7 @@ void
|
||||
Promise::AppendCallbacks(PromiseCallback* aResolveCallback,
|
||||
PromiseCallback* aRejectCallback)
|
||||
{
|
||||
if (mGlobal->IsDying()) {
|
||||
if (!mGlobal || mGlobal->IsDying()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,6 +148,8 @@ public:
|
||||
|
||||
void MaybeReject(const RefPtr<MediaStreamError>& aArg);
|
||||
|
||||
void MaybeRejectWithNull();
|
||||
|
||||
// DO NOT USE MaybeRejectBrokenly with in new code. Promises should be
|
||||
// rejected with Error instances.
|
||||
// Note: MaybeRejectBrokenly is a template so we can use it with DOMError
|
||||
|
||||
@@ -951,7 +951,7 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat)
|
||||
hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), getter_AddRefs(mSolidColorBrush));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << "[D2D1.1] Failure creating solid color brush.";
|
||||
gfxCriticalError() << "[D2D1.1] Failure creating solid color brush (I1).";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1006,7 +1006,7 @@ DrawTargetD2D1::Init(const IntSize &aSize, SurfaceFormat aFormat)
|
||||
hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), getter_AddRefs(mSolidColorBrush));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << "[D2D1.1] Failure creating solid color brush.";
|
||||
gfxCriticalError() << "[D2D1.1] Failure creating solid color brush (I2).";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -319,7 +319,7 @@ already_AddRefed<DrawTarget>
|
||||
Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
if (!AllowedSurfaceSize(aSize)) {
|
||||
gfxCriticalError(LoggerOptionsBasedOnSize(aSize)) << "Failed to allocate a surface due to invalid size " << aSize;
|
||||
gfxCriticalError(LoggerOptionsBasedOnSize(aSize)) << "Failed to allocate a surface due to invalid size (CDT) " << aSize;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ Factory::CreateDrawTargetForData(BackendType aBackend,
|
||||
{
|
||||
MOZ_ASSERT(aData);
|
||||
if (!AllowedSurfaceSize(aSize)) {
|
||||
gfxCriticalError(LoggerOptionsBasedOnSize(aSize)) << "Failed to allocate a surface due to invalid size " << aSize;
|
||||
gfxCriticalError(LoggerOptionsBasedOnSize(aSize)) << "Failed to allocate a surface due to invalid size (DTD) " << aSize;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -926,7 +926,7 @@ Factory::CreateDataSourceSurface(const IntSize &aSize,
|
||||
bool aZero)
|
||||
{
|
||||
if (!AllowedSurfaceSize(aSize)) {
|
||||
gfxCriticalError(LoggerOptionsBasedOnSize(aSize)) << "Failed to allocate a surface due to invalid size " << aSize;
|
||||
gfxCriticalError(LoggerOptionsBasedOnSize(aSize)) << "Failed to allocate a surface due to invalid size (DSS) " << aSize;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ DataSourceSurfaceD2D1::Map(MapType aMapType, MappedSurface *aMappedSurface)
|
||||
|
||||
D2D1_MAPPED_RECT map;
|
||||
if (FAILED(mBitmap->Map(D2D1_MAP_OPTIONS_READ, &map))) {
|
||||
gfxCriticalError() << "Failed to map bitmap.";
|
||||
gfxCriticalError() << "Failed to map bitmap (M).";
|
||||
return false;
|
||||
}
|
||||
aMappedSurface->mData = map.bits;
|
||||
@@ -231,7 +231,7 @@ DataSourceSurfaceD2D1::EnsureMapped()
|
||||
return;
|
||||
}
|
||||
if (FAILED(mBitmap->Map(D2D1_MAP_OPTIONS_READ, &mMap))) {
|
||||
gfxCriticalError() << "Failed to map bitmap.";
|
||||
gfxCriticalError() << "Failed to map bitmap (EM).";
|
||||
return;
|
||||
}
|
||||
mMapped = true;
|
||||
|
||||
@@ -65,7 +65,7 @@ SourceSurfaceD2DTarget::GetDataSurface()
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
if (!Factory::GetDirect3D10Device()) {
|
||||
gfxCriticalError() << "Invalid D3D10 device in D2D target surface";
|
||||
gfxCriticalError() << "Invalid D3D10 device in D2D target surface (GDS)";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ SourceSurfaceD2DTarget::GetSRView()
|
||||
}
|
||||
|
||||
if (!Factory::GetDirect3D10Device()) {
|
||||
gfxCriticalError() << "Invalid D3D10 device in D2D target surface";
|
||||
gfxCriticalError() << "Invalid D3D10 device in D2D target surface (SRV)";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,19 +303,19 @@ BufferTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
RefPtr<gfx::DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (BT).";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (surface->GetSize() != srcSurf->GetSize() || surface->GetFormat() != srcSurf->GetFormat()) {
|
||||
gfxCriticalError() << "Attempt to update texture client from a surface with a different size or format! This: " << surface->GetSize() << " " << surface->GetFormat() << " Other: " << aSurface->GetSize() << " " << aSurface->GetFormat();
|
||||
gfxCriticalError() << "Attempt to update texture client from a surface with a different size or format (BT)! This: " << surface->GetSize() << " " << surface->GetFormat() << " Other: " << aSurface->GetSize() << " " << aSurface->GetFormat();
|
||||
return false;
|
||||
}
|
||||
|
||||
gfx::DataSourceSurface::MappedSurface sourceMap;
|
||||
gfx::DataSourceSurface::MappedSurface destMap;
|
||||
if (!srcSurf->Map(gfx::DataSourceSurface::READ, &sourceMap)) {
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface (BT).";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define GFX_LAYERMETRICSWRAPPER_H
|
||||
|
||||
#include "Layers.h"
|
||||
#include "UnitTransforms.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@@ -299,6 +300,11 @@ public:
|
||||
return gfx::Matrix4x4();
|
||||
}
|
||||
|
||||
CSSTransformMatrix GetTransformTyped() const
|
||||
{
|
||||
return ViewAs<CSSTransformMatrix>(GetTransform());
|
||||
}
|
||||
|
||||
bool TransformIsPerspective() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
@@ -892,6 +892,12 @@ Layer::GetTransform() const
|
||||
return transform;
|
||||
}
|
||||
|
||||
const CSSTransformMatrix
|
||||
Layer::GetTransformTyped() const
|
||||
{
|
||||
return ViewAs<CSSTransformMatrix>(GetTransform());
|
||||
}
|
||||
|
||||
const Matrix4x4
|
||||
Layer::GetLocalTransform()
|
||||
{
|
||||
@@ -909,6 +915,12 @@ Layer::GetLocalTransform()
|
||||
return transform;
|
||||
}
|
||||
|
||||
const LayerToParentLayerMatrix4x4
|
||||
Layer::GetLocalTransformTyped()
|
||||
{
|
||||
return ViewAs<LayerToParentLayerMatrix4x4>(GetLocalTransform());
|
||||
}
|
||||
|
||||
bool
|
||||
Layer::HasTransformAnimation() const
|
||||
{
|
||||
|
||||
+11
-1
@@ -1278,6 +1278,9 @@ public:
|
||||
virtual Layer* GetFirstChild() const { return nullptr; }
|
||||
virtual Layer* GetLastChild() const { return nullptr; }
|
||||
const gfx::Matrix4x4 GetTransform() const;
|
||||
// Same as GetTransform(), but returns the transform as a strongly-typed
|
||||
// matrix. Eventually this will replace GetTransform().
|
||||
const CSSTransformMatrix GetTransformTyped() const;
|
||||
const gfx::Matrix4x4& GetBaseTransform() const { return mTransform; }
|
||||
// Note: these are virtual because ContainerLayerComposite overrides them.
|
||||
virtual float GetPostXScale() const { return mPostXScale; }
|
||||
@@ -1348,10 +1351,17 @@ public:
|
||||
|
||||
/**
|
||||
* Returns the local transform for this layer: either mTransform or,
|
||||
* for shadow layers, GetShadowTransform()
|
||||
* for shadow layers, GetShadowTransform(), in either case with the
|
||||
* pre- and post-scales applied.
|
||||
*/
|
||||
const gfx::Matrix4x4 GetLocalTransform();
|
||||
|
||||
/**
|
||||
* Same as GetLocalTransform(), but returns a strongly-typed matrix.
|
||||
* Eventually, this will replace GetLocalTransform().
|
||||
*/
|
||||
const LayerToParentLayerMatrix4x4 GetLocalTransformTyped();
|
||||
|
||||
/**
|
||||
* Returns the local opacity for this layer: either mOpacity or,
|
||||
* for shadow layers, GetShadowOpacity()
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "mozilla/layers/GonkNativeHandle.h"
|
||||
#endif
|
||||
|
||||
#include "Units.h"
|
||||
#include "mozilla/gfx/Point.h" // for IntPoint
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
#include "nsRegion.h"
|
||||
@@ -284,6 +285,22 @@ enum TextureDumpMode {
|
||||
DoNotCompress // dump texture uncompressed
|
||||
};
|
||||
|
||||
// Some specialized typedefs of Matrix4x4Typed.
|
||||
typedef gfx::Matrix4x4Typed<LayerPixel, CSSTransformedLayerPixel> CSSTransformMatrix;
|
||||
// Several different async transforms can contribute to a layer's transform
|
||||
// (specifically, an async animation can contribute a transform, and each APZC
|
||||
// that scrolls a layer can contribute async scroll/zoom and overscroll
|
||||
// transforms).
|
||||
// To try to model this with typed units, we represent individual async
|
||||
// transforms as ParentLayer -> ParentLayer transforms (aliased as
|
||||
// AsyncTransformComponentMatrix), and we represent the product of all of them
|
||||
// as a CSSTransformLayer -> ParentLayer transform (aliased as
|
||||
// AsyncTransformMatrix). To create an AsyncTransformMatrix from component
|
||||
// matrices, a ViewAs operation is needed. A MultipleAsyncTransforms
|
||||
// PixelCastJustification is provided for this purpose.
|
||||
typedef gfx::Matrix4x4Typed<ParentLayerPixel, ParentLayerPixel> AsyncTransformComponentMatrix;
|
||||
typedef gfx::Matrix4x4Typed<CSSTransformedLayerPixel, ParentLayerPixel> AsyncTransformMatrix;
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
+92
-37
@@ -28,6 +28,8 @@ public:
|
||||
TextureFlags aFlags = TextureFlags::DEFAULT,
|
||||
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
|
||||
|
||||
virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override;
|
||||
|
||||
static
|
||||
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat);
|
||||
|
||||
@@ -63,6 +65,8 @@ public:
|
||||
TextureFlags aFlags = TextureFlags::DEFAULT,
|
||||
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
|
||||
|
||||
virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override;
|
||||
|
||||
static
|
||||
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
ISurfaceAllocator* aAllocator);
|
||||
@@ -101,6 +105,10 @@ public:
|
||||
virtual ~ShmemDIBTextureData()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ShmemDIBTextureData);
|
||||
|
||||
// The host side has its own references and handles to this data, we can
|
||||
// safely clear ours.
|
||||
DeallocateData();
|
||||
}
|
||||
|
||||
HANDLE mFileMapping;
|
||||
@@ -115,31 +123,6 @@ DIBTextureData::BorrowDrawTarget()
|
||||
return gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mSurface, mSize);
|
||||
}
|
||||
|
||||
bool
|
||||
DIBTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
{
|
||||
RefPtr<gfxImageSurface> imgSurf = mSurface->GetAsImageSurface();
|
||||
|
||||
RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface.";
|
||||
return false;
|
||||
}
|
||||
|
||||
DataSourceSurface::MappedSurface sourceMap;
|
||||
srcSurf->Map(DataSourceSurface::READ, &sourceMap);
|
||||
|
||||
for (int y = 0; y < srcSurf->GetSize().height; y++) {
|
||||
memcpy(imgSurf->Data() + imgSurf->Stride() * y,
|
||||
sourceMap.mData + sourceMap.mStride * y,
|
||||
srcSurf->GetSize().width * BytesPerPixel(srcSurf->GetFormat()));
|
||||
}
|
||||
|
||||
srcSurf->Unmap();
|
||||
return true;
|
||||
}
|
||||
|
||||
DIBTextureData*
|
||||
DIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
ISurfaceAllocator* aAllocator)
|
||||
@@ -192,6 +175,34 @@ MemoryDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat)
|
||||
return new MemoryDIBTextureData(aSize, aFormat, surface);
|
||||
}
|
||||
|
||||
bool
|
||||
MemoryDIBTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
{
|
||||
RefPtr<gfxImageSurface> imgSurf = mSurface->GetAsImageSurface();
|
||||
|
||||
RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (DIB).";
|
||||
return false;
|
||||
}
|
||||
|
||||
DataSourceSurface::MappedSurface sourceMap;
|
||||
if (!srcSurf->Map(gfx::DataSourceSurface::READ, &sourceMap)) {
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int y = 0; y < srcSurf->GetSize().height; y++) {
|
||||
memcpy(imgSurf->Data() + imgSurf->Stride() * y,
|
||||
sourceMap.mData + sourceMap.mStride * y,
|
||||
srcSurf->GetSize().width * BytesPerPixel(srcSurf->GetFormat()));
|
||||
}
|
||||
|
||||
srcSurf->Unmap();
|
||||
return true;
|
||||
}
|
||||
|
||||
TextureData*
|
||||
ShmemDIBTextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
|
||||
TextureFlags aFlags,
|
||||
@@ -203,6 +214,46 @@ ShmemDIBTextureData::CreateSimilar(ISurfaceAllocator* aAllocator,
|
||||
return ShmemDIBTextureData::Create(mSize, mFormat, aAllocator);
|
||||
}
|
||||
|
||||
bool
|
||||
ShmemDIBTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
{
|
||||
|
||||
RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (DTD).";
|
||||
return false;
|
||||
}
|
||||
|
||||
DataSourceSurface::MappedSurface sourceMap;
|
||||
if (!srcSurf->Map(gfx::DataSourceSurface::READ, &sourceMap)) {
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
|
||||
return false;
|
||||
}
|
||||
|
||||
GdiFlush();
|
||||
|
||||
uint32_t stride = mSize.width * BytesPerPixel(mFormat);
|
||||
uint8_t* data = (uint8_t*)::MapViewOfFile(mFileMapping, FILE_MAP_WRITE, 0, 0, stride * mSize.height);
|
||||
|
||||
if (!data) {
|
||||
gfxCriticalError() << "Failed to map view of file for UpdateFromSurface.";
|
||||
srcSurf->Unmap();
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int y = 0; y < srcSurf->GetSize().height; y++) {
|
||||
memcpy(data + stride * y,
|
||||
sourceMap.mData + sourceMap.mStride * y,
|
||||
srcSurf->GetSize().width * BytesPerPixel(srcSurf->GetFormat()));
|
||||
}
|
||||
|
||||
::UnmapViewOfFile(data);
|
||||
|
||||
srcSurf->Unmap();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ShmemDIBTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
@@ -229,14 +280,6 @@ ShmemDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint8_t* data = (uint8_t*)::MapViewOfFile(fileMapping, FILE_MAP_WRITE | FILE_MAP_READ,
|
||||
0, 0, aSize.width * aSize.height
|
||||
* BytesPerPixel(aFormat));
|
||||
|
||||
memset(data, 0x80, aSize.width * aSize.height * BytesPerPixel(aFormat));
|
||||
|
||||
::UnmapViewOfFile(fileMapping);
|
||||
|
||||
BITMAPV4HEADER header;
|
||||
memset(&header, 0, sizeof(BITMAPV4HEADER));
|
||||
header.bV4Size = sizeof(BITMAPV4HEADER);
|
||||
@@ -249,7 +292,11 @@ ShmemDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
header.bV4GreenMask = 0x0000FF00;
|
||||
header.bV4BlueMask = 0x000000FF;
|
||||
|
||||
HDC dc = ::CreateCompatibleDC(::GetDC(NULL));
|
||||
HDC nulldc = ::GetDC(NULL);
|
||||
|
||||
HDC dc = ::CreateCompatibleDC(nulldc);
|
||||
|
||||
::ReleaseDC(nullptr, nulldc);
|
||||
|
||||
if (!dc) {
|
||||
::CloseHandle(fileMapping);
|
||||
@@ -264,7 +311,7 @@ ShmemDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
|
||||
|
||||
if (!bitmap) {
|
||||
gfxCriticalError() << "Failed to create DIB section for a bitmap of size "
|
||||
<< aSize;
|
||||
<< aSize << " and mapSize " << mapSize;
|
||||
::CloseHandle(fileMapping);
|
||||
::DeleteDC(dc);
|
||||
return nullptr;
|
||||
@@ -392,6 +439,14 @@ TextureHostFileMapping::~TextureHostFileMapping()
|
||||
::CloseHandle(mFileMapping);
|
||||
}
|
||||
|
||||
UserDataKey kFileMappingKey;
|
||||
|
||||
static void UnmapFileData(void* aData)
|
||||
{
|
||||
MOZ_ASSERT(aData);
|
||||
::UnmapViewOfFile(aData);
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostFileMapping::UpdatedInternal(const nsIntRegion* aRegion)
|
||||
{
|
||||
@@ -410,14 +465,14 @@ TextureHostFileMapping::UpdatedInternal(const nsIntRegion* aRegion)
|
||||
if (data) {
|
||||
RefPtr<DataSourceSurface> surf = Factory::CreateWrappingDataSourceSurface(data, mSize.width * BytesPerPixel(mFormat), mSize, mFormat);
|
||||
|
||||
surf->AddUserData(&kFileMappingKey, data, UnmapFileData);
|
||||
|
||||
if (!mTextureSource->Update(surf, const_cast<nsIntRegion*>(aRegion))) {
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
} else {
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
|
||||
::UnmapViewOfFile(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@ public:
|
||||
|
||||
virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() override;
|
||||
|
||||
virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override;
|
||||
|
||||
virtual bool HasInternalBuffer() const override { return true; }
|
||||
|
||||
static
|
||||
|
||||
@@ -358,7 +358,9 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
|
||||
if (!needsApzc) {
|
||||
node = RecycleOrCreateNode(aState, nullptr, aLayersId);
|
||||
AttachNodeToTree(node, aParent, aNextSibling);
|
||||
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetTransform(),
|
||||
node->SetHitTestData(
|
||||
GetEventRegions(aLayer),
|
||||
aLayer.GetTransformTyped(),
|
||||
aLayer.GetClipRect() ? Some(ParentLayerIntRegion(*aLayer.GetClipRect())) : Nothing(),
|
||||
GetEventRegionsOverride(aParent, aLayer));
|
||||
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
|
||||
@@ -462,7 +464,10 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
|
||||
MOZ_ASSERT(node->IsPrimaryHolder() && node->GetApzc() && node->GetApzc()->Matches(guid));
|
||||
|
||||
ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
|
||||
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetTransform(), Some(clipRegion),
|
||||
node->SetHitTestData(
|
||||
GetEventRegions(aLayer),
|
||||
aLayer.GetTransformTyped(),
|
||||
Some(clipRegion),
|
||||
GetEventRegionsOverride(aParent, aLayer));
|
||||
apzc->SetAncestorTransform(aAncestorTransform);
|
||||
|
||||
@@ -516,11 +521,20 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
|
||||
// Even though different layers associated with a given APZC may be at
|
||||
// different levels in the layer tree (e.g. one being an uncle of another),
|
||||
// we require from Layout that the CSS transforms up to their common
|
||||
// ancestor be the same.
|
||||
MOZ_ASSERT(aAncestorTransform == apzc->GetAncestorTransform());
|
||||
// ancestor be roughly the same. There are cases in which the transforms
|
||||
// are not exactly the same, for example if the parent is container layer
|
||||
// for an opacity, and this container layer has a resolution-induced scale
|
||||
// as its base transform and a prescale that is supposed to undo that scale.
|
||||
// Due to floating point inaccuracies those transforms can end up not quite
|
||||
// canceling each other. That's why we're using a fuzzy comparison here
|
||||
// instead of an exact one.
|
||||
MOZ_ASSERT(aAncestorTransform.FuzzyEqualsMultiplicative(apzc->GetAncestorTransform()));
|
||||
|
||||
ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
|
||||
node->SetHitTestData(GetEventRegions(aLayer), aLayer.GetTransform(), Some(clipRegion),
|
||||
node->SetHitTestData(
|
||||
GetEventRegions(aLayer),
|
||||
aLayer.GetTransformTyped(),
|
||||
Some(clipRegion),
|
||||
GetEventRegionsOverride(aParent, aLayer));
|
||||
}
|
||||
|
||||
@@ -1844,7 +1858,7 @@ APZCTreeManager::GetScreenToApzcTransform(const AsyncPanZoomController *aApzc) c
|
||||
// ancestorUntransform is updated to RC.Inverse() * QC.Inverse() when parent == P
|
||||
ancestorUntransform = parent->GetAncestorTransform().Inverse();
|
||||
// asyncUntransform is updated to PA.Inverse() when parent == P
|
||||
Matrix4x4 asyncUntransform = parent->GetCurrentAsyncTransformWithOverscroll().Inverse();
|
||||
Matrix4x4 asyncUntransform = parent->GetCurrentAsyncTransformWithOverscroll().Inverse().ToUnknownMatrix();
|
||||
// untransformSinceLastApzc is RC.Inverse() * QC.Inverse() * PA.Inverse()
|
||||
Matrix4x4 untransformSinceLastApzc = ancestorUntransform * asyncUntransform;
|
||||
|
||||
@@ -1876,7 +1890,7 @@ APZCTreeManager::GetApzcToGeckoTransform(const AsyncPanZoomController *aApzc) co
|
||||
// leftmost matrix in a multiplication is applied first.
|
||||
|
||||
// asyncUntransform is LA.Inverse()
|
||||
Matrix4x4 asyncUntransform = aApzc->GetCurrentAsyncTransformWithOverscroll().Inverse();
|
||||
Matrix4x4 asyncUntransform = aApzc->GetCurrentAsyncTransformWithOverscroll().Inverse().ToUnknownMatrix();
|
||||
|
||||
// aTransformToGeckoOut is initialized to LA.Inverse() * LD * MC * NC * OC * PC
|
||||
result = asyncUntransform * aApzc->GetTransformToLastDispatchedPaint() * aApzc->GetAncestorTransform();
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#define mozilla_layers_APZUtils_h
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include "LayersTypes.h"
|
||||
#include "UnitTransforms.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
@@ -61,6 +63,16 @@ static bool IsZero(const gfx::PointTyped<Units>& aPoint)
|
||||
&& FuzzyEqualsAdditive(aPoint.y, 0.0f, COORDINATE_EPSILON);
|
||||
}
|
||||
|
||||
// Deem an AsyncTransformComponentMatrix (obtained by multiplying together
|
||||
// one or more AsyncTransformComponentMatrix objects) as constituting a
|
||||
// complete async transform.
|
||||
inline AsyncTransformMatrix
|
||||
CompleteAsyncTransform(const AsyncTransformComponentMatrix& aMatrix)
|
||||
{
|
||||
return ViewAs<AsyncTransformMatrix>(aMatrix,
|
||||
PixelCastJustification::MultipleAsyncTransforms);
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
@@ -2896,10 +2896,10 @@ bool AsyncPanZoomController::UpdateAnimation(const TimeStamp& aSampleTime,
|
||||
return false;
|
||||
}
|
||||
|
||||
Matrix4x4 AsyncPanZoomController::GetOverscrollTransform() const {
|
||||
AsyncTransformComponentMatrix AsyncPanZoomController::GetOverscrollTransform() const {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!IsOverscrolled()) {
|
||||
return Matrix4x4();
|
||||
return AsyncTransformComponentMatrix();
|
||||
}
|
||||
|
||||
// The overscroll effect is a uniform stretch along the overscrolled axis,
|
||||
@@ -2936,7 +2936,7 @@ Matrix4x4 AsyncPanZoomController::GetOverscrollTransform() const {
|
||||
}
|
||||
|
||||
// Combine the transformations into a matrix.
|
||||
return Matrix4x4::Scaling(scaleX, scaleY, 1)
|
||||
return AsyncTransformComponentMatrix::Scaling(scaleX, scaleY, 1)
|
||||
.PostTranslate(translation.x, translation.y, 0);
|
||||
}
|
||||
|
||||
@@ -3033,8 +3033,9 @@ AsyncTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {
|
||||
-translation);
|
||||
}
|
||||
|
||||
Matrix4x4 AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll() const {
|
||||
return Matrix4x4(GetCurrentAsyncTransform()) * GetOverscrollTransform();
|
||||
AsyncTransformComponentMatrix AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll() const {
|
||||
return AsyncTransformComponentMatrix(GetCurrentAsyncTransform())
|
||||
* GetOverscrollTransform();
|
||||
}
|
||||
|
||||
Matrix4x4 AsyncPanZoomController::GetTransformToLastDispatchedPaint() const {
|
||||
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
* Return a visual effect that reflects this apzc's
|
||||
* overscrolled state, if any.
|
||||
*/
|
||||
Matrix4x4 GetOverscrollTransform() const;
|
||||
AsyncTransformComponentMatrix GetOverscrollTransform() const;
|
||||
|
||||
/**
|
||||
* A shadow layer update has arrived. |aLayerMetrics| is the new FrameMetrics
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
* Returns the same transform as GetCurrentAsyncTransform(), but includes
|
||||
* any transform due to axis over-scroll.
|
||||
*/
|
||||
Matrix4x4 GetCurrentAsyncTransformWithOverscroll() const;
|
||||
AsyncTransformComponentMatrix GetCurrentAsyncTransformWithOverscroll() const;
|
||||
|
||||
/**
|
||||
* Returns the transform to take something from the coordinate space of the
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "LayersLogging.h" // for Stringify
|
||||
#include "mozilla/gfx/Point.h" // for Point4D
|
||||
#include "mozilla/layers/APZThreadUtils.h" // for AssertOnCompositorThread
|
||||
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform
|
||||
#include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform::operator Matrix4x4()
|
||||
#include "nsPrintfCString.h" // for nsPrintfCString
|
||||
#include "UnitTransforms.h" // for ViewAs
|
||||
@@ -209,7 +210,7 @@ HitTestingTreeNode::GetLayersId() const
|
||||
|
||||
void
|
||||
HitTestingTreeNode::SetHitTestData(const EventRegions& aRegions,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
const CSSTransformMatrix& aTransform,
|
||||
const Maybe<ParentLayerIntRegion>& aClipRegion,
|
||||
const EventRegionsOverride& aOverride)
|
||||
{
|
||||
@@ -230,12 +231,12 @@ Maybe<LayerPoint>
|
||||
HitTestingTreeNode::Untransform(const ParentLayerPoint& aPoint) const
|
||||
{
|
||||
// convert into Layer coordinate space
|
||||
gfx::Matrix4x4 localTransform = mTransform;
|
||||
if (mApzc) {
|
||||
localTransform = localTransform * mApzc->GetCurrentAsyncTransformWithOverscroll();
|
||||
}
|
||||
return UntransformBy(
|
||||
ViewAs<LayerToParentLayerMatrix4x4>(localTransform).Inverse(), aPoint);
|
||||
LayerToParentLayerMatrix4x4 transform = mTransform *
|
||||
CompleteAsyncTransform(
|
||||
mApzc
|
||||
? mApzc->GetCurrentAsyncTransformWithOverscroll()
|
||||
: AsyncTransformComponentMatrix());
|
||||
return UntransformBy(transform.Inverse(), aPoint);
|
||||
}
|
||||
|
||||
HitTestResult
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
/* Hit test related methods */
|
||||
|
||||
void SetHitTestData(const EventRegions& aRegions,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
const CSSTransformMatrix& aTransform,
|
||||
const Maybe<ParentLayerIntRegion>& aClipRegion,
|
||||
const EventRegionsOverride& aOverride);
|
||||
bool IsOutsideClip(const ParentLayerPoint& aPoint) const;
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
|
||||
/* This is the transform from layer L. This does NOT include any async
|
||||
* transforms. */
|
||||
gfx::Matrix4x4 mTransform;
|
||||
CSSTransformMatrix mTransform;
|
||||
|
||||
/* This is clip rect for L that we wish to use for hit-testing purposes. Note
|
||||
* that this may not be exactly the same as the clip rect on layer L because
|
||||
|
||||
@@ -727,7 +727,6 @@ TextureClient::CreateForDrawing(CompositableForwarder* aAllocator,
|
||||
}
|
||||
|
||||
if (!data && aFormat == SurfaceFormat::B8G8R8X8 &&
|
||||
aAllocator->IsSameProcess() &&
|
||||
moz2DBackend == gfx::BackendType::CAIRO &&
|
||||
NS_IsMainThread()) {
|
||||
data = DIBTextureData::Create(aSize, aFormat, aAllocator);
|
||||
|
||||
@@ -772,7 +772,7 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion,
|
||||
|
||||
mBackBuffer.Set(this, mAllocator->GetTextureClient());
|
||||
if (!mBackBuffer) {
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to allocate a TextureClient";
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to allocate a TextureClient (B)";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -780,7 +780,7 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion,
|
||||
mBackBufferOnWhite = mAllocator->GetTextureClient();
|
||||
if (!mBackBufferOnWhite) {
|
||||
mBackBuffer.Set(this, nullptr);
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to allocate a TextureClient";
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to allocate a TextureClient (W)";
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -805,7 +805,7 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion,
|
||||
|
||||
if (!mBackBuffer->IsLocked()) {
|
||||
if (!mBackBuffer->Lock(OpenMode::OPEN_READ_WRITE)) {
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to lock a tile";
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to lock a tile (B)";
|
||||
DiscardBackBuffer();
|
||||
DiscardFrontBuffer();
|
||||
return nullptr;
|
||||
@@ -814,7 +814,7 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion,
|
||||
|
||||
if (mBackBufferOnWhite && !mBackBufferOnWhite->IsLocked()) {
|
||||
if (!mBackBufferOnWhite->Lock(OpenMode::OPEN_READ_WRITE)) {
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to lock a tile";
|
||||
gfxCriticalError() << "[Tiling:Client] Failed to lock a tile (W)";
|
||||
DiscardBackBuffer();
|
||||
DiscardFrontBuffer();
|
||||
return nullptr;
|
||||
@@ -1406,7 +1406,7 @@ GetCompositorSideCompositionBounds(const LayerMetricsWrapper& aScrollAncestor,
|
||||
const LayerRect& aClip)
|
||||
{
|
||||
LayerToParentLayerMatrix4x4 transform = aTransformToCompBounds *
|
||||
ViewAs<ParentLayerToParentLayerMatrix4x4>(aAPZTransform);
|
||||
AsyncTransformComponentMatrix(aAPZTransform);
|
||||
|
||||
return UntransformBy(transform.Inverse(),
|
||||
aScrollAncestor.Metrics().GetCompositionBounds(), aClip);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "mozilla/gfx/Point.h" // for RoundedToInt, PointTyped
|
||||
#include "mozilla/gfx/Rect.h" // for RoundedToInt, RectTyped
|
||||
#include "mozilla/gfx/ScaleFactor.h" // for ScaleFactor
|
||||
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/CompositorParent.h" // for CompositorParent, etc
|
||||
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
|
||||
@@ -221,7 +222,7 @@ TransformClipRect(Layer* aLayer,
|
||||
* only be applied once.
|
||||
*/
|
||||
static void
|
||||
SetShadowTransform(Layer* aLayer, Matrix4x4 aTransform)
|
||||
SetShadowTransform(Layer* aLayer, LayerToParentLayerMatrix4x4 aTransform)
|
||||
{
|
||||
if (ContainerLayer* c = aLayer->AsContainerLayer()) {
|
||||
aTransform.PreScale(1.0f / c->GetPreXScale(),
|
||||
@@ -231,7 +232,7 @@ SetShadowTransform(Layer* aLayer, Matrix4x4 aTransform)
|
||||
aTransform.PostScale(1.0f / aLayer->GetPostXScale(),
|
||||
1.0f / aLayer->GetPostYScale(),
|
||||
1);
|
||||
aLayer->AsLayerComposite()->SetShadowTransform(aTransform);
|
||||
aLayer->AsLayerComposite()->SetShadowTransform(aTransform.ToUnknownMatrix());
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -245,7 +246,7 @@ TranslateShadowLayer(Layer* aLayer,
|
||||
// Note that the shadow transform is reset on every frame of composition so
|
||||
// we don't have to worry about the adjustments compounding over successive
|
||||
// frames.
|
||||
Matrix4x4 layerTransform = aLayer->GetLocalTransform();
|
||||
LayerToParentLayerMatrix4x4 layerTransform = aLayer->GetLocalTransformTyped();
|
||||
|
||||
// Apply the translation to the layer transform.
|
||||
layerTransform.PostTranslate(aTranslation.x, aTranslation.y, 0);
|
||||
@@ -383,8 +384,8 @@ void
|
||||
AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
|
||||
Layer* aTransformedSubtreeRoot,
|
||||
FrameMetrics::ViewID aTransformScrollId,
|
||||
const Matrix4x4& aPreviousTransformForRoot,
|
||||
const Matrix4x4& aCurrentTransformForRoot,
|
||||
const LayerToParentLayerMatrix4x4& aPreviousTransformForRoot,
|
||||
const LayerToParentLayerMatrix4x4& aCurrentTransformForRoot,
|
||||
const ScreenMargin& aFixedLayerMargins,
|
||||
bool aTransformAffectsLayerClip)
|
||||
{
|
||||
@@ -428,8 +429,8 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
|
||||
|
||||
// Calculate the cumulative transforms between the subtree root with the
|
||||
// old transform and the current transform.
|
||||
Matrix4x4 oldCumulativeTransform = ancestorTransform * aPreviousTransformForRoot;
|
||||
Matrix4x4 newCumulativeTransform = ancestorTransform * aCurrentTransformForRoot;
|
||||
Matrix4x4 oldCumulativeTransform = ancestorTransform * aPreviousTransformForRoot.ToUnknownMatrix();
|
||||
Matrix4x4 newCumulativeTransform = ancestorTransform * aCurrentTransformForRoot.ToUnknownMatrix();
|
||||
if (newCumulativeTransform.IsSingular()) {
|
||||
return;
|
||||
}
|
||||
@@ -698,10 +699,10 @@ AsyncCompositionManager::RecordShadowTransforms(Layer* aLayer)
|
||||
}
|
||||
}
|
||||
|
||||
Matrix4x4
|
||||
AdjustForClip(const Matrix4x4& asyncTransform, Layer* aLayer)
|
||||
static AsyncTransformComponentMatrix
|
||||
AdjustForClip(const AsyncTransformComponentMatrix& asyncTransform, Layer* aLayer)
|
||||
{
|
||||
Matrix4x4 result = asyncTransform;
|
||||
AsyncTransformComponentMatrix result = asyncTransform;
|
||||
|
||||
// Container layers start at the origin, but they are clipped to where they
|
||||
// actually have content on the screen. The tree transform is meant to apply
|
||||
@@ -802,9 +803,10 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
clipDeferredFromChildren);
|
||||
}
|
||||
|
||||
Matrix4x4 oldTransform = aLayer->GetTransform();
|
||||
LayerToParentLayerMatrix4x4 oldTransform = aLayer->GetTransformTyped() *
|
||||
AsyncTransformMatrix();
|
||||
|
||||
Matrix4x4 combinedAsyncTransform;
|
||||
AsyncTransformComponentMatrix combinedAsyncTransform;
|
||||
bool hasAsyncTransform = false;
|
||||
ScreenMargin fixedLayerMargins;
|
||||
|
||||
@@ -840,9 +842,10 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
ParentLayerPoint scrollOffset;
|
||||
controller->SampleContentTransformForFrame(&asyncTransformWithoutOverscroll,
|
||||
scrollOffset);
|
||||
Matrix4x4 overscrollTransform = controller->GetOverscrollTransform();
|
||||
Matrix4x4 asyncTransform =
|
||||
Matrix4x4(asyncTransformWithoutOverscroll) * overscrollTransform;
|
||||
AsyncTransformComponentMatrix overscrollTransform = controller->GetOverscrollTransform();
|
||||
AsyncTransformComponentMatrix asyncTransform =
|
||||
AsyncTransformComponentMatrix(asyncTransformWithoutOverscroll)
|
||||
* overscrollTransform;
|
||||
|
||||
if (!aLayer->IsScrollInfoLayer()) {
|
||||
controller->MarkAsyncTransformAppliedToContent();
|
||||
@@ -898,8 +901,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
// frame and should not be transformed.
|
||||
if (asyncClip && !metrics.UsesContainerScrolling()) {
|
||||
MOZ_ASSERT(asyncTransform.Is2D());
|
||||
asyncClip = Some(TransformBy(
|
||||
ViewAs<ParentLayerToParentLayerMatrix4x4>(asyncTransform), *asyncClip));
|
||||
asyncClip = Some(TransformBy(asyncTransform, *asyncClip));
|
||||
}
|
||||
aLayer->AsLayerComposite()->SetShadowClipRect(asyncClip);
|
||||
|
||||
@@ -912,8 +914,10 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
// effects apply to fixed and sticky layers. We do this by using
|
||||
// GetTransform() as the base transform rather than GetLocalTransform(),
|
||||
// which would include those factors.
|
||||
Matrix4x4 transformWithoutOverscrollOrOmta = aLayer->GetTransform() *
|
||||
AdjustForClip(asyncTransformWithoutOverscroll, aLayer);
|
||||
LayerToParentLayerMatrix4x4 transformWithoutOverscrollOrOmta =
|
||||
aLayer->GetTransformTyped()
|
||||
* CompleteAsyncTransform(
|
||||
AdjustForClip(asyncTransformWithoutOverscroll, aLayer));
|
||||
|
||||
// Since fixed/sticky layers are relative to their nearest scrolling ancestor,
|
||||
// we use the ViewID from the bottommost scrollable metrics here.
|
||||
@@ -947,7 +951,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
// frame, so these are the ones we need to shift by our async transform.
|
||||
for (Layer* ancestorMaskLayer : ancestorMaskLayers) {
|
||||
SetShadowTransform(ancestorMaskLayer,
|
||||
ancestorMaskLayer->GetLocalTransform() * asyncTransform);
|
||||
ancestorMaskLayer->GetLocalTransformTyped() * asyncTransform);
|
||||
}
|
||||
|
||||
// Append the ancestor mask layer for this scroll frame to ancestorMaskLayers.
|
||||
@@ -969,12 +973,13 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
// shadow transform; in that case we want to apply ours on top of that one
|
||||
// rather than clobber it.
|
||||
SetShadowTransform(aLayer,
|
||||
aLayer->GetLocalTransform() * AdjustForClip(combinedAsyncTransform, aLayer));
|
||||
aLayer->GetLocalTransformTyped()
|
||||
* AdjustForClip(combinedAsyncTransform, aLayer));
|
||||
|
||||
// Do the same for the layer's own mask layer, if it has one.
|
||||
if (Layer* maskLayer = aLayer->GetMaskLayer()) {
|
||||
SetShadowTransform(maskLayer,
|
||||
maskLayer->GetLocalTransform() * combinedAsyncTransform);
|
||||
maskLayer->GetLocalTransformTyped() * combinedAsyncTransform);
|
||||
}
|
||||
|
||||
appliedTransform = true;
|
||||
@@ -1019,13 +1024,13 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
|
||||
const FrameMetrics& metrics = aContent.Metrics();
|
||||
AsyncPanZoomController* apzc = aContent.GetApzc();
|
||||
|
||||
Matrix4x4 asyncTransform = apzc->GetCurrentAsyncTransform();
|
||||
AsyncTransformComponentMatrix asyncTransform = apzc->GetCurrentAsyncTransform();
|
||||
|
||||
// |asyncTransform| represents the amount by which we have scrolled and
|
||||
// zoomed since the last paint. Because the scrollbar was sized and positioned based
|
||||
// on the painted content, we need to adjust it based on asyncTransform so that
|
||||
// it reflects what the user is actually seeing now.
|
||||
Matrix4x4 scrollbarTransform;
|
||||
AsyncTransformComponentMatrix scrollbarTransform;
|
||||
if (aScrollbar->GetScrollbarDirection() == Layer::VERTICAL) {
|
||||
const ParentLayerCoord asyncScrollY = asyncTransform._42;
|
||||
const float asyncZoomY = asyncTransform._22;
|
||||
@@ -1106,9 +1111,10 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
|
||||
scrollbarTransform.PostTranslate(xTranslation, 0, 0);
|
||||
}
|
||||
|
||||
Matrix4x4 transform = aScrollbar->GetLocalTransform() * scrollbarTransform;
|
||||
LayerToParentLayerMatrix4x4 transform =
|
||||
aScrollbar->GetLocalTransformTyped() * scrollbarTransform;
|
||||
|
||||
Matrix4x4 compensation;
|
||||
AsyncTransformComponentMatrix compensation;
|
||||
// If the scrollbar layer is for the root then the content's resolution
|
||||
// applies to the scrollbar as well. Since we don't actually want the scroll
|
||||
// thumb's size to vary with the zoom (other than its length reflecting the
|
||||
@@ -1116,9 +1122,10 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
|
||||
// above), we apply a transform to cancel out this resolution.
|
||||
if (metrics.IsRootContent()) {
|
||||
compensation =
|
||||
Matrix4x4::Scaling(metrics.GetPresShellResolution(),
|
||||
metrics.GetPresShellResolution(),
|
||||
1.0f).Inverse();
|
||||
AsyncTransformComponentMatrix::Scaling(
|
||||
metrics.GetPresShellResolution(),
|
||||
metrics.GetPresShellResolution(),
|
||||
1.0f).Inverse();
|
||||
}
|
||||
// If the scrollbar layer is a child of the content it is a scrollbar for,
|
||||
// then we need to adjust for any async transform (including an overscroll
|
||||
@@ -1132,13 +1139,15 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
|
||||
// the same coordinate space. This requires applying the content transform
|
||||
// and then unapplying it after unapplying the async transform.
|
||||
if (aScrollbarIsDescendant) {
|
||||
Matrix4x4 asyncUntransform = (asyncTransform * apzc->GetOverscrollTransform()).Inverse();
|
||||
Matrix4x4 asyncUntransform = (asyncTransform * apzc->GetOverscrollTransform()).Inverse().ToUnknownMatrix();
|
||||
Matrix4x4 contentTransform = aContent.GetTransform();
|
||||
Matrix4x4 contentUntransform = contentTransform.Inverse();
|
||||
|
||||
Matrix4x4 asyncCompensation = contentTransform
|
||||
* asyncUntransform
|
||||
* contentUntransform;
|
||||
AsyncTransformComponentMatrix asyncCompensation =
|
||||
ViewAs<AsyncTransformComponentMatrix>(
|
||||
contentTransform
|
||||
* asyncUntransform
|
||||
* contentUntransform);
|
||||
|
||||
compensation = compensation * asyncCompensation;
|
||||
|
||||
@@ -1147,7 +1156,7 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
|
||||
// including the layer with the async transform. Otherwise the scrollbar
|
||||
// shifts but gets clipped and so appears to flicker.
|
||||
for (Layer* ancestor = aScrollbar; ancestor != aContent.GetLayer(); ancestor = ancestor->GetParent()) {
|
||||
TransformClipRect(ancestor, ViewAs<ParentLayerToParentLayerMatrix4x4>(asyncCompensation));
|
||||
TransformClipRect(ancestor, asyncCompensation);
|
||||
}
|
||||
}
|
||||
transform = transform * compensation;
|
||||
@@ -1236,7 +1245,8 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
|
||||
// We must apply the resolution scale before a pan/zoom transform, so we call
|
||||
// GetTransform here.
|
||||
Matrix4x4 oldTransform = aLayer->GetTransform();
|
||||
LayerToParentLayerMatrix4x4 oldTransform = aLayer->GetTransformTyped() *
|
||||
AsyncTransformMatrix();
|
||||
|
||||
CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
|
||||
|
||||
@@ -1295,13 +1305,13 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
|
||||
LayerToParentLayerScale asyncZoom = userZoom / metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
|
||||
ParentLayerPoint translation = userRect.TopLeft() - geckoScroll;
|
||||
Matrix4x4 treeTransform = AsyncTransform(asyncZoom, -translation);
|
||||
AsyncTransformComponentMatrix treeTransform = AsyncTransform(asyncZoom, -translation);
|
||||
|
||||
// Apply the tree transform on top of GetLocalTransform() here (rather than
|
||||
// GetTransform()) in case the OMTA code in SampleAnimations already set a
|
||||
// shadow transform; in that case we want to apply ours on top of that one
|
||||
// rather than clobber it.
|
||||
SetShadowTransform(aLayer, aLayer->GetLocalTransform() * treeTransform);
|
||||
SetShadowTransform(aLayer, aLayer->GetLocalTransformTyped() * treeTransform);
|
||||
|
||||
// Make sure that overscroll and under-zoom are represented in the old
|
||||
// transform so that fixed position content moves and scales accordingly.
|
||||
@@ -1338,8 +1348,8 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
// Make sure fixed position layers don't move away from their anchor points
|
||||
// when we're asynchronously panning or zooming
|
||||
AlignFixedAndStickyLayers(aLayer, aLayer, metrics.GetScrollId(), oldTransform,
|
||||
aLayer->GetLocalTransform(), fixedLayerMargins,
|
||||
false);
|
||||
aLayer->GetLocalTransformTyped(),
|
||||
fixedLayerMargins, false);
|
||||
|
||||
ExpandRootClipRect(aLayer, fixedLayerMargins);
|
||||
}
|
||||
|
||||
@@ -36,17 +36,10 @@ struct AsyncTransform {
|
||||
, mTranslation(aTranslation)
|
||||
{}
|
||||
|
||||
operator gfx::Matrix4x4() const
|
||||
operator AsyncTransformComponentMatrix() const
|
||||
{
|
||||
return
|
||||
gfx::Matrix4x4::Scaling(mScale.scale, mScale.scale, 1)
|
||||
.PostTranslate(mTranslation.x, mTranslation.y, 0);
|
||||
}
|
||||
|
||||
// For convenience, to avoid writing the cumbersome
|
||||
// "gfx::Matrix4x4(a) * gfx::Matrix4x4(b)".
|
||||
friend gfx::Matrix4x4 operator*(const AsyncTransform& a, const AsyncTransform& b) {
|
||||
return gfx::Matrix4x4(a) * gfx::Matrix4x4(b);
|
||||
return AsyncTransformComponentMatrix::Scaling(mScale.scale, mScale.scale, 1)
|
||||
.PostTranslate(mTranslation.x, mTranslation.y, 0);
|
||||
}
|
||||
|
||||
bool operator==(const AsyncTransform& rhs) const {
|
||||
@@ -184,8 +177,8 @@ private:
|
||||
*/
|
||||
void AlignFixedAndStickyLayers(Layer* aLayer, Layer* aTransformedSubtreeRoot,
|
||||
FrameMetrics::ViewID aTransformScrollId,
|
||||
const gfx::Matrix4x4& aPreviousTransformForRoot,
|
||||
const gfx::Matrix4x4& aCurrentTransformForRoot,
|
||||
const LayerToParentLayerMatrix4x4& aPreviousTransformForRoot,
|
||||
const LayerToParentLayerMatrix4x4& aCurrentTransformForRoot,
|
||||
const ScreenMargin& aFixedLayerMargins,
|
||||
bool aTransformAffectsLayerClip);
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ RenderLayers(ContainerT* aContainer,
|
||||
gfx::Rect(aClipRect.ToUnknownRect()),
|
||||
asyncTransform * aContainer->GetEffectiveTransform());
|
||||
if (AsyncPanZoomController* apzc = layer->GetAsyncPanZoomController(i - 1)) {
|
||||
asyncTransform = apzc->GetCurrentAsyncTransformWithOverscroll()
|
||||
asyncTransform = apzc->GetCurrentAsyncTransformWithOverscroll().ToUnknownMatrix()
|
||||
* asyncTransform;
|
||||
}
|
||||
}
|
||||
@@ -758,7 +758,7 @@ ContainerRender(ContainerT* aContainer,
|
||||
for (LayerMetricsWrapper i(aContainer); i; i = i.GetFirstChild()) {
|
||||
if (AsyncPanZoomController* apzc = i.GetApzc()) {
|
||||
if (!apzc->GetAsyncTransformAppliedToContent()
|
||||
&& !Matrix4x4(apzc->GetCurrentAsyncTransform()).IsIdentity()) {
|
||||
&& !AsyncTransformComponentMatrix(apzc->GetCurrentAsyncTransform()).IsIdentity()) {
|
||||
aManager->UnusedApzTransformWarning();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -731,13 +731,13 @@ D3D11TextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (D3D11).";
|
||||
return false;
|
||||
}
|
||||
|
||||
DataSourceSurface::MappedSurface sourceMap;
|
||||
if (!srcSurf->Map(DataSourceSurface::READ, &sourceMap)) {
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface (D3D11).";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -764,13 +764,13 @@ D3D10TextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (D3D10).";
|
||||
return false;
|
||||
}
|
||||
|
||||
DataSourceSurface::MappedSurface sourceMap;
|
||||
if (!srcSurf->Map(DataSourceSurface::READ, &sourceMap)) {
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface (D3D10).";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1262,7 +1262,7 @@ SyncObjectD3D11::FinalizeFrame()
|
||||
if (FAILED(hr) || !mutex) {
|
||||
// Leave both the critical error and MOZ_CRASH for now; the critical error lets
|
||||
// us "save" the hr value. We will probably eventuall replace this with gfxDevCrash.
|
||||
gfxCriticalError() << "Failed to get KeyedMutex: " << hexa(hr);
|
||||
gfxCriticalError() << "Failed to get KeyedMutex (1): " << hexa(hr);
|
||||
MOZ_CRASH("GFX: Cannot get D3D10 KeyedMutex");
|
||||
}
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ SyncObjectD3D11::FinalizeFrame()
|
||||
if (FAILED(hr) || !mutex) {
|
||||
// Leave both the critical error and MOZ_CRASH for now; the critical error lets
|
||||
// us "save" the hr value. We will probably eventuall replace this with gfxDevCrash.
|
||||
gfxCriticalError() << "Failed to get KeyedMutex: " << hexa(hr);
|
||||
gfxCriticalError() << "Failed to get KeyedMutex (2): " << hexa(hr);
|
||||
MOZ_CRASH("GFX: Cannot get D3D11 KeyedMutex");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,13 +359,13 @@ DeviceManagerD3D9::Init()
|
||||
mNv3DVUtils->SetDeviceInfo(devUnknown);
|
||||
}
|
||||
|
||||
auto failCreateShaderMsg = "[D3D9] failed to create a critical resource (shader) code: ";
|
||||
auto failCreateShaderMsg = "[D3D9] failed to create a critical resource (shader) code";
|
||||
|
||||
hr = mDevice->CreateVertexShader((DWORD*)LayerQuadVS,
|
||||
getter_AddRefs(mLayerVS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "LayerQuadVS: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mRGBPS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "RGBShaderPS: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mRGBAPS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "RGBAShaderPS: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mComponentPass1PS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "ComponentPass1ShaderPS: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mComponentPass2PS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "ComponentPass2ShaderPS: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mYCbCrPS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "YCbCrShaderPS: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mSolidColorPS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg;
|
||||
gfxCriticalError() << failCreateShaderMsg << "SolidColorShaderPS" << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -421,14 +421,14 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mLayerVSMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "LayerQuadVSMask: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
hr = mDevice->CreateVertexShader((DWORD*)LayerQuadVSMask3D,
|
||||
getter_AddRefs(mLayerVSMask3D));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "LayerQuadVSMask3D: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mRGBPSMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "RGBShaderPSMask " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mRGBAPSMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "RGBAShaderPSMask: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mRGBAPSMask3D));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "RGBAShaderPSMask3D: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mComponentPass1PSMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "ComponentPass1ShaderPSMask: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mComponentPass2PSMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg;
|
||||
gfxCriticalError() << failCreateShaderMsg << "ComponentPass2ShaderPSMask: ";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mYCbCrPSMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "YCbCrShaderPSMask: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ DeviceManagerD3D9::Init()
|
||||
getter_AddRefs(mSolidColorPSMask));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalError() << failCreateShaderMsg << gfx::hexa(hr);
|
||||
gfxCriticalError() << failCreateShaderMsg << "SolidColorShaderPSMask: " << gfx::hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -553,7 +553,7 @@ D3D9TextureData::BorrowDrawTarget()
|
||||
D3DLOCKED_RECT rect;
|
||||
HRESULT hr = mD3D9Surface->LockRect(&rect, nullptr, 0);
|
||||
if (FAILED(hr) || !rect.pBits) {
|
||||
gfxCriticalError() << "Failed to lock rect borrowing the target in D3D9 " << hexa(hr);
|
||||
gfxCriticalError() << "Failed to lock rect borrowing the target in D3D9 (BDT) " << hexa(hr);
|
||||
return nullptr;
|
||||
}
|
||||
dt = gfxPlatform::GetPlatform()->CreateDrawTargetForData((uint8_t*)rect.pBits, mSize,
|
||||
@@ -588,21 +588,21 @@ D3D9TextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
D3DLOCKED_RECT rect;
|
||||
HRESULT hr = mD3D9Surface->LockRect(&rect, nullptr, 0);
|
||||
if (FAILED(hr) || !rect.pBits) {
|
||||
gfxCriticalError() << "Failed to lock rect borrowing the target in D3D9 " << hexa(hr);
|
||||
gfxCriticalError() << "Failed to lock rect borrowing the target in D3D9 (UFS) " << hexa(hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (D3D9).";
|
||||
mD3D9Surface->UnlockRect();
|
||||
return false;
|
||||
}
|
||||
|
||||
DataSourceSurface::MappedSurface sourceMap;
|
||||
if (!srcSurf->Map(DataSourceSurface::READ, &sourceMap)) {
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface (D3D9).";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ GrallocTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
RefPtr<DataSourceSurface> srcSurf = aSurface->GetDataSurface();
|
||||
|
||||
if (!srcSurf) {
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (GTC).";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ GrallocTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
|
||||
DataSourceSurface::MappedSurface sourceMap;
|
||||
|
||||
if (!srcSurf->Map(DataSourceSurface::READ, &sourceMap)) {
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface.";
|
||||
gfxCriticalError() << "Failed to map source surface for UpdateFromSurface (GTC).";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1777,7 +1777,7 @@ CheckForAdapterMismatch(ID3D11Device *device)
|
||||
nsresult ec;
|
||||
int32_t vendor = vendorID.ToInteger(&ec, 16);
|
||||
if (vendor != desc.VendorId) {
|
||||
gfxCriticalNote << "VendorIDMismatch " << hexa(vendor) << " " << hexa(desc.VendorId);
|
||||
gfxCriticalNote << "VendorIDMismatch V " << hexa(vendor) << " " << hexa(desc.VendorId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2265,7 +2265,7 @@ gfxWindowsPlatform::ContentAdapterIsParentAdapter(ID3D11Device* device)
|
||||
desc.AdapterLuid.HighPart != parent.AdapterLuid.HighPart ||
|
||||
desc.AdapterLuid.LowPart != parent.AdapterLuid.LowPart)
|
||||
{
|
||||
gfxCriticalNote << "VendorIDMismatch " << hexa(parent.VendorId) << " " << hexa(desc.VendorId);
|
||||
gfxCriticalNote << "VendorIDMismatch P " << hexa(parent.VendorId) << " " << hexa(desc.VendorId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ LayerActivity::~LayerActivity()
|
||||
}
|
||||
|
||||
// Frames with this property have NS_FRAME_HAS_LAYER_ACTIVITY_PROPERTY set
|
||||
NS_DECLARE_FRAME_PROPERTY(LayerActivityProperty, DeleteValue<LayerActivity>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(LayerActivityProperty, LayerActivity)
|
||||
|
||||
void
|
||||
LayerActivityTracker::NotifyExpired(LayerActivity* aObject)
|
||||
@@ -188,15 +188,14 @@ GetLayerActivity(nsIFrame* aFrame)
|
||||
return nullptr;
|
||||
}
|
||||
FrameProperties properties = aFrame->Properties();
|
||||
return static_cast<LayerActivity*>(properties.Get(LayerActivityProperty()));
|
||||
return properties.Get(LayerActivityProperty());
|
||||
}
|
||||
|
||||
static LayerActivity*
|
||||
GetLayerActivityForUpdate(nsIFrame* aFrame)
|
||||
{
|
||||
FrameProperties properties = aFrame->Properties();
|
||||
LayerActivity* layerActivity =
|
||||
static_cast<LayerActivity*>(properties.Get(LayerActivityProperty()));
|
||||
LayerActivity* layerActivity = properties.Get(LayerActivityProperty());
|
||||
if (layerActivity) {
|
||||
gLayerActivityTracker->MarkUsed(layerActivity);
|
||||
} else {
|
||||
@@ -224,8 +223,7 @@ ActiveLayerTracker::TransferActivityToContent(nsIFrame* aFrame, nsIContent* aCon
|
||||
return;
|
||||
}
|
||||
FrameProperties properties = aFrame->Properties();
|
||||
LayerActivity* layerActivity =
|
||||
static_cast<LayerActivity*>(properties.Remove(LayerActivityProperty()));
|
||||
LayerActivity* layerActivity = properties.Remove(LayerActivityProperty());
|
||||
aFrame->RemoveStateBits(NS_FRAME_HAS_LAYER_ACTIVITY_PROPERTY);
|
||||
if (!layerActivity) {
|
||||
return;
|
||||
|
||||
@@ -1710,23 +1710,21 @@ GetTranslationForPaintedLayer(PaintedLayer* aLayer)
|
||||
|
||||
/* static */ void
|
||||
FrameLayerBuilder::RemoveFrameFromLayerManager(const nsIFrame* aFrame,
|
||||
void* aPropertyValue)
|
||||
nsTArray<DisplayItemData*>* aArray)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(!sDestroyedFrame);
|
||||
sDestroyedFrame = aFrame;
|
||||
nsTArray<DisplayItemData*> *array =
|
||||
reinterpret_cast<nsTArray<DisplayItemData*>*>(aPropertyValue);
|
||||
|
||||
// Hold a reference to all the items so that they don't get
|
||||
// deleted from under us.
|
||||
nsTArray<RefPtr<DisplayItemData> > arrayCopy;
|
||||
for (uint32_t i = 0; i < array->Length(); ++i) {
|
||||
arrayCopy.AppendElement(array->ElementAt(i));
|
||||
for (DisplayItemData* data : *aArray) {
|
||||
arrayCopy.AppendElement(data);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DISPLAY_ITEM_DATA
|
||||
if (array->Length()) {
|
||||
LayerManagerData *rootData = array->ElementAt(0)->mParent;
|
||||
if (aArray->Length()) {
|
||||
LayerManagerData *rootData = aArray->ElementAt(0)->mParent;
|
||||
while (rootData->mParent) {
|
||||
rootData = rootData->mParent;
|
||||
}
|
||||
@@ -1735,9 +1733,7 @@ FrameLayerBuilder::RemoveFrameFromLayerManager(const nsIFrame* aFrame,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0; i < array->Length(); ++i) {
|
||||
DisplayItemData* data = array->ElementAt(i);
|
||||
|
||||
for (DisplayItemData* data : *aArray) {
|
||||
PaintedLayer* t = data->mLayer->AsPaintedLayer();
|
||||
if (t) {
|
||||
PaintedDisplayItemLayerUserData* paintedData =
|
||||
@@ -1755,7 +1751,7 @@ FrameLayerBuilder::RemoveFrameFromLayerManager(const nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
arrayCopy.Clear();
|
||||
delete array;
|
||||
delete aArray;
|
||||
sDestroyedFrame = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -410,6 +410,7 @@ public:
|
||||
void StoreOptimizedLayerForFrame(nsDisplayItem* aItem, Layer* aLayer);
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_FRAME_IN_DTOR(LayerManagerDataProperty,
|
||||
nsTArray<DisplayItemData*>,
|
||||
RemoveFrameFromLayerManager)
|
||||
|
||||
/**
|
||||
@@ -514,7 +515,8 @@ protected:
|
||||
|
||||
friend class LayerManagerData;
|
||||
|
||||
static void RemoveFrameFromLayerManager(const nsIFrame* aFrame, void* aPropertyValue);
|
||||
static void RemoveFrameFromLayerManager(const nsIFrame* aFrame,
|
||||
nsTArray<DisplayItemData*>* aArray);
|
||||
|
||||
/**
|
||||
* Given a frame and a display item key that uniquely identifies a
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
namespace mozilla {
|
||||
|
||||
void
|
||||
FramePropertyTable::Set(const nsIFrame* aFrame,
|
||||
const FramePropertyDescriptor* aProperty,
|
||||
void* aValue)
|
||||
FramePropertyTable::SetInternal(
|
||||
const nsIFrame* aFrame, UntypedDescriptor aProperty, void* aValue)
|
||||
{
|
||||
NS_ASSERTION(aFrame, "Null frame?");
|
||||
NS_ASSERTION(aProperty, "Null property?");
|
||||
@@ -60,9 +59,8 @@ FramePropertyTable::Set(const nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
void*
|
||||
FramePropertyTable::Get(const nsIFrame* aFrame,
|
||||
const FramePropertyDescriptor* aProperty,
|
||||
bool* aFoundResult)
|
||||
FramePropertyTable::GetInternal(
|
||||
const nsIFrame* aFrame, UntypedDescriptor aProperty, bool* aFoundResult)
|
||||
{
|
||||
NS_ASSERTION(aFrame, "Null frame?");
|
||||
NS_ASSERTION(aProperty, "Null property?");
|
||||
@@ -104,9 +102,8 @@ FramePropertyTable::Get(const nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
void*
|
||||
FramePropertyTable::Remove(const nsIFrame* aFrame,
|
||||
const FramePropertyDescriptor* aProperty,
|
||||
bool* aFoundResult)
|
||||
FramePropertyTable::RemoveInternal(
|
||||
const nsIFrame* aFrame, UntypedDescriptor aProperty, bool* aFoundResult)
|
||||
{
|
||||
NS_ASSERTION(aFrame, "Null frame?");
|
||||
NS_ASSERTION(aProperty, "Null property?");
|
||||
@@ -166,14 +163,14 @@ FramePropertyTable::Remove(const nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
void
|
||||
FramePropertyTable::Delete(const nsIFrame* aFrame,
|
||||
const FramePropertyDescriptor* aProperty)
|
||||
FramePropertyTable::DeleteInternal(
|
||||
const nsIFrame* aFrame, UntypedDescriptor aProperty)
|
||||
{
|
||||
NS_ASSERTION(aFrame, "Null frame?");
|
||||
NS_ASSERTION(aProperty, "Null property?");
|
||||
|
||||
bool found;
|
||||
void* v = Remove(aFrame, aProperty, &found);
|
||||
void* v = RemoveInternal(aFrame, aProperty, &found);
|
||||
if (found) {
|
||||
PropertyValue pv(aProperty, v);
|
||||
pv.DestroyValueFor(aFrame);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef FRAMEPROPERTYTABLE_H_
|
||||
#define FRAMEPROPERTYTABLE_H_
|
||||
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
@@ -15,28 +16,13 @@ class nsIFrame;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct FramePropertyDescriptor;
|
||||
|
||||
typedef void (*FramePropertyDestructor)(void* aPropertyValue);
|
||||
typedef void (*FramePropertyDestructorWithFrame)(const nsIFrame* aFrame,
|
||||
void* aPropertyValue);
|
||||
|
||||
/**
|
||||
* A pointer to a FramePropertyDescriptor serves as a unique property ID.
|
||||
* The FramePropertyDescriptor stores metadata about the property.
|
||||
* Currently the only metadata is a destructor function. The destructor
|
||||
* function is called on property values when they are overwritten or
|
||||
* deleted.
|
||||
*
|
||||
* To use this class, declare a global (i.e., file, class or function-scope
|
||||
* static member) FramePropertyDescriptor and pass its address as
|
||||
* aProperty in the FramePropertyTable methods.
|
||||
*/
|
||||
struct FramePropertyDescriptor {
|
||||
struct FramePropertyDescriptorUntyped
|
||||
{
|
||||
/**
|
||||
* mDestructor will be called if it's non-null.
|
||||
*/
|
||||
FramePropertyDestructor mDestructor;
|
||||
typedef void UntypedDestructor(void* aPropertyValue);
|
||||
UntypedDestructor* mDestructor;
|
||||
/**
|
||||
* mDestructorWithFrame will be called if it's non-null and mDestructor
|
||||
* is null. WARNING: The frame passed to mDestructorWithFrame may
|
||||
@@ -45,13 +31,104 @@ struct FramePropertyDescriptor {
|
||||
* other frame pointers. No frame will have been allocated with
|
||||
* the same address yet.
|
||||
*/
|
||||
FramePropertyDestructorWithFrame mDestructorWithFrame;
|
||||
typedef void UntypedDestructorWithFrame(const nsIFrame* aFrame,
|
||||
void* aPropertyValue);
|
||||
UntypedDestructorWithFrame* mDestructorWithFrame;
|
||||
/**
|
||||
* mDestructor and mDestructorWithFrame may both be null, in which case
|
||||
* no value destruction is a no-op.
|
||||
*/
|
||||
|
||||
protected:
|
||||
/**
|
||||
* At most one destructor should be passed in. In general, you should
|
||||
* just use the static function FramePropertyDescriptor::New* below
|
||||
* instead of using this constructor directly.
|
||||
*/
|
||||
MOZ_CONSTEXPR FramePropertyDescriptorUntyped(
|
||||
UntypedDestructor* aDtor, UntypedDestructorWithFrame* aDtorWithFrame)
|
||||
: mDestructor(aDtor)
|
||||
, mDestructorWithFrame(aDtorWithFrame)
|
||||
{}
|
||||
};
|
||||
|
||||
/**
|
||||
* A pointer to a FramePropertyDescriptor serves as a unique property ID.
|
||||
* The FramePropertyDescriptor stores metadata about the property.
|
||||
* Currently the only metadata is a destructor function. The destructor
|
||||
* function is called on property values when they are overwritten or
|
||||
* deleted.
|
||||
*
|
||||
* To use this class, declare a global (i.e., file, class or function-scope
|
||||
* static member) FramePropertyDescriptor and pass its address as
|
||||
* aProperty in the FramePropertyTable methods.
|
||||
*/
|
||||
template<typename T>
|
||||
struct FramePropertyDescriptor : public FramePropertyDescriptorUntyped
|
||||
{
|
||||
typedef void Destructor(T* aPropertyValue);
|
||||
typedef void DestructorWithFrame(const nsIFrame* aaFrame,
|
||||
T* aPropertyValue);
|
||||
|
||||
template<Destructor Dtor>
|
||||
static MOZ_CONSTEXPR const FramePropertyDescriptor<T> NewWithDestructor()
|
||||
{
|
||||
return { Destruct<Dtor>, nullptr };
|
||||
}
|
||||
|
||||
template<DestructorWithFrame Dtor>
|
||||
static MOZ_CONSTEXPR
|
||||
const FramePropertyDescriptor<T> NewWithDestructorWithFrame()
|
||||
{
|
||||
return { nullptr, DestructWithFrame<Dtor> };
|
||||
}
|
||||
|
||||
static MOZ_CONSTEXPR const FramePropertyDescriptor<T> NewWithoutDestructor()
|
||||
{
|
||||
return { nullptr, nullptr };
|
||||
}
|
||||
|
||||
private:
|
||||
MOZ_CONSTEXPR FramePropertyDescriptor(
|
||||
UntypedDestructor* aDtor, UntypedDestructorWithFrame* aDtorWithFrame)
|
||||
: FramePropertyDescriptorUntyped(aDtor, aDtorWithFrame)
|
||||
{}
|
||||
|
||||
template<Destructor Dtor>
|
||||
static void Destruct(void* aPropertyValue)
|
||||
{
|
||||
Dtor(static_cast<T*>(aPropertyValue));
|
||||
}
|
||||
|
||||
template<DestructorWithFrame Dtor>
|
||||
static void DestructWithFrame(const nsIFrame* aFrame, void* aPropertyValue)
|
||||
{
|
||||
Dtor(aFrame, static_cast<T*>(aPropertyValue));
|
||||
}
|
||||
};
|
||||
|
||||
// SmallValueHolder<T> is a placeholder intended to be used as template
|
||||
// argument of FramePropertyDescriptor for types which can fit into the
|
||||
// size of a pointer directly. This class should never be defined, so
|
||||
// that we won't use it for unexpected purpose by mistake.
|
||||
template<typename T>
|
||||
class SmallValueHolder;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
struct FramePropertyTypeHelper
|
||||
{
|
||||
typedef T* Type;
|
||||
};
|
||||
template<typename T>
|
||||
struct FramePropertyTypeHelper<SmallValueHolder<T>>
|
||||
{
|
||||
typedef T Type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The FramePropertyTable is optimized for storing 0 or 1 properties on
|
||||
* a given frame. Storing very large numbers of properties on a single
|
||||
@@ -65,6 +142,13 @@ struct FramePropertyDescriptor {
|
||||
*/
|
||||
class FramePropertyTable {
|
||||
public:
|
||||
template<typename T>
|
||||
using Descriptor = const FramePropertyDescriptor<T>*;
|
||||
using UntypedDescriptor = const FramePropertyDescriptorUntyped*;
|
||||
|
||||
template<typename T>
|
||||
using PropertyType = typename detail::FramePropertyTypeHelper<T>::Type;
|
||||
|
||||
FramePropertyTable() : mLastFrame(nullptr), mLastEntry(nullptr)
|
||||
{
|
||||
}
|
||||
@@ -79,40 +163,64 @@ public:
|
||||
* the properties of that frame. Any existing value for the property
|
||||
* is destroyed.
|
||||
*/
|
||||
void Set(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
|
||||
void* aValue);
|
||||
template<typename T>
|
||||
void Set(const nsIFrame* aFrame, Descriptor<T> aProperty,
|
||||
PropertyType<T> aValue)
|
||||
{
|
||||
ReinterpretHelper<T> helper{};
|
||||
helper.value = aValue;
|
||||
SetInternal(aFrame, aProperty, helper.ptr);
|
||||
}
|
||||
/**
|
||||
* Get a property value for a frame. This requires one hashtable
|
||||
* lookup (using the frame as the key) and a linear search through
|
||||
* the properties of that frame. If the frame has no such property,
|
||||
* returns null.
|
||||
* returns zero-filled result, which means null for pointers and
|
||||
* zero for integers and floating point types.
|
||||
* @param aFoundResult if non-null, receives a value 'true' iff
|
||||
* the frame has a value for the property. This lets callers
|
||||
* disambiguate a null result, which can mean 'no such property' or
|
||||
* 'property value is null'.
|
||||
*/
|
||||
void* Get(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
|
||||
bool* aFoundResult = nullptr);
|
||||
template<typename T>
|
||||
PropertyType<T> Get(const nsIFrame* aFrame, Descriptor<T> aProperty,
|
||||
bool* aFoundResult = nullptr)
|
||||
{
|
||||
ReinterpretHelper<T> helper;
|
||||
helper.ptr = GetInternal(aFrame, aProperty, aFoundResult);
|
||||
return helper.value;
|
||||
}
|
||||
/**
|
||||
* Remove a property value for a frame. This requires one hashtable
|
||||
* lookup (using the frame as the key) and a linear search through
|
||||
* the properties of that frame. The old property value is returned
|
||||
* (and not destroyed). If the frame has no such property,
|
||||
* returns null.
|
||||
* returns zero-filled result, which means null for pointers and
|
||||
* zero for integers and floating point types.
|
||||
* @param aFoundResult if non-null, receives a value 'true' iff
|
||||
* the frame had a value for the property. This lets callers
|
||||
* disambiguate a null result, which can mean 'no such property' or
|
||||
* 'property value is null'.
|
||||
*/
|
||||
void* Remove(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
|
||||
bool* aFoundResult = nullptr);
|
||||
template<typename T>
|
||||
PropertyType<T> Remove(const nsIFrame* aFrame, Descriptor<T> aProperty,
|
||||
bool* aFoundResult = nullptr)
|
||||
{
|
||||
ReinterpretHelper<T> helper;
|
||||
helper.ptr = RemoveInternal(aFrame, aProperty, aFoundResult);
|
||||
return helper.value;
|
||||
}
|
||||
/**
|
||||
* Remove and destroy a property value for a frame. This requires one
|
||||
* hashtable lookup (using the frame as the key) and a linear search
|
||||
* through the properties of that frame. If the frame has no such
|
||||
* property, nothing happens.
|
||||
*/
|
||||
void Delete(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty);
|
||||
template<typename T>
|
||||
void Delete(const nsIFrame* aFrame, Descriptor<T> aProperty)
|
||||
{
|
||||
DeleteInternal(aFrame, aProperty);
|
||||
}
|
||||
/**
|
||||
* Remove and destroy all property values for a frame. This requires one
|
||||
* hashtable lookup (using the frame as the key).
|
||||
@@ -126,23 +234,47 @@ public:
|
||||
/**
|
||||
* Check if a property exists (added for TenFourFox issue 493).
|
||||
*/
|
||||
bool Has(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty)
|
||||
template<typename T>
|
||||
bool Has(const nsIFrame* aFrame, Descriptor<T> aProperty)
|
||||
{
|
||||
bool foundResult = false;
|
||||
(void)Get(aFrame, aProperty, &foundResult);
|
||||
mozilla::Unused << GetInternal(aFrame, aProperty, &foundResult);
|
||||
return foundResult;
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
protected:
|
||||
void SetInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty,
|
||||
void* aValue);
|
||||
|
||||
void* GetInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty,
|
||||
bool* aFoundResult);
|
||||
|
||||
void* RemoveInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty,
|
||||
bool* aFoundResult);
|
||||
|
||||
void DeleteInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty);
|
||||
|
||||
// A helper union being used here rather than simple reinterpret_cast
|
||||
// is because PropertyType<T> could be float, bool, uint8_t, etc.
|
||||
// which do not have defined behavior for a direct cast.
|
||||
template<typename T>
|
||||
union ReinterpretHelper
|
||||
{
|
||||
void* ptr;
|
||||
PropertyType<T> value;
|
||||
static_assert(sizeof(PropertyType<T>) <= sizeof(void*),
|
||||
"size of the value must never be larger than a pointer");
|
||||
};
|
||||
|
||||
/**
|
||||
* Stores a property descriptor/value pair. It can also be used to
|
||||
* store an nsTArray of PropertyValues.
|
||||
*/
|
||||
struct PropertyValue {
|
||||
PropertyValue() : mProperty(nullptr), mValue(nullptr) {}
|
||||
PropertyValue(const FramePropertyDescriptor* aProperty, void* aValue)
|
||||
PropertyValue(UntypedDescriptor aProperty, void* aValue)
|
||||
: mProperty(aProperty), mValue(aValue) {}
|
||||
|
||||
bool IsArray() { return !mProperty && mValue; }
|
||||
@@ -174,7 +306,7 @@ protected:
|
||||
return n;
|
||||
}
|
||||
|
||||
const FramePropertyDescriptor* mProperty;
|
||||
UntypedDescriptor mProperty;
|
||||
void* mValue;
|
||||
};
|
||||
|
||||
@@ -187,10 +319,10 @@ protected:
|
||||
bool Equals(const PropertyValue& a, const PropertyValue& b) const {
|
||||
return a.mProperty == b.mProperty;
|
||||
}
|
||||
bool Equals(const FramePropertyDescriptor* a, const PropertyValue& b) const {
|
||||
bool Equals(UntypedDescriptor a, const PropertyValue& b) const {
|
||||
return a == b.mProperty;
|
||||
}
|
||||
bool Equals(const PropertyValue& a, const FramePropertyDescriptor* b) const {
|
||||
bool Equals(const PropertyValue& a, UntypedDescriptor b) const {
|
||||
return a.mProperty == b;
|
||||
}
|
||||
};
|
||||
@@ -225,33 +357,39 @@ protected:
|
||||
*/
|
||||
class FrameProperties {
|
||||
public:
|
||||
template<typename T> using Descriptor = FramePropertyTable::Descriptor<T>;
|
||||
template<typename T> using PropertyType = FramePropertyTable::PropertyType<T>;
|
||||
|
||||
FrameProperties(FramePropertyTable* aTable, const nsIFrame* aFrame)
|
||||
: mTable(aTable), mFrame(aFrame) {}
|
||||
|
||||
void Set(const FramePropertyDescriptor* aProperty, void* aValue) const
|
||||
template<typename T>
|
||||
void Set(Descriptor<T> aProperty, PropertyType<T> aValue) const
|
||||
{
|
||||
mTable->Set(mFrame, aProperty, aValue);
|
||||
}
|
||||
void* Get(const FramePropertyDescriptor* aProperty,
|
||||
bool* aFoundResult = nullptr) const
|
||||
template<typename T>
|
||||
PropertyType<T> Get(Descriptor<T> aProperty,
|
||||
bool* aFoundResult = nullptr) const
|
||||
{
|
||||
return mTable->Get(mFrame, aProperty, aFoundResult);
|
||||
}
|
||||
void* Remove(const FramePropertyDescriptor* aProperty,
|
||||
bool* aFoundResult = nullptr) const
|
||||
template<typename T>
|
||||
PropertyType<T> Remove(Descriptor<T> aProperty,
|
||||
bool* aFoundResult = nullptr) const
|
||||
{
|
||||
return mTable->Remove(mFrame, aProperty, aFoundResult);
|
||||
}
|
||||
void Delete(const FramePropertyDescriptor* aProperty)
|
||||
template<typename T>
|
||||
void Delete(Descriptor<T> aProperty)
|
||||
{
|
||||
mTable->Delete(mFrame, aProperty);
|
||||
}
|
||||
// TenFourFox issue 493
|
||||
bool Has(const FramePropertyDescriptor* aProperty)
|
||||
|
||||
template<typename T>
|
||||
bool Has(Descriptor<T> aProperty) const
|
||||
{
|
||||
bool foundResult;
|
||||
(void)mTable->Get(mFrame, aProperty, &foundResult);
|
||||
return foundResult;
|
||||
return mTable->Has(mFrame, aProperty);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -642,7 +642,7 @@ RestyleManager::AddSubtreeToOverflowTracker(nsIFrame* aFrame)
|
||||
}
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(ChangeListProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(ChangeListProperty, bool)
|
||||
|
||||
/**
|
||||
* Return true if aFrame's subtree has placeholders for out-of-flow content
|
||||
@@ -735,8 +735,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||
const nsStyleChangeData* changeData;
|
||||
aChangeList.ChangeAt(index, &changeData);
|
||||
if (changeData->mFrame) {
|
||||
propTable->Set(changeData->mFrame, ChangeListProperty(),
|
||||
NS_INT32_TO_PTR(1));
|
||||
propTable->Set(changeData->mFrame, ChangeListProperty(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,13 +128,9 @@ public:
|
||||
// Take a faster path that doesn't require unioning the overflow areas
|
||||
// of our children.
|
||||
|
||||
#ifdef DEBUG
|
||||
bool hasInitialOverflowPropertyApplied = false;
|
||||
frame->Properties().Get(nsIFrame::DebugInitialOverflowPropertyApplied(),
|
||||
&hasInitialOverflowPropertyApplied);
|
||||
NS_ASSERTION(hasInitialOverflowPropertyApplied,
|
||||
NS_ASSERTION(frame->Properties().Get(
|
||||
nsIFrame::DebugInitialOverflowPropertyApplied()),
|
||||
"InitialOverflowProperty must be set first.");
|
||||
#endif
|
||||
|
||||
nsOverflowAreas* overflow =
|
||||
static_cast<nsOverflowAreas*>(frame->Properties().Get(nsIFrame::InitialOverflowProperty()));
|
||||
|
||||
@@ -47,7 +47,11 @@ enum class PixelCastJustification : uint8_t {
|
||||
LayoutDeviceIsScreenForTabDims,
|
||||
// A combination of LayoutDeviceIsScreenForBounds and
|
||||
// ScreenIsParentLayerForRoot, which is how we're using it.
|
||||
LayoutDeviceIsParentLayerForRCDRSF
|
||||
LayoutDeviceIsParentLayerForRCDRSF,
|
||||
// Used to treat the product of AsyncTransformComponentMatrix objects
|
||||
// as an AsyncTransformMatrix. See the definitions of these matrices in
|
||||
// LayersTypes.h for details.
|
||||
MultipleAsyncTransforms
|
||||
};
|
||||
|
||||
template <class TargetUnits, class SourceUnits>
|
||||
@@ -92,6 +96,19 @@ gfx::ScaleFactor<SourceUnits, NewTargetUnits> ViewTargetAs(
|
||||
PixelCastJustification) {
|
||||
return gfx::ScaleFactor<SourceUnits, NewTargetUnits>(aScaleFactor.scale);
|
||||
}
|
||||
// Unlike the other functions in this category, this function takes the
|
||||
// target matrix type, rather than its source and target unit types, as
|
||||
// the explicit template argument, so an example invocation is:
|
||||
// ViewAs<ScreenToLayerMatrix4x4>(otherTypedMatrix, justification)
|
||||
// The reason is that if it took the source and target unit types as two
|
||||
// template arguments, there may be some confusion as to which is the
|
||||
// source and which is the target.
|
||||
template <class TargetMatrix, class SourceMatrixSourceUnits, class SourceMatrixTargetUnits>
|
||||
TargetMatrix ViewAs(
|
||||
const gfx::Matrix4x4Typed<SourceMatrixSourceUnits, SourceMatrixTargetUnits>& aMatrix,
|
||||
PixelCastJustification) {
|
||||
return TargetMatrix::FromUnknownMatrix(aMatrix.ToUnknownMatrix());
|
||||
}
|
||||
|
||||
// Convenience functions for casting untyped entities to typed entities.
|
||||
// Using these functions does not require a justification, but once we convert
|
||||
|
||||
@@ -28,6 +28,7 @@ struct IsPixel : FalseType {};
|
||||
struct CSSPixel;
|
||||
struct LayoutDevicePixel;
|
||||
struct LayerPixel;
|
||||
struct CSSTransformedLayerPixel;
|
||||
struct RenderTargetPixel;
|
||||
struct ScreenPixel;
|
||||
struct ParentLayerPixel;
|
||||
@@ -36,6 +37,7 @@ struct DesktopPixel;
|
||||
template<> struct IsPixel<CSSPixel> : TrueType {};
|
||||
template<> struct IsPixel<LayoutDevicePixel> : TrueType {};
|
||||
template<> struct IsPixel<LayerPixel> : TrueType {};
|
||||
template<> struct IsPixel<CSSTransformedLayerPixel> : TrueType {};
|
||||
template<> struct IsPixel<RenderTargetPixel> : TrueType {};
|
||||
template<> struct IsPixel<ScreenPixel> : TrueType {};
|
||||
template<> struct IsPixel<ParentLayerPixel> : TrueType {};
|
||||
@@ -77,6 +79,18 @@ typedef gfx::MarginTyped<LayerPixel> LayerMargin;
|
||||
typedef gfx::IntMarginTyped<LayerPixel> LayerIntMargin;
|
||||
typedef gfx::IntRegionTyped<LayerPixel> LayerIntRegion;
|
||||
|
||||
typedef gfx::CoordTyped<CSSTransformedLayerPixel> CSSTransformedLayerCoord;
|
||||
typedef gfx::IntCoordTyped<CSSTransformedLayerPixel> CSSTransformedLayerIntCoord;
|
||||
typedef gfx::PointTyped<CSSTransformedLayerPixel> CSSTransformedLayerPoint;
|
||||
typedef gfx::IntPointTyped<CSSTransformedLayerPixel> CSSTransformedLayerIntPoint;
|
||||
typedef gfx::SizeTyped<CSSTransformedLayerPixel> CSSTransformedLayerSize;
|
||||
typedef gfx::IntSizeTyped<CSSTransformedLayerPixel> CSSTransformedLayerIntSize;
|
||||
typedef gfx::RectTyped<CSSTransformedLayerPixel> CSSTransformedLayerRect;
|
||||
typedef gfx::IntRectTyped<CSSTransformedLayerPixel> CSSTransformedLayerIntRect;
|
||||
typedef gfx::MarginTyped<CSSTransformedLayerPixel> CSSTransformedLayerMargin;
|
||||
typedef gfx::IntMarginTyped<CSSTransformedLayerPixel> CSSTransformedLayerIntMargin;
|
||||
typedef gfx::IntRegionTyped<CSSTransformedLayerPixel> CSSTransformedLayerIntRegion;
|
||||
|
||||
typedef gfx::PointTyped<RenderTargetPixel> RenderTargetPoint;
|
||||
typedef gfx::IntPointTyped<RenderTargetPixel> RenderTargetIntPoint;
|
||||
typedef gfx::SizeTyped<RenderTargetPixel> RenderTargetSize;
|
||||
@@ -340,6 +354,16 @@ struct LayoutDevicePixel {
|
||||
struct LayerPixel {
|
||||
};
|
||||
|
||||
/*
|
||||
* This is Layer coordinates with the Layer's CSS transform applied.
|
||||
* It can be thought of as intermediate between LayerPixel and
|
||||
* ParentLayerPixel, as further applying async transforms to this
|
||||
* yields ParentLayerPixels.
|
||||
*/
|
||||
struct CSSTransformedLayerPixel {
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Layers are always composited to a render target. This unit
|
||||
* represents one pixel in the render target. Note that for the
|
||||
|
||||
@@ -428,8 +428,6 @@ struct LevState {
|
||||
class nsBidi
|
||||
{
|
||||
public:
|
||||
typedef mozilla::FramePropertyDescriptor FramePropertyDescriptor;
|
||||
|
||||
/** @brief Default constructor.
|
||||
*
|
||||
* The nsBidi object is initially empty. It is assigned
|
||||
@@ -660,18 +658,18 @@ public:
|
||||
*/
|
||||
nsresult WriteReverse(const char16_t *aSrc, int32_t aSrcLength, char16_t *aDest, uint16_t aOptions, int32_t *aDestSize);
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(BaseLevelProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY(EmbeddingLevelProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY(ParagraphDepthProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BaseLevelProperty, nsBidiLevel)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(EmbeddingLevelProperty, nsBidiLevel)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(ParagraphDepthProperty, uint8_t)
|
||||
|
||||
#define NS_GET_BASE_LEVEL(frame) \
|
||||
NS_PTR_TO_INT32(frame->Properties().Get(nsBidi::BaseLevelProperty()))
|
||||
frame->Properties().Get(nsBidi::BaseLevelProperty())
|
||||
|
||||
#define NS_GET_EMBEDDING_LEVEL(frame) \
|
||||
NS_PTR_TO_INT32(frame->Properties().Get(nsBidi::EmbeddingLevelProperty()))
|
||||
frame->Properties().Get(nsBidi::EmbeddingLevelProperty())
|
||||
|
||||
#define NS_GET_PARAGRAPH_DEPTH(frame) \
|
||||
NS_PTR_TO_INT32(frame->Properties().Get(nsBidi::ParagraphDepthProperty()))
|
||||
frame->Properties().Get(nsBidi::ParagraphDepthProperty())
|
||||
|
||||
protected:
|
||||
friend class nsBidiPresUtils;
|
||||
|
||||
@@ -796,11 +796,11 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
||||
// Set the base level and embedding level of the current run even
|
||||
// on an empty frame. Otherwise frame reordering will not be correct.
|
||||
propTable->Set(frame, nsBidi::EmbeddingLevelProperty(),
|
||||
NS_INT32_TO_PTR(embeddingLevel));
|
||||
embeddingLevel);
|
||||
propTable->Set(frame, nsBidi::BaseLevelProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->GetParaLevel()));
|
||||
aBpd->GetParaLevel());
|
||||
propTable->Set(frame, nsBidi::ParagraphDepthProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->mParagraphDepth));
|
||||
aBpd->mParagraphDepth);
|
||||
continue;
|
||||
}
|
||||
int32_t start, end;
|
||||
@@ -832,11 +832,11 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
|
||||
}
|
||||
else {
|
||||
propTable->Set(frame, nsBidi::EmbeddingLevelProperty(),
|
||||
NS_INT32_TO_PTR(embeddingLevel));
|
||||
embeddingLevel);
|
||||
propTable->Set(frame, nsBidi::BaseLevelProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->GetParaLevel()));
|
||||
aBpd->GetParaLevel());
|
||||
propTable->Set(frame, nsBidi::ParagraphDepthProperty(),
|
||||
NS_INT32_TO_PTR(aBpd->mParagraphDepth));
|
||||
aBpd->mParagraphDepth);
|
||||
if (isTextFrame) {
|
||||
if ( (runLength > 0) && (runLength < fragmentLength) ) {
|
||||
/*
|
||||
@@ -1782,12 +1782,9 @@ nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData *aBpd,
|
||||
int32_t& aOffset)
|
||||
{
|
||||
FrameProperties props = aFrame->Properties();
|
||||
nsBidiLevel embeddingLevel =
|
||||
(nsBidiLevel)NS_PTR_TO_INT32(props.Get(nsBidi::EmbeddingLevelProperty()));
|
||||
nsBidiLevel baseLevel =
|
||||
(nsBidiLevel)NS_PTR_TO_INT32(props.Get(nsBidi::BaseLevelProperty()));
|
||||
uint8_t paragraphDepth =
|
||||
NS_PTR_TO_INT32(props.Get(nsBidi::ParagraphDepthProperty()));
|
||||
nsBidiLevel embeddingLevel = props.Get(nsBidi::EmbeddingLevelProperty());
|
||||
nsBidiLevel baseLevel = props.Get(nsBidi::BaseLevelProperty());
|
||||
uint8_t paragraphDepth = props.Get(nsBidi::ParagraphDepthProperty());
|
||||
|
||||
for (int32_t index = aFirstIndex + 1; index <= aLastIndex; index++) {
|
||||
nsIFrame* frame = aBpd->FrameAt(index);
|
||||
@@ -1798,12 +1795,9 @@ nsBidiPresUtils::RemoveBidiContinuation(BidiParagraphData *aBpd,
|
||||
// Make the frame and its continuation ancestors fluid,
|
||||
// so they can be reused or deleted by normal reflow code
|
||||
FrameProperties frameProps = frame->Properties();
|
||||
frameProps.Set(nsBidi::EmbeddingLevelProperty(),
|
||||
NS_INT32_TO_PTR(embeddingLevel));
|
||||
frameProps.Set(nsBidi::BaseLevelProperty(),
|
||||
NS_INT32_TO_PTR(baseLevel));
|
||||
frameProps.Set(nsBidi::ParagraphDepthProperty(),
|
||||
NS_INT32_TO_PTR(paragraphDepth));
|
||||
frameProps.Set(nsBidi::EmbeddingLevelProperty(), embeddingLevel);
|
||||
frameProps.Set(nsBidi::BaseLevelProperty(), baseLevel);
|
||||
frameProps.Set(nsBidi::ParagraphDepthProperty(), paragraphDepth);
|
||||
frame->AddStateBits(NS_FRAME_IS_BIDI);
|
||||
while (frame) {
|
||||
nsIFrame* prev = frame->GetPrevContinuation();
|
||||
|
||||
@@ -5950,13 +5950,11 @@ AddGenConPseudoToFrame(nsIFrame* aOwnerFrame, nsIContent* aContent)
|
||||
NS_ASSERTION(nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(aOwnerFrame),
|
||||
"property should only be set on first continuation/ib-sibling");
|
||||
|
||||
typedef nsAutoTArray<nsIContent*, 2> T;
|
||||
const FramePropertyDescriptor* prop = nsIFrame::GenConProperty();
|
||||
FrameProperties props = aOwnerFrame->Properties();
|
||||
T* value = static_cast<T*>(props.Get(prop));
|
||||
nsIFrame::ContentArray* value = props.Get(nsIFrame::GenConProperty());
|
||||
if (!value) {
|
||||
value = new T;
|
||||
props.Set(prop, value);
|
||||
value = new nsIFrame::ContentArray;
|
||||
props.Set(nsIFrame::GenConProperty(), value);
|
||||
}
|
||||
value->AppendElement(aContent);
|
||||
}
|
||||
|
||||
+111
-103
@@ -1006,7 +1006,7 @@ nsCSSRendering::PaintFocus(nsPresContext* aPresContext,
|
||||
* that function, except they're for a single coordinate / a single size
|
||||
* dimension. (so, x/width vs. y/height)
|
||||
*/
|
||||
typedef nsStyleBackground::Position::PositionCoord PositionCoord;
|
||||
typedef nsStyleImageLayers::Position::PositionCoord PositionCoord;
|
||||
static void
|
||||
ComputeObjectAnchorCoord(const PositionCoord& aCoord,
|
||||
const nscoord aOriginBounds,
|
||||
@@ -1030,7 +1030,7 @@ ComputeObjectAnchorCoord(const PositionCoord& aCoord,
|
||||
|
||||
void
|
||||
nsImageRenderer::ComputeObjectAnchorPoint(
|
||||
const nsStyleBackground::Position& aPos,
|
||||
const nsStyleImageLayers::Position& aPos,
|
||||
const nsSize& aOriginBounds,
|
||||
const nsSize& aImageSize,
|
||||
nsPoint* aTopLeft,
|
||||
@@ -1750,11 +1750,11 @@ SetupDirtyRects(const nsRect& aBGClipArea, const nsRect& aCallerDirtyRect,
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsCSSRendering::GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
|
||||
nsIFrame* aForFrame, const nsStyleBorder& aBorder,
|
||||
const nsRect& aBorderArea, const nsRect& aCallerDirtyRect,
|
||||
bool aWillPaintBorder, nscoord aAppUnitsPerPixel,
|
||||
/* out */ BackgroundClipState* aClipState)
|
||||
/* out */ ImageLayerClipState* aClipState)
|
||||
{
|
||||
// Compute the outermost boundary of the area that might be painted.
|
||||
// Same coordinate space as aBorderArea.
|
||||
@@ -1769,12 +1769,12 @@ nsCSSRendering::GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
|
||||
bool isSolidBorder =
|
||||
aWillPaintBorder && IsOpaqueBorder(aBorder);
|
||||
if (isSolidBorder && backgroundClip == NS_STYLE_BG_CLIP_BORDER) {
|
||||
if (isSolidBorder && backgroundClip == NS_STYLE_IMAGELAYER_CLIP_BORDER) {
|
||||
// If we have rounded corners, we need to inflate the background
|
||||
// drawing area a bit to avoid seams between the border and
|
||||
// background.
|
||||
backgroundClip = haveRoundedCorners ?
|
||||
NS_STYLE_BG_CLIP_MOZ_ALMOST_PADDING : NS_STYLE_BG_CLIP_PADDING;
|
||||
NS_STYLE_IMAGELAYER_CLIP_MOZ_ALMOST_PADDING : NS_STYLE_IMAGELAYER_CLIP_PADDING;
|
||||
}
|
||||
|
||||
aClipState->mBGClipArea = clipBorderArea;
|
||||
@@ -1782,7 +1782,7 @@ nsCSSRendering::GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
aClipState->mCustomClip = false;
|
||||
|
||||
if (aForFrame->GetType() == nsGkAtoms::scrollFrame &&
|
||||
NS_STYLE_BG_ATTACHMENT_LOCAL == aLayer.mAttachment) {
|
||||
NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL == aLayer.mAttachment) {
|
||||
// As of this writing, this is still in discussion in the CSS Working Group
|
||||
// http://lists.w3.org/Archives/Public/www-style/2013Jul/0250.html
|
||||
|
||||
@@ -1790,7 +1790,7 @@ nsCSSRendering::GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
// but the background is also clipped at a non-scrolling 'padding-box'
|
||||
// like the content. (See below.)
|
||||
// Therefore, only 'content-box' makes a difference here.
|
||||
if (backgroundClip == NS_STYLE_BG_CLIP_CONTENT) {
|
||||
if (backgroundClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT) {
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame);
|
||||
// Clip at a rectangle attached to the scrolled content.
|
||||
aClipState->mHasAdditionalBGClipArea = true;
|
||||
@@ -1810,12 +1810,12 @@ nsCSSRendering::GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
|
||||
// Also clip at a non-scrolling, rounded-corner 'padding-box',
|
||||
// same as the scrolled content because of the 'overflow' property.
|
||||
backgroundClip = NS_STYLE_BG_CLIP_PADDING;
|
||||
backgroundClip = NS_STYLE_IMAGELAYER_CLIP_PADDING;
|
||||
}
|
||||
|
||||
if (backgroundClip != NS_STYLE_BG_CLIP_BORDER) {
|
||||
if (backgroundClip != NS_STYLE_IMAGELAYER_CLIP_BORDER) {
|
||||
nsMargin border = aForFrame->GetUsedBorder();
|
||||
if (backgroundClip == NS_STYLE_BG_CLIP_MOZ_ALMOST_PADDING) {
|
||||
if (backgroundClip == NS_STYLE_IMAGELAYER_CLIP_MOZ_ALMOST_PADDING) {
|
||||
// Reduce |border| by 1px (device pixels) on all sides, if
|
||||
// possible, so that we don't get antialiasing seams between the
|
||||
// background and border.
|
||||
@@ -1823,8 +1823,8 @@ nsCSSRendering::GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
border.right = std::max(0, border.right - aAppUnitsPerPixel);
|
||||
border.bottom = std::max(0, border.bottom - aAppUnitsPerPixel);
|
||||
border.left = std::max(0, border.left - aAppUnitsPerPixel);
|
||||
} else if (backgroundClip != NS_STYLE_BG_CLIP_PADDING) {
|
||||
NS_ASSERTION(backgroundClip == NS_STYLE_BG_CLIP_CONTENT,
|
||||
} else if (backgroundClip != NS_STYLE_IMAGELAYER_CLIP_PADDING) {
|
||||
NS_ASSERTION(backgroundClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT,
|
||||
"unexpected background-clip");
|
||||
border += aForFrame->GetUsedPadding();
|
||||
}
|
||||
@@ -1857,7 +1857,7 @@ nsCSSRendering::GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
}
|
||||
|
||||
static void
|
||||
SetupBackgroundClip(nsCSSRendering::BackgroundClipState& aClipState,
|
||||
SetupImageLayerClip(nsCSSRendering::ImageLayerClipState& aClipState,
|
||||
gfxContext *aCtx, nscoord aAppUnitsPerPixel,
|
||||
gfxContextAutoSaveRestore* aAutoSR)
|
||||
{
|
||||
@@ -1916,7 +1916,7 @@ SetupBackgroundClip(nsCSSRendering::BackgroundClipState& aClipState,
|
||||
}
|
||||
|
||||
static void
|
||||
DrawBackgroundColor(nsCSSRendering::BackgroundClipState& aClipState,
|
||||
DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
|
||||
gfxContext *aCtx, nscoord aAppUnitsPerPixel)
|
||||
{
|
||||
if (aClipState.mDirtyRectGfx.IsEmpty()) {
|
||||
@@ -2009,11 +2009,11 @@ nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// We can skip painting the background color if a background image is opaque.
|
||||
nsStyleBackground::Repeat repeat = bg->BottomLayer().mRepeat;
|
||||
bool xFullRepeat = repeat.mXRepeat == NS_STYLE_BG_REPEAT_REPEAT ||
|
||||
repeat.mXRepeat == NS_STYLE_BG_REPEAT_ROUND;
|
||||
bool yFullRepeat = repeat.mYRepeat == NS_STYLE_BG_REPEAT_REPEAT ||
|
||||
repeat.mYRepeat == NS_STYLE_BG_REPEAT_ROUND;
|
||||
nsStyleImageLayers::Repeat repeat = bg->BottomLayer().mRepeat;
|
||||
bool xFullRepeat = repeat.mXRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT ||
|
||||
repeat.mXRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND;
|
||||
bool yFullRepeat = repeat.mYRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT ||
|
||||
repeat.mYRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND;
|
||||
if (aDrawBackgroundColor &&
|
||||
xFullRepeat && yFullRepeat &&
|
||||
bg->BottomLayer().mImage.IsOpaque() &&
|
||||
@@ -2906,9 +2906,9 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
drawBackgroundImage,
|
||||
drawBackgroundColor);
|
||||
|
||||
const nsStyleImageLayers& layers = aBackgroundSC->StyleBackground()->mLayers;
|
||||
// If we're drawing a specific layer, we don't want to draw the
|
||||
// background color.
|
||||
const nsStyleBackground *bg = aBackgroundSC->StyleBackground();
|
||||
if (drawBackgroundColor && aLayer >= 0) {
|
||||
drawBackgroundColor = false;
|
||||
}
|
||||
@@ -2935,7 +2935,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
// taking the intersection breaks reftests/bugs/403249-1[ab].)
|
||||
gfxContext* ctx = aRenderingContext.ThebesContext();
|
||||
nscoord appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel();
|
||||
BackgroundClipState clipState;
|
||||
ImageLayerClipState clipState;
|
||||
if (aBGClipRect) {
|
||||
clipState.mBGClipArea = *aBGClipRect;
|
||||
clipState.mCustomClip = true;
|
||||
@@ -2943,9 +2943,10 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
SetupDirtyRects(clipState.mBGClipArea, aDirtyRect, appUnitsPerPixel,
|
||||
&clipState.mDirtyRect, &clipState.mDirtyRectGfx);
|
||||
} else {
|
||||
GetBackgroundClip(bg->BottomLayer(),
|
||||
GetImageLayerClip(layers.BottomLayer(),
|
||||
aForFrame, aBorder, aBorderArea,
|
||||
aDirtyRect, (aFlags & PAINTBG_WILL_PAINT_BORDER), appUnitsPerPixel,
|
||||
aDirtyRect, (aFlags & PAINTBG_WILL_PAINT_BORDER),
|
||||
appUnitsPerPixel,
|
||||
&clipState);
|
||||
}
|
||||
|
||||
@@ -2967,7 +2968,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
if (bg->mImageCount < 1) {
|
||||
if (layers.mImageCount < 1) {
|
||||
// Return if there are no background layers, all work from this point
|
||||
// onwards happens iteratively on these.
|
||||
return DrawResult::SUCCESS;
|
||||
@@ -2977,16 +2978,16 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
int32_t startLayer = aLayer;
|
||||
int32_t nLayers = 1;
|
||||
if (startLayer < 0) {
|
||||
startLayer = (int32_t)bg->mImageCount - 1;
|
||||
nLayers = bg->mImageCount;
|
||||
startLayer = (int32_t)layers.mImageCount - 1;
|
||||
nLayers = layers.mImageCount;
|
||||
}
|
||||
|
||||
// Ensure we get invalidated for loads of the image. We need to do
|
||||
// this here because this might be the only code that knows about the
|
||||
// association of the style data with the frame.
|
||||
if (aBackgroundSC != aForFrame->StyleContext()) {
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT_WITH_RANGE(i, bg, startLayer, nLayers) {
|
||||
aForFrame->AssociateImage(bg->mLayers[i].mImage, aPresContext);
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT_WITH_RANGE(i, layers, startLayer, nLayers) {
|
||||
aForFrame->AssociateImage(layers.mLayers[i].mImage, aPresContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2998,24 +2999,24 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
|
||||
if (drawBackgroundImage) {
|
||||
bool clipSet = false;
|
||||
uint8_t currentBackgroundClip = NS_STYLE_BG_CLIP_BORDER;
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT_WITH_RANGE(i, bg, bg->mImageCount - 1,
|
||||
nLayers + (bg->mImageCount -
|
||||
startLayer - 1)) {
|
||||
const nsStyleBackground::Layer &layer = bg->mLayers[i];
|
||||
uint8_t currentBackgroundClip = NS_STYLE_IMAGELAYER_CLIP_BORDER;
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT_WITH_RANGE(i, layers, layers.mImageCount - 1,
|
||||
nLayers + (layers.mImageCount -
|
||||
startLayer - 1)) {
|
||||
const nsStyleImageLayers::Layer& layer = layers.mLayers[i];
|
||||
if (!aBGClipRect) {
|
||||
if (currentBackgroundClip != layer.mClip || !clipSet) {
|
||||
currentBackgroundClip = layer.mClip;
|
||||
// If clipSet is false that means this is the bottom layer and we
|
||||
// already called GetBackgroundClip above and it stored its results
|
||||
// already called GetImageLayerClip above and it stored its results
|
||||
// in clipState.
|
||||
if (clipSet) {
|
||||
autoSR.Restore(); // reset the previous one
|
||||
GetBackgroundClip(layer, aForFrame,
|
||||
GetImageLayerClip(layer, aForFrame,
|
||||
aBorder, aBorderArea, aDirtyRect, (aFlags & PAINTBG_WILL_PAINT_BORDER),
|
||||
appUnitsPerPixel, &clipState);
|
||||
}
|
||||
SetupBackgroundClip(clipState, ctx, appUnitsPerPixel, &autoSR);
|
||||
SetupImageLayerClip(clipState, ctx, appUnitsPerPixel, &autoSR);
|
||||
clipSet = true;
|
||||
if (!clipBorderArea.IsEqualEdges(aBorderArea)) {
|
||||
// We're drawing the background for the joined continuation boxes
|
||||
@@ -3031,10 +3032,9 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
}
|
||||
if ((aLayer < 0 || i == (uint32_t)startLayer) &&
|
||||
!clipState.mDirtyRectGfx.IsEmpty()) {
|
||||
nsBackgroundLayerState state = PrepareBackgroundLayer(aPresContext, aForFrame,
|
||||
nsBackgroundLayerState state = PrepareImageLayer(aPresContext, aForFrame,
|
||||
aFlags, paintBorderArea, clipState.mBGClipArea, layer);
|
||||
result &= state.mImageRenderer.PrepareResult();
|
||||
|
||||
if (!state.mFillArea.IsEmpty()) {
|
||||
if (state.mCompositionOp != CompositionOp::OP_OVER) {
|
||||
NS_ASSERTION(ctx->CurrentOp() == CompositionOp::OP_OVER,
|
||||
@@ -3072,10 +3072,10 @@ IsTransformed(nsIFrame* aForFrame, nsIFrame* aTopFrame)
|
||||
}
|
||||
|
||||
nsRect
|
||||
nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
|
||||
nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground::Layer& aLayer,
|
||||
const nsStyleImageLayers::Layer& aLayer,
|
||||
nsIFrame** aAttachedToFrame)
|
||||
{
|
||||
// Compute background origin area relative to aBorderArea now as we may need
|
||||
@@ -3085,7 +3085,7 @@ nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
|
||||
nsIAtom* frameType = aForFrame->GetType();
|
||||
nsIFrame* geometryFrame = aForFrame;
|
||||
if (MOZ_UNLIKELY(frameType == nsGkAtoms::scrollFrame &&
|
||||
NS_STYLE_BG_ATTACHMENT_LOCAL == aLayer.mAttachment)) {
|
||||
NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL == aLayer.mAttachment)) {
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame);
|
||||
bgPositioningArea = nsRect(
|
||||
scrollableFrame->GetScrolledFrame()->GetPosition()
|
||||
@@ -3095,16 +3095,16 @@ nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
|
||||
// The ScrolledRect’s size does not include the borders or scrollbars,
|
||||
// reverse the handling of background-origin
|
||||
// compared to the common case below.
|
||||
if (aLayer.mOrigin == NS_STYLE_BG_ORIGIN_BORDER) {
|
||||
if (aLayer.mOrigin == NS_STYLE_IMAGELAYER_ORIGIN_BORDER) {
|
||||
nsMargin border = geometryFrame->GetUsedBorder();
|
||||
border.ApplySkipSides(geometryFrame->GetSkipSides());
|
||||
bgPositioningArea.Inflate(border);
|
||||
bgPositioningArea.Inflate(scrollableFrame->GetActualScrollbarSizes());
|
||||
} else if (aLayer.mOrigin != NS_STYLE_BG_ORIGIN_PADDING) {
|
||||
} else if (aLayer.mOrigin != NS_STYLE_IMAGELAYER_ORIGIN_PADDING) {
|
||||
nsMargin padding = geometryFrame->GetUsedPadding();
|
||||
padding.ApplySkipSides(geometryFrame->GetSkipSides());
|
||||
bgPositioningArea.Deflate(padding);
|
||||
NS_ASSERTION(aLayer.mOrigin == NS_STYLE_BG_ORIGIN_CONTENT,
|
||||
NS_ASSERTION(aLayer.mOrigin == NS_STYLE_IMAGELAYER_ORIGIN_CONTENT,
|
||||
"unknown background-origin value");
|
||||
}
|
||||
*aAttachedToFrame = aForFrame;
|
||||
@@ -3126,18 +3126,18 @@ nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
|
||||
|
||||
// Background images are tiled over the 'background-clip' area
|
||||
// but the origin of the tiling is based on the 'background-origin' area
|
||||
if (aLayer.mOrigin != NS_STYLE_BG_ORIGIN_BORDER && geometryFrame) {
|
||||
if (aLayer.mOrigin != NS_STYLE_IMAGELAYER_ORIGIN_BORDER && geometryFrame) {
|
||||
nsMargin border = geometryFrame->GetUsedBorder();
|
||||
if (aLayer.mOrigin != NS_STYLE_BG_ORIGIN_PADDING) {
|
||||
if (aLayer.mOrigin != NS_STYLE_IMAGELAYER_ORIGIN_PADDING) {
|
||||
border += geometryFrame->GetUsedPadding();
|
||||
NS_ASSERTION(aLayer.mOrigin == NS_STYLE_BG_ORIGIN_CONTENT,
|
||||
NS_ASSERTION(aLayer.mOrigin == NS_STYLE_IMAGELAYER_ORIGIN_CONTENT,
|
||||
"unknown background-origin value");
|
||||
}
|
||||
bgPositioningArea.Deflate(border);
|
||||
}
|
||||
|
||||
nsIFrame* attachedToFrame = aForFrame;
|
||||
if (NS_STYLE_BG_ATTACHMENT_FIXED == aLayer.mAttachment) {
|
||||
if (NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED == aLayer.mAttachment) {
|
||||
// If it's a fixed background attachment, then the image is placed
|
||||
// relative to the viewport, which is the area of the root frame
|
||||
// in a screen context or the page content frame in a print context.
|
||||
@@ -3194,16 +3194,16 @@ ComputeRoundedSize(nscoord aCurrentSize, nscoord aPositioningSize)
|
||||
static nsSize
|
||||
ComputeDrawnSizeForBackground(const CSSSizeOrRatio& aIntrinsicSize,
|
||||
const nsSize& aBgPositioningArea,
|
||||
const nsStyleBackground::Size& aLayerSize,
|
||||
const nsStyleImageLayers::Size& aLayerSize,
|
||||
uint8_t aXRepeat, uint8_t aYRepeat)
|
||||
{
|
||||
nsSize imageSize;
|
||||
|
||||
// Size is dictated by cover or contain rules.
|
||||
if (aLayerSize.mWidthType == nsStyleBackground::Size::eContain ||
|
||||
aLayerSize.mWidthType == nsStyleBackground::Size::eCover) {
|
||||
if (aLayerSize.mWidthType == nsStyleImageLayers::Size::eContain ||
|
||||
aLayerSize.mWidthType == nsStyleImageLayers::Size::eCover) {
|
||||
nsImageRenderer::FitType fitType =
|
||||
aLayerSize.mWidthType == nsStyleBackground::Size::eCover
|
||||
aLayerSize.mWidthType == nsStyleImageLayers::Size::eCover
|
||||
? nsImageRenderer::COVER
|
||||
: nsImageRenderer::CONTAIN;
|
||||
imageSize = nsImageRenderer::ComputeConstrainedSize(aBgPositioningArea,
|
||||
@@ -3212,11 +3212,11 @@ ComputeDrawnSizeForBackground(const CSSSizeOrRatio& aIntrinsicSize,
|
||||
} else {
|
||||
// No cover/contain constraint, use default algorithm.
|
||||
CSSSizeOrRatio specifiedSize;
|
||||
if (aLayerSize.mWidthType == nsStyleBackground::Size::eLengthPercentage) {
|
||||
if (aLayerSize.mWidthType == nsStyleImageLayers::Size::eLengthPercentage) {
|
||||
specifiedSize.SetWidth(
|
||||
aLayerSize.ResolveWidthLengthPercentage(aBgPositioningArea));
|
||||
}
|
||||
if (aLayerSize.mHeightType == nsStyleBackground::Size::eLengthPercentage) {
|
||||
if (aLayerSize.mHeightType == nsStyleImageLayers::Size::eLengthPercentage) {
|
||||
specifiedSize.SetHeight(
|
||||
aLayerSize.ResolveHeightLengthPercentage(aBgPositioningArea));
|
||||
}
|
||||
@@ -3233,15 +3233,15 @@ ComputeDrawnSizeForBackground(const CSSSizeOrRatio& aIntrinsicSize,
|
||||
// "If 'background-repeat' is 'round' for one dimension only and if 'background-size'
|
||||
// is 'auto' for the other dimension, then there is a third step: that other dimension
|
||||
// is scaled so that the original aspect ratio is restored."
|
||||
bool isRepeatRoundInBothDimensions = aXRepeat == NS_STYLE_BG_REPEAT_ROUND &&
|
||||
aYRepeat == NS_STYLE_BG_REPEAT_ROUND;
|
||||
bool isRepeatRoundInBothDimensions = aXRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND &&
|
||||
aYRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND;
|
||||
|
||||
// Calculate the rounded size only if the background-size computation
|
||||
// returned a correct size for the image.
|
||||
if (imageSize.width && aXRepeat == NS_STYLE_BG_REPEAT_ROUND) {
|
||||
if (imageSize.width && aXRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND) {
|
||||
imageSize.width = ComputeRoundedSize(imageSize.width, aBgPositioningArea.width);
|
||||
if (!isRepeatRoundInBothDimensions &&
|
||||
aLayerSize.mHeightType == nsStyleBackground::Size::DimensionType::eAuto) {
|
||||
aLayerSize.mHeightType == nsStyleImageLayers::Size::DimensionType::eAuto) {
|
||||
// Restore intrinsic rato
|
||||
if (aIntrinsicSize.mRatio.width) {
|
||||
float scale = float(aIntrinsicSize.mRatio.height) / aIntrinsicSize.mRatio.width;
|
||||
@@ -3252,10 +3252,10 @@ ComputeDrawnSizeForBackground(const CSSSizeOrRatio& aIntrinsicSize,
|
||||
|
||||
// Calculate the rounded size only if the background-size computation
|
||||
// returned a correct size for the image.
|
||||
if (imageSize.height && aYRepeat == NS_STYLE_BG_REPEAT_ROUND) {
|
||||
if (imageSize.height && aYRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND) {
|
||||
imageSize.height = ComputeRoundedSize(imageSize.height, aBgPositioningArea.height);
|
||||
if (!isRepeatRoundInBothDimensions &&
|
||||
aLayerSize.mWidthType == nsStyleBackground::Size::DimensionType::eAuto) {
|
||||
aLayerSize.mWidthType == nsStyleImageLayers::Size::DimensionType::eAuto) {
|
||||
// Restore intrinsic rato
|
||||
if (aIntrinsicSize.mRatio.height) {
|
||||
float scale = float(aIntrinsicSize.mRatio.width) / aIntrinsicSize.mRatio.height;
|
||||
@@ -3285,26 +3285,28 @@ ComputeSpacedRepeatSize(nscoord aImageDimension,
|
||||
}
|
||||
|
||||
nsBackgroundLayerState
|
||||
nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
uint32_t aFlags,
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aBGClipRect,
|
||||
const nsStyleBackground::Layer& aLayer)
|
||||
nsCSSRendering::PrepareImageLayer(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
uint32_t aFlags,
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aBGClipRect,
|
||||
const nsStyleImageLayers::Layer& aLayer)
|
||||
{
|
||||
/*
|
||||
* The properties we need to keep in mind when drawing background
|
||||
* The properties we need to keep in mind when drawing style image
|
||||
* layers are:
|
||||
*
|
||||
* background-image
|
||||
* background-repeat
|
||||
* background-image/ mask-image
|
||||
* background-repeat/ mask-repeat
|
||||
* background-attachment
|
||||
* background-position
|
||||
* background-clip
|
||||
* background-origin
|
||||
* background-size
|
||||
* background-position/ mask-position
|
||||
* background-clip/ mask-clip
|
||||
* background-origin/ mask-origin
|
||||
* background-size/ mask-size
|
||||
* background-blend-mode
|
||||
* box-decoration-break
|
||||
* mask-mode
|
||||
* mask-composite
|
||||
*
|
||||
* (background-color applies to the entire element and not to individual
|
||||
* layers, so it is irrelevant to this method.)
|
||||
@@ -3312,39 +3314,45 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
* These properties have the following dependencies upon each other when
|
||||
* determining rendering:
|
||||
*
|
||||
* background-image
|
||||
* background-image/ mask-image
|
||||
* no dependencies
|
||||
* background-repeat
|
||||
* background-repeat/ mask-repeat
|
||||
* no dependencies
|
||||
* background-attachment
|
||||
* no dependencies
|
||||
* background-position
|
||||
* depends upon background-size (for the image's scaled size) and
|
||||
* background-break (for the background positioning area)
|
||||
* background-clip
|
||||
* background-position/ mask-position
|
||||
* depends upon background-size/mask-size (for the image's scaled size)
|
||||
* and background-break (for the background positioning area)
|
||||
* background-clip/ mask-clip
|
||||
* no dependencies
|
||||
* background-origin
|
||||
* background-origin/ mask-origin
|
||||
* depends upon background-attachment (only in the case where that value
|
||||
* is 'fixed')
|
||||
* background-size
|
||||
* background-size/ mask-size
|
||||
* depends upon box-decoration-break (for the background positioning area
|
||||
* for resolving percentages), background-image (for the image's intrinsic
|
||||
* size), background-repeat (if that value is 'round'), and
|
||||
* background-origin (for the background painting area, when
|
||||
* background-repeat is 'round')
|
||||
* background-blend-mode
|
||||
* no dependencies
|
||||
* mask-mode
|
||||
* no dependencies
|
||||
* mask-composite
|
||||
* no dependencies
|
||||
* box-decoration-break
|
||||
* no dependencies
|
||||
*
|
||||
* As a result of only-if dependencies we don't strictly do a topological
|
||||
* sort of the above properties when processing, but it's pretty close to one:
|
||||
*
|
||||
* background-clip (by caller)
|
||||
* background-image
|
||||
* box-decoration-break, background-origin
|
||||
* background-clip/mask-clip (by caller)
|
||||
* background-image/ mask-image
|
||||
* box-decoration-break, background-origin/ mask origin
|
||||
* background-attachment (postfix for background-origin if 'fixed')
|
||||
* background-size
|
||||
* background-position
|
||||
* background-repeat
|
||||
* background-size/ mask-size
|
||||
* background-position/ mask-position
|
||||
* background-repeat/ mask-repeat
|
||||
*/
|
||||
|
||||
uint32_t irFlags = 0;
|
||||
@@ -3366,7 +3374,7 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
// Compute background origin area relative to aBorderArea now as we may need
|
||||
// it to compute the effective image size for a CSS gradient.
|
||||
nsRect bgPositioningArea =
|
||||
ComputeBackgroundPositioningArea(aPresContext, aForFrame, aBorderArea,
|
||||
ComputeImageLayerPositioningArea(aPresContext, aForFrame, aBorderArea,
|
||||
aLayer, &attachedToFrame);
|
||||
|
||||
// For background-attachment:fixed backgrounds, we'll limit the area
|
||||
@@ -3378,7 +3386,7 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
// relative to aBorderArea.TopLeft() (which is where the top-left
|
||||
// of aForFrame's border-box will be rendered)
|
||||
nsPoint imageTopLeft;
|
||||
if (NS_STYLE_BG_ATTACHMENT_FIXED == aLayer.mAttachment) {
|
||||
if (NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED == aLayer.mAttachment) {
|
||||
if ((aFlags & nsCSSRendering::PAINTBG_TO_WINDOW) &&
|
||||
!IsTransformed(aForFrame, attachedToFrame)) {
|
||||
// Clip background-attachment:fixed backgrounds to the viewport, if we're
|
||||
@@ -3418,25 +3426,25 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
bgPositionSize, imageSize,
|
||||
&imageTopLeft, &state.mAnchor);
|
||||
state.mRepeatSize = imageSize;
|
||||
if (repeatX == NS_STYLE_BG_REPEAT_SPACE) {
|
||||
if (repeatX == NS_STYLE_IMAGELAYER_REPEAT_SPACE) {
|
||||
state.mRepeatSize.width = ComputeSpacedRepeatSize(imageSize.width,
|
||||
bgPositionSize.width);
|
||||
if (state.mRepeatSize.width > imageSize.width) {
|
||||
imageTopLeft.x = 0;
|
||||
state.mAnchor.x = 0;
|
||||
} else {
|
||||
repeatX = NS_STYLE_BG_REPEAT_NO_REPEAT;
|
||||
repeatX = NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT;
|
||||
}
|
||||
}
|
||||
|
||||
if (repeatY == NS_STYLE_BG_REPEAT_SPACE) {
|
||||
if (repeatY == NS_STYLE_IMAGELAYER_REPEAT_SPACE) {
|
||||
state.mRepeatSize.height = ComputeSpacedRepeatSize(imageSize.height,
|
||||
bgPositionSize.height);
|
||||
if (state.mRepeatSize.height > imageSize.height) {
|
||||
imageTopLeft.y = 0;
|
||||
state.mAnchor.y = 0;
|
||||
} else {
|
||||
repeatY = NS_STYLE_BG_REPEAT_NO_REPEAT;
|
||||
repeatY = NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3447,16 +3455,16 @@ nsCSSRendering::PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
state.mFillArea = state.mDestArea;
|
||||
|
||||
ExtendMode repeatMode = ExtendMode::CLAMP;
|
||||
if (repeatX == NS_STYLE_BG_REPEAT_REPEAT ||
|
||||
repeatX == NS_STYLE_BG_REPEAT_ROUND ||
|
||||
repeatX == NS_STYLE_BG_REPEAT_SPACE) {
|
||||
if (repeatX == NS_STYLE_IMAGELAYER_REPEAT_REPEAT ||
|
||||
repeatX == NS_STYLE_IMAGELAYER_REPEAT_ROUND ||
|
||||
repeatX == NS_STYLE_IMAGELAYER_REPEAT_SPACE) {
|
||||
state.mFillArea.x = bgClipRect.x;
|
||||
state.mFillArea.width = bgClipRect.width;
|
||||
repeatMode = ExtendMode::REPEAT_X;
|
||||
}
|
||||
if (repeatY == NS_STYLE_BG_REPEAT_REPEAT ||
|
||||
repeatY == NS_STYLE_BG_REPEAT_ROUND ||
|
||||
repeatY == NS_STYLE_BG_REPEAT_SPACE) {
|
||||
if (repeatY == NS_STYLE_IMAGELAYER_REPEAT_REPEAT ||
|
||||
repeatY == NS_STYLE_IMAGELAYER_REPEAT_ROUND ||
|
||||
repeatY == NS_STYLE_IMAGELAYER_REPEAT_SPACE) {
|
||||
state.mFillArea.y = bgClipRect.y;
|
||||
state.mFillArea.height = bgClipRect.height;
|
||||
|
||||
@@ -3485,14 +3493,14 @@ nsCSSRendering::GetBackgroundLayerRect(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aClipRect,
|
||||
const nsStyleBackground::Layer& aLayer,
|
||||
const nsStyleImageLayers::Layer& aLayer,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
Sides skipSides = aForFrame->GetSkipSides();
|
||||
nsRect borderArea =
|
||||
::BoxDecorationRectForBackground(aForFrame, aBorderArea, skipSides);
|
||||
nsBackgroundLayerState state =
|
||||
PrepareBackgroundLayer(aPresContext, aForFrame, aFlags, borderArea,
|
||||
PrepareImageLayer(aPresContext, aForFrame, aFlags, borderArea,
|
||||
aClipRect, aLayer);
|
||||
return state.mFillArea;
|
||||
}
|
||||
@@ -4990,7 +4998,7 @@ nsImageRenderer::ComputeIntrinsicSize()
|
||||
// and that element's ratio, if it matches. If it doesn't match, it
|
||||
// should have no width/height or ratio. See element() in CSS images:
|
||||
// <http://dev.w3.org/csswg/css-images-4/#element-notation>.
|
||||
// Make sure to change nsStyleBackground::Size::DependsOnFrameSize
|
||||
// Make sure to change nsStyleImageLayers::Size::DependsOnFrameSize
|
||||
// when fixing this!
|
||||
if (mPaintServerFrame) {
|
||||
// SVG images have no intrinsic size
|
||||
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
*
|
||||
* Points are returned relative to aOriginBounds.
|
||||
*/
|
||||
static void ComputeObjectAnchorPoint(const nsStyleBackground::Position& aPos,
|
||||
static void ComputeObjectAnchorPoint(const nsStyleImageLayers::Position& aPos,
|
||||
const nsSize& aOriginBounds,
|
||||
const nsSize& aImageSize,
|
||||
nsPoint* aTopLeft,
|
||||
@@ -306,7 +306,7 @@ private:
|
||||
/**
|
||||
* A struct representing all the information needed to paint a background
|
||||
* image to some target, taking into account all CSS background-* properties.
|
||||
* See PrepareBackgroundLayer.
|
||||
* See PrepareImageLayer.
|
||||
*/
|
||||
struct nsBackgroundLayerState {
|
||||
typedef mozilla::gfx::CompositionOp CompositionOp;
|
||||
@@ -327,19 +327,19 @@ struct nsBackgroundLayerState {
|
||||
/**
|
||||
* A rectangle that one copy of the image tile is mapped onto. Same
|
||||
* coordinate system as aBorderArea/aBGClipRect passed into
|
||||
* PrepareBackgroundLayer.
|
||||
* PrepareImageLayer.
|
||||
*/
|
||||
nsRect mDestArea;
|
||||
/**
|
||||
* The actual rectangle that should be filled with (complete or partial)
|
||||
* image tiles. Same coordinate system as aBorderArea/aBGClipRect passed into
|
||||
* PrepareBackgroundLayer.
|
||||
* PrepareImageLayer.
|
||||
*/
|
||||
nsRect mFillArea;
|
||||
/**
|
||||
* The anchor point that should be snapped to a pixel corner. Same
|
||||
* coordinate system as aBorderArea/aBGClipRect passed into
|
||||
* PrepareBackgroundLayer.
|
||||
* PrepareImageLayer.
|
||||
*/
|
||||
nsPoint mAnchor;
|
||||
/**
|
||||
@@ -537,21 +537,21 @@ struct nsCSSRendering {
|
||||
bool& aDrawBackgroundColor);
|
||||
|
||||
static nsRect
|
||||
ComputeBackgroundPositioningArea(nsPresContext* aPresContext,
|
||||
ComputeImageLayerPositioningArea(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBackground::Layer& aLayer,
|
||||
const nsStyleImageLayers::Layer& aLayer,
|
||||
nsIFrame** aAttachedToFrame);
|
||||
|
||||
static nsBackgroundLayerState
|
||||
PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
uint32_t aFlags,
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aBGClipRect,
|
||||
const nsStyleBackground::Layer& aLayer);
|
||||
PrepareImageLayer(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
uint32_t aFlags,
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aBGClipRect,
|
||||
const nsStyleImageLayers::Layer& aLayer);
|
||||
|
||||
struct BackgroundClipState {
|
||||
struct ImageLayerClipState {
|
||||
nsRect mBGClipArea; // Affected by mClippedRadii
|
||||
nsRect mAdditionalBGClipArea; // Not affected by mClippedRadii
|
||||
nsRect mDirtyRect;
|
||||
@@ -568,11 +568,11 @@ struct nsCSSRendering {
|
||||
};
|
||||
|
||||
static void
|
||||
GetBackgroundClip(const nsStyleBackground::Layer& aLayer,
|
||||
nsIFrame* aForFrame, const nsStyleBorder& aBorder, const nsRect& aBorderArea,
|
||||
const nsRect& aCallerDirtyRect, bool aWillPaintBorder,
|
||||
nscoord aAppUnitsPerPixel,
|
||||
/* out */ BackgroundClipState* aClipState);
|
||||
GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
|
||||
nsIFrame* aForFrame, const nsStyleBorder& aBorder,
|
||||
const nsRect& aBorderArea, const nsRect& aCallerDirtyRect,
|
||||
bool aWillPaintBorder, nscoord aAppUnitsPerPixel,
|
||||
/* out */ ImageLayerClipState* aClipState);
|
||||
|
||||
/**
|
||||
* Render the background for an element using css rendering rules
|
||||
@@ -632,7 +632,7 @@ struct nsCSSRendering {
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aBorderArea,
|
||||
const nsRect& aClipRect,
|
||||
const nsStyleBackground::Layer& aLayer,
|
||||
const nsStyleImageLayers::Layer& aLayer,
|
||||
uint32_t aFlags);
|
||||
|
||||
/**
|
||||
|
||||
@@ -542,8 +542,7 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
|
||||
// EffectCompositor needs to know that we refused to run this animation
|
||||
// asynchronously so that it will not throttle the main thread
|
||||
// animation.
|
||||
aFrame->Properties().Set(nsIFrame::RefusedAsyncAnimationProperty(),
|
||||
reinterpret_cast<void*>(intptr_t(true)));
|
||||
aFrame->Properties().Set(nsIFrame::RefusedAsyncAnimationProperty(), true);
|
||||
|
||||
// We need to schedule another refresh driver run so that EffectCompositor
|
||||
// gets a chance to unthrottle the animation.
|
||||
@@ -2255,11 +2254,11 @@ nsDisplayBackgroundImage::GetDestAreaInternal(nsDisplayListBuilder* aBuilder)
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
||||
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer];
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mLayers.mLayers[mLayer];
|
||||
|
||||
nsBackgroundLayerState state =
|
||||
nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags,
|
||||
borderArea, borderArea, layer);
|
||||
nsCSSRendering::PrepareImageLayer(presContext, mFrame, flags,
|
||||
borderArea, borderArea, layer);
|
||||
return state.mDestArea;
|
||||
}
|
||||
|
||||
@@ -2296,13 +2295,13 @@ static nsStyleContext* GetBackgroundStyleContext(nsIFrame* aFrame)
|
||||
/* static */ void
|
||||
SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
|
||||
nsIFrame* aFrame, const nsPoint& aToReferenceFrame,
|
||||
const nsStyleBackground::Layer& aLayer,
|
||||
const nsStyleImageLayers::Layer& aLayer,
|
||||
bool aWillPaintBorder)
|
||||
{
|
||||
nsRect borderBox = nsRect(aToReferenceFrame, aFrame->GetSize());
|
||||
|
||||
nsCSSRendering::BackgroundClipState clip;
|
||||
nsCSSRendering::GetBackgroundClip(aLayer, aFrame, *aFrame->StyleBorder(),
|
||||
nsCSSRendering::ImageLayerClipState clip;
|
||||
nsCSSRendering::GetImageLayerClip(aLayer, aFrame, *aFrame->StyleBorder(),
|
||||
borderBox, borderBox, aWillPaintBorder,
|
||||
aFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||
&clip);
|
||||
@@ -2402,18 +2401,18 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
||||
|
||||
// Passing bg == nullptr in this macro will result in one iteration with
|
||||
// i = 0.
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
|
||||
if (bg->mLayers[i].mImage.IsEmpty()) {
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, bg->mLayers) {
|
||||
if (bg->mLayers.mLayers[i].mImage.IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bg->mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
|
||||
if (bg->mLayers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
|
||||
needBlendContainer = true;
|
||||
}
|
||||
|
||||
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
|
||||
if (!aBuilder->IsForEventDelivery()) {
|
||||
const nsStyleBackground::Layer& layer = bg->mLayers[i];
|
||||
const nsStyleImageLayers::Layer& layer = bg->mLayers.mLayers[i];
|
||||
SetBackgroundClipRegion(clipState, aFrame, toRef,
|
||||
layer, willPaintBorder);
|
||||
}
|
||||
@@ -2477,19 +2476,19 @@ nsDisplayBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuil
|
||||
if (!mBackgroundStyle)
|
||||
return false;
|
||||
|
||||
if (mBackgroundStyle->mLayers.Length() != 1)
|
||||
if (mBackgroundStyle->mLayers.mLayers.Length() != 1)
|
||||
return false;
|
||||
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
||||
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer];
|
||||
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
|
||||
|
||||
if (layer.mAttachment != NS_STYLE_BG_ATTACHMENT_FIXED)
|
||||
if (layer.mAttachment != NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED)
|
||||
return false;
|
||||
|
||||
nsBackgroundLayerState state =
|
||||
nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags,
|
||||
nsCSSRendering::PrepareImageLayer(presContext, mFrame, flags,
|
||||
borderArea, aClipRect, layer);
|
||||
nsImageRenderer* imageRenderer = &state.mImageRenderer;
|
||||
// We only care about images here, not gradients.
|
||||
@@ -2505,8 +2504,8 @@ nsDisplayBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuil
|
||||
bool
|
||||
nsDisplayBackgroundImage::IsNonEmptyFixedImage() const
|
||||
{
|
||||
return mBackgroundStyle->mLayers[mLayer].mAttachment == NS_STYLE_BG_ATTACHMENT_FIXED &&
|
||||
!mBackgroundStyle->mLayers[mLayer].mImage.IsEmpty();
|
||||
return mBackgroundStyle->mLayers.mLayers[mLayer].mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED &&
|
||||
!mBackgroundStyle->mLayers.mLayers[mLayer].mImage.IsEmpty();
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -2535,10 +2534,10 @@ nsDisplayBackgroundImage::CanOptimizeToImageLayer(LayerManager* aManager,
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
||||
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer];
|
||||
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
|
||||
|
||||
nsBackgroundLayerState state =
|
||||
nsCSSRendering::PrepareBackgroundLayer(presContext, mFrame, flags,
|
||||
nsCSSRendering::PrepareImageLayer(presContext, mFrame, flags,
|
||||
borderArea, borderArea, layer);
|
||||
nsImageRenderer* imageRenderer = &state.mImageRenderer;
|
||||
// We only care about images here, not gradients.
|
||||
@@ -2559,8 +2558,8 @@ nsDisplayBackgroundImage::CanOptimizeToImageLayer(LayerManager* aManager,
|
||||
// For 'contain' and 'cover', we allow any pixel of the image to be sampled
|
||||
// because there isn't going to be any spriting/atlasing going on.
|
||||
bool allowPartialImages =
|
||||
(layer.mSize.mWidthType == nsStyleBackground::Size::eContain ||
|
||||
layer.mSize.mWidthType == nsStyleBackground::Size::eCover);
|
||||
(layer.mSize.mWidthType == nsStyleImageLayers::Size::eContain ||
|
||||
layer.mSize.mWidthType == nsStyleImageLayers::Size::eCover);
|
||||
if (!allowPartialImages && !state.mFillArea.Contains(state.mDestArea)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2614,7 +2613,7 @@ nsDisplayBackgroundImage::ShouldCreateOwnLayer(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::AnimatedImageLayersEnabled() && mBackgroundStyle) {
|
||||
const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer];
|
||||
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
|
||||
const nsStyleImage* image = &layer.mImage;
|
||||
if (image->GetType() == eStyleImageType_Image) {
|
||||
imgIRequest* imgreq = image->GetImageData();
|
||||
@@ -2773,13 +2772,13 @@ nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
|
||||
clipRect = canvasFrame->CanvasArea() + aItem->ToReferenceFrame();
|
||||
} else {
|
||||
switch (aClip) {
|
||||
case NS_STYLE_BG_CLIP_BORDER:
|
||||
case NS_STYLE_IMAGELAYER_CLIP_BORDER:
|
||||
clipRect = nsRect(aItem->ToReferenceFrame(), frame->GetSize());
|
||||
break;
|
||||
case NS_STYLE_BG_CLIP_PADDING:
|
||||
case NS_STYLE_IMAGELAYER_CLIP_PADDING:
|
||||
clipRect = frame->GetPaddingRect() - frame->GetPosition() + aItem->ToReferenceFrame();
|
||||
break;
|
||||
case NS_STYLE_BG_CLIP_CONTENT:
|
||||
case NS_STYLE_IMAGELAYER_CLIP_CONTENT:
|
||||
clipRect = frame->GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
|
||||
break;
|
||||
default:
|
||||
@@ -2810,10 +2809,10 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
if (mFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
|
||||
(!mFrame->GetPrevContinuation() && !mFrame->GetNextContinuation())) {
|
||||
const nsStyleBackground::Layer& layer = mBackgroundStyle->mLayers[mLayer];
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mLayers.mLayers[mLayer];
|
||||
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
|
||||
layer.mRepeat.mXRepeat != NS_STYLE_BG_REPEAT_SPACE &&
|
||||
layer.mRepeat.mYRepeat != NS_STYLE_BG_REPEAT_SPACE) {
|
||||
layer.mRepeat.mXRepeat != NS_STYLE_IMAGELAYER_REPEAT_SPACE &&
|
||||
layer.mRepeat.mYRepeat != NS_STYLE_IMAGELAYER_REPEAT_SPACE) {
|
||||
result = GetInsideClipRegion(this, layer.mClip, mBounds);
|
||||
}
|
||||
}
|
||||
@@ -2837,10 +2836,10 @@ nsDisplayBackgroundImage::GetPositioningArea()
|
||||
return nsRect();
|
||||
}
|
||||
nsIFrame* attachedToFrame;
|
||||
return nsCSSRendering::ComputeBackgroundPositioningArea(
|
||||
return nsCSSRendering::ComputeImageLayerPositioningArea(
|
||||
mFrame->PresContext(), mFrame,
|
||||
nsRect(ToReferenceFrame(), mFrame->GetSize()),
|
||||
mBackgroundStyle->mLayers[mLayer],
|
||||
mBackgroundStyle->mLayers.mLayers[mLayer],
|
||||
&attachedToFrame) + ToReferenceFrame();
|
||||
}
|
||||
|
||||
@@ -2857,7 +2856,7 @@ nsDisplayBackgroundImage::RenderingMightDependOnPositioningAreaSizeChange()
|
||||
return true;
|
||||
}
|
||||
|
||||
const nsStyleBackground::Layer &layer = mBackgroundStyle->mLayers[mLayer];
|
||||
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
|
||||
if (layer.RenderingMightDependOnPositioningAreaSizeChange()) {
|
||||
return true;
|
||||
}
|
||||
@@ -2933,7 +2932,7 @@ void nsDisplayBackgroundImage::ComputeInvalidationRegion(nsDisplayListBuilder* a
|
||||
return;
|
||||
}
|
||||
if (aBuilder->ShouldSyncDecodeImages()) {
|
||||
const nsStyleImage& image = mBackgroundStyle->mLayers[mLayer].mImage;
|
||||
const nsStyleImage& image = mBackgroundStyle->mLayers.mLayers[mLayer].mImage;
|
||||
if (image.GetType() == eStyleImageType_Image &&
|
||||
geometry->ShouldInvalidateToSyncDecodeImages()) {
|
||||
aInvalidRegion->Or(*aInvalidRegion, bounds);
|
||||
@@ -2979,7 +2978,7 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
|
||||
clipRect = rootRect + aBuilder->ToReferenceFrame(mFrame);
|
||||
}
|
||||
}
|
||||
const nsStyleBackground::Layer& layer = mBackgroundStyle->mLayers[mLayer];
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mLayers.mLayers[mLayer];
|
||||
return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
|
||||
borderBox, clipRect, layer,
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
@@ -3227,7 +3226,7 @@ nsDisplayBackgroundColor::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
*aSnap = true;
|
||||
|
||||
const nsStyleBackground::Layer& bottomLayer = mBackgroundStyle->BottomLayer();
|
||||
const nsStyleImageLayers::Layer& bottomLayer = mBackgroundStyle->BottomLayer();
|
||||
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
return nsDisplayBackgroundImage::GetInsideClipRegion(this, bottomLayer.mClip,
|
||||
borderBox);
|
||||
|
||||
@@ -204,7 +204,6 @@ class nsDisplayListBuilder {
|
||||
};
|
||||
|
||||
public:
|
||||
typedef mozilla::FramePropertyDescriptor FramePropertyDescriptor;
|
||||
typedef mozilla::FrameLayerBuilder FrameLayerBuilder;
|
||||
typedef mozilla::DisplayItemClip DisplayItemClip;
|
||||
typedef mozilla::DisplayListClipState DisplayListClipState;
|
||||
@@ -960,8 +959,8 @@ public:
|
||||
nsRect mDirtyRect;
|
||||
};
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(OutOfFlowDisplayDataProperty,
|
||||
DeleteValue<OutOfFlowDisplayData>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(OutOfFlowDisplayDataProperty,
|
||||
OutOfFlowDisplayData)
|
||||
|
||||
static OutOfFlowDisplayData* GetOutOfFlowData(nsIFrame* aFrame)
|
||||
{
|
||||
@@ -969,7 +968,7 @@ public:
|
||||
aFrame->Properties().Get(OutOfFlowDisplayDataProperty()));
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(Preserve3DDirtyRectProperty, DeleteValue<nsRect>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(Preserve3DDirtyRectProperty, nsRect)
|
||||
|
||||
nsPresContext* CurrentPresContext() {
|
||||
return CurrentPresShellState()->mPresShell->GetPresContext();
|
||||
|
||||
@@ -806,6 +806,15 @@ nsLayoutUtils::AsyncPanZoomEnabled(nsIFrame* aFrame)
|
||||
return widget->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
float
|
||||
nsLayoutUtils::GetCurrentAPZResolutionScale(nsIPresShell* aShell) {
|
||||
#if !defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ)
|
||||
return aShell ? aShell->GetCumulativeNonRootScaleResolution() : 1.0;
|
||||
#else
|
||||
return 1.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Return the maximum displayport size, based on the LayerManager's maximum
|
||||
// supported texture size. The result is in app units.
|
||||
static nscoord
|
||||
@@ -1862,19 +1871,18 @@ nsLayoutUtils::IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame)
|
||||
return ViewportHasDisplayPort(aFrame->PresContext());
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(ScrollbarThumbLayerized, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(ScrollbarThumbLayerized, bool)
|
||||
|
||||
/* static */ void
|
||||
nsLayoutUtils::SetScrollbarThumbLayerization(nsIFrame* aThumbFrame, bool aLayerize)
|
||||
{
|
||||
aThumbFrame->Properties().Set(ScrollbarThumbLayerized(),
|
||||
reinterpret_cast<void*>(intptr_t(aLayerize)));
|
||||
aThumbFrame->Properties().Set(ScrollbarThumbLayerized(), aLayerize);
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::IsScrollbarThumbLayerized(nsIFrame* aThumbFrame)
|
||||
{
|
||||
return reinterpret_cast<intptr_t>(aThumbFrame->Properties().Get(ScrollbarThumbLayerized()));
|
||||
return aThumbFrame->Properties().Get(ScrollbarThumbLayerized());
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -2057,7 +2065,7 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(nsIWidget* aWidget,
|
||||
nsPoint pt(presContext->DevPixelsToAppUnits(aPoint.x),
|
||||
presContext->DevPixelsToAppUnits(aPoint.y));
|
||||
pt = pt - view->ViewToWidgetOffset();
|
||||
pt = pt.RemoveResolution(presContext->PresShell()->GetCumulativeNonRootScaleResolution());
|
||||
pt = pt.RemoveResolution(GetCurrentAPZResolutionScale(presContext->PresShell()));
|
||||
return pt;
|
||||
}
|
||||
}
|
||||
@@ -2096,7 +2104,7 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(nsIWidget* aWidget,
|
||||
nsIPresShell* shell = aFrame->PresContext()->PresShell();
|
||||
|
||||
// XXX Bug 1224748 - Update nsLayoutUtils functions to correctly handle nsPresShell resolution
|
||||
widgetToView = widgetToView.RemoveResolution(shell->GetCumulativeNonRootScaleResolution());
|
||||
widgetToView = widgetToView.RemoveResolution(GetCurrentAPZResolutionScale(shell));
|
||||
|
||||
/* If we encountered a transform, we can't do simple arithmetic to figure
|
||||
* out how to convert back to aFrame's coordinates and must use the CTM.
|
||||
@@ -2849,7 +2857,7 @@ nsLayoutUtils::TranslateViewToWidget(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsPoint pt = (aPt +
|
||||
viewOffset).ApplyResolution(aPresContext->PresShell()->GetCumulativeNonRootScaleResolution());
|
||||
viewOffset).ApplyResolution(GetCurrentAPZResolutionScale(aPresContext->PresShell()));
|
||||
LayoutDeviceIntPoint relativeToViewWidget(aPresContext->AppUnitsToDevPixels(pt.x),
|
||||
aPresContext->AppUnitsToDevPixels(pt.y));
|
||||
return relativeToViewWidget + WidgetToWidgetOffset(viewWidget, aWidget);
|
||||
@@ -3918,7 +3926,7 @@ ComputeConcreteObjectSize(const nsSize& aConstraintSize,
|
||||
|
||||
// (Helper for HasInitialObjectFitAndPosition, to check
|
||||
// each "object-position" coord.)
|
||||
typedef nsStyleBackground::Position::PositionCoord PositionCoord;
|
||||
typedef nsStyleImageLayers::Position::PositionCoord PositionCoord;
|
||||
static bool
|
||||
IsCoord50Pct(const PositionCoord& aCoord)
|
||||
{
|
||||
@@ -3932,7 +3940,7 @@ IsCoord50Pct(const PositionCoord& aCoord)
|
||||
static bool
|
||||
HasInitialObjectFitAndPosition(const nsStylePosition* aStylePos)
|
||||
{
|
||||
const nsStyleBackground::Position& objectPos = aStylePos->mObjectPosition;
|
||||
const nsStyleImageLayers::Position& objectPos = aStylePos->mObjectPosition;
|
||||
|
||||
return aStylePos->mObjectFit == NS_STYLE_OBJECT_FIT_FILL &&
|
||||
IsCoord50Pct(objectPos.mXPosition) &&
|
||||
@@ -5123,7 +5131,7 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(WritingMode aWM,
|
||||
FrameProperties props = aFrame->Properties();
|
||||
bool didImposeMainSize;
|
||||
nscoord imposedMainSize =
|
||||
reinterpret_cast<nscoord>(props.Get(nsIFrame::FlexItemMainSizeOverride(), &didImposeMainSize));
|
||||
props.Get(nsIFrame::FlexItemMainSizeOverride(), &didImposeMainSize);
|
||||
if (didImposeMainSize) {
|
||||
imposedMainSizeStyleCoord.emplace(imposedMainSize,
|
||||
nsStyleCoord::CoordConstructor);
|
||||
@@ -6813,7 +6821,7 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
|
||||
const nsStyleBackground* bg = bgSC->StyleBackground();
|
||||
if (NS_GET_A(bg->mBackgroundColor) < 255 ||
|
||||
// bottom layer's clip is used for the color
|
||||
bg->BottomLayer().mClip != NS_STYLE_BG_CLIP_BORDER)
|
||||
bg->BottomLayer().mClip != NS_STYLE_IMAGELAYER_CLIP_BORDER)
|
||||
return eTransparencyTransparent;
|
||||
return eTransparencyOpaque;
|
||||
}
|
||||
@@ -8956,6 +8964,18 @@ nsLayoutUtils::IsScrollFrameWithSnapping(nsIFrame* aFrame)
|
||||
styles.mScrollSnapTypeX != NS_STYLE_SCROLL_SNAP_TYPE_NONE;
|
||||
}
|
||||
|
||||
/* static */ nsBlockFrame*
|
||||
nsLayoutUtils::GetFloatContainingBlock(nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame* ancestor = aFrame->GetParent();
|
||||
while (ancestor && !ancestor->IsFloatContainingBlock()) {
|
||||
ancestor = ancestor->GetParent();
|
||||
}
|
||||
MOZ_ASSERT(!ancestor || GetAsBlock(ancestor),
|
||||
"Float containing block can only be block frame");
|
||||
return static_cast<nsBlockFrame*>(ancestor);
|
||||
}
|
||||
|
||||
// The implementation of this calculation is adapted from
|
||||
// Element::GetBoundingClientRect().
|
||||
/* static */ CSSRect
|
||||
|
||||
@@ -2669,6 +2669,12 @@ public:
|
||||
*/
|
||||
static bool AsyncPanZoomEnabled(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Returns the current APZ Resolution Scale. When Java Pan/Zoom is
|
||||
* enabled in Fennec it will always return 1.0.
|
||||
*/
|
||||
static float GetCurrentAPZResolutionScale(nsIPresShell* aShell);
|
||||
|
||||
/**
|
||||
* Log a key/value pair for APZ testing during a paint.
|
||||
* @param aManager The data will be written to the APZTestData associated
|
||||
@@ -2839,6 +2845,11 @@ public:
|
||||
static CSSRect GetBoundingContentRect(const nsIContent* aContent,
|
||||
const nsIScrollableFrame* aRootScrollFrame);
|
||||
|
||||
/**
|
||||
* Returns the first ancestor who is a float containing block.
|
||||
*/
|
||||
static nsBlockFrame* GetFloatContainingBlock(nsIFrame* aFrame);
|
||||
|
||||
private:
|
||||
static uint32_t sFontSizeInflationEmPerLine;
|
||||
static uint32_t sFontSizeInflationMinTwips;
|
||||
|
||||
@@ -1238,8 +1238,7 @@ nsTextControlFrame::SetInitialChildList(ChildListID aListID,
|
||||
NS_ASSERTION(txtCtrl, "Content not a text control element");
|
||||
txtCtrl->InitializeKeyboardEventListeners();
|
||||
|
||||
nsPoint* contentScrollPos = static_cast<nsPoint*>
|
||||
(Properties().Get(ContentScrollPos()));
|
||||
nsPoint* contentScrollPos = Properties().Get(ContentScrollPos());
|
||||
if (contentScrollPos) {
|
||||
// If we have a scroll pos stored to be passed to our anonymous
|
||||
// div, do it here!
|
||||
|
||||
@@ -32,7 +32,7 @@ class nsTextControlFrame final : public nsContainerFrame,
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(ContentScrollPos, DeleteValue<nsPoint>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ContentScrollPos, nsPoint)
|
||||
|
||||
explicit nsTextControlFrame(nsStyleContext* aContext);
|
||||
virtual ~nsTextControlFrame();
|
||||
@@ -152,10 +152,6 @@ public:
|
||||
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
// Temp reference to scriptrunner
|
||||
// We could make these auto-Revoking via the "delete" entry for safety
|
||||
NS_DECLARE_FRAME_PROPERTY(TextControlInitializer, nullptr)
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Launch the reflow on the child frames - see nsTextControlFrame::Reflow()
|
||||
@@ -202,6 +198,11 @@ protected:
|
||||
friend class EditorInitializer;
|
||||
friend class nsTextEditorState; // needs access to UpdateValueDisplay
|
||||
|
||||
// Temp reference to scriptrunner
|
||||
// We could make these auto-Revoking via the "delete" entry for safety
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(TextControlInitializer,
|
||||
EditorInitializer)
|
||||
|
||||
class EditorInitializer : public nsRunnable {
|
||||
public:
|
||||
explicit EditorInitializer(nsTextControlFrame* aFrame) :
|
||||
|
||||
@@ -13,22 +13,13 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(ReservedISize, nullptr);
|
||||
|
||||
union NSCoordValue
|
||||
{
|
||||
nscoord mCoord;
|
||||
void* mPointer;
|
||||
static_assert(sizeof(nscoord) <= sizeof(void*),
|
||||
"Cannot store nscoord in pointer");
|
||||
};
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(ReservedISize, nscoord)
|
||||
|
||||
/* static */ void
|
||||
RubyUtils::SetReservedISize(nsIFrame* aFrame, nscoord aISize)
|
||||
{
|
||||
MOZ_ASSERT(IsExpandableRubyBox(aFrame));
|
||||
NSCoordValue value = { aISize };
|
||||
aFrame->Properties().Set(ReservedISize(), value.mPointer);
|
||||
aFrame->Properties().Set(ReservedISize(), aISize);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
@@ -42,9 +33,7 @@ RubyUtils::ClearReservedISize(nsIFrame* aFrame)
|
||||
RubyUtils::GetReservedISize(nsIFrame* aFrame)
|
||||
{
|
||||
MOZ_ASSERT(IsExpandableRubyBox(aFrame));
|
||||
NSCoordValue value;
|
||||
value.mPointer = aFrame->Properties().Get(ReservedISize());
|
||||
return value.mCoord;
|
||||
return aFrame->Properties().Get(ReservedISize());
|
||||
}
|
||||
|
||||
AutoRubyTextContainerArray::AutoRubyTextContainerArray(
|
||||
@@ -57,6 +46,36 @@ AutoRubyTextContainerArray::AutoRubyTextContainerArray(
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
RubyColumn::Iterator::operator*() const
|
||||
{
|
||||
nsIFrame* frame;
|
||||
if (mIndex == -1) {
|
||||
frame = mColumn.mBaseFrame;
|
||||
} else {
|
||||
frame = mColumn.mTextFrames[mIndex];
|
||||
}
|
||||
MOZ_ASSERT(frame, "Frame here cannot be null");
|
||||
return frame;
|
||||
}
|
||||
|
||||
void
|
||||
RubyColumn::Iterator::SkipUntilExistingFrame()
|
||||
{
|
||||
if (mIndex == -1) {
|
||||
if (mColumn.mBaseFrame) {
|
||||
return;
|
||||
}
|
||||
++mIndex;
|
||||
}
|
||||
int32_t numTextFrames = mColumn.mTextFrames.Length();
|
||||
for (; mIndex < numTextFrames; ++mIndex) {
|
||||
if (mColumn.mTextFrames[mIndex]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RubySegmentEnumerator::RubySegmentEnumerator(nsRubyFrame* aRubyFrame)
|
||||
{
|
||||
nsIFrame* frame = aRubyFrame->PrincipalChildList().FirstChild();
|
||||
|
||||
@@ -133,7 +133,55 @@ struct MOZ_STACK_CLASS RubyColumn
|
||||
nsRubyBaseFrame* mBaseFrame;
|
||||
nsAutoTArray<nsRubyTextFrame*, RTC_ARRAY_SIZE> mTextFrames;
|
||||
bool mIsIntraLevelWhitespace;
|
||||
|
||||
RubyColumn() : mBaseFrame(nullptr), mIsIntraLevelWhitespace(false) { }
|
||||
|
||||
// Helper class to support iteration across the frames within a single
|
||||
// RubyColumn (the column's ruby base and its annotations).
|
||||
class MOZ_STACK_CLASS Iterator
|
||||
{
|
||||
public:
|
||||
nsIFrame* operator*() const;
|
||||
|
||||
Iterator& operator++() { ++mIndex; SkipUntilExistingFrame(); return *this; }
|
||||
Iterator operator++(int) { auto ret = *this; ++*this; return ret; }
|
||||
|
||||
friend bool operator==(const Iterator& aIter1, const Iterator& aIter2)
|
||||
{
|
||||
MOZ_ASSERT(&aIter1.mColumn == &aIter2.mColumn,
|
||||
"Should only compare iterators of the same ruby column");
|
||||
return aIter1.mIndex == aIter2.mIndex;
|
||||
}
|
||||
friend bool operator!=(const Iterator& aIter1, const Iterator& aIter2)
|
||||
{
|
||||
return !(aIter1 == aIter2);
|
||||
}
|
||||
|
||||
private:
|
||||
Iterator(const RubyColumn& aColumn, int32_t aIndex)
|
||||
: mColumn(aColumn)
|
||||
, mIndex(aIndex)
|
||||
{
|
||||
MOZ_ASSERT(aIndex == -1 ||
|
||||
(aIndex >= 0 &&
|
||||
aIndex <= int32_t(aColumn.mTextFrames.Length())));
|
||||
SkipUntilExistingFrame();
|
||||
}
|
||||
friend struct RubyColumn; // for the constructor
|
||||
|
||||
void SkipUntilExistingFrame();
|
||||
|
||||
const RubyColumn& mColumn;
|
||||
// -1 means the ruby base frame,
|
||||
// non-negative means the index of ruby text frame
|
||||
// a value of mTextFrames.Length() means we're done iterating
|
||||
int32_t mIndex = -1;
|
||||
};
|
||||
|
||||
Iterator begin() const { return Iterator(*this, -1); }
|
||||
Iterator end() const { return Iterator(*this, mTextFrames.Length()); }
|
||||
Iterator cbegin() const { return begin(); }
|
||||
Iterator cend() const { return end(); }
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(StickyScrollContainerProperty,
|
||||
DeleteValue<StickyScrollContainer>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(StickyScrollContainerProperty,
|
||||
StickyScrollContainer)
|
||||
|
||||
StickyScrollContainer::StickyScrollContainer(nsIScrollableFrame* aScrollFrame)
|
||||
: mScrollFrame(aScrollFrame)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
rbc { display: ruby-base-container; }
|
||||
</style>
|
||||
<div style="-moz-column-width: 1px">
|
||||
<ruby><rbc></rbc><rb><div style="float: right"></div></rb></ruby>X
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="UTF-8">
|
||||
<div style="-moz-column-width: 1px">
|
||||
<ruby><rb></rb><rb><div style="float: right"></div></rb></ruby>X
|
||||
</div>
|
||||
@@ -599,6 +599,8 @@ load 1223568-1.html
|
||||
load 1223568-2.html
|
||||
pref(layout.css.grid.enabled,true) load 1225118.html
|
||||
pref(layout.css.grid.enabled,true) load 1225376.html
|
||||
load 1229437-1.html
|
||||
load 1229437-2.html
|
||||
load details-display-none-summary-1.html
|
||||
load details-display-none-summary-2.html
|
||||
load details-display-none-summary-3.html
|
||||
|
||||
@@ -285,19 +285,13 @@ RecordReflowStatus(bool aChildIsBlock, nsReflowStatus aFrameReflowStatus)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Destructor function for the overflowLines frame property
|
||||
static void
|
||||
DestroyOverflowLines(void* aPropertyValue)
|
||||
{
|
||||
NS_ERROR("Overflow lines should never be destroyed by the FramePropertyTable");
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(OverflowLinesProperty, DestroyOverflowLines)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(OverflowLinesProperty,
|
||||
nsBlockFrame::FrameLines)
|
||||
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OverflowOutOfFlowsProperty)
|
||||
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(PushedFloatProperty)
|
||||
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OutsideBulletProperty)
|
||||
NS_DECLARE_FRAME_PROPERTY(InsideBulletProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY(BlockEndEdgeOfChildrenProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(InsideBulletProperty, nsBulletFrame)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BlockEndEdgeOfChildrenProperty, nscoord)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@@ -1636,8 +1630,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
||||
|
||||
FrameProperties properties = Properties();
|
||||
if (blockEndEdgeOfChildren != finalSize.BSize(wm) - borderPadding.BEnd(wm)) {
|
||||
properties.Set(BlockEndEdgeOfChildrenProperty(),
|
||||
NS_INT32_TO_PTR(blockEndEdgeOfChildren));
|
||||
properties.Set(BlockEndEdgeOfChildrenProperty(), blockEndEdgeOfChildren);
|
||||
} else {
|
||||
properties.Delete(BlockEndEdgeOfChildrenProperty());
|
||||
}
|
||||
@@ -1771,8 +1764,8 @@ nsBlockFrame::UpdateOverflow()
|
||||
kPrincipalList | kFloatList);
|
||||
|
||||
bool found;
|
||||
nscoord blockEndEdgeOfChildren = NS_PTR_TO_INT32(
|
||||
Properties().Get(BlockEndEdgeOfChildrenProperty(), &found));
|
||||
nscoord blockEndEdgeOfChildren =
|
||||
Properties().Get(BlockEndEdgeOfChildrenProperty(), &found);
|
||||
if (found) {
|
||||
ConsiderBlockEndEdgeOfChildren(GetWritingMode(),
|
||||
blockEndEdgeOfChildren, overflowAreas);
|
||||
@@ -4906,8 +4899,7 @@ nsBlockFrame::GetOverflowLines() const
|
||||
if (!HasOverflowLines()) {
|
||||
return nullptr;
|
||||
}
|
||||
FrameLines* prop =
|
||||
static_cast<FrameLines*>(Properties().Get(OverflowLinesProperty()));
|
||||
FrameLines* prop = Properties().Get(OverflowLinesProperty());
|
||||
NS_ASSERTION(prop && !prop->mLines.empty() &&
|
||||
prop->mLines.front()->GetChildCount() == 0 ? prop->mFrames.IsEmpty() :
|
||||
prop->mLines.front()->mFirstChild == prop->mFrames.FirstChild(),
|
||||
@@ -4921,8 +4913,7 @@ nsBlockFrame::RemoveOverflowLines()
|
||||
if (!HasOverflowLines()) {
|
||||
return nullptr;
|
||||
}
|
||||
FrameLines* prop =
|
||||
static_cast<FrameLines*>(Properties().Remove(OverflowLinesProperty()));
|
||||
FrameLines* prop = Properties().Remove(OverflowLinesProperty());
|
||||
NS_ASSERTION(prop && !prop->mLines.empty() &&
|
||||
prop->mLines.front()->GetChildCount() == 0 ? prop->mFrames.IsEmpty() :
|
||||
prop->mLines.front()->mFirstChild == prop->mFrames.FirstChild(),
|
||||
@@ -4935,8 +4926,7 @@ void
|
||||
nsBlockFrame::DestroyOverflowLines()
|
||||
{
|
||||
NS_ASSERTION(HasOverflowLines(), "huh?");
|
||||
FrameLines* prop =
|
||||
static_cast<FrameLines*>(Properties().Remove(OverflowLinesProperty()));
|
||||
FrameLines* prop = Properties().Remove(OverflowLinesProperty());
|
||||
NS_ASSERTION(prop && prop->mLines.empty(),
|
||||
"value should always be stored but empty when destroying");
|
||||
RemoveStateBits(NS_BLOCK_HAS_OVERFLOW_LINES);
|
||||
@@ -5012,8 +5002,7 @@ nsBlockFrame::GetInsideBullet() const
|
||||
return nullptr;
|
||||
}
|
||||
NS_ASSERTION(!HasOutsideBullet(), "invalid bullet state");
|
||||
nsBulletFrame* frame =
|
||||
static_cast<nsBulletFrame*>(Properties().Get(InsideBulletProperty()));
|
||||
nsBulletFrame* frame = Properties().Get(InsideBulletProperty());
|
||||
NS_ASSERTION(frame && frame->GetType() == nsGkAtoms::bulletFrame,
|
||||
"bogus inside bullet frame");
|
||||
return frame;
|
||||
@@ -6716,8 +6705,7 @@ nsLineBox* nsBlockFrame::GetFirstLineContaining(nscoord y)
|
||||
|
||||
FrameProperties props = Properties();
|
||||
|
||||
nsLineBox* property = static_cast<nsLineBox*>
|
||||
(props.Get(LineCursorProperty()));
|
||||
nsLineBox* property = props.Get(LineCursorProperty());
|
||||
line_iterator cursor = mLines.begin(property);
|
||||
nsRect cursorArea = cursor->GetVisualOverflowArea();
|
||||
|
||||
|
||||
@@ -371,10 +371,10 @@ protected:
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(LineCursorProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(LineCursorProperty, nsLineBox)
|
||||
nsLineBox* GetLineCursor() {
|
||||
return (GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR) ?
|
||||
static_cast<nsLineBox*>(Properties().Get(LineCursorProperty())) : nullptr;
|
||||
Properties().Get(LineCursorProperty()) : nullptr;
|
||||
}
|
||||
|
||||
nsLineBox* NewLineBox(nsIFrame* aFrame, bool aIsBlock) {
|
||||
|
||||
@@ -41,7 +41,7 @@ using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::image;
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(FontSizeInflationProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(FontSizeInflationProperty, float)
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsBulletFrame)
|
||||
|
||||
@@ -849,22 +849,13 @@ nsBulletFrame::GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGro
|
||||
*aLoadGroup = doc->GetDocumentLoadGroup().take();
|
||||
}
|
||||
|
||||
union VoidPtrOrFloat {
|
||||
VoidPtrOrFloat() : p(nullptr) {}
|
||||
|
||||
void *p;
|
||||
float f;
|
||||
};
|
||||
|
||||
float
|
||||
nsBulletFrame::GetFontSizeInflation() const
|
||||
{
|
||||
if (!HasFontSizeInflation()) {
|
||||
return 1.0f;
|
||||
}
|
||||
VoidPtrOrFloat u;
|
||||
u.p = Properties().Get(FontSizeInflationProperty());
|
||||
return u.f;
|
||||
return Properties().Get(FontSizeInflationProperty());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -879,9 +870,7 @@ nsBulletFrame::SetFontSizeInflation(float aInflation)
|
||||
}
|
||||
|
||||
AddStateBits(BULLET_FRAME_HAS_FONT_INFLATION);
|
||||
VoidPtrOrFloat u;
|
||||
u.f = aInflation;
|
||||
Properties().Set(FontSizeInflationProperty(), u.p);
|
||||
Properties().Set(FontSizeInflationProperty(), aInflation);
|
||||
}
|
||||
|
||||
already_AddRefed<imgIContainer>
|
||||
|
||||
@@ -402,11 +402,12 @@ nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
bool needBlendContainer = false;
|
||||
|
||||
// Create separate items for each background layer.
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
|
||||
if (bg->mLayers[i].mImage.IsEmpty()) {
|
||||
const nsStyleImageLayers& layers = bg->mLayers;
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, layers) {
|
||||
if (layers.mLayers[i].mImage.IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (bg->mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
|
||||
if (layers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
|
||||
needBlendContainer = true;
|
||||
}
|
||||
nsDisplayCanvasBackgroundImage* bgItem =
|
||||
|
||||
@@ -220,8 +220,8 @@ public:
|
||||
// compositing layer. Since we know their background painting area can't
|
||||
// change (unless the viewport size itself changes), async scrolling
|
||||
// will work well.
|
||||
return mBackgroundStyle->mLayers[mLayer].mAttachment == NS_STYLE_BG_ATTACHMENT_FIXED &&
|
||||
!mBackgroundStyle->mLayers[mLayer].mImage.IsEmpty();
|
||||
return mBackgroundStyle->mLayers.mLayers[mLayer].mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED &&
|
||||
!mBackgroundStyle->mLayers.mLayers[mLayer].mImage.IsEmpty();
|
||||
}
|
||||
|
||||
// We still need to paint a background color as well as an image for this item,
|
||||
|
||||
@@ -188,13 +188,12 @@ void
|
||||
nsContainerFrame::SafelyDestroyFrameListProp(nsIFrame* aDestructRoot,
|
||||
nsIPresShell* aPresShell,
|
||||
FramePropertyTable* aPropTable,
|
||||
const FramePropertyDescriptor* aProp)
|
||||
FrameListPropertyDescriptor aProp)
|
||||
{
|
||||
// Note that the last frame can be removed through another route and thus
|
||||
// delete the property -- that's why we fetch the property again before
|
||||
// removing each frame rather than fetching it once and iterating the list.
|
||||
while (nsFrameList* frameList =
|
||||
static_cast<nsFrameList*>(aPropTable->Get(this, aProp))) {
|
||||
while (nsFrameList* frameList = aPropTable->Get(this, aProp)) {
|
||||
nsIFrame* frame = frameList->RemoveFirstChild();
|
||||
if (MOZ_LIKELY(frame)) {
|
||||
frame->DestroyFrom(aDestructRoot);
|
||||
@@ -275,15 +274,14 @@ nsContainerFrame::GetChildList(ChildListID aListID) const
|
||||
}
|
||||
}
|
||||
|
||||
static void AppendIfNonempty(const nsIFrame* aFrame,
|
||||
FramePropertyTable* aPropTable,
|
||||
const FramePropertyDescriptor* aProperty,
|
||||
nsTArray<nsIFrame::ChildList>* aLists,
|
||||
nsIFrame::ChildListID aListID)
|
||||
static void
|
||||
AppendIfNonempty(const nsIFrame* aFrame,
|
||||
FramePropertyTable* aPropTable,
|
||||
nsContainerFrame::FrameListPropertyDescriptor aProperty,
|
||||
nsTArray<nsIFrame::ChildList>* aLists,
|
||||
nsIFrame::ChildListID aListID)
|
||||
{
|
||||
nsFrameList* list = static_cast<nsFrameList*>(
|
||||
aPropTable->Get(aFrame, aProperty));
|
||||
if (list) {
|
||||
if (nsFrameList* list = aPropTable->Get(aFrame, aProperty)) {
|
||||
list->AppendIfNonempty(aLists, aListID);
|
||||
}
|
||||
}
|
||||
@@ -1376,9 +1374,10 @@ nsContainerFrame::DisplayOverflowContainers(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
static bool
|
||||
TryRemoveFrame(nsIFrame* aFrame, FramePropertyTable* aPropTable,
|
||||
const FramePropertyDescriptor* aProp, nsIFrame* aChildToRemove)
|
||||
nsContainerFrame::FrameListPropertyDescriptor aProp,
|
||||
nsIFrame* aChildToRemove)
|
||||
{
|
||||
nsFrameList* list = static_cast<nsFrameList*>(aPropTable->Get(aFrame, aProp));
|
||||
nsFrameList* list = aPropTable->Get(aFrame, aProp);
|
||||
if (list && list->StartRemoveFrame(aChildToRemove)) {
|
||||
// aChildToRemove *may* have been removed from this list.
|
||||
if (list->IsEmpty()) {
|
||||
@@ -1399,11 +1398,9 @@ nsContainerFrame::StealFrame(nsIFrame* aChild,
|
||||
nsFrameList* list = GetOverflowFrames();
|
||||
if (!list || !list->ContainsFrame(aChild)) {
|
||||
FramePropertyTable* propTable = PresContext()->PropertyTable();
|
||||
list = static_cast<nsFrameList*>(
|
||||
propTable->Get(this, OverflowContainersProperty()));
|
||||
list = propTable->Get(this, OverflowContainersProperty());
|
||||
if (!list || !list->ContainsFrame(aChild)) {
|
||||
list = static_cast<nsFrameList*>(
|
||||
propTable->Get(this, ExcessOverflowContainersProperty()));
|
||||
list = propTable->Get(this, ExcessOverflowContainersProperty());
|
||||
MOZ_ASSERT(list && list->ContainsFrame(aChild), "aChild isn't our child"
|
||||
" or on a frame list not supported by StealFrame");
|
||||
}
|
||||
@@ -1572,22 +1569,21 @@ nsContainerFrame::SetOverflowFrames(const nsFrameList& aOverflowFrames)
|
||||
}
|
||||
|
||||
nsFrameList*
|
||||
nsContainerFrame::GetPropTableFrames(const FramePropertyDescriptor* aProperty) const
|
||||
nsContainerFrame::GetPropTableFrames(
|
||||
FrameListPropertyDescriptor aProperty) const
|
||||
{
|
||||
FramePropertyTable* propTable = PresContext()->PropertyTable();
|
||||
return static_cast<nsFrameList*>(propTable->Get(this, aProperty));
|
||||
return PresContext()->PropertyTable()->Get(this, aProperty);
|
||||
}
|
||||
|
||||
nsFrameList*
|
||||
nsContainerFrame::RemovePropTableFrames(const FramePropertyDescriptor* aProperty)
|
||||
nsContainerFrame::RemovePropTableFrames(FrameListPropertyDescriptor aProperty)
|
||||
{
|
||||
FramePropertyTable* propTable = PresContext()->PropertyTable();
|
||||
return static_cast<nsFrameList*>(propTable->Remove(this, aProperty));
|
||||
return PresContext()->PropertyTable()->Remove(this, aProperty);
|
||||
}
|
||||
|
||||
void
|
||||
nsContainerFrame::SetPropTableFrames(nsFrameList* aFrameList,
|
||||
const FramePropertyDescriptor* aProperty)
|
||||
nsContainerFrame::SetPropTableFrames(nsFrameList* aFrameList,
|
||||
FrameListPropertyDescriptor aProperty)
|
||||
{
|
||||
NS_PRECONDITION(aProperty && aFrameList, "null ptr");
|
||||
NS_PRECONDITION(
|
||||
@@ -1997,8 +1993,8 @@ nsOverflowContinuationTracker::EndFinish(nsIFrame* aChild)
|
||||
// Forget mOverflowContList if it was deleted.
|
||||
nsPresContext* pc = aChild->PresContext();
|
||||
FramePropertyTable* propTable = pc->PropertyTable();
|
||||
nsFrameList* eoc = static_cast<nsFrameList*>(propTable->Get(mParent,
|
||||
nsContainerFrame::ExcessOverflowContainersProperty()));
|
||||
nsFrameList* eoc = propTable->Get(
|
||||
mParent, nsContainerFrame::ExcessOverflowContainersProperty());
|
||||
if (eoc != mOverflowContList) {
|
||||
nsFrameList* oc = static_cast<nsFrameList*>(propTable->Get(mParent,
|
||||
nsContainerFrame::OverflowContainersProperty()));
|
||||
|
||||
@@ -431,15 +431,6 @@ public:
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
|
||||
/**
|
||||
* Destructor function for the proptable-stored framelists --
|
||||
* it should never be called.
|
||||
*/
|
||||
static void DestroyFrameList(void* aPropertyValue)
|
||||
{
|
||||
MOZ_ASSERT(false, "The owning frame should destroy its nsFrameList props");
|
||||
}
|
||||
|
||||
static void PlaceFrameView(nsIFrame* aFrame)
|
||||
{
|
||||
if (aFrame->HasView())
|
||||
@@ -448,8 +439,10 @@ public:
|
||||
nsContainerFrame::PositionChildViews(aFrame);
|
||||
}
|
||||
|
||||
#define NS_DECLARE_FRAME_PROPERTY_FRAMELIST(prop) \
|
||||
NS_DECLARE_FRAME_PROPERTY(prop, nsContainerFrame::DestroyFrameList)
|
||||
#define NS_DECLARE_FRAME_PROPERTY_FRAMELIST(prop) \
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, nsFrameList)
|
||||
|
||||
typedef PropertyDescriptor<nsFrameList> FrameListPropertyDescriptor;
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OverflowProperty)
|
||||
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OverflowContainersProperty)
|
||||
@@ -458,9 +451,9 @@ public:
|
||||
|
||||
#ifdef DEBUG
|
||||
// Use this to suppress the CRAZY_SIZE assertions.
|
||||
NS_DECLARE_FRAME_PROPERTY(DebugReflowingWithInfiniteISize, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(DebugReflowingWithInfiniteISize, bool)
|
||||
bool IsCrazySizeAssertSuppressed() const {
|
||||
return Properties().Get(DebugReflowingWithInfiniteISize()) != nullptr;
|
||||
return Properties().Get(DebugReflowingWithInfiniteISize());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -601,20 +594,20 @@ protected:
|
||||
* Get the PresContext-stored nsFrameList named aPropID for this frame.
|
||||
* May return null.
|
||||
*/
|
||||
nsFrameList* GetPropTableFrames(const FramePropertyDescriptor* aProperty) const;
|
||||
nsFrameList* GetPropTableFrames(FrameListPropertyDescriptor aProperty) const;
|
||||
|
||||
/**
|
||||
* Remove and return the PresContext-stored nsFrameList named aPropID for
|
||||
* this frame. May return null.
|
||||
*/
|
||||
nsFrameList* RemovePropTableFrames(const FramePropertyDescriptor* aProperty);
|
||||
nsFrameList* RemovePropTableFrames(FrameListPropertyDescriptor aProperty);
|
||||
|
||||
/**
|
||||
* Set the PresContext-stored nsFrameList named aPropID for this frame
|
||||
* to the given aFrameList, which must not be null.
|
||||
*/
|
||||
void SetPropTableFrames(nsFrameList* aFrameList,
|
||||
const FramePropertyDescriptor* aProperty);
|
||||
void SetPropTableFrames(nsFrameList* aFrameList,
|
||||
FrameListPropertyDescriptor aProperty);
|
||||
|
||||
/**
|
||||
* Safely destroy the frames on the nsFrameList stored on aProp for this
|
||||
@@ -624,7 +617,7 @@ protected:
|
||||
void SafelyDestroyFrameListProp(nsIFrame* aDestructRoot,
|
||||
nsIPresShell* aPresShell,
|
||||
mozilla::FramePropertyTable* aPropTable,
|
||||
const FramePropertyDescriptor* aProp);
|
||||
FrameListPropertyDescriptor aProp);
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
@@ -805,8 +798,7 @@ inline
|
||||
nsFrameList*
|
||||
nsContainerFrame::GetOverflowFrames() const
|
||||
{
|
||||
nsFrameList* list =
|
||||
static_cast<nsFrameList*>(Properties().Get(OverflowProperty()));
|
||||
nsFrameList* list = Properties().Get(OverflowProperty());
|
||||
NS_ASSERTION(!list || !list->IsEmpty(), "Unexpected empty overflow list");
|
||||
return list;
|
||||
}
|
||||
@@ -815,8 +807,7 @@ inline
|
||||
nsFrameList*
|
||||
nsContainerFrame::StealOverflowFrames()
|
||||
{
|
||||
nsFrameList* list =
|
||||
static_cast<nsFrameList*>(Properties().Remove(OverflowProperty()));
|
||||
nsFrameList* list = Properties().Remove(OverflowProperty());
|
||||
NS_ASSERTION(!list || !list->IsEmpty(), "Unexpected empty overflow list");
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -3781,7 +3781,7 @@ public:
|
||||
NS_ASSERTION(aItem.HasIntrinsicRatio(),
|
||||
"This should only be needed for items with an aspect ratio");
|
||||
|
||||
mItemProps.Set(nsIFrame::FlexItemMainSizeOverride(), reinterpret_cast<void *>(aItem.GetMainSize()));
|
||||
mItemProps.Set(nsIFrame::FlexItemMainSizeOverride(), aItem.GetMainSize());
|
||||
}
|
||||
|
||||
~AutoFlexItemMainSizeOverride() {
|
||||
|
||||
@@ -323,7 +323,7 @@ nsFloatManager::CalculateRegionFor(WritingMode aWM,
|
||||
return region;
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(FloatRegionProperty, DeleteValue<nsMargin>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(FloatRegionProperty, nsMargin)
|
||||
|
||||
LogicalRect
|
||||
nsFloatManager::GetRegionFor(WritingMode aWM, nsIFrame* aFloat,
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layout;
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(FontInflationDataProperty,
|
||||
DeleteValue<nsFontInflationData>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(FontInflationDataProperty,
|
||||
nsFontInflationData)
|
||||
|
||||
/* static */ nsFontInflationData*
|
||||
nsFontInflationData::FindFontInflationDataFor(const nsIFrame *aFrame)
|
||||
|
||||
+26
-29
@@ -160,7 +160,7 @@ static void RefreshContentFrames(nsPresContext* aPresContext, nsIContent * aStar
|
||||
|
||||
#include "prenv.h"
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(BoxMetricsProperty, DeleteValue<nsBoxLayoutMetrics>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(BoxMetricsProperty, nsBoxLayoutMetrics)
|
||||
|
||||
static void
|
||||
InitBoxMetrics(nsIFrame* aFrame, bool aClear)
|
||||
@@ -240,8 +240,8 @@ nsFrame::SetVerifyStyleTreeEnable(bool aEnabled)
|
||||
|
||||
#endif
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(AbsoluteContainingBlockProperty,
|
||||
DeleteValue<nsAbsoluteContainingBlock>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(AbsoluteContainingBlockProperty,
|
||||
nsAbsoluteContainingBlock)
|
||||
|
||||
bool
|
||||
nsIFrame::HasAbsolutelyPositionedChildren() const {
|
||||
@@ -251,8 +251,7 @@ nsIFrame::HasAbsolutelyPositionedChildren() const {
|
||||
nsAbsoluteContainingBlock*
|
||||
nsIFrame::GetAbsoluteContainingBlock() const {
|
||||
NS_ASSERTION(IsAbsoluteContainer(), "The frame is not marked as an abspos container correctly");
|
||||
nsAbsoluteContainingBlock* absCB = static_cast<nsAbsoluteContainingBlock*>
|
||||
(Properties().Get(AbsoluteContainingBlockProperty()));
|
||||
nsAbsoluteContainingBlock* absCB = Properties().Get(AbsoluteContainingBlockProperty());
|
||||
NS_ASSERTION(absCB, "The frame is marked as an abspos container but doesn't have the property");
|
||||
return absCB;
|
||||
}
|
||||
@@ -781,33 +780,35 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
aOldStyleContext->StyleBackground() :
|
||||
nullptr;
|
||||
const nsStyleBackground *newBG = StyleBackground();
|
||||
const nsStyleImageLayers& oldBGLayers = oldBG->mLayers;
|
||||
const nsStyleImageLayers& newBGLayers = newBG->mLayers;
|
||||
if (oldBG) {
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, oldBG) {
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, oldBGLayers) {
|
||||
// If there is an image in oldBG that's not in newBG, drop it.
|
||||
if (i >= newBG->mImageCount ||
|
||||
!oldBG->mLayers[i].mImage.ImageDataEquals(newBG->mLayers[i].mImage)) {
|
||||
const nsStyleImage& oldImage = oldBG->mLayers[i].mImage;
|
||||
if (i >= newBGLayers.mImageCount ||
|
||||
!oldBGLayers.mLayers[i].mImage.ImageDataEquals(newBGLayers.mLayers[i].mImage)) {
|
||||
const nsStyleImage& oldImage = oldBGLayers.mLayers[i].mImage;
|
||||
if (oldImage.GetType() != eStyleImageType_Image) {
|
||||
continue;
|
||||
}
|
||||
|
||||
imageLoader->DisassociateRequestFromFrame(oldImage.GetImageData(),
|
||||
this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, newBG) {
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, newBGLayers) {
|
||||
// If there is an image in newBG that's not in oldBG, add it.
|
||||
if (!oldBG || i >= oldBG->mImageCount ||
|
||||
!newBG->mLayers[i].mImage.ImageDataEquals(oldBG->mLayers[i].mImage)) {
|
||||
const nsStyleImage& newImage = newBG->mLayers[i].mImage;
|
||||
if (!oldBG || i >= oldBGLayers.mImageCount ||
|
||||
!newBGLayers.mLayers[i].mImage.ImageDataEquals(oldBGLayers.mLayers[i].mImage)) {
|
||||
const nsStyleImage& newImage = newBGLayers.mLayers[i].mImage;
|
||||
if (newImage.GetType() != eStyleImageType_Image) {
|
||||
continue;
|
||||
}
|
||||
|
||||
imageLoader->AssociateRequestToFrame(newImage.GetImageData(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aOldStyleContext) {
|
||||
@@ -4811,7 +4812,7 @@ nsIFrame* nsIFrame::GetTailContinuation()
|
||||
return frame;
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(ViewProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(ViewProperty, nsView)
|
||||
|
||||
// Associated view object
|
||||
nsView*
|
||||
@@ -4822,9 +4823,9 @@ nsIFrame::GetView() const
|
||||
return nullptr;
|
||||
|
||||
// Check for a property on the frame
|
||||
void* value = Properties().Get(ViewProperty());
|
||||
nsView* value = Properties().Get(ViewProperty());
|
||||
NS_ASSERTION(value, "frame state bit was set but frame has no view");
|
||||
return static_cast<nsView*>(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/* virtual */ nsView*
|
||||
@@ -6255,9 +6256,8 @@ nsFrame::GetPointFromOffset(int32_t inOffset, nsPoint* outPoint)
|
||||
// If the embedding level isn't set, just use the CSS direction
|
||||
// property.
|
||||
bool hasEmbeddingLevel;
|
||||
nsBidiLevel embeddingLevel =
|
||||
NS_PTR_TO_INT32(Properties().Get(nsBidi::EmbeddingLevelProperty(),
|
||||
&hasEmbeddingLevel));
|
||||
nsBidiLevel embeddingLevel = Properties().Get(
|
||||
nsBidi::EmbeddingLevelProperty(), &hasEmbeddingLevel);
|
||||
bool isRTL = hasEmbeddingLevel
|
||||
? IS_LEVEL_RTL(embeddingLevel)
|
||||
: StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
@@ -7387,7 +7387,7 @@ nsFrame::AccessibleType()
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(OverflowAreasProperty, DeleteValue<nsOverflowAreas>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(OverflowAreasProperty, nsOverflowAreas)
|
||||
|
||||
bool
|
||||
nsIFrame::ClearOverflowRects()
|
||||
@@ -7711,7 +7711,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
|
||||
Properties().Delete(nsIFrame::InitialOverflowProperty());
|
||||
}
|
||||
#ifdef DEBUG
|
||||
Properties().Set(nsIFrame::DebugInitialOverflowPropertyApplied(), nullptr);
|
||||
Properties().Set(nsIFrame::DebugInitialOverflowPropertyApplied(), true);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
@@ -9063,16 +9063,13 @@ nsIFrame::IsSelected() const
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
nsIFrame::DestroyContentArray(void* aPropertyValue)
|
||||
nsIFrame::DestroyContentArray(ContentArray* aArray)
|
||||
{
|
||||
typedef nsTArray<nsIContent*> T;
|
||||
T* arr = static_cast<T*>(aPropertyValue);
|
||||
for (T::size_type i = 0; i < arr->Length(); ++i) {
|
||||
nsIContent* content = (*arr)[i];
|
||||
for (nsIContent* content : *aArray) {
|
||||
content->UnbindFromTree();
|
||||
NS_RELEASE(content);
|
||||
}
|
||||
delete arr;
|
||||
delete aArray;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -5728,7 +5728,7 @@ ScrollSnapHelper(SnappingEdgeCallback& aCallback, nsIFrame* aFrame,
|
||||
nsPoint offset = f->GetOffsetTo(aScrolledFrame);
|
||||
nsRect edgesRect = nsRect(offset, frameRect.Size());
|
||||
for (size_t coordNum = 0; coordNum < coordCount; coordNum++) {
|
||||
const nsStyleBackground::Position &coordPosition =
|
||||
const nsStyleImageLayers::Position &coordPosition =
|
||||
f->StyleDisplay()->mScrollSnapCoordinate[coordNum];
|
||||
nsPoint coordPoint = edgesRect.TopLeft() - aScrollSnapDestination;
|
||||
coordPoint += nsPoint(coordPosition.mXPosition.mLength,
|
||||
|
||||
@@ -2320,8 +2320,8 @@ ContentContribution(nsIFrame* aChild,
|
||||
}
|
||||
#ifdef DEBUG
|
||||
// This will suppress various CRAZY_SIZE warnings for this reflow.
|
||||
parent->Properties().Set(nsContainerFrame::DebugReflowingWithInfiniteISize(),
|
||||
parent /* anything non-null will do */);
|
||||
parent->Properties().Set(
|
||||
nsContainerFrame::DebugReflowingWithInfiniteISize(), true);
|
||||
#endif
|
||||
// XXX this will give mostly correct results for now (until bug 1174569).
|
||||
LogicalSize availableSize(wm, INFINITE_ISIZE_COORD, NS_UNCONSTRAINEDSIZE);
|
||||
|
||||
@@ -105,18 +105,18 @@ public:
|
||||
StateBits mState;
|
||||
};
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(GridItemContainingBlockRect, DeleteValue<nsRect>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(GridItemContainingBlockRect, nsRect)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(GridColTrackInfo, DeleteValue<ComputedGridTrackInfo>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(GridColTrackInfo, ComputedGridTrackInfo)
|
||||
const ComputedGridTrackInfo* GetComputedTemplateColumns()
|
||||
{
|
||||
return static_cast<ComputedGridTrackInfo*>(Properties().Get(GridColTrackInfo()));
|
||||
return Properties().Get(GridColTrackInfo());
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(GridRowTrackInfo, DeleteValue<ComputedGridTrackInfo>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(GridRowTrackInfo, ComputedGridTrackInfo)
|
||||
const ComputedGridTrackInfo* GetComputedTemplateRows()
|
||||
{
|
||||
return static_cast<ComputedGridTrackInfo*>(Properties().Get(GridRowTrackInfo()));
|
||||
return Properties().Get(GridRowTrackInfo());
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -597,13 +597,13 @@ protected:
|
||||
* grid-template-columns / grid-template-rows are stored in this frame
|
||||
* property when needed, as a ImplicitNamedAreas* value.
|
||||
*/
|
||||
NS_DECLARE_FRAME_PROPERTY(ImplicitNamedAreasProperty,
|
||||
DeleteValue<ImplicitNamedAreas>)
|
||||
typedef nsTHashtable<nsStringHashKey> ImplicitNamedAreas;
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ImplicitNamedAreasProperty,
|
||||
ImplicitNamedAreas)
|
||||
void InitImplicitNamedAreas(const nsStylePosition* aStyle);
|
||||
void AddImplicitNamedAreas(const nsTArray<nsTArray<nsString>>& aLineNameLists);
|
||||
typedef nsTHashtable<nsStringHashKey> ImplicitNamedAreas;
|
||||
ImplicitNamedAreas* GetImplicitNamedAreas() const {
|
||||
return static_cast<ImplicitNamedAreas*>(Properties().Get(ImplicitNamedAreasProperty()));
|
||||
return Properties().Get(ImplicitNamedAreasProperty());
|
||||
}
|
||||
bool HasImplicitNamedArea(const nsString& aName) const {
|
||||
ImplicitNamedAreas* areas = GetImplicitNamedAreas();
|
||||
|
||||
@@ -2388,12 +2388,12 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
||||
|
||||
static void
|
||||
UpdateProp(FrameProperties& aProps,
|
||||
const FramePropertyDescriptor* aProperty,
|
||||
const FramePropertyDescriptor<nsMargin>* aProperty,
|
||||
bool aNeeded,
|
||||
nsMargin& aNewValue)
|
||||
{
|
||||
if (aNeeded) {
|
||||
nsMargin* propValue = static_cast<nsMargin*>(aProps.Get(aProperty));
|
||||
nsMargin* propValue = aProps.Get(aProperty);
|
||||
if (propValue) {
|
||||
*propValue = aNewValue;
|
||||
} else {
|
||||
|
||||
+71
-44
@@ -377,16 +377,16 @@ struct IntrinsicSize {
|
||||
|
||||
/// Generic destructor for frame properties. Calls delete.
|
||||
template<typename T>
|
||||
static void DeleteValue(void* aPropertyValue)
|
||||
static void DeleteValue(T* aPropertyValue)
|
||||
{
|
||||
delete static_cast<T*>(aPropertyValue);
|
||||
delete aPropertyValue;
|
||||
}
|
||||
|
||||
/// Generic destructor for frame properties. Calls Release().
|
||||
template<typename T>
|
||||
static void ReleaseValue(void* aPropertyValue)
|
||||
static void ReleaseValue(T* aPropertyValue)
|
||||
{
|
||||
static_cast<T*>(aPropertyValue)->Release();
|
||||
aPropertyValue->Release();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -415,7 +415,9 @@ static void ReleaseValue(void* aPropertyValue)
|
||||
class nsIFrame : public nsQueryFrame
|
||||
{
|
||||
public:
|
||||
typedef mozilla::FramePropertyDescriptor FramePropertyDescriptor;
|
||||
template<typename T=void>
|
||||
using PropertyDescriptor = const mozilla::FramePropertyDescriptor<T>*;
|
||||
|
||||
typedef mozilla::FrameProperties FrameProperties;
|
||||
typedef mozilla::layers::Layer Layer;
|
||||
typedef mozilla::layout::FrameChildList ChildList;
|
||||
@@ -842,68 +844,93 @@ public:
|
||||
|
||||
nsPoint GetPositionIgnoringScrolling();
|
||||
|
||||
static void DestroyContentArray(void* aPropertyValue);
|
||||
typedef nsAutoTArray<nsIContent*, 2> ContentArray;
|
||||
static void DestroyContentArray(ContentArray* aArray);
|
||||
|
||||
#define NS_DECLARE_FRAME_PROPERTY(prop, dtor) \
|
||||
static const FramePropertyDescriptor* prop() { \
|
||||
static const FramePropertyDescriptor descriptor = { dtor, nullptr }; \
|
||||
return &descriptor; \
|
||||
#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, dtor) \
|
||||
static const mozilla::FramePropertyDescriptor<type>* prop() { \
|
||||
static MOZ_CONSTEXPR auto descriptor = \
|
||||
mozilla::FramePropertyDescriptor<type>::NewWithDestructor<dtor>(); \
|
||||
return &descriptor; \
|
||||
}
|
||||
|
||||
// Don't use this unless you really know what you're doing!
|
||||
#define NS_DECLARE_FRAME_PROPERTY_WITH_FRAME_IN_DTOR(prop, dtor) \
|
||||
static const FramePropertyDescriptor* prop() { \
|
||||
static const FramePropertyDescriptor descriptor = { nullptr, dtor }; \
|
||||
return &descriptor; \
|
||||
#define NS_DECLARE_FRAME_PROPERTY_WITH_FRAME_IN_DTOR(prop, type, dtor) \
|
||||
static const mozilla::FramePropertyDescriptor<type>* prop() { \
|
||||
static MOZ_CONSTEXPR auto descriptor = mozilla:: \
|
||||
FramePropertyDescriptor<type>::NewWithDestructorWithFrame<dtor>(); \
|
||||
return &descriptor; \
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(IBSplitSibling, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY(IBSplitPrevSibling, nullptr)
|
||||
#define NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(prop, type) \
|
||||
static const mozilla::FramePropertyDescriptor<type>* prop() { \
|
||||
static MOZ_CONSTEXPR auto descriptor = \
|
||||
mozilla::FramePropertyDescriptor<type>::NewWithoutDestructor(); \
|
||||
return &descriptor; \
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(NormalPositionProperty, DeleteValue<nsPoint>)
|
||||
NS_DECLARE_FRAME_PROPERTY(ComputedOffsetProperty, DeleteValue<nsMargin>)
|
||||
#define NS_DECLARE_FRAME_PROPERTY_DELETABLE(prop, type) \
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, DeleteValue)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(OutlineInnerRectProperty, DeleteValue<nsRect>)
|
||||
NS_DECLARE_FRAME_PROPERTY(PreEffectsBBoxProperty, DeleteValue<nsRect>)
|
||||
NS_DECLARE_FRAME_PROPERTY(PreTransformOverflowAreasProperty,
|
||||
DeleteValue<nsOverflowAreas>)
|
||||
#define NS_DECLARE_FRAME_PROPERTY_RELEASABLE(prop, type) \
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, ReleaseValue)
|
||||
|
||||
#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, type) \
|
||||
static void AssertOnDestroyingProperty##prop(type*) { \
|
||||
MOZ_ASSERT_UNREACHABLE("Frame property " #prop " should never " \
|
||||
"be destroyed by the FramePropertyTable"); \
|
||||
} \
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, \
|
||||
AssertOnDestroyingProperty##prop)
|
||||
|
||||
#define NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(prop, type) \
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(prop, mozilla::SmallValueHolder<type>)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(IBSplitSibling, nsIFrame)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(IBSplitPrevSibling, nsIFrame)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(NormalPositionProperty, nsPoint)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ComputedOffsetProperty, nsMargin)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(OutlineInnerRectProperty, nsRect)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(PreEffectsBBoxProperty, nsRect)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(PreTransformOverflowAreasProperty,
|
||||
nsOverflowAreas)
|
||||
|
||||
// The initial overflow area passed to FinishAndStoreOverflow. This is only set
|
||||
// on frames that Preserve3D() or HasPerspective() or IsTransformed(), and
|
||||
// when at least one of the overflow areas differs from the frame bound rect.
|
||||
NS_DECLARE_FRAME_PROPERTY(InitialOverflowProperty,
|
||||
DeleteValue<nsOverflowAreas>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(InitialOverflowProperty, nsOverflowAreas)
|
||||
|
||||
#ifdef DEBUG
|
||||
// InitialOverflowPropertyDebug is added to the frame to indicate that either
|
||||
// the InitialOverflowProperty has been stored or the InitialOverflowProperty
|
||||
// has been suppressed due to being set to the default value (frame bounds)
|
||||
NS_DECLARE_FRAME_PROPERTY(DebugInitialOverflowPropertyApplied, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(DebugInitialOverflowPropertyApplied, bool)
|
||||
#endif
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(UsedMarginProperty, DeleteValue<nsMargin>)
|
||||
NS_DECLARE_FRAME_PROPERTY(UsedPaddingProperty, DeleteValue<nsMargin>)
|
||||
NS_DECLARE_FRAME_PROPERTY(UsedBorderProperty, DeleteValue<nsMargin>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(UsedMarginProperty, nsMargin)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(UsedPaddingProperty, nsMargin)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(UsedBorderProperty, nsMargin)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(LineBaselineOffset, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(LineBaselineOffset, nscoord)
|
||||
|
||||
// Temporary override for a flex item's main-size property (either width
|
||||
// or height), imposed by its flex container.
|
||||
// XXX: We don't have bug 1064843, so use the previous declaration system
|
||||
// (see bug 1030952 part 3 and TenFourFox issue 493).
|
||||
NS_DECLARE_FRAME_PROPERTY(FlexItemMainSizeOverride, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(FlexItemMainSizeOverride, nscoord)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(CachedBackgroundImage, ReleaseValue<gfxASurface>)
|
||||
NS_DECLARE_FRAME_PROPERTY(CachedBackgroundImageDT, ReleaseValue<DrawTarget>)
|
||||
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(CachedBackgroundImage, gfxASurface)
|
||||
NS_DECLARE_FRAME_PROPERTY_RELEASABLE(CachedBackgroundImageDT, DrawTarget)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(InvalidationRect, DeleteValue<nsRect>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(InvalidationRect, nsRect)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(RefusedAsyncAnimationProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(RefusedAsyncAnimationProperty, bool)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(GenConProperty, DestroyContentArray)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(GenConProperty, ContentArray,
|
||||
DestroyContentArray)
|
||||
|
||||
nsTArray<nsIContent*>* GetGenConPseudos() {
|
||||
const FramePropertyDescriptor* prop = GenConProperty();
|
||||
return static_cast<nsTArray<nsIContent*>*>(Properties().Get(prop));
|
||||
return Properties().Get(GenConProperty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1193,8 +1220,7 @@ public:
|
||||
|
||||
bool RefusedAsyncAnimation() const
|
||||
{
|
||||
void* prop = Properties().Get(nsIFrame::RefusedAsyncAnimationProperty());
|
||||
return bool(reinterpret_cast<intptr_t>(prop));
|
||||
return Properties().Get(RefusedAsyncAnimationProperty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3090,8 +3116,7 @@ private:
|
||||
|
||||
void MarkAbsoluteFramesForDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect);
|
||||
|
||||
static void DestroyPaintedPresShellList(void* propertyValue) {
|
||||
nsTArray<nsWeakPtr>* list = static_cast<nsTArray<nsWeakPtr>*>(propertyValue);
|
||||
static void DestroyPaintedPresShellList(nsTArray<nsWeakPtr>* list) {
|
||||
list->Clear();
|
||||
delete list;
|
||||
}
|
||||
@@ -3099,7 +3124,9 @@ private:
|
||||
// Stores weak references to all the PresShells that were painted during
|
||||
// the last paint event so that we can increment their paint count during
|
||||
// empty transactions
|
||||
NS_DECLARE_FRAME_PROPERTY(PaintedPresShellsProperty, DestroyPaintedPresShellList)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(PaintedPresShellsProperty,
|
||||
nsTArray<nsWeakPtr>,
|
||||
DestroyPaintedPresShellList)
|
||||
|
||||
nsTArray<nsWeakPtr>* PaintedPresShellList() {
|
||||
nsTArray<nsWeakPtr>* list = static_cast<nsTArray<nsWeakPtr>*>(
|
||||
|
||||
@@ -316,20 +316,13 @@ nsInlineFrame::ReparentFloatsForInlineChild(nsIFrame* aOurLineContainer,
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* ancestor = aFrame;
|
||||
do {
|
||||
ancestor = ancestor->GetParent();
|
||||
if (!ancestor)
|
||||
return;
|
||||
} while (!ancestor->IsFloatContainingBlock());
|
||||
|
||||
if (ancestor == aOurLineContainer)
|
||||
nsBlockFrame* frameBlock = nsLayoutUtils::GetFloatContainingBlock(aFrame);
|
||||
if (!frameBlock || frameBlock == aOurLineContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsBlockFrame* ourBlock = nsLayoutUtils::GetAsBlock(aOurLineContainer);
|
||||
NS_ASSERTION(ourBlock, "Not a block, but broke vertically?");
|
||||
nsBlockFrame* frameBlock = nsLayoutUtils::GetAsBlock(ancestor);
|
||||
NS_ASSERTION(frameBlock, "ancestor not a block");
|
||||
|
||||
while (true) {
|
||||
ourBlock->ReparentFloats(aFrame, frameBlock, false);
|
||||
|
||||
@@ -724,7 +724,7 @@ nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
|
||||
nsIFrame* nextBase = GetNextInFlowChild(aPullFrameState.mBase);
|
||||
MOZ_ASSERT(!nextBase || nextBase->GetType() == nsGkAtoms::rubyBaseFrame);
|
||||
aColumn.mBaseFrame = static_cast<nsRubyBaseFrame*>(nextBase);
|
||||
aIsComplete = !aColumn.mBaseFrame;
|
||||
bool foundFrame = !!aColumn.mBaseFrame;
|
||||
bool pullingIntraLevelWhitespace =
|
||||
aColumn.mBaseFrame && aColumn.mBaseFrame->IsIntraLevelWhitespace();
|
||||
|
||||
@@ -735,13 +735,17 @@ nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
|
||||
MOZ_ASSERT(!nextText || nextText->GetType() == nsGkAtoms::rubyTextFrame);
|
||||
nsRubyTextFrame* textFrame = static_cast<nsRubyTextFrame*>(nextText);
|
||||
aColumn.mTextFrames.AppendElement(textFrame);
|
||||
// If there exists any frame in continations, we haven't
|
||||
// completed the reflow process.
|
||||
aIsComplete = aIsComplete && !nextText;
|
||||
foundFrame = foundFrame || nextText;
|
||||
if (nextText && !pullingIntraLevelWhitespace) {
|
||||
pullingIntraLevelWhitespace = textFrame->IsIntraLevelWhitespace();
|
||||
}
|
||||
}
|
||||
// If there exists any frame in continations, we haven't
|
||||
// completed the reflow process.
|
||||
aIsComplete = !foundFrame;
|
||||
if (!foundFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
aColumn.mIsIntraLevelWhitespace = pullingIntraLevelWhitespace;
|
||||
if (pullingIntraLevelWhitespace) {
|
||||
@@ -757,6 +761,31 @@ nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
|
||||
textFrame = nullptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We are not pulling an intra-level whitespace, which means all
|
||||
// elements we are going to pull can have non-whitespace content,
|
||||
// which may contain float which we need to reparent.
|
||||
nsBlockFrame* oldFloatCB = nullptr;
|
||||
for (nsIFrame* frame : aColumn) {
|
||||
oldFloatCB = nsLayoutUtils::GetFloatContainingBlock(frame);
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(oldFloatCB, "Must have found a float containing block");
|
||||
for (nsIFrame* frame : aColumn) {
|
||||
MOZ_ASSERT(nsLayoutUtils::GetFloatContainingBlock(frame) == oldFloatCB,
|
||||
"All frames in the same ruby column should share "
|
||||
"the same old float containing block");
|
||||
}
|
||||
#endif
|
||||
nsBlockFrame* newFloatCB =
|
||||
nsLayoutUtils::GetAsBlock(aLineLayout->LineContainerFrame());
|
||||
MOZ_ASSERT(newFloatCB, "Must have a float containing block");
|
||||
if (oldFloatCB != newFloatCB) {
|
||||
for (nsIFrame* frame : aColumn) {
|
||||
newFloatCB->ReparentFloats(frame, oldFloatCB, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pull the frames of this column.
|
||||
|
||||
@@ -142,7 +142,8 @@ nsRubyFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
ContinuationTraversingState pullState(this);
|
||||
while (aStatus == NS_FRAME_COMPLETE) {
|
||||
nsRubyBaseContainerFrame* baseContainer = PullOneSegment(pullState);
|
||||
nsRubyBaseContainerFrame* baseContainer =
|
||||
PullOneSegment(aReflowState.mLineLayout, pullState);
|
||||
if (!baseContainer) {
|
||||
// No more continuations after, finish now.
|
||||
break;
|
||||
@@ -349,15 +350,21 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsRubyBaseContainerFrame*
|
||||
nsRubyFrame::PullOneSegment(ContinuationTraversingState& aState)
|
||||
nsRubyFrame::PullOneSegment(const nsLineLayout* aLineLayout,
|
||||
ContinuationTraversingState& aState)
|
||||
{
|
||||
// Pull a ruby base container
|
||||
nsIFrame* baseFrame = PullNextInFlowChild(aState);
|
||||
nsIFrame* baseFrame = GetNextInFlowChild(aState);
|
||||
if (!baseFrame) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(baseFrame->GetType() == nsGkAtoms::rubyBaseContainerFrame);
|
||||
|
||||
// Get the float containing block of the base frame before we pull it.
|
||||
nsBlockFrame* oldFloatCB =
|
||||
nsLayoutUtils::GetFloatContainingBlock(baseFrame);
|
||||
PullNextInFlowChild(aState);
|
||||
|
||||
// Pull all ruby text containers following the base container
|
||||
nsIFrame* nextFrame;
|
||||
while ((nextFrame = GetNextInFlowChild(aState)) != nullptr &&
|
||||
@@ -365,5 +372,12 @@ nsRubyFrame::PullOneSegment(ContinuationTraversingState& aState)
|
||||
PullNextInFlowChild(aState);
|
||||
}
|
||||
|
||||
if (nsBlockFrame* newFloatCB =
|
||||
nsLayoutUtils::GetAsBlock(aLineLayout->LineContainerFrame())) {
|
||||
if (oldFloatCB && oldFloatCB != newFloatCB) {
|
||||
newFloatCB->ReparentFloats(baseFrame, oldFloatCB, true);
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<nsRubyBaseContainerFrame*>(baseFrame);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ protected:
|
||||
nsRubyBaseContainerFrame* aBaseContainer,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
nsRubyBaseContainerFrame* PullOneSegment(ContinuationTraversingState& aState);
|
||||
nsRubyBaseContainerFrame* PullOneSegment(const nsLineLayout* aLineLayout,
|
||||
ContinuationTraversingState& aState);
|
||||
|
||||
// The leading required to put the annotations.
|
||||
// They are not initialized until the first reflow.
|
||||
|
||||
@@ -183,14 +183,14 @@ TabWidthStore::ApplySpacing(gfxTextRun::PropertyProvider::Spacing *aSpacing,
|
||||
}
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(TabWidthProperty, DeleteValue<TabWidthStore>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(TabWidthProperty, TabWidthStore)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(OffsetToFrameProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(OffsetToFrameProperty, nsTextFrame)
|
||||
|
||||
// text runs are destroyed by the text run cache
|
||||
NS_DECLARE_FRAME_PROPERTY(UninflatedTextRunProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(UninflatedTextRunProperty, gfxTextRun)
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(FontSizeInflationProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(FontSizeInflationProperty, float)
|
||||
|
||||
class GlyphObserver : public gfxFont::GlyphChangeObserver {
|
||||
public:
|
||||
@@ -207,8 +207,8 @@ private:
|
||||
* The only reason this list is in a property is to automatically destroy the
|
||||
* list when the frame is deleted, unregistering the observers.
|
||||
*/
|
||||
NS_DECLARE_FRAME_PROPERTY(TextFrameGlyphObservers,
|
||||
DeleteValue<nsTArray<nsAutoPtr<GlyphObserver>>>);
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(TextFrameGlyphObservers,
|
||||
nsTArray<nsAutoPtr<GlyphObserver>>)
|
||||
|
||||
static const nsFrameState TEXT_REFLOW_FLAGS =
|
||||
TEXT_FIRST_LETTER |
|
||||
@@ -4218,11 +4218,11 @@ nsContinuingTextFrame::Init(nsIContent* aContent,
|
||||
FramePropertyTable *propTable = PresContext()->PropertyTable();
|
||||
// Get all the properties from the prev-in-flow first to take
|
||||
// advantage of the propTable's cache and simplify the assertion below
|
||||
void* embeddingLevel =
|
||||
auto embeddingLevel =
|
||||
propTable->Get(aPrevInFlow, nsBidi::EmbeddingLevelProperty());
|
||||
void* baseLevel =
|
||||
auto baseLevel =
|
||||
propTable->Get(aPrevInFlow, nsBidi::BaseLevelProperty());
|
||||
void* paragraphDepth =
|
||||
auto paragraphDepth =
|
||||
propTable->Get(aPrevInFlow, nsBidi::ParagraphDepthProperty());
|
||||
propTable->Set(this, nsBidi::EmbeddingLevelProperty(), embeddingLevel);
|
||||
propTable->Set(this, nsBidi::BaseLevelProperty(), baseLevel);
|
||||
@@ -4489,8 +4489,7 @@ nsTextFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemK
|
||||
gfxTextRun*
|
||||
nsTextFrame::GetUninflatedTextRun()
|
||||
{
|
||||
return static_cast<gfxTextRun*>(
|
||||
Properties().Get(UninflatedTextRunProperty()));
|
||||
return Properties().Get(UninflatedTextRunProperty());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4966,9 +4965,8 @@ static nscoord
|
||||
LazyGetLineBaselineOffset(nsIFrame* aChildFrame, nsBlockFrame* aBlockFrame)
|
||||
{
|
||||
bool offsetFound;
|
||||
nscoord offset = NS_PTR_TO_INT32(
|
||||
aChildFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &offsetFound)
|
||||
);
|
||||
nscoord offset = aChildFrame->Properties().Get(
|
||||
nsIFrame::LineBaselineOffset(), &offsetFound);
|
||||
|
||||
if (!offsetFound) {
|
||||
for (nsBlockFrame::line_iterator line = aBlockFrame->begin_lines(),
|
||||
@@ -4980,15 +4978,12 @@ LazyGetLineBaselineOffset(nsIFrame* aChildFrame, nsBlockFrame* aBlockFrame)
|
||||
for (nsIFrame* lineFrame = line->mFirstChild;
|
||||
n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
|
||||
offset = lineBaseline - lineFrame->GetNormalPosition().y;
|
||||
lineFrame->Properties().Set(nsIFrame::LineBaselineOffset(),
|
||||
NS_INT32_TO_PTR(offset));
|
||||
lineFrame->Properties().Set(nsIFrame::LineBaselineOffset(), offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_PTR_TO_INT32(
|
||||
aChildFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &offsetFound)
|
||||
);
|
||||
|
||||
return aChildFrame->Properties().Get(
|
||||
nsIFrame::LineBaselineOffset(), &offsetFound);
|
||||
} else {
|
||||
return offset;
|
||||
}
|
||||
@@ -5180,7 +5175,7 @@ struct EmphasisMarkInfo
|
||||
gfxFloat baselineOffset;
|
||||
};
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(EmphasisMarkProperty, DeleteValue<EmphasisMarkInfo>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(EmphasisMarkProperty, EmphasisMarkInfo)
|
||||
|
||||
static gfxTextRun*
|
||||
GenerateTextRunForEmphasisMarks(nsTextFrame* aFrame, nsFontMetrics* aFontMetrics,
|
||||
@@ -6271,8 +6266,7 @@ nsTextFrame::DrawEmphasisMarks(gfxContext* aContext, WritingMode aWM,
|
||||
const nscolor* aDecorationOverrideColor,
|
||||
PropertyProvider& aProvider)
|
||||
{
|
||||
auto info = static_cast<const EmphasisMarkInfo*>(
|
||||
Properties().Get(EmphasisMarkProperty()));
|
||||
const auto info = Properties().Get(EmphasisMarkProperty());
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
@@ -7249,8 +7243,7 @@ nsTextFrame::GetChildFrameContainingOffset(int32_t aContentOffset,
|
||||
int32_t offset = mContentOffset;
|
||||
|
||||
// Try to look up the offset to frame property
|
||||
nsTextFrame* cachedFrame = static_cast<nsTextFrame*>
|
||||
(Properties().Get(OffsetToFrameProperty()));
|
||||
nsTextFrame* cachedFrame = Properties().Get(OffsetToFrameProperty());
|
||||
|
||||
if (cachedFrame) {
|
||||
f = cachedFrame;
|
||||
@@ -7828,22 +7821,13 @@ FindStartAfterSkippingWhitespace(PropertyProvider* aProvider,
|
||||
return aIterator->GetSkippedOffset();
|
||||
}
|
||||
|
||||
union VoidPtrOrFloat {
|
||||
VoidPtrOrFloat() : p(nullptr) {}
|
||||
|
||||
void *p;
|
||||
float f;
|
||||
};
|
||||
|
||||
float
|
||||
nsTextFrame::GetFontSizeInflation() const
|
||||
{
|
||||
if (!HasFontSizeInflation()) {
|
||||
return 1.0f;
|
||||
}
|
||||
VoidPtrOrFloat u;
|
||||
u.p = Properties().Get(FontSizeInflationProperty());
|
||||
return u.f;
|
||||
return Properties().Get(FontSizeInflationProperty());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -7858,9 +7842,7 @@ nsTextFrame::SetFontSizeInflation(float aInflation)
|
||||
}
|
||||
|
||||
AddStateBits(TEXT_HAS_FONT_INFLATION);
|
||||
VoidPtrOrFloat u;
|
||||
u.f = aInflation;
|
||||
Properties().Set(FontSizeInflationProperty(), u.p);
|
||||
Properties().Set(FontSizeInflationProperty(), aInflation);
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
@@ -9629,7 +9611,7 @@ nsTextFrame::UpdateOverflow()
|
||||
return FinishAndStoreOverflow(overflowAreas, GetSize());
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(JustificationAssignmentProperty, nullptr)
|
||||
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(JustificationAssignmentProperty, int32_t)
|
||||
|
||||
void
|
||||
nsTextFrame::AssignJustificationGaps(
|
||||
@@ -9639,14 +9621,13 @@ nsTextFrame::AssignJustificationGaps(
|
||||
static_assert(sizeof(aAssign) == 1,
|
||||
"The encoding might be broken if JustificationAssignment "
|
||||
"is larger than 1 byte");
|
||||
Properties().Set(JustificationAssignmentProperty(), NS_INT32_TO_PTR(encoded));
|
||||
Properties().Set(JustificationAssignmentProperty(), encoded);
|
||||
}
|
||||
|
||||
mozilla::JustificationAssignment
|
||||
nsTextFrame::GetJustificationAssignment() const
|
||||
{
|
||||
int32_t encoded =
|
||||
NS_PTR_TO_INT32(Properties().Get(JustificationAssignmentProperty()));
|
||||
int32_t encoded = Properties().Get(JustificationAssignmentProperty());
|
||||
mozilla::JustificationAssignment result;
|
||||
result.mGapsAtStart = encoded >> 8;
|
||||
result.mGapsAtEnd = encoded & 0xFF;
|
||||
|
||||
@@ -127,8 +127,8 @@ IsForeignChild(const nsIFrame* aFrame)
|
||||
aFrame->GetType() == nsGkAtoms::blockFrame;
|
||||
}
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(HTMLReflowMetricsProperty,
|
||||
DeleteValue<nsHTMLReflowMetrics>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(HTMLReflowMetricsProperty,
|
||||
nsHTMLReflowMetrics)
|
||||
|
||||
/* static */ void
|
||||
nsMathMLContainerFrame::SaveReflowAndBoundingMetricsFor(nsIFrame* aFrame,
|
||||
@@ -149,8 +149,8 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra
|
||||
{
|
||||
NS_PRECONDITION(aFrame, "null arg");
|
||||
|
||||
nsHTMLReflowMetrics *metrics = static_cast<nsHTMLReflowMetrics*>
|
||||
(aFrame->Properties().Get(HTMLReflowMetricsProperty()));
|
||||
nsHTMLReflowMetrics *metrics =
|
||||
aFrame->Properties().Get(HTMLReflowMetricsProperty());
|
||||
|
||||
// IMPORTANT: This function is only meant to be called in Place() methods
|
||||
// where it is assumed that SaveReflowAndBoundingMetricsFor has recorded the
|
||||
|
||||
@@ -131,12 +131,12 @@ static nsresult ReportParseError(nsIFrame* aFrame, const char16_t* aAttribute,
|
||||
// stored in the property table. Row/Cell frames query the property table
|
||||
// to see what values apply to them.
|
||||
|
||||
NS_DECLARE_FRAME_PROPERTY(RowAlignProperty, DeleteValue<nsTArray<int8_t>>)
|
||||
NS_DECLARE_FRAME_PROPERTY(RowLinesProperty, DeleteValue<nsTArray<int8_t>>)
|
||||
NS_DECLARE_FRAME_PROPERTY(ColumnAlignProperty, DeleteValue<nsTArray<int8_t>>)
|
||||
NS_DECLARE_FRAME_PROPERTY(ColumnLinesProperty, DeleteValue<nsTArray<int8_t>>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(RowAlignProperty, nsTArray<int8_t>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(RowLinesProperty, nsTArray<int8_t>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ColumnAlignProperty, nsTArray<int8_t>)
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ColumnLinesProperty, nsTArray<int8_t>)
|
||||
|
||||
static const FramePropertyDescriptor*
|
||||
static const FramePropertyDescriptor<nsTArray<int8_t>>*
|
||||
AttributeToProperty(nsIAtom* aAttribute)
|
||||
{
|
||||
if (aAttribute == nsGkAtoms::rowalign_)
|
||||
@@ -157,14 +157,14 @@ AttributeToProperty(nsIAtom* aAttribute)
|
||||
*/
|
||||
static nsTArray<int8_t>*
|
||||
FindCellProperty(const nsIFrame* aCellFrame,
|
||||
const FramePropertyDescriptor* aFrameProperty)
|
||||
const FramePropertyDescriptor<nsTArray<int8_t>>* aFrameProperty)
|
||||
{
|
||||
const nsIFrame* currentFrame = aCellFrame;
|
||||
nsTArray<int8_t>* propertyData = nullptr;
|
||||
|
||||
while (currentFrame) {
|
||||
FrameProperties props = currentFrame->Properties();
|
||||
propertyData = static_cast<nsTArray<int8_t>*>(props.Get(aFrameProperty));
|
||||
propertyData = props.Get(aFrameProperty);
|
||||
bool frameIsTable = (currentFrame->GetType() == nsGkAtoms::tableFrame);
|
||||
|
||||
if (propertyData || frameIsTable)
|
||||
|
||||
@@ -539,20 +539,20 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
|
||||
origin->mValue.GetUnit() == eCSSUnit_Enumerated,
|
||||
"should not have inherit/initial within list");
|
||||
|
||||
if (clip->mValue.GetIntValue() != NS_STYLE_BG_CLIP_BORDER ||
|
||||
origin->mValue.GetIntValue() != NS_STYLE_BG_ORIGIN_PADDING) {
|
||||
if (clip->mValue.GetIntValue() != NS_STYLE_IMAGELAYER_CLIP_BORDER ||
|
||||
origin->mValue.GetIntValue() != NS_STYLE_IMAGELAYER_ORIGIN_PADDING) {
|
||||
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
|
||||
eCSSProperty_background_origin] ==
|
||||
nsCSSProps::kBackgroundOriginKTable);
|
||||
nsCSSProps::kImageLayerOriginKTable);
|
||||
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
|
||||
eCSSProperty_background_clip] ==
|
||||
nsCSSProps::kBackgroundOriginKTable);
|
||||
static_assert(NS_STYLE_BG_CLIP_BORDER ==
|
||||
NS_STYLE_BG_ORIGIN_BORDER &&
|
||||
NS_STYLE_BG_CLIP_PADDING ==
|
||||
NS_STYLE_BG_ORIGIN_PADDING &&
|
||||
NS_STYLE_BG_CLIP_CONTENT ==
|
||||
NS_STYLE_BG_ORIGIN_CONTENT,
|
||||
nsCSSProps::kImageLayerOriginKTable);
|
||||
static_assert(NS_STYLE_IMAGELAYER_CLIP_BORDER ==
|
||||
NS_STYLE_IMAGELAYER_ORIGIN_BORDER &&
|
||||
NS_STYLE_IMAGELAYER_CLIP_PADDING ==
|
||||
NS_STYLE_IMAGELAYER_ORIGIN_PADDING &&
|
||||
NS_STYLE_IMAGELAYER_CLIP_CONTENT ==
|
||||
NS_STYLE_IMAGELAYER_ORIGIN_CONTENT,
|
||||
"bg-clip and bg-origin style constants must agree");
|
||||
aValue.Append(char16_t(' '));
|
||||
origin->mValue.AppendToString(eCSSProperty_background_origin, aValue,
|
||||
|
||||
@@ -2923,7 +2923,7 @@ StyleCoordToCSSValue(const nsStyleCoord& aCoord, nsCSSValue& aCSSValue)
|
||||
}
|
||||
|
||||
static void
|
||||
SetPositionValue(const nsStyleBackground::Position& aPos, nsCSSValue& aCSSValue)
|
||||
SetPositionValue(const nsStyleImageLayers::Position& aPos, nsCSSValue& aCSSValue)
|
||||
{
|
||||
RefPtr<nsCSSValue::Array> posArray = nsCSSValue::Array::Create(4);
|
||||
aCSSValue.SetArrayValue(posArray.get(), eCSSUnit_Array);
|
||||
@@ -3292,12 +3292,12 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
|
||||
static_cast<const nsStyleBackground*>(styleStruct);
|
||||
nsAutoPtr<nsCSSValueList> result;
|
||||
nsCSSValueList **resultTail = getter_Transfers(result);
|
||||
MOZ_ASSERT(bg->mPositionCount > 0, "unexpected count");
|
||||
for (uint32_t i = 0, i_end = bg->mPositionCount; i != i_end; ++i) {
|
||||
MOZ_ASSERT(bg->mLayers.mPositionCount > 0, "unexpected count");
|
||||
for (uint32_t i = 0, i_end = bg->mLayers.mPositionCount; i != i_end; ++i) {
|
||||
nsCSSValueList *item = new nsCSSValueList;
|
||||
*resultTail = item;
|
||||
resultTail = &item->mNext;
|
||||
SetPositionValue(bg->mLayers[i].mPosition, item->mValue);
|
||||
SetPositionValue(bg->mLayers.mLayers[i].mPosition, item->mValue);
|
||||
}
|
||||
|
||||
aComputedValue.SetAndAdoptCSSValueListValue(result.forget(),
|
||||
@@ -3310,23 +3310,23 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
|
||||
static_cast<const nsStyleBackground*>(styleStruct);
|
||||
nsAutoPtr<nsCSSValuePairList> result;
|
||||
nsCSSValuePairList **resultTail = getter_Transfers(result);
|
||||
MOZ_ASSERT(bg->mSizeCount > 0, "unexpected count");
|
||||
for (uint32_t i = 0, i_end = bg->mSizeCount; i != i_end; ++i) {
|
||||
MOZ_ASSERT(bg->mLayers.mSizeCount > 0, "unexpected count");
|
||||
for (uint32_t i = 0, i_end = bg->mLayers.mSizeCount; i != i_end; ++i) {
|
||||
nsCSSValuePairList *item = new nsCSSValuePairList;
|
||||
*resultTail = item;
|
||||
resultTail = &item->mNext;
|
||||
|
||||
const nsStyleBackground::Size &size = bg->mLayers[i].mSize;
|
||||
const nsStyleImageLayers::Size &size = bg->mLayers.mLayers[i].mSize;
|
||||
switch (size.mWidthType) {
|
||||
case nsStyleBackground::Size::eContain:
|
||||
case nsStyleBackground::Size::eCover:
|
||||
case nsStyleImageLayers::Size::eContain:
|
||||
case nsStyleImageLayers::Size::eCover:
|
||||
item->mXValue.SetIntValue(size.mWidthType,
|
||||
eCSSUnit_Enumerated);
|
||||
break;
|
||||
case nsStyleBackground::Size::eAuto:
|
||||
case nsStyleImageLayers::Size::eAuto:
|
||||
item->mXValue.SetAutoValue();
|
||||
break;
|
||||
case nsStyleBackground::Size::eLengthPercentage:
|
||||
case nsStyleImageLayers::Size::eLengthPercentage:
|
||||
// XXXbz is there a good reason we can't just
|
||||
// SetCalcValue(&size.mWidth, item->mXValue) here?
|
||||
if (!size.mWidth.mHasPercent &&
|
||||
@@ -3346,14 +3346,14 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
|
||||
}
|
||||
|
||||
switch (size.mHeightType) {
|
||||
case nsStyleBackground::Size::eContain:
|
||||
case nsStyleBackground::Size::eCover:
|
||||
case nsStyleImageLayers::Size::eContain:
|
||||
case nsStyleImageLayers::Size::eCover:
|
||||
// leave it null
|
||||
break;
|
||||
case nsStyleBackground::Size::eAuto:
|
||||
case nsStyleImageLayers::Size::eAuto:
|
||||
item->mYValue.SetAutoValue();
|
||||
break;
|
||||
case nsStyleBackground::Size::eLengthPercentage:
|
||||
case nsStyleImageLayers::Size::eLengthPercentage:
|
||||
// XXXbz is there a good reason we can't just
|
||||
// SetCalcValue(&size.mHeight, item->mYValue) here?
|
||||
if (!size.mHeight.mHasPercent &&
|
||||
|
||||
@@ -852,7 +852,7 @@ protected:
|
||||
// Property specific parsing routines
|
||||
bool ParseBackground();
|
||||
|
||||
struct BackgroundParseState {
|
||||
struct ImageLayersShorthandParseState {
|
||||
nsCSSValue& mColor;
|
||||
nsCSSValueList* mImage;
|
||||
nsCSSValuePairList* mRepeat;
|
||||
@@ -861,23 +861,27 @@ protected:
|
||||
nsCSSValueList* mOrigin;
|
||||
nsCSSValueList* mPosition;
|
||||
nsCSSValuePairList* mSize;
|
||||
BackgroundParseState(
|
||||
nsCSSValueList* mComposite;
|
||||
nsCSSValueList* mMode;
|
||||
ImageLayersShorthandParseState(
|
||||
nsCSSValue& aColor, nsCSSValueList* aImage, nsCSSValuePairList* aRepeat,
|
||||
nsCSSValueList* aAttachment, nsCSSValueList* aClip,
|
||||
nsCSSValueList* aOrigin, nsCSSValueList* aPosition,
|
||||
nsCSSValuePairList* aSize) :
|
||||
nsCSSValuePairList* aSize, nsCSSValueList* aComposite,
|
||||
nsCSSValueList* aMode) :
|
||||
mColor(aColor), mImage(aImage), mRepeat(aRepeat),
|
||||
mAttachment(aAttachment), mClip(aClip), mOrigin(aOrigin),
|
||||
mPosition(aPosition), mSize(aSize) {};
|
||||
mPosition(aPosition), mSize(aSize), mComposite(aComposite),
|
||||
mMode(aMode) {};
|
||||
};
|
||||
|
||||
bool IsFunctionTokenValidForBackgroundImage(const nsCSSToken& aToken) const;
|
||||
bool ParseBackgroundItem(BackgroundParseState& aState);
|
||||
bool IsFunctionTokenValidForImageLayerImage(const nsCSSToken& aToken) const;
|
||||
bool ParseBackgroundItem(ImageLayersShorthandParseState& aState);
|
||||
|
||||
bool ParseValueList(nsCSSProperty aPropID); // a single value prop-id
|
||||
bool ParseBackgroundRepeat();
|
||||
bool ParseBackgroundRepeatValues(nsCSSValuePair& aValue);
|
||||
bool ParseBackgroundPosition();
|
||||
bool ParseImageLayerRepeat(nsCSSProperty aPropID);
|
||||
bool ParseImageLayerRepeatValues(nsCSSValuePair& aValue);
|
||||
bool ParseImageLayerPosition(nsCSSProperty aPropID);
|
||||
|
||||
// ParseBoxPositionValues parses the CSS 2.1 background-position syntax,
|
||||
// which is still used by some properties. See ParsePositionValue
|
||||
@@ -889,8 +893,8 @@ protected:
|
||||
// the 'background-position' property.
|
||||
bool ParsePositionValue(nsCSSValue& aOut);
|
||||
|
||||
bool ParseBackgroundSize();
|
||||
bool ParseBackgroundSizeValues(nsCSSValuePair& aOut);
|
||||
bool ParseImageLayerSize(nsCSSProperty aPropID);
|
||||
bool ParseImageLayerSizeValues(nsCSSValuePair& aOut);
|
||||
bool ParseBorderColor();
|
||||
bool ParseBorderColors(nsCSSProperty aProperty);
|
||||
void SetBorderImageInitialValues();
|
||||
@@ -9867,13 +9871,13 @@ IsBoxPositionStrictlyEdgeKeywords(nsCSSValuePair& aPosition)
|
||||
const nsCSSValue& xValue = aPosition.mXValue;
|
||||
const nsCSSValue& yValue = aPosition.mYValue;
|
||||
return (xValue.GetUnit() == eCSSUnit_Enumerated &&
|
||||
(xValue.GetIntValue() & (NS_STYLE_BG_POSITION_LEFT |
|
||||
NS_STYLE_BG_POSITION_CENTER |
|
||||
NS_STYLE_BG_POSITION_RIGHT)) &&
|
||||
(xValue.GetIntValue() & (NS_STYLE_IMAGELAYER_POSITION_LEFT |
|
||||
NS_STYLE_IMAGELAYER_POSITION_CENTER |
|
||||
NS_STYLE_IMAGELAYER_POSITION_RIGHT)) &&
|
||||
yValue.GetUnit() == eCSSUnit_Enumerated &&
|
||||
(yValue.GetIntValue() & (NS_STYLE_BG_POSITION_TOP |
|
||||
NS_STYLE_BG_POSITION_CENTER |
|
||||
NS_STYLE_BG_POSITION_BOTTOM)));
|
||||
(yValue.GetIntValue() & (NS_STYLE_IMAGELAYER_POSITION_TOP |
|
||||
NS_STYLE_IMAGELAYER_POSITION_CENTER |
|
||||
NS_STYLE_IMAGELAYER_POSITION_BOTTOM)));
|
||||
}
|
||||
|
||||
// <gradient>
|
||||
@@ -10208,7 +10212,7 @@ CSSParserImpl::IsLegacyGradientLine(const nsCSSTokenType& aType,
|
||||
nsCSSKeyword kw = nsCSSKeywords::LookupKeyword(aId);
|
||||
int32_t junk;
|
||||
if (kw != eCSSKeyword_UNKNOWN &&
|
||||
nsCSSProps::FindKeyword(kw, nsCSSProps::kBackgroundPositionKTable,
|
||||
nsCSSProps::FindKeyword(kw, nsCSSProps::kImageLayerPositionKTable,
|
||||
junk)) {
|
||||
haveGradientLine = true;
|
||||
}
|
||||
@@ -10551,13 +10555,13 @@ CSSParserImpl::FinalizeLinearWebkitGradient(nsCSSValueGradient* aGradient,
|
||||
// this as a horizontal gradient progressing towards the center of the left
|
||||
// or right side.
|
||||
if (aStartPoint.mYValue == aEndPoint.mYValue) {
|
||||
aGradient->mBgPos.mYValue.SetIntValue(NS_STYLE_BG_POSITION_CENTER,
|
||||
aGradient->mBgPos.mYValue.SetIntValue(NS_STYLE_IMAGELAYER_POSITION_CENTER,
|
||||
eCSSUnit_Enumerated);
|
||||
if (IsWebkitGradientCoordLarger(aStartPoint.mXValue, aEndPoint.mXValue)) {
|
||||
aGradient->mBgPos.mXValue.SetIntValue(NS_STYLE_BG_POSITION_LEFT,
|
||||
aGradient->mBgPos.mXValue.SetIntValue(NS_STYLE_IMAGELAYER_POSITION_LEFT,
|
||||
eCSSUnit_Enumerated);
|
||||
} else {
|
||||
aGradient->mBgPos.mXValue.SetIntValue(NS_STYLE_BG_POSITION_RIGHT,
|
||||
aGradient->mBgPos.mXValue.SetIntValue(NS_STYLE_IMAGELAYER_POSITION_RIGHT,
|
||||
eCSSUnit_Enumerated);
|
||||
}
|
||||
return;
|
||||
@@ -10567,13 +10571,13 @@ CSSParserImpl::FinalizeLinearWebkitGradient(nsCSSValueGradient* aGradient,
|
||||
// this as a horizontal gradient progressing towards the center of the top
|
||||
// or bottom side.
|
||||
if (aStartPoint.mXValue == aEndPoint.mXValue) {
|
||||
aGradient->mBgPos.mXValue.SetIntValue(NS_STYLE_BG_POSITION_CENTER,
|
||||
aGradient->mBgPos.mXValue.SetIntValue(NS_STYLE_IMAGELAYER_POSITION_CENTER,
|
||||
eCSSUnit_Enumerated);
|
||||
if (IsWebkitGradientCoordLarger(aStartPoint.mYValue, aEndPoint.mYValue)) {
|
||||
aGradient->mBgPos.mYValue.SetIntValue(NS_STYLE_BG_POSITION_TOP,
|
||||
aGradient->mBgPos.mYValue.SetIntValue(NS_STYLE_IMAGELAYER_POSITION_TOP,
|
||||
eCSSUnit_Enumerated);
|
||||
} else {
|
||||
aGradient->mBgPos.mYValue.SetIntValue(NS_STYLE_BG_POSITION_BOTTOM,
|
||||
aGradient->mBgPos.mYValue.SetIntValue(NS_STYLE_IMAGELAYER_POSITION_BOTTOM,
|
||||
eCSSUnit_Enumerated);
|
||||
}
|
||||
return;
|
||||
@@ -11310,11 +11314,11 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID)
|
||||
case eCSSProperty_background:
|
||||
return ParseBackground();
|
||||
case eCSSProperty_background_repeat:
|
||||
return ParseBackgroundRepeat();
|
||||
return ParseImageLayerRepeat(eCSSProperty_background_repeat);
|
||||
case eCSSProperty_background_position:
|
||||
return ParseBackgroundPosition();
|
||||
return ParseImageLayerPosition(eCSSProperty_background_position);
|
||||
case eCSSProperty_background_size:
|
||||
return ParseBackgroundSize();
|
||||
return ParseImageLayerSize(eCSSProperty_background_size);
|
||||
case eCSSProperty_border:
|
||||
return ParseBorderSide(kBorderTopIDs, true);
|
||||
case eCSSProperty_border_color:
|
||||
@@ -11497,11 +11501,11 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID)
|
||||
}
|
||||
|
||||
// Bits used in determining which background position info we have
|
||||
#define BG_CENTER NS_STYLE_BG_POSITION_CENTER
|
||||
#define BG_TOP NS_STYLE_BG_POSITION_TOP
|
||||
#define BG_BOTTOM NS_STYLE_BG_POSITION_BOTTOM
|
||||
#define BG_LEFT NS_STYLE_BG_POSITION_LEFT
|
||||
#define BG_RIGHT NS_STYLE_BG_POSITION_RIGHT
|
||||
#define BG_CENTER NS_STYLE_IMAGELAYER_POSITION_CENTER
|
||||
#define BG_TOP NS_STYLE_IMAGELAYER_POSITION_TOP
|
||||
#define BG_BOTTOM NS_STYLE_IMAGELAYER_POSITION_BOTTOM
|
||||
#define BG_LEFT NS_STYLE_IMAGELAYER_POSITION_LEFT
|
||||
#define BG_RIGHT NS_STYLE_IMAGELAYER_POSITION_RIGHT
|
||||
#define BG_CTB (BG_CENTER | BG_TOP | BG_BOTTOM)
|
||||
#define BG_TB (BG_TOP | BG_BOTTOM)
|
||||
#define BG_CLR (BG_CENTER | BG_LEFT | BG_RIGHT)
|
||||
@@ -11719,21 +11723,21 @@ CSSParserImpl::ParseFontDescriptorValue(nsCSSFontDesc aDescID,
|
||||
static nsCSSValue
|
||||
BoxPositionMaskToCSSValue(int32_t aMask, bool isX)
|
||||
{
|
||||
int32_t val = NS_STYLE_BG_POSITION_CENTER;
|
||||
int32_t val = NS_STYLE_IMAGELAYER_POSITION_CENTER;
|
||||
if (isX) {
|
||||
if (aMask & BG_LEFT) {
|
||||
val = NS_STYLE_BG_POSITION_LEFT;
|
||||
val = NS_STYLE_IMAGELAYER_POSITION_LEFT;
|
||||
}
|
||||
else if (aMask & BG_RIGHT) {
|
||||
val = NS_STYLE_BG_POSITION_RIGHT;
|
||||
val = NS_STYLE_IMAGELAYER_POSITION_RIGHT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aMask & BG_TOP) {
|
||||
val = NS_STYLE_BG_POSITION_TOP;
|
||||
val = NS_STYLE_IMAGELAYER_POSITION_TOP;
|
||||
}
|
||||
else if (aMask & BG_BOTTOM) {
|
||||
val = NS_STYLE_BG_POSITION_BOTTOM;
|
||||
val = NS_STYLE_IMAGELAYER_POSITION_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11759,12 +11763,13 @@ CSSParserImpl::ParseBackground()
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCSSValue image, repeat, attachment, clip, origin, position, size;
|
||||
BackgroundParseState state(color, image.SetListValue(),
|
||||
repeat.SetPairListValue(),
|
||||
attachment.SetListValue(), clip.SetListValue(),
|
||||
origin.SetListValue(), position.SetListValue(),
|
||||
size.SetPairListValue());
|
||||
nsCSSValue image, repeat, attachment, clip, origin, position, size, composite, mode;
|
||||
ImageLayersShorthandParseState state(color, image.SetListValue(),
|
||||
repeat.SetPairListValue(),
|
||||
attachment.SetListValue(), clip.SetListValue(),
|
||||
origin.SetListValue(), position.SetListValue(),
|
||||
size.SetPairListValue(), composite.SetListValue(),
|
||||
mode.SetListValue());
|
||||
|
||||
for (;;) {
|
||||
if (!ParseBackgroundItem(state)) {
|
||||
@@ -11814,7 +11819,7 @@ CSSParserImpl::ParseBackground()
|
||||
// Helper for ParseBackgroundItem. Returns true if the passed-in nsCSSToken is
|
||||
// a function which is accepted for background-image.
|
||||
bool
|
||||
CSSParserImpl::IsFunctionTokenValidForBackgroundImage(
|
||||
CSSParserImpl::IsFunctionTokenValidForImageLayerImage(
|
||||
const nsCSSToken& aToken) const
|
||||
{
|
||||
MOZ_ASSERT(aToken.mType == eCSSToken_Function,
|
||||
@@ -11842,20 +11847,20 @@ CSSParserImpl::IsFunctionTokenValidForBackgroundImage(
|
||||
|
||||
// Parse one item of the background shorthand property.
|
||||
bool
|
||||
CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
CSSParserImpl::ParseBackgroundItem(CSSParserImpl::ImageLayersShorthandParseState& aState)
|
||||
|
||||
{
|
||||
// Fill in the values that the shorthand will set if we don't find
|
||||
// other values.
|
||||
aState.mImage->mValue.SetNoneValue();
|
||||
aState.mRepeat->mXValue.SetIntValue(NS_STYLE_BG_REPEAT_REPEAT,
|
||||
aState.mRepeat->mXValue.SetIntValue(NS_STYLE_IMAGELAYER_REPEAT_REPEAT,
|
||||
eCSSUnit_Enumerated);
|
||||
aState.mRepeat->mYValue.Reset();
|
||||
aState.mAttachment->mValue.SetIntValue(NS_STYLE_BG_ATTACHMENT_SCROLL,
|
||||
aState.mAttachment->mValue.SetIntValue(NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL,
|
||||
eCSSUnit_Enumerated);
|
||||
aState.mClip->mValue.SetIntValue(NS_STYLE_BG_CLIP_BORDER,
|
||||
aState.mClip->mValue.SetIntValue(NS_STYLE_IMAGELAYER_CLIP_BORDER,
|
||||
eCSSUnit_Enumerated);
|
||||
aState.mOrigin->mValue.SetIntValue(NS_STYLE_BG_ORIGIN_PADDING,
|
||||
aState.mOrigin->mValue.SetIntValue(NS_STYLE_IMAGELAYER_ORIGIN_PADDING,
|
||||
eCSSUnit_Enumerated);
|
||||
RefPtr<nsCSSValue::Array> positionArr = nsCSSValue::Array::Create(4);
|
||||
aState.mPosition->mValue.SetArrayValue(positionArr, eCSSUnit_Array);
|
||||
@@ -11899,7 +11904,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
return false;
|
||||
}
|
||||
} else if (nsCSSProps::FindKeyword(keyword,
|
||||
nsCSSProps::kBackgroundAttachmentKTable, dummy)) {
|
||||
nsCSSProps::kImageLayerAttachmentKTable, dummy)) {
|
||||
if (haveAttach)
|
||||
return false;
|
||||
haveAttach = true;
|
||||
@@ -11910,19 +11915,19 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
return false;
|
||||
}
|
||||
} else if (nsCSSProps::FindKeyword(keyword,
|
||||
nsCSSProps::kBackgroundRepeatKTable, dummy)) {
|
||||
nsCSSProps::kImageLayerRepeatKTable, dummy)) {
|
||||
if (haveRepeat)
|
||||
return false;
|
||||
haveRepeat = true;
|
||||
nsCSSValuePair scratch;
|
||||
if (!ParseBackgroundRepeatValues(scratch)) {
|
||||
if (!ParseImageLayerRepeatValues(scratch)) {
|
||||
NS_NOTREACHED("should be able to parse");
|
||||
return false;
|
||||
}
|
||||
aState.mRepeat->mXValue = scratch.mXValue;
|
||||
aState.mRepeat->mYValue = scratch.mYValue;
|
||||
} else if (nsCSSProps::FindKeyword(keyword,
|
||||
nsCSSProps::kBackgroundPositionKTable, dummy)) {
|
||||
nsCSSProps::kImageLayerPositionKTable, dummy)) {
|
||||
if (havePositionAndSize)
|
||||
return false;
|
||||
havePositionAndSize = true;
|
||||
@@ -11931,14 +11936,14 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
}
|
||||
if (ExpectSymbol('/', true)) {
|
||||
nsCSSValuePair scratch;
|
||||
if (!ParseBackgroundSizeValues(scratch)) {
|
||||
if (!ParseImageLayerSizeValues(scratch)) {
|
||||
return false;
|
||||
}
|
||||
aState.mSize->mXValue = scratch.mXValue;
|
||||
aState.mSize->mYValue = scratch.mYValue;
|
||||
}
|
||||
} else if (nsCSSProps::FindKeyword(keyword,
|
||||
nsCSSProps::kBackgroundOriginKTable, dummy)) {
|
||||
nsCSSProps::kImageLayerOriginKTable, dummy)) {
|
||||
if (haveOrigin)
|
||||
return false;
|
||||
haveOrigin = true;
|
||||
@@ -11955,16 +11960,16 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
// 'background-clip' and 'background-origin' use the same keyword table
|
||||
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
|
||||
eCSSProperty_background_origin] ==
|
||||
nsCSSProps::kBackgroundOriginKTable);
|
||||
nsCSSProps::kImageLayerOriginKTable);
|
||||
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
|
||||
eCSSProperty_background_clip] ==
|
||||
nsCSSProps::kBackgroundOriginKTable);
|
||||
static_assert(NS_STYLE_BG_CLIP_BORDER ==
|
||||
NS_STYLE_BG_ORIGIN_BORDER &&
|
||||
NS_STYLE_BG_CLIP_PADDING ==
|
||||
NS_STYLE_BG_ORIGIN_PADDING &&
|
||||
NS_STYLE_BG_CLIP_CONTENT ==
|
||||
NS_STYLE_BG_ORIGIN_CONTENT,
|
||||
nsCSSProps::kImageLayerOriginKTable);
|
||||
static_assert(NS_STYLE_IMAGELAYER_CLIP_BORDER ==
|
||||
NS_STYLE_IMAGELAYER_ORIGIN_BORDER &&
|
||||
NS_STYLE_IMAGELAYER_CLIP_PADDING ==
|
||||
NS_STYLE_IMAGELAYER_ORIGIN_PADDING &&
|
||||
NS_STYLE_IMAGELAYER_CLIP_CONTENT ==
|
||||
NS_STYLE_IMAGELAYER_ORIGIN_CONTENT,
|
||||
"bg-clip and bg-origin style constants must agree");
|
||||
|
||||
CSSParseResult result =
|
||||
@@ -11991,7 +11996,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
}
|
||||
} else if (tt == eCSSToken_URL ||
|
||||
(tt == eCSSToken_Function &&
|
||||
IsFunctionTokenValidForBackgroundImage(mToken))) {
|
||||
IsFunctionTokenValidForImageLayerImage(mToken))) {
|
||||
if (haveImage)
|
||||
return false;
|
||||
haveImage = true;
|
||||
@@ -12014,7 +12019,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
}
|
||||
if (ExpectSymbol('/', true)) {
|
||||
nsCSSValuePair scratch;
|
||||
if (!ParseBackgroundSizeValues(scratch)) {
|
||||
if (!ParseImageLayerSizeValues(scratch)) {
|
||||
return false;
|
||||
}
|
||||
aState.mSize->mXValue = scratch.mXValue;
|
||||
@@ -12039,7 +12044,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
|
||||
}
|
||||
|
||||
// This function is very similar to ParseScrollSnapCoordinate,
|
||||
// ParseBackgroundPosition, and ParseBackgroundSize.
|
||||
// ParseImageLayerPosition, and ParseBackgroundSize.
|
||||
bool
|
||||
CSSParserImpl::ParseValueList(nsCSSProperty aPropID)
|
||||
{
|
||||
@@ -12065,13 +12070,13 @@ CSSParserImpl::ParseValueList(nsCSSProperty aPropID)
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseBackgroundRepeat()
|
||||
CSSParserImpl::ParseImageLayerRepeat(nsCSSProperty aPropID)
|
||||
{
|
||||
nsCSSValue value;
|
||||
// 'initial', 'inherit' and 'unset' stand alone, no list permitted.
|
||||
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
|
||||
nsCSSValuePair valuePair;
|
||||
if (!ParseBackgroundRepeatValues(valuePair)) {
|
||||
if (!ParseImageLayerRepeatValues(valuePair)) {
|
||||
return false;
|
||||
}
|
||||
nsCSSValuePairList* item = value.SetPairListValue();
|
||||
@@ -12081,7 +12086,7 @@ CSSParserImpl::ParseBackgroundRepeat()
|
||||
if (!ExpectSymbol(',', true)) {
|
||||
break;
|
||||
}
|
||||
if (!ParseBackgroundRepeatValues(valuePair)) {
|
||||
if (!ParseImageLayerRepeatValues(valuePair)) {
|
||||
return false;
|
||||
}
|
||||
item->mNext = new nsCSSValuePairList;
|
||||
@@ -12089,36 +12094,36 @@ CSSParserImpl::ParseBackgroundRepeat()
|
||||
}
|
||||
}
|
||||
|
||||
AppendValue(eCSSProperty_background_repeat, value);
|
||||
AppendValue(aPropID, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseBackgroundRepeatValues(nsCSSValuePair& aValue)
|
||||
CSSParserImpl::ParseImageLayerRepeatValues(nsCSSValuePair& aValue)
|
||||
{
|
||||
nsCSSValue& xValue = aValue.mXValue;
|
||||
nsCSSValue& yValue = aValue.mYValue;
|
||||
|
||||
if (ParseEnum(xValue, nsCSSProps::kBackgroundRepeatKTable)) {
|
||||
|
||||
if (ParseEnum(xValue, nsCSSProps::kImageLayerRepeatKTable)) {
|
||||
int32_t value = xValue.GetIntValue();
|
||||
// For single values set yValue as eCSSUnit_Null.
|
||||
if (value == NS_STYLE_BG_REPEAT_REPEAT_X ||
|
||||
value == NS_STYLE_BG_REPEAT_REPEAT_Y ||
|
||||
!ParseEnum(yValue, nsCSSProps::kBackgroundRepeatPartKTable)) {
|
||||
if (value == NS_STYLE_IMAGELAYER_REPEAT_REPEAT_X ||
|
||||
value == NS_STYLE_IMAGELAYER_REPEAT_REPEAT_Y ||
|
||||
!ParseEnum(yValue, nsCSSProps::kImageLayerRepeatPartKTable)) {
|
||||
// the caller will fail cases like "repeat-x no-repeat"
|
||||
// by expecting a list separator or an end property.
|
||||
yValue.Reset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This function is very similar to ParseScrollSnapCoordinate,
|
||||
// ParseBackgroundList, and ParseBackgroundSize.
|
||||
bool
|
||||
CSSParserImpl::ParseBackgroundPosition()
|
||||
CSSParserImpl::ParseImageLayerPosition(nsCSSProperty aPropID)
|
||||
{
|
||||
nsCSSValue value;
|
||||
// 'initial', 'inherit' and 'unset' stand alone, no list permitted.
|
||||
@@ -12140,7 +12145,7 @@ CSSParserImpl::ParseBackgroundPosition()
|
||||
item = item->mNext;
|
||||
}
|
||||
}
|
||||
AppendValue(eCSSProperty_background_position, value);
|
||||
AppendValue(aPropID, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12190,7 +12195,7 @@ bool CSSParserImpl::ParseBoxPositionValues(nsCSSValuePair &aOut,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ParseEnum(yValue, nsCSSProps::kBackgroundPositionKTable)) {
|
||||
if (ParseEnum(yValue, nsCSSProps::kImageLayerPositionKTable)) {
|
||||
int32_t yVal = yValue.GetIntValue();
|
||||
if (!(yVal & BG_CTB)) {
|
||||
// The second keyword can only be 'center', 'top', or 'bottom'
|
||||
@@ -12213,10 +12218,10 @@ bool CSSParserImpl::ParseBoxPositionValues(nsCSSValuePair &aOut,
|
||||
// any duplicate keywords other than center. We try to get two
|
||||
// keywords but it's okay if there is only one.
|
||||
int32_t mask = 0;
|
||||
if (ParseEnum(xValue, nsCSSProps::kBackgroundPositionKTable)) {
|
||||
if (ParseEnum(xValue, nsCSSProps::kImageLayerPositionKTable)) {
|
||||
int32_t bit = xValue.GetIntValue();
|
||||
mask |= bit;
|
||||
if (ParseEnum(xValue, nsCSSProps::kBackgroundPositionKTable)) {
|
||||
if (ParseEnum(xValue, nsCSSProps::kImageLayerPositionKTable)) {
|
||||
bit = xValue.GetIntValue();
|
||||
if (mask & (bit & ~BG_CENTER)) {
|
||||
// Only the 'center' keyword can be duplicated.
|
||||
@@ -12274,7 +12279,7 @@ CSSParserImpl::ParsePositionValue(nsCSSValue& aOut)
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
CSSParseResult result =
|
||||
ParseVariant(value->Item(i), VARIANT_LPCALC | VARIANT_KEYWORD,
|
||||
nsCSSProps::kBackgroundPositionKTable);
|
||||
nsCSSProps::kImageLayerPositionKTable);
|
||||
if (result == CSSParseResult::Error) {
|
||||
return false;
|
||||
} else if (result == CSSParseResult::NotFound) {
|
||||
@@ -12387,7 +12392,7 @@ CSSParserImpl::ParsePositionValue(nsCSSValue& aOut)
|
||||
value->Item(1) = value->Item(0); // move xOffset to correct position
|
||||
xEdge.Reset();
|
||||
}
|
||||
yEdge.SetIntValue(NS_STYLE_BG_POSITION_CENTER, eCSSUnit_Enumerated);
|
||||
yEdge.SetIntValue(NS_STYLE_IMAGELAYER_POSITION_CENTER, eCSSUnit_Enumerated);
|
||||
yOffset.Reset();
|
||||
break;
|
||||
default:
|
||||
@@ -12436,13 +12441,13 @@ CSSParserImpl::ParsePositionValue(nsCSSValue& aOut)
|
||||
// This function is very similar to ParseScrollSnapCoordinate,
|
||||
// ParseBackgroundList, and ParseBackgroundPosition.
|
||||
bool
|
||||
CSSParserImpl::ParseBackgroundSize()
|
||||
CSSParserImpl::ParseImageLayerSize(nsCSSProperty aPropID)
|
||||
{
|
||||
nsCSSValue value;
|
||||
// 'initial', 'inherit' and 'unset' stand alone, no list permitted.
|
||||
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
|
||||
nsCSSValuePair valuePair;
|
||||
if (!ParseBackgroundSizeValues(valuePair)) {
|
||||
if (!ParseImageLayerSizeValues(valuePair)) {
|
||||
return false;
|
||||
}
|
||||
nsCSSValuePairList* item = value.SetPairListValue();
|
||||
@@ -12452,14 +12457,14 @@ CSSParserImpl::ParseBackgroundSize()
|
||||
if (!ExpectSymbol(',', true)) {
|
||||
break;
|
||||
}
|
||||
if (!ParseBackgroundSizeValues(valuePair)) {
|
||||
if (!ParseImageLayerSizeValues(valuePair)) {
|
||||
return false;
|
||||
}
|
||||
item->mNext = new nsCSSValuePairList;
|
||||
item = item->mNext;
|
||||
}
|
||||
}
|
||||
AppendValue(eCSSProperty_background_size, value);
|
||||
AppendValue(aPropID, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12474,7 +12479,7 @@ CSSParserImpl::ParseBackgroundSize()
|
||||
* @return Whether or not the operation succeeded.
|
||||
*/
|
||||
#define BG_SIZE_VARIANT (VARIANT_LP | VARIANT_AUTO | VARIANT_CALC)
|
||||
bool CSSParserImpl::ParseBackgroundSizeValues(nsCSSValuePair &aOut)
|
||||
bool CSSParserImpl::ParseImageLayerSizeValues(nsCSSValuePair &aOut)
|
||||
{
|
||||
// First try a percentage or a length value
|
||||
nsCSSValue &xValue = aOut.mXValue,
|
||||
@@ -12501,11 +12506,12 @@ bool CSSParserImpl::ParseBackgroundSizeValues(nsCSSValuePair &aOut)
|
||||
}
|
||||
|
||||
// Now address 'contain' and 'cover'.
|
||||
if (!ParseEnum(xValue, nsCSSProps::kBackgroundSizeKTable))
|
||||
if (!ParseEnum(xValue, nsCSSProps::kImageLayerSizeKTable))
|
||||
return false;
|
||||
yValue.Reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
#undef BG_SIZE_VARIANT
|
||||
|
||||
bool
|
||||
@@ -16798,8 +16804,7 @@ CSSParserImpl::ParseScrollSnapDestination(nsCSSValue& aValue)
|
||||
return true;
|
||||
}
|
||||
|
||||
// This function is very similar to ParseBackgroundPosition, ParseBackgroundList
|
||||
// and ParseBackgroundSize.
|
||||
// This function is very similar to ParseImageLayerPosition, and ParseImageLayerSize.
|
||||
bool
|
||||
CSSParserImpl::ParseScrollSnapCoordinate(nsCSSValue& aValue)
|
||||
{
|
||||
|
||||
@@ -537,7 +537,7 @@ CSS_PROP_BACKGROUND(
|
||||
CSS_PROPERTY_VALUE_LIST_USES_COMMAS,
|
||||
"",
|
||||
VARIANT_KEYWORD, // used by list parsing
|
||||
kBackgroundAttachmentKTable,
|
||||
kImageLayerAttachmentKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_BACKGROUND(
|
||||
@@ -550,7 +550,7 @@ CSS_PROP_BACKGROUND(
|
||||
CSS_PROPERTY_VALUE_LIST_USES_COMMAS,
|
||||
"",
|
||||
VARIANT_KEYWORD, // used by list parsing
|
||||
kBackgroundOriginKTable,
|
||||
kImageLayerOriginKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_BACKGROUND(
|
||||
@@ -605,7 +605,7 @@ CSS_PROP_BACKGROUND(
|
||||
CSS_PROPERTY_VALUE_LIST_USES_COMMAS,
|
||||
"",
|
||||
VARIANT_KEYWORD, // used by list parsing
|
||||
kBackgroundOriginKTable,
|
||||
kImageLayerOriginKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_BACKGROUND(
|
||||
@@ -620,7 +620,7 @@ CSS_PROP_BACKGROUND(
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
"",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
kImageLayerPositionKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Custom)
|
||||
CSS_PROP_BACKGROUND(
|
||||
@@ -633,7 +633,7 @@ CSS_PROP_BACKGROUND(
|
||||
CSS_PROPERTY_VALUE_LIST_USES_COMMAS,
|
||||
"",
|
||||
VARIANT_KEYWORD, // used by list parsing
|
||||
kBackgroundRepeatKTable,
|
||||
kImageLayerRepeatKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_BACKGROUND(
|
||||
@@ -648,7 +648,7 @@ CSS_PROP_BACKGROUND(
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
"",
|
||||
0,
|
||||
kBackgroundSizeKTable,
|
||||
kImageLayerSizeKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Custom)
|
||||
CSS_PROP_DISPLAY(
|
||||
@@ -2647,7 +2647,7 @@ CSS_PROP_POSITION(
|
||||
CSS_PROPERTY_ENABLED_IN_UA_SHEETS,
|
||||
"layout.css.object-fit-and-position.enabled",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
kImageLayerPositionKTable,
|
||||
offsetof(nsStylePosition, mObjectPosition),
|
||||
eStyleAnimType_Custom)
|
||||
CSS_PROP_LOGICAL(
|
||||
@@ -3128,7 +3128,7 @@ CSS_PROP_DISPLAY(
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
"layout.css.scroll-snap.enabled",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
kImageLayerPositionKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_DISPLAY(
|
||||
@@ -3140,7 +3140,7 @@ CSS_PROP_DISPLAY(
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
"layout.css.scroll-snap.enabled",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
kImageLayerPositionKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_DISPLAY(
|
||||
@@ -3430,7 +3430,7 @@ CSS_PROP_DISPLAY(
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
kImageLayerPositionKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Custom)
|
||||
CSS_PROP_DISPLAY(
|
||||
@@ -3442,7 +3442,7 @@ CSS_PROP_DISPLAY(
|
||||
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
|
||||
"",
|
||||
0,
|
||||
kBackgroundPositionKTable,
|
||||
kImageLayerPositionKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Custom)
|
||||
CSS_PROP_DISPLAY(
|
||||
|
||||
+33
-33
@@ -865,57 +865,57 @@ const KTableEntry nsCSSProps::kTransformStyleKTable[] = {
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBackgroundAttachmentKTable[] = {
|
||||
{ eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED },
|
||||
{ eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL },
|
||||
{ eCSSKeyword_local, NS_STYLE_BG_ATTACHMENT_LOCAL },
|
||||
const KTableEntry nsCSSProps::kImageLayerAttachmentKTable[] = {
|
||||
{ eCSSKeyword_fixed, NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED },
|
||||
{ eCSSKeyword_scroll, NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL },
|
||||
{ eCSSKeyword_local, NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
static_assert(NS_STYLE_BG_CLIP_BORDER == NS_STYLE_BG_ORIGIN_BORDER &&
|
||||
NS_STYLE_BG_CLIP_PADDING == NS_STYLE_BG_ORIGIN_PADDING &&
|
||||
NS_STYLE_BG_CLIP_CONTENT == NS_STYLE_BG_ORIGIN_CONTENT,
|
||||
static_assert(NS_STYLE_IMAGELAYER_CLIP_BORDER == NS_STYLE_IMAGELAYER_ORIGIN_BORDER &&
|
||||
NS_STYLE_IMAGELAYER_CLIP_PADDING == NS_STYLE_IMAGELAYER_ORIGIN_PADDING &&
|
||||
NS_STYLE_IMAGELAYER_CLIP_CONTENT == NS_STYLE_IMAGELAYER_ORIGIN_CONTENT,
|
||||
"bg-clip and bg-origin style constants must agree");
|
||||
const KTableEntry nsCSSProps::kBackgroundOriginKTable[] = {
|
||||
{ eCSSKeyword_border_box, NS_STYLE_BG_ORIGIN_BORDER },
|
||||
{ eCSSKeyword_padding_box, NS_STYLE_BG_ORIGIN_PADDING },
|
||||
{ eCSSKeyword_content_box, NS_STYLE_BG_ORIGIN_CONTENT },
|
||||
const KTableEntry nsCSSProps::kImageLayerOriginKTable[] = {
|
||||
{ eCSSKeyword_border_box, NS_STYLE_IMAGELAYER_ORIGIN_BORDER },
|
||||
{ eCSSKeyword_padding_box, NS_STYLE_IMAGELAYER_ORIGIN_PADDING },
|
||||
{ eCSSKeyword_content_box, NS_STYLE_IMAGELAYER_ORIGIN_CONTENT },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
// Note: Don't change this table unless you update
|
||||
// parseBackgroundPosition!
|
||||
// ParseImageLayerPosition!
|
||||
|
||||
const KTableEntry nsCSSProps::kBackgroundPositionKTable[] = {
|
||||
{ eCSSKeyword_center, NS_STYLE_BG_POSITION_CENTER },
|
||||
{ eCSSKeyword_top, NS_STYLE_BG_POSITION_TOP },
|
||||
{ eCSSKeyword_bottom, NS_STYLE_BG_POSITION_BOTTOM },
|
||||
{ eCSSKeyword_left, NS_STYLE_BG_POSITION_LEFT },
|
||||
{ eCSSKeyword_right, NS_STYLE_BG_POSITION_RIGHT },
|
||||
const KTableEntry nsCSSProps::kImageLayerPositionKTable[] = {
|
||||
{ eCSSKeyword_center, NS_STYLE_IMAGELAYER_POSITION_CENTER },
|
||||
{ eCSSKeyword_top, NS_STYLE_IMAGELAYER_POSITION_TOP },
|
||||
{ eCSSKeyword_bottom, NS_STYLE_IMAGELAYER_POSITION_BOTTOM },
|
||||
{ eCSSKeyword_left, NS_STYLE_IMAGELAYER_POSITION_LEFT },
|
||||
{ eCSSKeyword_right, NS_STYLE_IMAGELAYER_POSITION_RIGHT },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBackgroundRepeatKTable[] = {
|
||||
{ eCSSKeyword_no_repeat, NS_STYLE_BG_REPEAT_NO_REPEAT },
|
||||
{ eCSSKeyword_repeat, NS_STYLE_BG_REPEAT_REPEAT },
|
||||
{ eCSSKeyword_repeat_x, NS_STYLE_BG_REPEAT_REPEAT_X },
|
||||
{ eCSSKeyword_repeat_y, NS_STYLE_BG_REPEAT_REPEAT_Y },
|
||||
{ eCSSKeyword_round, NS_STYLE_BG_REPEAT_ROUND },
|
||||
{ eCSSKeyword_space, NS_STYLE_BG_REPEAT_SPACE },
|
||||
const KTableEntry nsCSSProps::kImageLayerRepeatKTable[] = {
|
||||
{ eCSSKeyword_no_repeat, NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT },
|
||||
{ eCSSKeyword_repeat, NS_STYLE_IMAGELAYER_REPEAT_REPEAT },
|
||||
{ eCSSKeyword_repeat_x, NS_STYLE_IMAGELAYER_REPEAT_REPEAT_X },
|
||||
{ eCSSKeyword_repeat_y, NS_STYLE_IMAGELAYER_REPEAT_REPEAT_Y },
|
||||
{ eCSSKeyword_round, NS_STYLE_IMAGELAYER_REPEAT_ROUND },
|
||||
{ eCSSKeyword_space, NS_STYLE_IMAGELAYER_REPEAT_SPACE },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBackgroundRepeatPartKTable[] = {
|
||||
{ eCSSKeyword_no_repeat, NS_STYLE_BG_REPEAT_NO_REPEAT },
|
||||
{ eCSSKeyword_repeat, NS_STYLE_BG_REPEAT_REPEAT },
|
||||
{ eCSSKeyword_round, NS_STYLE_BG_REPEAT_ROUND },
|
||||
{ eCSSKeyword_space, NS_STYLE_BG_REPEAT_SPACE },
|
||||
const KTableEntry nsCSSProps::kImageLayerRepeatPartKTable[] = {
|
||||
{ eCSSKeyword_no_repeat, NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT },
|
||||
{ eCSSKeyword_repeat, NS_STYLE_IMAGELAYER_REPEAT_REPEAT },
|
||||
{ eCSSKeyword_round, NS_STYLE_IMAGELAYER_REPEAT_ROUND },
|
||||
{ eCSSKeyword_space, NS_STYLE_IMAGELAYER_REPEAT_SPACE },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBackgroundSizeKTable[] = {
|
||||
{ eCSSKeyword_contain, NS_STYLE_BG_SIZE_CONTAIN },
|
||||
{ eCSSKeyword_cover, NS_STYLE_BG_SIZE_COVER },
|
||||
const KTableEntry nsCSSProps::kImageLayerSizeKTable[] = {
|
||||
{ eCSSKeyword_contain, NS_STYLE_IMAGELAYER_SIZE_CONTAIN },
|
||||
{ eCSSKeyword_cover, NS_STYLE_IMAGELAYER_SIZE_COVER },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
|
||||
@@ -670,12 +670,12 @@ public:
|
||||
static const KTableEntry kAzimuthKTable[];
|
||||
static const KTableEntry kBackfaceVisibilityKTable[];
|
||||
static const KTableEntry kTransformStyleKTable[];
|
||||
static const KTableEntry kBackgroundAttachmentKTable[];
|
||||
static const KTableEntry kBackgroundOriginKTable[];
|
||||
static const KTableEntry kBackgroundPositionKTable[];
|
||||
static const KTableEntry kBackgroundRepeatKTable[];
|
||||
static const KTableEntry kBackgroundRepeatPartKTable[];
|
||||
static const KTableEntry kBackgroundSizeKTable[];
|
||||
static const KTableEntry kImageLayerAttachmentKTable[];
|
||||
static const KTableEntry kImageLayerOriginKTable[];
|
||||
static const KTableEntry kImageLayerPositionKTable[];
|
||||
static const KTableEntry kImageLayerRepeatKTable[];
|
||||
static const KTableEntry kImageLayerRepeatPartKTable[];
|
||||
static const KTableEntry kImageLayerSizeKTable[];
|
||||
static const KTableEntry kBlendModeKTable[];
|
||||
static const KTableEntry kBorderCollapseKTable[];
|
||||
static const KTableEntry kBorderColorKTable[];
|
||||
|
||||
@@ -1517,12 +1517,12 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
||||
gradient->mBgPos.mYValue.GetUnit() == eCSSUnit_Enumerated,
|
||||
"unexpected unit");
|
||||
aResult.AppendLiteral("to");
|
||||
if (!(gradient->mBgPos.mXValue.GetIntValue() & NS_STYLE_BG_POSITION_CENTER)) {
|
||||
if (!(gradient->mBgPos.mXValue.GetIntValue() & NS_STYLE_IMAGELAYER_POSITION_CENTER)) {
|
||||
aResult.Append(' ');
|
||||
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position,
|
||||
aResult, aSerialization);
|
||||
}
|
||||
if (!(gradient->mBgPos.mYValue.GetIntValue() & NS_STYLE_BG_POSITION_CENTER)) {
|
||||
if (!(gradient->mBgPos.mYValue.GetIntValue() & NS_STYLE_IMAGELAYER_POSITION_CENTER)) {
|
||||
aResult.Append(' ');
|
||||
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position,
|
||||
aResult, aSerialization);
|
||||
|
||||
@@ -1804,17 +1804,16 @@ nsComputedDOMStyle::DoGetFontVariantPosition()
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
|
||||
uint32_t nsStyleBackground::* aCount,
|
||||
nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleImageLayers::Layer::* aMember,
|
||||
uint32_t nsStyleImageLayers::* aCount,
|
||||
const nsStyleImageLayers& aLayers,
|
||||
const KTableEntry aTable[])
|
||||
{
|
||||
const nsStyleBackground* bg = StyleBackground();
|
||||
|
||||
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
|
||||
|
||||
for (uint32_t i = 0, i_end = bg->*aCount; i < i_end; ++i) {
|
||||
for (uint32_t i = 0, i_end = aLayers.*aCount; i < i_end; ++i) {
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
val->SetIdent(nsCSSProps::ValueToKeywordEnum(bg->mLayers[i].*aMember,
|
||||
val->SetIdent(nsCSSProps::ValueToKeywordEnum(aLayers.mLayers[i].*aMember,
|
||||
aTable));
|
||||
valueList->AppendCSSValue(val.forget());
|
||||
}
|
||||
@@ -1825,17 +1824,19 @@ nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMembe
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBackgroundAttachment()
|
||||
{
|
||||
return GetBackgroundList(&nsStyleBackground::Layer::mAttachment,
|
||||
&nsStyleBackground::mAttachmentCount,
|
||||
nsCSSProps::kBackgroundAttachmentKTable);
|
||||
return GetBackgroundList(&nsStyleImageLayers::Layer::mAttachment,
|
||||
&nsStyleImageLayers::mAttachmentCount,
|
||||
StyleBackground()->mLayers,
|
||||
nsCSSProps::kImageLayerAttachmentKTable);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBackgroundClip()
|
||||
{
|
||||
return GetBackgroundList(&nsStyleBackground::Layer::mClip,
|
||||
&nsStyleBackground::mClipCount,
|
||||
nsCSSProps::kBackgroundOriginKTable);
|
||||
return GetBackgroundList(&nsStyleImageLayers::Layer::mClip,
|
||||
&nsStyleImageLayers::mClipCount,
|
||||
StyleBackground()->mLayers,
|
||||
nsCSSProps::kImageLayerOriginKTable);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
@@ -2137,10 +2138,10 @@ nsComputedDOMStyle::DoGetBackgroundImage()
|
||||
|
||||
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
|
||||
|
||||
for (uint32_t i = 0, i_end = bg->mImageCount; i < i_end; ++i) {
|
||||
for (uint32_t i = 0, i_end = bg->mLayers.mImageCount; i < i_end; ++i) {
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
||||
const nsStyleImage& image = bg->mLayers[i].mImage;
|
||||
const nsStyleImage& image = bg->mLayers.mLayers[i].mImage;
|
||||
SetValueToStyleImage(image, val);
|
||||
valueList->AppendCSSValue(val.forget());
|
||||
}
|
||||
@@ -2151,22 +2152,24 @@ nsComputedDOMStyle::DoGetBackgroundImage()
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBackgroundBlendMode()
|
||||
{
|
||||
return GetBackgroundList(&nsStyleBackground::Layer::mBlendMode,
|
||||
&nsStyleBackground::mBlendModeCount,
|
||||
return GetBackgroundList(&nsStyleImageLayers::Layer::mBlendMode,
|
||||
&nsStyleImageLayers::mBlendModeCount,
|
||||
StyleBackground()->mLayers,
|
||||
nsCSSProps::kBlendModeKTable);
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetBackgroundOrigin()
|
||||
{
|
||||
return GetBackgroundList(&nsStyleBackground::Layer::mOrigin,
|
||||
&nsStyleBackground::mOriginCount,
|
||||
nsCSSProps::kBackgroundOriginKTable);
|
||||
return GetBackgroundList(&nsStyleImageLayers::Layer::mOrigin,
|
||||
&nsStyleImageLayers::mOriginCount,
|
||||
StyleBackground()->mLayers,
|
||||
nsCSSProps::kImageLayerOriginKTable);
|
||||
}
|
||||
|
||||
void
|
||||
nsComputedDOMStyle::SetValueToPositionCoord(
|
||||
const nsStyleBackground::Position::PositionCoord& aCoord,
|
||||
const nsStyleImageLayers::Position::PositionCoord& aCoord,
|
||||
nsROCSSPrimitiveValue* aValue)
|
||||
{
|
||||
if (!aCoord.mHasPercent) {
|
||||
@@ -2182,7 +2185,7 @@ nsComputedDOMStyle::SetValueToPositionCoord(
|
||||
|
||||
void
|
||||
nsComputedDOMStyle::SetValueToPosition(
|
||||
const nsStyleBackground::Position& aPosition,
|
||||
const nsStyleImageLayers::Position& aPosition,
|
||||
nsDOMCSSValueList* aValueList)
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> valX = new nsROCSSPrimitiveValue;
|
||||
@@ -2201,9 +2204,9 @@ nsComputedDOMStyle::DoGetBackgroundPosition()
|
||||
|
||||
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
|
||||
|
||||
for (uint32_t i = 0, i_end = bg->mPositionCount; i < i_end; ++i) {
|
||||
for (uint32_t i = 0, i_end = bg->mLayers.mPositionCount; i < i_end; ++i) {
|
||||
RefPtr<nsDOMCSSValueList> itemList = GetROCSSValueList(false);
|
||||
SetValueToPosition(bg->mLayers[i].mPosition, itemList);
|
||||
SetValueToPosition(bg->mLayers.mLayers[i].mPosition, itemList);
|
||||
valueList->AppendCSSValue(itemList.forget());
|
||||
}
|
||||
|
||||
@@ -2217,23 +2220,23 @@ nsComputedDOMStyle::DoGetBackgroundRepeat()
|
||||
|
||||
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
|
||||
|
||||
for (uint32_t i = 0, i_end = bg->mRepeatCount; i < i_end; ++i) {
|
||||
for (uint32_t i = 0, i_end = bg->mLayers.mRepeatCount; i < i_end; ++i) {
|
||||
RefPtr<nsDOMCSSValueList> itemList = GetROCSSValueList(false);
|
||||
RefPtr<nsROCSSPrimitiveValue> valX = new nsROCSSPrimitiveValue;
|
||||
|
||||
const uint8_t& xRepeat = bg->mLayers[i].mRepeat.mXRepeat;
|
||||
const uint8_t& yRepeat = bg->mLayers[i].mRepeat.mYRepeat;
|
||||
const uint8_t& xRepeat = bg->mLayers.mLayers[i].mRepeat.mXRepeat;
|
||||
const uint8_t& yRepeat = bg->mLayers.mLayers[i].mRepeat.mYRepeat;
|
||||
|
||||
bool hasContraction = true;
|
||||
unsigned contraction;
|
||||
if (xRepeat == yRepeat) {
|
||||
contraction = xRepeat;
|
||||
} else if (xRepeat == NS_STYLE_BG_REPEAT_REPEAT &&
|
||||
yRepeat == NS_STYLE_BG_REPEAT_NO_REPEAT) {
|
||||
contraction = NS_STYLE_BG_REPEAT_REPEAT_X;
|
||||
} else if (xRepeat == NS_STYLE_BG_REPEAT_NO_REPEAT &&
|
||||
yRepeat == NS_STYLE_BG_REPEAT_REPEAT) {
|
||||
contraction = NS_STYLE_BG_REPEAT_REPEAT_Y;
|
||||
} else if (xRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT &&
|
||||
yRepeat == NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT) {
|
||||
contraction = NS_STYLE_IMAGELAYER_REPEAT_REPEAT_X;
|
||||
} else if (xRepeat == NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT &&
|
||||
yRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT) {
|
||||
contraction = NS_STYLE_IMAGELAYER_REPEAT_REPEAT_Y;
|
||||
} else {
|
||||
hasContraction = false;
|
||||
}
|
||||
@@ -2241,14 +2244,14 @@ nsComputedDOMStyle::DoGetBackgroundRepeat()
|
||||
RefPtr<nsROCSSPrimitiveValue> valY;
|
||||
if (hasContraction) {
|
||||
valX->SetIdent(nsCSSProps::ValueToKeywordEnum(contraction,
|
||||
nsCSSProps::kBackgroundRepeatKTable));
|
||||
nsCSSProps::kImageLayerRepeatKTable));
|
||||
} else {
|
||||
valY = new nsROCSSPrimitiveValue;
|
||||
|
||||
valX->SetIdent(nsCSSProps::ValueToKeywordEnum(xRepeat,
|
||||
nsCSSProps::kBackgroundRepeatKTable));
|
||||
nsCSSProps::kImageLayerRepeatKTable));
|
||||
valY->SetIdent(nsCSSProps::ValueToKeywordEnum(yRepeat,
|
||||
nsCSSProps::kBackgroundRepeatKTable));
|
||||
nsCSSProps::kImageLayerRepeatKTable));
|
||||
}
|
||||
itemList->AppendCSSValue(valX.forget());
|
||||
if (valY) {
|
||||
@@ -2267,15 +2270,15 @@ nsComputedDOMStyle::DoGetBackgroundSize()
|
||||
|
||||
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
|
||||
|
||||
for (uint32_t i = 0, i_end = bg->mSizeCount; i < i_end; ++i) {
|
||||
const nsStyleBackground::Size &size = bg->mLayers[i].mSize;
|
||||
for (uint32_t i = 0, i_end = bg->mLayers.mSizeCount; i < i_end; ++i) {
|
||||
const nsStyleImageLayers::Size &size = bg->mLayers.mLayers[i].mSize;
|
||||
|
||||
switch (size.mWidthType) {
|
||||
case nsStyleBackground::Size::eContain:
|
||||
case nsStyleBackground::Size::eCover: {
|
||||
case nsStyleImageLayers::Size::eContain:
|
||||
case nsStyleImageLayers::Size::eCover: {
|
||||
MOZ_ASSERT(size.mWidthType == size.mHeightType,
|
||||
"unsynced types");
|
||||
nsCSSKeyword keyword = size.mWidthType == nsStyleBackground::Size::eContain
|
||||
nsCSSKeyword keyword = size.mWidthType == nsStyleImageLayers::Size::eContain
|
||||
? eCSSKeyword_contain
|
||||
: eCSSKeyword_cover;
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
@@ -2289,11 +2292,11 @@ nsComputedDOMStyle::DoGetBackgroundSize()
|
||||
RefPtr<nsROCSSPrimitiveValue> valX = new nsROCSSPrimitiveValue;
|
||||
RefPtr<nsROCSSPrimitiveValue> valY = new nsROCSSPrimitiveValue;
|
||||
|
||||
if (size.mWidthType == nsStyleBackground::Size::eAuto) {
|
||||
if (size.mWidthType == nsStyleImageLayers::Size::eAuto) {
|
||||
valX->SetIdent(eCSSKeyword_auto);
|
||||
} else {
|
||||
MOZ_ASSERT(size.mWidthType ==
|
||||
nsStyleBackground::Size::eLengthPercentage,
|
||||
nsStyleImageLayers::Size::eLengthPercentage,
|
||||
"bad mWidthType");
|
||||
if (!size.mWidth.mHasPercent &&
|
||||
// negative values must have come from calc()
|
||||
@@ -2310,11 +2313,11 @@ nsComputedDOMStyle::DoGetBackgroundSize()
|
||||
}
|
||||
}
|
||||
|
||||
if (size.mHeightType == nsStyleBackground::Size::eAuto) {
|
||||
if (size.mHeightType == nsStyleImageLayers::Size::eAuto) {
|
||||
valY->SetIdent(eCSSKeyword_auto);
|
||||
} else {
|
||||
MOZ_ASSERT(size.mHeightType ==
|
||||
nsStyleBackground::Size::eLengthPercentage,
|
||||
nsStyleImageLayers::Size::eLengthPercentage,
|
||||
"bad mHeightType");
|
||||
if (!size.mHeight.mHasPercent &&
|
||||
// negative values must have come from calc()
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "nsCoord.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsStyleStruct.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@@ -36,7 +37,6 @@ class nsIPresShell;
|
||||
class nsDOMCSSValueList;
|
||||
struct nsMargin;
|
||||
class nsROCSSPrimitiveValue;
|
||||
struct nsStyleBackground;
|
||||
class nsStyleCoord;
|
||||
class nsStyleCorners;
|
||||
struct nsStyleFilter;
|
||||
@@ -201,8 +201,9 @@ private:
|
||||
bool aIsBoxShadow);
|
||||
|
||||
already_AddRefed<CSSValue> GetBackgroundList(
|
||||
uint8_t nsStyleBackground::Layer::* aMember,
|
||||
uint32_t nsStyleBackground::* aCount,
|
||||
uint8_t nsStyleImageLayers::Layer::* aMember,
|
||||
uint32_t nsStyleImageLayers::* aCount,
|
||||
const nsStyleImageLayers& aLayers,
|
||||
const KTableEntry aTable[]);
|
||||
|
||||
void GetCSSGradientString(const nsStyleGradient* aGradient,
|
||||
@@ -555,9 +556,9 @@ private:
|
||||
void SetValueToStyleImage(const nsStyleImage& aStyleImage,
|
||||
nsROCSSPrimitiveValue* aValue);
|
||||
void SetValueToPositionCoord(
|
||||
const nsStyleBackground::Position::PositionCoord& aCoord,
|
||||
const nsStyleImageLayers::Position::PositionCoord& aCoord,
|
||||
nsROCSSPrimitiveValue* aValue);
|
||||
void SetValueToPosition(const nsStyleBackground::Position& aPosition,
|
||||
void SetValueToPosition(const nsStyleImageLayers::Position& aPosition,
|
||||
nsDOMCSSValueList* aValueList);
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user