Merge inbound to mozilla-central. a=merge

This commit is contained in:
Brindusan Cristian 2018-03-26 00:44:42 +03:00
Родитель 05230575be 384c345f21
Коммит 2c121fc11d
50 изменённых файлов: 579 добавлений и 495 удалений

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

@ -28,7 +28,6 @@ skip-if = !e10s # Pref and test only relevant for e10s.
[browser_pinnedTabs_closeByKeyboard.js]
[browser_positional_attributes.js]
[browser_preloadedBrowser_zoom.js]
skip-if = !debug && (os == 'win' && (os_version == '6.1')) # Bug 1397098
[browser_reload_deleted_file.js]
skip-if = (debug && os == 'mac') || (debug && os == 'linux' && bits == 64) #Bug 1421183, disabled on Linux/OSX for leaked windows
[browser_tabswitch_updatecommands.js]

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

@ -38,6 +38,21 @@ async function zoomNewTab(changeZoom, message) {
const level = tab.linkedBrowser.fullZoom;
BrowserTestUtils.removeTab(tab);
// Wait for the the update of the full-zoom content pref value, that happens
// asynchronously after changing the zoom level.
let cps2 = Cc["@mozilla.org/content-pref/service;1"].
getService(Ci.nsIContentPrefService2);
await BrowserTestUtils.waitForCondition(() => {
return new Promise(resolve => {
cps2.getByDomainAndName("about:newtab", "browser.content.full-zoom", null, {
handleResult(pref) {
resolve(level == pref.value);
},
handleCompletion() {},
});
});
});
await checkPreloadedZoom(level, `${message}: ${level}`);
}

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

@ -114,3 +114,4 @@ support-files =
support-files =
bookmark_dummy_1.html
bookmark_dummy_2.html
[browser_drag_folder_on_newTab.js]

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

@ -0,0 +1,94 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function setup() {
let toolbar = document.getElementById("PersonalToolbar");
let wasCollapsed = toolbar.collapsed;
// Uncollapse the personal toolbar if needed.
if (wasCollapsed) {
await promiseSetToolbarVisibility(toolbar, true);
}
// Clean before and after so we don't have anything in the folders.
await PlacesUtils.bookmarks.eraseEverything();
registerCleanupFunction(async function() {
// Collapse the personal toolbar if needed.
if (wasCollapsed) {
await promiseSetToolbarVisibility(toolbar, false);
}
await PlacesUtils.bookmarks.eraseEverything();
});
});
const TEST_FOLDER_NAME = "Test folder";
add_task(async function test_change_location_from_Toolbar() {
let newTabButton = document.getElementById("new-tab-button");
let children = [
{
title: "first",
url: "http://www.mochi.test/first"
},
{
title: "second",
url: "http://www.mochi.test/second"
},
{
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
},
{
title: "third",
url: "http://www.mochi.test/third"
},
];
let guid = PlacesUtils.history.makeGuid();
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.toolbarGuid,
children: [
{
guid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: TEST_FOLDER_NAME,
children,
},
],
});
let folder = getToolbarNodeForItemGuid(guid);
let loadedPromises = children.filter(item => "url" in item).map(
item => BrowserTestUtils.waitForNewTab(gBrowser, item.url, false, true));
let srcX = 10, srcY = 10;
// We should drag upwards, since dragging downwards opens menu instead.
let stepX = 0, stepY = -5;
// We need to dispatch mousemove before dragging, to populate
// PlacesToolbar._cachedMouseMoveEvent, with the cursor position after the
// first step, so that the places code detects it as dragging upward.
EventUtils.synthesizeMouse(folder, srcX + stepX, srcY + stepY,
{ type: "mousemove" });
await EventUtils.synthesizePlainDragAndDrop({
srcElement: folder,
destElement: newTabButton,
srcX,
srcY,
stepX,
stepY,
});
let tabs = await Promise.all(loadedPromises);
for (let tab of tabs) {
BrowserTestUtils.removeTab(tab);
}
ok(true);
});

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

