Merge last green changeset of mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2011-11-22 02:36:57 +00:00
Родитель bda0768694 b6eea8956e
Коммит d0c94f52ef
77 изменённых файлов: 1942 добавлений и 899 удалений

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

@ -3931,14 +3931,13 @@ var FullScreen = {
// full-screen. Only add listeners and show warning etc when the event we
// receive is targeted at the chrome document, i.e. only once every time
// we enter DOM full-screen mode.
let targetDoc = event.target.ownerDocument ? event.target.ownerDocument : event.target;
if (targetDoc != document) {
if (event.target != document) {
// However, if we receive a "mozfullscreenchange" event for a document
// which is not a subdocument of the currently selected tab, we know that
// we've switched tabs since the request to enter full-screen was made,
// so we should exit full-screen since the "full-screen document" isn't
// acutally visible.
if (targetDoc.defaultView.top != gBrowser.contentWindow) {
if (event.target.defaultView.top != gBrowser.contentWindow) {
document.mozCancelFullScreen();
}
return;

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

@ -113,6 +113,6 @@ endif # WIN32_REDIST_DIR
# run the binscope tool to make sure the binary and all libraries
# are using all available Windows OS-level security mechanisms
check::
$(PYTHON) $(srcdir)/autobinscope.py $(DIST)/bin/firefox.exe $(DIST)/crashreporter-symbols/
$(PYTHON) $(srcdir)/autobinscope.py $(DIST)/bin/$(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/crashreporter-symbols/
$(PYTHON) $(srcdir)/autobinscope.py $(DIST)/bin/plugin-container.exe $(DIST)/crashreporter-symbols/

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

@ -2350,7 +2350,10 @@ case "$target" in
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
MOZ_OPTIMIZE_FLAGS="-O3"
_PEDANTIC=
MOZ_MEMORY=1
# Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
if test "$HAVE_64BIT_OS"; then
MOZ_MEMORY=1
fi
CFLAGS="$CFLAGS -fno-common"
CXXFLAGS="$CXXFLAGS -fno-common"
DLL_SUFFIX=".dylib"
@ -4684,7 +4687,7 @@ MOZ_USE_NATIVE_POPUP_WINDOWS=
MOZ_ANDROID_HISTORY=
case "${target}" in
*android*|*darwin*)
*darwin*)
ACCESSIBILITY=
;;
*)

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

@ -88,6 +88,11 @@ namespace dom {
class Link;
// IID for the dom::Element interface
#define NS_ELEMENT_IID \
{ 0xa1588efb, 0x5a84, 0x49cd, \
{ 0x99, 0x1a, 0xac, 0x84, 0x9d, 0x92, 0x05, 0x0f } }
class Element : public nsIContent
{
public:
@ -98,6 +103,8 @@ public:
{}
#endif // MOZILLA_INTERNAL_API
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ELEMENT_IID)
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(Element, nsIContent)
/**
@ -187,6 +194,8 @@ private:
nsEventStates mState;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Element, NS_ELEMENT_IID)
} // namespace dom
} // namespace mozilla

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

@ -8606,6 +8606,8 @@ public:
void
nsDocument::AsyncRequestFullScreen(Element* aElement)
{
NS_ASSERTION(aElement,
"Must pass non-null element to nsDocument::AsyncRequestFullScreen");
if (!aElement) {
return;
}
@ -8614,20 +8616,48 @@ nsDocument::AsyncRequestFullScreen(Element* aElement)
NS_DispatchToCurrentThread(event);
}
static void
LogFullScreenDenied(bool aLogFailure, const char* aMessage, nsIDocument* aDoc)
{
if (!aLogFailure) {
return;
}
nsRefPtr<nsPLDOMEvent> e =
new nsPLDOMEvent(aDoc,
NS_LITERAL_STRING("mozfullscreenerror"),
true,
false);
e->PostDOMEvent();
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
aMessage,
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", aDoc);
}
void
nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
{
if (!aElement ||
!aElement->IsInDoc() ||
aElement->OwnerDoc() != this ||
!IsFullScreenEnabled(aWasCallerChrome) ||
!GetWindow()) {
nsRefPtr<nsPLDOMEvent> e =
new nsPLDOMEvent(this,
NS_LITERAL_STRING("mozfullscreenerror"),
true,
false);
e->PostDOMEvent();
NS_ASSERTION(aElement,
"Must pass non-null element to nsDocument::RequestFullScreen");
if (!aElement) {
return;
}
if (!aElement->IsInDoc()) {
LogFullScreenDenied(true, "FullScreenDeniedNotInDocument", this);
return;
}
if (aElement->OwnerDoc() != this) {
LogFullScreenDenied(true, "FullScreenDeniedMovedDocument", this);
return;
}
if (!GetWindow()) {
LogFullScreenDenied(true, "FullScreenDeniedLostWindow", this);
return;
}
if (!IsFullScreenEnabled(aWasCallerChrome, true)) {
// IsFullScreenEnabled calls LogFullScreenDenied, no need to log.
return;
}
@ -8722,12 +8752,12 @@ NS_IMETHODIMP
nsDocument::GetMozFullScreenEnabled(bool *aFullScreen)
{
NS_ENSURE_ARG_POINTER(aFullScreen);
*aFullScreen = IsFullScreenEnabled(nsContentUtils::IsCallerChrome());
*aFullScreen = IsFullScreenEnabled(nsContentUtils::IsCallerChrome(), false);
return NS_OK;
}
bool
nsDocument::IsFullScreenEnabled(bool aCallerIsChrome)
nsDocument::IsFullScreenEnabled(bool aCallerIsChrome, bool aLogFailure)
{
if (nsContentUtils::IsFullScreenApiEnabled() && aCallerIsChrome) {
// Chrome code can always use the full-screen API, provided it's not
@ -8737,9 +8767,16 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome)
return true;
}
if (!nsContentUtils::IsFullScreenApiEnabled() ||
nsContentUtils::HasPluginWithUncontrolledEventDispatch(this) ||
!IsVisible()) {
if (!nsContentUtils::IsFullScreenApiEnabled()) {
LogFullScreenDenied(aLogFailure, "FullScreenDeniedDisabled", this);
return false;
}
if (nsContentUtils::HasPluginWithUncontrolledEventDispatch(this)) {
LogFullScreenDenied(aLogFailure, "FullScreenDeniedPlugins", this);
return false;
}
if (!IsVisible()) {
LogFullScreenDenied(aLogFailure, "FullScreenDeniedHidden", this);
return false;
}
@ -8753,6 +8790,7 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome)
// The node requesting fullscreen, or one of its crossdoc ancestors,
// is an iframe which doesn't have the "mozalllowfullscreen" attribute.
// This request is not authorized by the parent document.
LogFullScreenDenied(aLogFailure, "FullScreenDeniedIframeDisallowed", this);
return false;
}
node = nsContentUtils::GetCrossDocParentNode(node);

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

@ -978,7 +978,9 @@ protected:
// doc tree, and if the document is visible, and if the api is not
// disabled by pref. aIsCallerChrome must contain the return value of
// nsContentUtils::IsCallerChrome() from the context we're checking.
bool IsFullScreenEnabled(bool aIsCallerChrome);
// If aLogFailure is true, an appropriate warning message is logged to the
// console, and a "mozfullscreenerror" event is dispatched to this document.
bool IsFullScreenEnabled(bool aIsCallerChrome, bool aLogFailure);
/**
* Check that aId is not empty and log a message to the console

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

@ -3067,6 +3067,12 @@ nsGenericElement::UnbindFromTree(bool aDeep, bool aNullParent)
if (IsFullScreenAncestor(this)) {
// The element being removed is an ancestor of the full-screen element,
// exit full-screen state.
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"RemovedFullScreenElement",
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", OwnerDoc());
OwnerDoc()->CancelFullScreen();
}
if (GetParent()) {
@ -4343,6 +4349,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN(nsGenericElement)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsGenericElement)
NS_INTERFACE_MAP_ENTRY(Element)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)

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

@ -1776,6 +1776,10 @@ GK_ATOM(XULLabelFrame, "XULLabelFrame")
GK_ATOM(svgAFrame, "SVGAFrame")
GK_ATOM(svgClipPathFrame, "SVGClipPathFrame")
GK_ATOM(svgDefsFrame, "SVGDefsFrame")
GK_ATOM(svgFEContainerFrame, "SVGFEContainerFrame")
GK_ATOM(svgFEImageFrame, "SVGFEImageFrame")
GK_ATOM(svgFELeafFrame, "SVGFELeafFrame")
GK_ATOM(svgFEUnstyledLeafFrame, "SVGFEUnstyledLeafFrame")
GK_ATOM(svgFilterFrame, "SVGFilterFrame")
GK_ATOM(svgForeignObjectFrame, "SVGForeignObjectFrame")
GK_ATOM(svgGenericContainerFrame, "SVGGenericContainerFrame")

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

@ -1214,16 +1214,16 @@ nsXMLHttpRequest::Abort()
XML_HTTP_REQUEST_OPENED |
XML_HTTP_REQUEST_DONE))) {
ChangeState(XML_HTTP_REQUEST_DONE, true);
}
if (!(mState & XML_HTTP_REQUEST_SYNCLOOPING)) {
NS_NAMED_LITERAL_STRING(abortStr, ABORT_STR);
DispatchProgressEvent(this, abortStr, mLoadLengthComputable, responseLength,
mLoadTotal);
if (mUpload && !mUploadComplete) {
mUploadComplete = true;
DispatchProgressEvent(mUpload, abortStr, true, mUploadTransferred,
mUploadTotal);
if (!(mState & XML_HTTP_REQUEST_SYNCLOOPING)) {
NS_NAMED_LITERAL_STRING(abortStr, ABORT_STR);
DispatchProgressEvent(this, abortStr, mLoadLengthComputable, responseLength,
mLoadTotal);
if (mUpload && !mUploadComplete) {
mUploadComplete = true;
DispatchProgressEvent(mUpload, abortStr, true, mUploadTransferred,
mUploadTotal);
}
}
}

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

@ -528,6 +528,7 @@ _TEST_FILES2 = \
file_bug692434.xml \
test_bug693875.html \
test_nodelist_holes.html \
test_xhr_abort_after_load.html \
$(NULL)
_CHROME_FILES = \

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

@ -27,32 +27,29 @@ function testCancelInPhase4() {
// First request - should be loaded from server
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function(e) {
if (xhr.readyState >= 4) {
xhr.addEventListener("abort", function() {
setTimeout(function() {
// This request was cancelled, so the responseText should be empty string
is(xhr.responseText, "", "Expected empty response to cancelled request");
if (xhr.readyState < xhr.DONE) return;
is(xhr.readyState, xhr.DONE, "wrong readyState");
xhr.abort();
SimpleTest.executeSoon(function() {
// This request was cancelled, so the responseText should be empty string
is(xhr.responseText, "", "Expected empty response to cancelled request");
// Second request - should be found in cache
var xhr2 = new XMLHttpRequest();
// Second request - should be found in cache
var xhr2 = new XMLHttpRequest();
xhr2.addEventListener("load", function() {
is(xhr2.responseText, "0", "Received fresh value for second request");
SimpleTest.finish();
}, false);
xhr2.open("GET", url);
xhr2.setRequestHeader("X-Request", "1", false);
try { xhr2.send(); }
catch(e) {
is(xhr2.status, "200", "Exception!");
}
}, 0);
xhr2.addEventListener("load", function() {
is(xhr2.responseText, "0", "Received fresh value for second request");
SimpleTest.finish();
}, false);
xhr.abort();
}
xhr2.open("GET", url);
xhr2.setRequestHeader("X-Request", "1", false);
try { xhr2.send(); }
catch(e) {
is(xhr2.status, "200", "Exception!");
}
});
}, false);
xhr.open("GET", url, true);

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

@ -0,0 +1,95 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test bug 482935</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href=" /tests/SimpleTest/test.css" />
</head>
<body onload="onWindowLoad()">
<script class="testbody" type="text/javascript">"use strict";
SimpleTest.waitForExplicitFinish();
var url = "file_XHR_pass1.xml";
function onWindowLoad() {
runTest();
}
function runTest() {
var testFunctions = [
startTest1,
startTest2,
startTest3,
];
function nextTest() {
if (testFunctions.length == 0) {
SimpleTest.finish();
}
(testFunctions.shift())();
}
nextTest();
var xhr;
function startTest1() {
xhr = new XMLHttpRequest();
xhr.onload = onLoad1;
xhr.open("GET", url);
xhr.send();
}
function onLoad1() {
is(xhr.readyState, xhr.DONE, "readyState should be DONE");
xhr.onabort = onAbort1;
xhr.abort();
function onAbort1(e) {
ok(false, e.type + " event should not be fired!");
}
is(xhr.readyState, xhr.UNSENT, "readyState should be UNSENT");
nextTest();
}
function startTest2() {
xhr = new XMLHttpRequest();
xhr.onloadstart = onAfterSend;
xhr.open("GET", url);
xhr.send();
}
function startTest3() {
xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.send();
onAfterSend();
}
function onAfterSend() {
is(xhr.readyState, xhr.OPENED, "readyState should be OPENED");
var sent = false;
try {
xhr.send();
} catch (e) {
sent = true;
}
ok(sent, "send() flag should be set");
var aborted = false;
xhr.onabort = onAbort2;
xhr.abort();
function onAbort2() {
is(xhr.readyState, xhr.DONE, "readyState should be DONE");
aborted = true;
}
ok(aborted, "abort event should be fired");
is(xhr.readyState, xhr.UNSENT, "readyState should be UNSENT");
nextTest();
}
}
</script>
</body>
</html>

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

@ -68,8 +68,6 @@
#include "nsIDOMXULControlElement.h"
#include "nsINameSpaceManager.h"
#include "nsIBaseWindow.h"
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsISelection.h"
#include "nsFrameSelection.h"
#include "nsIPrivateDOMEvent.h"
@ -1030,8 +1028,7 @@ nsresult
nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView)
nsEventStatus* aStatus)
{
NS_ENSURE_ARG_POINTER(aStatus);
NS_ENSURE_ARG(aPresContext);
@ -3029,8 +3026,7 @@ nsresult
nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView)
nsEventStatus* aStatus)
{
NS_ENSURE_ARG(aPresContext);
NS_ENSURE_ARG_POINTER(aStatus);

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

@ -106,8 +106,7 @@ public:
nsresult PreHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView);
nsEventStatus* aStatus);
/* The PostHandleEvent method should contain all system processing which
* should occur conditionally based on DOM or frame processing. It should
@ -117,8 +116,7 @@ public:
nsresult PostHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView);
nsEventStatus* aStatus);
void NotifyDestroyPresContext(nsPresContext* aPresContext);
void SetPresContext(nsPresContext* aPresContext);

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

@ -42,7 +42,6 @@
#include "nsCOMPtr.h"
#include "nsIWidget.h"
#include "nsIViewManager.h"
#include "nsIViewObserver.h"
#include "nsIPresShell.h"
#include "nsISupports.h"
#include "nsPIDOMWindow.h"

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

@ -118,6 +118,7 @@
#include "nsHTMLFieldSetElement.h"
#include "nsHTMLMenuElement.h"
#include "nsPLDOMEvent.h"
#include "nsIScriptError.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/FromParser.h"
@ -3468,6 +3469,12 @@ nsresult nsGenericHTMLElement::MozRequestFullScreen()
// and it also makes it harder for bad guys' script to go full-screen and
// spoof the browser chrome/window and phish logins etc.
if (!nsContentUtils::IsRequestFullScreenAllowed()) {
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"FullScreenDeniedNotInputDriven",
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", OwnerDoc());
nsRefPtr<nsPLDOMEvent> e =
new nsPLDOMEvent(OwnerDoc(),
NS_LITERAL_STRING("mozfullscreenerror"),

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

@ -49,6 +49,7 @@
#include "nsThreadUtils.h"
#include "nsIDOMGetSVGDocument.h"
#include "nsIDOMSVGDocument.h"
#include "nsIScriptError.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -297,6 +298,12 @@ nsHTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
// to prevent phishing attacks.
NS_DispatchToCurrentThread(
NS_NewRunnableMethod(aDocument, &nsIDocument::CancelFullScreen));
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"AddedWindowedPluginWhileFullScreen",
nsnull, 0, nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM", aDocument);
}
#endif
return NS_OK;

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

@ -59,11 +59,8 @@
#include "nsIFrame.h"
#include "gfxContext.h"
#include "gfxMatrix.h"
#include "nsIDOMSVGURIReference.h"
#include "nsImageLoadingContent.h"
#include "imgIContainer.h"
#include "nsNetUtil.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsSVGFilterElement.h"
#include "nsSVGString.h"
@ -251,6 +248,18 @@ nsSVGFE::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
}
bool
nsSVGFE::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::x ||
aAttribute == nsGkAtoms::y ||
aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height ||
aAttribute == nsGkAtoms::result);
}
//----------------------------------------------------------------------
// nsIDOMSVGFilterPrimitiveStandardAttributes methods
@ -308,85 +317,6 @@ nsSVGFE::GetLengthInfo()
ArrayLength(sLengthInfo));
}
inline static void DidAnimateAttr(Element *aFilterPrimitive)
{
// nsSVGLeafFrame doesn't implement AttributeChanged.
nsIFrame* frame = aFilterPrimitive->GetPrimaryFrame();
if (frame) {
nsSVGEffects::InvalidateRenderingObservers(frame);
}
}
inline static void DidAnimateAttrViaParent(Element *aFilterPrimitive)
{
// No frame, use parent's
NS_ASSERTION(!aFilterPrimitive->GetPrimaryFrame(), "Not expecting a frame");
nsIContent *parent = aFilterPrimitive->GetFlattenedTreeParent();
if (parent && parent->IsElement()) {
DidAnimateAttr(parent->AsElement());
}
}
void
nsSVGFE::DidAnimateLength(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateNumber(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateNumberPair(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateNumberList(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateInteger(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateIntegerPair(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateEnum(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimatePreserveAspectRatio()
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateBoolean(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFE::DidAnimateString(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
//---------------------Gaussian Blur------------------------
typedef nsSVGFE nsSVGFEGaussianBlurElementBase;
@ -411,6 +341,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo >& aSources);
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
@ -800,6 +732,16 @@ nsSVGFEGaussianBlurElement::Filter(nsSVGFilterInstance* aInstance,
return NS_OK;
}
bool
nsSVGFEGaussianBlurElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEGaussianBlurElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::stdDeviation));
}
void
nsSVGFEGaussianBlurElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
@ -881,6 +823,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
@ -1035,6 +979,17 @@ nsSVGFEBlendElement::Filter(nsSVGFilterInstance* aInstance,
return NS_OK;
}
bool
nsSVGFEBlendElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEBlendElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::in2 ||
aAttribute == nsGkAtoms::mode));
}
void
nsSVGFEBlendElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
@ -1083,6 +1038,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
@ -1338,6 +1295,17 @@ nsSVGFEColorMatrixElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFEColorMatrixElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEColorMatrixElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::type ||
aAttribute == nsGkAtoms::values));
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -1386,6 +1354,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
@ -1597,6 +1567,21 @@ nsSVGFECompositeElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFECompositeElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFECompositeElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::in2 ||
aAttribute == nsGkAtoms::k1 ||
aAttribute == nsGkAtoms::k2 ||
aAttribute == nsGkAtoms::k3 ||
aAttribute == nsGkAtoms::k4 ||
aAttribute == nsGkAtoms::_operator));
}
void
nsSVGFECompositeElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
@ -1680,6 +1665,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
@ -1760,7 +1747,7 @@ nsSVGFEComponentTransferElement::GetStringInfo()
{ 0xafab106d, 0xbc18, 0x4f7f, \
{ 0x9e, 0x29, 0xfe, 0xb4, 0xb0, 0x16, 0x5f, 0xf4 } }
typedef nsSVGElement nsSVGComponentTransferFunctionElementBase;
typedef SVGFEUnstyledElement nsSVGComponentTransferFunctionElementBase;
class nsSVGComponentTransferFunctionElement : public nsSVGComponentTransferFunctionElementBase
{
@ -1777,22 +1764,16 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual PRInt32 GetChannel() = 0;
void GenerateLookupTable(PRUint8* aTable);
protected:
virtual NumberAttributesInfo GetNumberInfo();
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
DidAnimateAttrViaParent(this);
}
virtual EnumAttributesInfo GetEnumInfo();
virtual void DidAnimateEnum(PRUint8 aAttrEnum) {
DidAnimateAttrViaParent(this);
}
virtual NumberListAttributesInfo GetNumberListInfo();
virtual void DidAnimateNumberList(PRUint8 aAttrEnum) {
DidAnimateAttrViaParent(this);
}
// nsIDOMSVGComponentTransferFunctionElement properties:
enum { TABLEVALUES };
@ -1851,6 +1832,15 @@ nsSVGFEComponentTransferElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFEComponentTransferElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEComponentTransferElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::in);
}
void
nsSVGFEComponentTransferElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
@ -1910,6 +1900,23 @@ NS_INTERFACE_MAP_BEGIN(nsSVGComponentTransferFunctionElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGComponentTransferFunctionElementBase)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
nsSVGComponentTransferFunctionElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::tableValues ||
aAttribute == nsGkAtoms::slope ||
aAttribute == nsGkAtoms::intercept ||
aAttribute == nsGkAtoms::amplitude ||
aAttribute == nsGkAtoms::exponent ||
aAttribute == nsGkAtoms::offset ||
aAttribute == nsGkAtoms::type);
}
//----------------------------------------------------------------------
// nsIDOMSVGComponentTransferFunctionElement methods
@ -2286,7 +2293,7 @@ protected:
static StringInfo sStringInfo[1];
};
typedef nsSVGStylableElement nsSVGFEMergeNodeElementBase;
typedef SVGFEUnstyledElement nsSVGFEMergeNodeElementBase;
#define NS_SVG_FE_MERGE_NODE_CID \
{ 0x413687ec, 0x77fd, 0x4077, \
@ -2316,6 +2323,9 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
const nsSVGString* In1() { return &mStringAttributes[IN1]; }
operator nsISupports*() { return static_cast<nsIContent*>(this); }
@ -2432,6 +2442,16 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFEMergeNodeElementBase)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEMergeNodeElement)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
nsSVGFEMergeNodeElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in;
}
//----------------------------------------------------------------------
// nsIDOMSVGFEMergeNodeElement methods
@ -2475,6 +2495,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
@ -2596,6 +2618,17 @@ nsSVGFEOffsetElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFEOffsetElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEOffsetElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::dx ||
aAttribute == nsGkAtoms::dy));
}
void
nsSVGFEOffsetElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
@ -2807,6 +2840,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
@ -2962,6 +2997,15 @@ nsSVGFETileElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFETileElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFETileElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::in);
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -2998,6 +3042,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
const nsSVGFilterInstance& aInstance);
@ -3301,6 +3347,19 @@ nsSVGFETurbulenceElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFETurbulenceElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFETurbulenceElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::seed ||
aAttribute == nsGkAtoms::baseFrequency ||
aAttribute == nsGkAtoms::numOctaves ||
aAttribute == nsGkAtoms::type ||
aAttribute == nsGkAtoms::stitchTiles));
}
void
nsSVGFETurbulenceElement::InitSeed(PRInt32 aSeed)
{
@ -3525,6 +3584,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
@ -3798,6 +3859,17 @@ nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFEMorphologyElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEMorphologyElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::radius ||
aAttribute == nsGkAtoms::_operator));
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -3846,6 +3918,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
@ -4256,6 +4330,24 @@ nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFEConvolveMatrixElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEConvolveMatrixElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::divisor ||
aAttribute == nsGkAtoms::bias ||
aAttribute == nsGkAtoms::kernelUnitLength ||
aAttribute == nsGkAtoms::targetX ||
aAttribute == nsGkAtoms::targetY ||
aAttribute == nsGkAtoms::order ||
aAttribute == nsGkAtoms::preserveAlpha||
aAttribute == nsGkAtoms::edgeMode ||
aAttribute == nsGkAtoms::kernelMatrix));
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -4317,7 +4409,7 @@ nsSVGFEConvolveMatrixElement::GetNumberListInfo()
//---------------------DistantLight------------------------
typedef nsSVGElement nsSVGFEDistantLightElementBase;
typedef SVGFEUnstyledElement nsSVGFEDistantLightElementBase;
class nsSVGFEDistantLightElement : public nsSVGFEDistantLightElementBase,
public nsIDOMSVGFEDistantLightElement
@ -4337,14 +4429,14 @@ public:
NS_FORWARD_NSIDOMNODE(nsSVGFEDistantLightElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEDistantLightElementBase::)
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
protected:
virtual NumberAttributesInfo GetNumberInfo();
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
DidAnimateAttrViaParent(this);
}
enum { AZIMUTH, ELEVATION };
nsSVGNumber2 mNumberAttributes[2];
@ -4379,6 +4471,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFEDistantLightElementBase)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEDistantLightElement)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
nsSVGFEDistantLightElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::azimuth ||
aAttribute == nsGkAtoms::elevation);
}
//----------------------------------------------------------------------
// nsIDOMSVGFEDistantLightElement methods
@ -4408,7 +4512,7 @@ nsSVGFEDistantLightElement::GetNumberInfo()
//---------------------PointLight------------------------
typedef nsSVGElement nsSVGFEPointLightElementBase;
typedef SVGFEUnstyledElement nsSVGFEPointLightElementBase;
class nsSVGFEPointLightElement : public nsSVGFEPointLightElementBase,
public nsIDOMSVGFEPointLightElement
@ -4428,14 +4532,14 @@ public:
NS_FORWARD_NSIDOMNODE(nsSVGFEPointLightElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEPointLightElementBase::)
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
protected:
virtual NumberAttributesInfo GetNumberInfo();
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
DidAnimateAttrViaParent(this);
}
enum { X, Y, Z };
nsSVGNumber2 mNumberAttributes[3];
@ -4471,6 +4575,19 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFEPointLightElementBase)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEPointLightElement)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
nsSVGFEPointLightElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::x ||
aAttribute == nsGkAtoms::y ||
aAttribute == nsGkAtoms::z);
}
//----------------------------------------------------------------------
// nsIDOMSVGFEPointLightElement methods
@ -4504,7 +4621,7 @@ nsSVGFEPointLightElement::GetNumberInfo()
//---------------------SpotLight------------------------
typedef nsSVGElement nsSVGFESpotLightElementBase;
typedef SVGFEUnstyledElement nsSVGFESpotLightElementBase;
class nsSVGFESpotLightElement : public nsSVGFESpotLightElementBase,
public nsIDOMSVGFESpotLightElement
@ -4525,14 +4642,14 @@ public:
NS_FORWARD_NSIDOMNODE(nsSVGFESpotLightElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFESpotLightElementBase::)
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
protected:
virtual NumberAttributesInfo GetNumberInfo();
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
DidAnimateAttrViaParent(this);
}
enum { X, Y, Z, POINTS_AT_X, POINTS_AT_Y, POINTS_AT_Z,
SPECULAR_EXPONENT, LIMITING_CONE_ANGLE };
@ -4574,6 +4691,24 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFESpotLightElementBase)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFESpotLightElement)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
nsSVGFESpotLightElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::x ||
aAttribute == nsGkAtoms::y ||
aAttribute == nsGkAtoms::z ||
aAttribute == nsGkAtoms::pointsAtX ||
aAttribute == nsGkAtoms::pointsAtY ||
aAttribute == nsGkAtoms::pointsAtZ ||
aAttribute == nsGkAtoms::specularExponent ||
aAttribute == nsGkAtoms::limitingConeAngle);
}
//----------------------------------------------------------------------
// nsIDOMSVGFESpotLightElement methods
@ -4658,6 +4793,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
// XXX shouldn't we have ComputeTargetBBox here, since the output can
@ -4985,6 +5122,17 @@ nsSVGFELightingElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFELightingElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFELightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::surfaceScale ||
aAttribute == nsGkAtoms::kernelUnitLength));
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -5034,6 +5182,9 @@ public:
NS_FORWARD_NSIDOMNODE(nsSVGFEDiffuseLightingElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEDiffuseLightingElementBase::)
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
@ -5105,6 +5256,15 @@ nsSVGFEDiffuseLightingElement::GetKernelUnitLengthY(nsIDOMSVGAnimatedNumber **aK
this);
}
bool
nsSVGFEDiffuseLightingElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEDiffuseLightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::diffuseConstant);
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -5162,6 +5322,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsXPCClassInfo* GetClassInfo();
protected:
@ -5257,6 +5419,15 @@ nsSVGFESpecularLightingElement::Filter(nsSVGFilterInstance *instance,
return nsSVGFESpecularLightingElementBase::Filter(instance, aSources, aTarget, rect);
}
bool
nsSVGFESpecularLightingElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFESpecularLightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::specularConstant ||
aAttribute == nsGkAtoms::specularExponent));
}
void
nsSVGFESpecularLightingElement::LightPixel(const float *N, const float *L,
@ -5296,90 +5467,6 @@ nsSVGFESpecularLightingElement::LightPixel(const float *N, const float *L,
//---------------------Image------------------------
typedef nsSVGFE nsSVGFEImageElementBase;
class nsSVGFEImageElement : public nsSVGFEImageElementBase,
public nsIDOMSVGFEImageElement,
public nsIDOMSVGURIReference,
public nsImageLoadingContent
{
protected:
friend nsresult NS_NewSVGFEImageElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
nsSVGFEImageElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsSVGFEImageElement();
public:
virtual bool SubregionIsUnionOfRegions() { return false; }
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
// FE Base
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEImageElementBase::)
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
const nsSVGFilterInstance& aInstance);
NS_DECL_NSIDOMSVGFEIMAGEELEMENT
NS_DECL_NSIDOMSVGURIREFERENCE
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEImageElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEImageElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEImageElementBase::)
// nsIContent
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers);
virtual nsEventStates IntrinsicState() const;
// imgIDecoderObserver
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
const PRUnichar *statusArg);
// imgIContainerObserver
NS_IMETHOD FrameChanged(imgIContainer *aContainer,
const nsIntRect *aDirtyRect);
// imgIContainerObserver
NS_IMETHOD OnStartContainer(imgIRequest *aRequest,
imgIContainer *aContainer);
void MaybeLoadSVGImage();
virtual nsXPCClassInfo* GetClassInfo();
private:
// Invalidate users of the filter containing this element.
void Invalidate();
nsresult LoadSVGImage(bool aForce, bool aNotify);
protected:
virtual bool OperatesOnSRGB(nsSVGFilterInstance*,
PRInt32, Image*) { return true; }
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
virtual StringAttributesInfo GetStringInfo();
virtual void DidAnimateString(PRUint8 aAttrEnum);
enum { RESULT, HREF };
nsSVGString mStringAttributes[2];
static StringInfo sStringInfo[2];
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
};
nsSVGElement::StringInfo nsSVGFEImageElement::sStringInfo[2] =
{
{ &nsGkAtoms::result, kNameSpaceID_None, true },
@ -5468,10 +5555,22 @@ nsSVGFEImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
{
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
if (aValue) {
LoadSVGImage(true, aNotify);
} else {
CancelImageRequests(aNotify);
// If there isn't a frame we still need to load the image in case
// the frame is created later e.g. by attaching to a document.
// If there is a frame then it should deal with loading as the image
// url may be animated.
if (!GetPrimaryFrame()) {
// Prevent setting image.src by exiting early
if (nsContentUtils::IsImageSrcSetDisabled()) {
return NS_OK;
}
if (aValue) {
LoadSVGImage(true, aNotify);
} else {
CancelImageRequests(aNotify);
}
}
}
@ -5591,6 +5690,17 @@ nsSVGFEImageElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFEImageElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
// nsGkAtoms::href is deliberately omitted as the frame has special
// handling to load the image
return nsSVGFEImageElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::preserveAspectRatio);
}
nsIntRect
nsSVGFEImageElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
const nsSVGFilterInstance& aInstance)
@ -5617,17 +5727,6 @@ nsSVGFEImageElement::GetStringInfo()
ArrayLength(sStringInfo));
}
void
nsSVGFEImageElement::DidAnimateString(PRUint8 aAttrEnum)
{
if (aAttrEnum == HREF) {
LoadSVGImage(true, false);
return;
}
nsSVGFEImageElementBase::DidAnimateString(aAttrEnum);
}
//----------------------------------------------------------------------
// imgIDecoderObserver methods
@ -5704,6 +5803,8 @@ public:
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
@ -5903,6 +6004,19 @@ nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
return NS_OK;
}
bool
nsSVGFEDisplacementMapElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEDisplacementMapElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::in2 ||
aAttribute == nsGkAtoms::scale ||
aAttribute == nsGkAtoms::xChannelSelector ||
aAttribute == nsGkAtoms::yChannelSelector));
}
void
nsSVGFEDisplacementMapElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{

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

@ -39,13 +39,16 @@
#include "nsSVGStylableElement.h"
#include "nsSVGLength2.h"
#include "nsSVGString.h"
#include "nsIFrame.h"
#include "gfxRect.h"
#include "gfxImageSurface.h"
#include "nsIDOMSVGFilters.h"
#include "nsImageLoadingContent.h"
#include "nsIDOMSVGURIReference.h"
#include "SVGAnimatedPreserveAspectRatio.h"
class nsSVGFilterResource;
class nsSVGString;
class nsSVGNumberPair;
class nsSVGFilterInstance;
@ -64,6 +67,11 @@ typedef nsSVGStylableElement nsSVGFEBase;
{ 0x60483958, 0xd229, 0x4a77, \
{ 0x96, 0xb2, 0x62, 0x3e, 0x69, 0x95, 0x1e, 0x0e } }
/**
* Base class for filter primitive elements
* Children of those elements e.g. feMergeNode
* derive from SVGFEUnstyledElement instead
*/
class nsSVGFE : public nsSVGFEBase
//, public nsIDOMSVGFilterPrimitiveStandardAttributes
{
@ -194,6 +202,11 @@ public:
const Image* aTarget,
const nsIntRect& aDataRect) = 0;
// returns true if changes to the attribute should cause us to
// repaint the filter
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
static nsIntRect GetMaxRect() {
// Try to avoid overflow errors dealing with this rect. It will
// be intersected with some other reasonable-sized rect eventually.
@ -220,16 +233,6 @@ protected:
// nsSVGElement specializations:
virtual LengthAttributesInfo GetLengthInfo();
virtual void DidAnimateLength(PRUint8 aAttrEnum);
virtual void DidAnimateNumber(PRUint8 aAttrEnum);
virtual void DidAnimateNumberPair(PRUint8 aAttrEnum);
virtual void DidAnimateNumberList(PRUint8 aAttrEnum);
virtual void DidAnimateInteger(PRUint8 aAttrEnum);
virtual void DidAnimateIntegerPair(PRUint8 aAttrEnum);
virtual void DidAnimateEnum(PRUint8 aAttrEnum);
virtual void DidAnimateBoolean(PRUint8 aAttrEnum);
virtual void DidAnimatePreserveAspectRatio();
virtual void DidAnimateString(PRUint8 aAttrEnum);
// nsIDOMSVGFitlerPrimitiveStandardAttributes values
enum { X, Y, WIDTH, HEIGHT };
@ -237,4 +240,106 @@ protected:
static LengthInfo sLengthInfo[4];
};
typedef nsSVGFE nsSVGFEImageElementBase;
class nsSVGFEImageElement : public nsSVGFEImageElementBase,
public nsIDOMSVGFEImageElement,
public nsIDOMSVGURIReference,
public nsImageLoadingContent
{
friend class SVGFEImageFrame;
protected:
friend nsresult NS_NewSVGFEImageElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
nsSVGFEImageElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsSVGFEImageElement();
public:
virtual bool SubregionIsUnionOfRegions() { return false; }
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
// FE Base
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEImageElementBase::)
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& aDataRect);
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
const nsSVGFilterInstance& aInstance);
NS_DECL_NSIDOMSVGFEIMAGEELEMENT
NS_DECL_NSIDOMSVGURIREFERENCE
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEImageElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEImageElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEImageElementBase::)
// nsIContent
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers);
virtual nsEventStates IntrinsicState() const;
// imgIDecoderObserver
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
const PRUnichar *statusArg);
// imgIContainerObserver
NS_IMETHOD FrameChanged(imgIContainer *aContainer,
const nsIntRect *aDirtyRect);
// imgIContainerObserver
NS_IMETHOD OnStartContainer(imgIRequest *aRequest,
imgIContainer *aContainer);
void MaybeLoadSVGImage();
virtual nsXPCClassInfo* GetClassInfo();
private:
// Invalidate users of the filter containing this element.
void Invalidate();
nsresult LoadSVGImage(bool aForce, bool aNotify);
protected:
virtual bool OperatesOnSRGB(nsSVGFilterInstance*,
PRInt32, Image*) { return true; }
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
virtual StringAttributesInfo GetStringInfo();
enum { RESULT, HREF };
nsSVGString mStringAttributes[2];
static StringInfo sStringInfo[2];
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
};
typedef nsSVGElement SVGFEUnstyledElementBase;
class SVGFEUnstyledElement : public SVGFEUnstyledElementBase
{
protected:
SVGFEUnstyledElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGFEUnstyledElementBase(aNodeInfo) {}
public:
// returns true if changes to the attribute should cause us to
// repaint the filter
virtual bool AttributeAffectsRendering(
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const = 0;
};
#endif

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

@ -173,7 +173,10 @@ nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
{
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
// If there's a frame it will deal
// If there isn't a frame we still need to load the image in case
// the frame is created later e.g. by attaching to a document.
// If there is a frame then it should deal with loading as the image
// url may be animated
if (!GetPrimaryFrame()) {
// Prevent setting image.src by exiting early

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

@ -427,16 +427,24 @@ nsSVGPathElement::ConstructPath(gfxContext *aCtx)
}
gfxFloat
nsSVGPathElement::GetPathLengthScale()
nsSVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor)
{
NS_ABORT_IF_FALSE(aFor == eForTextPath || aFor == eForStroking,
"Unknown enum");
if (mPathLength.IsExplicitlySet()) {
nsRefPtr<gfxFlattenedPath> flat =
GetFlattenedPath(PrependLocalTransformTo(gfxMatrix()));
float pathLength = mPathLength.GetAnimValue();
if (flat && pathLength != 0) {
return flat->GetLength() / pathLength;
float authorsPathLengthEstimate = mPathLength.GetAnimValue();
if (authorsPathLengthEstimate > 0) {
gfxMatrix matrix;
if (aFor == eForTextPath) {
// For textPath, a transform on the referenced path affects the
// textPath layout, so when calculating the actual path length
// we need to take that into account.
matrix = PrependLocalTransformTo(gfxMatrix());
}
nsRefPtr<gfxFlattenedPath> path = GetFlattenedPath(matrix);
if (path) {
return path->GetLength() / authorsPathLengthEstimate;
}
}
}
return 1.0;

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

@ -98,12 +98,17 @@ public:
return nsGkAtoms::d;
}
enum PathLengthScaleForType {
eForTextPath,
eForStroking
};
/**
* Gets the ratio of the actual path length to the content author's estimated
* length (as provided by the <path> element's 'pathLength' attribute). This
* is used to scale stroke dashing, and to scale offsets along a textPath.
*/
gfxFloat GetPathLengthScale();
gfxFloat GetPathLengthScale(PathLengthScaleForType aFor);
protected:

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

@ -68,7 +68,6 @@
#include "gfxImageSurface.h"
#include "nsLayoutUtils.h"
#include "nsComputedDOMStyle.h"
#include "nsIViewObserver.h"
#include "nsIPresShell.h"
#include "nsStyleAnimation.h"
#include "nsCSSProps.h"
@ -475,12 +474,9 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
nsEventStatus status;
if (aToWindow) {
nsIPresShell* presShell = presContext->PresShell();
nsCOMPtr<nsIPresShell> presShell = presContext->PresShell();
if (!presShell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIViewObserver> vo = do_QueryInterface(presShell);
if (!vo)
return NS_ERROR_FAILURE;
nsIViewManager* viewManager = presShell->GetViewManager();
if (!viewManager)
return NS_ERROR_FAILURE;
@ -489,7 +485,7 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
return NS_ERROR_FAILURE;
status = nsEventStatus_eIgnore;
return vo->HandleEvent(view, &event, false, &status);
return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
}
return widget->DispatchEvent(&event, status);
}

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

@ -115,5 +115,15 @@ nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.st
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
InputEncodingWarning=Use of inputEncoding is deprecated.
GlobalStorageWarning=Use of globalStorage is deprecated. Please use localStorage instead.
FullScreenDeniedDisabled=Request for full-screen was denied because full-screen API is disabled by user preference.
FullScreenDeniedPlugins=Request for full-screen was denied because a document on this page contains a windowed plugin.
FullScreenDeniedHidden=Request for full-screen was denied because the document is no longer visible.
FullScreenDeniedIframeDisallowed=Request for full-screen was denied because at least one of the document's containing iframes does not have a "mozallowfullscreen" attribute.
FullScreenDeniedNotInputDriven=Request for full-screen was denied because Element.mozRequestFullScreen() was not called from inside a short running user-generated event handler.
FullScreenDeniedNotInDocument=Request for full-screen was denied because requesting element is no longer in its document.
FullScreenDeniedMovedDocument=Request for full-screen was denied because requesting element has moved document.
FullScreenDeniedLostWindow=Request for full-screen was denied because we no longer have a window.
RemovedFullScreenElement=Exited full-screen because full-screen element was removed from document.
AddedWindowedPluginWhileFullScreen=Exited full-screen because windowed plugin was added to document.
HTMLMultipartXHRWarning=HTML parsing in XMLHttpRequest is not supported for multipart responses.
HTMLSyncXHRWarning=HTML parsing in XMLHttpRequest is not supported in the synchronous mode.

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

@ -249,8 +249,9 @@ BrowserStreamChild::Deliver()
// asynchronously). Doing this resolves bug 687610, bug 670036 and possibly
// also other bugs.
if (mStreamAsFilePending) {
mInstance->mPluginIface->asfile(&mInstance->mData, &mStream,
mStreamAsFileName.get());
if (mStreamStatus == kStreamOpen)
mInstance->mPluginIface->asfile(&mInstance->mData, &mStream,
mStreamAsFileName.get());
mStreamAsFilePending = false;
}

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

@ -566,6 +566,19 @@ public:
mProxy->mSeenLoadStart = false;
}
}
else if (mType.EqualsASCII(sEventStrings[STRING_abort])) {
if ((mUploadEvent && !mProxy->mSeenUploadLoadStart) ||
(!mUploadEvent && !mProxy->mSeenLoadStart)) {
// We've already dispatched premature abort events.
return true;
}
}
else if (mType.EqualsASCII(sEventStrings[STRING_readystatechange])) {
if (mReadyState == 4 && !mUploadEvent && !mProxy->mSeenLoadStart) {
// We've already dispatched premature abort events.
return true;
}
}
if (mProgressEvent) {
// Cache these for premature abort events.
@ -1533,7 +1546,7 @@ XMLHttpRequestPrivate::Abort(JSContext* aCx)
}
if (mProxy) {
if (!MaybeDispatchPrematureAbortEvents(aCx, false)) {
if (!MaybeDispatchPrematureAbortEvents(aCx)) {
return false;
}
}
@ -1619,7 +1632,7 @@ XMLHttpRequestPrivate::Open(JSContext* aCx, JSString* aMethod, JSString* aURL,
}
if (mProxy) {
if (!MaybeDispatchPrematureAbortEvents(aCx, true)) {
if (!MaybeDispatchPrematureAbortEvents(aCx)) {
return false;
}
}
@ -1831,8 +1844,7 @@ XMLHttpRequestPrivate::OverrideMimeType(JSContext* aCx, JSString* aMimeType)
}
bool
XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx,
bool aFromOpen)
XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx)
{
mWorkerPrivate->AssertIsOnWorkerThread();
NS_ASSERTION(mProxy, "Must have a proxy here!");
@ -1865,11 +1877,9 @@ XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx,
return false;
}
if (aFromOpen) {
if (!DispatchPrematureAbortEvent(aCx, target, STRING_abort, false) ||
!DispatchPrematureAbortEvent(aCx, target, STRING_loadend, false)) {
return false;
}
if (!DispatchPrematureAbortEvent(aCx, target, STRING_abort, false) ||
!DispatchPrematureAbortEvent(aCx, target, STRING_loadend, false)) {
return false;
}
mProxy->mSeenLoadStart = false;

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

@ -155,7 +155,7 @@ private:
RootJSObject(JSContext* aCx);
bool
MaybeDispatchPrematureAbortEvents(JSContext* aCx, bool aFromOpen);
MaybeDispatchPrematureAbortEvents(JSContext* aCx);
bool
DispatchPrematureAbortEvent(JSContext* aCx, JSObject* aTarget,

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

@ -142,6 +142,7 @@
#undef NOISY_FIRST_LETTER
#include "nsMathMLParts.h"
#include "nsIDOMSVGFilters.h"
#include "nsSVGFeatures.h"
#include "nsSVGEffects.h"
#include "nsSVGUtils.h"
@ -213,7 +214,13 @@ NS_NewSVGPatternFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
#include "nsIDocument.h"
#include "nsIScrollable.h"
@ -4717,7 +4724,7 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
PRInt32 parentNSID;
nsIAtom* parentTag =
parentContent->OwnerDoc()->BindingManager()->
ResolveTag(aParentFrame->GetContent(), &parentNSID);
ResolveTag(parentContent, &parentNSID);
// It's not clear whether the SVG spec intends to allow any SVG
// content within svg:foreignObject at all (SVG 1.1, section
@ -4728,11 +4735,7 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
}
if ((aTag != nsGkAtoms::svg && !parentIsSVG) ||
(aTag == nsGkAtoms::desc || aTag == nsGkAtoms::title ||
aTag == nsGkAtoms::feFuncR || aTag == nsGkAtoms::feFuncG ||
aTag == nsGkAtoms::feFuncB || aTag == nsGkAtoms::feFuncA ||
aTag == nsGkAtoms::feDistantLight || aTag == nsGkAtoms::fePointLight ||
aTag == nsGkAtoms::feSpotLight)) {
(aTag == nsGkAtoms::desc || aTag == nsGkAtoms::title)) {
// Sections 5.1 and G.4 of SVG 1.1 say that SVG elements other than
// svg:svg not contained within svg:svg are incorrect, although they
// don't seem to specify error handling. Ignore them, since many of
@ -4744,9 +4747,6 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
// adding to the undisplayed content map.
//
// We don't currently handle any UI for desc/title
//
// The filter types are children of filter elements that use their
// parent frames when necessary
return &sSuppressData;
}
@ -4775,6 +4775,24 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
return &sContainerData;
}
// Special case for filter primitive elements.
// These elements must have a filter element as a parent
nsCOMPtr<nsIDOMSVGFilterPrimitiveStandardAttributes> filterPrimitive =
do_QueryInterface(aElement);
if (filterPrimitive && aParentFrame->GetType() != nsGkAtoms::svgFilterFrame) {
return &sSuppressData;
}
// Some elements must be children of filter primitive elements.
if ((aTag == nsGkAtoms::feDistantLight || aTag == nsGkAtoms::fePointLight ||
aTag == nsGkAtoms::feSpotLight ||
aTag == nsGkAtoms::feFuncR || aTag == nsGkAtoms::feFuncG ||
aTag == nsGkAtoms::feFuncB || aTag == nsGkAtoms::feFuncA ||
aTag == nsGkAtoms::feMergeNode) &&
aParentFrame->GetType() != nsGkAtoms::svgFEContainerFrame) {
return &sSuppressData;
}
// Special cases for text/tspan/textPath, because the kind of frame
// they get depends on the parent frame. We ignore 'a' elements when
// determining the parent, however.
@ -4834,22 +4852,30 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
SIMPLE_SVG_CREATE(filter, NS_NewSVGFilterFrame),
SIMPLE_SVG_CREATE(pattern, NS_NewSVGPatternFrame),
SIMPLE_SVG_CREATE(mask, NS_NewSVGMaskFrame),
SIMPLE_SVG_CREATE(feBlend, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feColorMatrix, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feComposite, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feComponentTransfer, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feConvolveMatrix, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feDiffuseLighting, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feDisplacementMap, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feFlood, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feGaussianBlur, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feImage, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feMergeNode, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feMorphology, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feOffset, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feSpecularLighting, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feTile, NS_NewSVGLeafFrame),
SIMPLE_SVG_CREATE(feTurbulence, NS_NewSVGLeafFrame)
SIMPLE_SVG_CREATE(feDistantLight, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(fePointLight, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(feSpotLight, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(feBlend, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feColorMatrix, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feFuncR, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(feFuncG, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(feFuncB, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(feFuncA, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(feComposite, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feComponentTransfer, NS_NewSVGFEContainerFrame),
SIMPLE_SVG_CREATE(feConvolveMatrix, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feDiffuseLighting, NS_NewSVGFEContainerFrame),
SIMPLE_SVG_CREATE(feDisplacementMap, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feFlood, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feGaussianBlur, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feImage, NS_NewSVGFEImageFrame),
SIMPLE_SVG_CREATE(feMerge, NS_NewSVGFEContainerFrame),
SIMPLE_SVG_CREATE(feMergeNode, NS_NewSVGFEUnstyledLeafFrame),
SIMPLE_SVG_CREATE(feMorphology, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feOffset, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feSpecularLighting, NS_NewSVGFEContainerFrame),
SIMPLE_SVG_CREATE(feTile, NS_NewSVGFELeafFrame),
SIMPLE_SVG_CREATE(feTurbulence, NS_NewSVGFELeafFrame)
};
const FrameConstructionData* data =

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

@ -102,11 +102,13 @@ class nsPIDOMWindow;
struct nsPoint;
struct nsIntPoint;
struct nsIntRect;
class nsRegion;
class nsRefreshDriver;
class nsARefreshObserver;
#ifdef ACCESSIBILITY
class nsAccessibilityService;
#endif
class nsIWidget;
typedef short SelectionType;
typedef PRUint64 nsFrameState;
@ -139,8 +141,8 @@ typedef struct CapturingContentInfo {
} CapturingContentInfo;
#define NS_IPRESSHELL_IID \
{ 0x67eab923, 0x5c15, 0x4c13,\
{ 0xb5, 0xcc, 0xb2, 0x75, 0xb3, 0x5a, 0xa5, 0x38 } }
{ 0x4e23d557, 0x741a, 0x4fd0,\
{ 0x91, 0x52, 0x34, 0xe2, 0xb4, 0xef, 0xe8, 0x2e } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -1136,6 +1138,20 @@ public:
*/
virtual void SynthesizeMouseMove(bool aFromScroll) = 0;
virtual void Paint(nsIView* aViewToPaint, nsIWidget* aWidget,
const nsRegion& aDirtyRegion, const nsIntRegion& aIntDirtyRegion,
bool aPaintDefaultBackground, bool aWillSendDidPaint) = 0;
virtual nsresult HandleEvent(nsIFrame* aFrame,
nsGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus) = 0;
virtual bool ShouldIgnoreInvalidation() = 0;
virtual void WillPaint(bool aWillSendDidPaint) = 0;
virtual void DidPaint() = 0;
virtual void ClearMouseCaptureOnView(nsIView* aView) = 0;
virtual bool IsVisible() = 0;
virtual void DispatchSynthMouseMove(nsGUIEvent *aEvent, bool aFlushOnHoverChange) = 0;
/**
* Refresh observer management.
*/

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

@ -106,10 +106,14 @@ nsImageLoader::Destroy()
if (mRequest && mFrame) {
nsLayoutUtils::DeregisterImageRequest(mFrame->PresContext(), mRequest,
&mRequestRegistered);
mRequest->CancelAndForgetObserver(NS_ERROR_FAILURE);
}
mFrame = nsnull;
if (mRequest) {
mRequest->CancelAndForgetObserver(NS_ERROR_FAILURE);
}
mRequest = nsnull;
}

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

@ -510,9 +510,7 @@ nsLayoutUtils::GetCrossDocParentFrame(const nsIFrame* aFrame,
*aExtraOffset += v->GetPosition();
}
v = v->GetParent(); // subdocumentframe's view
if (!v)
return nsnull;
return static_cast<nsIFrame*>(v->GetClientData());
return v ? v->GetFrame() : nsnull;
}
// static
@ -753,16 +751,16 @@ nsIFrame* nsLayoutUtils::GetLastSibling(nsIFrame* aFrame) {
// static
nsIView*
nsLayoutUtils::FindSiblingViewFor(nsIView* aParentView, nsIFrame* aFrame) {
nsIFrame* parentViewFrame = static_cast<nsIFrame*>(aParentView->GetClientData());
nsIFrame* parentViewFrame = aParentView->GetFrame();
nsIContent* parentViewContent = parentViewFrame ? parentViewFrame->GetContent() : nsnull;
for (nsIView* insertBefore = aParentView->GetFirstChild(); insertBefore;
insertBefore = insertBefore->GetNextSibling()) {
nsIFrame* f = static_cast<nsIFrame*>(insertBefore->GetClientData());
nsIFrame* f = insertBefore->GetFrame();
if (!f) {
// this view could be some anonymous view attached to a meaningful parent
for (nsIView* searchView = insertBefore->GetParent(); searchView;
searchView = searchView->GetParent()) {
f = static_cast<nsIFrame*>(searchView->GetClientData());
f = searchView->GetFrame();
if (f) {
break;
}

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

@ -342,8 +342,7 @@ public:
* @param aView is the view to return the root frame for
* @return the root frame for the view
*/
static nsIFrame* GetFrameFor(nsIView *aView)
{ return static_cast<nsIFrame*>(aView->GetClientData()); }
static nsIFrame* GetFrameFor(nsIView *aView) { return aView->GetFrame(); }
/**
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame

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

@ -2301,7 +2301,7 @@ nsPresContext::IsRootContentDocument()
return true;
}
nsIFrame* f = static_cast<nsIFrame*>(view->GetClientData());
nsIFrame* f = view->GetFrame();
return (f && f->PresContext()->IsChrome());
}

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

@ -72,7 +72,8 @@
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsIServiceManager.h"
#include "nsFrame.h"
#include "nsIViewManager.h"
#include "nsViewManager.h"
#include "nsView.h"
#include "nsCRTGlue.h"
#include "prlog.h"
#include "prmem.h"
@ -954,8 +955,8 @@ PresShell::PresShell()
sLiveShells->PutEntry(this);
}
NS_IMPL_ISUPPORTS8(PresShell, nsIPresShell, nsIDocumentObserver,
nsIViewObserver, nsISelectionController,
NS_IMPL_ISUPPORTS7(PresShell, nsIPresShell, nsIDocumentObserver,
nsISelectionController,
nsISelectionDisplay, nsIObserver, nsISupportsWeakReference,
nsIMutationObserver)
@ -1030,7 +1031,7 @@ PresShell::Init(nsIDocument* aDocument,
mFrameConstructor = new nsCSSFrameConstructor(mDocument, this);
// The document viewer owns both view manager and pres shell.
mViewManager->SetViewObserver(this);
mViewManager->SetPresShell(this);
// Bind the context to the presentation shell.
mPresContext = aPresContext;
@ -1236,7 +1237,7 @@ PresShell::Destroy()
if (mViewManager) {
// Clear the view manager's weak pointer back to |this| in case it
// was leaked.
mViewManager->SetViewObserver(nsnull);
mViewManager->SetPresShell(nsnull);
mViewManager = nsnull;
}
@ -3631,7 +3632,7 @@ nsresult PresShell::GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocationStrin
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP_(void)
void
PresShell::DispatchSynthMouseMove(nsGUIEvent *aEvent,
bool aFlushOnHoverChange)
{
@ -3647,8 +3648,8 @@ PresShell::DispatchSynthMouseMove(nsGUIEvent *aEvent,
}
}
NS_IMETHODIMP_(void)
PresShell::ClearMouseCapture(nsIView* aView)
void
PresShell::ClearMouseCaptureOnView(nsIView* aView)
{
if (gCaptureInfo.mContent) {
if (aView) {
@ -5262,7 +5263,7 @@ static nsIView* FindFloatingViewContaining(nsIView* aView, nsPoint aPt)
// No need to look into descendants.
return nsnull;
nsIFrame* frame = static_cast<nsIFrame*>(aView->GetClientData());
nsIFrame* frame = aView->GetFrame();
if (frame) {
if (!frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY) ||
!frame->PresContext()->PresShell()->IsActive()) {
@ -5299,7 +5300,7 @@ static nsIView* FindViewContaining(nsIView* aView, nsPoint aPt)
return nsnull;
}
nsIFrame* frame = static_cast<nsIFrame*>(aView->GetClientData());
nsIFrame* frame = aView->GetFrame();
if (frame) {
if (!frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY) ||
!frame->PresContext()->PresShell()->IsActive()) {
@ -5374,7 +5375,7 @@ PresShell::ProcessSynthMouseMoveEvent(bool aFromScroll)
viewAPD = APD;
} else {
pointVM = view->GetViewManager();
nsIFrame* frame = static_cast<nsIFrame*>(view->GetClientData());
nsIFrame* frame = view->GetFrame();
NS_ASSERTION(frame, "floating views can't be anonymous");
viewAPD = frame->PresContext()->AppUnitsPerDevPixel();
refpoint = mMouseLocation.ConvertAppUnits(APD, viewAPD);
@ -5388,9 +5389,9 @@ PresShell::ProcessSynthMouseMoveEvent(bool aFromScroll)
event.time = PR_IntervalNow();
// XXX set event.isShift, event.isControl, event.isAlt, event.isMeta ?
nsCOMPtr<nsIViewObserver> observer = pointVM->GetViewObserver();
if (observer) {
observer->DispatchSynthMouseMove(&event, !aFromScroll);
nsCOMPtr<nsIPresShell> shell = pointVM->GetPresShell();
if (shell) {
shell->DispatchSynthMouseMove(&event, !aFromScroll);
}
if (!aFromScroll) {
@ -5398,7 +5399,7 @@ PresShell::ProcessSynthMouseMoveEvent(bool aFromScroll)
}
}
NS_IMETHODIMP
void
PresShell::Paint(nsIView* aViewToPaint,
nsIWidget* aWidgetToPaint,
const nsRegion& aDirtyRegion,
@ -5424,8 +5425,7 @@ PresShell::Paint(nsIView* aViewToPaint,
nsPresContext* presContext = GetPresContext();
AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
nsIFrame* frame = aPaintDefaultBackground
? nsnull : static_cast<nsIFrame*>(aViewToPaint->GetClientData());
nsIFrame* frame = aPaintDefaultBackground ? nsnull : aViewToPaint->GetFrame();
bool isRetainingManager;
LayerManager* layerManager =
@ -5444,7 +5444,7 @@ PresShell::Paint(nsIView* aViewToPaint,
if (layerManager->EndEmptyTransaction()) {
frame->UpdatePaintCountForPaintedPresShells();
presContext->NotifyDidPaintForSubtree();
return NS_OK;
return;
}
}
@ -5473,7 +5473,7 @@ PresShell::Paint(nsIView* aViewToPaint,
frame->EndDeferringInvalidatesForDisplayRoot();
presContext->NotifyDidPaintForSubtree();
return NS_OK;
return;
}
nsRefPtr<ColorLayer> root = layerManager->CreateColorLayer();
@ -5489,7 +5489,6 @@ PresShell::Paint(nsIView* aViewToPaint,
layerManager->EndTransaction(NULL, NULL);
presContext->NotifyDidPaintForSubtree();
return NS_OK;
}
// static
@ -5645,16 +5644,9 @@ PresShell::RetargetEventToParent(nsGUIEvent* aEvent,
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
nsCOMPtr<nsIPresShell> parentPresShell = GetParentPresShell();
NS_ENSURE_TRUE(parentPresShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewObserver> parentViewObserver =
do_QueryInterface(parentPresShell);
if (!parentViewObserver) {
return NS_ERROR_FAILURE;
}
// Fake the event as though it'ss from the parent pres shell's root view.
nsIView *parentRootView = parentPresShell->GetViewManager()->GetRootView();
return parentViewObserver->HandleEvent(parentRootView, aEvent, true, aEventStatus);
// Fake the event as though it's from the parent pres shell's root frame.
return parentPresShell->HandleEvent(parentPresShell->GetRootFrame(), aEvent, true, aEventStatus);
}
void
@ -5726,13 +5718,13 @@ PresShell::RecordMouseLocation(nsGUIEvent* aEvent)
}
}
NS_IMETHODIMP
PresShell::HandleEvent(nsIView *aView,
nsresult
PresShell::HandleEvent(nsIFrame *aFrame,
nsGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus)
{
NS_ASSERTION(aView, "null view");
NS_ASSERTION(aFrame, "null frame");
if (mIsDestroying ||
(sDisableNonTestMouseEvents && NS_IS_MOUSE_EVENT(aEvent) &&
@ -5748,7 +5740,7 @@ PresShell::HandleEvent(nsIView *aView,
// Accessibility events come through OS requests and not from scripts,
// so it is safe to handle here
return HandleEventInternal(aEvent, aView, aEventStatus);
return HandleEventInternal(aEvent, aEventStatus);
}
#endif
@ -5789,17 +5781,12 @@ PresShell::HandleEvent(nsIView *aView,
}
if (retargetEventDoc) {
nsIPresShell* presShell = retargetEventDoc->GetShell();
nsCOMPtr<nsIPresShell> presShell = retargetEventDoc->GetShell();
if (!presShell)
return NS_OK;
if (presShell != this) {
nsCOMPtr<nsIViewObserver> viewObserver = do_QueryInterface(presShell);
if (!viewObserver)
return NS_ERROR_FAILURE;
nsIView* view = presShell->GetViewManager()->GetRootView();
return viewObserver->HandleEvent(view, aEvent, true, aEventStatus);
return presShell->HandleEvent(presShell->GetRootFrame(), aEvent, true, aEventStatus);
}
}
}
@ -5821,20 +5808,10 @@ PresShell::HandleEvent(nsIView *aView,
// Check for a system color change up front, since the frame type is
// irrelevant
if ((aEvent->message == NS_SYSCOLORCHANGED) && mPresContext) {
nsIViewManager* vm = GetViewManager();
if (vm) {
// Only dispatch system color change when the message originates from
// from the root views widget. This is necessary to prevent us from
// dispatching the SysColorChanged notification for each child window
// which may be redundant.
nsIView* view = vm->GetRootView();
if (view == aView) {
*aEventStatus = nsEventStatus_eConsumeDoDefault;
mPresContext->SysColorChanged();
return NS_OK;
}
}
if ((aEvent->message == NS_SYSCOLORCHANGED) && mPresContext &&
aFrame == FrameManager()->GetRootFrame()) {
*aEventStatus = nsEventStatus_eConsumeDoDefault;
mPresContext->SysColorChanged();
return NS_OK;
}
@ -5852,28 +5829,8 @@ PresShell::HandleEvent(nsIView *aView,
return NS_OK;
}
nsIFrame* frame = static_cast<nsIFrame*>(aView->GetClientData());
nsIFrame* frame = aFrame;
bool dispatchUsingCoordinates = NS_IsEventUsingCoordinates(aEvent);
// if this event has no frame, we need to retarget it at a parent
// view that has a frame.
if (!frame &&
(dispatchUsingCoordinates || NS_IS_KEY_EVENT(aEvent) ||
NS_IS_IME_RELATED_EVENT(aEvent) ||
NS_IS_NON_RETARGETED_PLUGIN_EVENT(aEvent) ||
aEvent->message == NS_PLUGIN_ACTIVATE ||
aEvent->message == NS_PLUGIN_FOCUS)) {
nsIView* targetView = aView;
while (targetView && !targetView->GetClientData()) {
targetView = targetView->GetParent();
}
if (targetView) {
aView = targetView;
frame = static_cast<nsIFrame*>(aView->GetClientData());
}
}
if (dispatchUsingCoordinates) {
NS_WARN_IF_FALSE(frame, "Nothing to handle this event!");
if (!frame)
@ -5982,7 +5939,6 @@ PresShell::HandleEvent(nsIView *aView,
nsIFrame* capturingFrame = capturingContent->GetPrimaryFrame();
if (capturingFrame) {
frame = capturingFrame;
aView = frame->GetClosestView();
}
}
@ -6026,8 +5982,7 @@ PresShell::HandleEvent(nsIView *aView,
nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(),
shell->GetDocument())) {
shell = static_cast<PresShell*>(activeShell);
nsIView* activeShellRootView = shell->GetViewManager()->GetRootView();
frame = static_cast<nsIFrame*>(activeShellRootView->GetClientData());
frame = shell->GetRootFrame();
}
}
@ -6035,16 +5990,14 @@ PresShell::HandleEvent(nsIView *aView,
// Handle the event in the correct shell.
// Prevent deletion until we're done with event handling (bug 336582).
nsCOMPtr<nsIPresShell> kungFuDeathGrip(shell);
nsIView* subshellRootView = shell->GetViewManager()->GetRootView();
// We pass the subshell's root view as the view to start from. This is
// We pass the subshell's root frame as the frame to start from. This is
// the only correct alternative; if the event was captured then it
// must have been captured by us or some ancestor shell and we
// now ask the subshell to dispatch it normally.
return shell->HandlePositionedEvent(subshellRootView, frame,
aEvent, aEventStatus);
return shell->HandlePositionedEvent(frame, aEvent, aEventStatus);
}
return HandlePositionedEvent(aView, frame, aEvent, aEventStatus);
return HandlePositionedEvent(frame, aEvent, aEventStatus);
}
nsresult rv = NS_OK;
@ -6108,14 +6061,10 @@ PresShell::HandleEvent(nsIView *aView,
nsIDocument* targetDoc = eventTarget ? eventTarget->OwnerDoc() : nsnull;
if (targetDoc && targetDoc != mDocument) {
PopCurrentEventInfo();
nsIPresShell* shell = targetDoc->GetShell();
nsCOMPtr<nsIViewObserver> vo = do_QueryInterface(shell);
if (vo) {
nsIView* root = shell->GetViewManager()->GetRootView();
rv = static_cast<PresShell*>(shell)->HandleRetargetedEvent(aEvent,
root,
aEventStatus,
eventTarget);
nsCOMPtr<nsIPresShell> shell = targetDoc->GetShell();
if (shell) {
rv = static_cast<PresShell*>(shell.get())->
HandleRetargetedEvent(aEvent, aEventStatus, eventTarget);
}
return rv;
} else {
@ -6132,7 +6081,7 @@ PresShell::HandleEvent(nsIView *aView,
mCurrentEventFrame = frame;
}
if (GetCurrentEventFrame()) {
rv = HandleEventInternal(aEvent, aView, aEventStatus);
rv = HandleEventInternal(aEvent, aEventStatus);
}
#ifdef NS_DEBUG
@ -6145,7 +6094,7 @@ PresShell::HandleEvent(nsIView *aView,
if (!NS_EVENT_NEEDS_FRAME(aEvent)) {
mCurrentEventFrame = nsnull;
return HandleEventInternal(aEvent, aView, aEventStatus);
return HandleEventInternal(aEvent, aEventStatus);
}
else if (NS_IS_KEY_EVENT(aEvent)) {
// Keypress events in new blank tabs should not be completely thrown away.
@ -6176,8 +6125,7 @@ PresShell::ShowEventTargetDebug()
#endif
nsresult
PresShell::HandlePositionedEvent(nsIView* aView,
nsIFrame* aTargetFrame,
PresShell::HandlePositionedEvent(nsIFrame* aTargetFrame,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus)
{
@ -6219,7 +6167,7 @@ PresShell::HandlePositionedEvent(nsIView* aView,
}
if (GetCurrentEventFrame()) {
rv = HandleEventInternal(aEvent, aView, aEventStatus);
rv = HandleEventInternal(aEvent, aEventStatus);
}
#ifdef NS_DEBUG
@ -6234,7 +6182,7 @@ PresShell::HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame,
nsIContent* aContent, nsEventStatus* aStatus)
{
PushCurrentEventInfo(aFrame, aContent);
nsresult rv = HandleEventInternal(aEvent, nsnull, aStatus);
nsresult rv = HandleEventInternal(aEvent, aStatus);
PopCurrentEventInfo();
return rv;
}
@ -6323,8 +6271,7 @@ IsFullScreenAndRestrictedKeyEvent(nsIContent* aTarget, const nsEvent* aEvent)
}
nsresult
PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
nsEventStatus* aStatus)
PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
{
NS_TIME_FUNCTION_MIN(1.0);
@ -6443,11 +6390,9 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
// bug 329430
aEvent->target = nsnull;
nsWeakView weakView(aView);
// 1. Give event to event manager for pre event state changes and
// generation of synthetic events.
rv = manager->PreHandleEvent(mPresContext, aEvent, mCurrentEventFrame,
aStatus, aView);
rv = manager->PreHandleEvent(mPresContext, aEvent, mCurrentEventFrame, aStatus);
// 2. Give event to the DOM for third party and JS use.
if (GetCurrentEventFrame() && NS_SUCCEEDED(rv)) {
@ -6486,8 +6431,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
// generation of synthetic events.
if (!mIsDestroying && NS_SUCCEEDED(rv)) {
rv = manager->PostHandleEvent(mPresContext, aEvent,
GetCurrentEventFrame(), aStatus,
weakView.GetView());
GetCurrentEventFrame(), aStatus);
}
}
@ -6896,19 +6840,13 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
NS_IF_ADDREF(*aTargetToUse = focusedContent);
}
NS_IMETHODIMP
PresShell::ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight)
{
return ResizeReflow(aWidth, aHeight);
}
NS_IMETHODIMP_(bool)
bool
PresShell::ShouldIgnoreInvalidation()
{
return mPaintingSuppressed || !mIsActive;
}
NS_IMETHODIMP_(void)
void
PresShell::WillPaint(bool aWillSendDidPaint)
{
// Don't bother doing anything if some viewmanager in our tree is painting
@ -6936,7 +6874,7 @@ PresShell::WillPaint(bool aWillSendDidPaint)
FlushPendingNotifications(Flush_InterruptibleLayout);
}
NS_IMETHODIMP_(void)
void
PresShell::DidPaint()
{
if (mPaintingSuppressed || !mIsActive || !IsVisible()) {
@ -6952,7 +6890,7 @@ PresShell::DidPaint()
}
}
NS_IMETHODIMP_(bool)
bool
PresShell::IsVisible()
{
if (!mViewManager)
@ -6972,7 +6910,7 @@ PresShell::IsVisible()
if (!view)
return true;
nsIFrame* frame = static_cast<nsIFrame*>(view->GetClientData());
nsIFrame* frame = view->GetFrame();
if (!frame)
return true;
@ -8075,7 +8013,7 @@ PresShell::VerifyIncrementalReflow()
newSet.forget();
// Note that after we create the shell, we must make sure to destroy it
sh->SetVerifyReflowEnable(false); // turn off verify reflow while we're reflowing the test frame tree
vm->SetViewObserver((nsIViewObserver *)((PresShell*)sh.get()));
vm->SetPresShell(sh);
{
nsAutoCauseReflowNotifier crNotifier(this);
sh->InitialReflow(r.width, r.height);

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

@ -60,7 +60,6 @@
#define nsPresShell_h_
#include "nsIPresShell.h"
#include "nsIViewObserver.h"
#include "nsStubDocumentObserver.h"
#include "nsISelectionController.h"
#include "nsIObserver.h"
@ -169,7 +168,7 @@ private:
class nsPresShellEventCB;
class nsAutoCauseReflowNotifier;
class PresShell : public nsIPresShell, public nsIViewObserver,
class PresShell : public nsIPresShell,
public nsStubDocumentObserver,
public nsISelectionController, public nsIObserver,
public nsSupportsWeakReference
@ -314,30 +313,25 @@ public:
//nsIViewObserver interface
NS_IMETHOD Paint(nsIView* aViewToPaint,
nsIWidget* aWidget,
const nsRegion& aDirtyRegion,
const nsIntRegion& aIntDirtyRegion,
bool aPaintDefaultBackground,
bool aWillSendDidPaint);
NS_IMETHOD HandleEvent(nsIView* aView,
nsGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus);
virtual void Paint(nsIView* aViewToPaint, nsIWidget* aWidget,
const nsRegion& aDirtyRegion, const nsIntRegion& aIntDirtyRegion,
bool aPaintDefaultBackground, bool aWillSendDidPaint);
virtual nsresult HandleEvent(nsIFrame* aFrame,
nsGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus);
virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent,
nsEvent* aEvent,
nsEventStatus* aStatus);
virtual NS_HIDDEN_(nsresult) HandleDOMEventWithTarget(nsIContent* aTargetContent,
nsIDOMEvent* aEvent,
nsEventStatus* aStatus);
NS_IMETHOD ResizeReflow(nsIView *aView, nscoord aWidth, nscoord aHeight);
NS_IMETHOD_(bool) ShouldIgnoreInvalidation();
NS_IMETHOD_(void) WillPaint(bool aWillSendDidPaint);
NS_IMETHOD_(void) DidPaint();
NS_IMETHOD_(void) DispatchSynthMouseMove(nsGUIEvent *aEvent,
bool aFlushOnHoverChange);
NS_IMETHOD_(void) ClearMouseCapture(nsIView* aView);
NS_IMETHOD_(bool) IsVisible();
virtual bool ShouldIgnoreInvalidation();
virtual void WillPaint(bool aWillSendDidPaint);
virtual void DidPaint();
virtual void DispatchSynthMouseMove(nsGUIEvent *aEvent, bool aFlushOnHoverChange);
virtual void ClearMouseCaptureOnView(nsIView* aView);
virtual bool IsVisible();
// caret handling
virtual NS_HIDDEN_(already_AddRefed<nsCaret>) GetCaret() const;
@ -605,14 +599,13 @@ protected:
}
}
nsresult HandleRetargetedEvent(nsEvent* aEvent, nsIView* aView,
nsEventStatus* aStatus, nsIContent* aTarget)
nsresult HandleRetargetedEvent(nsEvent* aEvent, nsEventStatus* aStatus, nsIContent* aTarget)
{
PushCurrentEventInfo(nsnull, nsnull);
mCurrentEventContent = aTarget;
nsresult rv = NS_OK;
if (GetCurrentEventFrame()) {
rv = HandleEventInternal(aEvent, aView, aStatus);
rv = HandleEventInternal(aEvent, aStatus);
}
PopCurrentEventInfo();
return rv;
@ -801,10 +794,8 @@ protected:
private:
void PushCurrentEventInfo(nsIFrame* aFrame, nsIContent* aContent);
void PopCurrentEventInfo();
nsresult HandleEventInternal(nsEvent* aEvent, nsIView* aView,
nsEventStatus *aStatus);
nsresult HandlePositionedEvent(nsIView* aView,
nsIFrame* aTargetFrame,
nsresult HandleEventInternal(nsEvent* aEvent, nsEventStatus *aStatus);
nsresult HandlePositionedEvent(nsIFrame* aTargetFrame,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus);
// This returns the focused DOM window under our top level window.

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

@ -245,7 +245,7 @@ nsContainerFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
// Prevent event dispatch during destruction
if (HasView()) {
GetView()->SetClientData(nsnull);
GetView()->SetFrame(nsnull);
}
// Delete the primary child list

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

@ -575,7 +575,7 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
if (view) {
// Break association between view and frame
view->SetClientData(nsnull);
view->SetFrame(nsnull);
// Destroy the view
view->Destroy();
@ -4049,7 +4049,7 @@ nsresult
nsIFrame::SetView(nsIView* aView)
{
if (aView) {
aView->SetClientData(this);
aView->SetFrame(this);
// Set a property on the frame
Properties().Set(ViewProperty(), aView);

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

@ -199,6 +199,10 @@ public:
nsSVGClipPathFrame_id,
nsSVGContainerFrame_id,
nsSVGDisplayContainerFrame_id,
SVGFEContainerFrame_id,
SVGFEImageFrame_id,
SVGFELeafFrame_id,
SVGFEUnstyledLeafFrame_id,
nsSVGFilterFrame_id,
nsSVGForeignObjectFrame_id,
nsSVGGenericContainerFrame_id,
@ -208,7 +212,6 @@ public:
nsSVGGradientFrame_id,
nsSVGImageFrame_id,
nsSVGInnerSVGFrame_id,
nsSVGLeafFrame_id,
nsSVGLinearGradientFrame_id,
nsSVGMarkerFrame_id,
nsSVGMaskFrame_id,

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

@ -107,7 +107,7 @@ GetDocumentFromView(nsIView* aView)
{
NS_PRECONDITION(aView, "");
nsIFrame* f = static_cast<nsIFrame*>(aView->GetClientData());
nsIFrame* f = aView->GetFrame();
nsIPresShell* ps = f ? f->PresContext()->PresShell() : nsnull;
return ps ? ps->GetDocument() : nsnull;
}
@ -250,9 +250,7 @@ nsSubDocumentFrame::GetSubdocumentRootFrame()
if (!mInnerView)
return nsnull;
nsIView* subdocView = mInnerView->GetFirstChild();
if (!subdocView)
return nsnull;
return static_cast<nsIFrame*>(subdocView->GetClientData());
return subdocView ? subdocView->GetFrame() : nsnull;
}
NS_IMETHODIMP
@ -287,9 +285,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsCOMPtr<nsIPresShell> presShell = nsnull;
nsIFrame* subdocRootFrame =
static_cast<nsIFrame*>(subdocView->GetClientData());
nsIFrame* subdocRootFrame = subdocView->GetFrame();
if (subdocRootFrame) {
presShell = subdocRootFrame->PresContext()->PresShell();
}
@ -303,7 +299,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsIView* nextView = subdocView->GetNextSibling();
nsIFrame* frame = nsnull;
if (nextView) {
frame = static_cast<nsIFrame*>(nextView->GetClientData());
frame = nextView->GetFrame();
}
if (frame) {
nsIPresShell* ps = frame->PresContext()->PresShell();

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

@ -226,9 +226,11 @@ fails-if(Android) random-if(gtk2Widget) != text-language-01.xhtml text-language-
== text-layout-05.svg text-layout-05-ref.svg
== text-scale-01.svg text-scale-01-ref.svg
== text-stroke-scaling-01.svg text-stroke-scaling-01-ref.svg
== stroke-dasharray-and-pathLength-01.svg pass.svg
== stroke-linecap-square-w-zero-length-segs-01.svg pass.svg
== stroke-linecap-square-w-zero-length-segs-02.svg pass.svg
== textPath-01.svg textPath-01-ref.svg
== textPath-02.svg pass.svg
== text-style-01a.svg text-style-01-ref.svg
== text-style-01b.svg text-style-01-ref.svg
== text-style-01c.svg text-style-01-ref.svg

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

@ -0,0 +1,20 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<title>Test stroke-dasharray with pathLength and scaling</title>
<rect width="100%" height="100%" fill="lime"/>
<!--
Here we set the 'pathLength' to twice the actual length of the path,
which should cause the stroke-dasharray values to be scaled down by one
half. Visually, this should effectively cancel out the 2x scaling along
the x-axis introduced by the 'transform' attribute.
-->
<path d="M0.5,10 L100.5,10" stroke="red" stroke-width="18" stroke-dasharray="18 22" pathLength="200" transform="scale(2,1)"/>
<rect x="1" y="1" width="18" height="18" fill="lime"/>
<rect x="41" y="1" width="18" height="18" fill="lime"/>
<rect x="81" y="1" width="18" height="18" fill="lime"/>
<rect x="121" y="1" width="18" height="18" fill="lime"/>
<rect x="161" y="1" width="18" height="18" fill="lime"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 995 B

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

@ -0,0 +1,15 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Test effect on startOffset of a scale transform on a textPath's path</title>
<defs>
<path id="path" d="M20,20 C20,150 150,150 150,20" pathLength="100" transform="scale(2,1)" fill="none" stroke="black"/>
</defs>
<rect width="100%" height="100%" fill="lime"/>
<text y="50">
<textPath xlink:href="#path" font-size="20" fill="red" startOffset="50">FAIL</textPath>
</text>
<rect x="160" y="80" width="100" height="60" fill="lime"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 679 B

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

@ -63,7 +63,10 @@ CPPSRCS = \
nsSVGImageFrame.cpp \
nsSVGInnerSVGFrame.cpp \
nsSVGIntegrationUtils.cpp \
nsSVGLeafFrame.cpp \
SVGFEContainerFrame.cpp \
SVGFEImageFrame.cpp \
SVGFELeafFrame.cpp \
SVGFEUnstyledLeafFrame.cpp \
nsSVGMarkerFrame.cpp \
nsSVGMaskFrame.cpp \
nsSVGOuterSVGFrame.cpp \

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

@ -0,0 +1,137 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla SVG project.
*
* The Initial Developer of the Original Code is Robert Longson.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsContainerFrame.h"
#include "nsSVGEffects.h"
#include "nsSVGFilters.h"
typedef nsContainerFrame SVGFEContainerFrameBase;
/*
* This frame is used by filter primitive elements that
* have special child elements that provide parameters.
*/
class SVGFEContainerFrame : public SVGFEContainerFrameBase
{
friend nsIFrame*
NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
protected:
SVGFEContainerFrame(nsStyleContext* aContext) : SVGFEContainerFrameBase(aContext) {}
public:
NS_DECL_FRAMEARENA_HELPERS
virtual bool IsFrameOfType(PRUint32 aFlags) const
{
return SVGFEContainerFrameBase::IsFrameOfType(
aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGContainer));
}
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("SVGFEContainer"), aResult);
}
#endif
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
#ifdef DEBUG
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
#endif
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::svgFEContainerFrame
*/
virtual nsIAtom* GetType() const;
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
};
nsIFrame*
NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) SVGFEContainerFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame)
/* virtual */ void
SVGFEContainerFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
SVGFEContainerFrameBase::DidSetStyleContext(aOldStyleContext);
nsSVGEffects::InvalidateRenderingObservers(this);
}
#ifdef DEBUG
NS_IMETHODIMP
SVGFEContainerFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
nsCOMPtr<nsIDOMSVGFilterPrimitiveStandardAttributes> elem = do_QueryInterface(aContent);
NS_ASSERTION(elem,
"Trying to construct an SVGFEContainerFrame for a "
"content element that doesn't support the right interfaces");
return SVGFEContainerFrameBase::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
nsIAtom *
SVGFEContainerFrame::GetType() const
{
return nsGkAtoms::svgFEContainerFrame;
}
NS_IMETHODIMP
SVGFEContainerFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
nsSVGEffects::InvalidateRenderingObservers(this);
}
return SVGFEContainerFrameBase::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
}

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

@ -0,0 +1,171 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla SVG project.
*
* The Initial Developer of the Original Code is Robert Longson.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsFrame.h"
#include "nsSVGEffects.h"
#include "nsSVGFilters.h"
#include "nsContentUtils.h"
#include "nsImageLoadingContent.h"
using namespace mozilla;
typedef nsFrame SVGFEImageFrameBase;
class SVGFEImageFrame : public SVGFEImageFrameBase
{
friend nsIFrame*
NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
protected:
SVGFEImageFrame(nsStyleContext* aContext) : SVGFEImageFrameBase(aContext) {}
public:
NS_DECL_FRAMEARENA_HELPERS
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
virtual void DestroyFrom(nsIFrame* aDestructRoot);
virtual bool IsFrameOfType(PRUint32 aFlags) const
{
return SVGFEImageFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("SVGFEImage"), aResult);
}
#endif
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::svgFEImageFrame
*/
virtual nsIAtom* GetType() const;
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
};
nsIFrame*
NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) SVGFEImageFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(SVGFEImageFrame)
/* virtual */ void
SVGFEImageFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
SVGFEImageFrameBase::DidSetStyleContext(aOldStyleContext);
nsSVGEffects::InvalidateRenderingObservers(this);
}
/* virtual */ void
SVGFEImageFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
nsCOMPtr<nsIImageLoadingContent> imageLoader =
do_QueryInterface(SVGFEImageFrameBase::mContent);
if (imageLoader) {
imageLoader->FrameDestroyed(this);
}
SVGFEImageFrameBase::DestroyFrom(aDestructRoot);
}
NS_IMETHODIMP
SVGFEImageFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
#ifdef DEBUG
nsCOMPtr<nsIDOMSVGFEImageElement> elem = do_QueryInterface(aContent);
NS_ASSERTION(elem,
"Trying to construct an SVGFEImageFrame for a "
"content element that doesn't support the right interfaces");
#endif /* DEBUG */
SVGFEImageFrameBase::Init(aContent, aParent, aPrevInFlow);
nsCOMPtr<nsIImageLoadingContent> imageLoader =
do_QueryInterface(SVGFEImageFrameBase::mContent);
if (imageLoader) {
imageLoader->FrameCreated(this);
}
return NS_OK;
}
nsIAtom *
SVGFEImageFrame::GetType() const
{
return nsGkAtoms::svgFEImageFrame;
}
NS_IMETHODIMP
SVGFEImageFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
nsSVGFEImageElement *element = static_cast<nsSVGFEImageElement*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
nsSVGEffects::InvalidateRenderingObservers(this);
}
if (aNameSpaceID == kNameSpaceID_XLink &&
aAttribute == nsGkAtoms::href) {
// Prevent setting image.src by exiting early
if (nsContentUtils::IsImageSrcSetDisabled()) {
return NS_OK;
}
if (element->mStringAttributes[nsSVGFEImageElement::HREF].IsExplicitlySet()) {
element->LoadSVGImage(true, true);
} else {
element->CancelImageRequests(true);
}
}
return SVGFEImageFrameBase::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
}

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

