merge mozilla-inbound to mozilla-central. r=merge a=merge

MozReview-Commit-ID: 9Z3Ly8icnvh
This commit is contained in:
Sebastian Hengst 2017-09-20 11:48:02 +02:00
Родитель c98ff484c0 260bd8768a
Коммит bc68e8f407
86 изменённых файлов: 664 добавлений и 385 удалений

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

@ -1307,9 +1307,11 @@ nsAccessibilityService::Init()
// obtain a MSAA content process id.
contentChild->SendGetA11yContentId();
}
#endif // defined(XP_WIN)
gApplicationAccessible = new ApplicationAccessibleWrap();
#else
gApplicationAccessible = new ApplicationAccessible();
#endif // defined(XP_WIN)
}
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()

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

@ -469,6 +469,7 @@ class ViewPopup extends BasePopup {
async attach(viewNode) {
this.viewNode = viewNode;
this.viewNode.addEventListener(this.DESTROY_EVENT, this);
this.viewNode.setAttribute("closemenu", "none");
if (this.extension.remote) {
this.panel.setAttribute("remote", "true");

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

@ -107,6 +107,10 @@ if (AppConstants.MOZ_DEV_EDITION) {
"resource://gre/modules/FxAccounts.jsm");
}
// A promise that resolves when the list of application handlers is loaded.
// We store this in a global so tests can await it.
var promiseLoadHandlersList;
var gMainPane = {
// The set of types the app knows how to handle. A hash of HandlerInfoWrapper
// objects, indexed by type.
@ -443,11 +447,18 @@ var gMainPane = {
// Load the data and build the list of handlers.
// By doing this after pageshow, we ensure it doesn't delay painting
// of the preferences page.
window.addEventListener("pageshow", () => {
this._loadData();
this._rebuildVisibleTypes();
this._sortVisibleTypes();
this._rebuildView();
promiseLoadHandlersList = new Promise((resolve, reject) => {
window.addEventListener("pageshow", async () => {
try {
this._loadData();
await this._rebuildVisibleTypes();
this._sortVisibleTypes();
this._rebuildView();
resolve();
} catch (ex) {
reject(ex);
}
}, {once: true});
});
let browserBundle = document.getElementById("browserBundle");
@ -1391,7 +1402,7 @@ var gMainPane = {
// nsIObserver
observe(aSubject, aTopic, aData) {
async observe(aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed") {
if (aData == PREF_CONTAINERS_EXTENSION) {
this.readBrowserContainersCheckbox();
@ -1404,7 +1415,7 @@ var gMainPane = {
// that list when they change.
if (aData == PREF_SHOW_PLUGINS_IN_LIST ||
aData == PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS) {
this._rebuildVisibleTypes();
await this._rebuildVisibleTypes();
this._sortVisibleTypes();
}
@ -1524,7 +1535,7 @@ var gMainPane = {
// View Construction
_rebuildVisibleTypes() {
async _rebuildVisibleTypes() {
// Reset the list of visible types and the visible type description counts.
this._visibleTypes = [];
this._visibleTypeDescriptionCount = {};
@ -1535,6 +1546,11 @@ var gMainPane = {
this._prefSvc.getBoolPref(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS);
for (let type in this._handledTypes) {
// Yield before processing each handler info object to avoid monopolizing
// the main thread, as the objects are retrieved lazily, and retrieval
// can be expensive on Windows.
await new Promise(resolve => Services.tm.dispatchToMainThread(resolve));
let handlerInfo = this._handledTypes[type];
// Hide plugins without associated extensions if so prefed so we don't

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

@ -8,6 +8,9 @@ add_task(async function setup() {
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
info("Preferences page opened on the general pane.");
await gBrowser.selectedBrowser.contentWindow.promiseLoadHandlersList;
info("Apps list loaded.");
registerCleanupFunction(() => {
gBrowser.removeCurrentTab();
});

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

@ -22,9 +22,9 @@ function test() {
getService(Ci.nsIHandlerService);
hserv.store(info);
openPreferencesViaOpenPreferencesAPI("general", {leaveOpen: true}).then(
() => runTest(gBrowser.selectedBrowser.contentWindow)
);
openPreferencesViaOpenPreferencesAPI("general", {leaveOpen: true})
.then(() => gBrowser.selectedBrowser.contentWindow.promiseLoadHandlersList)
.then(() => runTest(gBrowser.selectedBrowser.contentWindow));
}
function runTest(win) {

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

@ -906,8 +906,6 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect(const GlobalObject& aGlobal,
// Copy aSource's keyframes and animation properties.
// Note: We don't call SetKeyframes directly, which might revise the
// computed offsets and rebuild the animation properties.
// FIXME: Bug 1314537: We have to make sure SharedKeyframeList is handled
// properly.
effect->mKeyframes = aSource.mKeyframes;
effect->mProperties = aSource.mProperties;
return effect.forget();

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

@ -39,7 +39,7 @@
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsIContentPolicy.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "gfxPrefs.h"
@ -256,7 +256,7 @@ nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
}
nsCOMPtr<nsINode> thisNode = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
nsSVGEffects::InvalidateDirectRenderingObservers(thisNode->AsElement());
SVGObserverUtils::InvalidateDirectRenderingObservers(thisNode->AsElement());
return NS_OK;
}

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

@ -623,8 +623,8 @@ skip-if = toolkit == 'android'
[test_bug1375050.html]
[test_bug1381710.html]
[test_bug1384658.html]
[test_bug1399605.html]
skip-if = toolkit == 'android'
[test_bug1399605.html]
[test_caretPositionFromPoint.html]
[test_change_policy.html]
[test_clearTimeoutIntervalNoArg.html]

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

@ -17,7 +17,7 @@
#include "nsIDocument.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
@ -1300,7 +1300,7 @@ CanvasRenderingContext2D::Redraw()
return NS_OK;
}
nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mCanvasElement);
mCanvasElement->InvalidateCanvasContent(nullptr);
@ -1329,7 +1329,7 @@ CanvasRenderingContext2D::Redraw(const gfx::Rect& aR)
return;
}
nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mCanvasElement);
mCanvasElement->InvalidateCanvasContent(&aR);
}

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

@ -27,7 +27,7 @@
#include "nsLayoutUtils.h"
#include "mozilla/EnumeratedArray.h"
#include "FilterSupport.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "Layers.h"
#include "nsBidi.h"

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

@ -45,7 +45,7 @@
#include "nsIWidget.h"
#include "nsIXPConnect.h"
#include "nsServiceManagerUtils.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "prenv.h"
#include "ScopedGLHelpers.h"
#include "VRManagerChild.h"
@ -316,7 +316,7 @@ WebGLContext::Invalidate()
if (mInvalidated)
return;
nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mCanvasElement);
mInvalidated = true;
mCanvasElement->InvalidateCanvasContent(nullptr);

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

@ -332,10 +332,10 @@ MozNoiseSuppressionWarning=mozNoiseSuppression is deprecated. Use noiseSuppressi
XMLBaseAttributeWarning=Use of xml:base attribute is deprecated and will be removed soon. Please remove any use of it.
# LOCALIZATION NOTE: Do not translate "content", "Window", and "window.top"
WindowContentUntrustedWarning=The content attribute of Window objects is deprecated. Please use window.top instead.
# LOCALIZATION NOTE: %S is the tag name of the element that starts the loop
SVGReferenceLoopWarning=There is an SVG <%S> reference loop in this document, which will prevent the document rendering correctly.
# LOCALIZATION NOTE: %S is the tag name of the element that starts the chain
SVGReferenceChainLengthExceededWarning=There is an SVG <%S> reference chain which is too long in this document, which will prevent the document rendering correctly.
# LOCALIZATION NOTE: The first %S is the tag name of the element that starts the loop, the second %S is the element's ID.
SVGReferenceLoopWarning=The SVG <%S> with ID “%S” has a reference loop.
# LOCALIZATION NOTE: The first %S is the tag name of the element in the chain where the chain was broken, the second %S is the element's ID.
SVGReferenceChainLengthExceededWarning=An SVG <%S> reference chain which is too long was abandoned at the element with ID “%S”.
# LOCALIZATION NOTE: Do not translate "<script>".
ScriptSourceEmpty=%S attribute of <script> element is empty.
# LOCALIZATION NOTE: Do not translate "<script>".

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

@ -11,7 +11,7 @@
#include "nsIFrame.h"
#include "nsDisplayList.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
using namespace mozilla::layers;
@ -389,7 +389,7 @@ void VideoFrameContainer::InvalidateWithFlags(uint32_t aFlags)
}
}
nsSVGEffects::InvalidateDirectRenderingObservers(mElement);
SVGObserverUtils::InvalidateDirectRenderingObservers(mElement);
}
} // namespace mozilla

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

@ -145,7 +145,7 @@ SVGTextContentElement::SelectSubString(uint32_t charnum, uint32_t nchars, ErrorR
float
SVGTextContentElement::GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv)
{
SVGTextFrame* textFrame = GetSVGTextFrame();
SVGTextFrame* textFrame = GetSVGTextFrameForNonLayoutDependentQuery();
if (!textFrame)
return 0.0f;

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

@ -17,7 +17,7 @@
#include "nsContentUtils.h"
#include "nsIURI.h"
#include "mozilla/URLExtraData.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGUseFrame.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Use)
@ -375,7 +375,7 @@ SVGUseElement::LookupHref()
nsCOMPtr<nsIURI> originURI =
mOriginal ? mOriginal->GetBaseURI() : GetBaseURI();
nsCOMPtr<nsIURI> baseURI = nsContentUtils::IsLocalRefURL(href)
? nsSVGEffects::GetBaseURLForLocalRef(this, originURI)
? SVGObserverUtils::GetBaseURLForLocalRef(this, originURI)
: originURI;
nsCOMPtr<nsIURI> targetURI;

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

@ -27,6 +27,14 @@ function runTest()
var charWidth = text1.getSubStringLength(0, 1);
if (navigator.userAgent.indexOf("Linux") > -1 && charWidth == 241) {
// Workaround for a slight difference in 'charWidth' (i.e. the width of
// the 'a' char) on Linux build machines after bug 1342951. The issue
// doesn't reproduce locally on Ubuntu 17.04 so is particularly tricky to
// debug.
charWidth = 240;
}
var epsilon = 0.001;
function isClose(a, b, str)

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

@ -138,8 +138,13 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
if (!targetContent) {
return NS_OK;
}
if (EventStateManager::IsRemoteTarget(targetContent)) {
return NS_OK;
{
EventTarget* originalTarget = mouseEvent->AsEvent()->InternalDOMEvent()->GetOriginalTarget();
nsCOMPtr<nsIContent> content = do_QueryInterface(originalTarget);
if (content && EventStateManager::IsRemoteTarget(content)) {
return NS_OK;
}
}
bool preventDefault;

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

@ -24,6 +24,10 @@ else:
'nsAuthSambaNTLM.cpp',
]
LOCAL_INCLUDES += [
'/netwerk/dns', # For nsDNSService2.h
]
FINAL_LIBRARY = 'xul'
with Files('**'):

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

@ -14,6 +14,7 @@
//
#include "nsAuthSSPI.h"
#include "nsDNSService2.h"
#include "nsIServiceManager.h"
#include "nsIDNSService.h"
#include "nsIDNSRecord.h"
@ -92,8 +93,8 @@ InitSSPI()
//-----------------------------------------------------------------------------
static nsresult
MakeSN(const char *principal, nsCString &result)
nsresult
nsAuthSSPI::MakeSN(const char *principal, nsCString &result)
{
nsresult rv;
@ -106,10 +107,12 @@ MakeSN(const char *principal, nsCString &result)
if (index == kNotFound)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIDNSService> dnsService = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
auto dns = static_cast<nsDNSService*>(dnsService.get());
// This could be expensive if our DNS cache cannot satisfy the request.
// However, we should have at least hit the OS resolver once prior to
// reaching this code, so provided the OS resolver has this information
@ -120,10 +123,10 @@ MakeSN(const char *principal, nsCString &result)
// its cache. This is not an issue in versions of Windows up to WinXP.
nsCOMPtr<nsIDNSRecord> record;
mozilla::OriginAttributes attrs;
rv = dns->ResolveNative(Substring(buf, index + 1),
nsIDNSService::RESOLVE_CANONICAL_NAME,
attrs,
getter_AddRefs(record));
rv = dns->DeprecatedSyncResolve(Substring(buf, index + 1),
nsIDNSService::RESOLVE_CANONICAL_NAME,
attrs,
getter_AddRefs(record));
if (NS_FAILED(rv))
return rv;

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

@ -42,6 +42,8 @@ private:
typedef TimeStamp MS_TimeStamp;
private:
nsresult MakeSN(const char *principal, nsCString &result);
CredHandle mCred;
CtxtHandle mCtxt;
nsCString mServiceName;

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

@ -25,7 +25,7 @@
#include "nsSMILAnimationController.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "mozilla/dom/SVGAnimatedLength.h"
#include "nsMimeTypes.h"
#include "DOMSVGLength.h"
@ -276,7 +276,7 @@ SVGDocumentWrapper::Observe(nsISupports* aSubject,
// Sever ties from rendering observers to helper-doc's root SVG node
SVGSVGElement* svgElem = GetRootSVGElem();
if (svgElem) {
nsSVGEffects::RemoveAllRenderingObservers(svgElem);
SVGObserverUtils::RemoveAllRenderingObservers(svgElem);
}
// Clean up at XPCOM shutdown time.

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

@ -24,7 +24,7 @@
#include "nsRect.h"
#include "nsString.h"
#include "nsStubDocumentObserver.h"
#include "nsSVGEffects.h" // for nsSVGRenderingObserver
#include "SVGObserverUtils.h" // for nsSVGRenderingObserver
#include "nsWindowSizes.h"
#include "ImageRegion.h"
#include "ISurfaceProvider.h"
@ -66,7 +66,7 @@ public:
Element* elem = GetTarget();
MOZ_ASSERT(elem, "no root SVG node for us to observe");
nsSVGEffects::AddRenderingObserver(elem, this);
SVGObserverUtils::AddRenderingObserver(elem, this);
mInObserverList = true;
}
@ -108,7 +108,7 @@ protected:
// Our caller might've removed us from rendering-observer list.
// Add ourselves back!
if (!mInObserverList) {
nsSVGEffects::AddRenderingObserver(elem, this);
SVGObserverUtils::AddRenderingObserver(elem, this);
mInObserverList = true;
}
}

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

@ -101,7 +101,7 @@ LOCAL_INCLUDES += [
'/dom/svg',
# We need to instantiate the decoders
'/image/decoders',
# Because VectorImage.cpp includes nsSVGUtils.h and nsSVGEffects.h
# Because VectorImage.cpp includes nsSVGUtils.h and SVGObserverUtils.h
'/layout/svg',
# For URI-related functionality
'/netwerk/base',

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

@ -28,7 +28,7 @@
#include "nsStyleSet.h"
#include "nsStyleUtil.h"
#include "nsCSSFrameConstructor.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSRendering.h"
#include "nsAnimationManager.h"

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

@ -110,7 +110,7 @@
#include "gfxUtils.h"
#include "nsSMILAnimationController.h"
#include "SVGContentUtils.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "SVGFragmentIdentifier.h"
#include "nsFrameSelection.h"
@ -9308,7 +9308,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
target->SchedulePaint();
nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(target);
while (parent) {
nsSVGEffects::InvalidateDirectRenderingObservers(parent);
SVGObserverUtils::InvalidateDirectRenderingObservers(parent);
parent = nsLayoutUtils::GetCrossDocParentFrame(parent);
}

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

@ -1554,14 +1554,14 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
if (hint & nsChangeHint_UpdateEffects) {
for (nsIFrame* cont = frame; cont;
cont = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
nsSVGEffects::UpdateEffects(cont);
SVGObserverUtils::UpdateEffects(cont);
}
}
if ((hint & nsChangeHint_InvalidateRenderingObservers) ||
((hint & nsChangeHint_UpdateOpacityLayer) &&
frame->IsFrameOfType(nsIFrame::eSVG) &&
!(frame->GetStateBits() & NS_STATE_IS_OUTER_SVG))) {
nsSVGEffects::InvalidateRenderingObservers(frame);
SVGObserverUtils::InvalidateRenderingObservers(frame);
}
if (hint & nsChangeHint_NeedReflow) {
StyleChangeReflow(frame, hint);

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

@ -54,8 +54,8 @@ enum nsChangeHint : uint32_t {
* filter/mask/clip/etc CSS properties changes, causing the element's frame
* to start/stop referencing (or reference different) SVG resource elements.
* (_Not_ used to handle changes to referenced resource elements.) Using this
* hint results in nsSVGEffects::UpdateEffects being called on the element's
* frame.
* hint results in SVGObserverUtils::UpdateEffects being called on the
* element's frame.
*/
nsChangeHint_UpdateEffects = 1 << 7,

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

@ -317,7 +317,7 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
NS_ASSERTION(mContent, "We should have a content!");
mState |= NS_FRAME_INDEPENDENT_SELECTION;
AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
NS_ASSERTION(txtCtrl, "Content not a text control element");

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

@ -48,7 +48,7 @@ ViewportFrame::Init(nsIContent* aContent,
if (parent) {
nsFrameState state = parent->GetStateBits();
mState |= state & (NS_FRAME_IN_POPUP);
AddStateBits(state & (NS_FRAME_IN_POPUP));
}
}

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

@ -1229,7 +1229,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
LazyMarkLinesDirty();
mState &= ~NS_FRAME_FIRST_REFLOW;
RemoveStateBits(NS_FRAME_FIRST_REFLOW);
// Now reflow...
ReflowDirtyLines(state);
@ -5268,6 +5268,14 @@ nsBlockFrame::AppendFrames(ChildListID aListID,
printf("\n");
#endif
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
MOZ_ASSERT(GetParent()->IsSVGTextFrame(),
"unexpected block frame in SVG text");
// Workaround for bug 1399425 in case this bit has been removed from the
// SVGTextFrame just before the parser adds more descendant nodes.
GetParent()->AddStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY);
}
AddFrames(aFrameList, lastKid);
if (aListID != kNoReflowPrincipalList) {
PresContext()->PresShell()->

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

@ -76,7 +76,7 @@
#include "nsBlockFrame.h"
#include "nsDisplayList.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsChangeHint.h"
#include "nsDeckFrame.h"
#include "nsSubDocumentFrame.h"
@ -623,11 +623,11 @@ nsFrame::Init(nsIContent* aContent,
nsFrameState state = aPrevInFlow->GetStateBits();
// Make bits that are currently off (see constructor) the same:
mState |= state & (NS_FRAME_INDEPENDENT_SELECTION |
NS_FRAME_PART_OF_IBSPLIT |
NS_FRAME_MAY_BE_TRANSFORMED |
NS_FRAME_MAY_HAVE_GENERATED_CONTENT |
NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
AddStateBits(state & (NS_FRAME_INDEPENDENT_SELECTION |
NS_FRAME_PART_OF_IBSPLIT |
NS_FRAME_MAY_BE_TRANSFORMED |
NS_FRAME_MAY_HAVE_GENERATED_CONTENT |
NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN));
} else {
PresContext()->ConstructedFrame();
}
@ -635,11 +635,11 @@ nsFrame::Init(nsIContent* aContent,
nsFrameState state = GetParent()->GetStateBits();
// Make bits that are currently off (see constructor) the same:
mState |= state & (NS_FRAME_INDEPENDENT_SELECTION |
NS_FRAME_GENERATED_CONTENT |
NS_FRAME_IS_SVG_TEXT |
NS_FRAME_IN_POPUP |
NS_FRAME_IS_NONDISPLAY);
AddStateBits(state & (NS_FRAME_INDEPENDENT_SELECTION |
NS_FRAME_GENERATED_CONTENT |
NS_FRAME_IS_SVG_TEXT |
NS_FRAME_IN_POPUP |
NS_FRAME_IS_NONDISPLAY));
if (HasAnyStateBits(NS_FRAME_IN_POPUP) && TrackingVisibility()) {
// Assume all frames in popups are visible.
@ -652,7 +652,7 @@ nsFrame::Init(nsIContent* aContent,
nsLayoutUtils::HasAnimationOfProperty(this, eCSSProperty_transform))) {
// The frame gets reconstructed if we toggle the -moz-transform
// property, so we can set this bit here and then ignore it.
mState |= NS_FRAME_MAY_BE_TRANSFORMED;
AddStateBits(NS_FRAME_MAY_BE_TRANSFORMED);
}
if (disp->mPosition == NS_STYLE_POSITION_STICKY &&
!aPrevInFlow &&
@ -715,7 +715,7 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT),
"NS_FRAME_PART_OF_IBSPLIT set on non-nsContainerFrame?");
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
if (StyleDisplay()->mPosition == NS_STYLE_POSITION_STICKY) {
StickyScrollContainer* ssc =
@ -5892,11 +5892,12 @@ nsFrame::DidReflow(nsPresContext* aPresContext,
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
("nsFrame::DidReflow: aStatus=%d", static_cast<uint32_t>(aStatus)));
nsSVGEffects::InvalidateDirectRenderingObservers(this, nsSVGEffects::INVALIDATE_REFLOW);
SVGObserverUtils::InvalidateDirectRenderingObservers(this,
SVGObserverUtils::INVALIDATE_REFLOW);
if (nsDidReflowStatus::FINISHED == aStatus) {
mState &= ~(NS_FRAME_IN_REFLOW | NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_IN_REFLOW | NS_FRAME_FIRST_REFLOW |
NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
}
// Notify the percent bsize observer if there is a percent bsize.
@ -6407,12 +6408,12 @@ nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
static void InvalidateRenderingObservers(nsIFrame* aDisplayRoot, nsIFrame* aFrame)
{
MOZ_ASSERT(aDisplayRoot == nsLayoutUtils::GetDisplayRootFrame(aFrame));
nsSVGEffects::InvalidateDirectRenderingObservers(aFrame);
SVGObserverUtils::InvalidateDirectRenderingObservers(aFrame);
nsIFrame* parent = aFrame;
while (parent != aDisplayRoot &&
(parent = nsLayoutUtils::GetCrossDocParentFrame(parent)) &&
!parent->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
nsSVGEffects::InvalidateDirectRenderingObservers(parent);
SVGObserverUtils::InvalidateDirectRenderingObservers(parent);
}
}
@ -6451,7 +6452,7 @@ static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = tru
if (aHasDisplayItem) {
aFrame->AddStateBits(NS_FRAME_NEEDS_PAINT);
}
nsSVGEffects::InvalidateDirectRenderingObservers(aFrame);
SVGObserverUtils::InvalidateDirectRenderingObservers(aFrame);
bool needsSchedulePaint = false;
if (nsLayoutUtils::IsPopup(aFrame)) {
needsSchedulePaint = true;
@ -6461,7 +6462,7 @@ static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = tru
if (aHasDisplayItem && !parent->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
parent->AddStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);
}
nsSVGEffects::InvalidateDirectRenderingObservers(parent);
SVGObserverUtils::InvalidateDirectRenderingObservers(parent);
// If we're inside a popup, then we need to make sure that we
// call schedule paint so that the NS_FRAME_UPDATE_LAYER_TREE
@ -6997,7 +6998,7 @@ nsFrame::IsFrameTreeTooDeep(const ReflowInput& aReflowInput,
{
if (aReflowInput.mReflowDepth > MAX_FRAME_DEPTH) {
NS_WARNING("frame tree too deep; setting zero size and returning");
mState |= NS_FRAME_TOO_DEEP_IN_FRAME_TREE;
AddStateBits(NS_FRAME_TOO_DEEP_IN_FRAME_TREE);
ClearOverflowRects();
aMetrics.ClearSize();
aMetrics.SetBlockStartAscent(0);
@ -7014,7 +7015,7 @@ nsFrame::IsFrameTreeTooDeep(const ReflowInput& aReflowInput,
return true;
}
mState &= ~NS_FRAME_TOO_DEEP_IN_FRAME_TREE;
RemoveStateBits(NS_FRAME_TOO_DEEP_IN_FRAME_TREE);
return false;
}
@ -9138,7 +9139,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
}
if (anyOverflowChanged) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return anyOverflowChanged;
}

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

@ -390,6 +390,10 @@ FRAME_STATE_BIT(SVG, 23, NS_STATE_SVG_POSITIONING_MAY_USE_PERCENTAGES)
FRAME_STATE_BIT(SVG, 24, NS_STATE_SVG_TEXT_IN_REFLOW)
// Set on SVGTextFrame frames when they need a
// TextNodeCorrespondenceRecorder::RecordCorrespondence call
// to update the cached nsTextNode indexes that they correspond to.
FRAME_STATE_BIT(SVG, 25, NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY)
// == Frame state bits that apply to text frames ==============================

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

@ -4102,7 +4102,7 @@ protected:
// bug 81268
NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW), "frame is already in reflow");
#endif
mState |= NS_FRAME_IN_REFLOW;
AddStateBits(NS_FRAME_IN_REFLOW);
}
nsFrameState mState;

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

@ -991,15 +991,15 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
// see if we have a frozen size (i.e. a fixed width and height)
if (HaveFixedSize(aReflowInput)) {
mState |= IMAGE_SIZECONSTRAINED;
AddStateBits(IMAGE_SIZECONSTRAINED);
} else {
mState &= ~IMAGE_SIZECONSTRAINED;
RemoveStateBits(IMAGE_SIZECONSTRAINED);
}
// XXXldb These two bits are almost exact opposites (except in the
// middle of the initial reflow); remove IMAGE_GOTINITIALREFLOW.
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
mState |= IMAGE_GOTINITIALREFLOW;
AddStateBits(IMAGE_GOTINITIALREFLOW);
}
mComputedSize =

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

@ -4549,7 +4549,7 @@ nsContinuingTextFrame::Init(nsIContent* aContent,
nextContinuation = nextContinuation->GetNextContinuation();
}
}
mState |= NS_FRAME_IS_BIDI;
AddStateBits(NS_FRAME_IS_BIDI);
} // prev frame is bidi
}
@ -4872,7 +4872,7 @@ nsTextFrame::CharacterDataChanged(CharacterDataChangeInfo* aInfo)
do {
// textFrame contained deleted text (or the insertion point,
// if this was a pure insertion).
textFrame->mState &= ~TEXT_WHITESPACE_FLAGS;
textFrame->RemoveStateBits(TEXT_WHITESPACE_FLAGS);
textFrame->ClearTextRuns();
nsIFrame* parentOfTextFrame = textFrame->GetParent();
@ -10320,7 +10320,7 @@ nsTextFrame::IsEmpty()
bool isEmpty =
IsAllWhitespace(mContent->GetText(),
textStyle->mWhiteSpace != mozilla::StyleWhiteSpace::PreLine);
mState |= (isEmpty ? TEXT_IS_ONLY_WHITESPACE : TEXT_ISNOT_ONLY_WHITESPACE);
AddStateBits(isEmpty ? TEXT_IS_ONLY_WHITESPACE : TEXT_ISNOT_ONLY_WHITESPACE);
return isEmpty;
}

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

@ -46,7 +46,7 @@
#include "nsCSSFrameConstructor.h"
#include "nsCSSProps.h"
#include "nsContentUtils.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
#include "gfxDrawable.h"
#include "GeckoProfiler.h"

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

@ -43,7 +43,7 @@
#include "BasicLayers.h"
#include "nsBoxFrame.h"
#include "nsSubDocumentFrame.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGElement.h"
#include "nsSVGClipPathFrame.h"
#include "GeckoProfiler.h"
@ -8755,8 +8755,8 @@ ComputeMaskGeometry(PaintFramesParams& aParams)
const nsStyleSVGReset *svgReset = firstFrame->StyleSVGReset();
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();
if (maskFrames.Length() == 0) {
@ -8876,8 +8876,8 @@ nsDisplayMask::BuildLayer(nsDisplayListBuilder* aBuilder,
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
if (effectProperties.HasInvalidClipPath() ||
effectProperties.HasInvalidMask()) {
@ -9068,8 +9068,8 @@ nsDisplayMask::PrintEffects(nsACString& aTo)
{
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame();
bool first = true;
aTo += " effects=(";
@ -9135,8 +9135,8 @@ nsDisplayFilter::BuildLayer(nsDisplayListBuilder* aBuilder,
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
if (effectProperties.HasInvalidFilter()) {
return nullptr;
@ -9300,8 +9300,8 @@ nsDisplayFilter::PrintEffects(nsACString& aTo)
{
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
bool first = true;
aTo += " effects=(";
if (mFrame->StyleEffects()->mOpacity != 1.0f && mHandleOpacity) {

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

@ -20,7 +20,7 @@
#include "nsIFrame.h"
#include "nsStyleStructInlines.h"
#include "nsSVGDisplayableFrame.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
using namespace mozilla;
@ -180,9 +180,9 @@ nsImageRenderer::PrepareImage()
nsCOMPtr<nsIURI> base = mForFrame->GetContent()->GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), elementId,
mForFrame->GetContent()->GetUncomposedDoc(), base);
nsSVGPaintingProperty* property = nsSVGEffects::GetPaintingPropertyForURI(
nsSVGPaintingProperty* property = SVGObserverUtils::GetPaintingPropertyForURI(
targetURI, mForFrame->FirstContinuation(),
nsSVGEffects::BackgroundImageProperty());
SVGObserverUtils::BackgroundImageProperty());
if (!property) {
mPrepareResult = DrawResult::BAD_IMAGE;
return false;

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

@ -13,7 +13,7 @@
#include "nsError.h"
#include "nsDisplayList.h"
#include "FrameLayerBuilder.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "imgIContainer.h"
#include "Image.h"
@ -362,7 +362,7 @@ ImageLoader::DoRedraw(FrameSet* aFrameSet, bool aForcePaint)
// Update ancestor rendering observers (-moz-element etc)
nsIFrame *f = frame;
while (f && !f->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
nsSVGEffects::InvalidateDirectRenderingObservers(f);
SVGObserverUtils::InvalidateDirectRenderingObservers(f);
f = nsLayoutUtils::GetCrossDocParentFrame(f);
}

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

@ -151,9 +151,11 @@ public:
private:
void ReportErrorToConsole() {
nsAutoString tag;
mFrame->GetContent()->AsElement()->GetTagName(tag);
const char16_t* params[] = { tag.get() };
nsAutoString tag, id;
dom::Element* element = mFrame->GetContent()->AsElement();
element->GetTagName(tag);
element->GetId(id);
const char16_t* params[] = { tag.get(), id.get() };
auto doc = mFrame->GetContent()->OwnerDoc();
auto warning = *mFrameInUse ?
nsIDocument::eSVGReferenceLoop :

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

@ -10,7 +10,7 @@
#include "mozilla/Preferences.h"
#include "nsIDocument.h"
#include "nsSVGPaintServerFrame.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGPaintServerFrame.h"
using namespace mozilla::gfx;
@ -91,12 +91,12 @@ SetupInheritablePaint(const DrawTarget* aDrawTarget,
SVGContextPaint* aOuterContextPaint,
SVGContextPaintImpl::Paint& aTargetPaint,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
nsSVGEffects::PaintingPropertyDescriptor aProperty,
SVGObserverUtils::PaintingPropertyDescriptor aProperty,
imgDrawingParams& aImgParams)
{
const nsStyleSVG *style = aFrame->StyleSVG();
nsSVGPaintServerFrame *ps =
nsSVGEffects::GetPaintServer(aFrame, aFillOrStroke, aProperty);
SVGObserverUtils::GetPaintServer(aFrame, aFillOrStroke, aProperty);
if (ps) {
RefPtr<gfxPattern> pattern =
@ -157,7 +157,7 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity,
aOuterContextPaint, mFillPaint, &nsStyleSVG::mFill,
nsSVGEffects::FillProperty(), aImgParams);
SVGObserverUtils::FillProperty(), aImgParams);
SetFillOpacity(opacity);
@ -174,7 +174,8 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity,
aOuterContextPaint, mStrokePaint,
&nsStyleSVG::mStroke, nsSVGEffects::StrokeProperty(),
&nsStyleSVG::mStroke,
SVGObserverUtils::StrokeProperty(),
aImgParams);
SetStrokeOpacity(opacity);

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

@ -8,7 +8,7 @@
#include "nsGkAtoms.h"
#include "nsIFrame.h"
#include "nsLiteralString.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGFilters.h"
/*
@ -89,7 +89,7 @@ SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent());
}
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);

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

@ -10,7 +10,7 @@
#include "nsGkAtoms.h"
#include "nsIDOMMutationEvent.h"
#include "nsLiteralString.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGFilters.h"
#include "mozilla/dom/SVGFEImageElement.h"
@ -125,7 +125,7 @@ SVGFEImageFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent());
}
// Currently our SMIL implementation does not modify the DOM attributes. Once

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

@ -7,7 +7,7 @@
#include "nsContainerFrame.h"
#include "nsFrame.h"
#include "nsGkAtoms.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGFilters.h"
/*
@ -87,7 +87,7 @@ SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent());
}
return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);

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

@ -7,7 +7,7 @@
#include "nsContainerFrame.h"
#include "nsFrame.h"
#include "nsGkAtoms.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGFilters.h"
class SVGFEUnstyledLeafFrame : public nsFrame
@ -66,7 +66,7 @@ SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->GetParent()->IsSVGFilterFrame(),
"Observers observe the filter, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()->GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent()->GetParent());
}
return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);

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

@ -18,7 +18,7 @@
#include "nsDisplayList.h"
#include "nsGkAtoms.h"
#include "nsLayoutUtils.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGMarkerFrame.h"
#include "SVGGeometryElement.h"
@ -417,15 +417,15 @@ SVGGeometryFrame::ReflowSVG()
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
SVGObserverUtils::UpdateEffects(this);
}
nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
nsOverflowAreas overflowAreas(overflow, overflow);
FinishAndStoreOverflow(overflowAreas, mRect.Size());
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
// Invalidate, but only if this is not our first reflow (since if it is our
// first reflow then we haven't had our first paint yet).
@ -702,20 +702,20 @@ SVGGeometryFrame::GetMarkerProperties(SVGGeometryFrame *aFrame)
MarkerProperties result;
nsCOMPtr<nsIURI> markerURL =
nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
SVGObserverUtils::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
result.mMarkerStart =
nsSVGEffects::GetMarkerProperty(markerURL, aFrame,
nsSVGEffects::MarkerBeginProperty());
SVGObserverUtils::GetMarkerProperty(markerURL, aFrame,
SVGObserverUtils::MarkerBeginProperty());
markerURL = nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerMid);
markerURL = SVGObserverUtils::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerMid);
result.mMarkerMid =
nsSVGEffects::GetMarkerProperty(markerURL, aFrame,
nsSVGEffects::MarkerMiddleProperty());
SVGObserverUtils::GetMarkerProperty(markerURL, aFrame,
SVGObserverUtils::MarkerMiddleProperty());
markerURL = nsSVGEffects::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerEnd);
markerURL = SVGObserverUtils::GetMarkerURI(aFrame, &nsStyleSVG::mMarkerEnd);
result.mMarkerEnd =
nsSVGEffects::GetMarkerProperty(markerURL, aFrame,
nsSVGEffects::MarkerEndProperty());
SVGObserverUtils::GetMarkerProperty(markerURL, aFrame,
SVGObserverUtils::MarkerEndProperty());
return result;
}

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

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
// Keep others in (case-insensitive) order:
#include "mozilla/RestyleManager.h"
@ -41,7 +41,7 @@ nsSVGRenderingObserver::StopListening()
if (target) {
target->RemoveMutationObserver(this);
if (mInObserverList) {
nsSVGEffects::RemoveRenderingObserver(target, this);
SVGObserverUtils::RemoveRenderingObserver(target, this);
mInObserverList = false;
}
}
@ -69,7 +69,7 @@ nsSVGRenderingObserver::GetReferencedElement()
}
#endif
if (target && !mInObserverList) {
nsSVGEffects::AddRenderingObserver(target, this);
SVGObserverUtils::AddRenderingObserver(target, this);
mInObserverList = true;
}
return target;
@ -199,7 +199,7 @@ void
nsSVGIDRenderingObserver::DoUpdate()
{
if (mElement.get() && mInObserverList) {
nsSVGEffects::RemoveRenderingObserver(mElement.get(), this);
SVGObserverUtils::RemoveRenderingObserver(mElement.get(), this);
mInObserverList = false;
}
}
@ -229,7 +229,8 @@ nsSVGRenderingObserverProperty::DoUpdate()
nsSVGIDRenderingObserver::DoUpdate();
nsIFrame* frame = mFrameReference.Get();
if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) {
if (frame && frame->HasAllStateBits(NS_FRAME_SVG_LAYOUT)) {
// Changes should propagate out to things that might be observing
// the referencing frame or its ancestors.
nsLayoutUtils::PostRestyleEvent(
@ -304,7 +305,7 @@ nsSVGFilterChainObserver::nsSVGFilterChainObserver(const nsTArray<nsStyleFilter>
// aFilteredFrame can be null if this filter belongs to a
// CanvasRenderingContext2D.
nsCOMPtr<nsIURI> filterURL = aFilteredFrame
? nsSVGEffects::GetFilterURI(aFilteredFrame, i)
? SVGObserverUtils::GetFilterURI(aFilteredFrame, i)
: aFilters[i].GetURL()->ResolveLocalRef(aFilteredElement);
RefPtr<nsSVGFilterReference> reference =
@ -349,7 +350,9 @@ nsSVGFilterProperty::DoUpdate()
nsChangeHint changeHint =
nsChangeHint(nsChangeHint_RepaintFrame);
if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) {
// Since we don't call nsSVGRenderingObserverProperty::DoUpdate, we have to
// add this bit ourselves.
if (frame->HasAllStateBits(NS_FRAME_SVG_LAYOUT)) {
// Changes should propagate out to things that might be observing
// the referencing frame or its ancestors.
changeHint |= nsChangeHint_InvalidateRenderingObservers;
@ -374,20 +377,16 @@ nsSVGMarkerProperty::DoUpdate()
NS_ASSERTION(frame->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected");
// Repaint asynchronously in case the marker frame is being torn down
nsChangeHint changeHint =
nsChangeHint(nsChangeHint_RepaintFrame);
// Don't need to request ReflowFrame if we're being reflowed.
if (!(frame->GetStateBits() & NS_FRAME_IN_REFLOW)) {
changeHint |= nsChangeHint_InvalidateRenderingObservers;
// XXXjwatt: We need to unify SVG into standard reflow so we can just use
// nsChangeHint_NeedReflow | nsChangeHint_NeedDirtyReflow here.
// XXXSDL KILL THIS!!!
nsSVGUtils::ScheduleReflowSVG(frame);
}
frame->PresContext()->RestyleManager()->PostRestyleEvent(
frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint);
frame->GetContent()->AsElement(), nsRestyleHint(0),
nsChangeHint_RepaintFrame);
}
NS_IMPL_ISUPPORTS(nsSVGMaskProperty, nsISupports)
@ -398,7 +397,7 @@ nsSVGMaskProperty::nsSVGMaskProperty(nsIFrame* aFrame)
const nsStyleSVGReset *svgReset = aFrame->StyleSVGReset();
for (uint32_t i = 0; i < svgReset->mMask.mImageCount; i++) {
nsCOMPtr<nsIURI> maskUri = nsSVGEffects::GetMaskURI(aFrame, i);
nsCOMPtr<nsIURI> maskUri = SVGObserverUtils::GetMaskURI(aFrame, i);
bool hasRef = false;
if (maskUri) {
maskUri->GetHasRef(&hasRef);
@ -501,9 +500,6 @@ nsSVGPaintingProperty::DoUpdate()
return;
if (frame->GetStateBits() & NS_FRAME_SVG_LAYOUT) {
nsLayoutUtils::PostRestyleEvent(
frame->GetContent()->AsElement(), nsRestyleHint(0),
nsChangeHint_InvalidateRenderingObservers);
frame->InvalidateFrameSubtree();
} else {
InvalidateAllContinuations(frame);
@ -518,25 +514,26 @@ GetOrCreateFilterProperty(nsIFrame* aFrame)
return nullptr;
nsSVGFilterProperty *prop =
aFrame->GetProperty(nsSVGEffects::FilterProperty());
aFrame->GetProperty(SVGObserverUtils::FilterProperty());
if (prop)
return prop;
prop = new nsSVGFilterProperty(effects->mFilters, aFrame);
NS_ADDREF(prop);
aFrame->SetProperty(nsSVGEffects::FilterProperty(), prop);
aFrame->SetProperty(SVGObserverUtils::FilterProperty(), prop);
return prop;
}
static nsSVGMaskProperty*
GetOrCreateMaskProperty(nsIFrame* aFrame)
{
nsSVGMaskProperty *prop = aFrame->GetProperty(nsSVGEffects::MaskProperty());
nsSVGMaskProperty *prop =
aFrame->GetProperty(SVGObserverUtils::MaskProperty());
if (prop)
return prop;
prop = new nsSVGMaskProperty(aFrame);
NS_ADDREF(prop);
aFrame->SetProperty(nsSVGEffects::MaskProperty(), prop);
aFrame->SetProperty(SVGObserverUtils::MaskProperty(), prop);
return prop;
}
@ -558,7 +555,7 @@ GetEffectProperty(nsIURI* aURI, nsIFrame* aFrame,
}
nsSVGMarkerProperty*
nsSVGEffects::GetMarkerProperty(nsIURI* aURI, nsIFrame* aFrame,
SVGObserverUtils::GetMarkerProperty(nsIURI* aURI, nsIFrame* aFrame,
const mozilla::FramePropertyDescriptor<nsSVGMarkerProperty>* aProperty)
{
MOZ_ASSERT(aFrame->IsSVGGeometryFrame() &&
@ -568,44 +565,44 @@ nsSVGEffects::GetMarkerProperty(nsIURI* aURI, nsIFrame* aFrame,
}
nsSVGTextPathProperty*
nsSVGEffects::GetTextPathProperty(nsIURI* aURI, nsIFrame* aFrame,
SVGObserverUtils::GetTextPathProperty(nsIURI* aURI, nsIFrame* aFrame,
const mozilla::FramePropertyDescriptor<nsSVGTextPathProperty>* aProperty)
{
return GetEffectProperty(aURI, aFrame, aProperty);
}
nsSVGPaintingProperty*
nsSVGEffects::GetPaintingProperty(nsIURI* aURI, nsIFrame* aFrame,
SVGObserverUtils::GetPaintingProperty(nsIURI* aURI, nsIFrame* aFrame,
const mozilla::FramePropertyDescriptor<nsSVGPaintingProperty>* aProperty)
{
return GetEffectProperty(aURI, aFrame, aProperty);
}
nsSVGPaintingProperty*
nsSVGEffects::GetPaintingPropertyForURI(nsIURI* aURI, nsIFrame* aFrame,
SVGObserverUtils::GetPaintingPropertyForURI(nsIURI* aURI, nsIFrame* aFrame,
URIObserverHashtablePropertyDescriptor aProperty)
{
if (!aURI)
return nullptr;
nsSVGEffects::URIObserverHashtable *hashtable =
SVGObserverUtils::URIObserverHashtable *hashtable =
aFrame->GetProperty(aProperty);
if (!hashtable) {
hashtable = new nsSVGEffects::URIObserverHashtable();
hashtable = new SVGObserverUtils::URIObserverHashtable();
aFrame->SetProperty(aProperty, hashtable);
}
nsSVGPaintingProperty* prop =
static_cast<nsSVGPaintingProperty*>(hashtable->GetWeak(aURI));
if (!prop) {
bool watchImage = aProperty == nsSVGEffects::BackgroundImageProperty();
bool watchImage = aProperty == SVGObserverUtils::BackgroundImageProperty();
prop = new nsSVGPaintingProperty(aURI, aFrame, watchImage);
hashtable->Put(aURI, prop);
}
return prop;
}
nsSVGEffects::EffectProperties
nsSVGEffects::GetEffectProperties(nsIFrame* aFrame)
SVGObserverUtils::EffectProperties
SVGObserverUtils::GetEffectProperties(nsIFrame* aFrame)
{
NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame should be first continuation");
@ -615,7 +612,7 @@ nsSVGEffects::GetEffectProperties(nsIFrame* aFrame)
result.mFilter = GetOrCreateFilterProperty(aFrame);
if (style->mClipPath.GetType() == StyleShapeSourceType::URL) {
nsCOMPtr<nsIURI> pathURI = nsSVGEffects::GetClipPathURI(aFrame);
nsCOMPtr<nsIURI> pathURI = SVGObserverUtils::GetClipPathURI(aFrame);
result.mClipPath =
GetPaintingProperty(pathURI, aFrame, ClipPathProperty());
} else {
@ -630,9 +627,9 @@ nsSVGEffects::GetEffectProperties(nsIFrame* aFrame)
}
nsSVGPaintServerFrame *
nsSVGEffects::GetPaintServer(nsIFrame* aTargetFrame,
nsStyleSVGPaint nsStyleSVG::* aPaint,
PaintingPropertyDescriptor aType)
SVGObserverUtils::GetPaintServer(nsIFrame* aTargetFrame,
nsStyleSVGPaint nsStyleSVG::* aPaint,
PaintingPropertyDescriptor aType)
{
const nsStyleSVG* svgStyle = aTargetFrame->StyleSVG();
if ((svgStyle->*aPaint).Type() != eStyleSVGPaintType_Server)
@ -651,9 +648,10 @@ nsSVGEffects::GetPaintServer(nsIFrame* aTargetFrame,
}
}
nsCOMPtr<nsIURI> paintServerURL = nsSVGEffects::GetPaintURI(frame, aPaint);
nsCOMPtr<nsIURI> paintServerURL =
SVGObserverUtils::GetPaintURI(frame, aPaint);
nsSVGPaintingProperty *property =
nsSVGEffects::GetPaintingProperty(paintServerURL, frame, aType);
SVGObserverUtils::GetPaintingProperty(paintServerURL, frame, aType);
if (!property)
return nullptr;
nsIFrame* result = property->GetReferencedFrame();
@ -670,7 +668,7 @@ nsSVGEffects::GetPaintServer(nsIFrame* aTargetFrame,
}
nsSVGClipPathFrame *
nsSVGEffects::EffectProperties::GetClipPathFrame()
SVGObserverUtils::EffectProperties::GetClipPathFrame()
{
if (!mClipPath)
return nullptr;
@ -682,7 +680,7 @@ nsSVGEffects::EffectProperties::GetClipPathFrame()
}
nsTArray<nsSVGMaskFrame *>
nsSVGEffects::EffectProperties::GetMaskFrames()
SVGObserverUtils::EffectProperties::GetMaskFrames()
{
nsTArray<nsSVGMaskFrame *> result;
if (!mMask)
@ -710,13 +708,13 @@ nsSVGEffects::EffectProperties::GetMaskFrames()
}
bool
nsSVGEffects::EffectProperties::HasNoOrValidEffects()
SVGObserverUtils::EffectProperties::HasNoOrValidEffects()
{
return HasNoOrValidClipPath() && HasNoOrValidMask() && HasNoOrValidFilter();
}
bool
nsSVGEffects::EffectProperties::HasNoOrValidClipPath()
SVGObserverUtils::EffectProperties::HasNoOrValidClipPath()
{
if (mClipPath) {
bool ok = true;
@ -731,7 +729,7 @@ nsSVGEffects::EffectProperties::HasNoOrValidClipPath()
}
bool
nsSVGEffects::EffectProperties::HasNoOrValidMask()
SVGObserverUtils::EffectProperties::HasNoOrValidMask()
{
if (mMask) {
bool ok = true;
@ -748,7 +746,7 @@ nsSVGEffects::EffectProperties::HasNoOrValidMask()
}
void
nsSVGEffects::UpdateEffects(nsIFrame* aFrame)
SVGObserverUtils::UpdateEffects(nsIFrame* aFrame)
{
NS_ASSERTION(aFrame->GetContent()->IsElement(),
"aFrame's content should be an element");
@ -781,7 +779,7 @@ nsSVGEffects::UpdateEffects(nsIFrame* aFrame)
}
nsSVGFilterProperty*
nsSVGEffects::GetFilterProperty(nsIFrame* aFrame)
SVGObserverUtils::GetFilterProperty(nsIFrame* aFrame)
{
NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame should be first continuation");
@ -848,8 +846,8 @@ nsSVGRenderingObserverList::RemoveAll()
}
void
nsSVGEffects::AddRenderingObserver(Element* aElement,
nsSVGRenderingObserver* aObserver)
SVGObserverUtils::AddRenderingObserver(Element* aElement,
nsSVGRenderingObserver* aObserver)
{
nsSVGRenderingObserverList *observerList = GetObserverList(aElement);
if (!observerList) {
@ -864,8 +862,8 @@ nsSVGEffects::AddRenderingObserver(Element* aElement,
}
void
nsSVGEffects::RemoveRenderingObserver(Element* aElement,
nsSVGRenderingObserver* aObserver)
SVGObserverUtils::RemoveRenderingObserver(Element* aElement,
nsSVGRenderingObserver* aObserver)
{
nsSVGRenderingObserverList *observerList = GetObserverList(aElement);
if (observerList) {
@ -879,7 +877,7 @@ nsSVGEffects::RemoveRenderingObserver(Element* aElement,
}
void
nsSVGEffects::RemoveAllRenderingObservers(Element* aElement)
SVGObserverUtils::RemoveAllRenderingObservers(Element* aElement)
{
nsSVGRenderingObserverList *observerList = GetObserverList(aElement);
if (observerList) {
@ -889,7 +887,7 @@ nsSVGEffects::RemoveAllRenderingObservers(Element* aElement)
}
void
nsSVGEffects::InvalidateRenderingObservers(nsIFrame* aFrame)
SVGObserverUtils::InvalidateRenderingObservers(nsIFrame* aFrame)
{
NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame must be first continuation");
@ -922,7 +920,8 @@ nsSVGEffects::InvalidateRenderingObservers(nsIFrame* aFrame)
}
void
nsSVGEffects::InvalidateDirectRenderingObservers(Element* aElement, uint32_t aFlags /* = 0 */)
SVGObserverUtils::InvalidateDirectRenderingObservers(Element* aElement,
uint32_t aFlags /* = 0 */)
{
nsIFrame* frame = aElement->GetPrimaryFrame();
if (frame) {
@ -943,7 +942,8 @@ nsSVGEffects::InvalidateDirectRenderingObservers(Element* aElement, uint32_t aFl
}
void
nsSVGEffects::InvalidateDirectRenderingObservers(nsIFrame* aFrame, uint32_t aFlags /* = 0 */)
SVGObserverUtils::InvalidateDirectRenderingObservers(nsIFrame* aFrame,
uint32_t aFlags /* = 0 */)
{
nsIContent* content = aFrame->GetContent();
if (content && content->IsElement()) {
@ -952,7 +952,7 @@ nsSVGEffects::InvalidateDirectRenderingObservers(nsIFrame* aFrame, uint32_t aFla
}
already_AddRefed<nsIURI>
nsSVGEffects::GetBaseURLForLocalRef(nsIContent* content, nsIURI* aDocURI)
SVGObserverUtils::GetBaseURLForLocalRef(nsIContent* content, nsIURI* aDocURI)
{
MOZ_ASSERT(content);
@ -1014,20 +1014,21 @@ ResolveURLUsingLocalRef(nsIFrame* aFrame, const css::URLValueData* aURL)
}
nsCOMPtr<nsIURI> baseURI =
nsSVGEffects::GetBaseURLForLocalRef(aFrame->GetContent(), aURL->GetURI());
SVGObserverUtils::GetBaseURLForLocalRef(aFrame->GetContent(),
aURL->GetURI());
return aURL->ResolveLocalRef(baseURI);
}
already_AddRefed<nsIURI>
nsSVGEffects::GetMarkerURI(nsIFrame* aFrame,
RefPtr<css::URLValue> nsStyleSVG::* aMarker)
SVGObserverUtils::GetMarkerURI(nsIFrame* aFrame,
RefPtr<css::URLValue> nsStyleSVG::* aMarker)
{
return ResolveURLUsingLocalRef(aFrame, aFrame->StyleSVG()->*aMarker);
}
already_AddRefed<nsIURI>
nsSVGEffects::GetClipPathURI(nsIFrame* aFrame)
SVGObserverUtils::GetClipPathURI(nsIFrame* aFrame)
{
const nsStyleSVGReset* svgResetStyle = aFrame->StyleSVGReset();
MOZ_ASSERT(svgResetStyle->mClipPath.GetType() == StyleShapeSourceType::URL);
@ -1037,7 +1038,7 @@ nsSVGEffects::GetClipPathURI(nsIFrame* aFrame)
}
already_AddRefed<nsIURI>
nsSVGEffects::GetFilterURI(nsIFrame* aFrame, uint32_t aIndex)
SVGObserverUtils::GetFilterURI(nsIFrame* aFrame, uint32_t aIndex)
{
const nsStyleEffects* effects = aFrame->StyleEffects();
MOZ_ASSERT(effects->mFilters.Length() > aIndex);
@ -1047,7 +1048,7 @@ nsSVGEffects::GetFilterURI(nsIFrame* aFrame, uint32_t aIndex)
}
already_AddRefed<nsIURI>
nsSVGEffects::GetFilterURI(nsIFrame* aFrame, const nsStyleFilter& aFilter)
SVGObserverUtils::GetFilterURI(nsIFrame* aFrame, const nsStyleFilter& aFilter)
{
MOZ_ASSERT(aFrame->StyleEffects()->mFilters.Length());
MOZ_ASSERT(aFilter.GetType() == NS_STYLE_FILTER_URL);
@ -1056,8 +1057,8 @@ nsSVGEffects::GetFilterURI(nsIFrame* aFrame, const nsStyleFilter& aFilter)
}
already_AddRefed<nsIURI>
nsSVGEffects::GetPaintURI(nsIFrame* aFrame,
nsStyleSVGPaint nsStyleSVG::* aPaint)
SVGObserverUtils::GetPaintURI(nsIFrame* aFrame,
nsStyleSVGPaint nsStyleSVG::* aPaint)
{
const nsStyleSVG* svgStyle = aFrame->StyleSVG();
MOZ_ASSERT((svgStyle->*aPaint).Type() ==
@ -1068,7 +1069,7 @@ nsSVGEffects::GetPaintURI(nsIFrame* aFrame,
}
already_AddRefed<nsIURI>
nsSVGEffects::GetMaskURI(nsIFrame* aFrame, uint32_t aIndex)
SVGObserverUtils::GetMaskURI(nsIFrame* aFrame, uint32_t aIndex)
{
const nsStyleSVGReset* svgReset = aFrame->StyleSVGReset();
MOZ_ASSERT(svgReset->mMask.mLayers.Length() > aIndex);

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

@ -426,7 +426,7 @@ private:
nsTHashtable<nsPtrHashKey<nsSVGRenderingObserver> > mObservers;
};
class nsSVGEffects
class SVGObserverUtils
{
public:
typedef mozilla::dom::Element Element;

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

@ -27,7 +27,7 @@
#include "nsIDOMSVGLength.h"
#include "nsISelection.h"
#include "nsQuickSort.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGOuterSVGFrame.h"
#include "nsSVGPaintServerFrame.h"
#include "mozilla/dom/SVGRect.h"
@ -1392,8 +1392,13 @@ private:
/* static */ void
TextNodeCorrespondenceRecorder::RecordCorrespondence(SVGTextFrame* aRoot)
{
TextNodeCorrespondenceRecorder recorder(aRoot);
recorder.Record(aRoot);
if (aRoot->GetStateBits() & NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY) {
// Resolve bidi so that continuation frames are created if necessary:
aRoot->MaybeResolveBidiForAnonymousBlockChild();
TextNodeCorrespondenceRecorder recorder(aRoot);
recorder.Record(aRoot);
aRoot->RemoveStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY);
}
}
void
@ -1728,9 +1733,9 @@ private:
uint32_t
TextFrameIterator::UndisplayedCharacters() const
{
MOZ_ASSERT(!(mRootFrame->PrincipalChildList().FirstChild() &&
NS_SUBTREE_DIRTY(mRootFrame->PrincipalChildList().FirstChild())),
"should have already reflowed the anonymous block child");
MOZ_ASSERT(!(mRootFrame->GetStateBits() &
NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY),
"Text correspondence must be up to date");
if (!mCurrentFrame) {
return mRootFrame->mTrailingUndisplayedCharacters;
@ -2431,7 +2436,7 @@ CharIterator::CharIterator(SVGTextFrame* aSVGTextFrame,
nsIContent* aSubtree,
bool aPostReflow)
: mFilter(aFilter),
mFrameIterator(FrameIfAnonymousChildReflowed(aSVGTextFrame), aSubtree),
mFrameIterator(aSVGTextFrame, aSubtree),
mFrameForTrimCheck(nullptr),
mTrimmedOffset(0),
mTrimmedLength(0),
@ -3407,7 +3412,7 @@ SVGTextFrame::HandleAttributeChangeInDescendant(Element* aElement,
nsIFrame* childElementFrame = aElement->GetPrimaryFrame();
if (childElementFrame) {
childElementFrame->DeleteProperty(
nsSVGEffects::HrefAsTextPathProperty());
SVGObserverUtils::HrefAsTextPathProperty());
NotifyGlyphMetricsChange();
}
}
@ -3779,7 +3784,9 @@ SVGTextFrame::ReflowSVG()
"ReflowSVG mechanism not designed for this");
if (!nsSVGUtils::NeedsReflowSVG(this)) {
NS_ASSERTION(!(mState & NS_STATE_SVG_POSITIONING_DIRTY), "How did this happen?");
MOZ_ASSERT(!HasAnyStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY |
NS_STATE_SVG_POSITIONING_DIRTY),
"How did this happen?");
return;
}
@ -3835,14 +3842,14 @@ SVGTextFrame::ReflowSVG()
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
SVGObserverUtils::UpdateEffects(this);
}
// Now unset the various reflow bits. Do this before calling
// FinishAndStoreOverflow since FinishAndStoreOverflow can require glyph
// positions (to resolve transform-origin).
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
nsOverflowAreas overflowAreas(overflow, overflow);
@ -4067,6 +4074,135 @@ SVGTextFrame::GetSubStringLength(nsIContent* aContent,
uint32_t charnum, uint32_t nchars,
float* aResult)
{
// For some content we cannot (or currently cannot) compute the length
// without reflowing. In those cases we need to fall back to using
// GetSubStringLengthSlowFallback.
//
// We fall back for textPath since we need glyph positioning in order to
// tell if any characters should be ignored due to having fallen off the
// end of the textPath.
//
// We fall back for bidi because GetTrimmedOffsets does not produce the
// correct results for bidi continuations when passed aPostReflow = false.
// XXX It may be possible to determine which continuations to trim from (and
// which sides), but currently we don't do that. It would require us to
// identify the visual (rather than logical) start and end of the line, to
// avoid trimming at line-internal frame boundaries. Maybe nsBidiPresUtils
// methods like GetFrameToRightOf and GetFrameToLeftOf would help?
//
TextFrameIterator frameIter(this);
for (nsTextFrame* frame = frameIter.Current(); frame; frame = frameIter.Next()) {
if (frameIter.TextPathFrame() ||
frame->GetNextContinuation()) {
return GetSubStringLengthSlowFallback(aContent, charnum, nchars, aResult);
}
}
// We only need our text correspondence to be up to date (no need to call
// UpdateGlyphPositioning).
TextNodeCorrespondenceRecorder::RecordCorrespondence(this);
// Convert charnum/nchars from addressable characters relative to
// aContent to global character indices.
CharIterator chit(this, CharIterator::eAddressable, aContent,
/* aPostReflow */ false);
if (!chit.AdvanceToSubtree() ||
!chit.Next(charnum) ||
chit.IsAfterSubtree()) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
// We do this after the NS_ERROR_DOM_INDEX_SIZE_ERR return so JS calls
// correctly throw when necessary.
if (nchars == 0) {
*aResult = 0.0f;
return NS_OK;
}
charnum = chit.TextElementCharIndex();
chit.NextWithinSubtree(nchars);
nchars = chit.TextElementCharIndex() - charnum;
// Sum of the substring advances.
nscoord textLength = 0;
TextFrameIterator frit(this); // aSubtree = nullptr
// Index of the first non-skipped char in the frame, and of a subsequent char
// that we're interested in. Both are relative to the index of the first
// non-skipped char in the ancestor <text> element.
uint32_t frameStartTextElementCharIndex = 0;
uint32_t textElementCharIndex;
for (nsTextFrame* frame = frit.Current(); frame; frame = frit.Next()) {
frameStartTextElementCharIndex += frit.UndisplayedCharacters();
textElementCharIndex = frameStartTextElementCharIndex;
// Offset into frame's nsTextNode:
const uint32_t untrimmedOffset = frame->GetContentOffset();
const uint32_t untrimmedLength = frame->GetContentEnd() - untrimmedOffset;
// Trim the offset/length to remove any leading/trailing white space.
uint32_t trimmedOffset = untrimmedOffset;
uint32_t trimmedLength = untrimmedLength;
nsTextFrame::TrimmedOffsets trimmedOffsets =
frame->GetTrimmedOffsets(frame->GetContent()->GetText(),
/* aTrimAfter */ true,
/* aPostReflow */ false);
TrimOffsets(trimmedOffset, trimmedLength, trimmedOffsets);
textElementCharIndex += trimmedOffset - untrimmedOffset;
if (textElementCharIndex >= charnum + nchars) {
break; // we're past the end of the substring
}
uint32_t offset = textElementCharIndex;
// Intersect the substring we are interested in with the range covered by
// the nsTextFrame.
IntersectInterval(offset, trimmedLength, charnum, nchars);
if (trimmedLength != 0) {
// Convert offset into an index into the frame.
offset += trimmedOffset - textElementCharIndex;
gfxSkipCharsIterator skipCharsIter =
frame->EnsureTextRun(nsTextFrame::eInflated);
gfxTextRun* textRun = frame->GetTextRun(nsTextFrame::eInflated);
Range range =
ConvertOriginalToSkipped(skipCharsIter, offset, trimmedLength);
// Accumulate the advance.
textLength += textRun->GetAdvanceWidth(range, nullptr);
}
// Advance, ready for next call:
frameStartTextElementCharIndex += untrimmedLength;
}
nsPresContext* presContext = PresContext();
float cssPxPerDevPx = presContext->
AppUnitsToFloatCSSPixels(presContext->AppUnitsPerDevPixel());
*aResult = presContext->AppUnitsToGfxUnits(textLength) *
cssPxPerDevPx / mFontSizeScaleFactor;
return NS_OK;
}
nsresult
SVGTextFrame::GetSubStringLengthSlowFallback(nsIContent* aContent,
uint32_t charnum, uint32_t nchars,
float* aResult)
{
// We need to make sure that we've been reflowed before updating the glyph
// positioning.
// XXX perf: It may be possible to limit reflow to just calling ReflowSVG,
// but we would still need to resort to full reflow for percentage
// positioning attributes. For now we just do a full reflow regardless since
// the cases that would cause us to be called are relatively uncommon.
PresContext()->PresShell()->FlushPendingNotifications(FlushType::Layout);
UpdateGlyphPositioning();
// Convert charnum/nchars from addressable characters relative to
@ -4809,7 +4945,7 @@ SVGPathElement*
SVGTextFrame::GetTextPathPathElement(nsIFrame* aTextPathFrame)
{
nsSVGTextPathProperty *property =
aTextPathFrame->GetProperty(nsSVGEffects::HrefAsTextPathProperty());
aTextPathFrame->GetProperty(SVGObserverUtils::HrefAsTextPathProperty());
if (!property) {
nsIContent* content = aTextPathFrame->GetContent();
@ -4832,10 +4968,10 @@ SVGTextFrame::GetTextPathPathElement(nsIFrame* aTextPathFrame)
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
content->GetUncomposedDoc(), base);
property = nsSVGEffects::GetTextPathProperty(
property = SVGObserverUtils::GetTextPathProperty(
targetURI,
aTextPathFrame,
nsSVGEffects::HrefAsTextPathProperty());
SVGObserverUtils::HrefAsTextPathProperty());
if (!property)
return nullptr;
}
@ -5036,6 +5172,10 @@ SVGTextFrame::DoGlyphPositioning()
return;
}
// Since we can be called directly via GetBBoxContribution, our correspondence
// may not be up to date.
TextNodeCorrespondenceRecorder::RecordCorrespondence(this);
// Determine the positions of each character in app units.
nsTArray<nsPoint> charPositions;
DetermineCharPositions(charPositions);
@ -5222,7 +5362,11 @@ SVGTextFrame::ScheduleReflowSVG()
void
SVGTextFrame::NotifyGlyphMetricsChange()
{
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
// TODO: perf - adding NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY is overly
// aggressive here. Ideally we would only set that bit when our descendant
// frame tree changes (i.e. after frame construction).
AddStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY |
NS_STATE_SVG_POSITIONING_DIRTY);
nsLayoutUtils::PostRestyleEvent(
mContent->AsElement(), nsRestyleHint(0),
nsChangeHint_InvalidateRenderingObservers);
@ -5274,6 +5418,9 @@ SVGTextFrame::MaybeReflowAnonymousBlockChild()
// by nsSVGDisplayContainerFrame::ReflowSVG.)
kid->AddStateBits(NS_FRAME_IS_DIRTY);
}
TextNodeCorrespondenceRecorder::RecordCorrespondence(this);
MOZ_ASSERT(nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(this),
"should be under ReflowSVG");
nsPresContext::InterruptPreventer noInterrupts(PresContext());
@ -5286,7 +5433,12 @@ SVGTextFrame::DoReflow()
{
// Since we are going to reflow the anonymous block frame, we will
// need to update mPositions.
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
// We also mark our text correspondence as dirty since we can end up needing
// reflow in ways that do not set NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY.
// (We'd then fail the "expected a TextNodeCorrespondenceProperty" assertion
// when UpdateGlyphPositioning() is called after we return.)
AddStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY |
NS_STATE_SVG_POSITIONING_DIRTY);
if (mState & NS_FRAME_IS_NONDISPLAY) {
// Normally, these dirty flags would be cleared in ReflowSVG(), but that
@ -5298,7 +5450,7 @@ SVGTextFrame::DoReflow()
// observers, which reschedules the frame that is currently painting by
// referencing us to paint again. See bug 839958 comment 7. Hopefully we
// will break that loop more convincingly at some point.
mState &= ~(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
}
nsPresContext *presContext = PresContext();
@ -5315,7 +5467,7 @@ SVGTextFrame::DoReflow()
kid->MarkIntrinsicISizesDirty();
}
mState |= NS_STATE_SVG_TEXT_IN_REFLOW;
AddStateBits(NS_STATE_SVG_TEXT_IN_REFLOW);
nscoord inlineSize = kid->GetPrefISize(renderingContext);
WritingMode wm = kid->GetWritingMode();
@ -5335,9 +5487,7 @@ SVGTextFrame::DoReflow()
kid->DidReflow(presContext, &reflowInput, nsDidReflowStatus::FINISHED);
kid->SetSize(wm, desiredSize.Size(wm));
mState &= ~NS_STATE_SVG_TEXT_IN_REFLOW;
TextNodeCorrespondenceRecorder::RecordCorrespondence(this);
RemoveStateBits(NS_STATE_SVG_TEXT_IN_REFLOW);
}
// Usable font size range in devpixels / user-units

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

@ -203,7 +203,8 @@ protected:
, mLastContextScale(1.0f)
, mLengthAdjustScaleFactor(1.0f)
{
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
AddStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY |
NS_STATE_SVG_POSITIONING_DIRTY);
}
~SVGTextFrame() {}
@ -417,6 +418,18 @@ private:
*/
void DoGlyphPositioning();
/**
* This fallback version of GetSubStringLength that flushes layout and takes
* into account glyph positioning. As per the SVG 2 spec, typically glyph
* positioning does not affect the results of getSubStringLength, but one
* exception is text in a textPath where we need to ignore characters that
* fall off the end of the textPath path.
*/
nsresult GetSubStringLengthSlowFallback(nsIContent* aContent,
uint32_t charnum,
uint32_t nchars,
float* aResult);
/**
* Converts the specified index into mPositions to an addressable
* character index (as can be used with the SVG DOM text methods)

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

@ -17,7 +17,6 @@ if CONFIG['ENABLE_TESTS']:
EXPORTS += [
'nsFilterInstance.h',
'nsSVGEffects.h',
'nsSVGFilterInstance.h',
'nsSVGForeignObjectFrame.h',
'nsSVGImageFrame.h',
@ -25,6 +24,7 @@ EXPORTS += [
'nsSVGUseFrame.h',
'nsSVGUtils.h',
'SVGImageContext.h',
'SVGObserverUtils.h',
]
EXPORTS.mozilla += [
@ -38,7 +38,6 @@ UNIFIED_SOURCES += [
'nsSVGAFrame.cpp',
'nsSVGClipPathFrame.cpp',
'nsSVGContainerFrame.cpp',
'nsSVGEffects.cpp',
'nsSVGFilterFrame.cpp',
'nsSVGFilterInstance.cpp',
'nsSVGForeignObjectFrame.cpp',
@ -65,6 +64,7 @@ UNIFIED_SOURCES += [
'SVGFEUnstyledLeafFrame.cpp',
'SVGGeometryFrame.cpp',
'SVGImageContext.cpp',
'SVGObserverUtils.cpp',
'SVGTextFrame.cpp',
'SVGViewFrame.cpp',
]

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

@ -12,7 +12,7 @@
#include "gfxContext.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "nsGkAtoms.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
#include "nsSVGUtils.h"
@ -146,7 +146,7 @@ nsSVGClipPathFrame::PaintClipMask(gfxContext& aMaskContext,
// Check if this clipPath is itself clipped by another clipPath:
nsSVGClipPathFrame* clipPathThatClipsClipPath =
nsSVGEffects::GetEffectProperties(this).GetClipPathFrame();
SVGObserverUtils::GetEffectProperties(this).GetClipPathFrame();
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(this, true, maskUsage);
@ -202,8 +202,8 @@ nsSVGClipPathFrame::PaintFrameIntoMask(nsIFrame *aFrame,
frame->NotifySVGChanged(nsSVGDisplayableFrame::TRANSFORM_CHANGED);
// Children of this clipPath may themselves be clipped.
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(aFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(aFrame);
if (effectProperties.HasInvalidClipPath()) {
return;
}
@ -306,7 +306,7 @@ nsSVGClipPathFrame::PointIsInsideClipPath(nsIFrame* aClippedFrame,
// different clip path we need to check if it prevents the original element
// from recieving events at aPoint:
nsSVGClipPathFrame *clipPathFrame =
nsSVGEffects::GetEffectProperties(this).GetClipPathFrame();
SVGObserverUtils::GetEffectProperties(this).GetClipPathFrame();
if (clipPathFrame &&
!clipPathFrame->PointIsInsideClipPath(aClippedFrame, aPoint)) {
return false;
@ -338,7 +338,7 @@ bool
nsSVGClipPathFrame::IsTrivial(nsSVGDisplayableFrame **aSingleChild)
{
// If the clip path is clipped then it's non-trivial
if (nsSVGEffects::GetEffectProperties(this).GetClipPathFrame())
if (SVGObserverUtils::GetEffectProperties(this).GetClipPathFrame())
return false;
if (aSingleChild) {
@ -357,7 +357,7 @@ nsSVGClipPathFrame::IsTrivial(nsSVGDisplayableFrame **aSingleChild)
return false;
// or where the child is itself clipped
if (nsSVGEffects::GetEffectProperties(kid).GetClipPathFrame())
if (SVGObserverUtils::GetEffectProperties(kid).GetClipPathFrame())
return false;
foundChild = svgChild;
@ -383,7 +383,7 @@ nsSVGClipPathFrame::IsValid()
return false; // Break reference chain
}
if (nsSVGEffects::GetEffectProperties(this).HasInvalidClipPath()) {
if (SVGObserverUtils::GetEffectProperties(this).HasInvalidClipPath()) {
return false;
}
@ -421,12 +421,12 @@ nsSVGClipPathFrame::AttributeChanged(int32_t aNameSpaceID,
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::transform) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
nsSVGUtils::NotifyChildrenOfSVGChange(this,
nsSVGDisplayableFrame::TRANSFORM_CHANGED);
}
if (aAttribute == nsGkAtoms::clipPathUnits) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
}
@ -486,8 +486,8 @@ nsSVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox &aBBox,
if (svg) {
tmpBBox = svg->GetBBoxContribution(mozilla::gfx::ToMatrix(aMatrix),
nsSVGUtils::eBBoxIncludeFill);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(frame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(frame);
if (effectProperties.HasNoOrValidClipPath()) {
nsSVGClipPathFrame *clipPathFrame =
effectProperties.GetClipPathFrame();
@ -501,8 +501,8 @@ nsSVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox &aBBox,
}
}
nsSVGEffects::EffectProperties props =
nsSVGEffects::GetEffectProperties(this);
SVGObserverUtils::EffectProperties props =
SVGObserverUtils::GetEffectProperties(this);
if (props.mClipPath) {
if (props.HasInvalidClipPath()) {
unionBBox = SVGBBox();

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

@ -11,7 +11,7 @@
#include "mozilla/RestyleManager.h"
#include "mozilla/RestyleManagerInlines.h"
#include "nsCSSFrameConstructor.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGElement.h"
#include "nsSVGUtils.h"
#include "nsSVGAnimatedTransformList.h"
@ -200,7 +200,7 @@ void
nsSVGDisplayContainerFrame::RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame)
{
nsSVGEffects::InvalidateRenderingObservers(aOldFrame);
SVGObserverUtils::InvalidateRenderingObservers(aOldFrame);
// nsSVGContainerFrame::RemoveFrame doesn't call down into
// nsContainerFrame::RemoveFrame, so it doesn't call FrameNeedsReflow. We
@ -334,7 +334,7 @@ nsSVGDisplayContainerFrame::ReflowSVG()
(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) == 0;
if (outerSVGHasHadFirstReflow) {
mState &= ~NS_FRAME_FIRST_REFLOW; // tell our children
RemoveStateBits(NS_FRAME_FIRST_REFLOW); // tell our children
}
nsOverflowAreas overflowRects;
@ -384,15 +384,15 @@ nsSVGDisplayContainerFrame::ReflowSVG()
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
SVGObserverUtils::UpdateEffects(this);
}
FinishAndStoreOverflow(overflowRects, mRect.Size());
// Remove state bits after FinishAndStoreOverflow so that it doesn't
// invalidate on first reflow:
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
}
void

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

@ -10,7 +10,7 @@
#include "AutoReferenceChainGuard.h"
#include "gfxUtils.h"
#include "nsGkAtoms.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGElement.h"
#include "mozilla/dom/SVGFilterElement.h"
#include "nsSVGFilterInstance.h"
@ -117,7 +117,7 @@ nsSVGFilterFrame::GetReferencedFilter()
return nullptr;
nsSVGPaintingProperty *property =
GetProperty(nsSVGEffects::HrefAsPaintingProperty());
GetProperty(SVGObserverUtils::HrefAsPaintingProperty());
if (!property) {
// Fetch our Filter element's href or xlink:href attribute
@ -143,8 +143,8 @@ nsSVGFilterFrame::GetReferencedFilter()
mContent->GetUncomposedDoc(), base);
property =
nsSVGEffects::GetPaintingProperty(targetURI, this,
nsSVGEffects::HrefAsPaintingProperty());
SVGObserverUtils::GetPaintingProperty(targetURI, this,
SVGObserverUtils::HrefAsPaintingProperty());
if (!property)
return nullptr;
}
@ -172,15 +172,15 @@ nsSVGFilterFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::height ||
aAttribute == nsGkAtoms::filterUnits ||
aAttribute == nsGkAtoms::primitiveUnits)) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
} else if ((aNameSpaceID == kNameSpaceID_XLink ||
aNameSpaceID == kNameSpaceID_None) &&
aAttribute == nsGkAtoms::href) {
// Blow away our reference, if any
DeleteProperty(nsSVGEffects::HrefAsPaintingProperty());
DeleteProperty(SVGObserverUtils::HrefAsPaintingProperty());
mNoHRefURI = false;
// And update whoever references us
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGContainerFrame::AttributeChanged(aNameSpaceID,
aAttribute, aModType);

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

@ -13,7 +13,7 @@
#include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/dom/SVGFilterElement.h"
#include "nsReferencedElement.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGFilterFrame.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
@ -126,7 +126,7 @@ nsSVGFilterInstance::GetFilterFrame(nsIFrame* aTargetFrame)
// aTargetFrame can be null if this filter belongs to a
// CanvasRenderingContext2D.
nsCOMPtr<nsIURI> url = aTargetFrame
? nsSVGEffects::GetFilterURI(aTargetFrame, mFilter)
? SVGObserverUtils::GetFilterURI(aTargetFrame, mFilter)
: mFilter.GetURL()->ResolveLocalRef(mTargetContent);
if (!url) {

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

@ -15,7 +15,7 @@
#include "nsLayoutUtils.h"
#include "nsRegion.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "mozilla/dom/SVGForeignObjectElement.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGOuterSVGFrame.h"
@ -360,7 +360,7 @@ nsSVGForeignObjectFrame::ReflowSVG()
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
SVGObserverUtils::UpdateEffects(this);
}
// If we have a filter, we need to invalidate ourselves because filter
@ -376,8 +376,8 @@ nsSVGForeignObjectFrame::ReflowSVG()
FinishAndStoreOverflow(overflowAreas, mRect.Size());
// Now unset the various reflow bits:
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
}
void

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

@ -13,7 +13,7 @@
#include "mozilla/dom/SVGGradientElement.h"
#include "mozilla/dom/SVGStopElement.h"
#include "nsContentUtils.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGAnimatedTransformList.h"
// XXX Tight coupling with content classes ahead!
@ -46,15 +46,15 @@ nsSVGGradientFrame::AttributeChanged(int32_t aNameSpaceID,
(aAttribute == nsGkAtoms::gradientUnits ||
aAttribute == nsGkAtoms::gradientTransform ||
aAttribute == nsGkAtoms::spreadMethod)) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
} else if ((aNameSpaceID == kNameSpaceID_XLink ||
aNameSpaceID == kNameSpaceID_None) &&
aAttribute == nsGkAtoms::href) {
// Blow away our reference, if any
DeleteProperty(nsSVGEffects::HrefAsPaintingProperty());
DeleteProperty(SVGObserverUtils::HrefAsPaintingProperty());
mNoHRefURI = false;
// And update whoever references us
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGPaintServerFrame::AttributeChanged(aNameSpaceID,
@ -335,7 +335,7 @@ nsSVGGradientFrame::GetReferencedGradient()
return nullptr;
nsSVGPaintingProperty *property =
GetProperty(nsSVGEffects::HrefAsPaintingProperty());
GetProperty(SVGObserverUtils::HrefAsPaintingProperty());
if (!property) {
// Fetch our gradient element's href or xlink:href attribute
@ -363,8 +363,8 @@ nsSVGGradientFrame::GetReferencedGradient()
mContent->GetUncomposedDoc(), base);
property =
nsSVGEffects::GetPaintingProperty(targetURI, this,
nsSVGEffects::HrefAsPaintingProperty());
SVGObserverUtils::GetPaintingProperty(targetURI, this,
SVGObserverUtils::HrefAsPaintingProperty());
if (!property)
return nullptr;
}
@ -440,7 +440,7 @@ nsSVGLinearGradientFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::y1 ||
aAttribute == nsGkAtoms::x2 ||
aAttribute == nsGkAtoms::y2)) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGGradientFrame::AttributeChanged(aNameSpaceID,
@ -543,7 +543,7 @@ nsSVGRadialGradientFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::cy ||
aAttribute == nsGkAtoms::fx ||
aAttribute == nsGkAtoms::fy)) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGGradientFrame::AttributeChanged(aNameSpaceID,

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

@ -15,7 +15,7 @@
#include "nsIImageLoadingContent.h"
#include "nsLayoutUtils.h"
#include "imgINotificationObserver.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
@ -448,7 +448,7 @@ nsSVGImageFrame::ReflowSVG()
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
SVGObserverUtils::UpdateEffects(this);
if (!mReflowCallbackPosted) {
nsIPresShell* shell = PresContext()->PresShell();
@ -461,8 +461,8 @@ nsSVGImageFrame::ReflowSVG()
nsOverflowAreas overflowAreas(overflow, overflow);
FinishAndStoreOverflow(overflowAreas, mRect.Size());
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
// Invalidate, but only if this is not our first reflow (since if it is our
// first reflow then we haven't had our first paint yet).

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

@ -16,7 +16,7 @@
#include "nsIImageLoadingContent.h"
#include "nsLayoutUtils.h"
#include "imgINotificationObserver.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"

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

@ -16,7 +16,7 @@
#include "nsLayoutUtils.h"
#include "gfxContext.h"
#include "nsSVGClipPathFrame.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGElement.h"
#include "nsSVGFilterPaintCallback.h"
#include "nsSVGMaskFrame.h"
@ -284,8 +284,8 @@ nsRect
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
if (!effectProperties.HasValidFilter()) {
return aPreEffectsOverflowRect;
}
@ -324,7 +324,7 @@ nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(nsIFrame* aFrame,
// already have been set up during reflow/ComputeFrameEffectsRect
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsSVGFilterProperty *prop = nsSVGEffects::GetFilterProperty(firstFrame);
nsSVGFilterProperty *prop = SVGObserverUtils::GetFilterProperty(firstFrame);
if (!prop || !prop->IsInObserverLists()) {
return aInvalidRegion;
}
@ -364,7 +364,7 @@ nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(nsIFrame* aFrame,
// already have been set up during reflow/ComputeFrameEffectsRect
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsSVGFilterProperty *prop = nsSVGEffects::GetFilterProperty(firstFrame);
nsSVGFilterProperty *prop = SVGObserverUtils::GetFilterProperty(firstFrame);
if (!prop || !prop->ReferencesValidResources()) {
return aDirtyRect;
}
@ -721,8 +721,8 @@ nsSVGIntegrationUtils::IsMaskResourceReady(nsIFrame* aFrame)
{
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
nsTArray<nsSVGMaskFrame*> maskFrames = effectProperties.GetMaskFrames();
const nsStyleSVGReset* svgReset = firstFrame->StyleSVGReset();
@ -776,8 +776,8 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
gfxContext& ctx = aParams.ctx;
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(frame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
RefPtr<DrawTarget> maskTarget = ctx.GetDrawTarget();
@ -895,8 +895,8 @@ nsSVGIntegrationUtils::PaintMaskAndClipPath(const PaintFramesParams& aParams)
so make sure all applicable ones are set again. */
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(frame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame();
@ -1073,8 +1073,8 @@ nsSVGIntegrationUtils::PaintFilter(const PaintFramesParams& aParams)
so make sure all applicable ones are set again. */
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(frame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
if (effectProperties.HasInvalidFilter()) {
return;

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

@ -8,7 +8,7 @@
// Keep others in (case-insensitive) order:
#include "gfxContext.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "mozilla/dom/SVGMarkerElement.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
@ -42,7 +42,7 @@ nsSVGMarkerFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::orient ||
aAttribute == nsGkAtoms::preserveAspectRatio ||
aAttribute == nsGkAtoms::viewBox)) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGContainerFrame::AttributeChanged(aNameSpaceID,

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

@ -12,7 +12,7 @@
#include "gfxContext.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "mozilla/dom/SVGMaskElement.h"
using namespace mozilla;
@ -191,7 +191,7 @@ nsSVGMaskFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::height||
aAttribute == nsGkAtoms::maskUnits ||
aAttribute == nsGkAtoms::maskContentUnits)) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGContainerFrame::AttributeChanged(aNameSpaceID,

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

@ -18,7 +18,7 @@
#include "nsGkAtoms.h"
#include "nsSVGDisplayableFrame.h"
#include "nsStyleContext.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "SVGGeometryFrame.h"
#include "mozilla/dom/SVGPatternElement.h"
#include "nsSVGUtils.h"
@ -61,17 +61,17 @@ nsSVGPatternFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::height ||
aAttribute == nsGkAtoms::preserveAspectRatio ||
aAttribute == nsGkAtoms::viewBox)) {
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
if ((aNameSpaceID == kNameSpaceID_XLink ||
aNameSpaceID == kNameSpaceID_None) &&
aAttribute == nsGkAtoms::href) {
// Blow away our reference, if any
DeleteProperty(nsSVGEffects::HrefAsPaintingProperty());
DeleteProperty(SVGObserverUtils::HrefAsPaintingProperty());
mNoHRefURI = false;
// And update whoever references us
nsSVGEffects::InvalidateDirectRenderingObservers(this);
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGPaintServerFrame::AttributeChanged(aNameSpaceID,
@ -577,7 +577,7 @@ nsSVGPatternFrame::GetReferencedPattern()
return nullptr;
nsSVGPaintingProperty *property =
GetProperty(nsSVGEffects::HrefAsPaintingProperty());
GetProperty(SVGObserverUtils::HrefAsPaintingProperty());
if (!property) {
// Fetch our pattern element's href or xlink:href attribute
@ -603,8 +603,8 @@ nsSVGPatternFrame::GetReferencedPattern()
mContent->GetUncomposedDoc(), base);
property =
nsSVGEffects::GetPaintingProperty(targetURI, this,
nsSVGEffects::HrefAsPaintingProperty());
SVGObserverUtils::GetPaintingProperty(targetURI, this,
SVGObserverUtils::HrefAsPaintingProperty());
if (!property)
return nullptr;
}

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

@ -8,7 +8,7 @@
#include "nsFrame.h"
#include "nsGkAtoms.h"
#include "nsStyleContext.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
// This is a very simple frame whose only purpose is to capture style change
// events and propagate them to the parent. Most of the heavy lifting is done
@ -85,7 +85,7 @@ nsSVGStopFrame::AttributeChanged(int32_t aNameSpaceID,
MOZ_ASSERT(GetParent()->IsSVGLinearGradientFrame() ||
GetParent()->IsSVGRadialGradientFrame(),
"Observers observe the gradient, so that's what we must invalidate");
nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent());
}
return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);

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

@ -5,7 +5,7 @@
// Keep in (case-insensitive) order:
#include "gfxRect.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGGFrame.h"
#include "mozilla/dom/SVGSwitchElement.h"
#include "nsSVGUtils.h"
@ -172,7 +172,7 @@ nsSVGSwitchFrame::ReflowSVG()
(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) == 0;
if (outerSVGHasHadFirstReflow) {
mState &= ~NS_FRAME_FIRST_REFLOW; // tell our children
RemoveStateBits(NS_FRAME_FIRST_REFLOW); // tell our children
}
nsOverflowAreas overflowRects;
@ -194,15 +194,15 @@ nsSVGSwitchFrame::ReflowSVG()
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
SVGObserverUtils::UpdateEffects(this);
}
FinishAndStoreOverflow(overflowRects, mRect.Size());
// Remove state bits after FinishAndStoreOverflow so that it doesn't
// invalidate on first reflow:
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
}
SVGBBox

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

@ -7,7 +7,7 @@
#include "nsContentUtils.h"
#include "mozilla/dom/SVGUseElement.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
using namespace mozilla::dom;

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

@ -36,7 +36,7 @@
#include "nsStyleStruct.h"
#include "nsSVGClipPathFrame.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGEffects.h"
#include "SVGObserverUtils.h"
#include "nsSVGFilterPaintCallback.h"
#include "nsSVGForeignObjectFrame.h"
#include "nsSVGInnerSVGFrame.h"
@ -155,7 +155,7 @@ nsSVGUtils::GetPostFilterVisualOverflowRect(nsIFrame *aFrame,
MOZ_ASSERT(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT,
"Called on invalid frame type");
nsSVGFilterProperty *property = nsSVGEffects::GetFilterProperty(aFrame);
nsSVGFilterProperty *property = SVGObserverUtils::GetFilterProperty(aFrame);
if (!property || !property->ReferencesValidResources()) {
return aPreFilterRect;
}
@ -194,7 +194,7 @@ nsSVGUtils::ScheduleReflowSVG(nsIFrame *aFrame)
NS_ASSERTION(!OuterSVGIsCallingReflowSVG(aFrame),
"Do not call under nsSVGDisplayableFrame::ReflowSVG!");
// We don't call nsSVGEffects::InvalidateRenderingObservers here because
// We don't call SVGObserverUtils::InvalidateRenderingObservers here because
// we should only be called under InvalidateAndScheduleReflowSVG (which
// calls InvalidateBounds) or nsSVGDisplayContainerFrame::InsertFrames
// (at which point the frame has no observers).
@ -274,7 +274,7 @@ nsSVGUtils::NotifyAncestorsOfFilterRegionChange(nsIFrame *aFrame)
if (aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG)
return;
nsSVGFilterProperty *property = nsSVGEffects::GetFilterProperty(aFrame);
nsSVGFilterProperty *property = SVGObserverUtils::GetFilterProperty(aFrame);
if (property) {
property->Invalidate();
}
@ -506,8 +506,8 @@ nsSVGUtils::DetermineMaskUsage(nsIFrame* aFrame, bool aHandleOpacity,
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(firstFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(firstFrame);
const nsStyleSVGReset *svgReset = firstFrame->StyleSVGReset();
nsTArray<nsSVGMaskFrame*> maskFrames = effectProperties.GetMaskFrames();
@ -736,8 +736,8 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
/* Properties are added lazily and may have been removed by a restyle,
so make sure all applicable ones are set again. */
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(aFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(aFrame);
if (effectProperties.HasInvalidEffects()) {
// Some resource is invalid. We shouldn't paint anything.
return;
@ -888,8 +888,8 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
bool
nsSVGUtils::HitTestClip(nsIFrame *aFrame, const gfxPoint &aPoint)
{
nsSVGEffects::EffectProperties props =
nsSVGEffects::GetEffectProperties(aFrame);
SVGObserverUtils::EffectProperties props =
SVGObserverUtils::GetEffectProperties(aFrame);
if (!props.mClipPath) {
const nsStyleSVGReset *style = aFrame->StyleSVGReset();
if (style->HasClipPath()) {
@ -1178,8 +1178,8 @@ nsSVGUtils::GetBBox(nsIFrame* aFrame, uint32_t aFlags,
clipRect = matrix.TransformBounds(clipRect);
}
}
nsSVGEffects::EffectProperties effectProperties =
nsSVGEffects::GetEffectProperties(aFrame);
SVGObserverUtils::EffectProperties effectProperties =
SVGObserverUtils::GetEffectProperties(aFrame);
if (effectProperties.HasInvalidClipPath()) {
bbox = gfxRect(0, 0, 0, 0);
} else {
@ -1506,8 +1506,8 @@ nsSVGUtils::MakeFillPatternFor(nsIFrame* aFrame,
const DrawTarget* dt = aContext->GetDrawTarget();
nsSVGPaintServerFrame *ps =
nsSVGEffects::GetPaintServer(aFrame, &nsStyleSVG::mFill,
nsSVGEffects::FillProperty());
SVGObserverUtils::GetPaintServer(aFrame, &nsStyleSVG::mFill,
SVGObserverUtils::FillProperty());
if (ps) {
RefPtr<gfxPattern> pattern =
@ -1582,8 +1582,8 @@ nsSVGUtils::MakeStrokePatternFor(nsIFrame* aFrame,
const DrawTarget* dt = aContext->GetDrawTarget();
nsSVGPaintServerFrame *ps =
nsSVGEffects::GetPaintServer(aFrame, &nsStyleSVG::mStroke,
nsSVGEffects::StrokeProperty());
SVGObserverUtils::GetPaintServer(aFrame, &nsStyleSVG::mStroke,
SVGObserverUtils::StrokeProperty());
if (ps) {
RefPtr<gfxPattern> pattern =

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

@ -131,7 +131,7 @@ nsBox::BeginXULLayout(nsBoxLayoutState& aState)
// mark ourselves as dirty so no child under us
// can post an incremental layout.
// XXXldb Is this still needed?
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
if (GetStateBits() & NS_FRAME_IS_DIRTY)
{

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

@ -124,11 +124,10 @@ nsBoxFrame::nsBoxFrame(nsStyleContext* aContext,
, mFlex(0)
, mAscent(0)
{
mState |= NS_STATE_IS_HORIZONTAL;
mState |= NS_STATE_AUTO_STRETCH;
AddStateBits(NS_STATE_IS_HORIZONTAL | NS_STATE_AUTO_STRETCH);
if (aIsRoot)
mState |= NS_STATE_IS_ROOT;
AddStateBits(NS_STATE_IS_ROOT);
mValign = vAlign_Top;
mHalign = hAlign_Left;
@ -235,16 +234,16 @@ nsBoxFrame::CacheAttributes()
bool orient = false;
GetInitialOrientation(orient);
if (orient)
mState |= NS_STATE_IS_HORIZONTAL;
AddStateBits(NS_STATE_IS_HORIZONTAL);
else
mState &= ~NS_STATE_IS_HORIZONTAL;
RemoveStateBits(NS_STATE_IS_HORIZONTAL);
bool normal = true;
GetInitialDirection(normal);
if (normal)
mState |= NS_STATE_IS_DIRECTION_NORMAL;
AddStateBits(NS_STATE_IS_DIRECTION_NORMAL);
else
mState &= ~NS_STATE_IS_DIRECTION_NORMAL;
RemoveStateBits(NS_STATE_IS_DIRECTION_NORMAL);
GetInitialVAlignment(mValign);
GetInitialHAlignment(mHalign);
@ -252,29 +251,29 @@ nsBoxFrame::CacheAttributes()
bool equalSize = false;
GetInitialEqualSize(equalSize);
if (equalSize)
mState |= NS_STATE_EQUAL_SIZE;
AddStateBits(NS_STATE_EQUAL_SIZE);
else
mState &= ~NS_STATE_EQUAL_SIZE;
RemoveStateBits(NS_STATE_EQUAL_SIZE);
bool autostretch = !!(mState & NS_STATE_AUTO_STRETCH);
GetInitialAutoStretch(autostretch);
if (autostretch)
mState |= NS_STATE_AUTO_STRETCH;
AddStateBits(NS_STATE_AUTO_STRETCH);
else
mState &= ~NS_STATE_AUTO_STRETCH;
RemoveStateBits(NS_STATE_AUTO_STRETCH);
#ifdef DEBUG_LAYOUT
bool debug = mState & NS_STATE_SET_TO_DEBUG;
bool debugSet = GetInitialDebug(debug);
if (debugSet) {
mState |= NS_STATE_DEBUG_WAS_SET;
AddStateBits(NS_STATE_DEBUG_WAS_SET);
if (debug)
mState |= NS_STATE_SET_TO_DEBUG;
AddStateBits(NS_STATE_SET_TO_DEBUG);
else
mState &= ~NS_STATE_SET_TO_DEBUG;
RemoveStateBits(NS_STATE_SET_TO_DEBUG);
} else {
mState &= ~NS_STATE_DEBUG_WAS_SET;
RemoveStateBits(NS_STATE_DEBUG_WAS_SET);
}
#endif
}
@ -566,7 +565,7 @@ nsBoxFrame::DidReflow(nsPresContext* aPresContext,
nsFrameState preserveBits =
mState & (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
nsFrame::DidReflow(aPresContext, aReflowInput, aStatus);
mState |= preserveBits;
AddStateBits(preserveBits);
}
bool
@ -980,9 +979,9 @@ nsBoxFrame::SetXULDebug(nsBoxLayoutState& aState, bool aDebug)
if (debugChanged)
{
if (aDebug) {
mState |= NS_STATE_CURRENTLY_IN_DEBUG;
AddStateBits(NS_STATE_CURRENTLY_IN_DEBUG);
} else {
mState &= ~NS_STATE_CURRENTLY_IN_DEBUG;
RemoveStateBits(NS_STATE_CURRENTLY_IN_DEBUG);
}
SetDebugOnChildList(aState, mFirstChild, aDebug);
@ -1174,16 +1173,16 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID,
bool orient = true;
GetInitialOrientation(orient);
if (orient)
mState |= NS_STATE_IS_HORIZONTAL;
AddStateBits(NS_STATE_IS_HORIZONTAL);
else
mState &= ~NS_STATE_IS_HORIZONTAL;
RemoveStateBits(NS_STATE_IS_HORIZONTAL);
bool normal = true;
GetInitialDirection(normal);
if (normal)
mState |= NS_STATE_IS_DIRECTION_NORMAL;
AddStateBits(NS_STATE_IS_DIRECTION_NORMAL);
else
mState &= ~NS_STATE_IS_DIRECTION_NORMAL;
RemoveStateBits(NS_STATE_IS_DIRECTION_NORMAL);
GetInitialVAlignment(mValign);
GetInitialHAlignment(mHalign);
@ -1191,31 +1190,31 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID,
bool equalSize = false;
GetInitialEqualSize(equalSize);
if (equalSize)
mState |= NS_STATE_EQUAL_SIZE;
AddStateBits(NS_STATE_EQUAL_SIZE);
else
mState &= ~NS_STATE_EQUAL_SIZE;
RemoveStateBits(NS_STATE_EQUAL_SIZE);
#ifdef DEBUG_LAYOUT
bool debug = mState & NS_STATE_SET_TO_DEBUG;
bool debugSet = GetInitialDebug(debug);
if (debugSet) {
mState |= NS_STATE_DEBUG_WAS_SET;
AddStateBits(NS_STATE_DEBUG_WAS_SET);
if (debug)
mState |= NS_STATE_SET_TO_DEBUG;
AddStateBits(NS_STATE_SET_TO_DEBUG);
else
mState &= ~NS_STATE_SET_TO_DEBUG;
RemoveStateBits(NS_STATE_SET_TO_DEBUG);
} else {
mState &= ~NS_STATE_DEBUG_WAS_SET;
RemoveStateBits(NS_STATE_DEBUG_WAS_SET);
}
#endif
bool autostretch = !!(mState & NS_STATE_AUTO_STRETCH);
GetInitialAutoStretch(autostretch);
if (autostretch)
mState |= NS_STATE_AUTO_STRETCH;
AddStateBits(NS_STATE_AUTO_STRETCH);
else
mState &= ~NS_STATE_AUTO_STRETCH;
RemoveStateBits(NS_STATE_AUTO_STRETCH);
}
else if (aAttribute == nsGkAtoms::left ||
aAttribute == nsGkAtoms::top ||
@ -1223,7 +1222,7 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::bottom ||
aAttribute == nsGkAtoms::start ||
aAttribute == nsGkAtoms::end) {
mState &= ~NS_STATE_STACK_NOT_POSITIONED;
RemoveStateBits(NS_STATE_STACK_NOT_POSITIONED);
}
else if (aAttribute == nsGkAtoms::mousethrough) {
UpdateMouseThrough();

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

@ -51,7 +51,7 @@ nsScrollbarFrame::Init(nsIContent* aContent,
// slider. Any reflow inside the scrollbar frame will be a reflow to
// move the slider and will thus not change anything outside of the
// scrollbar or change the size of the scrollbar frame.
mState |= NS_FRAME_REFLOW_ROOT;
AddStateBits(NS_FRAME_REFLOW_ROOT);
}
void

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

@ -1532,9 +1532,9 @@ nsSliderFrame::EnsureOrient()
bool isHorizontal = (scrollbarBox->GetStateBits() & NS_STATE_IS_HORIZONTAL) != 0;
if (isHorizontal)
mState |= NS_STATE_IS_HORIZONTAL;
AddStateBits(NS_STATE_IS_HORIZONTAL);
else
mState &= ~NS_STATE_IS_HORIZONTAL;
RemoveStateBits(NS_STATE_IS_HORIZONTAL);
}

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

@ -884,9 +884,9 @@ nsSplitterFrameInner::EnsureOrient()
{
bool isHorizontal = !(mParentBox->GetStateBits() & NS_STATE_IS_HORIZONTAL);
if (isHorizontal)
mOuter->mState |= NS_STATE_IS_HORIZONTAL;
mOuter->AddStateBits(NS_STATE_IS_HORIZONTAL);
else
mOuter->mState &= ~NS_STATE_IS_HORIZONTAL;
mOuter->RemoveStateBits(NS_STATE_IS_HORIZONTAL);
}
void

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

@ -645,7 +645,7 @@ nsTextBoxFrame::CalculateTitleForWidth(gfxContext& aRenderingContext,
mCroppedTitle = mTitle;
if (HasRTLChars(mTitle) ||
StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
mState |= NS_FRAME_IS_BIDI;
AddStateBits(NS_FRAME_IS_BIDI);
}
return titleWidth; // fits, done.
}
@ -704,7 +704,7 @@ nsTextBoxFrame::CalculateTitleForWidth(gfxContext& aRenderingContext,
}
if (UCS2_CHAR_IS_BIDI(*pos)) {
mState |= NS_FRAME_IS_BIDI;
AddStateBits(NS_FRAME_IS_BIDI);
}
pos = nextPos;
totalWidth += charWidth;
@ -741,7 +741,7 @@ nsTextBoxFrame::CalculateTitleForWidth(gfxContext& aRenderingContext,
}
if (UCS2_CHAR_IS_BIDI(*pos)) {
mState |= NS_FRAME_IS_BIDI;
AddStateBits(NS_FRAME_IS_BIDI);
}
prevPos = pos;
totalWidth += charWidth;
@ -793,7 +793,7 @@ nsTextBoxFrame::CalculateTitleForWidth(gfxContext& aRenderingContext,
}
if (UCS2_CHAR_IS_BIDI(*leftPos)) {
mState |= NS_FRAME_IS_BIDI;
AddStateBits(NS_FRAME_IS_BIDI);
}
leftString.Append(leftPos, length);
@ -815,7 +815,7 @@ nsTextBoxFrame::CalculateTitleForWidth(gfxContext& aRenderingContext,
}
if (UCS2_CHAR_IS_BIDI(*pos)) {
mState |= NS_FRAME_IS_BIDI;
AddStateBits(NS_FRAME_IS_BIDI);
}
rightString.Insert(pos, 0, length);

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

@ -4690,17 +4690,6 @@ RETURN:
return ret;
}
/*
* In ELF systems the default visibility allows symbols to be preempted at
* runtime. This in turn prevents the uses of memalign in this file from being
* optimized. What we do in here is define two aliasing symbols (they point to
* the same code): memalign and memalign_internal. The internal version has
* hidden visibility and is used in every reference from this file.
*
* For more information on this technique, see section 2.2.7 (Avoid Using
* Exported Symbols) in http://www.akkadia.org/drepper/dsohowto.pdf.
*/
template<> inline void*
MozJemalloc::memalign(size_t aAlignment, size_t aSize)
{

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

@ -62,8 +62,8 @@ public final class GeckoViewSettings {
/*
* Key to specify which display-mode we should use
*/
public static final Key<Boolean> DISPLAY_MODE =
new Key<Boolean>("displayMode");
public static final Key<Integer> DISPLAY_MODE =
new Key<Integer>("displayMode");
private final EventDispatcher mEventDispatcher;
@ -105,7 +105,7 @@ public final class GeckoViewSettings {
}
}
public void setInt(final Key<Boolean> key, int value) {
public void setInt(final Key<Integer> key, int value) {
synchronized (mBundle) {
final Object old = mBundle.get(key.text);
if (old != null && old.equals(value)) {
@ -116,7 +116,7 @@ public final class GeckoViewSettings {
dispatchUpdate();
}
public int getInt(final Key<Boolean> key) {
public int getInt(final Key<Integer> key) {
synchronized (mBundle) {
return mBundle.getInt(key.text);
}

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

@ -991,6 +991,29 @@ nsDNSService::ResolveNative(const nsACString &aHostname,
uint32_t flags,
const OriginAttributes &aOriginAttributes,
nsIDNSRecord **result)
{
// Synchronous resolution is not available on the main thread.
if (NS_IsMainThread()) {
return NS_ERROR_NOT_AVAILABLE;
}
return ResolveInternal(aHostname, flags, aOriginAttributes, result);
}
nsresult
nsDNSService::DeprecatedSyncResolve(const nsACString &aHostname,
uint32_t flags,
const OriginAttributes &aOriginAttributes,
nsIDNSRecord **result)
{
return ResolveInternal(aHostname, flags, aOriginAttributes, result);
}
nsresult
nsDNSService::ResolveInternal(const nsACString &aHostname,
uint32_t flags,
const OriginAttributes &aOriginAttributes,
nsIDNSRecord **result)
{
// grab reference to global host resolver and IDN service. beware
// simultaneous shutdown!!

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

@ -19,6 +19,8 @@
#include "mozilla/Mutex.h"
#include "mozilla/Attributes.h"
class nsAuthSSPI;
class nsDNSService final : public nsPIDNSService
, public nsIObserver
, public nsIMemoryReporter
@ -38,6 +40,14 @@ public:
bool GetOffline() const;
protected:
friend class nsAuthSSPI;
nsresult DeprecatedSyncResolve(const nsACString &aHostname,
uint32_t flags,
const mozilla::OriginAttributes &aOriginAttributes,
nsIDNSRecord **result);
private:
~nsDNSService();
@ -50,6 +60,11 @@ private:
nsIIDNService *aIDN,
nsACString &aACE);
nsresult ResolveInternal(const nsACString &aHostname,
uint32_t flags,
const mozilla::OriginAttributes &aOriginAttributes,
nsIDNSRecord **result);
RefPtr<nsHostResolver> mResolver;
nsCOMPtr<nsIIDNService> mIDN;

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

@ -99,9 +99,10 @@ interface nsIDNSService : nsISupports
in OriginAttributes aOriginAttributes);
/**
* called to synchronously resolve a hostname. warning this method may
* block the calling thread for a long period of time. it is extremely
* unwise to call this function on the UI thread of an application.
* called to synchronously resolve a hostname.
*
* Since this method may block the calling thread for a long period of
* time, it may not be accessed from the main thread.
*
* @param aHostName
* the hostname or IP-address-literal to resolve.
@ -114,6 +115,7 @@ interface nsIDNSService : nsISupports
*
* @return DNS record corresponding to the given hostname.
* @throws NS_ERROR_UNKNOWN_HOST if host could not be resolved.
* @throws NS_ERROR_NOT_AVAILABLE if accessed from the main thread.
*/
[implicit_jscontext, optional_argc]
nsIDNSRecord resolve(in AUTF8String aHostName,

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

@ -1 +1 @@
a83094ccf952
NSS_3_33_RTM

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

@ -1,4 +1,4 @@
4.15
4.17
# The first line of this file must contain the human readable NSPR
# version number, which is the minimum required version of NSPR

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

@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

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

@ -22,12 +22,12 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
#define NSS_VERSION "3.33" _NSS_CUSTOMIZED " Beta"
#define NSS_VERSION "3.33" _NSS_CUSTOMIZED
#define NSS_VMAJOR 3
#define NSS_VMINOR 33
#define NSS_VPATCH 0
#define NSS_VBUILD 0
#define NSS_BETA PR_TRUE
#define NSS_BETA PR_FALSE
#ifndef RC_INVOKED

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

@ -17,11 +17,11 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
#define SOFTOKEN_VERSION "3.33" SOFTOKEN_ECC_STRING " Beta"
#define SOFTOKEN_VERSION "3.33" SOFTOKEN_ECC_STRING
#define SOFTOKEN_VMAJOR 3
#define SOFTOKEN_VMINOR 33
#define SOFTOKEN_VPATCH 0
#define SOFTOKEN_VBUILD 0
#define SOFTOKEN_BETA PR_TRUE
#define SOFTOKEN_BETA PR_FALSE
#endif /* _SOFTKVER_H_ */

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

@ -19,12 +19,12 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <Beta>]"
*/
#define NSSUTIL_VERSION "3.33 Beta"
#define NSSUTIL_VERSION "3.33"
#define NSSUTIL_VMAJOR 3
#define NSSUTIL_VMINOR 33
#define NSSUTIL_VPATCH 0
#define NSSUTIL_VBUILD 0
#define NSSUTIL_BETA PR_TRUE
#define NSSUTIL_BETA PR_FALSE
SEC_BEGIN_PROTOS

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

@ -271,7 +271,29 @@ HandlerService.prototype = {
handlers.appendElement(handler);
}
for (let type of Object.keys(this._store.data.schemes)) {
let handler = gExternalProtocolService.getProtocolHandlerInfo(type);
// nsIExternalProtocolService.getProtocolHandlerInfo can be expensive
// on Windows, so we return a proxy to delay retrieving the nsIHandlerInfo
// until one of its properties is accessed.
//
// Note: our caller still needs to yield periodically when iterating
// the enumerator and accessing handler properties to avoid monopolizing
// the main thread.
//
let handler = new Proxy(
{
QueryInterface: XPCOMUtils.generateQI([Ci.nsIHandlerInfo]),
type: type,
get _handlerInfo() {
delete this._handlerInfo;
return this._handlerInfo = gExternalProtocolService.getProtocolHandlerInfo(type);
},
},
{
get: function(target, name) {
return target[name] || target._handlerInfo[name];
},
},
);
handlers.appendElement(handler);
}
return handlers.enumerate();

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

@ -92,6 +92,7 @@ enum NSWindowTitleVisibility {
@interface NSWindow(TitleVisibility)
- (void)setTitleVisibility:(NSWindowTitleVisibility)visibility;
- (void)setTitlebarAppearsTransparent:(BOOL)isTitlebarTransparent;
@end
#endif
@ -490,6 +491,10 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect &aRect,
// By default, hide window titles.
[mWindow setTitleVisibility:NSWindowTitleHidden];
}
if ([mWindow respondsToSelector:@selector(setTitlebarAppearsTransparent)]) {
// By default, hide window titlebars.
[mWindow setTitlebarAppearsTransparent:YES];
}
// setup our notification delegate. Note that setDelegate: does NOT retain.
mDelegate = [[WindowDelegate alloc] initWithGeckoWindow:this];
@ -3157,6 +3162,9 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
[self setTitleVisibility:mDrawsIntoWindowFrame ? NSWindowTitleHidden :
NSWindowTitleVisible];
}
if ([self respondsToSelector:@selector(setTitlebarAppearsTransparent)]) {
[self setTitlebarAppearsTransparent:mDrawsIntoWindowFrame];
}
}
}