@ -416,13 +416,12 @@ class AsyncTabSwitcher {
this.maybeVisibleTabs.add(showTab);
let tabs = this.tabbrowser.tabbox.tabs;
let tabPanel = this.tabbrowser.tabpanels;
let showPanel = tabs.getRelatedElement(showTab);
let index = Array.indexOf(tabPanel.childNodes, showPanel);
let tabpanels = this.tabbrowser.tabpanels;
let showPanel = this.tabbrowser.tabContainer.getRelatedElement(showTab);
let index = Array.indexOf(tabpanels.childNodes, showPanel);
if (index != -1) {
this.log(`Switch to tab ${index} - ${this.tinfo(showTab)}`);
tabPanel.setAttribute("selectedIndex", index);
tabpanels.setAttribute("selectedIndex", index);
if (showTab === this.requestedTab) {
if (this._requestingTab) {
/*

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

@ -110,9 +110,9 @@ KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
if (mTarget) {
UpdateTargetRegistration();
RefPtr<ComputedStyle> styleContext = GetTargetComputedStyle();
if (styleContext) {
UpdateProperties(styleContext);
RefPtr<ComputedStyle> computedStyle = GetTargetComputedStyle();
if (computedStyle) {
UpdateProperties(computedStyle);
}
MaybeUpdateFrameForCompositor();
@ -163,9 +163,9 @@ KeyframeEffect::SetComposite(const CompositeOperation& aComposite)
}
if (mTarget) {
RefPtr<ComputedStyle> styleContext = GetTargetComputedStyle();
if (styleContext) {
UpdateProperties(styleContext);
RefPtr<ComputedStyle> computedStyle = GetTargetComputedStyle();
if (computedStyle) {
UpdateProperties(computedStyle);
}
}
}

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

@ -1023,7 +1023,7 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
// be consistent with Gecko, we just expand the variables (assuming we have
// enough context to do so). For that we need to grab the style context so we
// know what custom property values to provide.
RefPtr<ComputedStyle> styleContext;
RefPtr<ComputedStyle> computedStyle;
if (isServo && isCSSAnimation) {
// The following will flush style but that's ok since if you update
// a variable's computed value, you expect to see that updated value in the
@ -1033,7 +1033,7 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
// we might end up returning variables as-is or empty string. That should be
// acceptable however, since such a case is rare and this is only
// short-term (and unshipped) behavior until bug 1391537 is fixed.
styleContext = GetTargetComputedStyle();
computedStyle = GetTargetComputedStyle();
}
for (const Keyframe& keyframe : mKeyframes) {
@ -1086,7 +1086,7 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
}
if (propertyValue.mServoDeclarationBlock) {
const ComputedStyle* servoComputedStyle =
styleContext ? styleContext->AsServo() : nullptr;
computedStyle ? computedStyle->AsServo() : nullptr;
Servo_DeclarationBlock_SerializeOneValue(
propertyValue.mServoDeclarationBlock,
propertyValue.mProperty,

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

@ -12,7 +12,6 @@
#include "mozilla/dom/DOMPointBinding.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "mozilla/ServoCSSParser.h"
#include "nsCSSParser.h"
#include "nsGlobalWindowInner.h"

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

@ -1505,10 +1505,10 @@ Element::GetElementsWithGrid(nsTArray<RefPtr<Element>>& aElements)
// generate a nsGridContainerFrame during layout.
auto IsDisplayGrid = [](Element* aElement) -> bool
{
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyle(aElement, nullptr);
if (styleContext) {
const nsStyleDisplay* display = styleContext->StyleDisplay();
if (computedStyle) {
const nsStyleDisplay* display = computedStyle->StyleDisplay();
return (display->mDisplay == StyleDisplay::Grid ||
display->mDisplay == StyleDisplay::InlineGrid);
}

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

@ -10,7 +10,6 @@
#include "mozilla/dom/WebKitCSSMatrixBinding.h"
#include "mozilla/Preferences.h"
#include "nsPresContext.h"
#include "RuleNodeCacheConditions.h"
#include "nsGlobalWindowInner.h"
namespace mozilla {

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

@ -2719,9 +2719,9 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement,
return NS_ERROR_ILLEGAL_VALUE;
}
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyle(element, nullptr);
*aResult = v1.ComputeDistance(property, v2, styleContext);
*aResult = v1.ComputeDistance(property, v2, computedStyle);
return NS_OK;
}
@ -2817,14 +2817,14 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
}
RefPtr<nsAtom> pseudo = nsCSSPseudoElements::GetPseudoAtom(aPseudoElement);
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetUnanimatedComputedStyleNoFlush(element, pseudo);
if (!styleContext) {
if (!computedStyle) {
return NS_ERROR_FAILURE;
}
RefPtr<RawServoAnimationValue> value =
Servo_ComputedValues_ExtractAnimationValue(styleContext->AsServo(),
Servo_ComputedValues_ExtractAnimationValue(computedStyle,
propertyID).Consume();
if (!value) {
return NS_ERROR_FAILURE;

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

@ -1851,10 +1851,10 @@ nsPlainTextSerializer::IsInPre()
bool
nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
{
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
if (computedStyle) {
const nsStyleText* textStyle = computedStyle->StyleText();
return textStyle->WhiteSpaceOrNewlineIsSignificant();
}
// Fall back to looking at the tag, in case there is no style information.
@ -1864,10 +1864,10 @@ nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
bool
nsPlainTextSerializer::IsElementBlock(Element* aElement)
{
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
if (styleContext) {
const nsStyleDisplay* displayStyle = styleContext->StyleDisplay();
if (computedStyle) {
const nsStyleDisplay* displayStyle = computedStyle->StyleDisplay();
return displayStyle->IsBlockOutsideStyle();
}
// Fall back to looking at the tag, in case there is no style information.

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

@ -720,10 +720,10 @@ nsXHTMLContentSerializer::IsElementPreformatted(nsIContent* aNode)
if (!aNode->IsElement()) {
return false;
}
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aNode->AsElement(), nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
if (computedStyle) {
const nsStyleText* textStyle = computedStyle->StyleText();
return textStyle->WhiteSpaceOrNewlineIsSignificant();
}
return false;

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

@ -69,7 +69,7 @@ nsSMILCSSProperty::GetBaseValue() const
AnimationValue computedValue;
if (mElement->IsStyledByServo()) {
computedValue.mServo =
Servo_ComputedValues_ExtractAnimationValue(mBaseComputedStyle->AsServo(), mPropID)
Servo_ComputedValues_ExtractAnimationValue(mBaseComputedStyle, mPropID)
.Consume();
if (!computedValue.mServo) {
return baseValue;

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

@ -550,15 +550,15 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
return;
}
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyle(aTargetElement, nullptr);
if (!styleContext) {
if (!computedStyle) {
return;
}
ServoAnimationValues parsedValues =
ValueFromStringHelper(aPropID, aTargetElement, presContext,
styleContext, aString);
computedStyle, aString);
if (aIsContextSensitive) {
// FIXME: Bug 1358955 - detect context-sensitive values and set this value
// appropriately.

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

@ -175,19 +175,19 @@ SVGContentUtils::GetStrokeOptions(AutoStrokeOptions* aStrokeOptions,
SVGContextPaint* aContextPaint,
StrokeOptionFlags aFlags)
{
RefPtr<ComputedStyle> styleContext;
RefPtr<ComputedStyle> computedStyle;
if (aComputedStyle) {
styleContext = aComputedStyle;
computedStyle = aComputedStyle;
} else {
styleContext =
computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
}
if (!styleContext) {
if (!computedStyle) {
return;
}
const nsStyleSVG* styleSVG = styleContext->StyleSVG();
const nsStyleSVG* styleSVG = computedStyle->StyleSVG();
bool checkedDashAndStrokeIsDashed = false;
if (aFlags != eIgnoreStrokeDashing) {
@ -207,7 +207,7 @@ SVGContentUtils::GetStrokeOptions(AutoStrokeOptions* aStrokeOptions,
}
aStrokeOptions->mLineWidth =
GetStrokeWidth(aElement, styleContext, aContextPaint);
GetStrokeWidth(aElement, computedStyle, aContextPaint);
aStrokeOptions->mMiterLimit = Float(styleSVG->mStrokeMiterlimit);
@ -248,19 +248,19 @@ SVGContentUtils::GetStrokeWidth(nsSVGElement* aElement,
ComputedStyle* aComputedStyle,
SVGContextPaint* aContextPaint)
{
RefPtr<ComputedStyle> styleContext;
RefPtr<ComputedStyle> computedStyle;
if (aComputedStyle) {
styleContext = aComputedStyle;
computedStyle = aComputedStyle;
} else {
styleContext =
computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
}
if (!styleContext) {
if (!computedStyle) {
return 0.0f;
}
const nsStyleSVG* styleSVG = styleContext->StyleSVG();
const nsStyleSVG* styleSVG = computedStyle->StyleSVG();
if (aContextPaint && styleSVG->StrokeWidthFromObject()) {
return aContextPaint->GetStrokeWidth();
@ -275,15 +275,15 @@ SVGContentUtils::GetFontSize(Element *aElement)
if (!aElement)
return 1.0f;
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
if (!styleContext) {
if (!computedStyle) {
// ReportToConsole
NS_WARNING("Couldn't get style context for content in GetFontStyle");
return 1.0f;
}
return GetFontSize(styleContext);
return GetFontSize(computedStyle);
}
float
@ -312,15 +312,15 @@ SVGContentUtils::GetFontXHeight(Element *aElement)
if (!aElement)
return 1.0f;
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
if (!styleContext) {
if (!computedStyle) {
// ReportToConsole
NS_WARNING("Couldn't get style context for content in GetFontStyle");
return 1.0f;
}
return GetFontXHeight(styleContext);
return GetFontXHeight(computedStyle);
}
float

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

@ -138,14 +138,14 @@ SVGGeometryElement::GetFillRule()
{
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(this, nullptr);
if (styleContext) {
MOZ_ASSERT(styleContext->StyleSVG()->mFillRule == StyleFillRule::Nonzero ||
styleContext->StyleSVG()->mFillRule == StyleFillRule::Evenodd);
if (computedStyle) {
MOZ_ASSERT(computedStyle->StyleSVG()->mFillRule == StyleFillRule::Nonzero ||
computedStyle->StyleSVG()->mFillRule == StyleFillRule::Evenodd);
if (styleContext->StyleSVG()->mFillRule == StyleFillRule::Evenodd) {
if (computedStyle->StyleSVG()->mFillRule == StyleFillRule::Evenodd) {
fillRule = FillRule::FILL_EVEN_ODD;
}
} else {

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

@ -301,7 +301,7 @@ private:
* Consumers should check that the user unit values returned are finite. Even
* if the consumer can guarantee the list's element has a valid viewport
* ancestor to resolve percentage units against, and a valid presContext and
* styleContext to resolve absolute and em/ex units against, unit conversions
* ComputedStyle to resolve absolute and em/ex units against, unit conversions
* could still overflow. In that case the value returned will be
* numeric_limits<float>::quiet_NaN().
*/

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

@ -298,17 +298,18 @@ SVGPathElement::BuildPath(PathBuilder* aBuilder)
uint8_t strokeLineCap = NS_STYLE_STROKE_LINECAP_BUTT;
Float strokeWidth = 0;
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(this, nullptr);
if (styleContext) {
const nsStyleSVG* style = styleContext->StyleSVG();
if (computedStyle) {
const nsStyleSVG* style = computedStyle->StyleSVG();
// Note: the path that we return may be used for hit-testing, and SVG
// exposes hit-testing of strokes that are not actually painted. For that
// reason we do not check for eStyleSVGPaintType_None or check the stroke
// opacity here.
if (style->mStrokeLinecap != NS_STYLE_STROKE_LINECAP_BUTT) {
strokeLineCap = style->mStrokeLinecap;
strokeWidth = SVGContentUtils::GetStrokeWidth(this, styleContext, nullptr);
strokeWidth =
SVGContentUtils::GetStrokeWidth(this, computedStyle, nullptr);
}
}

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

@ -80,8 +80,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
]
# Work around a crash when jumping into assembly on platforms where
# Clang has 4-byte stack alignment (BSDs, Windows).
if CONFIG['CPU_ARCH'] == 'x86' and CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
# Clang has 4-byte stack alignment.
if CONFIG['CPU_ARCH'] == 'x86' and CONFIG['CC_TYPE'] == 'clang':
SOURCES['skia/src/jumper/SkJumper.cpp'].flags += [
'-mstack-alignment=16',
'-mstackrealign'

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

@ -755,8 +755,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
]
# Work around a crash when jumping into assembly on platforms where
# Clang has 4-byte stack alignment (BSDs, Windows).
if CONFIG['CPU_ARCH'] == 'x86' and CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
# Clang has 4-byte stack alignment.
if CONFIG['CPU_ARCH'] == 'x86' and CONFIG['CC_TYPE'] == 'clang':
SOURCES['skia/src/jumper/SkJumper.cpp'].flags += [
'-mstack-alignment=16',
'-mstackrealign'

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

@ -507,17 +507,17 @@ public:
void ComputeHintIfNeeded(nsIContent* aContent,
nsIFrame* aTextFrame,
ComputedStyle& aNewContext)
ComputedStyle& aNewStyle)
{
MOZ_ASSERT(aTextFrame);
MOZ_ASSERT(aNewContext.GetPseudo() == nsCSSAnonBoxes::mozText);
MOZ_ASSERT(aNewStyle.GetPseudo() == nsCSSAnonBoxes::mozText);
if (MOZ_LIKELY(!mShouldPostHints)) {
return;
}
ComputedStyle* oldContext = aTextFrame->Style()->AsServo();
MOZ_ASSERT(oldContext->GetPseudo() == nsCSSAnonBoxes::mozText);
ComputedStyle* oldStyle = aTextFrame->Style();
MOZ_ASSERT(oldStyle->GetPseudo() == nsCSSAnonBoxes::mozText);
// We rely on the fact that all the text children for the same element share
// style to avoid recomputing style differences for all of them.
@ -528,9 +528,9 @@ public:
mShouldComputeHints = false;
uint32_t equalStructs, samePointerStructs;
mComputedHint =
oldContext->CalcStyleDifference(&aNewContext,
&equalStructs,
&samePointerStructs);
oldStyle->CalcStyleDifference(&aNewStyle,
&equalStructs,
&samePointerStructs);
mComputedHint = NS_RemoveSubsumedHints(
mComputedHint, mParentRestyleState.ChangesHandledFor(*aTextFrame));
}
@ -588,10 +588,10 @@ UpdateBackdropIfNeeded(nsIFrame* aFrame,
MOZ_ASSERT(backdropFrame->Style()->GetPseudoType() ==
CSSPseudoElementType::backdrop);
RefPtr<ComputedStyle> newContext =
RefPtr<ComputedStyle> newStyle =
aStyleSet.ResolvePseudoElementStyle(aFrame->GetContent()->AsElement(),
CSSPseudoElementType::backdrop,
aFrame->Style()->AsServo(),
aFrame->Style(),
/* aPseudoElement = */ nullptr);
// NOTE(emilio): We can't use the changes handled for the owner of the
@ -601,7 +601,7 @@ UpdateBackdropIfNeeded(nsIFrame* aFrame,
backdropFrame->GetParent()->IsCanvasFrame());
nsTArray<nsIFrame*> wrappersToRestyle;
ServoRestyleState state(aStyleSet, aChangeList, wrappersToRestyle);
nsIFrame::UpdateStyleOfOwnedChildFrame(backdropFrame, newContext, state);
nsIFrame::UpdateStyleOfOwnedChildFrame(backdropFrame, newStyle, state);
}
static void
@ -636,16 +636,16 @@ UpdateOneAdditionalComputedStyle(nsIFrame* aFrame,
MOZ_ASSERT(
!nsCSSPseudoElements::PseudoElementSupportsUserActionState(pseudoType));
RefPtr<ComputedStyle> newContext =
RefPtr<ComputedStyle> newStyle =
aRestyleState.StyleSet().ResolvePseudoElementStyle(
aFrame->GetContent()->AsElement(),
pseudoType,
aFrame->Style()->AsServo(),
aFrame->Style(),
/* aPseudoElement = */ nullptr);
uint32_t equalStructs, samePointerStructs; // Not used, actually.
nsChangeHint childHint = aOldContext.CalcStyleDifference(
newContext,
newStyle,
&equalStructs,
&samePointerStructs);
if (!aFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
@ -663,7 +663,7 @@ UpdateOneAdditionalComputedStyle(nsIFrame* aFrame,
aFrame, aFrame->GetContent(), childHint);
}
aFrame->SetAdditionalComputedStyle(aIndex, newContext);
aFrame->SetAdditionalComputedStyle(aIndex, newStyle);
}
static void
@ -676,9 +676,9 @@ UpdateAdditionalComputedStyles(nsIFrame* aFrame,
// FIXME(emilio): Consider adding a bit or something to avoid the initial
// virtual call?
uint32_t index = 0;
while (auto* oldContext = aFrame->GetAdditionalComputedStyle(index)) {
while (auto* oldStyle = aFrame->GetAdditionalComputedStyle(index)) {
UpdateOneAdditionalComputedStyle(
aFrame, index++, *oldContext->AsServo(), aRestyleState);
aFrame, index++, *oldStyle, aRestyleState);
}
}
@ -854,7 +854,7 @@ ServoRestyleManager::ProcessPostTraversal(
// during the replacement. In practice it's not a huge deal, but better not
// playing with dangling pointers if not needed.
RefPtr<ComputedStyle> oldComputedStyle =
styleFrame ? styleFrame->Style()->AsServo() : nullptr;
styleFrame ? styleFrame->Style() : nullptr;
ComputedStyle* displayContentsStyle = nullptr;
// FIXME(emilio, bug 1303605): This can be simpler for Servo.
@ -863,7 +863,7 @@ ServoRestyleManager::ProcessPostTraversal(
displayContentsStyle =
PresContext()->FrameConstructor()->GetDisplayContentsStyleFor(aElement);
if (displayContentsStyle) {
oldComputedStyle = displayContentsStyle->AsServo();
oldComputedStyle = displayContentsStyle;
}
}
@ -899,7 +899,7 @@ ServoRestyleManager::ProcessPostTraversal(
// We want to walk all the continuations here, even the ones with different
// styles. In practice, the only reason we get continuations with different
// styles here is ::first-line (::first-letter never affects element
// styles). But in that case, newContext is the right context for the
// styles). But in that case, newStyle is the right context for the
// _later_ continuations anyway (the ones not affected by ::first-line), not
// the earlier ones, so there is no point stopping right at the point when
// we'd actually be setting the right ComputedStyle.
@ -938,7 +938,7 @@ ServoRestyleManager::ProcessPostTraversal(
//
// We can sometimes reach this when the animated style is being removed.
// Since AddLayerChangesForAnimation checks if |styleFrame| has a transform
// style or not, we need to call it *after* setting |newContext| to
// style or not, we need to call it *after* setting |newStyle| to
// |styleFrame| to ensure the animated transform has been removed first.
AddLayerChangesForAnimation(
styleFrame, aElement, aRestyleState.ChangeList());
@ -1045,13 +1045,13 @@ ServoRestyleManager::ProcessPostTraversalForText(
ServoRestyleState::TableAwareParentFor(primaryFrame));
}
ComputedStyle& newContext = aPostTraversalState.ComputeStyle(aTextNode);
aPostTraversalState.ComputeHintIfNeeded(aTextNode, primaryFrame, newContext);
ComputedStyle& newStyle = aPostTraversalState.ComputeStyle(aTextNode);
aPostTraversalState.ComputeHintIfNeeded(aTextNode, primaryFrame, newStyle);
// We want to walk all the continuations here, even the ones with different
// styles. In practice, the only reasons we get continuations with different
// styles are ::first-line and ::first-letter. But in those cases,
// newContext is the right context for the _later_ continuations anyway (the
// newStyle is the right context for the _later_ continuations anyway (the
// ones not affected by ::first-line/::first-letter), not the earlier ones,
// so there is no point stopping right at the point when we'd actually be
// setting the right ComputedStyle.
@ -1060,7 +1060,7 @@ ServoRestyleManager::ProcessPostTraversalForText(
// initial continuations; ::first-line/::first-letter fix that up after the
// fact.
for (nsIFrame* f = primaryFrame; f; f = f->GetNextContinuation()) {
f->SetComputedStyle(&newContext);
f->SetComputedStyle(&newStyle);
}
return true;
@ -1591,7 +1591,7 @@ ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
}
nsIFrame* providerFrame;
ComputedStyle* newParentContext =
ComputedStyle* newParentStyle =
aFrame->GetParentComputedStyle(&providerFrame);
// If our provider is our child, we want to reparent it first, because we
// inherit style from it.
@ -1601,13 +1601,13 @@ ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
DoReparentComputedStyle(providerFrame, aStyleSet);
// Get the style again after ReparentComputedStyle() which might have
// changed it.
newParentContext = providerFrame->Style();
newParentStyle = providerFrame->Style();
providerChild = providerFrame;
MOZ_ASSERT(!providerFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW),
"Out of flow provider?");
}
if (!newParentContext) {
if (!newParentStyle) {
// No need to do anything here for this frame, but we should still reparent
// its descendants, because those may have styles that inherit from the
// parent of this frame (e.g. non-anonymous columns in an anonymous
@ -1629,13 +1629,13 @@ ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
// We don't try to do the fancy copying from previous continuations that
// GeckoRestyleManager does here, because that relies on knowing the parents
// of ComputedStyles, and we don't know those.
ComputedStyle* oldContext = aFrame->Style()->AsServo();
ComputedStyle* oldStyle = aFrame->Style();
Element* ourElement =
oldContext->GetPseudoType() == CSSPseudoElementType::NotPseudo &&
oldStyle->GetPseudoType() == CSSPseudoElementType::NotPseudo &&
isElement ?
aFrame->GetContent()->AsElement() :
nullptr;
ComputedStyle* newParent = newParentContext->AsServo();
ComputedStyle* newParent = newParentStyle;
ComputedStyle* newParentIgnoringFirstLine;
if (newParent->GetPseudoType() == CSSPseudoElementType::firstLine) {
@ -1648,8 +1648,8 @@ ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
// Use the resulting style for the "parent style ignoring ::first-line".
nsIFrame* blockFrame = providerFrame->GetParent();
nsIFrame* correctedFrame =
nsFrame::CorrectStyleParentFrame(blockFrame, oldContext->GetPseudo());
newParentIgnoringFirstLine = correctedFrame->Style()->AsServo();
nsFrame::CorrectStyleParentFrame(blockFrame, oldStyle->GetPseudo());
newParentIgnoringFirstLine = correctedFrame->Style();
} else {
newParentIgnoringFirstLine = newParent;
}
@ -1663,18 +1663,18 @@ ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
aFrame->GetPlaceholderFrame()->GetLayoutParentStyleForOutOfFlow(&providerFrame);
} else {
providerFrame = nsFrame::CorrectStyleParentFrame(aFrame->GetParent(),
oldContext->GetPseudo());
oldStyle->GetPseudo());
}
}
ComputedStyle* layoutParent = providerFrame->Style()->AsServo();
ComputedStyle* layoutParent = providerFrame->Style();
RefPtr<ComputedStyle> newContext =
aStyleSet.ReparentComputedStyle(oldContext,
newParent,
newParentIgnoringFirstLine,
layoutParent,
ourElement);
aFrame->SetComputedStyle(newContext);
RefPtr<ComputedStyle> newStyle =
aStyleSet.ReparentComputedStyle(oldStyle,
newParent,
newParentIgnoringFirstLine,
layoutParent,
ourElement);
aFrame->SetComputedStyle(newStyle);
// This logic somewhat mirrors the logic in
// ServoRestyleManager::ProcessPostTraversal.
@ -1683,14 +1683,13 @@ ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
// ServoRestyleState and maintaining one of those during a _frametree_
// traversal is basically impossible.
uint32_t index = 0;
while (ComputedStyle* oldAdditionalContext =
aFrame->GetAdditionalComputedStyle(index)) {
while (auto* oldAdditionalStyle = aFrame->GetAdditionalComputedStyle(index)) {
RefPtr<ComputedStyle> newAdditionalContext =
aStyleSet.ReparentComputedStyle(oldAdditionalContext->AsServo(),
newContext,
newContext,
newContext,
nullptr);
aStyleSet.ReparentComputedStyle(oldAdditionalStyle,
newStyle,
newStyle,
newStyle,
nullptr);
aFrame->SetAdditionalComputedStyle(index, newAdditionalContext);
++index;
}

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

@ -2074,14 +2074,14 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
"Unexpected call");
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
const uint32_t nameSpaceID = aItem.mNameSpaceID;
// create the pseudo SC for the table wrapper as a child of the inner SC
RefPtr<ComputedStyle> outerComputedStyle;
outerComputedStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableWrapper,
styleContext);
computedStyle);
// Create the table wrapper frame which holds the caption and inner table frame
nsContainerFrame* newFrame;
@ -2100,9 +2100,9 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
// Create the inner table frame
nsContainerFrame* innerFrame;
if (kNameSpaceID_MathML == nameSpaceID)
innerFrame = NS_NewMathMLmtableFrame(mPresShell, styleContext);
innerFrame = NS_NewMathMLmtableFrame(mPresShell, computedStyle);
else
innerFrame = NS_NewTableFrame(mPresShell, styleContext);
innerFrame = NS_NewTableFrame(mPresShell, computedStyle);
InitAndRestoreFrame(aState, content, newFrame, innerFrame);
innerFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
@ -2139,7 +2139,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
aItem.mFCData->mBits & FCDATA_IS_WRAPPER_ANON_BOX,
childItems);
} else {
ProcessChildren(aState, content, styleContext, innerFrame,
ProcessChildren(aState, content, computedStyle, innerFrame,
true, childItems, false, aItem.mPendingBinding);
}
@ -2193,17 +2193,17 @@ nsCSSFrameConstructor::ConstructTableRowOrRowGroup(nsFrameConstructorState& aSta
MOZ_ASSERT(aItem.mComputedStyle->StyleDisplay() == aDisplay,
"Display style doesn't match style");
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
const uint32_t nameSpaceID = aItem.mNameSpaceID;
nsContainerFrame* newFrame;
if (aDisplay->mDisplay == StyleDisplay::TableRow) {
if (kNameSpaceID_MathML == nameSpaceID)
newFrame = NS_NewMathMLmtrFrame(mPresShell, styleContext);
newFrame = NS_NewMathMLmtrFrame(mPresShell, computedStyle);
else
newFrame = NS_NewTableRowFrame(mPresShell, styleContext);
newFrame = NS_NewTableRowFrame(mPresShell, computedStyle);
} else {
newFrame = NS_NewTableRowGroupFrame(mPresShell, styleContext);
newFrame = NS_NewTableRowGroupFrame(mPresShell, computedStyle);
}
InitAndRestoreFrame(aState, content, aParentFrame, newFrame);
@ -2223,7 +2223,7 @@ nsCSSFrameConstructor::ConstructTableRowOrRowGroup(nsFrameConstructorState& aSta
aItem.mFCData->mBits & FCDATA_IS_WRAPPER_ANON_BOX,
childItems);
} else {
ProcessChildren(aState, content, styleContext, newFrame,
ProcessChildren(aState, content, computedStyle, newFrame,
true, childItems, false, aItem.mPendingBinding);
}
@ -2240,19 +2240,19 @@ nsCSSFrameConstructor::ConstructTableCol(nsFrameConstructorState& aState,
nsFrameItems& aFrameItems)
{
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
nsTableColFrame* colFrame = NS_NewTableColFrame(mPresShell, styleContext);
nsTableColFrame* colFrame = NS_NewTableColFrame(mPresShell, computedStyle);
InitAndRestoreFrame(aState, content, aParentFrame, colFrame);
NS_ASSERTION(colFrame->Style() == styleContext, "Unexpected style");
NS_ASSERTION(colFrame->Style() == computedStyle, "Unexpected style");
aFrameItems.AddChild(colFrame);
// construct additional col frames if the col frame has a span > 1
int32_t span = colFrame->GetSpan();
for (int32_t spanX = 1; spanX < span; spanX++) {
nsTableColFrame* newCol = NS_NewTableColFrame(mPresShell, styleContext);
nsTableColFrame* newCol = NS_NewTableColFrame(mPresShell, computedStyle);
InitAndRestoreFrame(aState, content, aParentFrame, newCol, false);
aFrameItems.LastChild()->SetNextContinuation(newCol);
newCol->SetPrevContinuation(aFrameItems.LastChild());
@ -2274,7 +2274,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
"Unexpected call");
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
const uint32_t nameSpaceID = aItem.mNameSpaceID;
nsTableFrame* tableFrame =
@ -2288,12 +2288,12 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
// What will happen is just that non-MathML frames won't understand MathML attributes
// and will therefore miss the special handling that the MathML code does.
if (kNameSpaceID_MathML == nameSpaceID && !tableFrame->IsBorderCollapse()) {
newFrame = NS_NewMathMLmtdFrame(mPresShell, styleContext, tableFrame);
newFrame = NS_NewMathMLmtdFrame(mPresShell, computedStyle, tableFrame);
} else {
// Warning: If you change this and add a wrapper frame around table cell
// frames, make sure Bug 368554 doesn't regress!
// See IsInAutoWidthTableCellForQuirk() in nsImageFrame.cpp.
newFrame = NS_NewTableCellFrame(mPresShell, styleContext, tableFrame);
newFrame = NS_NewTableCellFrame(mPresShell, computedStyle, tableFrame);
}
// Initialize the table cell frame
@ -2304,7 +2304,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
RefPtr<ComputedStyle> innerPseudoStyle;
innerPseudoStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::cellContent,
styleContext);
computedStyle);
// Create a block frame that will format the cell's content
bool isBlock;
@ -2346,7 +2346,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
childItems);
} else {
// Process the child content
ProcessChildren(aState, content, styleContext, cellInnerFrame,
ProcessChildren(aState, content, computedStyle, cellInnerFrame,
true, childItems, isBlock, aItem.mPendingBinding);
}
@ -2455,10 +2455,10 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
}
}
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aDocElement);
const nsStyleDisplay* display = styleContext->StyleDisplay();
const nsStyleDisplay* display = computedStyle->StyleDisplay();
// Ensure that our XBL bindings are installed.
if (display->mBinding) {
@ -2488,9 +2488,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
}
if (resolveStyle) {
styleContext =
computedStyle =
mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aDocElement);
display = styleContext->StyleDisplay();
display = computedStyle->StyleDisplay();
}
}
@ -2502,12 +2502,12 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
"Scrollbars should have been propagated to the viewport");
if (MOZ_UNLIKELY(display->mDisplay == StyleDisplay::None)) {
RegisterDisplayNoneStyleFor(aDocElement, styleContext);
RegisterDisplayNoneStyleFor(aDocElement, computedStyle);
return nullptr;
}
// Make sure to start any background image loads for the root element now.
styleContext->StartBackgroundImageLoads();
computedStyle->StartBackgroundImageLoads();
nsFrameConstructorSaveState docElementContainingBlockAbsoluteSaveState;
if (mHasRootAbsPosContainingBlock) {
@ -2538,7 +2538,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// Check whether we need to build a XUL box or SVG root frame
#ifdef MOZ_XUL
if (aDocElement->IsXULElement()) {
contentFrame = NS_NewDocElementBoxFrame(mPresShell, styleContext);
contentFrame = NS_NewDocElementBoxFrame(mPresShell, computedStyle);
InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
contentFrame);
newFrame = contentFrame;
@ -2560,7 +2560,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootSVGData = FCDATA_DECL(0, nullptr);
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(styleContext).forget();
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootSVGData, aDocElement,
aDocElement->NodeInfo()->NameAtom(),
kNameSpaceID_SVG, nullptr, extraRef, true,
@ -2569,7 +2569,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
nsFrameItems frameItems;
contentFrame = static_cast<nsContainerFrame*>(
ConstructOuterSVG(state, item, mDocElementContainingBlock,
styleContext->StyleDisplay(),
computedStyle->StyleDisplay(),
frameItems));
newFrame = frameItems.FirstChild();
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
@ -2577,7 +2577,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
display->mDisplay == StyleDisplay::WebkitBox ||
(StylePrefs::sEmulateMozBoxWithFlex &&
display->mDisplay == StyleDisplay::MozBox)) {
contentFrame = NS_NewFlexContainerFrame(mPresShell, styleContext);
contentFrame = NS_NewFlexContainerFrame(mPresShell, computedStyle);
InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
contentFrame);
newFrame = contentFrame;
@ -2590,7 +2590,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
}
} else if (display->mDisplay == StyleDisplay::Grid) {
contentFrame = NS_NewGridContainerFrame(mPresShell, styleContext);
contentFrame = NS_NewGridContainerFrame(mPresShell, computedStyle);
InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
contentFrame);
newFrame = contentFrame;
@ -2612,7 +2612,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootTableData = FCDATA_DECL(0, nullptr);
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(styleContext).forget();
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootTableData, aDocElement,
aDocElement->NodeInfo()->NameAtom(),
kNameSpaceID_None, nullptr, extraRef, true,
@ -2622,7 +2622,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// if the document is a table then just populate it.
contentFrame = static_cast<nsContainerFrame*>(
ConstructTable(state, item, mDocElementContainingBlock,
styleContext->StyleDisplay(),
computedStyle->StyleDisplay(),
frameItems));
newFrame = frameItems.FirstChild();
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
@ -2630,13 +2630,13 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
MOZ_ASSERT(display->mDisplay == StyleDisplay::Block ||
display->mDisplay == StyleDisplay::FlowRoot,
"Unhandled display type for root element");
contentFrame = NS_NewBlockFormattingContext(mPresShell, styleContext);
contentFrame = NS_NewBlockFormattingContext(mPresShell, computedStyle);
nsFrameItems frameItems;
// Use a null PendingBinding, since our binding is not in fact pending.
ConstructBlock(state, aDocElement,
state.GetGeometricParent(display,
mDocElementContainingBlock),
mDocElementContainingBlock, styleContext,
mDocElementContainingBlock, computedStyle,
&contentFrame, frameItems,
display->IsAbsPosContainingBlock(contentFrame) ? contentFrame : nullptr,
nullptr);
@ -2670,7 +2670,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
!contentFrame->IsFrameOfType(nsIFrame::eSVG),
"Only XUL frames should reach here");
// Use a null PendingBinding, since our binding is not in fact pending.
ProcessChildren(state, aDocElement, styleContext, contentFrame, true,
ProcessChildren(state, aDocElement, computedStyle, contentFrame, true,
childItems, false, nullptr);
// Set the initial child lists
@ -2885,8 +2885,7 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
// created.
// resolve a context for the scrollframe
RefPtr<ComputedStyle> styleContext;
styleContext =
RefPtr<ComputedStyle> computedStyle =
styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewportScroll,
viewportPseudoStyle);
@ -2900,7 +2899,7 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
newFrame = nullptr;
rootPseudoStyle = BeginBuildingScrollFrame( state,
aDocElement,
styleContext,
computedStyle,
viewportFrame,
rootPseudo,
true,
@ -3076,7 +3075,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
nsFrameItems& aFrameItems)
{
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
// Construct a frame-based listbox or combobox
dom::HTMLSelectElement* sel = dom::HTMLSelectElement::FromNode(content);
@ -3089,7 +3088,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
// with the drop-down list.
nsFrameState flags = NS_BLOCK_FLOAT_MGR;
nsComboboxControlFrame* comboboxFrame =
NS_NewComboboxControlFrame(mPresShell, styleContext, flags);
NS_NewComboboxControlFrame(mPresShell, computedStyle, flags);
// Save the history state so we don't restore during construction
// since the complete tree is required before we restore.
@ -3108,7 +3107,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
RefPtr<ComputedStyle> listStyle;
listStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::dropDownList,
styleContext);
computedStyle);
// Create a listbox
nsContainerFrame* listFrame = NS_NewListControlFrame(mPresShell, listStyle);
@ -3135,7 +3134,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
// Initialize the scroll frame positioned. Note that it is NOT
// initialized as absolutely positioned.
nsContainerFrame* scrolledFrame =
NS_NewSelectsAreaFrame(mPresShell, styleContext, flags);
NS_NewSelectsAreaFrame(mPresShell, computedStyle, flags);
InitializeSelectFrame(aState, listFrame, scrolledFrame, content,
comboboxFrame, listStyle, true,
@ -3194,16 +3193,17 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
}
// Listbox, not combobox
nsContainerFrame* listFrame = NS_NewListControlFrame(mPresShell, styleContext);
nsContainerFrame* listFrame =
NS_NewListControlFrame(mPresShell, computedStyle);
nsContainerFrame* scrolledFrame = NS_NewSelectsAreaFrame(
mPresShell, styleContext, NS_BLOCK_FLOAT_MGR);
mPresShell, computedStyle, NS_BLOCK_FLOAT_MGR);
// ******* this code stolen from Initialze ScrollFrame ********
// please adjust this code to use BuildScrollFrame.
InitializeSelectFrame(aState, listFrame, scrolledFrame, content,
aParentFrame, styleContext, false,
aParentFrame, computedStyle, false,
aItem.mPendingBinding, aFrameItems);
return listFrame;
@ -3265,9 +3265,10 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
nsFrameItems& aFrameItems)
{
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
nsContainerFrame* fieldsetFrame = NS_NewFieldSetFrame(mPresShell, styleContext);
nsContainerFrame* fieldsetFrame =
NS_NewFieldSetFrame(mPresShell, computedStyle);
// Initialize it
InitAndRestoreFrame(aState, content,
@ -3280,7 +3281,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
RefPtr<ComputedStyle> fieldsetContentStyle;
fieldsetContentStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::fieldsetContent,
styleContext);
computedStyle);
const nsStyleDisplay* fieldsetContentDisplay = fieldsetContentStyle->StyleDisplay();
bool isScrollable = fieldsetContentDisplay->IsScrollableOverflow();
@ -3356,7 +3357,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
aState.PushAbsoluteContainingBlock(contentFrame, absPosContainer, absoluteSaveState);
}
ProcessChildren(aState, content, styleContext, contentFrame, true,
ProcessChildren(aState, content, computedStyle, contentFrame, true,
childItems, true, aItem.mPendingBinding);
nsFrameItems fieldsetKids;
@ -3871,8 +3872,8 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
nsIContent* const content = aItem.mContent;
nsIFrame* newFrame;
nsIFrame* primaryFrame;
ComputedStyle* const styleContext = aItem.mComputedStyle;
const nsStyleDisplay* display = styleContext->StyleDisplay();
ComputedStyle* const computedStyle = aItem.mComputedStyle;
const nsStyleDisplay* display = computedStyle->StyleDisplay();
if (bits & FCDATA_FUNC_IS_FULL_CTOR) {
newFrame =
(this->*(data->mFullConstructor))(aState, aItem, aParentFrame,
@ -3881,7 +3882,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
primaryFrame = newFrame;
} else {
newFrame =
(*data->mFunc.mCreationFunc)(mPresShell, styleContext);
(*data->mFunc.mCreationFunc)(mPresShell, computedStyle);
bool allowOutOfFlow = !(bits & FCDATA_DISALLOW_OUT_OF_FLOW);
bool isPopup = aItem.mIsPopup;
@ -3900,7 +3901,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
if ((bits & FCDATA_MAY_NEED_SCROLLFRAME) &&
display->IsScrollableOverflow()) {
nsContainerFrame* scrollframe = nullptr;
BuildScrollFrame(aState, content, styleContext, newFrame,
BuildScrollFrame(aState, content, computedStyle, newFrame,
geometricParent, scrollframe);
frameToAddToList = scrollframe;
} else {
@ -3923,7 +3924,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
if (bits & FCDATA_CREATE_BLOCK_WRAPPER_FOR_ALL_KIDS) {
RefPtr<ComputedStyle> outerSC = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(*data->mAnonBoxPseudo,
styleContext);
computedStyle);
#ifdef DEBUG
nsContainerFrame* containerFrame = do_QueryFrame(newFrame);
MOZ_ASSERT(containerFrame);
@ -4059,7 +4060,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
childItems);
} else {
// Process the child frames.
ProcessChildren(aState, content, styleContext, newFrameAsContainer,
ProcessChildren(aState, content, computedStyle, newFrameAsContainer,
!(bits & FCDATA_DISALLOW_GENERATED_CONTENT),
childItems,
(bits & FCDATA_ALLOW_BLOCK_STYLES) != 0,
@ -4910,18 +4911,18 @@ nsCSSFrameConstructor::ConstructScrollableBlockWithConstructor(
BlockFrameCreationFunc aConstructor)
{
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
nsContainerFrame* newFrame = nullptr;
RefPtr<ComputedStyle> scrolledContentStyle
= BeginBuildingScrollFrame(aState, content, styleContext,
= BeginBuildingScrollFrame(aState, content, computedStyle,
aState.GetGeometricParent(aDisplay, aParentFrame),
nsCSSAnonBoxes::scrolledContent,
false, newFrame);
// Create our block frame
// pass a temporary stylecontext, the correct one will be set later
nsContainerFrame* scrolledFrame = aConstructor(mPresShell, styleContext);
nsContainerFrame* scrolledFrame = aConstructor(mPresShell, computedStyle);
// Make sure to AddChild before we call ConstructBlock so that we
// end up before our descendants in fixed-pos lists as needed.
@ -4961,7 +4962,7 @@ nsCSSFrameConstructor::ConstructNonScrollableBlockWithConstructor(
nsFrameItems& aFrameItems,
BlockFrameCreationFunc aConstructor)
{
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
// We want a block formatting context root in paginated contexts for
// every block that would be scrollable in a non-paginated context.
@ -4981,11 +4982,11 @@ nsCSSFrameConstructor::ConstructNonScrollableBlockWithConstructor(
}
}
nsContainerFrame* newFrame = aConstructor(mPresShell, styleContext);
nsContainerFrame* newFrame = aConstructor(mPresShell, computedStyle);
newFrame->AddStateBits(flags);
ConstructBlock(aState, aItem.mContent,
aState.GetGeometricParent(aDisplay, aParentFrame),
aParentFrame, styleContext, &newFrame,
aParentFrame, computedStyle, &newFrame,
aFrameItems,
aDisplay->IsAbsPosContainingBlock(newFrame) ? newFrame : nullptr,
aItem.mPendingBinding);
@ -5181,14 +5182,14 @@ nsCSSFrameConstructor::ConstructFrameWithAnonymousChild(
bool aCandidateRootFrame)
{
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
// Create the outer frame:
nsContainerFrame* newFrame = aConstructor(mPresShell, styleContext);
nsContainerFrame* newFrame = aConstructor(mPresShell, computedStyle);
InitAndRestoreFrame(aState, content,
aCandidateRootFrame ?
aState.GetGeometricParent(styleContext->StyleDisplay(),
aState.GetGeometricParent(computedStyle->StyleDisplay(),
aParentFrame) :
aParentFrame,
newFrame);
@ -5197,7 +5198,7 @@ nsCSSFrameConstructor::ConstructFrameWithAnonymousChild(
// Create the pseudo SC for the anonymous wrapper child as a child of the SC:
RefPtr<ComputedStyle> scForAnon;
scForAnon = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(aInnerPseudo, styleContext);
ResolveInheritingAnonymousBoxStyle(aInnerPseudo, computedStyle);
// Create the anonymous inner wrapper frame
nsContainerFrame* innerFrame = aInnerConstructor(mPresShell, scForAnon);
@ -5229,7 +5230,7 @@ nsCSSFrameConstructor::ConstructFrameWithAnonymousChild(
aItem.mFCData->mBits & FCDATA_IS_WRAPPER_ANON_BOX,
childItems);
} else {
ProcessChildren(aState, content, styleContext, innerFrame,
ProcessChildren(aState, content, computedStyle, innerFrame,
true, childItems, false, aItem.mPendingBinding);
}
@ -5637,8 +5638,8 @@ nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState
if (!ShouldCreateItemsForChild(aState, aContent, parentFrame)) {
return;
}
RefPtr<ComputedStyle> styleContext = ResolveComputedStyle(aContent);
DoAddFrameConstructionItems(aState, aContent, styleContext,
RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(aContent);
DoAddFrameConstructionItems(aState, aContent, computedStyle,
aSuppressWhiteSpaceOptimizations, parentFrame,
nullptr, aItems);
}
@ -5689,7 +5690,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.)
// can then be extended arbitrarily.
const nsStyleDisplay* display = aComputedStyle->StyleDisplay();
RefPtr<ComputedStyle> styleContext(aComputedStyle);
RefPtr<ComputedStyle> computedStyle(aComputedStyle);
PendingBinding* pendingBinding = nullptr;
if (aFlags & ITEM_ALLOW_XBL_BASE) {
if (display->mBinding) {
@ -5717,12 +5718,12 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
}
if (resolveStyle) {
styleContext =
computedStyle =
mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aContent->AsElement());
}
display = styleContext->StyleDisplay();
aComputedStyle = styleContext;
display = computedStyle->StyleDisplay();
aComputedStyle = computedStyle;
aTag = mDocument->BindingManager()->ResolveTag(aContent, &aNameSpaceID);
}
}
@ -5732,7 +5733,8 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// Pre-check for display "none" - if we find that, don't create
// any frame at all
if (StyleDisplay::None == display->mDisplay) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext, isGeneratedContent);
SetAsUndisplayedContent(aState, aItems, aContent, computedStyle,
isGeneratedContent);
return;
}
@ -5754,7 +5756,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
!aContent->IsRootOfNativeAnonymousSubtree()) {
// No frame for aContent
if (!isText) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext,
SetAsUndisplayedContent(aState, aItems, aContent, computedStyle,
isGeneratedContent);
}
return;
@ -5773,7 +5775,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
aContent->IsGeneratedContentContainerForAfter())) {
auto* summary = HTMLSummaryElement::FromNodeOrNull(aContent);
if (!summary || !summary->IsMainSummary()) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext,
SetAsUndisplayedContent(aState, aItems, aContent, computedStyle,
isGeneratedContent);
return;
}
@ -5798,41 +5800,41 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
IsFrameForSVG(aParentFrame) &&
!aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)) ||
(aFlags & ITEM_IS_WITHIN_SVG_TEXT))) {
SetAsUndisplayedContent(aState, aItems, element, styleContext,
SetAsUndisplayedContent(aState, aItems, element, computedStyle,
isGeneratedContent);
return;
}
data = FindHTMLData(element, aTag, aNameSpaceID, aParentFrame,
styleContext);
computedStyle);
if (!data) {
data = FindXULTagData(element, aTag, aNameSpaceID, styleContext);
data = FindXULTagData(element, aTag, aNameSpaceID, computedStyle);
}
if (!data) {
data = FindMathMLData(element, aTag, aNameSpaceID, styleContext);
data = FindMathMLData(element, aTag, aNameSpaceID, computedStyle);
foundMathMLData = !!data;
}
if (!data) {
data = FindSVGData(element, aTag, aNameSpaceID, aParentFrame,
aFlags & ITEM_IS_WITHIN_SVG_TEXT,
aFlags & ITEM_ALLOWS_TEXT_PATH_CHILD,
styleContext);
computedStyle);
}
// Now check for XUL display types
if (!data) {
data = FindXULDisplayData(display, element, styleContext);
data = FindXULDisplayData(display, element, computedStyle);
}
// And general display types
if (!data) {
data = FindDisplayData(display, element, styleContext);
data = FindDisplayData(display, element, computedStyle);
}
NS_ASSERTION(data, "Should have frame construction data now");
if (data->mBits & FCDATA_SUPPRESS_FRAME) {
SetAsUndisplayedContent(aState, aItems, element, styleContext, isGeneratedContent);
SetAsUndisplayedContent(aState, aItems, element, computedStyle, isGeneratedContent);
return;
}
@ -5842,7 +5844,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
!aParentFrame->IsMenuFrame())) {
if (!aState.mPopupItems.containingBlock &&
!aState.mHavePendingPopupgroup) {
SetAsUndisplayedContent(aState, aItems, element, styleContext,
SetAsUndisplayedContent(aState, aItems, element, computedStyle,
isGeneratedContent);
return;
}
@ -5858,7 +5860,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
if (aParentFrame && aParentFrame->IsTableColGroupFrame() &&
(!(bits & FCDATA_IS_TABLE_PART) ||
display->mDisplay != StyleDisplay::TableColumn)) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext, isGeneratedContent);
SetAsUndisplayedContent(aState, aItems, aContent, computedStyle, isGeneratedContent);
return;
}
@ -5878,20 +5880,20 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
if (display->mDisplay == StyleDisplay::Contents &&
!foundMathMLData) {
if (!GetDisplayContentsStyleFor(aContent)) {
MOZ_ASSERT(styleContext->GetPseudo() || !isGeneratedContent,
MOZ_ASSERT(computedStyle->GetPseudo() || !isGeneratedContent,
"Should have had pseudo type");
aState.mFrameManager->RegisterDisplayContentsStyleFor(aContent,
styleContext);
computedStyle);
} else {
aState.mFrameManager->ChangeRegisteredDisplayContentsStyleFor(aContent,
styleContext);
computedStyle);
}
if (aParentFrame) {
aParentFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT);
}
CreateGeneratedContentItem(aState, aParentFrame, aContent->AsElement(),
styleContext, CSSPseudoElementType::before,
computedStyle, CSSPseudoElementType::before,
aItems);
FlattenedChildIterator iter(aContent);
@ -5908,7 +5910,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
aItems.SetParentHasNoXBLChildren(!iter.XBLInvolved());
CreateGeneratedContentItem(aState, aParentFrame, aContent->AsElement(),
styleContext, CSSPseudoElementType::after,
computedStyle, CSSPseudoElementType::after,
aItems);
if (canHavePageBreak && display->mBreakAfter) {
AddPageBreakItem(aContent, aItems);
@ -5923,14 +5925,14 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// If details is open, the main summary needs to be rendered as if it is
// the first child, so add the item to the front of the item list.
item = aItems.PrependItem(this, data, aContent, aTag, aNameSpaceID,
pendingBinding, styleContext.forget(),
pendingBinding, computedStyle.forget(),
aSuppressWhiteSpaceOptimizations, aAnonChildren);
}
}
if (!item) {
item = aItems.AppendItem(this, data, aContent, aTag, aNameSpaceID,
pendingBinding, styleContext.forget(),
pendingBinding, computedStyle.forget(),
aSuppressWhiteSpaceOptimizations, aAnonChildren);
}
item->mIsText = isText;
@ -6081,8 +6083,8 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState,
{
nsContainerFrame* adjParentFrame = aParentFrame;
FrameConstructionItem& item = aIter.item();
ComputedStyle* styleContext = item.mComputedStyle;
AdjustParentFrame(&adjParentFrame, item.mFCData, styleContext);
ComputedStyle* computedStyle = item.mComputedStyle;
AdjustParentFrame(&adjParentFrame, item.mFCData, computedStyle);
if (item.mIsText) {
// If this is collapsible whitespace next to a line boundary,
@ -6100,7 +6102,7 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState,
// We don't do it for SVG text, since we might need to position and
// measure the white space glyphs due to x/y/dx/dy attributes.
if (AtLineBoundary(aIter) &&
!styleContext->StyleText()->WhiteSpaceOrNewlineIsSignificant() &&
!computedStyle->StyleText()->WhiteSpaceOrNewlineIsSignificant() &&
aIter.List()->ParentHasNoXBLChildren() &&
!(aState.mAdditionalStateBits & NS_FRAME_GENERATED_CONTENT) &&
(item.mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) &&
@ -6110,14 +6112,14 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState,
return;
ConstructTextFrame(item.mFCData, aState, item.mContent,
adjParentFrame, styleContext,
adjParentFrame, computedStyle,
aFrameItems);
return;
}
// Start background loads during frame construction so that we're
// guaranteed that they will be started before onload fires.
styleContext->StartBackgroundImageLoads();
computedStyle->StartBackgroundImageLoads();
nsFrameState savedStateBits = aState.mAdditionalStateBits;
if (item.mIsGeneratedContent) {
@ -6451,8 +6453,8 @@ nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling,
return false;
}
// FIXME(emilio): This is buggy some times, see bug 1424656.
RefPtr<ComputedStyle> styleContext = ResolveComputedStyle(aContent);
const nsStyleDisplay* display = styleContext->StyleDisplay();
RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(aContent);
const nsStyleDisplay* display = computedStyle->StyleDisplay();
aDisplay = display->mDisplay;
}
if (LayoutFrameType::Menu == parentType) {
@ -8618,7 +8620,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
bool aIsFluid)
{
nsIPresShell* shell = aPresContext->PresShell();
ComputedStyle* styleContext = aFrame->Style();
ComputedStyle* computedStyle = aFrame->Style();
nsIFrame* newFrame = nullptr;
nsIFrame* nextContinuation = aFrame->GetNextContinuation();
nsIFrame* nextInFlow = aFrame->GetNextInFlow();
@ -8631,25 +8633,25 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
"why CreateContinuingFrame for a non-splittable frame?");
if (LayoutFrameType::Text == frameType) {
newFrame = NS_NewContinuingTextFrame(shell, styleContext);
newFrame = NS_NewContinuingTextFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Inline == frameType) {
newFrame = NS_NewInlineFrame(shell, styleContext);
newFrame = NS_NewInlineFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Block == frameType) {
MOZ_ASSERT(!aFrame->IsTableCaption(),
"no support for fragmenting table captions yet");
newFrame = NS_NewBlockFrame(shell, styleContext);
newFrame = NS_NewBlockFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
#ifdef MOZ_XUL
} else if (LayoutFrameType::XULLabel == frameType) {
newFrame = NS_NewXULLabelFrame(shell, styleContext);
newFrame = NS_NewXULLabelFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
#endif
} else if (LayoutFrameType::ColumnSet == frameType) {
MOZ_ASSERT(!aFrame->IsTableCaption(),
"no support for fragmenting table captions yet");
newFrame = NS_NewColumnSetFrame(shell, styleContext, nsFrameState(0));
newFrame = NS_NewColumnSetFrame(shell, computedStyle, nsFrameState(0));
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Page == frameType) {
nsContainerFrame* canvasFrame;
@ -8657,21 +8659,21 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
} else if (LayoutFrameType::TableWrapper == frameType) {
newFrame =
CreateContinuingOuterTableFrame(shell, aPresContext, aFrame, aParentFrame,
content, styleContext);
content, computedStyle);
} else if (LayoutFrameType::Table == frameType) {
newFrame =
CreateContinuingTableFrame(shell, aFrame, aParentFrame,
content, styleContext);
content, computedStyle);
} else if (LayoutFrameType::TableRowGroup == frameType) {
newFrame = NS_NewTableRowGroupFrame(shell, styleContext);
newFrame = NS_NewTableRowGroupFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
if (newFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
nsTableFrame::RegisterPositionedTablePart(newFrame);
}
} else if (LayoutFrameType::TableRow == frameType) {
nsTableRowFrame* rowFrame = NS_NewTableRowFrame(shell, styleContext);
nsTableRowFrame* rowFrame = NS_NewTableRowFrame(shell, computedStyle);
rowFrame->Init(content, aParentFrame, aFrame);
if (rowFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
@ -8701,7 +8703,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
nsTableFrame* tableFrame =
static_cast<nsTableRowFrame*>(aParentFrame)->GetTableFrame();
nsTableCellFrame* cellFrame =
NS_NewTableCellFrame(shell, styleContext, tableFrame);
NS_NewTableCellFrame(shell, computedStyle, tableFrame);
cellFrame->Init(content, aParentFrame, aFrame);
if (cellFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
@ -8717,16 +8719,16 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
SetInitialSingleChild(cellFrame, continuingBlockFrame);
newFrame = cellFrame;
} else if (LayoutFrameType::Line == frameType) {
newFrame = NS_NewFirstLineFrame(shell, styleContext);
newFrame = NS_NewFirstLineFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Letter == frameType) {
newFrame = NS_NewFirstLetterFrame(shell, styleContext);
newFrame = NS_NewFirstLetterFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Image == frameType) {
newFrame = NS_NewImageFrame(shell, styleContext);
newFrame = NS_NewImageFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::ImageControl == frameType) {
newFrame = NS_NewImageControlFrame(shell, styleContext);
newFrame = NS_NewImageControlFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Placeholder == frameType) {
// create a continuing out of flow frame
@ -8738,7 +8740,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
aParentFrame, aFrame,
aFrame->GetStateBits() & PLACEHOLDER_TYPE_MASK);
} else if (LayoutFrameType::FieldSet == frameType) {
nsContainerFrame* fieldset = NS_NewFieldSetFrame(shell, styleContext);
nsContainerFrame* fieldset = NS_NewFieldSetFrame(shell, computedStyle);
fieldset->Init(content, aParentFrame, aFrame);
@ -8756,25 +8758,25 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
}
newFrame = fieldset;
} else if (LayoutFrameType::Legend == frameType) {
newFrame = NS_NewLegendFrame(shell, styleContext);
newFrame = NS_NewLegendFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::FlexContainer == frameType) {
newFrame = NS_NewFlexContainerFrame(shell, styleContext);
newFrame = NS_NewFlexContainerFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::GridContainer == frameType) {
newFrame = NS_NewGridContainerFrame(shell, styleContext);
newFrame = NS_NewGridContainerFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Ruby == frameType) {
newFrame = NS_NewRubyFrame(shell, styleContext);
newFrame = NS_NewRubyFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::RubyBaseContainer == frameType) {
newFrame = NS_NewRubyBaseContainerFrame(shell, styleContext);
newFrame = NS_NewRubyBaseContainerFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::RubyTextContainer == frameType) {
newFrame = NS_NewRubyTextContainerFrame(shell, styleContext);
newFrame = NS_NewRubyTextContainerFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else if (LayoutFrameType::Details == frameType) {
newFrame = NS_NewDetailsFrame(shell, styleContext);
newFrame = NS_NewDetailsFrame(shell, computedStyle);
newFrame->Init(content, aParentFrame, aFrame);
} else {
MOZ_CRASH("unexpected frame type");
@ -8866,14 +8868,14 @@ nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
// We want to use the same style as the primary style frame for
// our content
nsIContent* content = fixed->GetContent();
ComputedStyle* styleContext =
ComputedStyle* computedStyle =
nsLayoutUtils::GetStyleFrame(content)->Style();
AutoFrameConstructionItemList items(this);
AddFrameConstructionItemsInternal(state, content, canvasFrame,
content->NodeInfo()->NameAtom(),
content->GetNameSpaceID(),
true,
styleContext,
computedStyle,
ITEM_ALLOW_XBL_BASE |
ITEM_ALLOW_PAGE_BREAK,
nullptr, items);
@ -10312,7 +10314,7 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
MOZ_ASSERT(!content->IsStyledByServo() || !content->IsElement() ||
content->AsElement()->HasServoData());
RefPtr<ComputedStyle> styleContext = ResolveComputedStyle(content);
RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(content);
nsTArray<nsIAnonymousContentCreator::ContentInfo>* anonChildren = nullptr;
if (!aAnonymousItems[i].mChildren.IsEmpty()) {
@ -10325,7 +10327,7 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
AddFrameConstructionItemsInternal(aState, content, aFrame,
content->NodeInfo()->NameAtom(),
content->GetNameSpaceID(),
true, styleContext, flags,
true, computedStyle, flags,
anonChildren, aItemsToConstruct);
}
}
@ -10413,15 +10415,15 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
// Note that we don't use this style for looking up things like special
// block styles because in some cases involving table pseudo-frames it has
// nothing to do with the parent frame's desired behavior.
ComputedStyle* styleContext;
ComputedStyle* computedStyle;
if (aCanHaveGeneratedContent) {
aFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT);
styleContext =
computedStyle =
nsFrame::CorrectStyleParentFrame(aFrame, nullptr)->Style();
// Probe for generated content before
CreateGeneratedContentItem(aState, aFrame, aContent->AsElement(),
styleContext, CSSPseudoElementType::before,
computedStyle, CSSPseudoElementType::before,
itemsToConstruct);
}
@ -10465,7 +10467,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
if (aCanHaveGeneratedContent) {
// Probe for generated content after
CreateGeneratedContentItem(aState, aFrame, aContent->AsElement(),
styleContext, CSSPseudoElementType::after,
computedStyle, CSSPseudoElementType::after,
itemsToConstruct);
}
} else {
@ -10875,10 +10877,10 @@ nsCSSFrameConstructor::CreateLetterFrame(nsContainerFrame* aBlockFrame,
sc =
mPresShell->StyleSet()->AsServo()->ReparentComputedStyle(
sc->AsServo(),
parentComputedStyle->AsServo(),
parentIgnoringFirstLine->Style()->AsServo(),
parentComputedStyle->AsServo(),
sc,
parentComputedStyle,
parentIgnoringFirstLine->Style(),
parentComputedStyle,
blockContent->AsElement());
}
@ -11290,11 +11292,11 @@ nsCSSFrameConstructor::CreateListBoxContent(nsContainerFrame* aParentFrame,
GetFloatContainingBlock(aParentFrame),
do_AddRef(mTempFrameTreeState));
RefPtr<ComputedStyle> styleContext = ResolveComputedStyle(aChild);
RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(aChild);
// Pre-check for display "none" - only if we find that, do we create
// any frame at all
const nsStyleDisplay* display = styleContext->StyleDisplay();
const nsStyleDisplay* display = computedStyle->StyleDisplay();
if (StyleDisplay::None == display->mDisplay) {
*aNewFrame = nullptr;
@ -11305,7 +11307,7 @@ nsCSSFrameConstructor::CreateListBoxContent(nsContainerFrame* aParentFrame,
AddFrameConstructionItemsInternal(state, aChild, aParentFrame,
aChild->NodeInfo()->NameAtom(),
aChild->GetNameSpaceID(),
true, styleContext,
true, computedStyle,
ITEM_ALLOW_XBL_BASE, nullptr, items);
ConstructFramesFromItemList(state, items, aParentFrame,
/* aParentIsWrapperAnonBox = */ false,
@ -11476,14 +11478,14 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
// Text("f")
nsIContent* const content = aItem.mContent;
ComputedStyle* const styleContext = aItem.mComputedStyle;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
bool positioned =
StyleDisplay::Inline == aDisplay->mDisplay &&
aDisplay->IsRelativelyPositionedStyle() &&
!nsSVGUtils::IsInSVGTextSubtree(aParentFrame);
nsInlineFrame* newFrame = NS_NewInlineFrame(mPresShell, styleContext);
nsInlineFrame* newFrame = NS_NewInlineFrame(mPresShell, computedStyle);
// Initialize the frame
InitAndRestoreFrame(aState, content, aParentFrame, newFrame);
@ -11548,7 +11550,7 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
nsFrameItems& aSiblings)
{
nsIContent* content = aInitialInline->GetContent();
ComputedStyle* styleContext = aInitialInline->Style();
ComputedStyle* computedStyle = aInitialInline->Style();
nsContainerFrame* parentFrame = aInitialInline->GetParent();
// Resolve the right style for our anonymous blocks.
@ -11561,7 +11563,7 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
// in the inline box.
RefPtr<ComputedStyle> blockSC = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozBlockInsideInlineWrapper,
styleContext);
computedStyle);
nsContainerFrame* lastNewInline =
static_cast<nsContainerFrame*>(aInitialInline->FirstContinuation());
@ -11591,7 +11593,7 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
// Now grab the initial inlines in aChildItems and put them into an inline
// frame.
nsInlineFrame* inlineFrame = NS_NewInlineFrame(mPresShell, styleContext);
nsInlineFrame* inlineFrame = NS_NewInlineFrame(mPresShell, computedStyle);
InitAndRestoreFrame(aState, content, parentFrame, inlineFrame, false);
inlineFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT |
NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);

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

@ -115,7 +115,6 @@
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/Telemetry.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
@ -4684,9 +4683,9 @@ nsLayoutUtils::ComputeObjectDestRect(const nsRect& aConstraintRect,
already_AddRefed<nsFontMetrics>
nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame, float aInflation)
{
ComputedStyle* styleContext = aFrame->Style();
ComputedStyle* computedStyle = aFrame->Style();
uint8_t variantWidth = NS_FONT_VARIANT_WIDTH_NORMAL;
if (styleContext->IsTextCombined()) {
if (computedStyle->IsTextCombined()) {
MOZ_ASSERT(aFrame->IsTextFrame());
auto textFrame = static_cast<const nsTextFrame*>(aFrame);
auto clusters = textFrame->CountGraphemeClusters();
@ -4698,7 +4697,7 @@ nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame, float aInflation)
variantWidth = NS_FONT_VARIANT_WIDTH_QUARTER;
}
}
return GetFontMetricsForComputedStyle(styleContext, aInflation, variantWidth);
return GetFontMetricsForComputedStyle(computedStyle, aInflation, variantWidth);
}
already_AddRefed<nsFontMetrics>

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