@ -0,0 +1,137 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla SVG project.
*
* The Initial Developer of the Original Code is IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsFrame.h"
#include "nsSVGFilters.h"
#include "nsSVGEffects.h"
typedef nsFrame SVGFELeafFrameBase;
/*
* This frame is used by filter primitive elements that don't
* have special child elements that provide parameters.
*/
class SVGFELeafFrame : public SVGFELeafFrameBase
{
friend nsIFrame*
NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
protected:
SVGFELeafFrame(nsStyleContext* aContext) : SVGFELeafFrameBase(aContext) {}
public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
#endif
virtual bool IsFrameOfType(PRUint32 aFlags) const
{
return SVGFELeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("SVGFELeaf"), aResult);
}
#endif
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::svgFELeafFrame
*/
virtual nsIAtom* GetType() const;
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
};
nsIFrame*
NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) SVGFELeafFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame)
/* virtual */ void
SVGFELeafFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
SVGFELeafFrameBase::DidSetStyleContext(aOldStyleContext);
nsSVGEffects::InvalidateRenderingObservers(this);
}
#ifdef DEBUG
NS_IMETHODIMP
SVGFELeafFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
nsCOMPtr<nsIDOMSVGFilterPrimitiveStandardAttributes> elem = do_QueryInterface(aContent);
NS_ASSERTION(elem,
"Trying to construct an SVGFELeafFrame for a "
"content element that doesn't support the right interfaces");
return SVGFELeafFrameBase::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
nsIAtom *
SVGFELeafFrame::GetType() const
{
return nsGkAtoms::svgFELeafFrame;
}
NS_IMETHODIMP
SVGFELeafFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
nsSVGEffects::InvalidateRenderingObservers(this);
}
return SVGFELeafFrameBase::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
}

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