@ -2220,15 +2220,15 @@ nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame,
return false;
}
ComputedStyle* styleContext = aFrame->Style();
CSSPseudoElementType pseudoType = styleContext->GetPseudoType();
ComputedStyle* computedStyle = aFrame->Style();
CSSPseudoElementType pseudoType = computedStyle->GetPseudoType();
// Anonymous boxes are more complicated, and we just assume that they
// cannot have any author-specified rules here.
if (pseudoType == CSSPseudoElementType::InheritingAnonBox ||
pseudoType == CSSPseudoElementType::NonInheritingAnonBox) {
return false;
}
return Servo_HasAuthorSpecifiedRules(styleContext->AsServo(),
return Servo_HasAuthorSpecifiedRules(computedStyle->AsServo(),
elem, pseudoType,
aRuleTypeMask,
UseDocumentColors());

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

@ -1386,9 +1386,9 @@ nsComboboxControlFrame::CreateFrameForDisplayNode()
nsIPresShell *shell = PresShell();
StyleSetHandle styleSet = shell->StyleSet();
// create the style contexts for the anonymous block frame and text frame
RefPtr<ComputedStyle> styleContext;
styleContext = styleSet->
// create the ComputedStyle for the anonymous block frame and text frame
RefPtr<ComputedStyle> computedStyle;
computedStyle = styleSet->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
mComputedStyle);
@ -1397,7 +1397,7 @@ nsComboboxControlFrame::CreateFrameForDisplayNode()
styleSet->ResolveStyleForText(mDisplayContent, mComputedStyle);
// Start by creating our anonymous block frame
mDisplayFrame = new (shell) nsComboboxDisplayFrame(styleContext, this);
mDisplayFrame = new (shell) nsComboboxDisplayFrame(computedStyle, this);
mDisplayFrame->Init(mContent, this, nullptr);
// Create a text frame and put it inside the block frame

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

@ -220,10 +220,10 @@ nsDisplayRangeFocusRing::GetBounds(nsDisplayListBuilder* aBuilder,
// We want to paint as if specifying a border for ::-moz-focus-outer
// specifies an outline for our frame, so inflate by the border widths:
ComputedStyle* styleContext =
ComputedStyle* computedStyle =
static_cast<nsRangeFrame*>(mFrame)->mOuterFocusStyle;
MOZ_ASSERT(styleContext, "We only exist if mOuterFocusStyle is non-null");
rect.Inflate(styleContext->StyleBorder()->GetComputedBorder());
MOZ_ASSERT(computedStyle, "We only exist if mOuterFocusStyle is non-null");
rect.Inflate(computedStyle->StyleBorder()->GetComputedBorder());
return rect;
}
@ -233,9 +233,9 @@ nsDisplayRangeFocusRing::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx)
{
bool unused;
ComputedStyle* styleContext =
ComputedStyle* computedStyle =
static_cast<nsRangeFrame*>(mFrame)->mOuterFocusStyle;
MOZ_ASSERT(styleContext, "We only exist if mOuterFocusStyle is non-null");
MOZ_ASSERT(computedStyle, "We only exist if mOuterFocusStyle is non-null");
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
@ -244,7 +244,7 @@ nsDisplayRangeFocusRing::Paint(nsDisplayListBuilder* aBuilder,
ImgDrawResult result =
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect, GetBounds(aBuilder, &unused),
styleContext, flags);
computedStyle, flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}

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