@ -0,0 +1,103 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla SVG project.
*
* The Initial Developer of the Original Code is Robert Longson.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsFrame.h"
#include "nsSVGFilters.h"
#include "nsSVGEffects.h"
typedef nsFrame SVGFEUnstyledLeafFrameBase;
class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase
{
friend nsIFrame*
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
protected:
SVGFEUnstyledLeafFrame(nsStyleContext* aContext) : SVGFEUnstyledLeafFrameBase(aContext) {}
public:
NS_DECL_FRAMEARENA_HELPERS
virtual bool IsFrameOfType(PRUint32 aFlags) const
{
return SVGFEUnstyledLeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult);
}
#endif
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::svgFEUnstyledLeafFrame
*/
virtual nsIAtom* GetType() const;
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
};
nsIFrame*
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) SVGFEUnstyledLeafFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
nsIAtom *
SVGFEUnstyledLeafFrame::GetType() const
{
return nsGkAtoms::svgFEUnstyledLeafFrame;
}
NS_IMETHODIMP
SVGFEUnstyledLeafFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
nsSVGEffects::InvalidateRenderingObservers(this);
}
return SVGFEUnstyledLeafFrameBase::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
}

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

@ -120,8 +120,8 @@ nsSVGGeometryFrame::GetStrokeDashArray(gfxFloat **aDashes, PRUint32 *aCount)
gfxFloat pathScale = 1.0;
if (mContent->Tag() == nsGkAtoms::path) {
pathScale =
static_cast<nsSVGPathElement*>(mContent)->GetPathLengthScale();
pathScale = static_cast<nsSVGPathElement*>(mContent)->
GetPathLengthScale(nsSVGPathElement::eForStroking);
if (pathScale <= 0) {
return NS_OK;
}

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

@ -177,7 +177,7 @@ nsSVGTextPathFrame::GetOffsetScale()
return 1.0;
return static_cast<nsSVGPathElement*>(pathFrame->GetContent())->
GetPathLengthScale();
GetPathLengthScale(nsSVGPathElement::eForTextPath);
}
//----------------------------------------------------------------------

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