@ -104,7 +104,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/css/ImageLoader.h"
#include "mozilla/gfx/Tools.h"
@ -10721,8 +10720,7 @@ nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
// Anon boxes inherit from their parent; that's us.
RefPtr<ComputedStyle> newContext =
aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(pseudo,
Style()->AsServo());
aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(pseudo, Style());
nsChangeHint childHint =
UpdateStyleOfOwnedChildFrame(aChildFrame, newContext, aRestyleState);

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

@ -957,7 +957,7 @@ nsInlineFrame::UpdateStyleOfOwnedAnonBoxesForIBSplit(
MOZ_ASSERT(blockFrame, "Why did we have an IB split?");
// The later inlines need to get our style.
ComputedStyle* ourStyle = Style()->AsServo();
ComputedStyle* ourStyle = Style();
// The anonymous block's style inherits from ours, and we already have our new
// style context.

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

@ -5575,16 +5575,16 @@ nsTextFrame::UpdateTextEmphasis(WritingMode aWM, PropertyProvider& aProvider)
return nsRect();
}
ComputedStyle* styleContext = Style();
bool isTextCombined = styleContext->IsTextCombined();
ComputedStyle* computedStyle = Style();
bool isTextCombined = computedStyle->IsTextCombined();
if (isTextCombined) {
styleContext = GetParent()->Style();
computedStyle = GetParent()->Style();
}
RefPtr<nsFontMetrics> fm = nsLayoutUtils::
GetFontMetricsOfEmphasisMarks(styleContext, GetFontSizeInflation());
GetFontMetricsOfEmphasisMarks(computedStyle, GetFontSizeInflation());
EmphasisMarkInfo* info = new EmphasisMarkInfo;
info->textRun =
GenerateTextRunForEmphasisMarks(this, fm, styleContext, styleText);
GenerateTextRunForEmphasisMarks(this, fm, computedStyle, styleText);
info->advance = info->textRun->GetAdvanceWidth();
// Calculate the baseline offset

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