@ -81,7 +81,6 @@ class nsMenuBarFrame;
class nsMenuParent;
class nsIDOMKeyEvent;
class nsIDocShellTreeItem;
class nsIView;
// when a menu command is executed, the closemenu attribute may be used
// to define how the menu should be closed up
@ -478,9 +477,10 @@ public:
nsIContent* aLastPopup = nsnull);
/**
* Hide the popup associated the view aView
* Hide the popup aFrame. This method is called by the view manager when the
* close button is pressed.
*/
void HidePopup(nsIView* aView);
void HidePopup(nsIFrame* aFrame);
/**
* Hide a popup after a short delay. This is used when rolling over menu items.
@ -553,13 +553,13 @@ public:
* Indicate that the popup associated with aView has been moved to the
* specified screen coordiates.
*/
void PopupMoved(nsIView* aView, nsIntPoint aPoint);
void PopupMoved(nsIFrame* aFrame, nsIntPoint aPoint);
/**
* Indicate that the popup associated with aView has been resized to the
* specified screen width and height.
*/
void PopupResized(nsIView* aView, nsIntSize ASize);
void PopupResized(nsIFrame* aFrame, nsIntSize ASize);
/**
* Called when a popup frame is destroyed. In this case, just remove the

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

@ -336,14 +336,13 @@ nsXULPopupManager::AdjustPopupsOnWindowChange(nsPIDOMWindow* aWindow)
}
static
nsMenuPopupFrame* GetPopupToMoveOrResize(nsIView* aView)
nsMenuPopupFrame* GetPopupToMoveOrResize(nsIFrame* aFrame)
{
nsIFrame *frame = static_cast<nsIFrame *>(aView->GetClientData());
if (!frame || frame->GetType() != nsGkAtoms::menuPopupFrame)
if (!aFrame || aFrame->GetType() != nsGkAtoms::menuPopupFrame)
return nsnull;
// no point moving or resizing hidden popups
nsMenuPopupFrame* menuPopupFrame = static_cast<nsMenuPopupFrame *>(frame);
nsMenuPopupFrame* menuPopupFrame = static_cast<nsMenuPopupFrame *>(aFrame);
if (menuPopupFrame->PopupState() != ePopupOpenAndVisible)
return nsnull;
@ -351,9 +350,9 @@ nsMenuPopupFrame* GetPopupToMoveOrResize(nsIView* aView)
}
void
nsXULPopupManager::PopupMoved(nsIView* aView, nsIntPoint aPnt)
nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt)
{
nsMenuPopupFrame* menuPopupFrame = GetPopupToMoveOrResize(aView);
nsMenuPopupFrame* menuPopupFrame = GetPopupToMoveOrResize(aFrame);
if (!menuPopupFrame)
return;
@ -376,9 +375,9 @@ nsXULPopupManager::PopupMoved(nsIView* aView, nsIntPoint aPnt)
}
void
nsXULPopupManager::PopupResized(nsIView* aView, nsIntSize aSize)
nsXULPopupManager::PopupResized(nsIFrame* aFrame, nsIntSize aSize)
{
nsMenuPopupFrame* menuPopupFrame = GetPopupToMoveOrResize(aView);
nsMenuPopupFrame* menuPopupFrame = GetPopupToMoveOrResize(aFrame);
if (!menuPopupFrame)
return;
@ -998,13 +997,10 @@ nsXULPopupManager::HidePopupCallback(nsIContent* aPopup,
}
void
nsXULPopupManager::HidePopup(nsIView* aView)
nsXULPopupManager::HidePopup(nsIFrame* aFrame)
{
nsIFrame *frame = static_cast<nsIFrame *>(aView->GetClientData());
if (!frame || frame->GetType() != nsGkAtoms::menuPopupFrame)
return;
HidePopup(frame->GetContent(), false, true, false);
if (aFrame && aFrame->GetType() == nsGkAtoms::menuPopupFrame)
HidePopup(aFrame->GetContent(), false, true, false);
}
void

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

@ -989,10 +989,10 @@ struct arena_bin_s {
};
struct arena_s {
#ifdef MALLOC_DEBUG
/* For bug 703087, we're temporarily adding arena.magic to release
builds. */
uint32_t magic;
# define ARENA_MAGIC 0x947d3d24
#endif
/* All operations on this arena require that lock be locked. */
#ifdef MOZ_MEMORY
@ -4332,7 +4332,15 @@ isalloc_validate(const void *ptr)
return (0);
if (chunk != ptr) {
assert(chunk->arena->magic == ARENA_MAGIC);
/* For bug 703087, we've temporarily made what is normally a
debug-only assertion here into a fatal assertion. */
if (chunk->arena->magic != ARENA_MAGIC) {
char* boom = (char*) 0;
_malloc_message("isalloc_validate called with invalid pointer. "
"Crashing...\n", "", "", "");
*boom = 1;
}
return (arena_salloc(ptr));
} else {
size_t ret;
@ -4842,10 +4850,9 @@ arena_new(arena_t *arena)
#endif
}
#ifdef MALLOC_DEBUG
/* For bug 703087, we're temporarily adding arena->magic for release
builds. */
arena->magic = ARENA_MAGIC;
#endif
return (false);
}
@ -6063,13 +6070,16 @@ MALLOC_OUT:
default_zone = malloc_default_zone();
/*
* We only use jemalloc with versions of MacOS we've seen (10.5, 10.6, and
* 10.7). We'll have to update our code to work with newer versions,
* because the malloc zone layout is likely to change.
* We only use jemalloc with MacOS 10.6 and 10.7. jemalloc is disabled
* on 32-bit builds (10.5 and 32-bit 10.6) due to bug 702250, an
* apparent MacOS bug. In fact, this code isn't even compiled on
* 32-bit builds.
*
* We'll have to update our code to work with newer versions, because
* the malloc zone layout is likely to change.
*/
osx_use_jemalloc = (default_zone->version == LEOPARD_MALLOC_ZONE_T_VERSION ||
default_zone->version == SNOW_LEOPARD_MALLOC_ZONE_T_VERSION ||
osx_use_jemalloc = (default_zone->version == SNOW_LEOPARD_MALLOC_ZONE_T_VERSION ||
default_zone->version == LION_MALLOC_ZONE_T_VERSION);
/* Allow us dynamically turn off jemalloc for testing. */

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

@ -174,7 +174,7 @@ public:
T* operator->() const { return ptr; }
T& operator*() const { return *ptr; }
template<typename U>
operator TemporaryRef<U>() { return forget(); }
operator TemporaryRef<U>() { return TemporaryRef<U>(ptr); }
private:
void assign(T* t) {

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

@ -696,12 +696,14 @@ com
// CentralNic names : http://www.centralnic.com/names/domains
// Confirmed by registry <gavin.brown@centralnic.com> 2008-06-09
// Updated by registry <gavin.brown@centralnic.com> 2011-05-27
ar.com
br.com
cn.com
de.com
eu.com
gb.com
gr.com
hu.com
jpn.com
kr.com
@ -762,6 +764,10 @@ cz
// reservations) 2008-07-01
de
// CentralNic names : http://www.centralnic.com/names/domains
// Submitted by registry <gavin.brown@centralnic.com> 2011-05-27
com.de
// dj : http://en.wikipedia.org/wiki/.dj
dj
@ -3491,7 +3497,9 @@ org
// CentralNic names : http://www.centralnic.com/names/domains
// Submitted by registry <gavin.brown@centralnic.com> 2008-06-17
// Updated by registry <gavin.brown@centralnic.com> 2011-05-27
ae.org
us.org
// ZaNiC names : http://www.za.net/
// Confirmed by registry <hostmaster@nic.za.net> 2009-10-03

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

@ -370,6 +370,8 @@ public final class ElementName
// return "ANNOTATION_XML";
// case TreeBuilder.FOREIGNOBJECT_OR_DESC:
// return "FOREIGNOBJECT_OR_DESC";
// case TreeBuilder.MENUITEM:
// return "MENUITEM";
// }
// return null;
// }
@ -713,6 +715,7 @@ public final class ElementName
public static final ElementName LOWLIMIT = new ElementName("lowlimit", "lowlimit", TreeBuilder.OTHER);
public static final ElementName METADATA = new ElementName("metadata", "metadata", TreeBuilder.OTHER);
public static final ElementName MENCLOSE = new ElementName("menclose", "menclose", TreeBuilder.OTHER);
public static final ElementName MENUITEM = new ElementName("menuitem", "menuitem", TreeBuilder.MENUITEM | SPECIAL);
public static final ElementName MPHANTOM = new ElementName("mphantom", "mphantom", TreeBuilder.OTHER);
public static final ElementName NOFRAMES = new ElementName("noframes", "noframes", TreeBuilder.NOFRAMES | SPECIAL);
public static final ElementName NOSCRIPT = new ElementName("noscript", "noscript", TreeBuilder.NOSCRIPT | SPECIAL);
@ -1105,6 +1108,7 @@ public final class ElementName
LOWLIMIT,
METADATA,
MENCLOSE,
MENUITEM,
MPHANTOM,
NOFRAMES,
NOSCRIPT,
@ -1498,6 +1502,7 @@ public final class ElementName
281683369,
282120228,
282250732,
282498697,
282508942,
283743649,
283787570,

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

@ -1204,8 +1204,10 @@ public class Tokenizer implements Locator {
attributes.addAttribute(attributeName, "", xmlnsPolicy);
}
} else {
err("Attribute value omitted for a non-boolean attribute. (HTML4-only error.)");
attributes.addAttribute(attributeName, "", xmlnsPolicy);
if (AttributeName.BORDER != attributeName) {
err("Attribute value omitted for a non-boolean attribute. (HTML4-only error.)");
attributes.addAttribute(attributeName, "", xmlnsPolicy);
}
}
} else {
if (AttributeName.SRC == attributeName
@ -6758,9 +6760,7 @@ public class Tokenizer implements Locator {
attributeName = other.attributeName.cloneAttributeName(interner);
}
if (attributes != null) {
Portability.delete(attributes);
}
Portability.delete(attributes);
if (other.attributes == null) {
attributes = null;
} else {

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

@ -55,6 +55,7 @@ import nu.validator.htmlparser.common.TokenHandler;
import nu.validator.htmlparser.common.XmlViolationPolicy;
import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@ -198,6 +199,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
final static int KEYGEN = 65;
final static int MENUITEM = 66;
// start insertion modes
private static final int INITIAL = 0;
@ -340,7 +343,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
// [NOCPP[
private static final @Local String HTML_LOCAL = "html";
// ]NOCPP]
private int mode = INITIAL;
@ -362,6 +365,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
private DoctypeExpectation doctypeExpectation = DoctypeExpectation.HTML;
private LocatorImpl firstCommentLocation;
// ]NOCPP]
private boolean scriptingEnabled = false;
@ -519,6 +524,21 @@ public abstract class TreeBuilder<T> implements TokenHandler,
errorHandler.warning(spe);
}
/**
* Reports a warning with an explicit locator
*
* @param message
* the message
* @throws SAXException
*/
final void warn(String message, Locator locator) throws SAXException {
if (errorHandler == null) {
return;
}
SAXParseException spe = new SAXParseException(message, locator);
errorHandler.warning(spe);
}
// ]NOCPP]
@SuppressWarnings("unchecked") public final void startTokenization(Tokenizer self) throws SAXException {
@ -536,6 +556,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
html4 = false;
idLocations.clear();
wantingComments = wantsComments();
firstCommentLocation = null;
// ]NOCPP]
start(fragment);
charBufferLen = 0;
@ -619,6 +640,11 @@ public abstract class TreeBuilder<T> implements TokenHandler,
false);
} else if (isAlmostStandards(publicIdentifier,
systemIdentifier)) {
// [NOCPP[
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
// ]NOCPP]
errAlmostStandardsDoctype();
documentModeInternal(
DocumentMode.ALMOST_STANDARDS_MODE,
@ -626,6 +652,9 @@ public abstract class TreeBuilder<T> implements TokenHandler,
false);
} else {
// [NOCPP[
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
if ((Portability.literalEqualsString(
"-//W3C//DTD HTML 4.0//EN",
publicIdentifier) && (systemIdentifier == null || Portability.literalEqualsString(
@ -672,12 +701,18 @@ public abstract class TreeBuilder<T> implements TokenHandler,
true);
} else if (isAlmostStandards(publicIdentifier,
systemIdentifier)) {
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
err("Almost standards mode doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
documentModeInternal(
DocumentMode.ALMOST_STANDARDS_MODE,
publicIdentifier, systemIdentifier,
true);
} else {
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
if ("-//W3C//DTD HTML 4.01//EN".equals(publicIdentifier)) {
if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
@ -702,6 +737,9 @@ public abstract class TreeBuilder<T> implements TokenHandler,
true);
} else if (isAlmostStandards(publicIdentifier,
systemIdentifier)) {
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
if ("-//W3C//DTD HTML 4.01 Transitional//EN".equals(publicIdentifier)
&& systemIdentifier != null) {
if (!"http://www.w3.org/TR/html4/loose.dtd".equals(systemIdentifier)) {
@ -715,6 +753,9 @@ public abstract class TreeBuilder<T> implements TokenHandler,
publicIdentifier, systemIdentifier,
true);
} else {
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
err("The doctype was not the HTML 4.01 Transitional doctype. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
documentModeInternal(
DocumentMode.STANDARDS_MODE,
@ -735,6 +776,9 @@ public abstract class TreeBuilder<T> implements TokenHandler,
html4);
} else if (isAlmostStandards(publicIdentifier,
systemIdentifier)) {
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
if ("-//W3C//DTD HTML 4.01 Transitional//EN".equals(publicIdentifier)) {
if (!"http://www.w3.org/TR/html4/loose.dtd".equals(systemIdentifier)) {
warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\u201D.");
@ -747,6 +791,9 @@ public abstract class TreeBuilder<T> implements TokenHandler,
publicIdentifier, systemIdentifier,
html4);
} else {
if (firstCommentLocation != null) {
warn("Comments seen before doctype. Internet Explorer will go into the quirks mode.", firstCommentLocation);
}
if ("-//W3C//DTD HTML 4.01//EN".equals(publicIdentifier)) {
if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
@ -822,6 +869,9 @@ public abstract class TreeBuilder<T> implements TokenHandler,
throws SAXException {
needToDropLF = false;
// [NOCPP[
if (firstCommentLocation == null) {
firstCommentLocation = new LocatorImpl(tokenizer);
}
if (!wantingComments) {
return;
}
@ -2057,6 +2107,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case AREA_OR_WBR:
reconstructTheActiveFormattingElements();
// FALL THROUGH to PARAM_OR_SOURCE_OR_TRACK
// CPPONLY: case MENUITEM:
case PARAM_OR_SOURCE_OR_TRACK:
appendVoidElementToCurrentMayFoster(
elementName,
@ -3517,6 +3568,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
HtmlAttributes.EMPTY_ATTRIBUTES);
break endtagloop;
case AREA_OR_WBR:
// CPPONLY: case MENUITEM:
case PARAM_OR_SOURCE_OR_TRACK:
case EMBED_OR_IMG:
case IMAGE:
@ -4683,10 +4735,10 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case ALTER_INFOSET:
// fall through
case ALLOW:
warn("Attribute \u201Cxmlns:xlink\u201D with the value \u201Chttp://www.w3org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
warn("Attribute \u201Cxmlns:xlink\u201D with a value other than \u201Chttp://www.w3.org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
break;
case FATAL:
fatal("Attribute \u201Cxmlns:xlink\u201D with the value \u201Chttp://www.w3org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
fatal("Attribute \u201Cxmlns:xlink\u201D with a value other than \u201Chttp://www.w3.org/1999/xlink\u201D is not serializable as XML 1.0 without changing document semantics.");
break;
}
}

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

@ -51,6 +51,8 @@ public final class UTF16Buffer {
*/
private int end;
//[NOCPP[
/**
* Constructor for wrapping an existing UTF-16 code unit array.
*
@ -67,6 +69,8 @@ public final class UTF16Buffer {
this.end = end;
}
// ]NOCPP]
/**
* Returns the start index.
*

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

@ -159,6 +159,13 @@ const DB_BOOL_METADATA = ["visible", "active", "userDisabled", "appDisabled",
"softDisabled", "foreignInstall",
"hasBinaryComponents", "strictCompatibility"];
// Properties that should be migrated where possible from an old database. These
// shouldn't include properties that can be read directly from install.rdf files
// or calculated
const DB_MIGRATE_METADATA= ["installDate", "userDisabled", "softDisabled",
"sourceURI", "applyBackgroundUpdates",
"releaseNotesURI", "foreignInstall", "syncGUID"];
const BOOTSTRAP_REASONS = {
APP_STARTUP : 1,
APP_SHUTDOWN : 2,
@ -2643,24 +2650,16 @@ var XPIProvider = {
// If there is migration data then apply it.
if (aMigrateData) {
LOG("Migrating data from old database");
// A theme's disabled state is determined by the selected theme
// preference which is read in loadManifestFromRDF
if (newAddon.type != "theme")
newAddon.userDisabled = aMigrateData.userDisabled;
if ("syncGUID" in aMigrateData)
newAddon.syncGUID = aMigrateData.syncGUID;
if ("installDate" in aMigrateData)
newAddon.installDate = aMigrateData.installDate;
if ("softDisabled" in aMigrateData)
newAddon.softDisabled = aMigrateData.softDisabled;
if ("applyBackgroundUpdates" in aMigrateData)
newAddon.applyBackgroundUpdates = aMigrateData.applyBackgroundUpdates;
if ("sourceURI" in aMigrateData)
newAddon.sourceURI = aMigrateData.sourceURI;
if ("releaseNotesURI" in aMigrateData)
newAddon.releaseNotesURI = aMigrateData.releaseNotesURI;
if ("foreignInstall" in aMigrateData)
newAddon.foreignInstall = aMigrateData.foreignInstall;
DB_MIGRATE_METADATA.forEach(function(aProp) {
// A theme's disabled state is determined by the selected theme
// preference which is read in loadManifestFromRDF
if (aProp == "userDisabled" && newAddon.type == "theme")
return;
if (aProp in aMigrateData)
newAddon[aProp] = aMigrateData[aProp];
});
// Some properties should only be migrated if the add-on hasn't changed.
// The version property isn't a perfect check for this but covers the
@ -4476,61 +4475,47 @@ var XPIDatabase = {
// Attempt to migrate data from a different (even future!) version of the
// database
try {
// Build a list of sql statements that might recover useful data from this
// and future versions of the schema
var sql = [];
sql.push("SELECT internal_id, id, syncGUID, location, userDisabled, " +
"softDisabled, installDate, version, applyBackgroundUpdates, " +
"sourceURI, releaseNotesURI, foreignInstall FROM addon");
sql.push("SELECT internal_id, id, location, userDisabled, " +
"softDisabled, installDate, version, applyBackgroundUpdates, " +
"sourceURI, releaseNotesURI, foreignInstall FROM addon");
sql.push("SELECT internal_id, id, location, userDisabled, " +
"softDisabled, installDate, version, applyBackgroundUpdates, " +
"sourceURI, releaseNotesURI FROM addon");
sql.push("SELECT internal_id, id, location, userDisabled, " +
"installDate, version, applyBackgroundUpdates, " +
"sourceURI, releaseNotesURI FROM addon");
sql.push("SELECT internal_id, id, location, userDisabled, installDate, " +
"version FROM addon");
var stmt = this.connection.createStatement("PRAGMA table_info(addon)");
var stmt = null;
if (!sql.some(function(aSql) {
try {
stmt = this.connection.createStatement(aSql);
return true;
const REQUIRED = ["internal_id", "id", "location", "userDisabled",
"installDate", "version"];
let reqCount = 0;
let props = [];
for (let row in resultRows(stmt)) {
if (REQUIRED.indexOf(row.name) != -1) {
reqCount++;
props.push(row.name);
}
catch (e) {
return false;
else if (DB_METADATA.indexOf(row.name) != -1) {
props.push(row.name);
}
}, this)) {
else if (DB_BOOL_METADATA.indexOf(row.name) != -1) {
props.push(row.name);
}
}
if (reqCount < REQUIRED.length) {
ERROR("Unable to read anything useful from the database");
return migrateData;
}
stmt.finalize();
stmt = this.connection.createStatement("SELECT " + props.join(",") + " FROM addon");
for (let row in resultRows(stmt)) {
if (!(row.location in migrateData))
migrateData[row.location] = {};
migrateData[row.location][row.id] = {
internal_id: row.internal_id,
version: row.version,
installDate: row.installDate,
userDisabled: row.userDisabled == 1,
let addonData = {
targetApplications: []
};
}
migrateData[row.location][row.id] = addonData;
if ("syncGUID" in row)
migrateData[row.location][row.id].syncGUID = row.syncGUID;
if ("softDisabled" in row)
migrateData[row.location][row.id].softDisabled = row.softDisabled == 1;
if ("applyBackgroundUpdates" in row)
migrateData[row.location][row.id].applyBackgroundUpdates = row.applyBackgroundUpdates == 1;
if ("sourceURI" in row)
migrateData[row.location][row.id].sourceURI = row.sourceURI;
if ("releaseNotesURI" in row)
migrateData[row.location][row.id].releaseNotesURI = row.releaseNotesURI;
if ("foreignInstall" in row)
migrateData[row.location][row.id].foreignInstall = row.foreignInstall;
props.forEach(function(aProp) {
if (DB_BOOL_METADATA.indexOf(aProp) != -1)
addonData[aProp] = row[aProp] == 1;
else
addonData[aProp] = row[aProp];
})
}
var taStmt = this.connection.createStatement("SELECT id, minVersion, " +

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

@ -135,7 +135,7 @@ function run_test() {
stmt.execute();
stmt.finalize();
db.schemaVersion = 100;
db.schemaVersion = 10000;
Services.prefs.setIntPref("extensions.databaseSchema", 100);
db.close();

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

@ -0,0 +1,139 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Checks that we fail to migrate but still start up ok when there is a database
// with no useful data in it.
const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin";
var addon1 = {
id: "addon1@tests.mozilla.org",
version: "1.0",
name: "Test 1",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
var addon2 = {
id: "addon2@tests.mozilla.org",
version: "2.0",
name: "Test 5",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "0",
maxVersion: "0"
}]
};
var defaultTheme = {
id: "default@tests.mozilla.org",
version: "2.0",
name: "Default theme",
internalName: "classic/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
var theme1 = {
id: "theme1@tests.mozilla.org",
version: "2.0",
name: "Test theme",
internalName: "theme1/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}]
};
const profileDir = gProfD.clone();
profileDir.append("extensions");
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
writeInstallRDFForExtension(addon1, profileDir);
writeInstallRDFForExtension(addon2, profileDir);
writeInstallRDFForExtension(defaultTheme, profileDir);
writeInstallRDFForExtension(theme1, profileDir);
Services.prefs.setCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN, "theme1/1.0");
// Write out a broken database (no userDisabled field)
let dbfile = gProfD.clone();
dbfile.append("extensions.sqlite");
let db = AM_Cc["@mozilla.org/storage/service;1"].
getService(AM_Ci.mozIStorageService).
openDatabase(dbfile);
db.createTable("addon", "internal_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"id TEXT, location TEXT, version TEXT, active INTEGER, " +
"installDate INTEGER");
db.createTable("targetApplication", "addon_internal_id INTEGER, " +
"id TEXT, minVersion TEXT, maxVersion TEXT");
let stmt = db.createStatement("INSERT INTO addon VALUES (NULL, :id, :location, " +
":version, :active, :installDate)");
let internal_ids = {};
[["addon1@tests.mozilla.org", "app-profile", "1.0", "1", "0"],
["addon2@tests.mozilla.org", "app-profile", "2.0", "0", "0"],
["default@tests.mozilla.org", "app-profile", "2.0", "1", "0"],
["theme1@tests.mozilla.org", "app-profile", "2.0", "0", "0"]].forEach(function(a) {
stmt.params.id = a[0];
stmt.params.location = a[1];
stmt.params.version = a[2];
stmt.params.active = a[3];
stmt.params.installDate = a[4];
stmt.execute();
internal_ids[a[0]] = db.lastInsertRowID;
});
stmt.finalize();
db.schemaVersion = 100;
Services.prefs.setIntPref("extensions.databaseSchema", 100);
db.close();
startupManager();
check_startup_changes("installed", []);
check_startup_changes("updated", []);
check_startup_changes("uninstalled", []);
check_startup_changes("disabled", []);
check_startup_changes("enabled", []);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"default@tests.mozilla.org",
"theme1@tests.mozilla.org"],
function([a1, a2, d, t1]) {
do_check_neq(a1, null);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_true(a1.isActive);
do_check_neq(a2, null);
do_check_false(a2.userDisabled);
do_check_true(a2.appDisabled);
do_check_false(a2.isActive);
// Should have enabled the selected theme
do_check_neq(t1, null);
do_check_false(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_true(t1.isActive);
do_check_neq(d, null);
do_check_true(d.userDisabled);
do_check_false(d.appDisabled);
do_check_false(d.isActive);
do_test_finished();
});
}

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

@ -173,6 +173,7 @@ skip-if = os == "android"
[test_migrate2.js]
[test_migrate3.js]
[test_migrate4.js]
[test_migrate5.js]
[test_migrateAddonRepository.js]
[test_permissions.js]
[test_plugins.js]

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

@ -48,7 +48,6 @@ EXPORTS = \
nsIView.h \
nsIViewManager.h \
nsViewsCID.h \
nsIViewObserver.h \
nsIScrollPositionListener.h \
$(NULL)

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

@ -45,6 +45,7 @@
#include "nsNativeWidget.h"
#include "nsIWidget.h"
#include "nsWidgetInitData.h"
#include "nsIFrame.h"
class nsIViewManager;
class nsViewManager;
@ -62,8 +63,8 @@ enum nsViewVisibility {
};
#define NS_IVIEW_IID \
{ 0x7caf32d2, 0xd82a, 0x4b9f, \
{ 0x84, 0xc1, 0xbd, 0x20, 0xeb, 0x5c, 0x78, 0x55 } }
{ 0xda62efbf, 0x0711, 0x4b79, \
{ 0x87, 0x85, 0x9e, 0xec, 0xed, 0xf5, 0xb0, 0x32 } }
// Public view flags
@ -251,16 +252,14 @@ public:
}
/**
* Set the view's link to client owned data.
* @param aData - data to associate with view. nsnull to disassociate
* Set the view's frame.
*/
void SetClientData(void *aData) { mClientData = aData; }
void SetFrame(nsIFrame* aRootFrame) { mFrame = aRootFrame; }
/**
* Query the view for it's link to client owned data.
* @result data associated with view or nsnull if there is none.
* Retrieve the view's frame.
*/
void* GetClientData() const { return mClientData; }
nsIFrame* GetFrame() const { return mFrame; }
/**
* Get the nearest widget in this view or a parent of this view and
@ -399,7 +398,7 @@ protected:
nsIWidget *mWindow;
nsView *mNextSibling;
nsView *mFirstChild;
void *mClientData;
nsIFrame *mFrame;
PRInt32 mZIndex;
nsViewVisibility mVis;
// position relative our parent view origin but in our appunits

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

@ -46,11 +46,10 @@ class nsIWidget;
struct nsRect;
class nsRegion;
class nsDeviceContext;
class nsIViewObserver;
#define NS_IVIEWMANAGER_IID \
{ 0x144ef328, 0xbece, 0x43d6, \
{ 0xac, 0xac, 0x1a, 0x90, 0x4b, 0x5c, 0xc1, 0x11 } }
{ 0x1262a33f, 0xc19f, 0x4e5b, \
{ 0x85, 0x00, 0xab, 0xf3, 0x7d, 0xcf, 0x30, 0x1d } }
class nsIViewManager : public nsISupports
{
@ -59,7 +58,7 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IVIEWMANAGER_IID)
/**
* Initialize the ViewManager
* Note: this instance does not hold a reference to the viewobserver
* Note: this instance does not hold a reference to the presshell
* because it holds a reference to this instance.
* @result The result of the initialization, NS_OK if no errors
*/
@ -258,15 +257,15 @@ public:
NS_IMETHOD SetViewFloating(nsIView *aView, bool aFloatingView) = 0;
/**
* Set the view observer associated with this manager
* @param aObserver - new observer
* Set the presshell associated with this manager
* @param aPresShell - new presshell
*/
virtual void SetViewObserver(nsIViewObserver *aObserver) = 0;
virtual void SetPresShell(nsIPresShell *aPresShell) = 0;
/**
* Get the view observer associated with this manager
* Get the pres shell associated with this manager
*/
virtual nsIViewObserver* GetViewObserver() = 0;
virtual nsIPresShell* GetPresShell() = 0;
/**
* Get the device context associated with this manager

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

@ -1,157 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIViewObserver_h___
#define nsIViewObserver_h___
#include "nsISupports.h"
#include "nsEvent.h"
#include "nsColor.h"
#include "nsRect.h"
class nsRenderingContext;
class nsGUIEvent;
class nsIWidget;
class nsRegion;
class nsIntRegion;
#define NS_IVIEWOBSERVER_IID \
{ 0xac6eec35, 0x65d2, 0x4fe8, \
{ 0xa1, 0x37, 0x1a, 0xc3, 0xf6, 0x51, 0x52, 0x56 } }
class nsIViewObserver : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IVIEWOBSERVER_IID)
/* called when the observer needs to paint. This paints the entire
* frame subtree rooted at aViewToPaint, including frame subtrees from
* subdocuments.
* @param aViewToPaint the view for the widget that is being painted
* @param aWidgetToPaint the widget that is being painted, the widget of
* aViewToPaint
* @param aDirtyRegion the region to be painted, in appunits of aDisplayRoot
* and relative to aDisplayRoot
* @param aIntDirtyRegion the region to be painted, in dev pixels, in the
* coordinates of aWidgetToPaint. This conveys the same information as
* aDirtyRegion but in a different format.
* @param aPaintDefaultBackground just paint the default background,
* don't try to paint any content. This is set when the observer
* needs to paint something, but the view tree is unstable, so it
* must *not* paint, or even examine, the frame subtree rooted at the
* view. (It is, however, safe to inspect the state of the view itself,
* and any associated widget.) The name illustrates the expected behavior,
* which is to paint some default background color over the dirty region.
* @return error status
*/
NS_IMETHOD Paint(nsIView* aViewToPaint,
nsIWidget* aWidgetToPaint,
const nsRegion& aDirtyRegion,
const nsIntRegion& aIntDirtyRegion,
bool aPaintDefaultBackground,
bool aWillSendDidPaint) = 0;
/* called when the observer needs to handle an event
* @param aView - where to start processing the event; the root view,
* or the view that's currently capturing this sort of event; must be a view
* for this presshell
* @param aEvent - event notification
* @param aEventStatus - out parameter for event handling
* status
* @param aHandled - whether the correct frame was found to
* handle the event
* @return error status
*/
NS_IMETHOD HandleEvent(nsIView* aView,
nsGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus) = 0;
/* called when the view has been resized and the
* content within the view needs to be reflowed.
* @param aWidth - new width of view
* @param aHeight - new height of view
* @return error status
*/
NS_IMETHOD ResizeReflow(nsIView * aView, nscoord aWidth, nscoord aHeight) = 0;
/**
* Returns true if the view observer wants to drop all invalidation right now
* because painting is suppressed. It will invalidate everything when it
* unsuppresses.
*/
NS_IMETHOD_(bool) ShouldIgnoreInvalidation() = 0;
/**
* Notify the observer that we're about to start painting. This
* gives the observer a chance to make some last-minute invalidates
* and geometry changes if it wants to.
*/
NS_IMETHOD_(void) WillPaint(bool aWillSendDidPaint) = 0;
/**
* Notify the observer that we finished painting. This
* gives the observer a chance to make some last-minute invalidates
* and geometry changes if it wants to.
*/
NS_IMETHOD_(void) DidPaint() = 0;
/**
* Dispatch the given synthesized mouse move event, and if
* aFlushOnHoverChange is true, flush layout if :hover changes cause
* any restyles.
*/
NS_IMETHOD_(void) DispatchSynthMouseMove(nsGUIEvent *aEvent,
bool aFlushOnHoverChange) = 0;
/**
* If something within aView is capturing the mouse, clear the capture.
* if aView is null, clear the mouse capture no matter what is capturing it.
*/
NS_IMETHOD_(void) ClearMouseCapture(nsIView* aView) = 0;
/**
* Returns true if the view observer is visible in some way. Otherwise false.
*/
NS_IMETHOD_(bool) IsVisible() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIViewObserver, NS_IVIEWOBSERVER_IID)
#endif

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

@ -213,10 +213,9 @@ nsView::nsView(nsViewManager* aViewManager, nsViewVisibility aVisibility)
void nsView::DropMouseGrabbing()
{
nsCOMPtr<nsIViewObserver> viewObserver = mViewManager->GetViewObserver();
if (viewObserver) {
viewObserver->ClearMouseCapture(this);
}
nsIPresShell* presShell = mViewManager->GetPresShell();
if (presShell)
presShell->ClearMouseCaptureOnView(this);
}
nsView::~nsView()
@ -983,8 +982,8 @@ void nsIView::List(FILE* out, PRInt32 aIndent) const
nsRect brect = GetBounds();
fprintf(out, "{%d,%d,%d,%d}",
brect.x, brect.y, brect.width, brect.height);
fprintf(out, " z=%d vis=%d clientData=%p <\n",
mZIndex, mVis, mClientData);
fprintf(out, " z=%d vis=%d frame=%p <\n",
mZIndex, mVis, mFrame);
for (nsView* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
NS_ASSERTION(kid->GetParent() == this, "incorrect parent");
kid->List(out, aIndent + 1);

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

@ -158,7 +158,7 @@ nsViewManager::~nsViewManager()
gViewManagers = nsnull;
}
mObserver = nsnull;
mPresShell = nsnull;
}
NS_IMPL_ISUPPORTS1(nsViewManager, nsIViewManager)
@ -257,15 +257,15 @@ void nsViewManager::DoSetWindowDimensions(nscoord aWidth, nscoord aHeight)
if (!oldDim.IsEqualEdges(newDim)) {
// Don't resize the widget. It is already being set elsewhere.
mRootView->SetDimensions(newDim, true, false);
if (mObserver)
mObserver->ResizeReflow(mRootView, aWidth, aHeight);
if (mPresShell)
mPresShell->ResizeReflow(aWidth, aHeight);
}
}
NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight)
{
if (mRootView) {
if (mRootView->IsEffectivelyVisible() && mObserver && mObserver->IsVisible()) {
if (mRootView->IsEffectivelyVisible() && mPresShell && mPresShell->IsVisible()) {
if (mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
mDelayedResize != nsSize(aWidth, aHeight)) {
// We have a delayed resize; that now obsolete size may already have
@ -292,9 +292,8 @@ NS_IMETHODIMP nsViewManager::FlushDelayedResize(bool aDoReflow)
if (aDoReflow) {
DoSetWindowDimensions(mDelayedResize.width, mDelayedResize.height);
mDelayedResize.SizeTo(NSCOORD_NONE, NSCOORD_NONE);
} else if (mObserver) {
nsCOMPtr<nsIPresShell> shell = do_QueryInterface(mObserver);
nsPresContext* presContext = shell->GetPresContext();
} else if (mPresShell) {
nsPresContext* presContext = mPresShell->GetPresContext();
if (presContext) {
presContext->SetVisibleArea(nsRect(nsPoint(0, 0), mDelayedResize));
}
@ -410,9 +409,9 @@ void nsViewManager::RenderViews(nsView *aView, nsIWidget *aWidget,
NS_ASSERTION(GetDisplayRootFor(aView) == aView,
"Widgets that we paint must all be display roots");
if (mObserver) {
mObserver->Paint(aView, aWidget, aRegion, aIntRegion,
aPaintDefaultBackground, aWillSendDidPaint);
if (mPresShell) {
mPresShell->Paint(aView, aWidget, aRegion, aIntRegion,
aPaintDefaultBackground, aWillSendDidPaint);
mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
}
}
@ -602,8 +601,8 @@ static bool
ShouldIgnoreInvalidation(nsViewManager* aVM)
{
while (aVM) {
nsIViewObserver* vo = aVM->GetViewObserver();
if (!vo || vo->ShouldIgnoreInvalidation()) {
nsIPresShell* shell = aVM->GetPresShell();
if (!shell || shell->ShouldIgnoreInvalidation()) {
return true;
}
nsView* view = aVM->GetRootViewImpl()->GetParent();
@ -735,7 +734,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm)
{
pm->PopupResized(aView, nsIntSize(width, height));
pm->PopupResized(aView->GetFrame(), nsIntSize(width, height));
*aStatus = nsEventStatus_eConsumeNoDefault;
}
}
@ -754,7 +753,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm)
{
pm->PopupMoved(aView, aEvent->refPoint);
pm->PopupMoved(aView->GetFrame(), aEvent->refPoint);
*aStatus = nsEventStatus_eConsumeNoDefault;
}
}
@ -763,15 +762,15 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
case NS_DONESIZEMOVE:
{
nsCOMPtr<nsIPresShell> shell = do_QueryInterface(mObserver);
if (shell) {
nsPresContext* presContext = shell->GetPresContext();
if (mPresShell) {
nsPresContext* presContext = mPresShell->GetPresContext();
if (presContext) {
nsEventStateManager::ClearGlobalActiveContent(nsnull);
}
mObserver->ClearMouseCapture(aView);
}
nsIPresShell::ClearMouseCapture(nsnull);
}
break;
@ -786,7 +785,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
if (type == eWindowType_popup) {
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm) {
pm->HidePopup(aView);
pm->HidePopup(aView->GetFrame());
*aStatus = nsEventStatus_eConsumeNoDefault;
}
}
@ -827,7 +826,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
: nsnull) {
if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
vm->mRootView->IsEffectivelyVisible() &&
mObserver && mObserver->IsVisible()) {
mPresShell && mPresShell->IsVisible()) {
vm->FlushDelayedResize(true);
// Paint later.
@ -855,8 +854,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
nsView* view = static_cast<nsView*>(aView);
if (!transparentWindow) {
nsIViewObserver* observer = GetViewObserver();
if (observer) {
if (mPresShell) {
// Do an update view batch. Make sure not to do it DEFERRED,
// since that would effectively delay any invalidates that are
// triggered by the WillPaint notification (they'd happen when
@ -950,12 +948,12 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
case NS_SYSCOLORCHANGED:
{
// Hold a refcount to the observer. The continued existence of the observer will
// delay deletion of this view hierarchy should the event want to cause its
// destruction in, say, some JavaScript event handler.
nsCOMPtr<nsIViewObserver> obs = GetViewObserver();
if (obs) {
obs->HandleEvent(aView, aEvent, false, aStatus);
if (mPresShell) {
// Hold a refcount to the presshell. The continued existence of the observer will
// delay deletion of this view hierarchy should the event want to cause its
// destruction in, say, some JavaScript event handler.
nsCOMPtr<nsIPresShell> presShell = mPresShell;
presShell->HandleEvent(aView->GetFrame(), aEvent, false, aStatus);
}
}
break;
@ -980,24 +978,43 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
if (aEvent->message == NS_DEACTIVATE) {
// if a window is deactivated, clear the mouse capture regardless
// of what is capturing
nsIViewObserver* viewObserver = GetViewObserver();
if (viewObserver) {
viewObserver->ClearMouseCapture(nsnull);
nsIPresShell::ClearMouseCapture(nsnull);
}
// Find the view whose coordinates system we're in.
nsIView* view = aView;
bool dispatchUsingCoordinates = NS_IsEventUsingCoordinates(aEvent);
if (dispatchUsingCoordinates) {
// Will dispatch using coordinates. Pretty bogus but it's consistent
// with what presshell does.
view = GetDisplayRootFor(view);
}
// If the view has no frame, look for a view that does.
nsIFrame* frame = view->GetFrame();
if (!frame &&
(dispatchUsingCoordinates || NS_IS_KEY_EVENT(aEvent) ||
NS_IS_IME_RELATED_EVENT(aEvent) ||
NS_IS_NON_RETARGETED_PLUGIN_EVENT(aEvent) ||
aEvent->message == NS_PLUGIN_ACTIVATE ||
aEvent->message == NS_PLUGIN_FOCUS)) {
while (view && !view->GetFrame()) {
view = view->GetParent();
}
if (view) {
frame = view->GetFrame();
}
}
//Find the view whose coordinates system we're in.
nsView* baseView = static_cast<nsView*>(aView);
nsView* view = baseView;
if (NS_IsEventUsingCoordinates(aEvent)) {
// will dispatch using coordinates. Pretty bogus but it's consistent
// with what presshell does.
view = static_cast<nsView*>(GetDisplayRootFor(baseView));
}
if (nsnull != view) {
*aStatus = HandleEvent(view, aEvent);
if (nsnull != frame) {
// Hold a refcount to the presshell. The continued existence of the
// presshell will delay deletion of this view hierarchy should the event
// want to cause its destruction in, say, some JavaScript event handler.
nsCOMPtr<nsIPresShell> shell = view->GetViewManager()->GetPresShell();
if (shell) {
shell->HandleEvent(frame, aEvent, false, aStatus);
}
}
break;
@ -1007,24 +1024,6 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
return NS_OK;
}
nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent)
{
#if 0
printf(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports,
event->message, event->point.x, event->point.y);
#endif
// Hold a refcount to the observer. The continued existence of the observer will
// delay deletion of this view hierarchy should the event want to cause its
// destruction in, say, some JavaScript event handler.
nsCOMPtr<nsIViewObserver> obs = aView->GetViewManager()->GetViewObserver();
nsEventStatus status = nsEventStatus_eIgnore;
if (obs) {
obs->HandleEvent(aView, aEvent, false, &status);
}
return status;
}
// Recursively reparent widgets if necessary
void nsViewManager::ReparentChildWidgets(nsIView* aView, nsIWidget *aNewWidget)
@ -1568,9 +1567,9 @@ nsViewManager::CallWillPaintOnObservers(bool aWillSendDidPaint)
if (vm->RootViewManager() == this) {
// One of our kids.
if (vm->mRootView && vm->mRootView->IsEffectivelyVisible()) {
nsCOMPtr<nsIViewObserver> obs = vm->GetViewObserver();
if (obs) {
obs->WillPaint(aWillSendDidPaint);
nsCOMPtr<nsIPresShell> shell = vm->GetPresShell();
if (shell) {
shell->WillPaint(aWillSendDidPaint);
NS_ASSERTION(mUpdateBatchCnt == savedUpdateBatchCnt,
"Observer did not end view batch?");
}
@ -1590,9 +1589,9 @@ nsViewManager::CallDidPaintOnObservers()
if (vm->RootViewManager() == this) {
// One of our kids.
if (vm->mRootView && vm->mRootView->IsEffectivelyVisible()) {
nsCOMPtr<nsIViewObserver> obs = vm->GetViewObserver();
if (obs) {
obs->DidPaint();
nsCOMPtr<nsIPresShell> shell = vm->GetPresShell();
if (shell) {
shell->DidPaint();
}
}
}

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

@ -46,7 +46,7 @@
#include "nsVoidArray.h"
#include "nsThreadUtils.h"
#include "nsView.h"
#include "nsIViewObserver.h"
#include "nsIPresShell.h"
#include "nsDeviceContext.h"
@ -132,8 +132,8 @@ public:
NS_IMETHOD SetViewZIndex(nsIView *aView, bool aAuto, PRInt32 aZIndex, bool aTopMost=false);
virtual void SetViewObserver(nsIViewObserver *aObserver) { mObserver = aObserver; }
virtual nsIViewObserver* GetViewObserver() { return mObserver; }
virtual void SetPresShell(nsIPresShell *aPresShell) { mPresShell = aPresShell; }
virtual nsIPresShell* GetPresShell() { return mPresShell; }
NS_IMETHOD GetDeviceContext(nsDeviceContext *&aContext);
@ -244,8 +244,6 @@ public: // NOT in nsIViewManager, so private to the view module
nsViewManager* RootViewManager() const { return mRootViewManager; }
bool IsRootVM() const { return this == RootViewManager(); }
nsEventStatus HandleEvent(nsView* aView, nsGUIEvent* aEvent);
bool IsRefreshEnabled() { return RootViewManager()->mUpdateBatchCnt == 0; }
// Call this when you need to let the viewmanager know that it now has
@ -259,7 +257,7 @@ public: // NOT in nsIViewManager, so private to the view module
private:
nsRefPtr<nsDeviceContext> mContext;
nsIViewObserver *mObserver;
nsIPresShell *mPresShell;
// The size for a resize that we delayed until the root view becomes
// visible again.

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

@ -118,8 +118,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#endif
#define NS_IWIDGET_IID \
{ 0x32966f95, 0x89e0, 0x447a, \
{ 0x91, 0x8d, 0x58, 0x53, 0xd6, 0x99, 0x4a, 0x72 } }
{ 0xEAAF1019, 0x0CD8, 0x4DD8, \
{ 0xBE, 0xB9, 0x8D, 0x8D, 0xEB, 0x52, 0xFC, 0xF6 } }
/*
* Window shadow styles
@ -356,6 +356,14 @@ class nsIWidget : public nsISupports {
nsWidgetInitData *aInitData = nsnull,
bool aForceUseIWidgetParent = false) = 0;
/**
* Set the event callback for a widget. If a device context is not
* provided then the existing device context will remain, it will
* not be nulled out.
*/
NS_IMETHOD SetEventCallback(EVENT_CALLBACK aEventFunction,
nsDeviceContext *aContext) = 0;
/**
* Attach to a top level widget.
*
@ -398,7 +406,7 @@ class nsIWidget : public nsISupports {
/**
* Reparent a widget
*
* Change the widgets parent
* Change the widget's parent. Null parents are allowed.
*
* @param aNewParent new parent
*/

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

@ -705,26 +705,30 @@ nsChildView::SetParent(nsIWidget* aNewParent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NS_ENSURE_ARG(aNewParent);
if (mOnDestroyCalled)
return NS_OK;
// make sure we stay alive
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
// remove us from our existing parent
if (mParentWidget)
if (mParentWidget) {
mParentWidget->RemoveChild(this);
}
nsresult rv = ReparentNativeWidget(aNewParent);
if (NS_SUCCEEDED(rv))
mParentWidget = aNewParent;
if (aNewParent) {
ReparentNativeWidget(aNewParent);
} else {
[mView removeFromSuperview];
mParentView = nil;
}
mParentWidget = aNewParent;
if (mParentWidget) {
mParentWidget->AddChild(this);
}
// add us to the new parent
mParentWidget->AddChild(this);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
@ -744,7 +748,7 @@ nsChildView::ReparentNativeWidget(nsIWidget* aNewParent)
// we hold a ref to mView, so this is safe
[mView removeFromSuperview];
mParentView = newParentView;
mParentView = newParentView;
[mParentView addSubview:mView];
return NS_OK;

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

@ -897,15 +897,17 @@ nsWindow::GetDPI()
NS_IMETHODIMP
nsWindow::SetParent(nsIWidget *aNewParent)
{
if (mContainer || !mGdkWindow || !mParent) {
NS_NOTREACHED("nsWindow::SetParent - reparenting a non-child window");
if (mContainer || !mGdkWindow) {
NS_NOTREACHED("nsWindow::SetParent called illegally");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_ASSERTION(!mTransientParent, "child widget with transient parent");
nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
mParent->RemoveChild(this);
if (mParent) {
mParent->RemoveChild(this);
}
mParent = aNewParent;
@ -1002,6 +1004,10 @@ nsWindow::ReparentNativeWidgetInternal(nsIWidget* aNewParent,
NS_ABORT_IF_FALSE(!gdk_window_is_destroyed(aNewParentWindow),
"destroyed GdkWindow with widget");
SetWidgetForHierarchy(mGdkWindow, aOldContainer, aNewContainer);
if (aOldContainer == gInvisibleContainer) {
CheckDestroyInvisibleContainer();
}
}
if (!mIsTopLevel) {

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

@ -4668,17 +4668,7 @@ bool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
break;
case WM_SYSCOLORCHANGE:
if (mWindowType == eWindowType_invisible) {
::EnumThreadWindows(GetCurrentThreadId(), nsWindow::BroadcastMsg, msg);
}
else {
// Note: This is sent for child windows as well as top-level windows.
// The Win32 toolkit normally only sends these events to top-level windows.
// But we cycle through all of the childwindows and send it to them as well
// so all presentations get notified properly.
// See nsWindow::GlobalMsgWindowProc.
DispatchStandardEvent(NS_SYSCOLORCHANGED);
}
OnSysColorChanged();
break;
case WM_NOTIFY:
@ -8001,6 +7991,22 @@ nsWindow::HasBogusPopupsDropShadowOnMultiMonitor() {
return !!sHasBogusPopupsDropShadowOnMultiMonitor;
}
void
nsWindow::OnSysColorChanged()
{
if (mWindowType == eWindowType_invisible) {
::EnumThreadWindows(GetCurrentThreadId(), nsWindow::BroadcastMsg, WM_SYSCOLORCHANGE);
}
else {
// Note: This is sent for child windows as well as top-level windows.
// The Win32 toolkit normally only sends these events to top-level windows.
// But we cycle through all of the childwindows and send it to them as well
// so all presentations get notified properly.
// See nsWindow::GlobalMsgWindowProc.
DispatchStandardEvent(NS_SYSCOLORCHANGED);
}
}
/**************************************************************
**************************************************************
**

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

@ -443,6 +443,7 @@ protected:
LPARAM aLParam,
LRESULT *aRetValue);
void OnWindowPosChanging(LPWINDOWPOS& info);
void OnSysColorChanged();
/**
* Function that registers when the user has been active (used for detecting

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

@ -62,7 +62,6 @@
#include "nsIImageLoadingContent.h"
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "nsIViewObserver.h"
#include "nsRegion.h"
#include "nsGUIEvent.h"
#include "nsXULPopupManager.h"
@ -246,13 +245,7 @@ nsBaseDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
// capture. However, this gets in the way of determining drag
// feedback for things like trees because the event coordinates
// are in the wrong coord system, so turn off mouse capture.
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mSourceDocument);
if (doc) {
nsCOMPtr<nsIViewObserver> viewObserver = do_QueryInterface(doc->GetShell());
if (viewObserver) {
viewObserver->ClearMouseCapture(nsnull);
}
}
nsIPresShell::ClearMouseCapture(nsnull);
return NS_OK;
}

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

@ -250,6 +250,21 @@ nsBaseWidget::CreateChild(const nsIntRect &aRect,
return nsnull;
}
NS_IMETHODIMP
nsBaseWidget::SetEventCallback(EVENT_CALLBACK aEventFunction,
nsDeviceContext *aContext)
{
mEventCallback = aEventFunction;
if (aContext) {
NS_IF_RELEASE(mContext);
mContext = aContext;
NS_ADDREF(mContext);
}
return NS_OK;
}
// Attach a view to our widget which we'll send events to.
NS_IMETHODIMP
nsBaseWidget::AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction,

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

@ -165,6 +165,7 @@ public:
nsDeviceContext *aContext,
nsWidgetInitData *aInitData = nsnull,
bool aForceUseIWidgetParent = false);
NS_IMETHOD SetEventCallback(EVENT_CALLBACK aEventFunction, nsDeviceContext *aContext);
NS_IMETHOD AttachViewToTopLevel(EVENT_CALLBACK aViewEventFunction, nsDeviceContext *aContext);
virtual ViewWrapper* GetAttachedViewPtr();
NS_IMETHOD SetAttachedViewPtr(ViewWrapper* aViewWrapper);