@ -168,9 +168,9 @@ InspectorUtils::GetCSSStyleRules(GlobalObject& aGlobalObject,
pseudoElt = NS_Atomize(aPseudo);
}
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
GetCleanComputedStyleForElement(&aElement, pseudoElt);
if (!styleContext) {
if (!computedStyle) {
// This can fail for elements that are not in the document or
// if the document they're in doesn't have a presshell. Bail out.
return;
@ -183,7 +183,7 @@ InspectorUtils::GetCSSStyleRules(GlobalObject& aGlobalObject,
return;
}
ComputedStyle* servo = styleContext->AsServo();
ComputedStyle* servo = computedStyle->AsServo();
nsTArray<const RawServoStyleRule*> rawRuleList;
Servo_ComputedValues_GetStyleRuleList(servo, &rawRuleList);
@ -397,12 +397,7 @@ InspectorUtils::GetCSSPropertyNames(GlobalObject& aGlobalObject,
}
for ( ; prop < eCSSProperty_COUNT; ++prop) {
// Some shorthands are also aliases
if (aOptions.mIncludeAliases ||
!nsCSSProps::PropHasFlags(nsCSSPropertyID(prop),
CSS_PROPERTY_IS_ALIAS)) {
DO_PROP(prop);
}
DO_PROP(prop);
}
if (aOptions.mIncludeAliases) {
@ -967,9 +962,7 @@ InspectorUtils::GetCleanComputedStyleForElement(dom::Element* aElement,
presContext->EnsureSafeToHandOutCSSRules();
RefPtr<ComputedStyle> styleContext =
nsComputedDOMStyle::GetComputedStyle(aElement, aPseudo);
return styleContext.forget();
return nsComputedDOMStyle::GetComputedStyle(aElement, aPseudo);
}
/* static */ void

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

@ -1945,7 +1945,7 @@ void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
// for visual debug
Sides skipSides;
nsPresContext* presContext = mFrame->PresContext();
ComputedStyle* styleContext = mFrame->Style();
ComputedStyle* computedStyle = mFrame->Style();
nsRect rect = mRect + ToReferenceFrame();
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
@ -1956,10 +1956,10 @@ void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
// tracking the ImgDrawResult.
Unused <<
nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame, mVisibleRect,
rect, styleContext, flags, skipSides);
rect, computedStyle, flags, skipSides);
nsCSSRendering::PaintOutline(presContext, *aCtx, mFrame,
mVisibleRect, rect, styleContext);
mVisibleRect, rect, computedStyle);
}
#endif
@ -1971,19 +1971,20 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
uint32_t aIndex,
const nsRect* aSelectedRect)
{
ComputedStyle* parentContext = aForFrame->Style();
ComputedStyle* styleContext = mComputedStyle;
bool usingParentStyle = false;
ComputedStyle* computedStyle = mComputedStyle;
if (mDraw == DRAW_NORMAL) {
// normal drawing if there is nothing special about this char
// Set default context to the parent context
styleContext = parentContext;
// Use our parent element's style
usingParentStyle = true;
computedStyle = aForFrame->Style();
}
if (!styleContext->StyleVisibility()->IsVisible())
if (!computedStyle->StyleVisibility()->IsVisible())
return;
// if the leaf style context that we use for stretchy chars has a background
// if the leaf computed style that we use for stretchy chars has a background
// color we use it -- this feature is mostly used for testing and debugging
// purposes. Normally, users will set the background on the container frame.
// paint the selection background -- beware MathML frames overlap a lot
@ -1992,12 +1993,12 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
MakeDisplayItem<nsDisplayMathMLSelectionRect>(aBuilder, aForFrame, *aSelectedRect));
}
else if (mRect.width && mRect.height) {
if (styleContext != parentContext &&
NS_GET_A(styleContext->StyleBackground()->
BackgroundColor(styleContext)) > 0) {
if (!usingParentStyle &&
NS_GET_A(computedStyle->StyleBackground()->
BackgroundColor(computedStyle)) > 0) {
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, aForFrame, mRect, aLists.BorderBackground(),
/* aAllowWillPaintBorderOptimization */ true, styleContext);
/* aAllowWillPaintBorderOptimization */ true, computedStyle);
}
//else
// our container frame will take care of painting its background
@ -2049,18 +2050,17 @@ nsMathMLChar::PaintForeground(nsIFrame* aForFrame,
nsPoint aPt,
bool aIsSelected)
{
ComputedStyle* parentContext = aForFrame->Style();
ComputedStyle* styleContext = mComputedStyle;
ComputedStyle* computedStyle = mComputedStyle;
nsPresContext* presContext = aForFrame->PresContext();
if (mDraw == DRAW_NORMAL) {
// normal drawing if there is nothing special about this char
// Set default context to the parent context
styleContext = parentContext;
// Use our parent element's style
computedStyle = aForFrame->Style();
}
// Set color ...
nscolor fgColor = styleContext->
nscolor fgColor = computedStyle->
GetVisitedDependentColor(&nsStyleText::mWebkitTextFillColor);
if (aIsSelected) {
// get color to use for selection from the look&feel object

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

@ -448,7 +448,7 @@ ExtractSpacingValues(const nsAString& aString,
float aFontSizeInflation)
{
nsPresContext* presContext = aFrame->PresContext();
ComputedStyle* styleContext = aFrame->Style();
ComputedStyle* computedStyle = aFrame->Style();
const char16_t* start = aString.BeginReading();
const char16_t* end = aString.EndReading();
@ -483,7 +483,7 @@ ExtractSpacingValues(const nsAString& aString,
}
nsMathMLFrame::ParseNumericValue(valueString, &newValue,
nsMathMLElement::PARSE_ALLOW_UNITLESS,
presContext, styleContext,
presContext, computedStyle,
aFontSizeInflation);
aSpacingArray.AppendElement(newValue);

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

@ -11,7 +11,6 @@
#include "mozilla/gfx/Matrix.h"
#include "mozilla/EffectSet.h"
#include "mozilla/PodOperations.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "gfx2DGlue.h"
#include "nsExpirationTracker.h"
#include "nsContainerFrame.h"

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

@ -81,7 +81,6 @@
#include "nsCaret.h"
#include "nsISelection.h"
#include "nsDOMTokenList.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "nsCSSProps.h"
#include "nsSVGMaskFrame.h"
#include "nsTableCellFrame.h"

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

@ -1,28 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* an object that stores the result of determining whether a style struct that
* was computed can be cached in the rule tree, and if so, what the conditions
* it relies on are
*/
#ifndef RuleNodeCacheConditions_h_
#define RuleNodeCacheConditions_h_
namespace mozilla {
// Define this dummy class so there are fewer call sites to change when the old
// style system code is compiled out.
class RuleNodeCacheConditions
{
};
} // namespace mozilla
#endif // !defined(RuleNodeCacheConditions_h_)

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

@ -10,7 +10,6 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
@ -230,9 +229,9 @@ AnimationValue::FromString(nsCSSPropertyID aProperty,
// GetComputedStyle() flushes style, so we shouldn't assume that any
// non-owning references we have are still valid.
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyle(aElement, nullptr);
MOZ_ASSERT(styleContext);
MOZ_ASSERT(computedStyle);
RefPtr<RawServoDeclarationBlock> declarations =
ServoCSSParser::ParseProperty(aProperty, aValue,
@ -245,7 +244,7 @@ AnimationValue::FromString(nsCSSPropertyID aProperty,
result.mServo =
shell->StyleSet()->AsServo()->ComputeAnimationValue(aElement,
declarations,
styleContext);
computedStyle);
return result;
}

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

@ -16,10 +16,6 @@
#define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
return AsServo()->method_ servoargs_;
#define FORWARD_WITH_PARENT(method_, parent_, args_) \
auto* parent = parent_ ? parent_->AsServo() : nullptr; \
return AsServo()->method_ args_;
#define FORWARD(method_, args_) FORWARD_CONCRETE(method_, args_, args_)
@ -81,17 +77,17 @@ StyleSetHandle::Ptr::EndUpdate()
// resolve a style context
already_AddRefed<ComputedStyle>
StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement,
ComputedStyle* aParentContext,
ComputedStyle* aParentStyle,
LazyComputeBehavior aMayCompute)
{
FORWARD_WITH_PARENT(ResolveStyleFor, aParentContext, (aElement, parent, aMayCompute));
FORWARD(ResolveStyleFor, (aElement, aParentStyle, aMayCompute));
}
already_AddRefed<ComputedStyle>
StyleSetHandle::Ptr::ResolveStyleForText(nsIContent* aTextNode,
ComputedStyle* aParentContext)
ComputedStyle* aParentStyle)
{
FORWARD_WITH_PARENT(ResolveStyleForText, aParentContext, (aTextNode, parent));
FORWARD(ResolveStyleForText, (aTextNode, aParentStyle));
}
already_AddRefed<ComputedStyle>
@ -101,25 +97,25 @@ StyleSetHandle::Ptr::ResolveStyleForPlaceholder()
}
already_AddRefed<ComputedStyle>
StyleSetHandle::Ptr::ResolveStyleForFirstLetterContinuation(ComputedStyle* aParentContext)
StyleSetHandle::Ptr::ResolveStyleForFirstLetterContinuation(ComputedStyle* aParentStyle)
{
FORWARD_WITH_PARENT(ResolveStyleForFirstLetterContinuation, aParentContext, (parent));
FORWARD(ResolveStyleForFirstLetterContinuation, (aParentStyle));
}
already_AddRefed<ComputedStyle>
StyleSetHandle::Ptr::ResolvePseudoElementStyle(dom::Element* aParentElement,
CSSPseudoElementType aType,
ComputedStyle* aParentContext,
ComputedStyle* aParentStyle,
dom::Element* aPseudoElement)
{
FORWARD_WITH_PARENT(ResolvePseudoElementStyle, aParentContext, (aParentElement, aType, parent, aPseudoElement));
FORWARD(ResolvePseudoElementStyle, (aParentElement, aType, aParentStyle, aPseudoElement));
}
already_AddRefed<ComputedStyle>
StyleSetHandle::Ptr::ResolveInheritingAnonymousBoxStyle(nsAtom* aPseudoTag,
ComputedStyle* aParentContext)
ComputedStyle* aParentStyle)
{
FORWARD_WITH_PARENT(ResolveInheritingAnonymousBoxStyle, aParentContext, (aPseudoTag, parent));
FORWARD(ResolveInheritingAnonymousBoxStyle, (aPseudoTag, aParentStyle));
}
already_AddRefed<ComputedStyle>
@ -132,11 +128,10 @@ StyleSetHandle::Ptr::ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag)
already_AddRefed<ComputedStyle>
StyleSetHandle::Ptr::ResolveXULTreePseudoStyle(dom::Element* aParentElement,
nsICSSAnonBoxPseudo* aPseudoTag,
ComputedStyle* aParentContext,
ComputedStyle* aParentStyle,
const AtomArray& aInputWord)
{
FORWARD_WITH_PARENT(ResolveXULTreePseudoStyle, aParentContext,
(aParentElement, aPseudoTag, parent, aInputWord));
FORWARD(ResolveXULTreePseudoStyle, (aParentElement, aPseudoTag, aParentStyle, aInputWord));
}
#endif
@ -276,9 +271,9 @@ StyleSetHandle::Ptr::InvalidateStyleForCSSRuleChanges()
already_AddRefed<ComputedStyle>
StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement,
CSSPseudoElementType aType,
ComputedStyle* aParentContext)
ComputedStyle* aParentStyle)
{
FORWARD_WITH_PARENT(ProbePseudoElementStyle, aParentContext, (aParentElement, aType, parent));
FORWARD(ProbePseudoElementStyle, (aParentElement, aType, aParentStyle));
}
void

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

@ -83,7 +83,6 @@ EXPORTS.mozilla += [
'MediaFeatureChange.h',
'PostTraversalTask.h',
'PreloadedStyleSheet.h',
'RuleNodeCacheConditions.h',
'ServoArcTypeList.h',
'ServoBindingList.h',
'ServoBindings.h',

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

@ -331,11 +331,6 @@ nsCSSProps::BuildShorthandsContainingTable()
subpropCounts[shorthand - eCSSProperty_COUNT_no_shorthands];
subpropCountsEntry.property = shorthand;
subpropCountsEntry.count = 0;
if (nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS)) {
// Don't put shorthands that are acting as aliases in the
// shorthands-containing lists.
continue;
}
for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(shorthand);
*subprops != eCSSProperty_UNKNOWN;
++subprops) {
@ -395,12 +390,6 @@ nsCSSProps::BuildShorthandsContainingTable()
shorthandAndCount->count,
nsCSSProps::GetStringValue(shorthandAndCount->property).get());
#endif
if (nsCSSProps::PropHasFlags(shorthandAndCount->property,
CSS_PROPERTY_IS_ALIAS)) {
// Don't put shorthands that are acting as aliases in the
// shorthands-containing lists.
continue;
}
for (const nsCSSPropertyID* subprops =
SubpropertyEntryFor(shorthandAndCount->property);
*subprops != eCSSProperty_UNKNOWN;
@ -429,11 +418,6 @@ nsCSSProps::BuildShorthandsContainingTable()
for (nsCSSPropertyID shorthand = eCSSProperty_COUNT_no_shorthands;
shorthand < eCSSProperty_COUNT;
shorthand = nsCSSPropertyID(shorthand + 1)) {
if (nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS)) {
// Don't put shorthands that are acting as aliases in the
// shorthands-containing lists.
continue;
}
for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(shorthand);
*subprops != eCSSProperty_UNKNOWN;
++subprops) {

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

@ -204,8 +204,7 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
// Does this property support the unitless length quirk in quirks mode?
#define CSS_PROPERTY_UNITLESS_LENGTH_QUIRK (1<<16)
// Is this property (which must be a shorthand) really an alias?
#define CSS_PROPERTY_IS_ALIAS (1<<17)
// There's a free bit here.
// Does the property apply to ::placeholder?
#define CSS_PROPERTY_APPLIES_TO_PLACEHOLDER (1<<18)

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

@ -1920,7 +1920,6 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty,
} else if (eCSSUnit_TokenStream == unit) {
nsCSSPropertyID shorthand = mValue.mTokenStream->mShorthandPropertyID;
if (shorthand == eCSSProperty_UNKNOWN ||
nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS) ||
aProperty == eCSSProperty__x_system_font) {
// We treat serialization of aliases like '-moz-transform' as a special
// case, since it really wants to be serialized as if it were a longhand

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

@ -71,12 +71,10 @@ using namespace mozilla::dom;
already_AddRefed<nsComputedDOMStyle>
NS_NewComputedDOMStyle(dom::Element* aElement, const nsAString& aPseudoElt,
nsIPresShell* aPresShell,
nsComputedDOMStyle::StyleType aStyleType,
nsComputedDOMStyle::AnimationFlag aFlag)
nsComputedDOMStyle::StyleType aStyleType)
{
RefPtr<nsComputedDOMStyle> computedStyle;
computedStyle = new nsComputedDOMStyle(aElement, aPseudoElt,
aPresShell, aStyleType, aFlag);
RefPtr<nsComputedDOMStyle> computedStyle =
new nsComputedDOMStyle(aElement, aPseudoElt, aPresShell, aStyleType);
return computedStyle.forget();
}
@ -151,28 +149,24 @@ DocumentNeedsRestyle(
}
}
if (styleSet->IsServo()) {
// For Servo, we need to process the restyle-hint-invalidations first, to
// expand LaterSiblings hint, so that we can look whether ancestors need
// restyling.
ServoRestyleManager* restyleManager =
presContext->RestyleManager()->AsServo();
restyleManager->ProcessAllPendingAttributeAndStateInvalidations();
// For Servo, we need to process the restyle-hint-invalidations first, to
// expand LaterSiblings hint, so that we can look whether ancestors need
// restyling.
ServoRestyleManager* restyleManager =
presContext->RestyleManager()->AsServo();
restyleManager->ProcessAllPendingAttributeAndStateInvalidations();
if (!presContext->EffectCompositor()->HasPendingStyleUpdates() &&
!aDocument->GetServoRestyleRoot()) {
return false;
}
// Then if there is a restyle root, we check if the root is an ancestor of
// this content. If it is not, then we don't need to restyle immediately.
// Note this is different from Gecko: we only check if any ancestor needs
// to restyle _itself_, not descendants, since dirty descendants can be
// another subtree.
return restyleManager->HasPendingRestyleAncestor(aElement);
if (!presContext->EffectCompositor()->HasPendingStyleUpdates() &&
!aDocument->GetServoRestyleRoot()) {
return false;
}
MOZ_CRASH("old style system disabled");
// Then if there is a restyle root, we check if the root is an ancestor of
// this content. If it is not, then we don't need to restyle immediately.
// Note this is different from Gecko: we only check if any ancestor needs
// to restyle _itself_, not descendants, since dirty descendants can be
// another subtree.
return restyleManager->HasPendingRestyleAncestor(aElement);
}
/**
@ -321,8 +315,7 @@ ComputedStyleMap::Update()
nsComputedDOMStyle::nsComputedDOMStyle(dom::Element* aElement,
const nsAString& aPseudoElt,
nsIPresShell* aPresShell,
StyleType aStyleType,
AnimationFlag aFlag)
StyleType aStyleType)
: mDocumentWeak(nullptr)
, mOuterFrame(nullptr)
, mInnerFrame(nullptr)
@ -331,7 +324,6 @@ nsComputedDOMStyle::nsComputedDOMStyle(dom::Element* aElement,
, mComputedStyleGeneration(0)
, mExposeVisitedStyle(false)
, mResolvedComputedStyle(false)
, mAnimationFlag(aFlag)
{
MOZ_ASSERT(aElement && aPresShell);
MOZ_ASSERT(aPresShell->GetPresContext());
@ -425,7 +417,7 @@ nsComputedDOMStyle::Length()
// properties.
UpdateCurrentStyleSources(false);
if (mComputedStyle) {
length += Servo_GetCustomPropertiesCount(mComputedStyle->AsServo());
length += Servo_GetCustomPropertiesCount(mComputedStyle);
}
ClearCurrentStyleSources();
@ -511,16 +503,7 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
if (!presShell) {
inDocWithShell = false;
presShell = aPresShell;
if (!presShell)
return nullptr;
// In some edge cases, the caller document might be using a different style
// backend than the callee. This causes problems because the cached parsed
// style attributes in the callee document will be a different format than
// the caller expects. Supporting this would be a pain, and we're already
// in edge-case-squared, so we just return.
if (presShell->GetDocument()->GetStyleBackendType() !=
aElement->OwnerDoc()->GetStyleBackendType()) {
if (!presShell) {
return nullptr;
}
}
@ -565,21 +548,16 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
// The existing style may have animation styles so check if we need to
// remove them.
if (aAnimationFlag == eWithoutAnimation) {
nsPresContext* presContext = presShell->GetPresContext();
MOZ_ASSERT(presContext, "Should have a prescontext if we have a frame");
if (presContext && presContext->StyleSet()->IsGecko()) {
MOZ_CRASH("old style system disabled");
} else {
Element* elementOrPseudoElement =
EffectCompositor::GetElementToRestyle(aElement, pseudoType);
if (!elementOrPseudoElement) {
return nullptr;
}
return presContext->StyleSet()->AsServo()->
GetBaseContextForElement(elementOrPseudoElement,
presContext,
result->AsServo());
nsPresContext* presContext = frame->PresContext();
Element* elementOrPseudoElement =
EffectCompositor::GetElementToRestyle(aElement, pseudoType);
if (!elementOrPseudoElement) {
return nullptr;
}
return presContext->StyleSet()->AsServo()->
GetBaseContextForElement(elementOrPseudoElement,
presContext,
result);
}
RefPtr<ComputedStyle> ret = result;
@ -592,8 +570,9 @@ nsComputedDOMStyle::DoGetComputedStyleNoFlush(Element* aElement,
// for the default style, so resolve the style ourselves.
nsPresContext* presContext = presShell->GetPresContext();
if (!presContext)
if (!presContext) {
return nullptr;
}
ServoStyleSet* styleSet = presShell->StyleSet()->AsServo();
@ -760,6 +739,7 @@ nsComputedDOMStyle::GetCSSImageURLs(const nsAString& aPropertyName,
}
CollectImageURLsForProperty(prop, *mComputedStyle, aImageURLs);
ClearCurrentStyleSources();
}
// nsDOMCSSDeclaration abstract methods which should never be called
@ -989,17 +969,12 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
"should not have pseudo-element data");
}
if (mAnimationFlag == eWithoutAnimation) {
MOZ_CRASH("old style system disabled");
}
// mExposeVisitedStyle is set to true only by testing APIs that
// require chrome privilege.
MOZ_ASSERT(!mExposeVisitedStyle || nsContentUtils::IsCallerChrome(),
"mExposeVisitedStyle set incorrectly");
if (mExposeVisitedStyle && mComputedStyle->RelevantLinkVisited()) {
ComputedStyle *styleIfVisited = mComputedStyle->GetStyleIfVisited();
if (styleIfVisited) {
if (ComputedStyle* styleIfVisited = mComputedStyle->GetStyleIfVisited()) {
mComputedStyle = styleIfVisited;
}
}
@ -1047,19 +1022,6 @@ nsComputedDOMStyle::GetPropertyCSSValueWithoutWarning(
needsLayoutFlush = false;
getter = nullptr;
} else {
// We don't (for now, anyway, though it may make sense to change it
// for all aliases, including those in nsCSSPropAliasList) want
// aliases to be enumerable (via GetLength and IndexedGetter), so
// handle them here rather than adding entries to
// GetQueryablePropertyMap.
if (prop != eCSSProperty_UNKNOWN &&
nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_IS_ALIAS)) {
const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(prop);
MOZ_ASSERT(subprops[1] == eCSSProperty_UNKNOWN,
"must have list of length 1");
prop = subprops[0];
}
const ComputedStyleMap::Entry* propEntry =
GetComputedStyleMap()->FindEntryForProperty(prop);
@ -1150,7 +1112,7 @@ nsComputedDOMStyle::IndexedGetter(uint32_t aIndex,
if (index < count) {
aFound = true;
nsString varName;
Servo_GetCustomPropertyNameAt(mComputedStyle->AsServo(), index, &varName);
Servo_GetCustomPropertyNameAt(mComputedStyle, index, &varName);
aPropName.AssignLiteral("--");
aPropName.Append(varName);
} else {
@ -7168,8 +7130,7 @@ nsComputedDOMStyle::DoGetCustomProperty(const nsAString& aPropertyName)
const nsAString& name = Substring(aPropertyName,
CSS_CUSTOM_NAME_PREFIX_LENGTH);
bool present =
Servo_GetCustomPropertyValue(mComputedStyle->AsServo(), &name,
&variableValue);
Servo_GetCustomPropertyValue(mComputedStyle, &name, &variableValue);
if (!present) {
return nullptr;
}

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

@ -94,8 +94,7 @@ public:
nsComputedDOMStyle(mozilla::dom::Element* aElement,
const nsAString& aPseudoElt,
nsIPresShell* aPresShell,
StyleType aStyleType,
AnimationFlag aFlag = eWithAnimation);
StyleType aStyleType);
virtual nsINode *GetParentObject() override
{
@ -801,11 +800,6 @@ private:
*/
bool mResolvedComputedStyle;
/**
* Whether we include animation rules in the computed style.
*/
AnimationFlag mAnimationFlag;
#ifdef DEBUG
bool mFlushedPendingReflows;
#endif
@ -816,8 +810,6 @@ NS_NewComputedDOMStyle(mozilla::dom::Element* aElement,
const nsAString& aPseudoElt,
nsIPresShell* aPresShell,
nsComputedDOMStyle::StyleType aStyleType =
nsComputedDOMStyle::eAll,
nsComputedDOMStyle::AnimationFlag aFlag =
nsComputedDOMStyle::eWithAnimation);
nsComputedDOMStyle::eAll);
#endif /* nsComputedDOMStyle_h__ */

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

@ -14,7 +14,6 @@
#include "nsPresContext.h"
#include "nsSVGUtils.h"
#include "nsCSSKeywords.h"
#include "mozilla/RuleNodeCacheConditions.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StyleAnimationValue.h"
#include "gfxMatrix.h"

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

@ -23,9 +23,6 @@ class nsIFrame;
class nsPresContext;
struct gfxQuaternion;
struct nsRect;
namespace mozilla {
class RuleNodeCacheConditions;
} // namespace mozilla
/**
* A helper to generate gfxMatrixes from css transform functions.

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

@ -734,19 +734,16 @@ nsTableFrame::AppendAnonymousColFrames(nsTableColGroupFrame* aColGroupFrame,
int32_t lastIndex = startIndex + aNumColsToAdd - 1;
for (int32_t childX = startIndex; childX <= lastIndex; childX++) {
nsIContent* iContent;
RefPtr<ComputedStyle> styleContext;
// all anonymous cols that we create here use a pseudo style context of the
// col group
iContent = aColGroupFrame->GetContent();
styleContext = shell->StyleSet()->
nsIContent* iContent = aColGroupFrame->GetContent();
RefPtr<ComputedStyle> computedStyle = shell->StyleSet()->
ResolveNonInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableCol);
// ASSERTION to check for bug 54454 sneaking back in...
NS_ASSERTION(iContent, "null content in CreateAnonymousColFrames");
// create the new col frame
nsIFrame* colFrame = NS_NewTableColFrame(shell, styleContext);
nsIFrame* colFrame = NS_NewTableColFrame(shell, computedStyle);
((nsTableColFrame *) colFrame)->SetColType(aColType);
colFrame->Init(iContent, aColGroupFrame, nullptr);
@ -8185,9 +8182,9 @@ nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
nsCSSAnonBoxes::tableWrapper,
"What happened to our parent?");
RefPtr<ComputedStyle> newContext =
RefPtr<ComputedStyle> newStyle =
aRestyleState.StyleSet().ResolveInheritingAnonymousBoxStyle(
nsCSSAnonBoxes::tableWrapper, aOwningFrame->Style()->AsServo());
nsCSSAnonBoxes::tableWrapper, aOwningFrame->Style());
// Figure out whether we have an actual change. It's important that we do
// this, even though all the wrapper's changes are due to properties it
@ -8204,7 +8201,7 @@ nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
// compared to the owner frame.
uint32_t equalStructs, samePointerStructs; // Not used, actually.
nsChangeHint wrapperHint = aWrapperFrame->Style()->CalcStyleDifference(
newContext,
newStyle,
&equalStructs,
&samePointerStructs,
/* aIgnoreVariables = */ true);
@ -8222,7 +8219,7 @@ nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
}
for (nsIFrame* cur = aWrapperFrame; cur; cur = cur->GetNextContinuation()) {
cur->SetComputedStyle(newContext);
cur->SetComputedStyle(newStyle);
}
MOZ_ASSERT(!(aWrapperFrame->GetStateBits() & NS_FRAME_OWNS_ANON_BOXES),

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

@ -714,17 +714,17 @@ nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState)
if (firstRowContent) {
nsPresContext* presContext = aBoxLayoutState.PresContext();
RefPtr<ComputedStyle> styleContext =
RefPtr<ComputedStyle> computedStyle =
presContext->StyleSet()->ResolveStyleFor(
firstRowContent->AsElement(), nullptr, LazyComputeBehavior::Allow);
nscoord width = 0;
nsMargin margin(0,0,0,0);
if (styleContext->StylePadding()->GetPadding(margin))
if (computedStyle->StylePadding()->GetPadding(margin))
width += margin.LeftRight();
width += styleContext->StyleBorder()->GetComputedBorder().LeftRight();
if (styleContext->StyleMargin()->GetMargin(margin))
width += computedStyle->StyleBorder()->GetComputedBorder().LeftRight();
if (computedStyle->StyleMargin()->GetMargin(margin))
width += margin.LeftRight();
FlattenedChildIterator iter(mContent);
@ -741,7 +741,7 @@ nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState)
}
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForComputedStyle(styleContext);
nsLayoutUtils::GetFontMetricsForComputedStyle(computedStyle);
nscoord textWidth =
nsLayoutUtils::AppUnitWidthOfStringBidi(value, this, *fm,

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

@ -20,6 +20,7 @@
* synthesizeDragOver
* synthesizeDropAfterDragOver
* synthesizeDrop
* synthesizePlainDragAndDrop
*
* When adding methods to this file, please add a performance test for it.
*/
@ -2691,6 +2692,91 @@ function synthesizeDrop(aSrcElement, aDestElement, aDragData, aDropEffect, aWind
}
}
/**
* Emulate a drag and drop by emulating a dragstart by mousedown and mousemove,
* and firing events dragenter, dragover, drop, and mouseup.
* This does not modify dataTransfer and tries to emulate the plain drag and
* drop as much as possible, compared to synthesizeDrop.
*
* @param aParams
* {
* srcElement: The element to start dragging
* destElement: The element to drop on
* srcX: The initial x coordinate inside srcElement
* srcY: The initial y coordinate inside srcElement
* stepX: The x-axis step for mousemove inside srcElement
* stepY: The y-axis step for mousemove inside srcElement
* destX: The x coordinate inside destElement
* destY: The x coordinate inside destElement
* srcWindow: The window for dispatching event on srcElement,
* defaults to the current window object
* destWindow: The window for dispatching event on destElement,
* defaults to the current window object
* }
*/
async function synthesizePlainDragAndDrop(aParams)
{
let {
srcElement,
destElement,
srcX = 2,
srcY = 2,
stepX = 9,
stepY = 9,
destX = 2,
destY = 2,
srcWindow = window,
destWindow = window,
} = aParams;
const ds = _EU_Cc["@mozilla.org/widget/dragservice;1"]
.getService(_EU_Ci.nsIDragService);
ds.startDragSession();
try {
let dataTransfer = null;
function trapDrag(aEvent) {
dataTransfer = aEvent.dataTransfer;
}
srcElement.addEventListener("dragstart", trapDrag, true);
synthesizeMouse(srcElement, srcX, srcY, { type: "mousedown" }, srcWindow);
// Wait for the next event tick after each event dispatch, so that UI elements
// (e.g. menu) work like the real user input.
await new Promise(r => setTimeout(r, 0));
srcX += stepX; srcY += stepY;
synthesizeMouse(srcElement, srcX, srcY, { type: "mousemove" }, srcWindow);
await new Promise(r => setTimeout(r, 0));
srcX += stepX; srcY += stepY;
synthesizeMouse(srcElement, srcX, srcY, { type: "mousemove" }, srcWindow);
await new Promise(r => setTimeout(r, 0));
srcElement.removeEventListener("dragstart", trapDrag, true);
await new Promise(r => setTimeout(r, 0));
let event = createDragEventObject("dragover", destElement, destWindow,
dataTransfer, {});
sendDragEvent(event, destElement, destWindow);
await new Promise(r => setTimeout(r, 0));
event = createDragEventObject("drop", destElement, destWindow,
dataTransfer, {});
sendDragEvent(event, destElement, destWindow);
await new Promise(r => setTimeout(r, 0));
synthesizeMouseAtCenter(destElement, { type: "mouseup" }, destWindow);
} finally {
ds.endDragSession(true, 0);
}
}
var PluginUtils =
{
withTestPlugin : function(callback)

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

@ -946,6 +946,11 @@ var PlacesUtils = {
case this.TYPE_X_MOZ_URL: {
if (aFeedURI || PlacesUtils.nodeIsURI(aNode))
return (aFeedURI || aNode.uri) + NEWLINE + aNode.title;
if (PlacesUtils.nodeIsContainer(aNode)) {
return PlacesUtils.getURLsForContainerNode(aNode)
.map(item => item.uri + "\n" + item.title)
.join("\n");
}
return "";
}
case this.TYPE_HTML: {
@ -1382,7 +1387,11 @@ var PlacesUtils = {
for (let i = 0; i < root.childCount; ++i) {
let child = root.getChild(i);
if (this.nodeIsURI(child))
urls.push({uri: child.uri, isBookmark: this.nodeIsBookmark(child)});
urls.push({
uri: child.uri,
isBookmark: this.nodeIsBookmark(child),
title: child.title,
});
}
if (!wasOpen) {